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. Hide specific QStandardItem in QStandarItemModel based on some property
Forum Updated to NodeBB v4.3 + New Features

Hide specific QStandardItem in QStandarItemModel based on some property

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.9k 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.
  • N Offline
    N Offline
    nnafridi
    wrote on last edited by
    #1

    @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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

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

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      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