View Full Version : QTreeWidget refeshing view

10th August 2009, 10:54

I have a problem with QTreeWidget, I insert into QTreeWidget some widgets like QDoubleSpinBox or QLineEdit. When I try to hide them everything is ok since I don't resize the window or minimalize it, then all hiden widget from QTreeWidget are shown. Do you have any idea how to hide widget insert in QTreeWidget?

10th August 2009, 11:00
if you use delegates in a table widget then everything should work, because delegate keep track on editors. so, if you navigate from opened editor it will be hidden.

10th August 2009, 14:07
Can you explain me this? Now I using QTreeWidget and metod setItemWidget to set widget, how should I use delegates?

10th August 2009, 15:31
if you are using those widgets as editors for data shown in treeView than you should use custom delegate and it's QAbstractItemDelegate::createEditor() and related methods.
You can find an example in Qt Examples & Demos -> Item Views -> Spin Box Delegate
to play a bit with sample application, and to open documentation (which can be also found here (http://doc.qtsoftware.com/4.5/itemviews-spinboxdelegate.html)).