qmessagebox.sip 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // qmessagebox.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 QMessageBox : public QDialog
  22. {
  23. %TypeHeaderCode
  24. #include <qmessagebox.h>
  25. %End
  26. public:
  27. enum ButtonRole
  28. {
  29. InvalidRole,
  30. AcceptRole,
  31. RejectRole,
  32. DestructiveRole,
  33. ActionRole,
  34. HelpRole,
  35. YesRole,
  36. NoRole,
  37. ResetRole,
  38. ApplyRole,
  39. };
  40. enum Icon
  41. {
  42. NoIcon,
  43. Information,
  44. Warning,
  45. Critical,
  46. Question,
  47. };
  48. enum StandardButton /BaseType=IntFlag/
  49. {
  50. NoButton,
  51. Ok,
  52. Save,
  53. SaveAll,
  54. Open,
  55. Yes,
  56. YesToAll,
  57. No,
  58. NoToAll,
  59. Abort,
  60. Retry,
  61. Ignore,
  62. Close,
  63. Cancel,
  64. Discard,
  65. Help,
  66. Apply,
  67. Reset,
  68. RestoreDefaults,
  69. FirstButton,
  70. LastButton,
  71. YesAll,
  72. NoAll,
  73. Default,
  74. Escape,
  75. FlagMask,
  76. ButtonMask,
  77. };
  78. typedef QFlags<QMessageBox::StandardButton> StandardButtons;
  79. typedef QMessageBox::StandardButton Button;
  80. explicit QMessageBox(QWidget *parent /TransferThis/ = 0);
  81. QMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::NoButton, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
  82. virtual ~QMessageBox();
  83. QString text() const;
  84. void setText(const QString &);
  85. QMessageBox::Icon icon() const;
  86. void setIcon(QMessageBox::Icon);
  87. QPixmap iconPixmap() const;
  88. void setIconPixmap(const QPixmap &);
  89. Qt::TextFormat textFormat() const;
  90. void setTextFormat(Qt::TextFormat);
  91. static QMessageBox::StandardButton information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/;
  92. static QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No), QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/;
  93. static QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/;
  94. static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/;
  95. static void about(QWidget *parent, const QString &caption, const QString &text) /ReleaseGIL/;
  96. static void aboutQt(QWidget *parent, const QString &title = QString()) /ReleaseGIL/;
  97. static QPixmap standardIcon(QMessageBox::Icon icon);
  98. protected:
  99. virtual bool event(QEvent *e);
  100. virtual void resizeEvent(QResizeEvent *);
  101. virtual void showEvent(QShowEvent *);
  102. virtual void closeEvent(QCloseEvent *);
  103. virtual void keyPressEvent(QKeyEvent *);
  104. virtual void changeEvent(QEvent *);
  105. public:
  106. void addButton(QAbstractButton *button /Transfer/, QMessageBox::ButtonRole role);
  107. QPushButton *addButton(const QString &text, QMessageBox::ButtonRole role) /Transfer/;
  108. QPushButton *addButton(QMessageBox::StandardButton button) /Transfer/;
  109. void removeButton(QAbstractButton *button /TransferBack/);
  110. void setStandardButtons(QMessageBox::StandardButtons buttons);
  111. QMessageBox::StandardButtons standardButtons() const;
  112. QMessageBox::StandardButton standardButton(QAbstractButton *button) const;
  113. QAbstractButton *button(QMessageBox::StandardButton which) const;
  114. QPushButton *defaultButton() const;
  115. void setDefaultButton(QPushButton *button /KeepReference/);
  116. void setDefaultButton(QMessageBox::StandardButton button);
  117. QAbstractButton *escapeButton() const;
  118. void setEscapeButton(QAbstractButton *button /KeepReference/);
  119. void setEscapeButton(QMessageBox::StandardButton button);
  120. QAbstractButton *clickedButton() const;
  121. QString informativeText() const;
  122. void setInformativeText(const QString &text);
  123. QString detailedText() const;
  124. void setDetailedText(const QString &text);
  125. void setWindowTitle(const QString &title);
  126. void setWindowModality(Qt::WindowModality windowModality);
  127. virtual void open();
  128. void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/);
  129. %MethodCode
  130. QObject *receiver;
  131. QByteArray slot_signature;
  132. if ((sipError = pyqt6_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone)
  133. {
  134. sipCpp->open(receiver, slot_signature.constData());
  135. }
  136. else if (sipError == sipErrorContinue)
  137. {
  138. sipError = sipBadCallableArg(0, a0);
  139. }
  140. %End
  141. QList<QAbstractButton *> buttons() const;
  142. QMessageBox::ButtonRole buttonRole(QAbstractButton *button) const;
  143. signals:
  144. void buttonClicked(QAbstractButton *button);
  145. public:
  146. void setTextInteractionFlags(Qt::TextInteractionFlags flags);
  147. Qt::TextInteractionFlags textInteractionFlags() const;
  148. void setCheckBox(QCheckBox *cb);
  149. QCheckBox *checkBox() const;
  150. %If (Qt_6_6_0 -)
  151. enum class Option
  152. {
  153. DontUseNativeDialog,
  154. };
  155. %End
  156. %If (Qt_6_6_0 -)
  157. typedef QFlags<QMessageBox::Option> Options;
  158. %End
  159. %If (Qt_6_6_0 -)
  160. void setOption(QMessageBox::Option option, bool on = true);
  161. %End
  162. %If (Qt_6_6_0 -)
  163. bool testOption(QMessageBox::Option option) const;
  164. %End
  165. %If (Qt_6_6_0 -)
  166. void setOptions(QMessageBox::Options options);
  167. %End
  168. %If (Qt_6_6_0 -)
  169. QMessageBox::Options options() const;
  170. %End
  171. };