View Full Version : QTreeWidgetItem, 2+ icons
Ieshir
14th May 2014, 19:51
hello
how i can insert 2+ icons in 1 column of qtreewidgetitem?
skauert
15th May 2014, 08:31
Hi Ieshir.
One way of accomplishing this is to create a custom widget and inserting it under that column in place of the icons. You can then fill the widget with as many icons as you want.
http://qt-project.org/doc/qt-4.8/qtreewidget.html#setItemWidget
Ieshir
15th May 2014, 09:20
ty, but can't use this
all itemWidgets is ugly;) with my QSS
How i can do it with qstyleditemdelegate?
skauert
15th May 2014, 09:26
Unless I'm mistaken, using delegates directly requires implementing a model/view rather than just using one of the pre-made widgets. There's a complete example of how to set up a delegate here:
http://qt-project.org/doc/qt-4.8/itemviews-stardelegate.html
And an introduction to model/view here:
http://qt-project.org/doc/qt-4.8/modelview.html
However, I would've thought that styling the widget should be entirely in your control. Are you sure you cannot work with what you have?
anda_skoa
15th May 2014, 12:58
Unless I'm mistaken, using delegates directly requires implementing a model/view rather than just using one of the pre-made widgets.
No, that should be OK.
A QTreeWidget is a QTreeView, the items are basically just a different way of filling an internal model.
Cheers,
_
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.