Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to refresh the data show after the model filtered by DelegateModel, the model is defined by QAbstractListModel.

How to refresh the data show after the model filtered by DelegateModel, the model is defined by QAbstractListModel.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 241 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kongkong
    wrote on last edited by
    #1

    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.
    What is the situation, and how to solve this problem?
    thanks.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kongkong
      wrote on last edited by
      #2

      Below is the code:

         DelegateModel{
              id: displayedModel
              model: profModel
      
              delegate: dataDelegate
              groups: [
                  DelegateModelGroup{
                      includeByDefault: true//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
              }
          }
      

      Do I have something wrong with it?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Please don't post the same question in multiple sub-forum. One is enough

        Duplicates

        Closing

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved