Hello,
I have an C++ based application which exports a data model to the DeclarativeContext. Displaying the data works fine what I miss is how to update single members of the dataModel from QML and request an update of the ListView which dipslays the data. Can anybody tell me what the correct way to do this.
What I already tried is to provide some public slots on the dataModel and use the slots to update update the underlying list inside my DataModel and force an refresh but it works very slowly and seems not to be the correct way
QML
myModel.setColor(selectedIdInput.text, selectedColorInput.text);
myModel.refresh();
C++
void MyModel::refresh()
{
beginResetModel();
endResetModel();
}
void MyModel::setColor(int index, QVariant id)
{
_pMyDataList->at(index)->setColor(id.toString());
}
Can anybody tell me a better way?
I’m using QtQuick 1.1 with Qt 4.8.8.
Thanks Michael
↧