How to refresh the data show after the model filtered by DelegateModel?
Unsolved
QML and Qt Quick
-
I have defined a model by QAbstractListModel, and show the data filtered by DelegateModel. The data in the items of the model is dynamic, and refreshes by a certain frequency. When the includeByDefault property of DelegateModelGroup is true, the data on the screen is changing correctly as the data of model is refreshing, but when includeByDefault is false and begin to filter the model, the data on the screen is still on the initial state.
Below is the code:DelegateModel{ id: displayedModel model: profModel delegate: dataDelegate groups: [ DelegateModelGroup{ includeByDefault: false//true name: "byAreaTitle" } ] filterOnGroup: "byAreaTitle" Component.onCompleted: { rowCount = profModel.rowCount(); items.remove(0, rowCount); for(var i=0; i<rowCount; i++) { entry1 = profModel.getEntry(profModel.index(i, 0)); if(entry1.titleBelong === columnTitle) items.insert(entry1,"byAreaTitle"); } } } GridView { id: gridArea width: parent.width - 2 anchors.top: cTitle.bottom anchors.bottom: parent.bottom anchors.topMargin: 10 anchors.horizontalCenter: parent.horizontalCenter cellHeight: 18 cellWidth: width / 10 model: displayedModel//profModel } Component{ id: dataDelegate WLValueShow{ vname: sndDisplayName value: displayStr unitName: unit } }
What is the situation, and how to solve this problem?
thanks.