QMessageBox: Remove include of qdebug.h
Move the implementation qRequireVersion() to prevent having to include qdebug.h which pulls in many other headers. Amendsb5d874e36f
. Fix missing include introduced by3a553507a1
. Pick-to: 6.6 Task-number: QTBUG-114214 Task-number: QTBUG-97601 Change-Id: Iba68ffca95061666d9458ffa5700d07c7669da5b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
684070bc34
commit
408fbd3f2d
@ -4,6 +4,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "xbeltree.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFileDialog>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
|
@ -30,11 +30,17 @@
|
||||
#include "private/qabstractbutton_p.h"
|
||||
#include <QtGui/qpa/qplatformtheme.h>
|
||||
|
||||
#include <QtCore/qanystringview.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/qversionnumber.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <QtCore/qt_windows.h>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
@ -2841,6 +2847,22 @@ void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHel
|
||||
clickedButton = button;
|
||||
}
|
||||
|
||||
Q_WIDGETS_EXPORT void _q_requireVersion(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("%s", qPrintable(message));
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(6,2)
|
||||
/*!
|
||||
\deprecated
|
||||
|
@ -5,17 +5,13 @@
|
||||
#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>
|
||||
|
||||
QT_REQUIRE_CONFIG(messagebox);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAnyStringView;
|
||||
class QLabel;
|
||||
class QMessageBoxPrivate;
|
||||
class QAbstractButton;
|
||||
@ -319,18 +315,8 @@ 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 _q_requireVersion(int, char *[], QAnyStringView);
|
||||
_q_requireVersion(argc, argv, req);
|
||||
}
|
||||
|
||||
#define QT_REQUIRE_VERSION(argc, argv, str) qRequireVersion(argc, argv, str);
|
||||
|
Loading…
Reference in New Issue
Block a user