Reputation: 270
I'm trying to create a vertical menu with a Qt application that would have the following example structure:
Language |--> Select |--> English |--> Load Image |--> Save Format |--> JPEG |--> Bitmap |--> JPEG Quality |--> Super High |--> High |--> Low
and so on. I'd ideally like to use QMenuBar
to implement not only the top level menu items but all of the sub-menus as well. I would also like to make use of the signal/slots that can be used to trigger these various options. Some of the options are of the On and Off variety and being able to quickly reflect the selected choice with a checkmark or something would be ideal.
I can layout the QMenuBar
and have it show up either on top or bottom when housed within a QVBoxLayout
. However, what I want to do is to change its orientation from horizontal to vertical. I'm a novice when it comes to Qt programming and my searching hasn't yielded the right functions or Widget to use to gain this functionality.
All pointers and tips appreciated.
Here is an image that shows what I'm trying to accomplish.
The user has selected "sensor display" and is shown the 3 sub-options (pressure, pan & tilt, radiation) and also by default is moved over to the first option (pressure) which happens to have 2 sub-options (on, off).
The sub-menus all need to appear horizontally across as opposed to the "tree view" I've depicted in the text menu above.
Regards
Upvotes: 3
Views: 2148
Reputation: 10662
I've implement a menu similar to your above image. I built it entirely in QML and integrated all of the data models, signals, and slots from C++ source code.
Check out the RSS News Example as a starting point. In this example, they show you how to build a horizontal menu using QML.
The basics to make your above mock up is:
You can do all the above in C++ if you connect your QML list view elements to appropriate signals and slots.
I hope that helps.
Upvotes: 2