diff options
Diffstat (limited to 'src/widgets/dialogs/qmessagebox.h')
-rw-r--r-- | src/widgets/dialogs/qmessagebox.h | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index 161719e180..751674466c 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -5,17 +5,14 @@ #define QMESSAGEBOX_H #include <QtWidgets/qtwidgetsglobal.h> -#include <QtWidgets/qapplication.h> #include <QtWidgets/qdialog.h> - -#include <QtCore/qanystringview.h> -#include <QtCore/qdebug.h> -#include <QtCore/qversionnumber.h> +#include <QtWidgets/qdialogbuttonbox.h> QT_REQUIRE_CONFIG(messagebox); QT_BEGIN_NAMESPACE +class QAnyStringView; class QLabel; class QMessageBoxPrivate; class QAbstractButton; @@ -38,7 +35,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog Q_PROPERTY(Options options READ options WRITE setOptions) public: // Keep in sync with MessageBoxOption in qplatformdialoghelper.h - enum class Option : quint8 { + enum class Option { DontUseNativeDialog = 0x00000001 }; Q_FLAG(Option) @@ -68,6 +65,7 @@ public: NRoles }; + Q_ENUM(ButtonRole) enum StandardButton { // keep this in sync with QDialogButtonBox::StandardButton and QPlatformDialogHelper::StandardButton @@ -102,6 +100,8 @@ public: FlagMask = 0x00000300, // obsolete ButtonMask = ~FlagMask // obsolete }; + Q_ENUM(StandardButton) + #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) typedef StandardButton Button; #endif @@ -307,31 +307,13 @@ protected: void changeEvent(QEvent *event) override; private: - Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *)) - Q_PRIVATE_SLOT(d_func(), void _q_clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)) - Q_DISABLE_COPY(QMessageBox) Q_DECLARE_PRIVATE(QMessageBox) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QMessageBox::StandardButtons) -[[maybe_unused]] -static inline void qRequireVersion(int argc, char *argv[], QAnyStringView req) -{ - const auto required = QVersionNumber::fromString(req).normalized(); - const auto current = QVersionNumber::fromString(qVersion()).normalized(); - if (current >= required) - return; - std::unique_ptr<QApplication> application; - if (!qApp) - application = std::make_unique<QApplication>(argc, argv); - const QString message = QApplication::tr("Application \"%1\" requires Qt %2, found Qt %3.") - .arg(qAppName(), required.toString(), current.toString()); - QMessageBox::critical(nullptr, QApplication::tr("Incompatible Qt Library Error"), - message, QMessageBox::Abort); - qFatal().noquote() << message; -} +Q_WIDGETS_EXPORT void qRequireVersion(int argc, char *argv[], QAnyStringView req); #define QT_REQUIRE_VERSION(argc, argv, str) qRequireVersion(argc, argv, str); |