PDA

View Full Version : qml QListview updating slow



bladekel
6th January 2020, 09:05
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 ?