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
2
votes
1 answer

QToolButton with text: Overwrite minimal height to minic regular button height

I am displaying QToolButtons with icon plus text (Qt::ToolButtonTextBesideIcon) outside of a tool bar. Each button has a QAction associated with it which determines the used icon and the displayed text. All those buttons are placed inside a…
Philip Allgaier
  • 3,505
  • 2
  • 26
  • 53
2
votes
3 answers

Enable QMenu access for a disabled QToolButton

I have a QToolButton with an attached QMenu which includes a couple of QActions. One of those actions is the button's default action. The default action dynamically changes when clicking on the actions and this works great. Now, these QActions get…
Lars
  • 81
  • 1
  • 8
2
votes
1 answer

How can I add more than one QAction to same QMenu?

I'm trying to implement Qt Menus customization, and I'm giving a feature to add same QAction more than once in the same RMB context menu. But when I try to do: myMenu->addAction( myAction ); myMenu->addAction( myAction ); Adding QAction twice,…
Maverick33
  • 337
  • 3
  • 15
2
votes
2 answers

QAction::setAccel(QString) not available from Qt 4?

Following this documentation: http://doc.qt.digia.com/qq/qq14-actioneditor.html I figured that out there is no QAction::setAccel(QString) method anymore. How can one modify the QAction accel other than using QtCreator? I need to change them…
Petr
  • 13,747
  • 20
  • 89
  • 144
2
votes
1 answer

Is there a way to reassign a key press to a different function in Qt?

I'm trying to reassign keyboard buttons that trigger different events based on which tab is active. Below is my initialization: action = QtGui.QAction(self) action.setShortcut(QtGui.QKeySequence("w")) self.connect(action,…
LMT
  • 23
  • 5
2
votes
1 answer

Possibility to create QAction as a separator in constructor

I have dozens of QAction objects creating in the constructor of widget without giving them variable names. Many of properties of QAction can be set right in the constructor (e.g. shortcut, signals connections, statusTip, etc.). Is it possible to set…
Крайст
  • 776
  • 1
  • 9
  • 22
2
votes
1 answer

How to prevent QWidget::keyReleaseEvent from being called when a QAction's shortcut is typed

In my QMainWindow subclass, I have several QActions with QKeySequence shortcuts. I have also reimplemented QWidget::keyPressEvent and QWidget::keyReleaseEvent in the main window. If I type one of the shortcuts on my keyboard (e.g., Ctrl + C),…
Anthony
  • 8,570
  • 3
  • 38
  • 46
1
vote
1 answer

Is there a way to connect the "RPG" menu with the "clickMSG" function?

I want to connect the "RPG" menu with the "clickMSG" function. I don't get an error when I run the code, but the connect is colored in white, therefor is not assigned to anything. Here is the code: class gui(QMainWindow): def __init__(self,…
1
vote
1 answer

PyQt5: Get row number from button-menu action in QTableView index-widget

Basically, I have a QTableView and the last column of each row contains a QMenu where if triggered, the row should be deleted. I tried the code below, but if I click on the menu that is in a row number > 1, the returned rowNum is -1: Code: def…
pefile
  • 69
  • 6
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

QAction doesn't call the connected slot

I have a Qt project with a QMainWindow, which has the following actions and slots: class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = Q_NULLPTR); private: Ui::MainWindowClass ui; //..... other…
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,…
1
vote
0 answers

How to add 2 custom buttons for QLineEdit?

I tried to add two buttons for my line edit. The "clear" appears only when the text in line edit not empty, and the "bulb" is always shown. MyLineEdit.cpp MyLineEdit::MyLineEdit( QWidget *p_parent ) : QLineEdit( p_parent ) { m_buttonAction =…
songvan
  • 369
  • 5
  • 21
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 2
3
9 10