How can I add button inside treewidget/view?
Gokhan last edited by Gokhan
I wanna do a thing like the below image. A button (tool button) and text have to be in one cell. How can I do this? Which widget should I use Treewidget or treeview?
Hi! The image-upload feature on our forum is broken, you might see the images you uploaded but other users don't. Please upload your images to an image hoster of your choice, e.g. https://postimage.io/, and embed them here with the following markup:
@VRonin I guess it can be seen now?
Treewidget is just a treeview with an embedded model.
What you need is a delegate, see http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
@VRonin It is a very complicated example, I really don't understand anything.
Ok, let's start from the overview of the framework: http://doc.qt.io/qt-5/model-view-programming.html
The delegate is then a helper class to change how the View display data.
I like the info here
Delegates are the way to do it as they offer far better performance.
However, there is also poor mans way using a
which allows to insert normal widget into a cell
This get heavy fast if not on Desktop pc.
So its better to spend some days reading about views and delegates than a fast hax.
@mrjj thank you. I did it easily after read your shared links. They're really good documents to get started with.