qmenu.sip 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // qmenu.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtWidgets Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  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. class QMenu : public QWidget
  22. {
  23. %TypeHeaderCode
  24. #include <qmenu.h>
  25. %End
  26. public:
  27. explicit QMenu(QWidget *parent /TransferThis/ = 0);
  28. QMenu(const QString &title, QWidget *parent /TransferThis/ = 0);
  29. virtual ~QMenu();
  30. %If (- Qt_6_3_0)
  31. void addAction(QAction *);
  32. %End
  33. %If (- Qt_6_3_0)
  34. QAction *addAction(const QString &text) /Transfer/;
  35. %End
  36. %If (- Qt_6_3_0)
  37. QAction *addAction(const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, const QKeySequence &shortcut = 0) /Transfer/;
  38. %MethodCode
  39. QObject *receiver;
  40. QByteArray slot_signature;
  41. if ((sipError = pyqt6_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. %End
  51. %If (- Qt_6_3_0)
  52. QAction *addAction(const QIcon &icon, const QString &text) /Transfer/;
  53. %End
  54. %If (- Qt_6_3_0)
  55. QAction *addAction(const QIcon &icon, const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, const QKeySequence &shortcut = 0) /Transfer/;
  56. %MethodCode
  57. QObject *receiver;
  58. QByteArray slot_signature;
  59. if ((sipError = pyqt6_qtwidgets_get_connection_parts(a2, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone)
  60. {
  61. sipRes = sipCpp->addAction(*a0, *a1, receiver, slot_signature.constData(), *a3);
  62. }
  63. else if (sipError == sipErrorContinue)
  64. {
  65. sipError = sipBadCallableArg(2, a2);
  66. }
  67. %End
  68. %End
  69. QAction *addMenu(QMenu *menu);
  70. QMenu *addMenu(const QString &title) /Transfer/;
  71. QMenu *addMenu(const QIcon &icon, const QString &title) /Transfer/;
  72. QAction *addSeparator() /Transfer/;
  73. QAction *insertMenu(QAction *before, QMenu *menu);
  74. QAction *insertSeparator(QAction *before) /Transfer/;
  75. void clear();
  76. void setTearOffEnabled(bool);
  77. bool isTearOffEnabled() const;
  78. bool isTearOffMenuVisible() const;
  79. void hideTearOffMenu();
  80. void setDefaultAction(QAction * /KeepReference/);
  81. QAction *defaultAction() const;
  82. void setActiveAction(QAction *act);
  83. QAction *activeAction() const;
  84. void popup(const QPoint &p, QAction *action = 0);
  85. QAction *exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
  86. QAction *exec(const QPoint &p, QAction *action = 0) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
  87. static QAction *exec(const QList<QAction *> &actions, const QPoint &pos, QAction *at = 0, QWidget *parent = 0) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
  88. virtual QSize sizeHint() const;
  89. QRect actionGeometry(QAction *) const;
  90. QAction *actionAt(const QPoint &) const;
  91. QAction *menuAction() const;
  92. QString title() const;
  93. void setTitle(const QString &title);
  94. QIcon icon() const;
  95. void setIcon(const QIcon &icon);
  96. void setNoReplayFor(QWidget *widget);
  97. signals:
  98. void aboutToHide();
  99. void aboutToShow();
  100. void hovered(QAction *action);
  101. void triggered(QAction *action);
  102. protected:
  103. int columnCount() const;
  104. virtual void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const;
  105. virtual void changeEvent(QEvent *);
  106. virtual void keyPressEvent(QKeyEvent *);
  107. virtual void mouseReleaseEvent(QMouseEvent *);
  108. virtual void mousePressEvent(QMouseEvent *);
  109. virtual void mouseMoveEvent(QMouseEvent *);
  110. virtual void wheelEvent(QWheelEvent *);
  111. virtual void enterEvent(QEnterEvent *);
  112. virtual void leaveEvent(QEvent *);
  113. virtual void hideEvent(QHideEvent *);
  114. virtual void paintEvent(QPaintEvent *);
  115. virtual void actionEvent(QActionEvent *);
  116. virtual void timerEvent(QTimerEvent *);
  117. virtual bool event(QEvent *);
  118. virtual bool focusNextPrevChild(bool next);
  119. public:
  120. bool isEmpty() const;
  121. bool separatorsCollapsible() const;
  122. void setSeparatorsCollapsible(bool collapse);
  123. QAction *addSection(const QString &text) /Transfer/;
  124. QAction *addSection(const QIcon &icon, const QString &text) /Transfer/;
  125. QAction *insertSection(QAction *before, const QString &text) /Transfer/;
  126. QAction *insertSection(QAction *before, const QIcon &icon, const QString &text) /Transfer/;
  127. bool toolTipsVisible() const;
  128. void setToolTipsVisible(bool visible);
  129. %If (macOS)
  130. void setAsDockMenu();
  131. %End
  132. void showTearOffMenu();
  133. void showTearOffMenu(const QPoint &pos);
  134. %If (Qt_6_3_0 -)
  135. static QMenu *menuInAction(const QAction *action);
  136. %End
  137. };