Solved How can I add button inside treewidget/view?
-
Hi everyone,
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:
![alternate text](url)
. -
@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
-
@Gokhan
Hi
Sadly the model & view concept in Qt is not super easy to get started with.
http://doc.qt.io/qt-5/model-view-programming.htmlThe delegate is then a helper class to change how the View display data.
I like the info here
http://www.informit.com/articles/article.aspx?p=1405547&seqNum=4Delegates are the way to do it as they offer far better performance.
However, there is also poor mans way using a
Treewidget and
http://doc.qt.io/qt-5/qlistwidget.html#setItemWidgetwhich allows to insert normal widget into a cell
BUT
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.