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
1
vote
1 answer
Qt: How to set context menu stylesheet for whole application's QLineEdit
As you can see in the following screenshot, the selected item's font color is white as its background color, which cause we can not see the item text, this issue exists in all the QLineEdits in my application, so i just want to set the selected…

Wade Wang
- 536
- 6
- 11
1
vote
1 answer
Qaction Shortcut in extended contextmenu not triggered
I try to extend the contextmenu of a QLineEdit with an additional entry for replacing text. I can extend the contextmenu with .createStandardContextMenu(), which works fine. But when I try to add a shortcut with .setShortcut(QKeySequence(Qt.CTRL +…

Papageno
- 305
- 3
- 15
1
vote
1 answer
QMenu not inheriting stylesheet when not created via addMenu
I set a stylesheet on my entire window in which the background of a QMenu should be green. However, when I create the menu (self.project_menu in the MenuBar class), it does not inherit the stylesheet. If I instead use self.project_menu =…
user7989146
1
vote
0 answers
How to add search bar in column filter in QTableWidget in Pyqt5 Python?
I have a created a QTableWidget using pyqt5 and managed to add filter option in each column of the table widget successfully with one of the answers available on stack overflow. filters works as expected but I wanted to add search bar in the filter…

PyPyVk
- 79
- 4
- 14
1
vote
0 answers
How to add a button to a QMenu, or reproduce a QMenu in a custom QWidgetAction
I currently have a menu that looks something like this:
What I would like to do, is make the part that displays the keyboard shortcut a button that can be clicked. When the user clicks this button, they will be taken to the shortcut editor, with…

Dan Forever
- 381
- 2
- 12
1
vote
1 answer
Context menu didn't work on tray icon when using pyqt5
I'm developing an application with pyqt5, which will hide window automatically when it starts to work. And I hope to build a tray icon with context menu to show the window again. Below is my brief code,
class MainWindow(QMainWindow, Ui_MainWindow):
…

CivilKen
- 15
- 5
1
vote
1 answer
QMenu Right Align Text
I need the text in my QMenu to be right aligned instead of left aligned.
QMenu menu;
menu.setStyleSheet("QMenu{background: #2e353d; color: #bfbfbf; margin: 0px;}"
"QMenu::item{font-size: 10pt; padding: " + QString::number(6*globalDPI) + "px " +…

mrg95
- 2,371
- 11
- 46
- 89
1
vote
0 answers
PythonQT, QMenu update QActions
I've got the following code which was working well before I updated utils._DATA twice. Utils._DATA is dictionary.
class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
def __init__(self, icon, parent=None):
super(SystemTrayIcon,…

Константин Мебиус
- 11
- 4
1
vote
1 answer
QMenu does not execute methods properly
I am working with a custom QMenu which executes some methods. The menu has three options: a delete row option, a toggle variable option and a debug option, which prints the value of the toggleing variable. The code is not properly executed.…

Jaime02
- 299
- 7
- 21
1
vote
0 answers
QLabel appears grayed out inside QWidgetAction
I am using a QWidgetAction to create a QMenu "item" that has a QLabel and a QLineEdit. These are added to a QHBoxLayout which is added to a QWidget which is set as the default in the QWidgetAction.
The end result is that everything works, except the…

durka42
- 1,502
- 10
- 17
1
vote
1 answer
Add more than one Qmenu from other classes in MainWindow
I want a single menubar in my main window and be able to set the menus in the menubar from additional classes. Using the setMenuWidget command will overwrite the first menu option as shown in the code. In the classes where I set up the menu I think…

anthony crimin
- 29
- 6
1
vote
1 answer
reading text from QLineEdit as a submenu of a Qmenu option
Reading the text a QlineEdit which is part of a Qmenu
As shown in the code initially I though I could use a trigger function to determine what option changed and then read the text. If I could figure out how to read the QlineEdit with currenttext()…

anthony crimin
- 29
- 6
1
vote
2 answers
How to make shortcuts trigger in a custom QMenu?
I have a context menu (QMenu) and add a copy action to it like this:
m_copyNodeAction = new QAction(tr("Copy node"),…

juzzlin
- 45,029
- 5
- 38
- 50
1
vote
1 answer
How to set focus after execution QAction
Main widget steals focus after execution QAction.
I need the focus to be set to popup widget.
QAction *action = new QAction(tr("show popup"), this);
connect(action, &QAction::triggered, this, &MyWidget::showPopup);
addAction(action);
void…

Michał Hanusek
- 199
- 3
- 13
1
vote
1 answer
Changing icon in nested menus
I don't think this may be posssible but I had still want to try asking.
In the attached screenshot, I have nested menus.
Is it possible to change the arrow keys icon as 'highlighted' by the red box?
I am trying to change the arrow key to a plus icon…

Teh Ki
- 455
- 1
- 3
- 14