Is there any signal to notify once all the items of the list are loaded?
-
Hi,
I am making a sample list, and adding button to it form my .cppListView { id: list width: 180; height: 200 delegate: Button { width: 180; height: 40 //assigning few properties } }
From my .cpp I am clearing the list and again adding items. Is there any signal that I can check every time the list is refreshed, and all items are added successfully?
Also what is the order of property update of list button and list view. -
@darpita_7 I think you can check that in
onCountChanged
handler. If count equals to model's count then all are loaded. -
@darpita_7 Did you add it inside
ListView
? -
@darpita_7 That is strange. Can you post an example ?
-
@darpita_7 Can you post a small example ?
-
@Viet
void modifying_list()
{
QAbstractListModel _model;
QQuickItem* list = findChild("list");
if(list)
{
list->setProperty("model",QVariant::fromValue(&_model));
}_model.beginInsertRows(x,y,z); //adding some data here, where x,y,z are the expected values
endInsertRows();
//once added trying to clear the list_model.beginRemoveRows(x,y,z);// trying to remove the added items,
_model.endRemoveRows();
}This is just a sample code.
-
@Viet Also
QAbstractListModel
is supposed to be subclassed and not used directly.QAbstractListModel provides a standard interface for models that represent their data as a simple non-hierarchical sequence of items. It is not used directly, but must be subclassed.