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. I want to hide a specific node in QTreeView - C++ - QT
Forum Updated to NodeBB v4.3 + New Features

I want to hide a specific node in QTreeView - C++ - QT

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 514 Views
  • 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.
  • D Offline
    D Offline
    developer_96
    wrote on last edited by
    #1

    Hello,
    i want to hide a specific node in QTreeView.
    For example i have a node called "Positions" in my QTreeView. I want to hide this node, so that the user can't see it by his name.
    Is it possible? And if yes it is possible with the name or only with the index?

    Regards

    JonBJ 1 Reply Last reply
    0
    • D developer_96

      Hello,
      i want to hide a specific node in QTreeView.
      For example i have a node called "Positions" in my QTreeView. I want to hide this node, so that the user can't see it by his name.
      Is it possible? And if yes it is possible with the name or only with the index?

      Regards

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @developer_96
      Well, I don't know if this is the best way, but you can always use a QSortFilterProxyModel to filter data items out. Might depend on what kind of "hide" you mean in a treeview.

      1 Reply Last reply
      2
      • D Offline
        D Offline
        developer_96
        wrote on last edited by
        #3

        With "hide" i want to achive that the user can't see the whole node i want to hide. I look to QSortFilterProxyModel i think with that i can be solved :)

        JonBJ 1 Reply Last reply
        0
        • D developer_96

          With "hide" i want to achive that the user can't see the whole node i want to hide. I look to QSortFilterProxyModel i think with that i can be solved :)

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @developer_96
          If it is a node and you want its children to be filtered out too, you may need to set setRecursiveFilteringEnabled(true).
          UPDATE
          Or, you might not want that, and better left on default setRecursiveFilteringEnabled(false)?!

          1 Reply Last reply
          0
          • D Offline
            D Offline
            developer_96
            wrote on last edited by
            #5

            Thank you @JonB that is exactly what i want, to filter the node with its children out.

            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