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

Iterate QAction items on a given QToolBar object in PyQt?

Using Python and PyQt4, given a GUI with any number of QToolBar objects and each toolbar contains any number of QAction objects. I can iterate the ui with the following code and find the toolbars: for name, obj in inspect.getmembers(ui): if…
panofish
  • 7,578
  • 13
  • 55
  • 96
1
vote
1 answer

Override addAction() to modify string and QIcon in pyqt

I want to override the function addAction() in pyqt to have the possibility to modify my strings and icons (or add a default one if none has been specified) every time an item is added in my QMenu class. Here is the code : Python code class…
syedelec
  • 1,285
  • 2
  • 19
  • 30
1
vote
1 answer

How to set signals for each action in QMenu?

for(auto s :listofPossibleValues){ // item =s; action = myMenu.addAction("Set Value to "+s); connect(action,SIGNAL(triggered(bool)),this,SLOT(menuClicked())); } void MainWindow::menuClicked(){ value = new…
user2775042
  • 509
  • 2
  • 6
  • 21
1
vote
1 answer

How to add icons to QMenu in Qt Creator?

I have several *.png icon files like new.png, open.png etc. I added these icons to my main menu in the QtCreator as following: Click on corresponding QAction in desgin mode In that actions property window --> QAction --> icon --> Select…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
1
vote
2 answers

Qt Connect trigger SIGNAL for QMenu

I have a "Recent files" file menu as QMenu, like: File-->Recent files. In that I create dynamically several QActions with the recently opened files listed. That works. But I want to trigger a seperate SLOT when I click on that Recent files…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
1
vote
1 answer

How to select file from MainMenu in Qt?

I load all text files from my folder to the MainMenu in my Qt application. void MainWindow::loadFilesToMainMenu() { QString pathToDir("/myfiles"); QDirIterator it(pathToDir, QStringList() << "*.txt", QDir::Files,…
MarkZltr
  • 67
  • 2
  • 7
1
vote
0 answers

pyqt QAction strange behavior of the function call

I make a simple window and added the menu and toolbar. And I got the strange behavior of the function connected to action. Here's the code: import os import sys import sip import maya.OpenMayaUI as mui from PyQt4.QtCore import * from PyQt4.QtGui…
Massimo
  • 836
  • 3
  • 17
  • 38
1
vote
0 answers

QAction not triggered after QAction removed from QMenu

I'm coding a program with a typical main window GUI interface with the QMainWindow and QMdiWindow Qt 5.4 classes similar to the one of the below picture (from the official documentation). Every time the active subwindow changes the…
AxeEffect
  • 6,345
  • 4
  • 37
  • 33
1
vote
1 answer

Drop-down button in QToolBar with changing fields

I'm a bit stucked with creating drop-down button based on QAction placed in QToolBar I have an XML file with following data: filed1 filed2
tema
  • 1,115
  • 14
  • 33
1
vote
2 answers

Fix QToolButton icon

I have QToolButton with a couple QActions inside it. The problem is that I've set an icon for this toolbar button and I don't want it to change, when I'm selecting some QAction (it changes set item to the text from selected QAction) from popup…
tema
  • 1,115
  • 14
  • 33
1
vote
2 answers

How to pass a QAction to a Qt slot from a QMenu

Iam new in Qt and I have problem how to pass QAction as parameter like this code: connect(fileToolBarAct, SIGNAL(toggled(bool)), this, SLOT(ToggleBar(fileToolBarAct)); And this my slots function: void MainWindow::ToggleBar(QAction& what) { …
1
vote
0 answers

Setting the particular item in a menu as checked when the action is triggered

I have a context menu with a list of item actions. By default the first action in the menu is selected. This is set by using the setChecked() & setCheckable() properties of QAction. But I'm unable to to change the other actions to checked when any…
Beginner
  • 43
  • 4
1
vote
2 answers

QToolButton should have another icon than the default action

When using a QToolButton and the setDefaultAction(myAction) method, it will get the default actions properties Reference: If a tool button has a default action, the action defines the button's properties like text, icon, tool tip, etc. So I try…
Sadık
  • 4,249
  • 7
  • 53
  • 89
1
vote
1 answer

QMenu exec to return on a QMenu click (instead of QAction)

I am building a menu and I would like to be able to click both on QAction and QMenu items. When running exec, nothing happens if I click on a QMenu. Even if I added an action to the QMenu. Is there a way to do this? Here is what I tried: QMenu* menu…
Denis Rouzaud
  • 2,412
  • 2
  • 26
  • 45
1
vote
2 answers

QAction doesn't show icon from Pixmap

For the last couple of hours I'm trying to solve problem with displaying icon in QAction. The problem is that icon isn't shown, only text decryption is placed on its position 'Roads'. I've tried to debug it and all the time QPixmap is NULL, looks…
tema
  • 1,115
  • 14
  • 33