Answer the question
In order to leave comments, you need to log in
How to work with menus in qt?
Hello. I created a menu in the dialog box in the qt editor, and now I'm thinking how to work with it? Give a hint. How to handle it?
Answer the question
In order to leave comments, you need to log in
A lot of options:
1. Read the doc
2. Don't read the doc, immediately kill yourself against the wall and forget the address of the toaster.
Choose.
Лучше прочитайте книгу Шлее об этом фреймворке.
Можете сразу доку, а лучше примеры. Они есть в составе самого Qt, можете загуглить "QMenu example". А если коротко, то меню содержит QAction'ы. И при выборе конкретного пункта ,который соответствует этому QAction, испускается сигнал triggered(). Вот за него и цепляйтесь с помощью connect().
A QMenu object is created. For each menu item, QAction objects are created, which are then added to the previously created menu via the addAction method. To add a submenu, another QMenu object is created and added using the addMenu method. Further, depending on the purpose of the menu, it can be made both the main menu (QMenuBar class), and bind it to the QPushButton::setMenu button.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question