From 701df72db6b70156e55a83b7e8135d563f27e698 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Thu, 1 Jul 2021 16:54:44 +0100 Subject: [PATCH] Remove some ifdefs regarding 5.9 The one missing QT_VERSION_CHECK was even wrong and triggering even with Qt 5.15. --- examples/dockwidgets/MyMainWindow.cpp | 12 ------------ src/QWidgetAdapter.h | 7 +------ tests/tst_docks.cpp | 7 ------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/examples/dockwidgets/MyMainWindow.cpp b/examples/dockwidgets/MyMainWindow.cpp index 4a43486e..244780f4 100644 --- a/examples/dockwidgets/MyMainWindow.cpp +++ b/examples/dockwidgets/MyMainWindow.cpp @@ -21,9 +21,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) #include -#endif #include @@ -34,12 +32,7 @@ static MyWidget *newMyWidget() { -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - const int randomNumber = qrand() % 100 + 1; -#else const int randomNumber = QRandomGenerator::global()->bounded(0, 100) + 1; -#endif - if (randomNumber < 50) { if (randomNumber < 33) { return new MyWidget1(); @@ -62,11 +55,6 @@ MyMainWindow::MyMainWindow(const QString &uniqueName, KDDockWidgets::MainWindowO , m_maxSizeForDockWidget8(maxSizeForDockWidget8) , m_dockwidget5DoesntCloseBeforeRestore(dockwidget5DoesntCloseBeforeRestore) { -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - qsrand(time(nullptr)); -#endif - - // qApp->installEventFilter(this); auto menubar = menuBar(); auto fileMenu = new QMenu(QStringLiteral("File")); m_toggleMenu = new QMenu(QStringLiteral("Toggle")); diff --git a/src/QWidgetAdapter.h b/src/QWidgetAdapter.h index 51f5231e..decf6beb 100644 --- a/src/QWidgetAdapter.h +++ b/src/QWidgetAdapter.h @@ -30,12 +30,7 @@ namespace Private { inline bool isMinimized(QWindow *window) { - // QWindow::windowStates() was introduced in 5.10 -#if QT_VERSION < 0x051000 - return window && window->windowState() == Qt::WindowMinimized; -#else - return window && window->windowStates() & Qt::WindowMinimized; -#endif + return window && (window->windowStates() & Qt::WindowMinimized); } }} diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index 62008520..e0cb8e58 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -6812,21 +6812,14 @@ void TestDocks::tst_constraintsPropagateUp() auto frame1 = dock1->dptr()->frame(); QVERIFY(qAbs(widgetMinLength(frame1, Qt::Horizontal) - minWidth) < 10); //10px for styling differences - -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) - // Flaky with 5.9 QVERIFY(qAbs(widgetMinLength(frame1, Qt::Vertical) - (minHeight + frame1->nonContentsHeight())) < 10); //10px for styling differences -#endif // Add dock2 side-by side, so the Frame now has a title bar. auto oldFw2 = dock2->window(); dock1->addDockWidgetToContainingWindow(dock2, Location_OnLeft); TitleBar *tb = dock1->titleBar(); QVERIFY(tb->isVisible()); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) - // Flaky with 5.9 QVERIFY(qAbs(widgetMinLength(frame1, Qt::Vertical) - (minHeight + frame1->nonContentsHeight())) < 10); -#endif delete dock1->window(); delete oldFw2; }