I'm updating the qml Listview from c++ like;
in main.cpp;
listeci frmlisteci;
engine.rootContext()->setContextProperty("listeElemanlar", &frmlisteci.listeElemanlar);
in Liste.qml;
ListView{
id: listeciElemanlar
anchors.fill: parent
model: listeElemanlar
delegate: Text{
text: display
verticalAlignment: Text.AlignBottom
width : parent.width
color: textRengi
font.pointSize: 30
leftPadding: 20
}}
in listeci.h;
public:
QStringListModel listeElemanlar;
private:
QStringList userAyarlari;
in listeci.cpp;
listeci::listeci(QObject *parent) : QObject(parent)
{
// Kullanıcı ayarları elemanları
userAyarlari.append("Kullanıcı ayarı 01");
userAyarlari.append("Kullanıcı ayarı 02");
userAyarlari.append("Kullanıcı ayarı 03");
userAyarlari.append("Kullanıcı ayarı 04");
userAyarlari.append("Kullanıcı ayarı 05");
userAyarlari.append("Kullanıcı ayarı 06");
userAyarlari.append("Kullanıcı ayarı 07");
userAyarlari.append("Kullanıcı ayarı 08");
userAyarlari.append("Kullanıcı ayarı 09");
userAyarlari.append("Kullanıcı ayarı 10");
userAyarlari.append("Kullanıcı ayarı 11");
userAyarlari.append("Kullanıcı ayarı 12");
userAyarlari.append("Kullanıcı ayarı 13");
userAyarlari.append("Kullanıcı ayarı 14");
userAyarlari.append("Kullanıcı ayarı 15");
userAyarlari.append("Kullanıcı ayarı 16");
userAyarlari.append("Kullanıcı ayarı 17");
userAyarlari.append("Kullanıcı ayarı 18");
userAyarlari.append("Kullanıcı ayarı 19");
}
void listeci::listeGuncelle()
{
listeElemanlar.setStringList(userAyarlari);
}
with these lines, I can successfully create a list and show on qml Listview, when I clicked on a button on qml side by calling
frmlisteci.listeGuncelle()
But when I do this procedure after a mount,( we can say refreshing the list) the code becoming slow, and waiting on this line:
listeElemanlar.setStringList(userAyarlari);
What can be the reason ?
I discovered that the problem is causing by stackview....
I'm navigating between the pages by stackview.pop. I changed the pop to replace and the problem solved....