Creating a custom menu in Qt

I am developing a mobile application using Qt for s60 v5 and symbain 3. Now I want a menu at the bottom of the screen. It should have an OPtions button, an Exit button. And one more button between them. How can this be done? I tried several things but could not get the menu at the bottom of the screen. I would like some pointers to create a custom menu and place it anywhere I want. Preferably he should look like a native.

+4
source share
2 answers

You can place non-native QMenuBar in the layout, like any other widget. The following is an example application.

#include <QApplication> #include <QMenuBar> #include <QVBoxLayout> int main(int argc, char **argv) { QApplication app(argc, argv); QWidget window; QVBoxLayout layout(&window); QMenuBar menubar(&window); layout.addStretch(); menubar.addMenu("&File"); layout.addWidget(&menubar); window.show(); return app.exec(); } 
+4
source

I don’t think you can make the menu bar appear at the bottom of the screen. However, you can:

1) use the built-in menuBar () function to get the real menu bar and customize the menu the way you need your native OS (e.g. symbian).

2) create your own menu bar by simply creating a QHBoxLayout and adding buttons to it that create a popup menu. When you are done, it will look very much like a menu bar. You most likely want to play with button layout mockups.

0
source

Source: https://habr.com/ru/post/1344604/


All Articles