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. Table & tree widgets and their flexibility
Forum Updated to NodeBB v4.3 + New Features

Table & tree widgets and their flexibility

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 2.3k 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.
  • B Offline
    B Offline
    brainchild
    wrote on last edited by
    #1

    I am new to Qt, having written GUIs only in Java Swing (and Java AWT before that).

    I am considering using Qt for a desktop application that has the requirement of displaying a multi-column tree widget such that one column displays an icon, and when clicked, that icon changes, allowing the user to cycle through several options.

    My first question is simply which widget do I use for multi-column trees?: tree widget, table widget, or something else. The second is whether the above described behavior is possible under Qt.

    Thank you.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      beemaster
      wrote on last edited by
      #2

      You would probably have a hard time doing this in Qt, but this is possible. Check "QTreeView":http://qt-project.org/doc/qt-4.8/qtreeview.html

      1 Reply Last reply
      0
      • B Offline
        B Offline
        broadpeak
        wrote on last edited by
        #3

        In Qt:
        QTreeWidget is for relatively little dataset.
        If you have large dataset you should use QTreeView (this is an MVC approach).

        1 Reply Last reply
        0
        • B Offline
          B Offline
          brainchild
          wrote on last edited by
          #4

          I definitely would want the MVC approach.

          As beemaster says the changing icons is difficult but possible, can someone please provide more information, including a code snippet if one is available? This would help greatly.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            broadpeak
            wrote on last edited by
            #5

            The Qt directory has an Example directory, try to search there after the QTreeView (c:\Qt\4.8.3\examples.. or similar).

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

              Not all that hard at all. You'd use a QTreeView on a custom QAbstractItemModel derived model. For the cycling through the icons, you might either use a custom delegate, or use the clicked signal and modify the model outside of the model/view context.
              Getting a tree model right is tricky, but what you want to achieve is certainly possible.

              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