Hide specific QStandardItem in QStandarItemModel based on some property



  • @QStandardItemModel *dataModel=new QStandardItemModel(this);

    QStandardItem *simpleItem=new QStandardItem("simple");

    dataModel.appendRow(simpleItem);
    QStandardItem *complexItem=new QStandardItem("complex");

    dataModel.appendRow(complexItem):

    QTreeView *simpleTreeView=new QTreeView();
    simpleTree.setModel(dataModel);

    QTreeView *complexTreeView=new QTreeView();
    complexTreeView.setModel(dataModel);

    @

    now I want to show simpleItem in simpleTreeView and hide all complexItem inserted.
    And hide all simpleItem in complexTreeView vice verse.

    Any suggestion, Solution?



  • Hi,

    try using "QSortFilterProxyModel":http://qt-project.org/doc/qt-5/qsortfilterproxymodel.html


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.