Adding tree view to form in Qt Designer - from scratch , not in code
-
I am looking at this example.
It implements tree view in code.
I like to learn how to do same in Qt Designer - graphically.There are other , similar , "in code " examples.
I have not found ANY examples of tree view in QT Designer / GUI form.Is that even feasible to implement using Qt Designer only ?
Sample reference will be appreciated.https://doc.qt.io/qt-5/qtwidgets-itemviews-simpletreemodel-example.html
-
@AnneRanch said in Adding tree view to form in Qt Designer - from scratch , not in code:
Is that even feasible to implement using Qt Designer only ?
Hi
Not really as while you can place the TreeView visually, the model construction and
the assignment is only possible via code.So unlike TreeWidget, you will have to use code to give it the data.
-
QTreeView is just a view that shows a QAbstractItemModel. QAbstractItemModel, as the name suggests, is abstract, meaning it has no implementation and thus can't be really used in the designer. You can only place the view in designer, but you need to implement the model yourself as the possibilities are pretty much endless and that's not something you could represent in the designer.
QTreeWidget on the other hand is a view and it has internal implementation of QAbstractItemModel that operates on QTreeWidgetItems. Since this is a concrete implementation with concrete behavior and is not abstract it is available to use in the designer.
-
Thanks Chris,
I will go for QTreeWidget, it will do the job.