diff options
29 files changed, 72 insertions, 454 deletions
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index d1c7b2c328..7a77e995c4 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the qmake application of the Qt Toolkit. @@ -38,16 +38,15 @@ #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> +#include <qjsonarray.h> +#include <qjsondocument.h> +#include <qjsonobject.h> #include <qlist.h> #include <qregularexpression.h> #include <qset.h> #include <qstringlist.h> #include <qtextstream.h> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -# include <qjsondocument.h> -# include <qjsonobject.h> -# include <qjsonarray.h> -#endif + #ifdef PROEVALUATOR_THREAD_SAFE # include <qthreadpool.h> #endif @@ -222,9 +221,7 @@ void QMakeEvaluator::initFunctionStatics() { "infile", T_INFILE, 2, 3, "file, var, [values]" }, { "count", T_COUNT, 2, 3, "var, count, [op=operator]" }, { "isEmpty", T_ISEMPTY, 1, 1, "var" }, -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) { "parseJson", T_PARSE_JSON, 2, 2, "var, into" }, -#endif { "load", T_LOAD, 1, 2, "feature, [ignore_errors=false]" }, { "include", T_INCLUDE, 1, 3, "file, [into, [silent]]" }, { "debug", T_DEBUG, 2, 2, "level, message" }, @@ -362,7 +359,6 @@ QMakeEvaluator::quoteValue(const ProString &val) return ret; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) static void addJsonValue(const QJsonValue &value, const QString &keyPrefix, ProValueMap *map); static void insertJsonKeyValue(const QString &key, const QStringList &values, ProValueMap *map) @@ -474,7 +470,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::parseJsonInto(const QByteArray &json return QMakeEvaluator::ReturnTrue; } -#endif QMakeEvaluator::VisitReturn QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::OpenMode mode, @@ -1729,14 +1724,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( m_valuemapStack.top()[var] = statics.fakeValue; return ReturnTrue; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) case T_PARSE_JSON: { QByteArray json = values(args.at(0).toKey()).join(QLatin1Char(' ')).toUtf8(); ProStringRoUser u1(args.at(1), m_tmp2); QString parseInto = u1.str(); return parseJsonInto(json, parseInto, &m_valuemapStack.top()); } -#endif case T_INCLUDE: { QString parseInto; LoadFlags flags; diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 582073a3b2..ad7df773ed 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com> ** Contact: https://www.qt.io/licensing/ @@ -159,14 +159,6 @@ static inline QBasicMutex *signalSlotLock(const QObject *o) return &_q_ObjectMutexPool[uint(quintptr(o)) % sizeof(_q_ObjectMutexPool)/sizeof(QBasicMutex)]; } -#if QT_VERSION < 0x60000 -extern "C" Q_CORE_EXPORT void qt_addObject(QObject *) -{} - -extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) -{} -#endif - void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = nullptr; void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = nullptr; int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = nullptr; @@ -953,9 +945,6 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent) QT_RETHROW; } } -#if QT_VERSION < 0x60000 - qt_addObject(this); -#endif if (Q_UNLIKELY(qtHookData[QHooks::AddQObject])) reinterpret_cast<QHooks::AddQObjectCallback>(qtHookData[QHooks::AddQObject])(this); Q_TRACE(QObject_ctor, this); @@ -1114,9 +1103,6 @@ QObject::~QObject() if (!d->children.isEmpty()) d->deleteChildren(); -#if QT_VERSION < 0x60000 - qt_removeObject(this); -#endif if (Q_UNLIKELY(qtHookData[QHooks::RemoveQObject])) reinterpret_cast<QHooks::RemoveQObjectCallback>(qtHookData[QHooks::RemoveQObject])(this); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index a6a4d588d3..09c14f1ec1 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1934,33 +1934,7 @@ static QMessageBox::StandardButton newButton(int button) if (button == QMessageBox::NoButton || (button & NewButtonMask)) return QMessageBox::StandardButton(button & QMessageBox::ButtonMask); -#if QT_VERSION < 0x050000 - // this is needed for binary compatibility with Qt 4.0 and 4.1 - switch (button & Old_ButtonMask) { - case Old_Ok: - return QMessageBox::Ok; - case Old_Cancel: - return QMessageBox::Cancel; - case Old_Yes: - return QMessageBox::Yes; - case Old_No: - return QMessageBox::No; - case Old_Abort: - return QMessageBox::Abort; - case Old_Retry: - return QMessageBox::Retry; - case Old_Ignore: - return QMessageBox::Ignore; - case Old_YesAll: - return QMessageBox::YesToAll; - case Old_NoAll: - return QMessageBox::NoToAll; - default: - return QMessageBox::NoButton; - } -#else return QMessageBox::NoButton; -#endif } static bool detectedCompat(int button0, int button1, int button2) diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index c481bf7639..63cce0bd80 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -84,9 +84,7 @@ PlatformInfo PlatformInfo::localHostInfo() pi.insert(PI_HostName, QHostInfo::localHostName()); pi.insert(PI_QtVersion, QLS(qVersion())); pi.insert(PI_QMakeSpec, QString(QLS(QMAKESPEC)).remove(QRegularExpression(QLS("^.*mkspecs/")))); -#if QT_VERSION >= 0x050000 pi.insert(PI_QtBuildMode, QLibraryInfo::isDebugBuild() ? QLS("QtDebug") : QLS("QtRelease")); -#endif #if defined(Q_OS_LINUX) && QT_CONFIG(process) pi.insert(PI_OSName, QLS("Linux")); #elif defined(Q_OS_WIN) diff --git a/tests/manual/diaglib/debugproxystyle.cpp b/tests/manual/diaglib/debugproxystyle.cpp index 002220507b..cf73ae2ef8 100644 --- a/tests/manual/diaglib/debugproxystyle.cpp +++ b/tests/manual/diaglib/debugproxystyle.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -34,37 +34,21 @@ #include <QStyleOption> #include <QApplication> -#if QT_VERSION < 0x050000 -QDebug operator<<(QDebug d, const QPixmap &p) -{ - d << "QPixmap(" << p.size() << ')'; - return d; -} -#endif // QT_VERSION < 0x050000 - QDebug operator<<(QDebug debug, const QStyleOption *option) { -#if QT_VERSION >= 0x050000 QDebugStateSaver saver(debug); -# if QT_VERSION >= 0x050400 debug.noquote(); -# endif debug.nospace(); -#endif if (!option) { debug << "QStyleOption(0)"; return debug; } if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { debug << "QStyleOptionViewItem("; -#if QT_VERSION >= 0x050000 debug << ivo->index; if (const int textSize = ivo->text.size()) debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"'; debug << ", "; -#else // Qt 5 - Q_UNUSED(ivo); -#endif } else { debug << "QStyleOption("; } @@ -72,10 +56,8 @@ QDebug operator<<(QDebug debug, const QStyleOption *option) << option->rect.x() << option->rect.y() << Qt::noforcesign; if (option->state != QStyle::State_None) debug << ", state=" << option->state; -#if QT_VERSION >= 0x050000 if (option->styleObject && !option->styleObject->isWidgetType()) debug << ", styleObject=" << QtDiag::formatQObject(option->styleObject); -#endif debug << ')'; return debug; } @@ -84,15 +66,9 @@ namespace QtDiag { DebugProxyStyle::DebugProxyStyle(QStyle *style) : QProxyStyle(style) { -#if QT_VERSION >= 0x050000 const qreal devicePixelRatio = qApp->devicePixelRatio(); -#else - const qreal devicePixelRatio = 1; -#endif qDebug() << __FUNCTION__ << QT_VERSION_STR -#if QT_VERSION >= 0x050000 << QGuiApplication::platformName() -#endif << style->objectName() << "devicePixelRatio=" << devicePixelRatio; } diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp index b99d4099e3..2a434a2cdb 100644 --- a/tests/manual/diaglib/eventfilter.cpp +++ b/tests/manual/diaglib/eventfilter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -31,17 +31,11 @@ #include <QtCore/QDebug> #include <QtCore/QTextStream> -#if QT_VERSION >= 0x050000 -# if defined(QT_WIDGETS_LIB) -# define HAVE_APPLICATION -# endif -# if defined(QT_GUI_LIB) -# define HAVE_GUI_APPLICATION -# endif -#else // Qt 5 -# if defined(QT_GUI_LIB) -# define HAVE_APPLICATION -# endif +#if defined(QT_WIDGETS_LIB) +# define HAVE_APPLICATION +#endif +#if defined(QT_GUI_LIB) +# define HAVE_GUI_APPLICATION #endif #ifdef HAVE_APPLICATION @@ -82,9 +76,7 @@ void EventFilter::init(EventCategories eventCategories) m_eventTypes << QEvent::MouseMove << QEvent::NonClientAreaMouseMove; if (eventCategories & TouchEvents) { m_eventTypes << QEvent::TouchBegin << QEvent::TouchUpdate << QEvent::TouchEnd; -#if QT_VERSION >= 0x050000 m_eventTypes << QEvent::TouchCancel; -#endif } if (eventCategories & TabletEvents) { m_eventTypes << QEvent::TabletEnterProximity << QEvent::TabletLeaveProximity @@ -100,9 +92,7 @@ void EventFilter::init(EventCategories eventCategories) } if (eventCategories & FocusEvents) { m_eventTypes -#if QT_VERSION >= 0x050000 << QEvent::FocusAboutToChange -#endif << QEvent::FocusIn << QEvent::FocusOut; } if (eventCategories & GeometryEvents) @@ -110,17 +100,13 @@ void EventFilter::init(EventCategories eventCategories) if (eventCategories & PaintEvents) { m_eventTypes << QEvent::UpdateRequest << QEvent::Paint << QEvent::Show << QEvent::Hide; -#if QT_VERSION >= 0x050000 m_eventTypes << QEvent::Expose; -#endif } if (eventCategories & StateChangeEvents) { m_eventTypes << QEvent::WindowStateChange << QEvent::WindowBlocked << QEvent::WindowUnblocked -#if QT_VERSION >= 0x050000 << QEvent::ApplicationStateChange -#endif << QEvent::ApplicationActivate << QEvent::ApplicationDeactivate; } if (eventCategories & TimerEvents) @@ -131,9 +117,7 @@ void EventFilter::init(EventCategories eventCategories) } if (eventCategories & InputMethodEvents) { m_eventTypes << QEvent::InputMethod; -#if QT_VERSION >= 0x050000 m_eventTypes << QEvent::InputMethodQuery; -#endif } #ifndef QT_NO_GESTURES if (eventCategories & GestureEvents) { @@ -147,10 +131,8 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types) { if (o->isWidgetType()) return types & EventFilter::QWidgetType; -#if QT_VERSION >= 0x050000 if (o->isWindowType()) return types & EventFilter::QWindowType; -#endif return types & EventFilter::OtherType; } @@ -215,9 +197,7 @@ bool EventFilter::eventFilter(QObject *o, QEvent *e) formatObject(o, debug); debug << ' ' << e; switch (e->type()) { -#if QT_VERSION >= 0x050000 case QEvent::FocusAboutToChange: -#endif case QEvent::FocusIn: formatApplicationState(debug); break; @@ -230,9 +210,7 @@ bool EventFilter::eventFilter(QObject *o, QEvent *e) case QEvent::NonClientAreaMouseButtonPress: case QEvent::NonClientAreaMouseButtonRelease: case QEvent::NonClientAreaMouseMove: -# if QT_VERSION >= 0x050000 case QEvent::Enter: -# endif case QEvent::Leave: formatMouseState(o, debug); break; diff --git a/tests/manual/diaglib/glinfo.cpp b/tests/manual/diaglib/glinfo.cpp index d8aec5298a..663ceabc05 100644 --- a/tests/manual/diaglib/glinfo.cpp +++ b/tests/manual/diaglib/glinfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -30,24 +30,16 @@ #include <QOpenGLFunctions> #include <QtOpenGLWidgets/QOpenGLWidget> -#if QT_VERSION > 0x050000 -# if QT_VERSION >= 0x050400 -# include <QtOpenGL/QOpenGLWindow> -# else // 5.4 -# include <QtGui/QWindow> -# endif // 5.0..5.4 -# include <QtGui/QOpenGLContext> -# include <QtGui/QOpenGLFunctions> -# include <QtGui/QWindow> -#endif +#include <QtOpenGL/QOpenGLWindow> +#include <QtGui/QOpenGLContext> +#include <QtGui/QOpenGLFunctions> +#include <QtGui/QWindow> #include <QtCore/QDebug> #include <QtCore/QString> #include <QtCore/QTimer> namespace QtDiag { -#if QT_VERSION > 0x050000 - static QString getGlString(const QOpenGLContext *ctx, GLenum name) { if (const GLubyte *p = ctx->functions()->glGetString(name)) @@ -64,7 +56,6 @@ static QString glInfo(const QOpenGLContext *ctx) QString glInfo(const QObject *o) { -# if QT_VERSION >= 0x050400 if (o->isWindowType()) { if (const QOpenGLWindow *oglw = qobject_cast<const QOpenGLWindow *>(o)) return glInfo(oglw->context()); @@ -74,25 +65,8 @@ QString glInfo(const QObject *o) if (o->isWidgetType()) { if (const QOpenGLWidget *g = qobject_cast<const QOpenGLWidget *>(o)) return glInfo(g->context()); -# endif // 5.4 } return QString(); } -#else // Qt4: - -static QString getGlString(GLenum name) -{ - if (const GLubyte *p = glGetString(name)) - return QString::fromLatin1(reinterpret_cast<const char *>(p)); - return QString(); -} - -QString glInfo(const QObject *) -{ - return getGlString(GL_VENDOR) + QLatin1Char('\n') + getGlString(GL_RENDERER); -} - -#endif - } // namespace QtDiag diff --git a/tests/manual/diaglib/logwidget.cpp b/tests/manual/diaglib/logwidget.cpp index 0089664a60..a1822d7ed4 100644 --- a/tests/manual/diaglib/logwidget.cpp +++ b/tests/manual/diaglib/logwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -27,15 +27,13 @@ ****************************************************************************/ #include "logwidget.h" -#if QT_VERSION >= 0x050000 -# include <QtCore/qlogging.h> -# include <QtCore/QLibraryInfo> -#endif #include <QApplication> #include <QStyle> #include <QtCore/QDebug> +#include <QtCore/QLibraryInfo> #include <QtCore/QList> +#include <QtCore/qlogging.h> #include <QtCore/QStringList> #include <iostream> @@ -60,19 +58,13 @@ LogWidget::~LogWidget() QString LogWidget::startupMessage() { QString result; -#if QT_VERSION >= 0x050300 result += QLatin1String(QLibraryInfo::build()); -#else - result += QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR); -#endif const QCoreApplication *coreApp = QCoreApplication::instance(); -#if QT_VERSION >= 0x050000 if (qobject_cast<const QGuiApplication *>(coreApp)) { result += QLatin1Char(' '); result += QGuiApplication::platformName(); } -#endif if (qobject_cast<const QApplication *>(coreApp)) { result += QLatin1Char(' '); result += QApplication::style()->objectName(); diff --git a/tests/manual/diaglib/nativewindowdump.cpp b/tests/manual/diaglib/nativewindowdump.cpp index a854e8a790..2937665bad 100644 --- a/tests/manual/diaglib/nativewindowdump.cpp +++ b/tests/manual/diaglib/nativewindowdump.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -28,25 +28,20 @@ #include "nativewindowdump.h" -#if QT_VERSION >= 0x050000 -# include <QtGui/QGuiApplication> -# include <qpa/qplatformnativeinterface.h> -#endif - +#include <QtGui/QGuiApplication> +#include <qpa/qplatformnativeinterface.h> #include <QtCore/QDebug> namespace QtDiag { void dumpNativeWindows(WId wid) { -#if QT_VERSION >= 0x050000 QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface(); QString result; QMetaObject::invokeMethod(ni, "dumpNativeWindows", Qt::DirectConnection, Q_RETURN_ARG(QString, result), Q_ARG(WId, wid)); qDebug().noquote() << result; -#endif // Qt 5 } void dumpNativeQtTopLevels() diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp index 8fbd634937..f88b189665 100644 --- a/tests/manual/diaglib/nativewindowdump_win.cpp +++ b/tests/manual/diaglib/nativewindowdump_win.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -262,11 +262,7 @@ static void dumpNativeWindows(const WIdVector& wins) dc.stream = QSharedPointer<QTextStream>(new QTextStream(&s)); for (WId win : wins) dumpNativeWindowRecursion(reinterpret_cast<HWND>(win), &dc); -#if QT_VERSION >= 0x050400 qDebug().noquote() << s; -#else - qDebug("%s", qPrintable(s)); -#endif } void dumpNativeWindows(WId rootIn) diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp index b1d2a37d0e..95c4b175d8 100644 --- a/tests/manual/diaglib/qwidgetdump.cpp +++ b/tests/manual/diaglib/qwidgetdump.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -28,14 +28,13 @@ #include "qwidgetdump.h" -#include <QWidget> -#if QT_VERSION > 0x050000 -# include <QtGui/QScreen> -# include <QtGui/QWindow> -#endif #include <QApplication> -#include <QtCore/QMetaObject> +#include <QWidget> +#include <QtGui/QScreen> +#include <QtGui/QWindow> + #include <QtCore/QDebug> +#include <QtCore/QMetaObject> #include <QtCore/QTextStream> namespace QtDiag { @@ -99,11 +98,9 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w, formatRect(str, w->geometry()); if (w->isWindow()) { str << ' ' << w->logicalDpiX() << "DPI"; -#if QT_VERSION > 0x050600 const qreal dpr = w->devicePixelRatio(); if (!qFuzzyCompare(dpr, qreal(1))) str << " dpr=" << dpr; -#endif // Qt 5.6 const QRect normalGeometry = w->normalGeometry(); if (normalGeometry.isValid() && !normalGeometry.isEmpty() && normalGeometry != w->geometry()) { str << " normal="; @@ -130,13 +127,11 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w, str << "maximumSize=" << maximumSize.width() << 'x' << maximumSize.height() << ' '; } str << '\n'; -#if QT_VERSION > 0x050000 if (const QWindow *win = w->windowHandle()) { indentStream(str, 2 * (1 + depth)); formatWindow(str, win, options); str << '\n'; } -#endif // Qt 5 for (const QObject *co : w->children()) { if (co->isWidgetType()) dumpWidgetRecursion(str, static_cast<const QWidget *>(co), options, depth + 1); @@ -155,14 +150,8 @@ void dumpAllWidgets(FormatWindowOptions options, const QWidget *root) topLevels = QApplication::topLevelWidgets(); for (QWidget *tw : qAsConst(topLevels)) dumpWidgetRecursion(str, tw, options); -#if QT_VERSION >= 0x050400 - { - for (const QString &line : d.split(QLatin1Char('\n'))) - qDebug().noquote() << line; - } -#else - qDebug("%s", qPrintable(d)); -#endif + for (const QString &line : d.split(QLatin1Char('\n'))) + qDebug().noquote() << line; } } // namespace QtDiag diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp index 1e46f62b1d..2e5b3e0f96 100644 --- a/tests/manual/diaglib/qwindowdump.cpp +++ b/tests/manual/diaglib/qwindowdump.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -28,21 +28,18 @@ #include "qwindowdump.h" -#if QT_VERSION > 0x050000 -# include <QtGui/QGuiApplication> -# include <QtGui/QScreen> -# include <QtGui/QWindow> -# include <qpa/qplatformwindow.h> -# include <private/qwindow_p.h> -# if QT_VERSION >= 0x050600 -# include <private/qhighdpiscaling_p.h> -# endif -#endif +#include <QtGui/QGuiApplication> +#include <QtGui/QScreen> +#include <QtGui/QWindow> +#include <QtCore/QDebug> #include <QtCore/QMetaObject> #include <QtCore/QRect> -#include <QtCore/QDebug> #include <QtCore/QTextStream> +#include <qpa/qplatformwindow.h> +#include <private/qwindow_p.h> +#include <private/qhighdpiscaling_p.h> + namespace QtDiag { void indentStream(QTextStream &s, int indent) @@ -87,10 +84,8 @@ void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) debugType(str, windowType, Qt::SplashScreen) debugType(str, windowType, Qt::Desktop) debugType(str, windowType, Qt::SubWindow) -#if QT_VERSION > 0x050000 debugType(str, windowType, Qt::ForeignWindow) debugType(str, windowType, Qt::CoverWindow) -#endif debugFlag(str, flags, Qt::MSWindowsFixedSizeDialogHint) debugFlag(str, flags, Qt::MSWindowsOwnDC) debugFlag(str, flags, Qt::X11BypassWindowManagerHint) @@ -103,20 +98,16 @@ void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) debugFlag(str, flags, Qt::WindowShadeButtonHint) debugFlag(str, flags, Qt::WindowStaysOnTopHint) debugFlag(str, flags, Qt::CustomizeWindowHint) -#if QT_VERSION > 0x050000 debugFlag(str, flags, Qt::WindowTransparentForInput) debugFlag(str, flags, Qt::WindowOverridesSystemGestures) debugFlag(str, flags, Qt::WindowDoesNotAcceptFocus) debugFlag(str, flags, Qt::NoDropShadowWindowHint) debugFlag(str, flags, Qt::WindowFullscreenButtonHint) -#endif debugFlag(str, flags, Qt::WindowStaysOnBottomHint) debugFlag(str, flags, Qt::MacWindowToolBarButtonHint) debugFlag(str, flags, Qt::BypassGraphicsProxyWidget) } -#if QT_VERSION > 0x050000 - void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions options) { const QPlatformWindow *pw = w->handle(); @@ -137,10 +128,8 @@ void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions option formatRect(str, w->geometry()); if (w->isTopLevel()) { str << " \"" << w->screen()->name() << "\" "; -#if QT_VERSION >= 0x050600 if (QHighDpiScaling::isActive()) str << "factor=" << QHighDpiScaling::factor(w) << " dpr=" << w->devicePixelRatio(); -#endif } if (!(options & DontPrintWindowFlags)) { str << ' '; @@ -176,24 +165,7 @@ void dumpAllWindows(FormatWindowOptions options) str << "### QWindows:\n"; for (QWindow *w : QGuiApplication::topLevelWindows()) dumpWindowRecursion(str, w, options); -#if QT_VERSION >= 0x050400 qDebug().noquote() << d; -#else - qDebug() << d; -#endif } -#else // Qt 5 -class QWindow {}; - -void formatWindow(QTextStream &, const QWindow *, FormatWindowOptions) -{ -} - -void dumpAllWindows(FormatWindowOptions options) -{ -} - -#endif // Qt 4 - } // namespace QtDiag diff --git a/tests/manual/diaglib/textdump.cpp b/tests/manual/diaglib/textdump.cpp index 54a251928a..544f094fd1 100644 --- a/tests/manual/diaglib/textdump.cpp +++ b/tests/manual/diaglib/textdump.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -41,28 +41,20 @@ struct EnumLookup { static const EnumLookup specialCharactersEnumLookup[] = { {QChar::Null, "Null"}, -#if QT_VERSION >= 0x050000 {QChar::Tabulation, "Tabulation"}, {QChar::LineFeed, "LineFeed"}, -# if QT_VERSION >= 0x050e00 {QChar::FormFeed, "FormFeed"}, -# endif {QChar::CarriageReturn, "CarriageReturn"}, {QChar::Space, "Space"}, -#endif {QChar::Nbsp, "Nbsp"}, -#if QT_VERSION >= 0x050000 {QChar::SoftHyphen, "SoftHyphen"}, -#endif {QChar::ReplacementCharacter, "ReplacementCharacter"}, {QChar::ObjectReplacementCharacter, "ObjectReplacementCharacter"}, {QChar::ByteOrderMark, "ByteOrderMark"}, {QChar::ByteOrderSwapped, "ByteOrderSwapped"}, {QChar::ParagraphSeparator, "ParagraphSeparator"}, {QChar::LineSeparator, "LineSeparator"}, -#if QT_VERSION >= 0x050000 {QChar::LastValidCodePoint, "LastValidCodePoint"} -#endif }; static const EnumLookup categoryEnumLookup[] = @@ -105,8 +97,6 @@ static const EnumLookup categoryEnumLookup[] = {QChar::Symbol_Other, "Symbol_Other"}, }; -#if QT_VERSION >= 0x050100 - static const EnumLookup scriptEnumLookup[] = { {QChar::Script_Unknown, "Script_Unknown"}, @@ -221,7 +211,6 @@ static const EnumLookup scriptEnumLookup[] = {QChar::Script_SoraSompeng, "Script_SoraSompeng"}, {QChar::Script_Takri, "Script_Takri"}, -#if QT_VERSION >= 0x050500 {QChar::Script_CaucasianAlbanian, "Script_CaucasianAlbanian"}, {QChar::Script_BassaVah, "Script_BassaVah"}, {QChar::Script_Duployan, "Script_Duployan"}, @@ -245,20 +234,15 @@ static const EnumLookup scriptEnumLookup[] = {QChar::Script_Khudawadi, "Script_Khudawadi"}, {QChar::Script_Tirhuta, "Script_Tirhuta"}, {QChar::Script_WarangCiti, "Script_WarangCiti"}, -#endif // Qt 5.5 -#if QT_VERSION >= 0x050600 {QChar::Script_Ahom, "Script_Ahom"}, {QChar::Script_AnatolianHieroglyphs, "Script_AnatolianHieroglyphs"}, {QChar::Script_Hatran, "Script_Hatran"}, {QChar::Script_Multani, "Script_Multani"}, {QChar::Script_OldHungarian, "Script_OldHungarian"}, {QChar::Script_SignWriting, "Script_SignWriting"}, -#endif // Qt 5.5 }; -#endif // Qt 5.1 - static const EnumLookup directionEnumLookup[] = { {QChar::DirL, "DirL"}, @@ -280,12 +264,10 @@ static const EnumLookup directionEnumLookup[] = {QChar::DirPDF, "DirPDF"}, {QChar::DirNSM, "DirNSM"}, {QChar::DirBN, "DirBN"}, -#if QT_VERSION >= 0x050000 {QChar::DirLRI, "DirLRI"}, {QChar::DirRLI, "DirRLI"}, {QChar::DirFSI, "DirFSI"}, {QChar::DirPDI, "DirPDI"}, -#endif }; static const EnumLookup decompositionEnumLookup[] = @@ -310,8 +292,6 @@ static const EnumLookup decompositionEnumLookup[] = {QChar::Fraction, "Fraction"}, }; -#if QT_VERSION >= 0x050000 - static const EnumLookup joiningTypeEnumLookup[] = { {QChar::Joining_None, "Joining_None"}, @@ -322,8 +302,6 @@ static const EnumLookup joiningTypeEnumLookup[] = {QChar::Joining_Transparent, "Joining_Transparent"} }; -#endif // Qt 5 - static const EnumLookup combiningClassEnumLookup[] = { {QChar::Combining_BelowLeftAttached, "Combining_BelowLeftAttached"}, @@ -361,20 +339,14 @@ static const EnumLookup unicodeVersionEnumLookup[] = {QChar::Unicode_4_0, "Unicode_4_0"}, {QChar::Unicode_4_1, "Unicode_4_1"}, {QChar::Unicode_5_0, "Unicode_5_0"}, -#if QT_VERSION >= 0x050000 {QChar::Unicode_5_1, "Unicode_5_1"}, {QChar::Unicode_5_2, "Unicode_5_2"}, {QChar::Unicode_6_0, "Unicode_6_0"}, {QChar::Unicode_6_1, "Unicode_6_1"}, {QChar::Unicode_6_2, "Unicode_6_2"}, {QChar::Unicode_6_3, "Unicode_6_3"}, -#if QT_VERSION >= 0x050500 {QChar::Unicode_7_0, "Unicode_7_0"}, -#endif // Qt 5.5 -#if QT_VERSION >= 0x050600 {QChar::Unicode_8_0, "Unicode_8_0"}, -#endif // Qt 5.6 -#endif // Qt 5 }; static const EnumLookup *enumLookup(int v, const EnumLookup *array, size_t size) @@ -423,7 +395,6 @@ static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext << enumName(category, categoryEnumLookup, sizeof(categoryEnumLookup) / sizeof(EnumLookup)); context.category = category; } -#if QT_VERSION >= 0x050100 const int script = qc.script(); if (script != context.script) { str << " script=" @@ -431,21 +402,18 @@ static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext << '(' << script << ')'; context.script = script; } -#endif // Qt 5 const int direction = qc.direction(); if (direction != context.direction) { str << " direction=" << enumName(direction, directionEnumLookup, sizeof(directionEnumLookup) / sizeof(EnumLookup)); context.direction = direction; } -#if QT_VERSION >= 0x050000 const int joiningType = qc.joiningType(); if (joiningType != context.joiningType) { str << " joiningType=" << enumName(joiningType, joiningTypeEnumLookup, sizeof(joiningTypeEnumLookup) / sizeof(EnumLookup)); context.joiningType = joiningType; } -#endif // Qt 5QWidget const int decompositionTag = qc.decompositionTag(); if (decompositionTag != context.decompositionTag) { str << " decomposition=" diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp index 9f2ae559d7..f72ab3d107 100644 --- a/tests/manual/dialogs/filedialogpanel.cpp +++ b/tests/manual/dialogs/filedialogpanel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -326,7 +326,6 @@ void FileDialogPanel::getOpenFileNames() void FileDialogPanel::getOpenFileUrls() { -#if QT_VERSION >= 0x050000 QString selectedFilter = m_selectedNameFilter->text().trimmed(); const QList<QUrl> files = QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)), @@ -339,7 +338,6 @@ void FileDialogPanel::getOpenFileUrls() << "\nName filter: " << selectedFilter; QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok); } -#endif // Qt 5 } void FileDialogPanel::getOpenFileName() @@ -359,7 +357,6 @@ void FileDialogPanel::getOpenFileName() void FileDialogPanel::getOpenFileUrl() { -#if QT_VERSION >= 0x050000 QString selectedFilter = m_selectedNameFilter->text().trimmed(); const QUrl file = QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)), @@ -372,7 +369,6 @@ void FileDialogPanel::getOpenFileUrl() << "\nName filter: " << selectedFilter; QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok); } -#endif // Qt 5 } void FileDialogPanel::getSaveFileName() @@ -392,7 +388,6 @@ void FileDialogPanel::getSaveFileName() void FileDialogPanel::getSaveFileUrl() { -#if QT_VERSION >= 0x050000 QString selectedFilter = m_selectedNameFilter->text().trimmed(); const QUrl file = QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)), @@ -405,7 +400,6 @@ void FileDialogPanel::getSaveFileUrl() << "\nName filter: " << selectedFilter; QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok); } -#endif // Qt 5 } void FileDialogPanel::getExistingDirectory() @@ -419,14 +413,12 @@ void FileDialogPanel::getExistingDirectory() void FileDialogPanel::getExistingDirectoryUrl() { -#if QT_VERSION >= 0x050000 const QUrl dir = QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)), currentDirectoryUrl(), options() | QFileDialog::ShowDirsOnly, allowedSchemes()); if (!dir.isEmpty()) QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok); -#endif // Qt 5 } void FileDialogPanel::restoreDefaults() @@ -473,11 +465,9 @@ void FileDialogPanel::applySettings(QFileDialog *d) const if (!filter.isEmpty()) d->selectNameFilter(filter); } else { -#if QT_VERSION >= 0x050000 d->setMimeTypeFilters(filters); if (!filter.isEmpty()) d->selectMimeTypeFilter(filter); -#endif // Qt 5 } foreach (LabelLineEdit *l, m_labelLineEdits) l->apply(d); @@ -504,14 +494,10 @@ void FileDialogPanel::accepted() Q_ASSERT(d); m_result.clear(); QDebug(&m_result).nospace() -#if QT_VERSION >= 0x050000 << "URLs: " << d->selectedUrls() << '\n' -#endif << "Files: " << d->selectedFiles() << "\nDirectory: " -#if QT_VERSION >= 0x050000 << d->directoryUrl() << ", " -#endif << d->directory().absolutePath() << "\nName filter: " << d->selectedNameFilter(); QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent. diff --git a/tests/manual/dialogs/fontdialogpanel.cpp b/tests/manual/dialogs/fontdialogpanel.cpp index 8ed52a8a75..629fa95262 100644 --- a/tests/manual/dialogs/fontdialogpanel.cpp +++ b/tests/manual/dialogs/fontdialogpanel.cpp @@ -196,12 +196,10 @@ void FontDialogPanel::applySettings(QFontDialog *d) const { d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked()); d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked()); -#if QT_VERSION >= 0x050000 d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked()); d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked()); d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked()); d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked()); -#endif // Qt 5 QFont font = m_fontFamilyBox->currentFont(); font.setPointSizeF(m_fontSizeBox->value()); diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp index da9daab942..90915b18ea 100644 --- a/tests/manual/dialogs/main.cpp +++ b/tests/manual/dialogs/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -59,15 +59,9 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QFormLayout *mainLayout = new QFormLayout(this); -#if QT_VERSION >= 0x050600 mainLayout->addRow(new QLabel(QLibraryInfo::build())); -#else - mainLayout->addRow(new QLabel(QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR ))); -#endif mainLayout->addRow("Style:", new QLabel(qApp->style()->objectName())); -#if QT_VERSION >= 0x050600 mainLayout->addRow("DPR:", new QLabel(QString::number(qApp->devicePixelRatio()))); -#endif const QString resolution = QString::number(logicalDpiX()) + QLatin1Char(',') + QString::number(logicalDpiY()) + QLatin1String("dpi"); mainLayout->addRow("Resolution:", new QLabel(resolution)); @@ -129,9 +123,7 @@ int main(int argc, char *argv[]) for (int a = 1; a < argc; ++a) { if (!qstrcmp(argv[a], "-n")) { qDebug("AA_DontUseNativeDialogs"); -#if QT_VERSION >= 0x050700 QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs); -#endif } else if (!qstrcmp(argv[a], "-p")) { optNoPrinter = true; // Avoid startup slowdown by printer code } diff --git a/tests/manual/dialogs/messageboxpanel.cpp b/tests/manual/dialogs/messageboxpanel.cpp index 6a305523ea..25c230a855 100644 --- a/tests/manual/dialogs/messageboxpanel.cpp +++ b/tests/manual/dialogs/messageboxpanel.cpp @@ -138,11 +138,9 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box) if (box.standardButtons() == QMessageBox::StandardButtons()) box.setStandardButtons(QMessageBox::Ok); // just to have something. -#if QT_VERSION >= 0x050000 box.setCheckBox(0); if (m_checkboxText->text().length() > 0) box.setCheckBox(new QCheckBox(m_checkboxText->text())); -#endif // Qt 5 box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex()); } @@ -167,14 +165,12 @@ void MessageBoxPanel::doExec() QString sres; sres.setNum(res, 16); m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres)); -#if QT_VERSION >= 0x050000 if (m_msgbox->checkBox()) { if (m_msgbox->checkBox()->isChecked()) m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked")); else m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked")); } -#endif // Qt 5 } void MessageBoxPanel::doShowApply() diff --git a/tests/manual/dialogs/printdialogpanel.h b/tests/manual/dialogs/printdialogpanel.h index 618e34d596..0f34d01033 100644 --- a/tests/manual/dialogs/printdialogpanel.h +++ b/tests/manual/dialogs/printdialogpanel.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -33,9 +33,7 @@ #include "ui_printdialogpanel.h" -#if QT_VERSION >= 0x050300 #include <QPageLayout> -#endif #include <QPrinter> #include <QWidget> @@ -50,31 +48,6 @@ QT_END_NAMESPACE class PageSizeControl; class OptionsControl; -#if QT_VERSION < 0x050300 -// Copied from class QPageLayout introduced in Qt 5.3 -namespace QPageLayout -{ - enum Unit { - Millimeter, - Point, - Inch, - Pica, - Didot, - Cicero - }; - - enum Orientation { - Portrait, - Landscape - }; - - enum Mode { - StandardMode, // Paint Rect includes margins - FullPageMode // Paint Rect excludes margins - }; -} -#endif - class PrintDialogPanel : public QWidget { Q_OBJECT @@ -107,12 +80,7 @@ private: bool m_blockSignals; Ui::PrintDialogPanel m_panel; -#if QT_VERSION >= 0x050300 QPageLayout m_pageLayout; -#else - QPrinter m_printerLayout; - QPrinter::Unit m_units; -#endif QScopedPointer<QPrinter> m_printer; }; diff --git a/tests/manual/filetest/main.cpp b/tests/manual/filetest/main.cpp index 290dc7064e..7a19599858 100644 --- a/tests/manual/filetest/main.cpp +++ b/tests/manual/filetest/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -196,10 +196,6 @@ static int rm(const char *fileName) static int rmr(const char *dirName) { -#if QT_VERSION < 0x050000 - Q_UNUSED(dirName); - return 1; -#else QDir dir(QString::fromLocal8Bit(dirName)); if (!dir.removeRecursively()) { qWarning().nospace() << "Failed to remove " << dir.absolutePath(); @@ -207,7 +203,6 @@ static int rmr(const char *dirName) } return 0; -#endif } int main(int argc, char *argv[]) diff --git a/tests/manual/qcursor/qcursorhighdpi/main.cpp b/tests/manual/qcursor/qcursorhighdpi/main.cpp index dd7df2bd10..a81f914c90 100644 --- a/tests/manual/qcursor/qcursorhighdpi/main.cpp +++ b/tests/manual/qcursor/qcursorhighdpi/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -47,15 +47,10 @@ #include <QStringList> #include <QTextStream> -#if QT_VERSION > 0x050000 -# include <QScreen> -# include <QWindow> -# include <private/qhighdpiscaling_p.h> -# include <qpa/qplatformwindow.h> -#else -# define Q_NULLPTR 0 -# define Q_DECL_OVERRIDE -#endif +#include <QScreen> +#include <QWindow> +#include <private/qhighdpiscaling_p.h> +#include <qpa/qplatformwindow.h> #ifdef Q_OS_WIN # include <qt_windows.h> @@ -64,14 +59,6 @@ #include <algorithm> #include <iterator> -#if QT_VERSION < 0x050000 -QDebug operator<<(QDebug d, const QPixmap &p) -{ - d.nospace() << "QPixmap(" << p.size() << ')'; - return d; -} -#endif // Qt 4 - // High DPI cursor test for testing cursor sizes in multi-screen setups. // It creates one widget per screen with a grid of standard cursors, // pixmap / bitmap cursors and pixmap / bitmap cursors with device pixel ratio 2. @@ -139,7 +126,6 @@ static QCursor bitmapCursor(int size) return QCursor(bitmaps.first, bitmaps.second, size / 2, size / 2); } -#if QT_VERSION > 0x050000 static QCursor pixmapCursorDevicePixelRatio(int size, int dpr) { QPixmap pixmap = paintPixmap(dpr * size, Qt::yellow); @@ -154,7 +140,6 @@ static QCursor bitmapCursorDevicePixelRatio(int size, int dpr) bitmaps.second.setDevicePixelRatio(dpr); return QCursor(bitmaps.first, bitmaps.second, size / 2, size / 2); } -#endif // Qt 5 // A label from which a pixmap can be dragged for testing drag with pixmaps/DPR. class DraggableLabel : public QLabel { @@ -191,9 +176,7 @@ void DraggableLabel::mousePressEvent(QMouseEvent *) drag->setMimeData(mimeData); drag->setPixmap(pixmap); QPoint sizeP = QPoint(m_pixmap.width(), m_pixmap.height()); -#if QT_VERSION > 0x050000 sizeP /= int(m_pixmap.devicePixelRatio()); -#endif // Qt 5 drag->setHotSpot(sizeP / 2); qDebug() << "Dragging:" << m_pixmap; drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction); @@ -244,10 +227,8 @@ static QLabel *createCursorLabel(const QCursor &cursor, const QString &additiona { QString labelText; QDebug(&labelText).nospace() << cursor.shape(); -#if QT_VERSION > 0x050000 labelText.remove(0, labelText.indexOf('(') + 1); labelText.chop(1); -#endif // Qt 5 if (!additionalText.isEmpty()) labelText += ' ' + additionalText; const QPixmap cursorPixmap = cursor.pixmap(); @@ -279,9 +260,7 @@ MainWindow::MainWindow(QWidget *parent) , m_screenInfoLabel(new QLabel) { QString title = "Cursors "; -#if QT_VERSION > 0x050000 title += '(' + QGuiApplication::platformName() + ") "; -#endif title += QT_VERSION_STR; setWindowTitle(title); @@ -315,7 +294,6 @@ MainWindow::MainWindow(QWidget *parent) QLatin1String("Plain BM ") + QString::number(size)), gridLayout, columnCount, row, col); -#if QT_VERSION > 0x050000 addToGrid(createCursorLabel(QCursor(pixmapCursorDevicePixelRatio(size, 2)), "PX with DPR 2 " + QString::number(size)), gridLayout, columnCount, row, col); @@ -323,7 +301,6 @@ MainWindow::MainWindow(QWidget *parent) addToGrid(createCursorLabel(QCursor(bitmapCursorDevicePixelRatio(size, 2)), "BM with DPR 2 " + QString::number(size)), gridLayout, columnCount, row, col); -#endif // Qt 5 gridLayout->addWidget(m_screenInfoLabel, row + 1, 0, 1, columnCount); @@ -351,10 +328,8 @@ int main(int argc, char *argv[]) windows.append(window); window->show(); window->updateScreenInfo(); -#if QT_VERSION > 0x050000 QObject::connect(window->windowHandle(), &QWindow::screenChanged, window.data(), &MainWindow::updateScreenInfo); -#endif } return app.exec(); } diff --git a/tests/manual/qgraphicslayout/flicker/window.h b/tests/manual/qgraphicslayout/flicker/window.h index cb1ac16016..3901eaa157 100644 --- a/tests/manual/qgraphicslayout/flicker/window.h +++ b/tests/manual/qgraphicslayout/flicker/window.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -58,11 +58,7 @@ struct Statistics { QLabel *output; void sleep() { -#if QT_VERSION >= 0x050000 QThread::msleep(sleepMsecs); -#else - qWarning("%s unimplemented", Q_FUNC_INFO); -#endif } int currentBenchmarkIteration; bool relayoutClicked; diff --git a/tests/manual/rhi/shared/examplefw.h b/tests/manual/rhi/shared/examplefw.h index 9efbd37d77..83b5a73514 100644 --- a/tests/manual/rhi/shared/examplefw.h +++ b/tests/manual/rhi/shared/examplefw.h @@ -195,9 +195,7 @@ Window::Window() setSurfaceType(Direct3DSurface); break; case Metal: -#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) setSurfaceType(MetalSurface); -#endif break; default: break; diff --git a/tests/manual/widgetgrab/main.cpp b/tests/manual/widgetgrab/main.cpp index 45c3feeefe..cc69732cfa 100644 --- a/tests/manual/widgetgrab/main.cpp +++ b/tests/manual/widgetgrab/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -224,13 +224,9 @@ bool MainWindow::eventFilter(QObject *o, QEvent *e) case QEvent::Enter: { QString message; QDebug debug(&message); -#if QT_VERSION >= 0x050000 const QEnterEvent *ee = static_cast<QEnterEvent *>(e); debug.nospace() << '#' << m_enterLeaveEventCount++ << " Enter for " << o->objectName() << " at " << ee->localPos() << " global: " << ee->globalPos(); -#else - debug.nospace() << '#' << m_enterLeaveEventCount++ << " Enter for " << o->objectName(); -#endif m_logEdit->appendPlainText(message); } break; @@ -357,11 +353,7 @@ void MainWindow::grabKeyboardWindowToggled(bool g) void MainWindow::forceNativeWidgets() { const WId platformWid = m_forceNativeButton->winId(); -#if QT_VERSION < 0x050000 && defined(Q_OS_WIN) - const quintptr wid = quintptr(platformWid); // HWND on Qt 4.8/Windows. -#else const WId wid = platformWid; -#endif m_logEdit->appendPlainText(QString::fromLatin1("Created native widget %1").arg(wid)); m_forceNativeButton->setEnabled(false); m_forceNativeButton->setText(QLatin1String("Native widgets created")); diff --git a/tests/manual/windowchildgeometry/controllerwidget.cpp b/tests/manual/windowchildgeometry/controllerwidget.cpp index 1ceb785e9e..4d0aac1732 100644 --- a/tests/manual/windowchildgeometry/controllerwidget.cpp +++ b/tests/manual/windowchildgeometry/controllerwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -267,8 +267,6 @@ void WidgetWindowControl::statesChanged() w->setWindowState(m_statesControl->states()); } -#if QT_VERSION >= 0x050000 - // Test window drawing diagonal lines class Window : public QWindow { @@ -453,8 +451,6 @@ void WindowControl::addChildWindow() control->show(); } -#endif - ControllerWidget::ControllerWidget(QWidget *parent) : QMainWindow(parent) , m_testWindow(new Window) @@ -475,12 +471,8 @@ ControllerWidget::ControllerWidget(QWidget *parent) int y = 100; const QStringList args = QApplication::arguments(); const int offsetArgIndex = args.indexOf(QLatin1String("-offset")); - if (offsetArgIndex >=0 && offsetArgIndex < args.size() - 1) { + if (offsetArgIndex >=0 && offsetArgIndex < args.size() - 1) y += args.at(offsetArgIndex + 1).toInt(); - } else { - if (QT_VERSION < 0x050000) - y += 400; - } move(x, y); diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp index a87844d2cd..ff53a4adb1 100644 --- a/tests/manual/windowflags/controllerwindow.cpp +++ b/tests/manual/windowflags/controllerwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -32,23 +32,19 @@ #include <QAction> #include <QApplication> #include <QCheckBox> +#include <QDebug> #include <QGroupBox> #include <QHBoxLayout> #include <QLabel> +#include <QLibraryInfo> +#include <qlogging.h> #include <QMainWindow> #include <QMenu> +#include <QMoveEvent> #include <QPushButton> #include <QRadioButton> #include <QTabWidget> - -#include <QMoveEvent> - -#if QT_VERSION >= 0x050000 -# include <QWindow> -# include <qlogging.h> -# include <QLibraryInfo> -#endif -#include <QDebug> +#include <QWindow> ControllerWidget::ControllerWidget(QWidget *parent) : QWidget(parent) @@ -224,10 +220,8 @@ static bool isTopLevel(const QObject *o) { if (o->isWidgetType()) return static_cast<const QWidget *>(o)->isWindow(); -#if QT_VERSION >= 0x050000 if (o->isWindowType()) return static_cast<const QWindow *>(o)->isTopLevel(); -#endif return false; } @@ -238,10 +232,8 @@ static Qt::WindowStates windowState(const QObject *o) states &= ~Qt::WindowActive; return states; } -#if QT_VERSION >= 0x050000 if (o->isWindowType()) return static_cast<const QWindow *>(o)->windowState(); -#endif return Qt::WindowNoState; } @@ -257,9 +249,7 @@ public: case QEvent::WindowStateChange: case QEvent::ApplicationActivate: case QEvent::ApplicationDeactivate: -#if QT_VERSION >= 0x050000 case QEvent::ApplicationStateChange: -#endif if (isTopLevel(o)) formatEvent(o, e); break; @@ -274,9 +264,7 @@ private: { static int n = 0; QDebug debug = qDebug().nospace(); -#if QT_VERSION >= 0x050000 debug.noquote(); -#endif debug << '#' << n++ << ' ' << o->metaObject()->className(); const QString name = o->objectName(); if (!name.isEmpty()) @@ -320,15 +308,9 @@ void LogWidget::install() QString LogWidget::startupMessage() { QString result; -#if QT_VERSION >= 0x050300 result += QLatin1String(QLibraryInfo::build()); -#else - result += QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR); -#endif -#if QT_VERSION >= 0x050000 result += QLatin1Char(' '); result += QGuiApplication::platformName(); -#endif return result; } @@ -342,11 +324,7 @@ ControllerWindow::ControllerWindow() { setWindowTitle(tr("Window Flags (Qt version %1, %2)") .arg(QLatin1String(qVersion()), -#if QT_VERSION >= 0x050000 qApp->platformName())); -#else - QLatin1String("<unknown>"))); -#endif QVBoxLayout *layout = new QVBoxLayout(this); QTabWidget *tabWidget = new QTabWidget(this); diff --git a/tests/manual/windowflags/controls.cpp b/tests/manual/windowflags/controls.cpp index 88c9393053..62edeba443 100644 --- a/tests/manual/windowflags/controls.cpp +++ b/tests/manual/windowflags/controls.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -89,9 +89,6 @@ HintControl::HintControl(QWidget *parent) layout->addWidget(windowStaysOnBottomCheckBox, 7, 1); layout->addWidget(customizeWindowHintCheckBox, 5, 0); layout->addWidget(transparentForInputCheckBox, 6, 0); -#if QT_VERSION < 0x050000 - transparentForInputCheckBox->setEnabled(false); -#endif } Qt::WindowFlags HintControl::hints() const @@ -111,10 +108,8 @@ Qt::WindowFlags HintControl::hints() const flags |= Qt::WindowMinimizeButtonHint; if (windowMaximizeButtonCheckBox->isChecked()) flags |= Qt::WindowMaximizeButtonHint; -#if QT_VERSION >= 0x050000 if (windowFullscreenButtonCheckBox->isChecked()) flags |= Qt::WindowFullscreenButtonHint; -#endif if (windowCloseButtonCheckBox->isChecked()) flags |= Qt::WindowCloseButtonHint; if (windowContextHelpButtonCheckBox->isChecked()) @@ -127,10 +122,8 @@ Qt::WindowFlags HintControl::hints() const flags |= Qt::WindowStaysOnBottomHint; if (customizeWindowHintCheckBox->isChecked()) flags |= Qt::CustomizeWindowHint; -#if QT_VERSION >= 0x050000 if (transparentForInputCheckBox->isChecked()) flags |= Qt::WindowTransparentForInput; -#endif return flags; } @@ -143,18 +136,14 @@ void HintControl::setHints(Qt::WindowFlags flags) windowSystemMenuCheckBox->setChecked(flags & Qt::WindowSystemMenuHint); windowMinimizeButtonCheckBox->setChecked(flags & Qt::WindowMinimizeButtonHint); windowMaximizeButtonCheckBox->setChecked(flags & Qt::WindowMaximizeButtonHint); -#if QT_VERSION >= 0x050000 windowFullscreenButtonCheckBox->setChecked(flags & Qt::WindowFullscreenButtonHint); -#endif windowCloseButtonCheckBox->setChecked(flags & Qt::WindowCloseButtonHint); windowContextHelpButtonCheckBox->setChecked(flags & Qt::WindowContextHelpButtonHint); windowShadeButtonCheckBox->setChecked(flags & Qt::WindowShadeButtonHint); windowStaysOnTopCheckBox->setChecked(flags & Qt::WindowStaysOnTopHint); windowStaysOnBottomCheckBox->setChecked(flags & Qt::WindowStaysOnBottomHint); customizeWindowHintCheckBox->setChecked(flags & Qt::CustomizeWindowHint); -#if QT_VERSION >= 0x050000 transparentForInputCheckBox->setChecked(flags & Qt::WindowTransparentForInput); -#endif } void HintControl::slotCheckBoxChanged() diff --git a/tests/manual/windowflags/previewwindow.cpp b/tests/manual/windowflags/previewwindow.cpp index 893dbc9a41..b827d031bf 100644 --- a/tests/manual/windowflags/previewwindow.cpp +++ b/tests/manual/windowflags/previewwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -79,13 +79,8 @@ static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) if (flags & Qt::MSWindowsFixedSizeDialogHint) str << "\n| Qt::MSWindowsFixedSizeDialogHint"; -#if QT_VERSION >= 0x050000 if (flags & Qt::BypassWindowManagerHint) str << "\n| Qt::BypassWindowManagerHint"; -#else - if (flags & Qt::X11BypassWindowManagerHint) - str << "\n| Qt::X11BypassWindowManagerHint"; -#endif if (flags & Qt::FramelessWindowHint) str << "\n| Qt::FramelessWindowHint"; if (flags & Qt::WindowTitleHint) @@ -108,7 +103,6 @@ static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) str << "\n| Qt::CustomizeWindowHint"; if (flags & Qt::WindowStaysOnBottomHint) str << "\n| Qt::WindowStaysOnBottomHint"; -#if QT_VERSION >= 0x050000 if (flags & Qt::WindowFullscreenButtonHint) str << "\n| Qt::WindowFullscreenButtonHint"; if (flags & Qt::WindowTransparentForInput) @@ -121,7 +115,6 @@ static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) str << "\n| Qt::MaximizeUsingFullscreenGeometryHint"; if (flags & Qt::NoDropShadowWindowHint) str << "\n| Qt::NoDropShadowWindowHint"; -#endif // Qt 5 } static void formatWindowStates(QTextStream &str, Qt::WindowStates states) diff --git a/tests/manual/windowgeometry/controllerwidget.cpp b/tests/manual/windowgeometry/controllerwidget.cpp index 0bf089e934..b2b5810158 100644 --- a/tests/manual/windowgeometry/controllerwidget.cpp +++ b/tests/manual/windowgeometry/controllerwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -29,17 +29,13 @@ #include "controllerwidget.h" #include <controls.h> -#if QT_VERSION >= 0x050000 -# include <QtWidgets> -# include <QWindow> -# include <QBackingStore> -# include <QPaintDevice> -# include <QPainter> -#else -# include <QtGui> -#endif +#include <QtWidgets> +#include <QBackingStore> +#include <QPaintDevice> +#include <QPainter> #include <QResizeEvent> +#include <QWindow> CoordinateControl::CoordinateControl(const QString &sep) : m_x(new QSpinBox), m_y(new QSpinBox) { @@ -291,8 +287,6 @@ void WidgetWindowControl::statesChanged() w->setWindowState(m_statesControl->states()); } -#if QT_VERSION >= 0x050000 - // Test window drawing diagonal lines class Window : public QWindow { @@ -388,14 +382,10 @@ void WindowControl::stateChanged() w->setWindowStates(m_statesControl->states()); } -#endif - ControllerWidget::ControllerWidget(QWidget *parent) : QMainWindow(parent) , m_testWidget(new QWidget) -#if QT_VERSION >= 0x050000 , m_testWindow(new Window) -#endif { QMenu *fileMenu = menuBar()->addMenu(tr("File")); QAction *exitAction = fileMenu->addAction(tr("Exit")); @@ -404,10 +394,8 @@ ControllerWidget::ControllerWidget(QWidget *parent) QString title = QLatin1String("Geometry test, (Qt "); title += QLatin1String(QT_VERSION_STR); -#if QT_VERSION >= 0x050000 title += QLatin1String(", "); title += qApp->platformName(); -#endif title += QLatin1Char(')'); setWindowTitle(title); @@ -417,9 +405,6 @@ ControllerWidget::ControllerWidget(QWidget *parent) const int offsetArgIndex = args.indexOf(QLatin1String("-offset")); if (offsetArgIndex >=0 && offsetArgIndex < args.size() - 1) { y += args.at(offsetArgIndex + 1).toInt(); - } else { - if (QT_VERSION < 0x050000) - y += 400; } move(x, y); @@ -443,7 +428,6 @@ ControllerWidget::ControllerWidget(QWidget *parent) else m_testWidget->show(); -#if QT_VERSION >= 0x050000 x += 300; m_testWindow->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint @@ -459,7 +443,6 @@ ControllerWidget::ControllerWidget(QWidget *parent) else m_testWindow->show(); m_testWindow->setTitle(tr("TestWindow")); -#endif QWidget *central = new QWidget ; QVBoxLayout *l = new QVBoxLayout(central); @@ -478,11 +461,9 @@ ControllerWidget::ControllerWidget(QWidget *parent) widgetControl->refresh(); l->addWidget(widgetControl); -#if QT_VERSION >= 0x050000 BaseWindowControl *windowControl = new WindowControl(m_testWindow.data()); windowControl->refresh(); l->addWidget(windowControl); -#endif setCentralWidget(central); } diff --git a/tests/manual/windowgeometry/controllerwidget.h b/tests/manual/windowgeometry/controllerwidget.h index 4b5dfac348..e492f965b5 100644 --- a/tests/manual/windowgeometry/controllerwidget.h +++ b/tests/manual/windowgeometry/controllerwidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -147,9 +147,7 @@ public: private: QScopedPointer<QWidget> m_testWidget; -#if QT_VERSION >= 0x050000 QScopedPointer<QWindow> m_testWindow; -#endif }; #endif // CONTROLLERWIDGET_H |