Questions tagged [qmenu]

The QMenu class, part of the Qt framwork, provides a menu widget for use in menu bars, context menus, and other popup menus.

Documentation can be found here (Qt4) and here (Qt5).

252 questions
5
votes
1 answer

How to change QMenu font size

The code below creates a Menu with 5 Submenus and 10 Actions per each Submenu. Even while the setPointSize command is applied to the Submenus their font seem to be unaffected and it remains to be large. But the Actions font is set to a smaller size…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
5
votes
2 answers

How to use QTest::mouseClick with QAction

I'm very new to Qt, and I need to simulate a click using the QTest Namespace and QTest::mouseClick. My problem is I would like to click a QMenu entry, defined as a QAction, but the mouseClick function doesn't allow me to pass this as an argument…
Fran M.
  • 79
  • 5
5
votes
3 answers

Set position (to right) of Qt QPushButton popup menu

I am writing a popup menu for a Qt push button widget. Whenever the push button is clicked, a menu pops up (below the push button). The popup menu is left-sided below by default. Are there any ways to make the popup menu to pop up on the right side…
Ryan
  • 279
  • 1
  • 4
  • 12
5
votes
5 answers

Use a model as a source for a QMenu

I created a model which list the existing configurations (let's say it lists "files", as this doesn't really matter here). So far, it works well when attached to a QListView. Example: --- ListView --- - file #1 - - file #2 - - file #3 …
ereOn
  • 53,676
  • 39
  • 161
  • 238
5
votes
1 answer

How can I dynamically add actions to a QMenu while it is open on a Mac?

I have QSystemTrayIcon with a QMenu. In order to fill the menu, I need to fetch some things from the network, so I want to do that in the background. So I have a QThread with a slot that is connected to the activated signal of the tray icon. Then…
Pepijn
  • 4,145
  • 5
  • 36
  • 64
4
votes
3 answers

How to Change the IconSize for Actions in QMenu?

I am trying to resize the Icons of QActions in the QMenu with the following code but it doesn't work. QMenu *menu; menu =new QMenu(); menu->setStyleSheet("QMenu::icon{height:20px;width:20px});" I would really appreciate it if someone could provide…
Veera
  • 331
  • 3
  • 15
4
votes
3 answers

When and how to properly destroy QMenu context menu?

I allow custom context menu to appear over a table. This is how the menu is generated, using a generic function that accepts target widget and coordinates: #include void MainWindow::makeContextMenu(const QPoint& pos, QWidget* target) { …
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
4
votes
2 answers

Adding and localizing menu items in the main menu of a Qt application menubar

So first of all here is a screenshot of the said menu of Evernote, localized in French: [] As you can see, all the menu items in the main menu (by main menu I mean the one whose name is the application name, like here it is Evernote) are localized…
SexyBeast
  • 7,913
  • 28
  • 108
  • 196
4
votes
1 answer

Update menu in QT system tray application

I need to update the existing menu items for a system tray application. At first when the app loads, there will be two menu items. Later when I click a button these menu items need to be replaced with new menu items. How can I achieve that ? Here is…
Jakes
  • 105
  • 1
  • 7
4
votes
1 answer

In Qt app how to capture "Cmd-Q" or "Quit" menu click

In my Qt app, I have a quit routine which gracefully cleans up everything before finally quitting, else there might be a crash somewhere. The app runs in the system tray, and there is a "Quit" menu defined for the system tray icon. On the quitAction…
Soumya Das
  • 1,635
  • 2
  • 19
  • 28
4
votes
1 answer

Qt4, QMenu addAction, connect function with arguments

I would create a button with 3 choices that changes its text when you make a choice. This solution works for me: def swTrigger(self): self.setTrigger(self.ui.triggerButton,'Software') def hwTrigger(self): …
salvo
  • 63
  • 1
  • 8
4
votes
1 answer

Qt: QMenu with translucent background

I use Windows and I want to set a style sheet to a QMenu to give it a translucent background. In order for that to work, I first set the FramelessWindowHint, then I set the WA_TranslucentBackground attribute. Then I set my style sheet and display…
user1703711
  • 123
  • 2
  • 6
4
votes
1 answer

How to change right-arrow image in Qt's QMenu for selected items with a CSS stylesheet?

I have a Qt QMenu in my app, consisting of two levels (the top level of submenus, then each submenu containing actions), and we have a custom dark-grey style whereby the menu background is grey, the text color is white, and the right arrow is white.…
4
votes
1 answer

Is there a way to have multiple columns in a QMenu?

Is there a way to have multiple columns in a QMenu? I'm using Qt with C++. I have searched and there does not seem to be a way to do this built in to Qt. The question then is how do I add this functionality to my program? Has anyone built a custom…
Ben Gates
  • 762
  • 5
  • 14
4
votes
1 answer

QMenuBar and QMenu doesn't show in Mac OS X

I'm using Qt 4.7.4 on Mac OS X 10.7.4, and I'm trying to add a QMenuBar and a QMenu to my application without success. When looking for examples, I found the Basic Layouts and the screenshot of the interface on Windows displays the File menu, which…
karlphillip
  • 92,053
  • 36
  • 243
  • 426
1 2
3
16 17