I
I
Ilya Bobkov2015-01-29 20:35:05
Qt
Ilya Bobkov, 2015-01-29 20:35:05

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

3 answer(s)
D
Don Kaban, 2015-01-29
@donkaban

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.

Y
Yaroslav, 2015-01-29
@torwig

Лучше прочитайте книгу Шлее об этом фреймворке.
Можете сразу доку, а лучше примеры. Они есть в составе самого Qt, можете загуглить "QMenu example". А если коротко, то меню содержит QAction'ы. И при выборе конкретного пункта ,который соответствует этому QAction, испускается сигнал triggered(). Вот за него и цепляйтесь с помощью connect().

Илья Подшивалов, 2015-01-30
@Harrowmont

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 question

Ask a Question

731 491 924 answers to any question