Unsolved Pixmap in QTreeWidget
-
Hi!
I simply want to palce a pixmap into a QTreeWidgetItem instead of text.
Like implementing a function "setPixmap()" instead of setText().
But where to start?Thanks a lot,
Klaus! -
hi @klausix and welcome
ok, what I think you're doing is using the QTreeWidget and you want to populate it with custom TreeWidget items.
It is possible, but not trivial, and therefore I would suggest to take the extra time, and understand/learn Qt's model/view approach with delegates. And start using QTreeView.
It will be more setup but it will run smoother and more reliable
Take a look at this example
https://doc.qt.io/qt-5/qtwidgets-itemviews-editabletreemodel-example.html -
@klausix You can set an icon. Do you really need a pixmap?
-
@jsulm well, think I also could live with an icon!
I just didn’t notice this function in the class-reference.
Thanks for the hint, gonna try!