The QMenu class, part of the Qt framwork, provides a menu widget for use in menu bars, context menus, and other popup menus.
Questions tagged [qmenu]
252 questions
2
votes
1 answer
Adding slots to automatically created menu items
I have an existing menu called save and in it i want to add two menus,Save New and Save Edits.
QMenu *menu = new QMenu(this);
menu->addAction("Save New");//void saveNew()
menu->addAction("Save Edits");//void…

Gandalf
- 1
- 29
- 94
- 165
2
votes
1 answer
How to remove QMenu separators in Qt Designer?
I'm using Qt Designer with PyQt. I accidentally created about ten separators and cannot figure out how to delete them. They show up in the Object Inspector, but delete or right click has no useful effect. How can I delete them?

Mastiff
- 2,101
- 2
- 23
- 38
2
votes
2 answers
PyQt5 use shortcuts in opened menu
In a PyQt5 application I have a QMenu. I want to make it so that once the menu is open, users can use keys 1, 2, 3, etc to select option 1, 2, 3, etc in the menu. However, I'm having trouble setting the shortcut, or getting the shortcut to react to…

duocorn
- 43
- 1
- 8
2
votes
1 answer
QAction's icon doesn't show in QMenu
I had a working program in Qt4. After porting it to Qt5, the QActions' icons no longer show in the QMenu; only the text shows. The icons show ok in the toolbar, but not in the menu. I've already set the app to disable "AA_DontShowIconsInMenus" to…

DrewD
- 21
- 3
2
votes
0 answers
How do I make a QMenu scrollable and in the same time fix the position it?
I want to visualize and filter data from a pandas dataframe in PyQt. I already managed to visualize the data and to open up a menu by clicking on the header. The idea is, that you can choose the elements in the menu which you want to keep in the…

Sergey Mi
- 29
- 4
2
votes
1 answer
Qt QMenu lazy initialization
In my QMenu I have a submenu that may contain potentially hunderds of items, and it is not always used, so I am considering initalizing it only on demand:
I suspect that this can be done by implementing a QAbstractItemModel and overriding the…

Sturm
- 3,968
- 10
- 48
- 78
2
votes
2 answers
PyQt5 context menu for QTableWidget column head
is there a way to get a context menu on a tables column head.
Find nothing about that in PyQt5's tuts.
the table's context menu is simple but the column heads don't affect.
# dlg is a QDialog object
self.tbl =…

jgsedi
- 227
- 4
- 18
2
votes
2 answers
Removing dynamically created Qmenu items
I have a Qmenu that I am creating by loading a list with Qsettings and I am trying to be able to remove items from the menu by loading the list in a QListQWidget and deleting the selected items. Currently I am able to delete the menu items in the…

Richard
- 445
- 1
- 5
- 21
2
votes
1 answer
How to set QMenu tear-off window title?
I'm creating a custom ui in Maya 2017 which uses PyQt5 (well... technically PySide2, but it's essentially the same).
I've got a few CustomContextMenu popup menus that I've created in my ui and I've used popup.setTearOffEnabled(True) to be able to…

silent_sight
- 492
- 1
- 8
- 16
2
votes
3 answers
Click menu and open new window
I have used Qt designer to create two different windows, input_window.ui and help_window.ui. Here is the python scripts for showing the input window. In input window, there is a menu bar("About>>Help"). How could it pop up a help_window when "Help"…

Kester
- 283
- 2
- 5
- 10
2
votes
1 answer
Qt: Adding a special item to QMenu
Some programs like Maya and Wings3D have a menu, which includes a special link on some menu items on the right side (usually a square) that triggers a different feature. For example, Wings3D might have an item called "Cube", which makes a standard…

voodoogiant
- 2,118
- 6
- 29
- 49
2
votes
1 answer
Prevent a QMenu from closing when one of its QAction is not triggered
I have a QMenu and Several QWidgetActions, with checkboxes, when I try to click on any area of the QMenu, the menu get closed. I would like to prevent that.
Here is how I do the actions and the menus.
QWidgetAction* action = new…

احمد
- 113
- 1
- 2
- 7
2
votes
1 answer
Is there a way to show tooltip on disabled QWidget
I have a Qt form, where I have a button and menu. For various reasons I can disable certain elements, e.g button or some actions in the menu.
Is there a way I could show a tooltip or when the mouse is hovered over the disabled button or menu item…

Serge
- 1,027
- 14
- 21
2
votes
1 answer
QMenu displays incorrectly when setParent called
I want to create a function to build a context menu that can be dynamically added to a window's menubar. Consider the following minimal example for adding a simple QMenu:
from PyQt5 import QtWidgets
class MainWindow(QtWidgets.QMainWindow):
def…

user3419537
- 4,740
- 2
- 24
- 42
2
votes
1 answer
Set an Icon in QMenu with Stylesheet?
how can i set an Icon for a QAction in QMenu through Stylesheet?
for example:
QMenu* menu = new QMenu();
QAction* action1= new QAction();
QACtion* action2= new QAction();
menu->addAction(action1);
menu->addAction(action2);
now i want to set…

jung
- 557
- 2
- 4
- 16