QTableWidget in a QTreeWidget
-
Interesting, what do you mean about standard tree ?
-
A tree like [[doc:QTreeView]] provides you.
-
Oh ok i did not know that a QTreeView was more "standard" than a QTreeWidget i though it was the opposite. So you think using this kind of tree will solve my problem ? I just need to put some text and widgets in the tree.
Thank you ! -
The need to put widgets in the tree is the problem. That is going to be hard to do well and make perform well. Note that QTreeView is the base class of QTreeWidget. QTreeWidget just adds a buid-in model.
So no, QTreeView will not help you do that, even though there is the setIndexWidget method in [[doc:QAbstractItemView]]. That might work for you, but it is not what I call model-view programming.
-
[quote author="silver356" date="1343293698"]Hi everybody,
If i display anything but a QTableWidget i have no issue but with a table i have a weird flickering effect when i move my mouse over the QTreeWidgetItem its background is often paint over the table and i don't know why :(
[/quote]
Back to the initial problem.
The flickering might be caused by the standard style settings for the treeview. Try to change the QStyleSheet for your treeview (especially the setting for QTreeView::item:hover).
Have a look at "this example":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qtreeview. Maybe if you change the setting for QTreeView::item:hover to nothing, or something different then the standard setting, this might solve the flickering problem. -
Thank you but it does not seem to work :/
One weird thing is that when i manually change something in my table (add a value for instance), it draws correctly untill the table release !
-
Sorry it didn't help. But as Andre already mentioned doing a Widget in a Table- Tree- or Whatever-View is not as trivial as it might seem at first glance.
= / -
Ok thank you both for your very useful help. I think i will try to handle a hierarchy directly through a table i suppose it will avoid those kind of bugs, no ?
-
Do you know how the Property Editor in QtDesigner is done ? What kind of container is it ? Its cell seems to be able to contain QWidget.
-
I'd suggest you get yourself the sources for QtDesigner, and have a look. The widgets it contains are the same widgets any item view can contain: editors for the items you're editing. That's why you first have to start an edit before you can even check or uncheck a checkbox in that editor, or before you can change an integer.