qaction

Pyside2 QAction triggers once automatically but not when user clicks the menu

佐手、 提交于 2021-02-05 11:51:44
问题 I've created a simple GUI using qt designer and imported it into my python project. The main window comes up, and the menus/buttons are responsive, but I cannot manage to connect my QActions to custom functions (I did it for buttons though, and it works). The weird thing is that my custom function ( on_action_clicked ) is called once when I run the application, but not when I click on the menu items or icons of the toolbar (I tried connecting both). Below are the test codes. Am I missing

Pyside2 QAction triggers once automatically but not when user clicks the menu

丶灬走出姿态 提交于 2021-02-05 11:50:10
问题 I've created a simple GUI using qt designer and imported it into my python project. The main window comes up, and the menus/buttons are responsive, but I cannot manage to connect my QActions to custom functions (I did it for buttons though, and it works). The weird thing is that my custom function ( on_action_clicked ) is called once when I run the application, but not when I click on the menu items or icons of the toolbar (I tried connecting both). Below are the test codes. Am I missing

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

左心房为你撑大大i 提交于 2021-01-27 23:30:25
问题 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, only one instance of QAction appear on the menu. Why can't I have more than one instances of QAction ? Is there any trick to achieve this? I was trying to clone/create a new action with all the propeties of previous action. But I don't know the way to

Why won't QToolTips appear on QActions within a QMenu

℡╲_俬逩灬. 提交于 2021-01-27 02:13:27
问题 I'm doing an app with in GUI written with PySide . I set a QMenu on a QPushButton , added several QActions via QMenu.addAction . To further explain these actions to the user I added QToolTip 's to these with QAction.setToolTip . When I run the GUI now my QToolTip won't show. The example posted below reproduces the same issue, any ideas? Thanks in advance import sys from PySide import QtGui class Example(QtGui.QPushButton): def __init__(self, parent = None): super(Example, self).__init__

Why won't QToolTips appear on QActions within a QMenu

你说的曾经没有我的故事 提交于 2021-01-27 02:12:44
问题 I'm doing an app with in GUI written with PySide . I set a QMenu on a QPushButton , added several QActions via QMenu.addAction . To further explain these actions to the user I added QToolTip 's to these with QAction.setToolTip . When I run the GUI now my QToolTip won't show. The example posted below reproduces the same issue, any ideas? Thanks in advance import sys from PySide import QtGui class Example(QtGui.QPushButton): def __init__(self, parent = None): super(Example, self).__init__

Why won't QToolTips appear on QActions within a QMenu

心不动则不痛 提交于 2021-01-27 02:10:23
问题 I'm doing an app with in GUI written with PySide . I set a QMenu on a QPushButton , added several QActions via QMenu.addAction . To further explain these actions to the user I added QToolTip 's to these with QAction.setToolTip . When I run the GUI now my QToolTip won't show. The example posted below reproduces the same issue, any ideas? Thanks in advance import sys from PySide import QtGui class Example(QtGui.QPushButton): def __init__(self, parent = None): super(Example, self).__init__

Why won't QToolTips appear on QActions within a QMenu

梦想与她 提交于 2021-01-27 02:09:05
问题 I'm doing an app with in GUI written with PySide . I set a QMenu on a QPushButton , added several QActions via QMenu.addAction . To further explain these actions to the user I added QToolTip 's to these with QAction.setToolTip . When I run the GUI now my QToolTip won't show. The example posted below reproduces the same issue, any ideas? Thanks in advance import sys from PySide import QtGui class Example(QtGui.QPushButton): def __init__(self, parent = None): super(Example, self).__init__

Why won't QToolTips appear on QActions within a QMenu

依然范特西╮ 提交于 2021-01-27 02:08:10
问题 I'm doing an app with in GUI written with PySide . I set a QMenu on a QPushButton , added several QActions via QMenu.addAction . To further explain these actions to the user I added QToolTip 's to these with QAction.setToolTip . When I run the GUI now my QToolTip won't show. The example posted below reproduces the same issue, any ideas? Thanks in advance import sys from PySide import QtGui class Example(QtGui.QPushButton): def __init__(self, parent = None): super(Example, self).__init__

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

爱⌒轻易说出口 提交于 2019-12-24 18:00:54
问题 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 QGridLayout. So far so good. Unfortunately, it looks like that as soon as you add a QAction to a QToolButton, Qt automatically decides to shrink it down to the minimal size, which is not what I want given my QGridLayout. I used the following lines to

QTooltip for QActions in QMenu

半世苍凉 提交于 2019-12-13 11:57:30
问题 I want to be able to show ToolTips for QMenu items ( QAction s). The best I have achieved is to connect the hovered signal of the QAction to a QTooltip show: connect(action, &QAction::hovered, [=]{ QToolTip::showText(QCursor::pos(), text, this); }); The problem is that sometimes the program will position the tooltip below the menu, specially when changing menus. Is there any way to force the tooltip to show on top? 回答1: You can subclass QMenu and reimplementing QMenu::event() to intercept the