Unsolved Is there any signal to notify once all the items of the list are loaded?
-
I am not getting the onCountChanged signal in my qml
-
@darpita_7 Did you add it inside
ListView
? -
@p3c0
Yes i added it inside the list view -
@darpita_7 That is strange. Can you post an example ?
-
I don't see any model ?
-
@Viet yes, so i am adding the button to the model, and assigning the model in cpp.
Then i am clearing the same model. -
@darpita_7 Can you post a small example ?
-
Were you using QAbstractListModel then?
If so, you also have to notify the view about the change in C++ (ex: use beginInsertRows(), endInsertRows() etc) -
@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.
-
The _model will be deleted once it gets out of scope !
Other than that I don't see anything wrong here. -
@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.