Questions tagged [qaction]

The QAction class, part of the Qt framework, provides an abstract user interface action that can be inserted into widgets.

Documentation can be found here

145 questions
0
votes
0 answers

QAction::text(), Program received signal SIGSEGV, Segmentation fault

I working on migration of a product from QT4 to 5. I am getting this error while backtracing it- #0 0x00007ffff5488cd1 in QAction::text() const () from…
chinmay singh
  • 163
  • 2
  • 7
0
votes
0 answers

Properly handling of QAction shortcut

I have an application where users can add their own key sequences and open a file or folder when they hit their key sequences. I already did all the validations on the user's input and my app is almost complete until I encountered this…
0
votes
0 answers

statusBar don't get updated by setStatusTip PyQT5

I try this simple example (self is a QMainWindow) : self.statusBar().showMessage('test') #checking if the statusBar is here and works resetInterfaceAct = QAction('&Interface de Base', self) resetInterfaceAct.setStatusTip('Remet l\'interface de…
JB Tand
  • 11
  • 5
0
votes
1 answer

QWidgetAction not showing menu

I've created a custom widget which is used in a QMenu. Which the menu is displayed the user clicks on the Block rectangle as seen in the image below. However when i change the way the Menu is assigned to the control, it stops working for some…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
0
votes
0 answers

How to disable menu action items after they are selected in qt

How can I disable menu action items after they are selected?Ι want the user to be able to select the action only once. Menu=MainMenu->addMenu("menu"); sub1 =Menu->addAction("sub 1"); sub2 =Menu->addAction("sub 2"); connect(sub1,…
Sonicpath
  • 231
  • 4
  • 16
0
votes
1 answer

Dynamically created QActions creating class object

I have a simple pyside QMenu which is being populated with QActions when the application starts. Each menu action represents a class object. How can I create a new instance of the class object based on the Menu Item clicked, and append that new…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
0
votes
0 answers

Qt QMenu QAction that is disabled but looks as enabled

I would like to have an element of a popup menu that doesn't react to user inputs: click, hover, etc. but that doesn't look greyed out as when I disable it. I have a QMenu to which I add a QAction QMenu* menu// Further code creating the menu…
AOlov
  • 1
0
votes
1 answer

How to get QToolBar / QDockWidget context menu actions?

When QToolBar and QDockWidget widgets are used, they automatically generate a context menu which allows you to show/hide these dock and toolbar widgets (see the screenshot). How can I get these context menu actions? Usage example: E.g., I want to…
John Doe
  • 555
  • 6
  • 17
0
votes
0 answers

Different text colors for different QActions inside a QMenu

I'm trying to set different text colors for my QActions inside a QMenu. For example File -> Open -> Save And I want to have Open written in red and Save in blue. I tried modifying the style of the File menu but this doesn't work, all the…
nmud
  • 175
  • 14
0
votes
2 answers

PyQt - How can I re-initialise the whole code without restarting it?

I wrote a python GUI program consisting of two separate files; One is for logic code and the other for GUI using PyQt4. The behaviour of some objects (buttons, text fields ...) changes throughout the code and I need to reset everything to its…
gnome
  • 573
  • 1
  • 6
  • 19
0
votes
1 answer

multiple shortcut key doesn't work

I put on multiple shortcuts on each QAction, e.g. 'L, Right, Space'. but 'L' shortcut doesn't now work. 'Right' and 'Space' can work. Similarly, if I register 'A, B' and then, 'A' will not work and 'B' will work. If I use QMainWindow::eventFilter()…
0
votes
1 answer

How to change a QPushButton's Icon String based on QTranslator

I have an application with buttons that have icons set for the various click states, no actual QPushButton text is set or displayed; it is all contained in the icon. These icon files include text that requires translation, and have already been…
Nfettinger
  • 71
  • 7
0
votes
1 answer

PyQt QAction connecting to Exit popup

# -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui import iconresource try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def…
David.K
  • 1
  • 1
0
votes
1 answer

Get QMenu's ActionRect for paint an image

QPainter p(this); for (int i = 0; i < this->actions().count(); ++i) { QAction *action = this->actions().at(i); QRect actionRect = ........... QStyleOptionMenuItem opt; initStyleOption(&opt, action); opt.rect =…
0
votes
0 answers

Pyside set shortcut with mouse button to the QAction

I want to set shortcut to the QAction as "Ctrl + Left Mouse Button", but can't figure out how to do this. For keyboard shortcuts I do like this: someAction = QtGui.QAction("DoSomething", self, shortcut="Ctrl+S") Anyone has a suggestion? Thanks.
as tek
  • 11
  • 3