PDA

View Full Version : Combining expandable items in QListView - is it possible?



yossi.gohar@ceva-dsp.com
23rd October 2011, 17:15
Hi all

I'm not so experienced in QT, and I have a dilemma for quite time now.
I'll explain my dilemma.
I have data that I need to display. My data consists of items, and each item has a name and a value. The value of each item can be updated and the view needs to show those updates.
In general the data is divided into two types, the first type is a standalone item (that does not have any "children"), and the second type, is an item that has sub-items (or "children"), these items also have a name and a value.

I tried to display the data using a QTreeView, but because I have many items to display, the tree becomes a long list, and this forces me to scroll back-and-forth to view the entire list and detect the items that were updated. These changes might be not so hard to detect, because I mark the updated items with different color, but I think the QTreeView is not the perfect view to use.
Then I tried to display the data using a QListView, and setting the flow direction to be QListView::LeftToRight, this functionality spared the need of scrolling the entire view, and another thing that I liked is that when the QListWidget (that holds the QListView) changes its size, the items are re-organized exactly as I want them to be. But now I cannot expand items that can be expanded.

Another solution that I came across with is using the Q3ListView, but using this I get some compilation errors that I don't want to deal with, and my project is a brand new one, so I'd like to use QT4 for the entire project code.

I'm using QT4 (4.7.4) with Microsoft's Visual Studio 2008.

Can anyone think of a solution to my problem?
Did I forget to mention that the value of the items can also be manually updated? Well they can be updated..

I don't want to start implementing new customized views, and frankly I'm not sure I know where to start... :(

I'd appreciate any help.

Yossi