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 add Combobox at the top of treeview
Forum Updated to NodeBB v4.3 + New Features

How to add Combobox at the top of treeview

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.
  • I Offline
    I Offline
    Indrajeet
    wrote on last edited by
    #1

    Hi All

    I want to add the combobox at the top of tree view and depending upon the selection of the items from that combobox
    I want to show different treeviews how to do this?

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

      One way is to use a [[doc:QStackedWidget]], and create a page with a QTreeView for each of the items in your combobox. Then, let the selectedIndex of the combobox determine the currentIndex() of the widget stack.

      Or, if it really is the model in the view you'd like to change, do exactly that: use a single QTreeView, and simply add a bit of code to change the model you're using for the view based on the selected item in the combo box.

      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