Wysota,
Thanks for the reply. Let me explain what I'm trying to create. It is basically a list of titles which can be collapsed or expanded, just like in a tree. All these title contain some attributes with their value. It should look something like this:
(-) SOMEWHAT LONG TITLE
attribute1 La lalal
attribute2 Chah chah cha
attribute3 tralalala
(+) EVEN A MUCH LONGER TITLE
(+) SOME MORE TITLE
(-) AGAIN A TITLE THAT COULD BECOME QUITE LONG
attribute1 Some value
attribute2 Flop Flop
attribute8 Chop Chop
attribute12 More nonsense
attribute12 Gibberish
.
.
.
(+) ALMOST LAST TITLE
(+) THE LAST TITLE
(-) SOMEWHAT LONG TITLE
attribute1 La lalal
attribute2 Chah chah cha
attribute3 tralalala
(+) EVEN A MUCH LONGER TITLE
(+) SOME MORE TITLE
(-) AGAIN A TITLE THAT COULD BECOME QUITE LONG
attribute1 Some value
attribute2 Flop Flop
attribute8 Chop Chop
attribute12 More nonsense
attribute12 Gibberish
.
.
.
(+) ALMOST LAST TITLE
(+) THE LAST TITLE
To copy to clipboard, switch view to plain text mode
So I'd have about 20 of these titles that could be collapsed. Sounds like the perfect job for a tree view, I thought. I tried that, but as I the TreeItems cannot span columns (I think), I got the following result (my titles get cut off):
(-) SOMEWHAT LON...
attribute1 La lalal
attribute2 Chah chah cha
attribute3 tralalala
(+) EVEN A MUCH ...
(+) SOME MORE TITLE
(-) AGAIN A TITL...
attribute1 Some value
attribute2 Flop Flop
attribute8 Chop Chop
attribute12 More nonsense
attribute12 Gibberish
.
.
.
(+) ALMOST LAST ...
(+) THE LAST TITLE
(-) SOMEWHAT LON...
attribute1 La lalal
attribute2 Chah chah cha
attribute3 tralalala
(+) EVEN A MUCH ...
(+) SOME MORE TITLE
(-) AGAIN A TITL...
attribute1 Some value
attribute2 Flop Flop
attribute8 Chop Chop
attribute12 More nonsense
attribute12 Gibberish
.
.
.
(+) ALMOST LAST ...
(+) THE LAST TITLE
To copy to clipboard, switch view to plain text mode
So I implemented the titles myself as a inherited QLabel and added a TableView for each title to represent the attributes. Everything works very fast: scrolling, editing, resizing the mainwindow, ... I added a button that collapses all titles at the same time (using hide). This worked really fast as well. Next I added a button to expand all collapsed titles in one go. This was sloooow. The time between button push and final result was long, but what was worse: you can see the table widgets being drawn and expanded. This takes about 3 to 4 seconds on my machine.
I have also tried implementing the attributes with a Tree and with just QLabels and QLineInput, but it didn't help much when I restored the hidden widgets with show().
So, maybe you can tell me if there is a better way to implement what I'm trying to do? I have looked at all the available widgets and Tabs/Stacked/Tool boxes are really cool, but they take away the overview the user needs to have of all the attributes.
So, the only thing I can think of right now is reimplementing the painting routine of the QTree in order to have my titles take up the full width of the tree, instead of just the first column. Would that be feasible or just a mad newbie idea?
Apparently Jambi (QT in Java) already has this functionality in QTreeWidgetItem, although I don't really understand the description completely:
public final void setSpanning(boolean span)
Sets the first section to span all columns if expand is true, otherwise all item sections are shown.
public final void setSpanning(boolean span)
Sets the first section to span all columns if expand is true, otherwise all item sections are shown.
To copy to clipboard, switch view to plain text mode
Maybe this is something we can expext on a next version of QT for C++?
Help!
p
Bookmarks