Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, January 2007
Set QTreeWidgetItem always expanded


Message 1 in thread

Hi Everyone,
I have a QTreeWidget and it has many QTreeWidgetItem inside. I want
to make all QTreeWidgetItem keeps "expanded" when I double click
on them.

In QT, double click on closed QTreeWidgetItem will expand it. But double
click on expanded QTreeWidgetItem will close it.

I can't find any option in QTreeWidget allow me to do what I want. So I do
it myself :

class_A* object_A=new class_A();
connect(pTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
        object_A, SLOT(_ActivateTreeItem(QTreeWidgetItem*, int)));

void class_A::_ActivateTreeItem(QTreeWidgetItem* pTreeItem, int)
{
    pTreeWidget->setItemExpanded(pTreeItem, TRUE);
}


But this won't work. Moreover, the QTreeWidgetItem always keeps
closed after my double click.

So I change to

    pTreeWidget->setItemExpanded(pTreeItem, FALSE);

Then I found it works. But it looks very strange to me because I set
QTreeWidgetItem expanded to "FALSE" not "TRUE".

Could anybody tell me ?

Regards,
Pagan


--
 [ signature omitted ]