Caolan O'Domhnaill
15th October 2015, 01:05
Hello everyone I am hoping to get some architectural advice on the best way to put together my UI.
What I currently have in my Main Window is a QGraphicsView as the primary piece that the user interacts with. On the right hand side I have docked a QTreeView that keeps track of the hierarchy I have created of QGraphicsItems in the scene of the QGraphicsView.
Note: The hierarchy I mention could be Item1 and Item2 as siblings or Item2 is a child of Item1 but never Item1 being a child of Item2. It is a data hierarchy that is specific for my app and has nothing to do with QT itself.
In the QTreeView I wish to represent this hierarchy. When I click on either Item1 or Item2 in the QGraphicsView, I want to do two things:
1. Highlight the object in the QTreeView
2. Display in another docked window under the QTreeView a QTableView with the various editable properties of the object.
Those two items are not an issue to do.
My main problem is thus:
The properties of the Item I clicked on can be set using controls: a text field, a combobox drop down, spinner controls, and just static text.
Question 1: Does QTableView allow you to customise the type of control that is under each column?
Question 2: Is there a better way of approaching this?
I did take a look at the QStandardItem and QStandardItemModel but this did not seem to provide the droids I was looking for.
Cheers!
-Caolan.
Added after 54 minutes:
Update...
I found more information. It appears that Delegates could be a solution to my woes. here's a sample of it: http://programmingexamples.net/wiki/Qt/Delegates/ComboBoxDelegate#ComboBoxDelegate.h
Opinions?!
What I currently have in my Main Window is a QGraphicsView as the primary piece that the user interacts with. On the right hand side I have docked a QTreeView that keeps track of the hierarchy I have created of QGraphicsItems in the scene of the QGraphicsView.
Note: The hierarchy I mention could be Item1 and Item2 as siblings or Item2 is a child of Item1 but never Item1 being a child of Item2. It is a data hierarchy that is specific for my app and has nothing to do with QT itself.
In the QTreeView I wish to represent this hierarchy. When I click on either Item1 or Item2 in the QGraphicsView, I want to do two things:
1. Highlight the object in the QTreeView
2. Display in another docked window under the QTreeView a QTableView with the various editable properties of the object.
Those two items are not an issue to do.
My main problem is thus:
The properties of the Item I clicked on can be set using controls: a text field, a combobox drop down, spinner controls, and just static text.
Question 1: Does QTableView allow you to customise the type of control that is under each column?
Question 2: Is there a better way of approaching this?
I did take a look at the QStandardItem and QStandardItemModel but this did not seem to provide the droids I was looking for.
Cheers!
-Caolan.
Added after 54 minutes:
Update...
I found more information. It appears that Delegates could be a solution to my woes. here's a sample of it: http://programmingexamples.net/wiki/Qt/Delegates/ComboBoxDelegate#ComboBoxDelegate.h
Opinions?!