PDA

View Full Version : QtreeWidget



h4harman
27th May 2015, 15:51
Hello,

I'm trying to expand and collapse the tree when the QtreeWidget is checked or unchecked respectively.

I've tried to implement in two ways:

1. Trying to see what the checkState is and then setExpanded true or fales. Which dosen't work.
2. I tried to add the click signal on the treewidget , but as it's a treeWidget connect only takes QtObject and not QtTreeWidget.

Any help would be appreciated.

Thank you.

anda_skoa
27th May 2015, 17:00
2. I tried to add the click signal on the treewidget , but as it's a treeWidget connect only takes QtObject and not QtTreeWidget.

all widgets are QObject derived classes because QWidget is

Cheers,
_

h4harman
27th May 2015, 17:19
So I tried to do something like this:


connect(treeWidget, SIGNAL(itemClicked(RootWidget,0)),this,SLOT(Expand (RootWidget)));


but then nothing happens. I guess itemClicked is not the signal I need. I'm not sure, how to implement a slot if the item is checked. If the itemClicked signal is not right?

anda_skoa
27th May 2015, 22:07
itemClicked() is a signal of QTreeWidget, but your SIGNAL macro does not contain that signal's signature.



SIGNAL(itemClicked(QTreeWidgetItem*, int))


Cheers,
_