qmenu

highlighting custom QWidgetAction on hover

喜欢而已 提交于 2021-02-07 13:34:44
问题 My application has a QMenuBar with a number of QMenu s, each of which having a number of QAction s and sub- QMenu s. Most of the QAction -items are derivatives of QWidgetAction with re-implemented QWidgetAction::createWidget methods. Usually, both QAction s and QMenu become highlighted on mouse hover. Even a QWidgetAction doesn't make trouble until here: But as soon as I override QWidgetAction::createWidget to return a custom QWidget QWidget* MyWidgetAction::createWidget(QWidget* parent) {

highlighting custom QWidgetAction on hover

旧街凉风 提交于 2021-02-07 13:34:14
问题 My application has a QMenuBar with a number of QMenu s, each of which having a number of QAction s and sub- QMenu s. Most of the QAction -items are derivatives of QWidgetAction with re-implemented QWidgetAction::createWidget methods. Usually, both QAction s and QMenu become highlighted on mouse hover. Even a QWidgetAction doesn't make trouble until here: But as soon as I override QWidgetAction::createWidget to return a custom QWidget QWidget* MyWidgetAction::createWidget(QWidget* parent) {

connect a function when menu title is clicked

纵然是瞬间 提交于 2021-02-05 06:58:25
问题 I am trying to find open ports and add them to my menu. Right now, what I succeed having an action to my menu (like, "find ports"), and only if it's clicked - it will connect to my function that gets all free ports. Unfortunately, that's not what I am looking for. I want to click on the menu title , and get all port in my menu. Below is the code I have: This is the GUI part: from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow

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__

Remove icon space from QMenu

非 Y 不嫁゛ 提交于 2020-05-08 03:17:07
问题 I'm working on a Qt application (in C++). Without appyling any styles, my menu looks like this: I'd like it to look like this: How do I achieve this? Either using qss, or programmatically? I already tried this, without success: menu->addAction(tr("Add"), this, SLOT(CreateNewWaypoint()))->setIconVisibleInMenu(false); Answers for both Qt4.8 and Qt5 are needed to get the full bounty! 回答1: One way to solve the problem is to use QProxyStyle: customstyle.h #ifndef CUSTOMSTYLE_H #define CUSTOMSTYLE