1// qmenu.sip generated by MetaSIP 2// 3// This file is part of the QtWidgets Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 8// 9// This file may be used under the terms of the GNU General Public License 10// version 3.0 as published by the Free Software Foundation and appearing in 11// the file LICENSE included in the packaging of this file. Please review the 12// following information to ensure the GNU General Public License version 3.0 13// requirements will be met: http://www.gnu.org/copyleft/gpl.html. 14// 15// If you do not wish to use this file under the terms of the GPL version 3.0 16// then you may purchase a commercial license. For more information contact 17// info@riverbankcomputing.com. 18// 19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 22 23class QMenu : QWidget 24{ 25%TypeHeaderCode 26#include <qmenu.h> 27%End 28 29public: 30 explicit QMenu(QWidget *parent /TransferThis/ = 0); 31 QMenu(const QString &title, QWidget *parent /TransferThis/ = 0); 32 virtual ~QMenu(); 33 void addAction(QAction *action); 34 QAction *addAction(const QString &text) /Transfer/; 35 QAction *addAction(const QIcon &icon, const QString &text) /Transfer/; 36 QAction *addAction(const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, const QKeySequence &shortcut = 0) /Transfer/; 37%MethodCode 38 QObject *receiver; 39 QByteArray slot_signature; 40 41 if ((sipError = pyqt5_qtwidgets_get_connection_parts(a1, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) 42 { 43 sipRes = sipCpp->addAction(*a0, receiver, slot_signature.constData(), *a2); 44 } 45 else if (sipError == sipErrorContinue) 46 { 47 sipError = sipBadCallableArg(1, a1); 48 } 49%End 50 51 QAction *addAction(const QIcon &icon, const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, const QKeySequence &shortcut = 0) /Transfer/; 52%MethodCode 53 QObject *receiver; 54 QByteArray slot_signature; 55 56 if ((sipError = pyqt5_qtwidgets_get_connection_parts(a2, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) 57 { 58 sipRes = sipCpp->addAction(*a0, *a1, receiver, slot_signature.constData(), *a3); 59 } 60 else if (sipError == sipErrorContinue) 61 { 62 sipError = sipBadCallableArg(2, a2); 63 } 64%End 65 66 QAction *addMenu(QMenu *menu); 67 QMenu *addMenu(const QString &title) /Transfer/; 68 QMenu *addMenu(const QIcon &icon, const QString &title) /Transfer/; 69 QAction *addSeparator() /Transfer/; 70 QAction *insertMenu(QAction *before, QMenu *menu); 71 QAction *insertSeparator(QAction *before) /Transfer/; 72 void clear(); 73 void setTearOffEnabled(bool); 74 bool isTearOffEnabled() const; 75 bool isTearOffMenuVisible() const; 76 void hideTearOffMenu(); 77 void setDefaultAction(QAction * /KeepReference/); 78 QAction *defaultAction() const; 79 void setActiveAction(QAction *act); 80 QAction *activeAction() const; 81 void popup(const QPoint &p, QAction *action = 0); 82 QAction *exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/; 83%If (Py_v3) 84 QAction *exec() /ReleaseGIL/; 85%End 86 QAction *exec(const QPoint &p, QAction *action = 0) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/; 87%If (Py_v3) 88 QAction *exec(const QPoint &pos, QAction *action = 0) /ReleaseGIL/; 89%End 90 static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at = 0, QWidget *parent = 0) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/; 91%If (Py_v3) 92 static QAction *exec(QList<QAction *> actions, const QPoint &pos, QAction *at = 0, QWidget *parent = 0) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; 93%End 94 virtual QSize sizeHint() const; 95 QRect actionGeometry(QAction *) const; 96 QAction *actionAt(const QPoint &) const; 97 QAction *menuAction() const; 98 QString title() const; 99 void setTitle(const QString &title); 100 QIcon icon() const; 101 void setIcon(const QIcon &icon); 102 void setNoReplayFor(QWidget *widget); 103 104signals: 105 void aboutToHide(); 106 void aboutToShow(); 107 void hovered(QAction *action); 108 void triggered(QAction *action); 109 110protected: 111 int columnCount() const; 112 void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; 113 virtual void changeEvent(QEvent *); 114 virtual void keyPressEvent(QKeyEvent *); 115 virtual void mouseReleaseEvent(QMouseEvent *); 116 virtual void mousePressEvent(QMouseEvent *); 117 virtual void mouseMoveEvent(QMouseEvent *); 118 virtual void wheelEvent(QWheelEvent *); 119 virtual void enterEvent(QEvent *); 120 virtual void leaveEvent(QEvent *); 121 virtual void hideEvent(QHideEvent *); 122 virtual void paintEvent(QPaintEvent *); 123 virtual void actionEvent(QActionEvent *); 124 virtual void timerEvent(QTimerEvent *); 125 virtual bool event(QEvent *); 126 virtual bool focusNextPrevChild(bool next); 127 128public: 129 bool isEmpty() const; 130 bool separatorsCollapsible() const; 131 void setSeparatorsCollapsible(bool collapse); 132%If (Qt_5_1_0 -) 133 QAction *addSection(const QString &text) /Transfer/; 134%End 135%If (Qt_5_1_0 -) 136 QAction *addSection(const QIcon &icon, const QString &text) /Transfer/; 137%End 138%If (Qt_5_1_0 -) 139 QAction *insertSection(QAction *before, const QString &text) /Transfer/; 140%End 141%If (Qt_5_1_0 -) 142 QAction *insertSection(QAction *before, const QIcon &icon, const QString &text) /Transfer/; 143%End 144%If (Qt_5_1_0 -) 145 bool toolTipsVisible() const; 146%End 147%If (Qt_5_1_0 -) 148 void setToolTipsVisible(bool visible); 149%End 150%If (Qt_5_2_0 -) 151%If (WS_MACX) 152%If (PyQt_MacOSXOnly) 153 void setAsDockMenu(); 154%End 155%End 156%End 157%If (Qt_5_7_0 -) 158 void showTearOffMenu(); 159%End 160%If (Qt_5_7_0 -) 161 void showTearOffMenu(const QPoint &pos); 162%End 163}; 164