PDA

View Full Version : QTreeWidget and expandall() function



MrGarbage
31st July 2007, 01:11
I am using QT 4.3 and using the expandall() function to expand all of the
items in a treewidget.
I have setup a signal/slot for itemexpanded and this function does get
called if I manually expand a tree node.
I need this to selectively bold some of the tree items.

I would like my function to be called for each expanded item as a result of
my Expandall() call but that does not happen.

How can I make the Expandall() generate the necessary tree item signals, or
if that is not possible, what is
the easiest way to iterate the tree items such that I can manually call my
function for the necessary items?

Many thanks!

Mark

marcel
31st July 2007, 23:49
See this post: http://www.qtcentre.org/forum/f-qt-programming-2/t-qtreewidget-parsing-data-7575.html

You will have to modify that function(actually add something to it) and expand every item in the hierarchy that has children. Really easy to do. You just have to call setExpanded(true) for the item in question.

You can use that function and pass as parameter the tree item that you want to be expanded. This will cause the item itself along with all its children to be expanded.

Regards