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. Itemview (ProxyModel)
Forum Updated to NodeBB v4.3 + New Features

Itemview (ProxyModel)

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

    Is this possible can I ask my proxymodel to give my view only child elements of given parent index.

    I have two view, mytreeview->setModel(originalModel) other view is myTableview->setModel(proxyModel), proxyModel->setSourceModel(originalModel).

    Now some how I want my proxy model to give me only data of child items , is this possible at all ? is there any way I can give parentIndex to my proxy ??

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      You can build a proxy model that does that, but none of the standard proxy models work that way. There is no standard functionality to do this.

      However, you can also use the view to do the work for you. Just set the correct modelIndex as the root index for the table view. If you want to display only children of the currently selected item in the tree view, you get that item's model index, map it to the corresponding index in the proxy (using one of the proxy model mapping methods), and set the resulting index as the root index for your table view.

      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