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
1
vote
1 answer

Qt: Check mark next to a menu item

In my application a user is able to select a comport from a list of all available comports. This is to be done in a menu that is populated with QAction widgets. However, the current code does not show which port has been selected, and in order to…
ADB
  • 1,210
  • 4
  • 15
  • 23
1
vote
1 answer

How to display a QMenu on a QAction trigger

I Have a (QT) toolbar in my application which is populated by QAction objects, and one of the QActions has an associated menu. I would like to pop up that menu below the QActions' button when the action is triggered. I have…
Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
1
vote
1 answer

Why I can't connect QAction SIGNAL with QFileDialog SLOT?

I'm trying to write application's menu for my text editor, but I don't understand why signal triggered does not working. It should open a QFileDialog::getOpenFileName, but it does not happen. Why? main.cpp #include "mainwindow.h" #include…
Ilya Glushchenko
  • 317
  • 1
  • 6
  • 13
1
vote
4 answers

Create Custom Button

I want to create a custom pushButton without any styling which just displays a .png image. I have tried creating a pushButton with the setIcon method but this uses the pushButton silver styling I just want to display the image and have it be a…
DomX23
  • 867
  • 5
  • 13
  • 26
0
votes
1 answer

Store and evaluate a condition in an instance variable

I start my question by describing the use case: A context-menu should be populated with actions. Depending on the item for which the menu is requested, some actions should be hidden because they are not allowed for that specific item. So my idea is…
chrset
  • 581
  • 6
  • 11
0
votes
0 answers

QT:Why tooltip set by qstylesheet is covered when the enabled property of A QAction object changes?

I have one QToolBar with two QActions, defined in .ui file. Review
hiki
  • 1
0
votes
0 answers

Adding checkable QToolButton to QToolBar with an icon, a text and a menu

Currently, I have a QToolBar with different checkable actions grouped in QActionGroups set to autoExclusive. This works well. Now, I would like to have one QAction with a menu so that user can choose the behavior of this action. So I decided to use…
zigma12
  • 181
  • 1
  • 7
0
votes
0 answers

Passing unknown number of values to a function in Python

I'm attemping to setup a function that will create QActions and connect them with methods. The methods that I pass vary in terms of arguments that they receive. Is there a way to pass all individual arguments from a tuple (args) into a function…
0
votes
1 answer

QMenu action entry with ampersand shortcut

I tried to set an action in a QMenu with the ampersand shortcut (&) but the shortcut is not rendered. I should have a rendering like the "Help" action with the F11 shortcut. The code: QMenu* filesMenu = ui->menubar->addMenu("&Test"); QAction*…
Theo
  • 13
  • 5
0
votes
0 answers

PyQt5 Problem involving QMainWindow class, QAction and probably the setCentralWidget() function, what to do?

Good afternoon. This is an MRE of the problem that you can easily run in your machine import sys from PyQt5.QtWidgets import ( QWidget, QMenuBar, QMenu, QApplication, QAction, QMainWindow, QVBoxLayout, QLabel ) class…
zeca_abc
  • 41
  • 5
0
votes
0 answers

QAction.isChecked seems to report inverted value

Using QtDesigner I created a menu item (QAction) and set it to checkable and checked. The resulting code generated by pyuic5 contains self.actionEdit_Mode = QtWidgets.QAction(MainWindow) self.actionEdit_Mode.setCheckable(True) …
Llaves
  • 683
  • 7
  • 20
0
votes
0 answers

How to implement an interactive QAction with Pyside ? (i.e. How to catch event in a QAction ?)

It might be a very simple question but I can't figure out how to do it. The context: I am making an application that can draw polygons in a QGraphicsScene. I would like to implement interactive actions. For example, the user clicks on a button, then…
Simon
  • 11
  • 4
0
votes
0 answers

Connecting action to a menu item/action on a button?

I want to make my own menu bar. I have found a way to add actions to a QPushButton: Source: https://www.youtube.com/watch?v=Aj-Q8pu_HG0 def add_menu(data,menu_obj): if isinstance(data,dict): for k,v in data.items(): sub_menu…
david 11
  • 75
  • 8
0
votes
0 answers

How to set the QMenuBar's actions to multiple rows (new line)

self.menuBar = self.menuBar() self.action1 = QAction('This is\nAction Button', self) self.menuBar.addAction(self.action1) This makes the menuBar multiple lines, but new line doesn't apply.
Mineral
  • 1
  • 1
  • 2
  • 4
0
votes
1 answer

Qt Checkable QActions

I have two QActions in a right-click menu. I'm trying to check one action and show a tick next to it. While positive is checked and if I check positive a second time, it should return the program to the default mode and remove the tick. If negative…
Elf
  • 15
  • 5