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
2
votes
3 answers

Passing argument to PyQt SIGNAL connection

Is it possible to pass an argument to PyQt4 Signal connections? In my case I have n buttons with set the same menu dinamically created on the interface, depending on user's input: for j in range(0, len(self.InputList)): arrow =…
Matteo NNZ
  • 11,930
  • 12
  • 52
  • 89
2
votes
1 answer

How to display color icons in menu, PyQt?

What i'm trying to achieve is to display color icons in a context menu, in python. So that it displays some of the used colors to mark the table. Here is an example of what i'm trying to achieve. Any guess how to do this ? UPDATE Here is a more…
thecreator232
  • 2,145
  • 1
  • 36
  • 51
2
votes
1 answer

How to Hide Right Arrow in QMenu in Qt?

Can anyone please tell me how to hide the right arrow for the QMenu items. I tried using the stylesheet. But it didn't works.. Please Help. MyStylesheet.qss QMenu::right-arrow[hide="true"] { image: url(Resources/MenuRight.png); //am using an…
New Moon
  • 787
  • 6
  • 21
  • 35
2
votes
2 answers

Dynamically create context menu in QT associated to a toolbutton

In my application I have a QToolButton related to the presence of an USB Pen Drive. When the Pen drive is inserted I would like to show the QToolButton and create a context menu associated to the content of the pen drive.I have a different menu…
Rudy Barbieri
  • 389
  • 1
  • 4
  • 16
2
votes
2 answers

QToolButton pops up menu only when pressed and HOLD

I'm trying to implement an "open" button such that if a user presses it and holds, a menu of applications for the user to choose from will pop up; but as soon as the user releases the mouse, the menu should disappear. if the user releases the mouse…
user110
  • 315
  • 1
  • 11
2
votes
1 answer

Styling QSystemTrayIcon's QMenu

I am trying to code context menu similar to the one Dropbox has: I thought that the best way to do this is to style QMenu attached to the QSystemTrayIcon: class canvas : public QMenu { Q_OBJECT public: canvas(QObject* parent =…
user840413
2
votes
0 answers

Are QMenus typically in a thread of their own? What's the right way to wait for them to finish handling events?

In the debugger, I can see that my QMenu objects do not reside in the same thread as the main gui thread. E.g., QApplication.instance().thread() == 0xdeadbeef, but mymenu.thread() == 0xdeadbabe 1) Is that expected? BTW, my QMenus are not native…
Stuart Berg
  • 17,026
  • 12
  • 67
  • 99
2
votes
1 answer

Specify top-left corner position for QMenu

I have QPoint pos after clicking mouse and what to show at this point QMenu. But I what menu to appear that this pos will be left top corner of QMenu. And menu.exec(pos); shows menu such that pos is it's left edge middle point
Littlebitter
  • 671
  • 3
  • 10
  • 19
2
votes
2 answers

adding context QMenu to left click on a button in PySide

I want to add context menu to left click of mouse button pressed over emailbtn from PySide import QtCore,QtGui import sys class ToolBarUI(QtGui.QWidget): def __init__(self,*args,**kwargs): super(ToolBarUI,self).__init__(*args,**kwargs) …
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
1
vote
2 answers

Put QMenuBar at QMainWindow Bottom in QT

Is there any way to put a QMenuBar at screen bottom (I mean, at QMainWindow bottom)? I'm working on my thesis project, and my director asked me to put a QMenuBar at screen bottom. Is this possible?, I have been trying adjusting the menubar geometry.…
Hermandroid
  • 2,120
  • 4
  • 29
  • 35
1
vote
0 answers

How to fix QMenu height when scroll enabled?

I have a derived MyQMenu from QMenu and want to enable scrolling in case the menu expands too much. This menu contains a lot of check boxes. class MyQMenu : public QMenu{ ... void customizeStyle(){ QString menuStyle( "QMenu{" …
woody
  • 11
  • 1
1
vote
0 answers

QMenuBar QMenu is too short when first clicked

I'm running into a strange one here. I have a QMenuBar attached to a QMainWindow with multiple QMenus and QActions contained in it. When the program is first started, and one of the menus is clicked, the resulting drop-down is too short. But if the…
1
vote
2 answers

how to initiate context menu event in QGraphicsItem from QGraphicsView context menu - PyQt6

I have a context menu on the QGraphicsView. I cannot activate the context menu of a QTextGraphicsItem. I read that I need to send a scene event to the item, but I cannot find the event needed to make the sendEvent method work. def…
Colin Curtain
  • 217
  • 1
  • 10
1
vote
1 answer

How to move cursor form first menu to next menu by pressing Right arrow Key once, Instead of Twice?

The following Code is to create a MenuBar in Pyqt5. Want to move the cursor from one menu to another menu by pressing Left/Right Arrow Keys. IF We press the Left Arrow key once, Cursor moves smoothly and focus on pervious Menu. But at the same…
tckraomuqnt
  • 470
  • 4
  • 17
1
vote
0 answers

QMenu (contextMenuEvent) not closing on click on action nor parent QWidget

I am trying to create a context menu (QMenu) for a right-click inside of PatternWidget(QWidget) with PySide6. For this purpose I have overwritten contextMenuEvent as seen below. For whatever reason, the context menu will NOT exit, when any of the…
badnun872
  • 77
  • 5