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. QTableWidget in a QTreeWidget
Forum Updated to NodeBB v4.3 + New Features

QTableWidget in a QTreeWidget

Scheduled Pinned Locked Moved General and Desktop
15 Posts 4 Posters 10.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.
  • S Offline
    S Offline
    silver356
    wrote on last edited by
    #6

    Interesting, what do you mean about standard tree ?

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

      A tree like [[doc:QTreeView]] provides you.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        silver356
        wrote on last edited by
        #8

        Oh ok i did not know that a QTreeView was more "standard" than a QTreeWidget i though it was the opposite. So you think using this kind of tree will solve my problem ? I just need to put some text and widgets in the tree.
        Thank you !

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

          The need to put widgets in the tree is the problem. That is going to be hard to do well and make perform well. Note that QTreeView is the base class of QTreeWidget. QTreeWidget just adds a buid-in model.

          So no, QTreeView will not help you do that, even though there is the setIndexWidget method in [[doc:QAbstractItemView]]. That might work for you, but it is not what I call model-view programming.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            KA51O
            wrote on last edited by
            #10

            [quote author="silver356" date="1343293698"]Hi everybody,
            If i display anything but a QTableWidget i have no issue but with a table i have a weird flickering effect when i move my mouse over the QTreeWidgetItem its background is often paint over the table and i don't know why :(
            [/quote]
            Back to the initial problem.
            The flickering might be caused by the standard style settings for the treeview. Try to change the QStyleSheet for your treeview (especially the setting for QTreeView::item:hover).
            Have a look at "this example":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qtreeview. Maybe if you change the setting for QTreeView::item:hover to nothing, or something different then the standard setting, this might solve the flickering problem.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              silver356
              wrote on last edited by
              #11

              Thank you but it does not seem to work :/

              One weird thing is that when i manually change something in my table (add a value for instance), it draws correctly untill the table release !

              1 Reply Last reply
              0
              • K Offline
                K Offline
                KA51O
                wrote on last edited by
                #12

                Sorry it didn't help. But as Andre already mentioned doing a Widget in a Table- Tree- or Whatever-View is not as trivial as it might seem at first glance.
                = /

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  silver356
                  wrote on last edited by
                  #13

                  Ok thank you both for your very useful help. I think i will try to handle a hierarchy directly through a table i suppose it will avoid those kind of bugs, no ?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    silver356
                    wrote on last edited by
                    #14

                    Do you know how the Property Editor in QtDesigner is done ? What kind of container is it ? Its cell seems to be able to contain QWidget.

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

                      I'd suggest you get yourself the sources for QtDesigner, and have a look. The widgets it contains are the same widgets any item view can contain: editors for the items you're editing. That's why you first have to start an edit before you can even check or uncheck a checkbox in that editor, or before you can change an integer.

                      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