[Qt-interest] Adding the check box and widget to the zeroth column in QTreeWidget
srikanth bemineni
bemineni.srikanth at gmail.com
Fri Apr 22 06:22:53 CEST 2011
Hi,
I have a tree view and and first column needs to have a check box. I also
need to add a widget to the same column
Here is my sample code
QTreeWidgetItem* item = new QTreeWidgetItem(myTreeWidget);
item->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
QLabel label = new QLabel("Hello") ;
//Here I am adding only a label but in my code I am adding some composite
widget which is made up of multiple labels and QTextboxes for word wraping
myTreeWidget->setItemWidget(item , 0 , label);
In this case I do get a check box but i am not able to click the check
boxes. It doesn't even generate the itemchanged() signal from the tree
widget.
How can I put my widget in the 0 columns and as well as use the
functionality of the checkbox in the QTreeWidget.
The alternative that I am thinking of , if Qtreewidget checkbox is not an
option and is a limitation in the above mentioned scenario
I will keep a Qcheckbox in my widget and generate the state change from it.
But I would really like to get feed back on this before I go ahead changes
which requires requires modifying a lot of code at multiple places.
Thank you in advance
With Regards
Srikanth Bemineni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110421/816aa3f0/attachment.html
More information about the Qt-interest-old
mailing list