KeineAhnung
4th May 2014, 21:28
Hi there,
I have put several tasks in a QList and when the task is done it shall be deleted form the list. If I do
iniTextList.removeFirst();
ui->iniList->setModel(new QStringListModel(iniTextList));
the first element disappears but iniList.count(); still gives me the initial number of elements. I guess removeFirst() does not "shrink" the list, the list still got n values just the first is empty and therefore not displayed. Is there a way to shorten the list?
[EDIT]
Sorry for the post! I just realized that I was deleting elements from the view and counted the elements of the underlying list.
I have put several tasks in a QList and when the task is done it shall be deleted form the list. If I do
iniTextList.removeFirst();
ui->iniList->setModel(new QStringListModel(iniTextList));
the first element disappears but iniList.count(); still gives me the initial number of elements. I guess removeFirst() does not "shrink" the list, the list still got n values just the first is empty and therefore not displayed. Is there a way to shorten the list?
[EDIT]
Sorry for the post! I just realized that I was deleting elements from the view and counted the elements of the underlying list.