Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
New representation (View) of a QStandardItemModel
I´m currently developing a program for creating trees. This itself wouldn´t be a problem, BUT:
I´m using the QStandardItemModel, that is totally enough for my needs.
I would like to create a widget, displaying the tree like shown in this IMAGE
As I understood the documentation, I have to reimlpement the QAbstractItemView. But is there any tutorial which methods to use for drawing the tree, getting signals when a node is clicked? With a simple example I could figure the rest out by myself. I just need a starting point.
Is there anybody who has done something similar?
Is it also possible to place widgets in nodes? Like:
| MyNode |
Thank you very much!
You might be better off switching to the graphics scene framework, it looks to be better suited to your needs. For a startup you could look here. That said you could probably do the painting in an abstract item view, but I believe it'll be much more hassle to implement.
Thank you for your reply!
That was my wayB. I will probably do that and go with the graphics scene framework! I just thought, that there is a nicer version with the Model/View Framework.
I just thought, that there is a nicer version with the Model/View Framework.
No, at least not an easy way as far as I know, since you'd want a pretty heavily custom painting. I believe it possible, but still doubt the wisdom of it, because the graphics view framework is quite better tailored for tasks such as yours.
Since I already worked with the graphics framework, I will stick with it!
Thank you both for your posts. It saved me a lot of time trying ;)