From bd263452cdb1b311c72fb3d6d05cbfa37b16f16e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Jun 2017 14:39:16 +0200 Subject: [PATCH 01/82] Revert "QWidgetEffectSourcePrivate::draw(): Call render() when no shared painter exists" The change causes drawing artifacts in Qt Creator. This reverts commit 8b1377fde16a2049a1c27f6d005bff84a8f85f28. Task-number: QTCREATORBUG-18322 Task-number: QTBUG-60231 Change-Id: Ic05507b0c23ea612fa5a9b92163380059b6e710d Reviewed-by: Andy Shaw --- src/widgets/kernel/qwidget.cpp | 2 +- .../qgraphicseffect/tst_qgraphicseffect.cpp | 21 ------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 6112d33974d..f467bcfff5a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5860,7 +5860,7 @@ QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) con void QWidgetEffectSourcePrivate::draw(QPainter *painter) { - if (!context || context->painter != painter || !context->sharedPainter) { + if (!context || context->painter != painter) { m_widget->render(painter); return; } diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index 4d289dcb02a..a1cb7298496 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -52,7 +52,6 @@ private slots: void boundingRect2(); void draw(); void opacity(); - void nestedOpaqueOpacity(); void grayscale(); void colorize(); void drawPixmapItem(); @@ -408,26 +407,6 @@ void tst_QGraphicsEffect::opacity() QCOMPARE(effect->m_opacity, qreal(0.5)); } -void tst_QGraphicsEffect::nestedOpaqueOpacity() -{ - // QTBUG-60231: Nesting widgets with a QGraphicsEffect on a toplevel with - // QGraphicsOpacityEffect caused crashes due to constructing several - // QPainter instances on a device in the fast path for - // QGraphicsOpacityEffect::opacity=1 - QWidget topLevel; - topLevel.setWindowTitle(QTest::currentTestFunction()); - topLevel.resize(QApplication::desktop()->screenGeometry(&topLevel).size() / 8); - QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect; - opacityEffect->setOpacity(1); - topLevel.setGraphicsEffect(opacityEffect); - QWidget *child = new QWidget(&topLevel); - child->resize(topLevel.size() / 2); - QGraphicsDropShadowEffect *childEffect = new QGraphicsDropShadowEffect; - child->setGraphicsEffect(childEffect); - topLevel.show(); - QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); -} - void tst_QGraphicsEffect::grayscale() { if (qApp->desktop()->depth() < 24) From 096cdb3c04b13be811fc2a5a23deec2a69dc65a4 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 2 Jun 2017 14:38:17 +0200 Subject: [PATCH 02/82] Fix tst_qfile::size for configurations using builtin test data As the files are packaged into the binary, they have to be extracted, before they can be ::open'ed. Change-Id: Ie83086a2b9a73b6b0de462bdb52a71bb277ae06f Reviewed-by: Maurice Kalinowski --- tests/auto/corelib/io/qfile/test/test.pro | 6 ++++++ tests/auto/corelib/io/qfile/tst_qfile.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index 7ad047e8a22..1472ddbb83a 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -4,6 +4,12 @@ QT = core-private core testlib qtHaveModule(network): QT += network else: DEFINES += QT_NO_NETWORK +contains(CONFIG, builtin_testdata) { + DEFINES += BUILTIN_TESTDATA +} + +TESTDATA += ../BLACKLIST + TARGET = ../tst_qfile SOURCES = ../tst_qfile.cpp INCLUDEPATH += ../../../../../shared/ diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 9751bb4c9e7..c7216dc1693 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -250,6 +250,9 @@ private slots: void reuseQFile(); private: +#ifdef BUILTIN_TESTDATA + QSharedPointer m_dataDir; +#endif enum FileType { OpenQFile, OpenFd, @@ -428,8 +431,15 @@ void tst_QFile::initTestCase() QVERIFY(!m_forRenamingFile.isEmpty()); m_twoDotsFile = QFINDTESTDATA("two.dots.file"); QVERIFY(!m_twoDotsFile.isEmpty()); + +#ifndef BUILTIN_TESTDATA m_testFile = QFINDTESTDATA("testfile.txt"); QVERIFY(!m_testFile.isEmpty()); +#else + m_dataDir = QEXTRACTTESTDATA("/"); + QVERIFY2(!m_dataDir.isNull(), qPrintable("Could not extract test data")); + m_testFile = m_dataDir->path() + "/testfile.txt"; +#endif m_resourcesDir = QFINDTESTDATA("resources"); QVERIFY(!m_resourcesDir.isEmpty()); m_noEndOfLineFile = QFINDTESTDATA("noendofline.txt"); From 9c75ee685835f21fa837e59dd15a9daec9d383f6 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 24 May 2017 13:25:26 +0200 Subject: [PATCH 03/82] Fix tst_QOpenGlConfig for platforms with builtin test data Change-Id: Ifd57002b730987105554514b3498f5e3bb4962e4 Reviewed-by: Maurice Kalinowski --- tests/auto/gui/qopenglconfig/qopenglconfig.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/gui/qopenglconfig/qopenglconfig.pro b/tests/auto/gui/qopenglconfig/qopenglconfig.pro index 9b0175acea3..446a9608358 100644 --- a/tests/auto/gui/qopenglconfig/qopenglconfig.pro +++ b/tests/auto/gui/qopenglconfig/qopenglconfig.pro @@ -7,4 +7,4 @@ TARGET = tst_qopenglconfig QT += gui-private core-private testlib SOURCES += tst_qopenglconfig.cpp -OTHER_FILES = buglist.json +TESTDATA += buglist.json From 5a1f25a1bda80b3f420063aa68ff376953ae6e19 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 13 Jun 2017 10:11:11 +0200 Subject: [PATCH 04/82] winrt: Fix tst_qlanguagechange Change-Id: Ic11a81b49cc2e7a3fcb895d1556b44baf8c1d6fe Reviewed-by: Maurice Kalinowski --- tests/auto/other/languagechange/tst_languagechange.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index 22c2e1fbc70..14ede33500a 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -197,7 +197,7 @@ void tst_languageChange::retranslatability_data() << "QFileDialog::Back" << "QFileDialog::Create New Folder" << "QFileDialog::Detail View" -#ifndef Q_OS_MAC +#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT) << "QFileDialog::File" #endif << "QFileDialog::Files of type:" From 0086bf62a203f0e4bd5982532e1b7c04b0f6cdfb Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 13 Jun 2017 12:43:44 +0200 Subject: [PATCH 05/82] winrt: Fix tst_qtextstream Change-Id: I5e8076a344a50f70e9618ff7b2e9258182601957 Reviewed-by: Maurice Kalinowski --- tests/auto/corelib/io/qtextstream/BLACKLIST | 1 + tests/auto/corelib/io/qtextstream/test/test.pro | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/io/qtextstream/BLACKLIST b/tests/auto/corelib/io/qtextstream/BLACKLIST index bc3f118b337..b54b53cd740 100644 --- a/tests/auto/corelib/io/qtextstream/BLACKLIST +++ b/tests/auto/corelib/io/qtextstream/BLACKLIST @@ -1,2 +1,3 @@ [stillOpenWhenAtEnd] windows +winrt diff --git a/tests/auto/corelib/io/qtextstream/test/test.pro b/tests/auto/corelib/io/qtextstream/test/test.pro index 50335524d37..3dcfa0b414d 100644 --- a/tests/auto/corelib/io/qtextstream/test/test.pro +++ b/tests/auto/corelib/io/qtextstream/test/test.pro @@ -18,7 +18,8 @@ TESTDATA += \ ../task113817.txt \ ../qtextstream.qrc \ ../tst_qtextstream.cpp \ - ../resources + ../resources \ + ../BLACKLIST builtin_testdata { DEFINES += BUILTIN_TESTDATA From 9ed46c28539bc93c99c4e727f4de97cf643b4e41 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 13 Jun 2017 12:43:03 +0200 Subject: [PATCH 06/82] winrt: Fix tst_qurl Change-Id: Ia7e33e3892f888ead1357f5cd522480f514421e3 Reviewed-by: Maurice Kalinowski --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index ebc240c2859..c5647752fd3 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -3078,11 +3078,7 @@ void tst_QUrl::fromUserInputWithCwd_data() // "." { - const QUrl url = QUrl::fromLocalFile(base -#ifdef Q_OS_WINRT - + QLatin1Char('/') -#endif - ); // fromUserInput cleans the path + const QUrl url = QUrl::fromLocalFile(base); // fromUserInput cleans the path QTest::newRow("dot-in-path") << "." << base << url << url; QTest::newRow("dot-in-dot") << "." << QStringLiteral(".") << url << url; } From 56a29f0e91fc48c5eb9062e81a2b45ecc6082cc2 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 14 Jun 2017 10:50:29 +0200 Subject: [PATCH 07/82] winrt: Fix tst_QDialog::showFullScreen show will use the platform's default flags but the test actually checks for the flags that were set before so we have to use setVisible(true) instead. Change-Id: I52c055ec07d6f0dee626626318c875aefdf67484 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index ac7ba027006..d3bc83fe6d4 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -339,7 +339,7 @@ void tst_QDialog::showFullScreen() QVERIFY(dialog.isFullScreen()); QVERIFY(!dialog.isVisible()); - dialog.show(); + dialog.setVisible(true); QVERIFY(dialog.isFullScreen()); QVERIFY(dialog.isVisible()); From a2322519929bd36a90422dccc0310b8230729197 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 14 Jun 2017 08:28:40 +0200 Subject: [PATCH 08/82] Moc: Don't error out when parsing namespace __identifier(...) Present for example in the Windows's Atlbase.h header. We should not abort the compilation, just ignore that construct Task-number: QTBUG-56634 Change-Id: Id6e4c9f03cb1cef46e330f4fbcae80ce4f3730c6 Reviewed-by: Simon Hausmann --- src/tools/moc/moc.cpp | 3 +++ tests/auto/tools/moc/namespace.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 36d84a61d8e..4d3ccb86802 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -559,6 +559,9 @@ void Moc::parse() if (test(EQ)) { // namespace Foo = Bar::Baz; until(SEMIC); + } else if (test(LPAREN)) { + // Ignore invalid code such as: 'namespace __identifier("x")' (QTBUG-56634) + until(RPAREN); } else if (!test(SEMIC)) { NamespaceDef def; def.classname = nsName; diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h index 6e048315897..43d00e82f3e 100644 --- a/tests/auto/tools/moc/namespace.h +++ b/tests/auto/tools/moc/namespace.h @@ -74,4 +74,8 @@ namespace FooNamespace { } } +#ifdef Q_MOC_RUN +namespace __identifier("") {} // QTBUG-56634 +#endif + #endif // NAMESPACE_H From b2cb83ecbb1eec29268852d1b230f37e4c8592e9 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 13 Jun 2017 15:10:30 +0200 Subject: [PATCH 09/82] Pass the absolute path with the file when finding files When generating a project, the directories can be specified as arguments to the qmake call. As a result files can either be incorrectly added to the project with a leading slash, or can end up duplicated. By passing the absolute path with the file, it ensures that the file is added correctly and no duplicates occur as a result. Task-number: QTBUG-48342 Change-Id: If774de8d7f5cceca80042a25a3aa4e5b045249da Reviewed-by: Joerg Bornemann --- qmake/generators/projectgenerator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index eb4f46cd7ec..073d315aaba 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -118,14 +118,15 @@ ProjectGenerator::init() dir = regex.left(s+1); regex = regex.right(regex.length() - (s+1)); } + const QDir d(dir); if (Option::recursive) { - QStringList entries = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot); + QStringList entries = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot); for (int i = 0; i < entries.count(); i++) dirs.append(dir + entries[i] + QDir::separator() + regex); } - QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regex)); + QStringList files = d.entryList(QDir::nameFiltersFromString(regex)); for(int i = 0; i < (int)files.count(); i++) { - QString file = dir + files[i]; + QString file = d.absoluteFilePath(files[i]); if (addFile(file)) { add_depend = true; file_count++; From 8ae55f0d002f9f928b5b30ad0cf2276c1667d7ce Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 18 Jun 2017 10:31:54 +0200 Subject: [PATCH 10/82] Skip unreliable tst_QTimer::moveToThread() on macOS 10.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Randomly timeouts in the CI. Task-number: QTBUG-59679 Change-Id: I28410b747b2033fc0ef6286a11c88cd0c07eb247 Reviewed-by: Tony Sarajärvi --- tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index d2035a088e8..fd704f582d9 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -37,6 +37,7 @@ #include #include +#include #if defined Q_OS_UNIX #include @@ -498,6 +499,9 @@ void tst_QTimer::moveToThread() { #if defined(Q_OS_WIN32) QSKIP("Does not work reliably on Windows :("); +#elif defined(Q_OS_MACOS) + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSSierra) + QSKIP("Does not work reliably on macOS 10.12 (QTBUG-59679)"); #endif QTimer ti1; QTimer ti2; From c9713bcd688385564a556d33f452b3bf8990694b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 19 Jun 2017 07:55:11 +0200 Subject: [PATCH 11/82] Blacklist flaky tst_QGuiEventLoop::testQuitLock() on macOS 10.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-61499 Change-Id: I6eebe2305b47f9ae7be128c3d7a7535f6f04a4da Reviewed-by: Tony Sarajärvi --- tests/auto/gui/kernel/qguieventloop/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/gui/kernel/qguieventloop/BLACKLIST b/tests/auto/gui/kernel/qguieventloop/BLACKLIST index d55c67998d2..2303d9380e4 100644 --- a/tests/auto/gui/kernel/qguieventloop/BLACKLIST +++ b/tests/auto/gui/kernel/qguieventloop/BLACKLIST @@ -1,2 +1,4 @@ [processEvents] osx-10.12 +[testQuitLock] +osx-10.12 From 70112521454f26cbca9b370ec88de6024a6d4f8d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 19 Jun 2017 08:03:52 +0200 Subject: [PATCH 12/82] Blacklist tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is flaky on macOS 10.12. Task-number: QTBUG-61500 Change-Id: I3dfb6979808dec3a20896c2579dd1f5124c94a70 Reviewed-by: Tony Sarajärvi --- tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST new file mode 100644 index 00000000000..fe1d5bd9683 --- /dev/null +++ b/tests/auto/corelib/animation/qparallelanimationgroup/BLACKLIST @@ -0,0 +1,2 @@ +[deleteChildrenWithRunningGroup] +osx-10.12 From 0c0210682bdf32b0bcf0ce815d7be3df6bdab0ae Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Mon, 19 Jun 2017 10:23:30 +0300 Subject: [PATCH 13/82] Add changes file for 5.9.1 Done-with: Oswald Buddenhagen Change-Id: I17b5343c88b3b86bcb956b6f4911917206360012 Reviewed-by: Simon Hausmann --- dist/changes-5.9.1 | 126 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 dist/changes-5.9.1 diff --git a/dist/changes-5.9.1 b/dist/changes-5.9.1 new file mode 100644 index 00000000000..1b6aea86ab4 --- /dev/null +++ b/dist/changes-5.9.1 @@ -0,0 +1,126 @@ +Qt 5.9.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.9.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.9.1 Changes * +**************************************************************************** + +Important Behavior Changes +-------------------------- + + - The Q_REQUIRED_RESULT macro now expands to the C++17 attribute + [[nodiscard]] if the compiler supports it. Code using this macro needs + to pay attention to its placement, as C++ function attributes must come + before the declaration, unlike the GCC extension that this macro + previously expanded to. + +Binary Compatibility Note +------------------------- + + - The variable QOperatingSystemVersion::MacOSHighSierra was added in this + release. Code that uses this variable will not run under Qt 5.9.0. If + backwards compatibility is desired, use instead + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 13) + +Third-Party Code +---------------- + + - Sqlite was updated to version 3.16.2. + - Deleted the src/3rdparty/atspi2 directory. + +QtCore +------ + + - [QTBUG-60558] Fixed a bug that caused QInternal::unregisterCallback to + crash on exit. + - [QTBUG-61034] QT_NO_EXCEPTIONS is now reliably set when using Clang, even + in Objective C++ mode. + + - QHash/QMultiHash: + * [QTBUG-60395] Fixed operator== so that two containers compare equal when + there are multiple values with the same key. + + - QStorageInfo + * [QTBUG-61096] Fixed a hang on certain systems when retrieving + information from unresponsive filesystems. + + - QTimeZone: + * [QTBUG-60595] Fixed sending IANA standard UTC-offset QTimeZones + through QDataStream, which previously came out invalid after + deserialization. + +moc +--- + + - [QTBUG-61204] moc no longer errors out if a C++ keyword is #define'ed + +Platform Specific Changes +------------------------- + + - macOS / iOS: + * [QTBUG-41978] QCollator now respects the ignorePunctuation property on + Apple based platforms correctly. + * [QTBUG-61205] Fixed the architecture information in QSysInfo. + * QSysInfo and QOperatingSystemVersion now support the newest versions of + Apple's operating systems. + * [QTBUG-61053] Fixed SSL certificate verification on iOS with Secure + Transport back-end. + + - Windows: + * [QTBUG-61315] Fixed invalid sorting of custom environment variables set + via QProcessEnvironment when starting subprocesses. + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-58372] The SQL driver plugins can be built separately again. + Note that it is necessary to configure the whole sqldrivers directory. + - [QTBUG-60925][Unix] Fixed library retrieval from pkg-config. Again. + - [QTBUG-60936] Fixed module version number in Qt modules' cmake config files. + - [QTBUG-61017] Fixed configure hanging upon selecting commercial license. + - [QTBUG-61044] Fixed license checker invocation on 32 bit systems. + - [MinGW] The gold linker is no longer used. + +qmake +----- + + - [QTBUG-38452][Android] Fixed overwriting of INSTALLS for target, and the + resulting bogus attempts to write to /libs on the host system. + - [QTBUG-42830][Android] INSTALL targets are no longer created for static + libraries. + - [QTBUG-40825][QTBUG-59457][Unix] Fixed various makespecs to append shared + include and library locations only at the end of the search lists. + - [QTBUG-52383][Windows] midl and rc are now invoked with /NOLOGO. + - [QTBUG-58391][MSVC] MSVC extensions are not disabled any more when + querying the compiler for the predefined macros to pass to moc. + - [QTBUG-59431][VS] Fixed parsing of /utf-8 option. Again. + - [QTBUG-60895][VS] Fixed .vcxproj generation for ActiveQt server projects. + - [QTBUG-60059] qmake will now be more verbose when it fails to run the + compiler while querying the toolchain's properties. + - Various QT__VERSION variables were reverted to refer to the + toolchain Qt was built with. The current toolchain's versions can be + found in the QMAKE__VERSION variables. + - QMAKE_DEFAULT_{INC,LIB}DIRS is now populated also when using clang. + - [MinGW] Re-builds of static library projects will now create a new library + instead of updating the previously built one. + - [VS] Unknown /Zc:XXX options are no longer complained about. From 4183475080d334d7d17d02e6ad4eb53c01205c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 24 May 2017 13:02:16 +0200 Subject: [PATCH 14/82] Error out when compiler is unable to produce default include/library paths Adds a bit of extra safeguard to ensure we don't accidentally fall into the generic unix isEmpty(QMAKE_DEFAULT_{INC,LIB}DIRS) code-paths. Change-Id: Id760b32cd29cb2b9db1390c174e1637e2dddaabc Reviewed-by: Oswald Buddenhagen --- mkspecs/features/toolchain.prf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 34bd8f1d788..9687767cf1f 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -77,6 +77,9 @@ isEmpty($${target_prefix}.INCDIRS) { QMAKE_DEFAULT_INCDIRS += $$clean_path($$line) } } + isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \ + !if(qnx|integrity): \ + error("failed to parse default search paths from compiler output") QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) } else: msvc { # This doesn't differentiate between host and target, From 0aceec65a5405ae6ef8a745a611fea7caafd12f0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 19 Jun 2017 11:54:03 -0700 Subject: [PATCH 15/82] ATSPI: correct configure warning message when ATSPI is missing This threw me for a loop: Qt D-Bus ............................... yes Qt D-Bus directly linked to libdbus .... yes [...] Note: Disabling Linux Accessibility Bridge: D-Bus is missing. Also, this is not the Linux bridge, since I was running on FreeBSD. Change-Id: I1d5a585d4af842f9a66ffffd14c99ab2a8d648de Reviewed-by: Frederik Gladhorn --- src/gui/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index 2fb03a452ab..1b2b0775a26 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -1041,7 +1041,7 @@ XKB configuration data. This is required for keyboard input support." { "type": "note", "condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge", - "message": "Disabling Linux Accessibility Bridge: D-Bus is missing." + "message": "Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing." }, { "type": "warning", From 460a591a9323c47189ad95111cbd27a1e7fc534f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Jun 2017 15:04:24 +0200 Subject: [PATCH 16/82] tst_QTreeWidget: Fix GCC 7 warnings about using uninitialized variables qtreewidget.h:179:53: warning: 'search' may be used uninitialized in this function [-Wmaybe-uninitialized] ^~ tst_qtreewidget.cpp:1564:22: note: 'search' was declared here QTreeWidgetItem *search; tst_qtreewidget.cpp: In member function 'void tst_QTreeWidget::expandAndCallapse()': tst_qtreewidget.cpp:2678:18: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized] Change-Id: I19c9dc86aa12f36c26ae2475f1854ed17fad0638 Reviewed-by: Simon Hausmann Reviewed-by: Frederik Gladhorn --- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index f20805f97e8..fa7f9596da5 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1560,10 +1560,9 @@ void tst_QTreeWidget::scrollToItem() { // Check if all parent nodes of the item found are expanded. // Reported in task #78761 - QTreeWidgetItem *bar; - QTreeWidgetItem *search; + QTreeWidgetItem *search = nullptr; for (int i=0; i<2; ++i) { - bar = new QTreeWidgetItem(testWidget); + QTreeWidgetItem *bar = new QTreeWidgetItem(testWidget); bar->setText(0, QString::number(i)); for (int j=0; j<2; ++j) { @@ -1571,9 +1570,8 @@ void tst_QTreeWidget::scrollToItem() foo->setText(0, bar->text(0) + QString::number(j)); for (int k=0; k<2; ++k) { - QTreeWidgetItem *yo = new QTreeWidgetItem(foo); - yo->setText(0, foo->text(0) + QString::number(k)); - search = yo; + search = new QTreeWidgetItem(foo); + search->setText(0, foo->text(0) + QString::number(k)); } } } @@ -1582,10 +1580,10 @@ void tst_QTreeWidget::scrollToItem() testWidget->scrollToItem(search); QCOMPARE(search->text(0), QLatin1String("111")); - bar = search->parent(); - QVERIFY(testWidget->isItemExpanded(bar)); - bar = bar->parent(); - QVERIFY(testWidget->isItemExpanded(bar)); + QTreeWidgetItem *par = search->parent(); + QVERIFY(testWidget->isItemExpanded(par)); + par = par->parent(); + QVERIFY(testWidget->isItemExpanded(par)); } // From task #85413 @@ -2663,7 +2661,7 @@ void tst_QTreeWidget::expandAndCallapse() { QTreeWidget tw; QTreeWidgetItem *top = new QTreeWidgetItem(&tw, QStringList() << "top"); - QTreeWidgetItem *p; + QTreeWidgetItem *p = nullptr; for (int i = 0; i < 10; ++i) { p = new QTreeWidgetItem(top, QStringList(QString::number(i))); for (int j = 0; j < 10; ++j) From 3851a8ff20c6aed0807bfdc4588ae108a2b108ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 23 Jun 2017 13:32:25 +0200 Subject: [PATCH 17/82] macOS: Work around buildup of NSDisplayCycle objects during rapid painting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-60012 Change-Id: Id5291f768a4b9d8d9c77804cb697e0c9fb151012 Reviewed-by: Timur Pocheptsov Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 66c3b6fad40..80c8bfc48be 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -381,6 +381,14 @@ static bool _q_dontOverrideCtrlLMB = false; m_backingStore = backingStore; m_backingStoreOffset = offset * m_backingStore->paintDevice()->devicePixelRatio(); + + // Prevent buildup of NSDisplayCycle objects during setNeedsDisplayInRect, which + // would normally be released as part of the root runloop's autorelease pool, but + // can be kept alive during repeated painting which starve the root runloop. + // FIXME: Move this to the event dispatcher, to cover more cases of starvation. + // FIXME: Figure out if there's a way to detect and/or prevent runloop starvation. + QMacAutoReleasePool pool; + for (const QRect &rect : region) [self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } From 198b67d14bf3ca76d6bdf8901348da0838cf3b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 12 Jun 2017 17:58:41 +0200 Subject: [PATCH 18/82] macOS: Send text input and key events to focus object of window, not app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The key events and input method callbacks coming from Cocoa are targeted at our specific NSView, so we should deliver them to the focus object of the corresponding QWindow, not the global application focus object. This means that we'll deliver key events to windows also when they are not key (active), but this is intentional, as we would otherwise fail to deliver input method events coming from e.g. the emoji/symbol picker, which steals the key window when active. Task-number: QTBUG-61359 Change-Id: I61326c08ad8bbd0c535b3cc8a67d0ceeec7ee910 Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 80c8bfc48be..2c9157c4ec7 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1544,7 +1544,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1); } - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (m_sendKeyEvent && fo) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImHints); if (QCoreApplication::sendEvent(fo, &queryEvent)) { @@ -1694,8 +1694,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) commitString = QString::fromCFString(reinterpret_cast(aString)); }; } - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1762,8 +1761,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) m_composingText = preeditString; - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1779,8 +1777,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void) unmarkText { if (!m_composingText.isEmpty()) { - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1802,7 +1799,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { Q_UNUSED(actualRange) - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return nil; QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection); @@ -1837,7 +1834,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { NSRange selectedRange = {0, 0}; - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return selectedRange; QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection); @@ -1859,7 +1856,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { Q_UNUSED(aRange) Q_UNUSED(actualRange) - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return NSZeroRect; @@ -1899,7 +1896,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (m_platformWindow->window() != QGuiApplication::focusWindow()) return nil; - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return nil; From 11d36bd9eb29995629fe460bb1b24383b47ae5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Mon, 26 Jun 2017 16:25:41 +0200 Subject: [PATCH 19/82] Revert "don't overwrite pre-existing INSTALL for target" This reverts commit c0e94dd0933c549f35d05318cdcd97572c61fabf, as it introduced a regression for applications that sets an installation target (on Android), which a lot of our examples do. The installation target for Android applications/libraries needs to be within in the application bundle's directory tree, or it won't work. Task-number: QTBUG-61635 Change-Id: I8c919ef3888d7679b0f9659796f5e590bc1faa57 Reviewed-by: Eskil Abrahamsen Blomfeldt --- mkspecs/features/android/android.prf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mkspecs/features/android/android.prf b/mkspecs/features/android/android.prf index 45eadc9fdb2..1dc8f87313a 100644 --- a/mkspecs/features/android/android.prf +++ b/mkspecs/features/android/android.prf @@ -1,6 +1,3 @@ -android_install:contains(INSTALLS, target):!isEmpty(target.path): \ - CONFIG -= android_install - contains(TEMPLATE, ".*app") { !android_app { !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so @@ -11,7 +8,7 @@ contains(TEMPLATE, ".*app") { INSTALLS *= target } } -} else: contains(TEMPLATE, "lib"):!static:android_install { +} else: contains(TEMPLATE, "lib"):!static:!QTDIR_build:android_install { target.path = /libs/$$ANDROID_TARGET_ARCH/ INSTALLS *= target } From 081a7c9ba8557c78b4d78686d0bfb419a8383946 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Jun 2017 10:49:24 -0700 Subject: [PATCH 20/82] Add the MSVC 2013 drop to the 5.9.1 changelog We should repeat it in 5.10 and 5.9 changelogs (until 5.11 is released). Change-Id: Ibe46a7253188480890f9fffd14cad187ac091e79 Reviewed-by: Lars Knoll Reviewed-by: Alex Blasche --- dist/changes-5.9.1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dist/changes-5.9.1 b/dist/changes-5.9.1 index 1b6aea86ab4..0fc66430132 100644 --- a/dist/changes-5.9.1 +++ b/dist/changes-5.9.1 @@ -21,6 +21,13 @@ information about a particular change. * Qt 5.9.1 Changes * **************************************************************************** +Deprecation Notice +------------------ + + - The following platforms or toolchains are deprecated and will be + removed as of Qt 5.11: + * Microsoft Visual Studio 2013 + Important Behavior Changes -------------------------- From 160533328cae32c8647cecafad21233aa3529659 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 27 Jun 2017 14:45:45 +0200 Subject: [PATCH 21/82] Remove mention of reverted fix The fix for QTBUG-38452 was reverted by 11d36bd9eb29995629fe460bb1b24383b47ae5e5. Task-number: QTBUG-61635 Change-Id: If80939b75426c48249478e86cae7162132565912 --- dist/changes-5.9.1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/dist/changes-5.9.1 b/dist/changes-5.9.1 index 0fc66430132..4458aee89bb 100644 --- a/dist/changes-5.9.1 +++ b/dist/changes-5.9.1 @@ -111,8 +111,6 @@ configure & build system qmake ----- - - [QTBUG-38452][Android] Fixed overwriting of INSTALLS for target, and the - resulting bogus attempts to write to /libs on the host system. - [QTBUG-42830][Android] INSTALL targets are no longer created for static libraries. - [QTBUG-40825][QTBUG-59457][Unix] Fixed various makespecs to append shared From 9c9382a85f53756c3c702ef7a999720ae40be5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Mon, 19 Jun 2017 22:28:37 +0200 Subject: [PATCH 22/82] xcb: Increment iterator inside bgr888 region loop Amends 9c1d3bc253abd4418f3050d19ec5f05bef3ada97. Change-Id: I912096794d274617e5b290dfb42685088cd49b23 Reviewed-by: Marc Mutz --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index f0952882218..a419caf0fcb 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -561,7 +561,7 @@ void QXcbBackingStore::endPaint() return; QPainter p(m_image->image()); while (it != end) { - const QRect rect = *it; + const QRect rect = *(it++); p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped()); } } From d138a239d27b3f2d3b654b4768f8000bb2a555a1 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 23 Jun 2017 10:47:23 -0700 Subject: [PATCH 23/82] Fix current tab text color on Mac when a proxy style is installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We move the code forcing white text on the current tab to QMacStyle. This removes the small encapsulation violation even though we need to check for the tab text color in the style and modify the palette. Amends 2fbc1432025dd478cf9e940e3c2a1952b218c6dc. Change-Id: If31dc11ae389ee5315e84ab03cf1c08540d81640 Reviewed-by: Błażej Szczygieł Reviewed-by: Jake Petroules --- src/widgets/styles/qmacstyle_mac.mm | 6 ++++++ src/widgets/widgets/qtabbar.cpp | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 8d0fe1196c9..cf2929db7ed 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -4210,6 +4210,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // outside world, unless they read the source, in which case, it's // their own fault). bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem"); + + if (!myTab.documentMode && (myTab.state & State_Selected) && (myTab.state & State_Active)) + if (const auto *tabBar = qobject_cast(w)) + if (!tabBar->tabTextColor(tabBar->currentIndex()).isValid()) + myTab.palette.setColor(QPalette::WindowText, Qt::white); + if (verticalTabs || nonDefaultFont || !tab->icon.isNull() || !myTab.leftButtonSize.isEmpty() || !myTab.rightButtonSize.isEmpty()) { int heightOffset = 0; diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 060d1f9a03f..4cd9522bfb7 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -176,10 +176,6 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) if (tab.textColor.isValid()) option->palette.setColor(q->foregroundRole(), tab.textColor); - else if (q->style()->inherits("QMacStyle") - && isCurrent && !documentMode && q->isActiveWindow()) { - option->palette.setColor(QPalette::WindowText, Qt::white); - } option->icon = tab.icon; option->iconSize = q->iconSize(); // Will get the default value then. From 5a60934aa79c87561ac072987773fa8f124fa0d1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Jun 2017 09:22:54 +0200 Subject: [PATCH 24/82] Blacklist tst_QSocks5SocketEngine::downloadBigFile() Task-number: QTBUG-61673 Change-Id: Id81446e52c6492a22347de708b4785f55a1b0d5d Reviewed-by: Timur Pocheptsov --- tests/auto/network/socket/qsocks5socketengine/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST index 2a32a326d07..60526827bfb 100644 --- a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST +++ b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST @@ -4,3 +4,5 @@ * [serverTest] windows +[downloadBigFile] +windows From f0b51dd0ee789ea8011856fe1ac80931fc4e719a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jun 2017 12:22:26 +0200 Subject: [PATCH 25/82] QGbkCodec: Initialize buf arrays Fix developer build with GCC 7, which complains: codecs\qgb18030codec.cpp:387:37: error: 'buf[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized] codecs\qgb18030codec.cpp:8908:17: error: 'buf[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] codecs\qgb18030codec.cpp:536:37: error: 'buf[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized] codecs\qgb18030codec.cpp:535:37: error: 'buf[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] Change-Id: I7e98355c625276c74792707f22d4318c0cc9be6a Reviewed-by: Marc Mutz --- src/corelib/codecs/qgb18030codec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qgb18030codec.cpp b/src/corelib/codecs/qgb18030codec.cpp index 9899d47c236..04e4bef4cdf 100644 --- a/src/corelib/codecs/qgb18030codec.cpp +++ b/src/corelib/codecs/qgb18030codec.cpp @@ -317,7 +317,7 @@ QList QGbkCodec::_aliases() QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *state) const { - uchar buf[2]; + uchar buf[2] = {0, 0}; int nbuf = 0; ushort replacement = QChar::ReplacementCharacter; if (state) { @@ -467,7 +467,7 @@ QByteArray QGb2312Codec::_name() QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterState *state) const { - uchar buf[2]; + uchar buf[2] = {0, 0}; int nbuf = 0; ushort replacement = QChar::ReplacementCharacter; if (state) { From 8612b0ed938bfbf7cfd2e5db405aa6a0109f41d2 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 27 Jun 2017 15:36:26 +0200 Subject: [PATCH 26/82] xcb: rename arg in QXcbBackingStore ctor ... as it is a window, not widget. This matches the name from cpp file: QXcbBackingStore::QXcbBackingStore(QWindow *window). Change-Id: Ib9f69cbe80ea645bbce0e4f5ef24a8df8808b823 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbbackingstore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 2985432b7fa..94b5994004a 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -54,7 +54,7 @@ class QXcbShmImage; class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore { public: - QXcbBackingStore(QWindow *widget); + QXcbBackingStore(QWindow *window); ~QXcbBackingStore(); QPaintDevice *paintDevice() override; From b1381ea9ebb3dd4019081f4412f82a3280b4eb52 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 22 Feb 2017 13:55:28 +0300 Subject: [PATCH 27/82] xcb: Use QT_CONFIG macro to check for xcb-xlib ... and remove the XCB_USE_XLIB define. This patch also removes the unnecessary checks for xcb-xlib in: - qxcbglxintegration.cpp as this files is build _only_ when xcb-xlib is present. From gl_integrations.pro: qtConfig(xcb-xlib):qtConfig(opengl):!qtConfig(opengles2) { SUBDIRS += xcb_glx } This also would have been the right place where to define XCB_USE_XLIB, instead of unconditional line in xcb_glx.pro: DEFINES += XCB_USE_GLX XCB_USE_XLIB - qxcbnativeinterface.cpp as this cpp file does not use any Xlib APIs directly, there is no need to include Xlib.h. Change-Id: I531b5f1e79606fcfd1c63810cf51b7d5e9dc58a7 Reviewed-by: Gatis Paeglis --- .../gl_integrations/gl_integrations_plugin_base.pri | 1 - .../gl_integrations/xcb_egl/qxcbeglintegration.cpp | 2 +- .../xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp | 2 +- .../xcb/gl_integrations/xcb_egl/qxcbeglwindow.h | 2 +- .../xcb/gl_integrations/xcb_egl/xcb_egl.pro | 2 -- .../gl_integrations/xcb_glx/qxcbglxintegration.cpp | 8 +++----- .../xcb/gl_integrations/xcb_glx/xcb_glx.pro | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 12 ++++++------ src/plugins/platforms/xcb/qxcbconnection.h | 4 ++-- src/plugins/platforms/xcb/qxcbcursor.cpp | 10 +++++----- src/plugins/platforms/xcb/qxcbcursor.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 4 ++-- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 12 ++++-------- src/plugins/platforms/xcb/qxcbwindow.cpp | 10 +++++----- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 1 - 15 files changed, 32 insertions(+), 42 deletions(-) diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 4ab406acb9b..063a74c395d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -7,7 +7,6 @@ load(qt_build_paths) # needed by Xcursor ... qtConfig(xcb-xlib) { - DEFINES += XCB_USE_XLIB qtConfig(xinput2) { DEFINES += XCB_USE_XINPUT2 } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp index 4852d38f7e1..9c52733120d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -116,7 +116,7 @@ QPlatformOffscreenSurface *QXcbEglIntegration::createPlatformOffscreenSurface(QO void *QXcbEglIntegration::xlib_display() const { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) return m_connection->xlib_display(); #else return EGL_DEFAULT_DISPLAY; diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp index 3f7ef94238d..9c3fd26d49e 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp @@ -65,7 +65,7 @@ void QXcbEglWindow::resolveFormat(const QSurfaceFormat &format) m_format = q_glFormatFromConfig(m_glIntegration->eglDisplay(), m_config, format); } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) const xcb_visualtype_t *QXcbEglWindow::createVisual() { QXcbScreen *scr = xcbScreen(); diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h index 3090cef735f..e49a3fe2acd 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h @@ -62,7 +62,7 @@ protected: void create() override; void resolveFormat(const QSurfaceFormat &format) override; -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) const xcb_visualtype_t *createVisual() override; #endif diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro index 1c193849caf..a39e00ec59e 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro @@ -5,8 +5,6 @@ QT += egl_support-private CONFIG += egl -qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB - DEFINES += QT_NO_FOREACH HEADERS += \ diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index 77cbdd5fbad..a283d451f81 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -75,7 +75,7 @@ typedef struct xcb_glx_buffer_swap_complete_event_t { } xcb_glx_buffer_swap_complete_event_t; #endif -#if defined(XCB_USE_XLIB) && defined(XCB_USE_GLX) +#if defined(XCB_USE_GLX) typedef struct { int type; unsigned long serial; /* # of last request processed by server */ @@ -202,10 +202,9 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast(m_connection->xlib_display()); -#endif + const char *glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor) { if (!strcmp(glxvendor, "ATI") || !strcmp(glxvendor, "Chromium")) @@ -231,10 +230,9 @@ bool QXcbGlxIntegration::supportsSwitchableWidgetComposition() const if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast(m_connection->xlib_display()); -#endif + const char *glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor) { if (!strcmp(glxvendor, "Parallels Inc")) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro index 215f5a3fe12..5af61723012 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro @@ -4,7 +4,7 @@ include(../gl_integrations_plugin_base.pri) QT += glx_support-private #should be removed from the sources -DEFINES += XCB_USE_GLX XCB_USE_XLIB +DEFINES += XCB_USE_GLX DEFINES += QT_NO_FOREACH qtConfig(xcb-glx) { diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5c15a9cbcb6..e29dd645cbf 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -69,7 +69,7 @@ #include #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #include @@ -136,7 +136,7 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) } #endif // XCB_USE_XINPUT2 -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) static const char * const xcbConnectionErrors[] = { "No error", /* Error 0 */ "I/O error", /* XCB_CONN_ERROR */ @@ -557,7 +557,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) , m_nativeInterface(nativeInterface) { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) Display *dpy = XOpenDisplay(m_displayName.constData()); if (dpy) { m_primaryScreenNumber = DefaultScreen(dpy); @@ -569,7 +569,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra } #else m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreenNumber); -#endif //XCB_USE_XLIB +#endif // QT_CONFIG(xcb_xlib) if (Q_UNLIKELY(!m_connection || xcb_connection_has_error(m_connection))) qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); @@ -685,7 +685,7 @@ QXcbConnection::~QXcbConnection() delete m_glIntegration; -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XCloseDisplay(static_cast(m_xlib_display)); #else xcb_disconnect(xcb_connection()); @@ -1551,7 +1551,7 @@ xcb_window_t QXcbConnection::clientLeader() return m_clientLeader; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) void *QXcbConnection::xlib_display() const { return m_xlib_display; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 60892653046..5b9a3887f51 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -421,7 +421,7 @@ public: bool hasDefaultVisualId() const { return m_defaultVisualId != UINT_MAX; } xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) void *xlib_display() const; void *createVisualInfoForDefaultVisualId() const; #endif @@ -632,7 +632,7 @@ private: QScopedPointer m_wmSupport; QXcbNativeInterface *m_nativeInterface = nullptr; -#if defined(XCB_USE_XLIB) +#if QT_CONFIG(xcb_xlib) void *m_xlib_display = nullptr; #endif QXcbEventReader *m_reader = nullptr; diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index d257ab1242a..7c62c2e2b36 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -60,7 +60,7 @@ typedef char *(*PtrXcursorLibraryGetTheme)(void *); typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); typedef int (*PtrXcursorLibraryGetDefaultSize)(void *); -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) #include enum { XCursorShape = CursorShape @@ -308,7 +308,7 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) const char *cursorStr = "cursor"; xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr); -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static bool function_ptrs_not_initialized = true; if (function_ptrs_not_initialized) { QLibrary xcursorLib(QLatin1String("Xcursor"), 1); @@ -509,7 +509,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) return cursor; } -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) bool updateCursorTheme(void *dpy, const QByteArray &theme) { if (!ptrXcursorLibraryGetTheme || !ptrXcursorLibrarySetTheme) @@ -553,7 +553,7 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) } return cursor; } -#endif // XCB_USE_XLIB / QT_CONFIG(library) +#endif // QT_CONFIG(xcb_xlib) / QT_CONFIG(library) xcb_cursor_t QXcbCursor::createFontCursor(int cshape) { @@ -562,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) xcb_cursor_t cursor = XCB_NONE; // Try Xcursor first -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) if (cshape >= 0 && cshape <= Qt::LastCursor) { void *dpy = connection()->xlib_display(); // special case for non-standard dnd-* cursors diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index 41ec4dbbf84..e3f88518fef 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -101,7 +101,7 @@ private: #ifndef QT_NO_CURSOR CursorHash m_cursorHash; #endif -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 8e3ee20329d..e742e91f7d2 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -63,7 +63,7 @@ #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #endif @@ -123,7 +123,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true); qRegisterMetaType(); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XInitThreads(); #endif m_nativeInterface.reset(new QXcbNativeInterface); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 725288633a2..97dcb8f328c 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -57,11 +57,7 @@ #include #include -#ifdef XCB_USE_XLIB -# include -#else -# include -#endif +#include #include @@ -210,7 +206,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr const QXcbScreen *xcbScreen = static_cast(screen->handle()); switch (resourceType(lowerCaseResource)) { case Display: -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) result = xcbScreen->connection()->xlib_display(); #endif break; @@ -436,7 +432,7 @@ void *QXcbNativeInterface::rootWindow() void *QXcbNativeInterface::display() { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) QXcbIntegration *integration = QXcbIntegration::instance(); QXcbConnection *defaultConnection = integration->defaultConnection(); if (defaultConnection) @@ -514,7 +510,7 @@ QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window) void *QXcbNativeInterface::displayForWindow(QWindow *window) { -#if defined(XCB_USE_XLIB) +#if QT_CONFIG(xcb_xlib) QXcbScreen *screen = qPlatformScreenForWindow(window); return screen ? screen->connection()->xlib_display() : Q_NULLPTR; #else diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index d6c69d52ef6..31757ca6f6e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -99,7 +99,7 @@ #include #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #endif @@ -251,7 +251,7 @@ static inline bool positionIncludesFrame(QWindow *w) return qt_window_private(w)->positionPolicy == QWindowPrivate::WindowFrameInclusive; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) { #include @@ -297,7 +297,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) #endif return &tp; } -#endif // XCB_USE_XLIB +#endif // QT_CONFIG(xcb_xlib) // TODO move this into a utility function in QWindow or QGuiApplication static QWindow *childWindowAt(QWindow *win, const QPoint &p) @@ -569,7 +569,7 @@ void QXcbWindow::create() if (window()->flags() & Qt::WindowTransparentForInput) setTransparentForMouseEvents(true); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) // force sync to read outstanding requests - see QTBUG-29106 XSync(DISPLAY_FROM_XCB(platformScreen), false); #endif @@ -1535,7 +1535,7 @@ void QXcbWindow::setWindowTitle(const QString &title) ba.length(), ba.constData())); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XTextProperty *text = qstringToXTP(DISPLAY_FROM_XCB(this), title); if (text) XSetWMName(DISPLAY_FROM_XCB(this), m_window, text); diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 6db0c76dea2..6c9a3259b64 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -50,7 +50,6 @@ load(qt_build_paths) DEFINES += QT_BUILD_XCB_PLUGIN # needed by Xcursor ... qtConfig(xcb-xlib) { - DEFINES += XCB_USE_XLIB QMAKE_USE += xcb_xlib qtConfig(xinput2) { From f17554fce1d693cfd58bd568d2e43e977b3a6507 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 13 Jun 2017 16:05:24 +0200 Subject: [PATCH 28/82] Skip the threaded systemProxyForQuery test on Windows 7 Under qemu/kvm the systemProxyForQuery call - when initiated from a secondary thread - never completes. Consequently the thread hangs, test fails and the crashes due to the inability to cleanly terminate the test thread. Task-number: QTQAINFRA-1200 Change-Id: I9bd4ed163d215fadd8532a03bbdccd80fc8d9cb1 Reviewed-by: Frederik Gladhorn --- .../kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index 7faf0d947c2..4f947a57384 100644 --- a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -41,7 +41,7 @@ #include #include #include - +#include #include class tst_QNetworkProxyFactory : public QObject { @@ -416,6 +416,9 @@ public: //regression test for QTBUG-18799 void tst_QNetworkProxyFactory::systemProxyForQueryCalledFromThread() { + if (QSysInfo::productType() == QLatin1String("windows") && QSysInfo::productVersion() == QLatin1String("7sp1")) { + QSKIP("This test fails by the systemProxyForQuery() call hanging - QTQAINFRA-1200"); + } QUrl url(QLatin1String("http://qt-project.org")); QNetworkProxyQuery query(url); QSPFQThread thread; From 3e67f727b84a06c0742aad0abbec027b57fef657 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 16 Jun 2017 18:03:20 +0200 Subject: [PATCH 29/82] Ignore failure of tst_qmenu::submenuTearOffDontClose on macOS 10.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test is failing inexplicably on macOS 10.11. Task-number: QTQAINFRA-1315 Change-Id: Ia0162768b6d4fdd016bce62b92c3df0b5d4ed8d0 Reviewed-by: Tor Arne Vestbø --- tests/auto/widgets/widgets/qmenu/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index de49d5ff459..ea468b378e1 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -1,2 +1,4 @@ [task258920_mouseBorder] osx +[submenuTearOffDontClose] +osx-10.11 ci From 666f5dbb153c5d7e4d739923a2a4f557883c3060 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 14 Jun 2017 16:04:01 +0200 Subject: [PATCH 30/82] Ignore tst_qwidget::showMinimizedKeepsFocus on macOS 10.11 It's failing for inexplicable reasons not only on 10.10 but also 10.11. Task-number: QTQAINFRA-1317 Change-Id: Id316764443dfe9e0ae30e2d25d8bae73fa255617 Reviewed-by: Frederik Gladhorn --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 01c8e783add..ab45a342e36 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -47,6 +47,7 @@ osx osx [showMinimizedKeepsFocus] osx-10.10 +osx-10.11 ci [moveWindowInShowEvent:1] osx [moveWindowInShowEvent:2] From 5628d47291eb5fcf3ef771cfbd5c2cfcab687de6 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 14 Jun 2017 14:43:58 +0200 Subject: [PATCH 31/82] Ignore tst_QOpenGLWidget::clearAndGrab failures on Ubuntu The test fails for unknown reasons when using the mesa swrast when using qemu/kvm (as opposed to when using the vmware mesa driver). Task-number: QTQAINFRA-1318 Change-Id: Ib7e9d894cd368b8c2c12d83ec1e4862622781fe6 Reviewed-by: Frederik Gladhorn Reviewed-by: Laszlo Agocs --- tests/auto/widgets/widgets/qopenglwidget/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST index fa326a6ea5f..7825c33a0a6 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST +++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST @@ -1,5 +1,6 @@ [clearAndGrab] opensuse-13.1 +ubuntu #QTBUG-31611 [painter] From 0c7e4b97a7990b29255abaf4568f62b6a6b6c470 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 14 Jun 2017 09:54:19 +0200 Subject: [PATCH 32/82] Ignore tst_macNativeEvents::testPushButtonPressRelease on macOS 10.11 Task-number: QTQAINFRA-1292 Change-Id: I1047b797380820d2636f4d514b41b621c7794486 Reviewed-by: Frederik Gladhorn --- tests/auto/other/macnativeevents/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST index 3e68ba0cf01..f1eb038201a 100644 --- a/tests/auto/other/macnativeevents/BLACKLIST +++ b/tests/auto/other/macnativeevents/BLACKLIST @@ -21,3 +21,6 @@ osx osx [testMouseDragToNonClientArea] osx +# QTQAINFRA-1292 +[testPushButtonPressRelease] +osx-10.11 ci From dcaa2d057b2276acb6f98b4ef071912babe1961c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 19 Jun 2017 16:31:50 +0200 Subject: [PATCH 33/82] Fix crash when running tst_qlbuffers under Angle Angle does not support glGetBufferSubData. Task-number: QTQAINFRA-1199 Change-Id: I17f99027cc374131965d6589d2babacb75f9174a Reviewed-by: Laszlo Agocs --- src/opengl/qglbuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index 08aa37e5aa8..200ee2499ee 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -343,7 +343,7 @@ bool QGLBuffer::read(int offset, void *data, int count) { #if !defined(QT_OPENGL_ES) Q_D(QGLBuffer); - if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) + if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id() || !d->funcs->d()->GetBufferSubData) return false; while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state. d->funcs->glGetBufferSubData(d->type, offset, count, data); From fdbf400b27ff25f98a64879adeeb342931a84d9a Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Mon, 19 Jun 2017 14:30:19 +0200 Subject: [PATCH 34/82] winrt: Fix build for Windows Kit 10.0.10586.0 The old SDK does not consider the macro value a constant expression, so the build fails. Change-Id: I95bdcd9ad34ee4da81016ff07e70439ed229f853 Reviewed-by: Maurice Kalinowski --- src/network/socket/qnativesocketengine_winrt.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 38c2b6e8c05..291d85844d6 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -251,17 +251,16 @@ public: { HRESULT hr = action->GetResults(); if (FAILED(hr)) { - switch (hr) { - case HRESULT_FROM_WIN32(WSAETIMEDOUT): + if (hr == HRESULT_FROM_WIN32(WSAETIMEDOUT)) { emit connectOpFinished(false, QAbstractSocket::NetworkError, WinRTSocketEngine::ConnectionTimeOutErrorString); return S_OK; - case HRESULT_FROM_WIN32(WSAEHOSTUNREACH): + } else if (hr == HRESULT_FROM_WIN32(WSAEHOSTUNREACH)) { emit connectOpFinished(false, QAbstractSocket::HostNotFoundError, WinRTSocketEngine::HostUnreachableErrorString); return S_OK; - case HRESULT_FROM_WIN32(WSAECONNREFUSED): + } else if (hr == HRESULT_FROM_WIN32(WSAECONNREFUSED)) { emit connectOpFinished(false, QAbstractSocket::ConnectionRefusedError, WinRTSocketEngine::ConnectionRefusedErrorString); return S_OK; - default: + } else { emit connectOpFinished(false, QAbstractSocket::UnknownSocketError, WinRTSocketEngine::UnknownSocketErrorString); return S_OK; } From 5ede5706a8b8052280981aa1d9c42999a24b74b5 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 22:22:22 +0200 Subject: [PATCH 35/82] Convert features.wheelevent to QT_CONFIG Change-Id: I46083a9115c199d1ebe024ed5f64b160a27462f1 Reviewed-by: Oswald Buddenhagen --- .../corelib/threads/mandelbrot/mandelbrotwidget.cpp | 2 +- examples/corelib/threads/mandelbrot/mandelbrotwidget.h | 2 +- examples/widgets/graphicsview/chip/view.cpp | 2 +- examples/widgets/graphicsview/chip/view.h | 2 +- .../widgets/graphicsview/elasticnodes/graphwidget.cpp | 2 +- .../widgets/graphicsview/elasticnodes/graphwidget.h | 2 +- examples/widgets/painting/affine/xform.cpp | 2 +- examples/widgets/painting/affine/xform.h | 2 +- examples/widgets/widgets/mousebuttons/buttontester.cpp | 2 +- examples/widgets/widgets/mousebuttons/buttontester.h | 2 +- src/gui/kernel/qevent.cpp | 8 ++++---- src/gui/kernel/qevent.h | 2 +- src/gui/kernel/qguiapplication.cpp | 4 ++-- src/gui/kernel/qwindow.cpp | 6 +++--- src/gui/kernel/qwindow.h | 4 ++-- src/plugins/platforms/cocoa/qnsview.mm | 6 +++--- src/widgets/graphicsview/qgraphicsproxywidget.cpp | 2 +- src/widgets/graphicsview/qgraphicsproxywidget.h | 2 +- src/widgets/graphicsview/qgraphicsview.cpp | 4 ++-- src/widgets/graphicsview/qgraphicsview.h | 2 +- src/widgets/itemviews/qlistview.cpp | 4 ++-- src/widgets/itemviews/qlistview.h | 2 +- src/widgets/kernel/qapplication.cpp | 8 ++++---- src/widgets/kernel/qapplication.h | 4 ++-- src/widgets/kernel/qapplication_p.h | 2 +- src/widgets/kernel/qwidget.cpp | 8 ++++---- src/widgets/kernel/qwidget.h | 2 +- src/widgets/kernel/qwidgetwindow.cpp | 6 +++--- src/widgets/kernel/qwidgetwindow_p.h | 2 +- src/widgets/statemachine/qguistatemachine.cpp | 4 ++-- src/widgets/util/qsystemtrayicon_x11.cpp | 2 +- src/widgets/widgets/qabstractbutton.cpp | 2 +- src/widgets/widgets/qabstractscrollarea.cpp | 4 ++-- src/widgets/widgets/qabstractscrollarea.h | 2 +- src/widgets/widgets/qabstractslider.cpp | 4 ++-- src/widgets/widgets/qabstractslider.h | 2 +- src/widgets/widgets/qabstractspinbox.cpp | 2 +- src/widgets/widgets/qabstractspinbox.h | 2 +- src/widgets/widgets/qcalendarwidget.cpp | 4 ++-- src/widgets/widgets/qcombobox.cpp | 2 +- src/widgets/widgets/qcombobox.h | 2 +- src/widgets/widgets/qdatetimeedit.cpp | 2 +- src/widgets/widgets/qdatetimeedit.h | 2 +- src/widgets/widgets/qmenu.cpp | 2 +- src/widgets/widgets/qmenu.h | 2 +- src/widgets/widgets/qplaintextedit.cpp | 2 +- src/widgets/widgets/qplaintextedit.h | 2 +- src/widgets/widgets/qscrollbar.cpp | 2 +- src/widgets/widgets/qscrollbar.h | 2 +- src/widgets/widgets/qtabbar.cpp | 4 ++-- src/widgets/widgets/qtabbar.h | 2 +- src/widgets/widgets/qtextedit.cpp | 2 +- src/widgets/widgets/qtextedit.h | 2 +- .../qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 10 +++++----- .../graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 6 +++--- .../widgets/itemviews/qtableview/tst_qtableview.cpp | 10 +++++----- .../widgets/kernel/qapplication/tst_qapplication.cpp | 6 +++--- .../widgets/qabstractslider/tst_qabstractslider.cpp | 6 +++--- tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 8 ++++---- .../widgets/qdatetimeedit/tst_qdatetimeedit.cpp | 6 +++--- .../auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp | 4 ++-- tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp | 4 ++-- tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp | 4 ++-- 63 files changed, 110 insertions(+), 110 deletions(-) diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp index 8b11c209721..fd0060d8a93 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp @@ -171,7 +171,7 @@ void MandelbrotWidget::keyPressEvent(QKeyEvent *event) } //! [11] -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) //! [12] void MandelbrotWidget::wheelEvent(QWheelEvent *event) { diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h index cbacc2cdd0e..a04bfa6e813 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h @@ -68,7 +68,7 @@ protected: void paintEvent(QPaintEvent *event) override; void resizeEvent(QResizeEvent *event) override; void keyPressEvent(QKeyEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void mousePressEvent(QMouseEvent *event) override; diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index 79b173bec74..491f1a54cfc 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -64,7 +64,7 @@ #endif #include -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void GraphicsView::wheelEvent(QWheelEvent *e) { if (e->modifiers() & Qt::ControlModifier) { diff --git a/examples/widgets/graphicsview/chip/view.h b/examples/widgets/graphicsview/chip/view.h index 2d174250c2b..89b2e813f11 100644 --- a/examples/widgets/graphicsview/chip/view.h +++ b/examples/widgets/graphicsview/chip/view.h @@ -69,7 +69,7 @@ public: GraphicsView(View *v) : QGraphicsView(), view(v) { } protected: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) override; #endif diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp index 8b2f0a06292..844c8f8aac2 100644 --- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp +++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp @@ -184,7 +184,7 @@ void GraphWidget::timerEvent(QTimerEvent *event) } //! [4] -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) //! [5] void GraphWidget::wheelEvent(QWheelEvent *event) { diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.h b/examples/widgets/graphicsview/elasticnodes/graphwidget.h index 79acb899859..5ed6aed4522 100644 --- a/examples/widgets/graphicsview/elasticnodes/graphwidget.h +++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.h @@ -73,7 +73,7 @@ public slots: protected: void keyPressEvent(QKeyEvent *event) override; void timerEvent(QTimerEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void drawBackground(QPainter *painter, const QRectF &rect) override; diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp index e48c1012627..e47bc9d2517 100644 --- a/examples/widgets/painting/affine/xform.cpp +++ b/examples/widgets/painting/affine/xform.cpp @@ -260,7 +260,7 @@ void XFormView::timerEvent(QTimerEvent *e) } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void XFormView::wheelEvent(QWheelEvent *e) { m_scale += e->delta() / qreal(600); diff --git a/examples/widgets/painting/affine/xform.h b/examples/widgets/painting/affine/xform.h index f2eed99b4fa..1dce3b26da3 100644 --- a/examples/widgets/painting/affine/xform.h +++ b/examples/widgets/painting/affine/xform.h @@ -125,7 +125,7 @@ signals: protected: void timerEvent(QTimerEvent *e) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) override; #endif diff --git a/examples/widgets/widgets/mousebuttons/buttontester.cpp b/examples/widgets/widgets/mousebuttons/buttontester.cpp index 3faf6e35532..66532216982 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.cpp +++ b/examples/widgets/widgets/mousebuttons/buttontester.cpp @@ -89,7 +89,7 @@ void ButtonTester::mouseDoubleClickEvent(QMouseEvent *e) this->setText(result); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void ButtonTester::wheelEvent (QWheelEvent *e) { QString result; diff --git a/examples/widgets/widgets/mousebuttons/buttontester.h b/examples/widgets/widgets/mousebuttons/buttontester.h index cd05171d869..d99dcceb188 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.h +++ b/examples/widgets/widgets/mousebuttons/buttontester.h @@ -64,7 +64,7 @@ protected: void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void mouseDoubleClickEvent(QMouseEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent * event) override; #endif int buttonByNumber(const Qt::MouseButton button); diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 2777e408c1d..12ac7323a67 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -767,7 +767,7 @@ QHoverEvent::~QHoverEvent() \sa pos(), pixelDelta(), angleDelta() */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QWheelEvent::QWheelEvent(const QPointF &pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient) @@ -952,7 +952,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, invertedScrolling(inverted) {} -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! \fn QPoint QWheelEvent::pixelDelta() const @@ -3956,13 +3956,13 @@ QDebug operator<<(QDebug dbg, const QEvent *e) dbg << ')'; } break; -# ifndef QT_NO_WHEELEVENT +# if QT_CONFIG(wheelevent) case QEvent::Wheel: { const QWheelEvent *we = static_cast(e); dbg << "QWheelEvent(" << "pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta() << ')'; } break; -# endif // !QT_NO_WHEELEVENT +# endif // QT_CONFIG(wheelevent) case QEvent::KeyPress: case QEvent::KeyRelease: case QEvent::ShortcutOverride: diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index cfc3b842d7a..95de6000123 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -169,7 +169,7 @@ protected: QPointF p, op; }; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class Q_GUI_EXPORT QWheelEvent : public QInputEvent { public: diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c0b0acbda62..8cbf0a457de 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1997,7 +1997,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) { -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QWindow *window = e->window.data(); QPointF globalPoint = e->globalPos; QPointF localPoint = e->localPos; @@ -2027,7 +2027,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh QGuiApplication::sendSpontaneousEvent(window, &ev); #else Q_UNUSED(e); -#endif /* ifndef QT_NO_WHEELEVENT */ +#endif // QT_CONFIG(wheelevent) } // Remember, Qt convention is: keyboard state is state *before* diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 519d749b8ac..8048a397e81 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2220,7 +2220,7 @@ bool QWindow::event(QEvent *ev) #endif break; } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: wheelEvent(static_cast(ev)); break; @@ -2418,7 +2418,7 @@ void QWindow::mouseMoveEvent(QMouseEvent *ev) ev->ignore(); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! Override this to handle mouse wheel or other wheel events (\a ev). */ @@ -2426,7 +2426,7 @@ void QWindow::wheelEvent(QWheelEvent *ev) { ev->ignore(); } -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! Override this to handle touch events (\a ev). diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 2883749d2e2..748c3ee7073 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -71,7 +71,7 @@ class QShowEvent; class QHideEvent; class QKeyEvent; class QMouseEvent; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class QWheelEvent; #endif class QTouchEvent; @@ -344,7 +344,7 @@ protected: virtual void mouseReleaseEvent(QMouseEvent *); virtual void mouseDoubleClickEvent(QMouseEvent *); virtual void mouseMoveEvent(QMouseEvent *); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *); #endif virtual void touchEvent(QTouchEvent *); diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 2c9157c4ec7..e6d513bb896 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include +#include #include "qnsview.h" #include "qcocoawindow.h" @@ -1388,7 +1388,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } #endif // QT_NO_GESTURES -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) - (void)scrollWheel:(NSEvent *)theEvent { if (!m_platformWindow) @@ -1469,7 +1469,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) QWindowSystemInterface::handleWheelEvent(m_platformWindow->window(), qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph, source, isInverted); } -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) - (int) convertKeyCode : (QChar)keyChar { diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 0b9e6e72162..eface182ae8 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -1273,7 +1273,7 @@ void QGraphicsProxyWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event) { Q_D(QGraphicsProxyWidget); diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h index 8112c65d636..c1564cba347 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.h +++ b/src/widgets/graphicsview/qgraphicsproxywidget.h @@ -103,7 +103,7 @@ protected: void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE; #endif diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 9d7412340fb..f5f24649c23 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -3409,7 +3409,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event) #endif } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! \reimp */ @@ -3437,7 +3437,7 @@ void QGraphicsView::wheelEvent(QWheelEvent *event) if (!event->isAccepted()) QAbstractScrollArea::wheelEvent(event); } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! \reimp diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 64d5f5b4300..fb975b9d71e 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -259,7 +259,7 @@ protected: void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index e7a3c11b440..93b2b0b5e0e 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -801,7 +801,7 @@ void QListView::mouseReleaseEvent(QMouseEvent *e) } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! \reimp */ @@ -828,7 +828,7 @@ void QListView::wheelEvent(QWheelEvent *e) QApplication::sendEvent(d->hbar, e); } } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) /*! \reimp diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h index e918e66d383..6b164aeec80 100644 --- a/src/widgets/itemviews/qlistview.h +++ b/src/widgets/itemviews/qlistview.h @@ -153,7 +153,7 @@ protected: void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 4ab43628b9e..6ef9c1da511 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -407,7 +407,7 @@ QWidget *QApplicationPrivate::main_widget = 0; // main application widget QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show() QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QPointer QApplicationPrivate::wheel_widget; #endif bool qt_in_tab_key_event = false; @@ -2984,7 +2984,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::KeyPress: case QEvent::KeyRelease: case QEvent::MouseMove: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif case QEvent::TouchBegin: @@ -3227,7 +3227,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) d->hoverGlobalPos = mouse->globalPos(); } break; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: { QWidget* w = static_cast(receiver); @@ -4041,7 +4041,7 @@ int QApplication::keyboardInputInterval() \sa QStyleHints::wheelScrollLines() */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) int QApplication::wheelScrollLines() { return styleHints()->wheelScrollLines(); diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index be5ec2ad059..396d0c94743 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -76,7 +76,7 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime) Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval) Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval) -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines) #endif Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut) @@ -154,7 +154,7 @@ public: static void setKeyboardInputInterval(int); static int keyboardInputInterval(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) static void setWheelScrollLines(int); static int wheelScrollLines(); #endif diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 271844a23e3..1a189cb2b97 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -195,7 +195,7 @@ public: static QWidget *focus_widget; static QWidget *hidden_focus_widget; static QWidget *active_window; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) static int wheel_scroll_lines; static QPointer wheel_widget; #endif diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index f467bcfff5a..b710d13e670 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8777,7 +8777,7 @@ bool QWidget::event(QEvent *event) case QEvent::ContextMenu: case QEvent::KeyPress: case QEvent::KeyRelease: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif return false; @@ -8801,7 +8801,7 @@ bool QWidget::event(QEvent *event) case QEvent::MouseButtonDblClick: mouseDoubleClickEvent((QMouseEvent*)event); break; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: wheelEvent((QWheelEvent*)event); break; @@ -9418,7 +9418,7 @@ void QWidget::mouseDoubleClickEvent(QMouseEvent *event) mousePressEvent(event); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! This event handler, for event \a event, can be reimplemented in a subclass to receive wheel events for the widget. @@ -9437,7 +9437,7 @@ void QWidget::wheelEvent(QWheelEvent *event) { event->ignore(); } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) #ifndef QT_NO_TABLETEVENT /*! diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 1c378924a09..ef456ef1dad 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -613,7 +613,7 @@ protected: virtual void mouseReleaseEvent(QMouseEvent *event); virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *event); #endif virtual void keyPressEvent(QKeyEvent *event); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 6741555c0c5..f9f67cb4498 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -265,7 +265,7 @@ bool QWidgetWindow::event(QEvent *event) handleResizeEvent(static_cast(event)); return true; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: handleWheelEvent(static_cast(event)); return true; @@ -778,7 +778,7 @@ void QWidgetWindow::handleCloseEvent(QCloseEvent *event) event->setAccepted(is_closing); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QWidgetWindow::handleWheelEvent(QWheelEvent *event) { @@ -808,7 +808,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event) QGuiApplication::sendSpontaneousEvent(widget, &translated); } -#endif // QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) #ifndef QT_NO_DRAGANDDROP diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h index a81355160e0..944f845e3c8 100644 --- a/src/widgets/kernel/qwidgetwindow_p.h +++ b/src/widgets/kernel/qwidgetwindow_p.h @@ -89,7 +89,7 @@ protected: void handleTouchEvent(QTouchEvent *); void handleMoveEvent(QMoveEvent *); void handleResizeEvent(QResizeEvent *); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void handleWheelEvent(QWheelEvent *); #endif #ifndef QT_NO_DRAGANDDROP diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp index 8d722a44754..a0ae614a03a 100644 --- a/src/widgets/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -100,10 +100,10 @@ static QEvent *cloneEvent(QEvent *e) return new QEvent(*e); case QEvent::HideToParent: return new QEvent(*e); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: return new QWheelEvent(*static_cast(e)); -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) case QEvent::WindowTitleChange: return new QEvent(*e); case QEvent::WindowIconChange: diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index cbd5d9eb804..fd9fdfb507b 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -210,7 +210,7 @@ bool QSystemTrayIconSys::event(QEvent *e) case QEvent::ToolTip: QApplication::sendEvent(q, e); break; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: return QApplication::sendEvent(q, e); #endif diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 77fb203b821..e65613d5cd3 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -935,7 +935,7 @@ bool QAbstractButton::event(QEvent *e) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::ContextMenu: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif return true; diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index abdd946c497..673983d5752 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -1188,7 +1188,7 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e) case QEvent::TouchEnd: case QEvent::MouseMove: case QEvent::ContextMenu: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: #endif #ifndef QT_NO_DRAGANDDROP @@ -1305,7 +1305,7 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) \sa QWidget::wheelEvent() */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QAbstractScrollArea::wheelEvent(QWheelEvent *e) { Q_D(QAbstractScrollArea); diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h index 476914b7811..193fabce56c 100644 --- a/src/widgets/widgets/qabstractscrollarea.h +++ b/src/widgets/widgets/qabstractscrollarea.h @@ -116,7 +116,7 @@ protected: void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 0ea92506952..99ee1eccb7d 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -710,7 +710,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb // offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can // only scroll whole lines, so we keep the reminder until next event. qreal stepsToScrollF = -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) QApplication::wheelScrollLines() * #endif offset * effectiveSingleStep(); @@ -759,7 +759,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QAbstractSlider::wheelEvent(QWheelEvent * e) { Q_D(QAbstractSlider); diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h index 89796857242..d26d6a879c2 100644 --- a/src/widgets/widgets/qabstractslider.h +++ b/src/widgets/widgets/qabstractslider.h @@ -146,7 +146,7 @@ protected: void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE; void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif void changeEvent(QEvent *e) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 501d9560d9b..4a3abe0c321 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1119,7 +1119,7 @@ void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event) \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QAbstractSpinBox::wheelEvent(QWheelEvent *event) { Q_D(QAbstractSpinBox); diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h index b60178b94c1..d81cbfdc344 100644 --- a/src/widgets/widgets/qabstractspinbox.h +++ b/src/widgets/widgets/qabstractspinbox.h @@ -137,7 +137,7 @@ protected: void resizeEvent(QResizeEvent *event) override; void keyPressEvent(QKeyEvent *event) override; void keyReleaseEvent(QKeyEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void focusInEvent(QFocusEvent *event) override; diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index f81377a85cc..c5db3a7c9af 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -957,7 +957,7 @@ protected: void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; @@ -1412,7 +1412,7 @@ void QCalendarView::keyPressEvent(QKeyEvent *event) QTableView::keyPressEvent(event); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QCalendarView::wheelEvent(QWheelEvent *event) { const int numDegrees = event->delta() / 8; diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 45dfffe8bd7..5520e9d28fd 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3285,7 +3285,7 @@ void QComboBox::keyReleaseEvent(QKeyEvent *e) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QComboBox::wheelEvent(QWheelEvent *e) { #ifdef Q_OS_DARWIN diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 2da1ceb047b..8f99594a768 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -234,7 +234,7 @@ protected: void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 2e0a8a3cd71..e136363b170 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1194,7 +1194,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event) \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QDateTimeEdit::wheelEvent(QWheelEvent *event) { QAbstractSpinBox::wheelEvent(event); diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index b54b0e7cf02..30e4a58bb30 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -177,7 +177,7 @@ public Q_SLOTS: protected: void keyPressEvent(QKeyEvent *event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif void focusInEvent(QFocusEvent *event) override; diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 57321315784..95bb9765668 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2797,7 +2797,7 @@ void QMenu::paintEvent(QPaintEvent *e) style()->drawControl(QStyle::CE_MenuEmptyArea, &menuOpt, &p, this); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! \reimp */ diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index e9a5db11122..9d1a17a5b3d 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -237,7 +237,7 @@ protected: void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif void enterEvent(QEvent *) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 746dc201229..173be7aa88d 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2296,7 +2296,7 @@ void QPlainTextEdit::changeEvent(QEvent *e) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QPlainTextEdit::wheelEvent(QWheelEvent *e) { Q_D(QPlainTextEdit); diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h index 432ec85a579..d773c4791cc 100644 --- a/src/widgets/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -250,7 +250,7 @@ protected: virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 66f1a4c689c..a98f3fe0851 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -493,7 +493,7 @@ bool QScrollBar::event(QEvent *event) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QScrollBar::wheelEvent(QWheelEvent *event) { event->ignore(); diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h index b99ad219eb2..963ae4263bb 100644 --- a/src/widgets/widgets/qscrollbar.h +++ b/src/widgets/widgets/qscrollbar.h @@ -64,7 +64,7 @@ public: bool event(QEvent *event) Q_DECL_OVERRIDE; protected: -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 4cd9522bfb7..b9020253a58 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2181,7 +2181,7 @@ void QTabBar::keyPressEvent(QKeyEvent *event) /*!\reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QTabBar::wheelEvent(QWheelEvent *event) { #ifndef Q_OS_MAC @@ -2193,7 +2193,7 @@ void QTabBar::wheelEvent(QWheelEvent *event) Q_UNUSED(event) #endif } -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void QTabBarPrivate::setCurrentNextEnabledIndex(int offset) { diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 71ca58c9930..c7d9f95d93a 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -203,7 +203,7 @@ protected: void mousePressEvent (QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent (QMouseEvent *) Q_DECL_OVERRIDE; void mouseReleaseEvent (QMouseEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 1abc9bef8e5..6973cec4299 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1831,7 +1831,7 @@ void QTextEdit::changeEvent(QEvent *e) /*! \reimp */ -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QTextEdit::wheelEvent(QWheelEvent *e) { Q_D(QTextEdit); diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h index b0e19193a90..745b6445117 100644 --- a/src/widgets/widgets/qtextedit.h +++ b/src/widgets/widgets/qtextedit.h @@ -288,7 +288,7 @@ protected: virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; #endif diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 65c9938f894..e49cd87941f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -112,7 +112,7 @@ private slots: void resizeEvent_data(); void resizeEvent(); void paintEvent(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif void sizeHint_data(); @@ -254,7 +254,7 @@ public: int focusOut; }; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class WheelWidget : public QWidget { public: @@ -264,7 +264,7 @@ public: bool wheelEventCalled; }; -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) // This will be called before the first test function is executed. // It is only called once. @@ -1297,7 +1297,7 @@ void tst_QGraphicsProxyWidget::paintEvent() } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QGraphicsProxyWidget::wheelEvent() { QGraphicsScene scene; @@ -1321,7 +1321,7 @@ void tst_QGraphicsProxyWidget::wheelEvent() QVERIFY(event.isAccepted()); QVERIFY(wheelWidget->wheelEventCalled); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) Q_DECLARE_METATYPE(Qt::SizeHint) void tst_QGraphicsProxyWidget::sizeHint_data() diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 1a96180c05e..121836234d6 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -199,7 +199,7 @@ private slots: void mapFromScenePoly(); void mapFromScenePath(); void sendEvent(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif #ifndef QT_NO_CURSOR @@ -2188,7 +2188,7 @@ void tst_QGraphicsView::sendEvent() QCOMPARE(item->events.last(), QEvent::KeyPress); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class MouseWheelScene : public QGraphicsScene { public: @@ -2245,7 +2245,7 @@ void tst_QGraphicsView::wheelEvent() QCOMPARE(spy.count(), 2); QVERIFY(widget->hasFocus()); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) #ifndef QT_NO_CURSOR void tst_QGraphicsView::cursor() diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index cf8ee310d39..5c0bb678255 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -180,7 +180,7 @@ private slots: void task191545_dragSelectRows(); void taskQTBUG_5062_spansInconsistency(); void taskQTBUG_4516_clickOnRichTextLabel(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void taskQTBUG_5237_wheelEventOnHeader(); #endif void taskQTBUG_8585_crashForNoGoodReason(); @@ -190,7 +190,7 @@ private slots: void taskQTBUG_30653_doItemsLayout(); void taskQTBUG_50171_selectRowAfterSwapColumns(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void mouseWheel_data(); void mouseWheel(); #endif @@ -3966,7 +3966,7 @@ void tst_QTableView::task248688_autoScrollNavigation() } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QTableView::mouseWheel_data() { QTest::addColumn("scrollMode"); @@ -4019,7 +4019,7 @@ void tst_QTableView::mouseWheel() QApplication::sendEvent(view.viewport(), &verticalEvent); QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 15); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QTableView::addColumnWhileEditing() { @@ -4283,7 +4283,7 @@ void tst_QTableView::changeHeaderData() QVERIFY(view.verticalHeader()->width() > textWidth); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader() { QTableView view; diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index b98cc048c83..6ff38abdb8f 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -140,7 +140,7 @@ private slots: void execAfterExit(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelScrollLines(); #endif @@ -1773,7 +1773,7 @@ void tst_QApplication::execAfterExit() QCOMPARE(exitCode, 0); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QApplication::wheelScrollLines() { int argc = 1; @@ -1781,7 +1781,7 @@ void tst_QApplication::wheelScrollLines() // If wheelScrollLines returns 0, the mose wheel will be disabled. QVERIFY(app.wheelScrollLines() > 0); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QApplication::style() { diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp index 17a53204331..f0d74e77978 100644 --- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp @@ -74,7 +74,7 @@ private slots: void minimum_maximum(); void keyPressed_data(); void keyPressed(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent_data(); void wheelEvent(); void fineGrainedWheelEvent_data(); @@ -690,7 +690,7 @@ void tst_QAbstractSlider::keyPressed() QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QAbstractSlider::wheelEvent_data() { QTest::addColumn("initialSliderPosition"); @@ -941,7 +941,7 @@ void tst_QAbstractSlider::fineGrainedWheelEvent() QCOMPARE(slider->sliderPosition(), 1); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QAbstractSlider::sliderPressedReleased_data() { diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index b8820558880..bf190cf60ae 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -120,11 +120,11 @@ private slots: void flaggedItems_data(); void flaggedItems(); void pixmapIcon(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void mouseWheel_data(); void mouseWheel(); void popupWheelHandling(); -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void layoutDirection(); void itemListPosition(); void separatorItem_data(); @@ -2036,7 +2036,7 @@ void tst_QComboBox::pixmapIcon() QCOMPARE( box.itemIcon(1).isNull(), false ); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) // defined to be 120 by the wheel mouse vendors according to the docs #define WHEEL_DELTA 120 @@ -2133,7 +2133,7 @@ void tst_QComboBox::popupWheelHandling() QVERIFY(comboBox->view()->isVisible()); QCOMPARE(comboBox->view()->pos(), popupPos); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QComboBox::layoutDirection() { diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 9ab755c5f1f..94e4fc005cc 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -205,7 +205,7 @@ private slots: void reverseTest(); void ddMMMMyyyy(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif @@ -2998,7 +2998,7 @@ void tst_QDateTimeEdit::ddMMMMyyyy() QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200"); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void tst_QDateTimeEdit::wheelEvent() { testWidget->setDisplayFormat("dddd/MM"); @@ -3011,7 +3011,7 @@ void tst_QDateTimeEdit::wheelEvent() qApp->sendEvent(testWidget, &w); QCOMPARE(testWidget->date(), QDate(2000, 3, 22)); } -#endif // !QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) void tst_QDateTimeEdit::specialValueCornerCase() { diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index 08ef96bf1bc..5238eea5922 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp @@ -50,7 +50,7 @@ class tst_QScrollBar : public QObject private slots: void scrollSingleStep(); void task_209492(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QTBUG_27308(); #endif void QTBUG_42871(); @@ -143,7 +143,7 @@ void tst_QScrollBar::task_209492() QCOMPARE(spy.count(), 1); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) #define WHEEL_DELTA 120 // copied from tst_QAbstractSlider / tst_QComboBox void tst_QScrollBar::QTBUG_27308() { diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 808c7f9d3df..07a2fd859d2 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -69,7 +69,7 @@ public: { return QSpinBox::valueFromText(text); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) { QSpinBox::wheelEvent(event); @@ -1218,7 +1218,7 @@ void tst_QSpinBox::setGroupSeparatorShown() void tst_QSpinBox::wheelEvents() { -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) SpinBox spinBox; spinBox.setRange(-20, 20); spinBox.setValue(0); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index bc94e2a05bf..55ef44f4e03 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -199,7 +199,7 @@ private slots: void findWithRegExpReturnsFalseIfNoMoreResults(); #endif -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(); #endif @@ -2566,7 +2566,7 @@ void tst_QTextEdit::findWithRegExpReturnsFalseIfNoMoreResults() } #endif -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) class TextEdit : public QTextEdit { From 7f62c5fedc4a677fd9d9b002c4dfb9fd52a8a1a3 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 23:04:21 +0200 Subject: [PATCH 36/82] Convert features.tabletevent to QT_CONFIG Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378 Reviewed-by: Oswald Buddenhagen --- src/3rdparty/wintab/qt_attribution.json | 2 +- src/gui/kernel/qevent.cpp | 12 ++++----- src/gui/kernel/qevent.h | 4 +-- src/gui/kernel/qevent_p.h | 4 +-- src/gui/kernel/qguiapplication.cpp | 6 ++--- src/gui/kernel/qwindow.cpp | 4 +-- src/gui/kernel/qwindow.h | 4 +-- .../platforms/android/androidjniinput.cpp | 14 +++++----- .../platforms/windows/qwindowscontext.cpp | 5 ++-- .../windows/qwindowstabletsupport.cpp | 4 --- .../platforms/windows/qwindowstabletsupport.h | 6 ++--- src/plugins/platforms/xcb/qxcbconnection.cpp | 4 +-- src/plugins/platforms/xcb/qxcbconnection.h | 8 +++--- .../platforms/xcb/qxcbconnection_xi2.cpp | 26 +++++++++---------- src/widgets/kernel/qapplication.cpp | 6 ++--- src/widgets/kernel/qwidget.cpp | 6 ++--- src/widgets/kernel/qwidget.h | 2 +- src/widgets/kernel/qwidgetwindow.cpp | 6 ++--- src/widgets/kernel/qwidgetwindow_p.h | 2 +- src/widgets/statemachine/qguistatemachine.cpp | 8 +++--- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 4 +-- 21 files changed, 68 insertions(+), 69 deletions(-) diff --git a/src/3rdparty/wintab/qt_attribution.json b/src/3rdparty/wintab/qt_attribution.json index 742278fb26d..ac06e8da5a1 100644 --- a/src/3rdparty/wintab/qt_attribution.json +++ b/src/3rdparty/wintab/qt_attribution.json @@ -2,7 +2,7 @@ "Id": "wintab", "Name": "Wintab API", "QDocModule": "qtgui", - "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -DQT_NO_TABLETEVENT to avoid.", + "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -no-feature-tabletevent to avoid.", "Description": "Wintab is a de facto API for pointing devices on Windows.", "Homepage": "http://www.pointing.com/Wintab.html", diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 12ac7323a67..5ae76abb558 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2264,7 +2264,7 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const return QVariant(); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) /*! \class QTabletEvent @@ -2706,7 +2706,7 @@ Qt::MouseButtons QTabletEvent::buttons() const \sa posF() */ -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifndef QT_NO_GESTURES /*! @@ -3856,7 +3856,7 @@ static void formatDropEvent(QDebug d, const QDropEvent *e) # endif // !QT_NO_DRAGANDDROP -# ifndef QT_NO_TABLETEVENT +# if QT_CONFIG(tabletevent) static void formatTabletEvent(QDebug d, const QTabletEvent *e) { @@ -3883,7 +3883,7 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e) d << ", tangentialPressure=" << e->tangentialPressure(); } -# endif // !QT_NO_TABLETEVENT +# endif // QT_CONFIG(tabletevent) QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) { @@ -4063,7 +4063,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) dbg << "QContextMenuEvent(" << static_cast(e)->pos() << ')'; break; # endif // !QT_NO_CONTEXTMENU -# ifndef QT_NO_TABLETEVENT +# if QT_CONFIG(tabletevent) case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: case QEvent::TabletPress: @@ -4071,7 +4071,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) case QEvent::TabletRelease: formatTabletEvent(dbg, static_cast(e)); break; -# endif // !QT_NO_TABLETEVENT +# endif // QT_CONFIG(tabletevent) case QEvent::Enter: dbg << "QEnterEvent(" << static_cast(e)->pos() << ')'; break; diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 95de6000123..18f87183302 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -237,7 +237,7 @@ protected: }; #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class Q_GUI_EXPORT QTabletEvent : public QInputEvent { Q_GADGET @@ -295,7 +295,7 @@ protected: // ### Qt 6: QPointingEvent will have Buttons, QTabletEvent will inherit void *mExtra; }; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifndef QT_NO_GESTURES class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 1eccfaea78a..7df4a1e25be 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -94,7 +94,7 @@ public: QVector rawScreenPositions; }; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class QTabletEventPrivate { public: @@ -106,7 +106,7 @@ public: Qt::MouseButton b; Qt::MouseButtons buttonState; }; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 8cbf0a457de..f43329afd06 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2302,7 +2302,7 @@ QGuiApplicationPrivate::TabletPointData &QGuiApplicationPrivate::tabletDevicePoi void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::TabletEvent *e) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) TabletPointData &pointData = tabletDevicePoint(e->uid); QEvent::Type type = QEvent::TabletMove; @@ -2369,7 +2369,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T void QGuiApplicationPrivate::processTabletEnterProximityEvent(QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) QTabletEvent ev(QEvent::TabletEnterProximity, QPointF(), QPointF(), e->device, e->pointerType, 0, 0, 0, 0, 0, 0, @@ -2383,7 +2383,7 @@ void QGuiApplicationPrivate::processTabletEnterProximityEvent(QWindowSystemInter void QGuiApplicationPrivate::processTabletLeaveProximityEvent(QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) QTabletEvent ev(QEvent::TabletLeaveProximity, QPointF(), QPointF(), e->device, e->pointerType, 0, 0, 0, 0, 0, 0, diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 8048a397e81..cf4a75dfce6 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2254,7 +2254,7 @@ bool QWindow::event(QEvent *ev) break; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletPress: case QEvent::TabletMove: case QEvent::TabletRelease: @@ -2436,7 +2436,7 @@ void QWindow::touchEvent(QTouchEvent *ev) ev->ignore(); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) /*! Override this to handle tablet press, move, and release events (\a ev). diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 748c3ee7073..db8e828e704 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -75,7 +75,7 @@ class QMouseEvent; class QWheelEvent; #endif class QTouchEvent; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class QTabletEvent; #endif @@ -348,7 +348,7 @@ protected: virtual void wheelEvent(QWheelEvent *); #endif virtual void touchEvent(QTouchEvent *); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) virtual void tabletEvent(QTabletEvent *); #endif virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result); diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 32630003d13..ef95b80dd44 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -38,6 +38,8 @@ ** ****************************************************************************/ +#include + #include "androidjniinput.h" #include "androidjnimain.h" #include "qandroidplatformintegration.h" @@ -292,17 +294,17 @@ namespace QtAndroidInput static bool isTabletEventSupported(JNIEnv */*env*/, jobject /*thiz*/) { -#ifdef QT_NO_TABLETEVENT - return false; -#else +#if QT_CONFIG(tabletevent) return true; -#endif // QT_NO_TABLETEVENT +#else + return false; +#endif // QT_CONFIG(tabletevent) } static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action, jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) QPointF globalPosF(x, y); QPoint globalPos((int)x, (int)y); QWindow *tlw = topLevelWindowAt(globalPos); @@ -344,7 +346,7 @@ namespace QtAndroidInput QWindowSystemInterface::handleTabletEvent(tlw, ulong(time), localPos, globalPosF, QTabletEvent::Stylus, pointerType, buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier); -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) } static int mapAndroidKey(int key) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 5eb58dc5a12..42cdc86fb75 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -59,6 +59,7 @@ #include "qwindowsscreen.h" #include "qwindowstheme.h" +#include #include #include #include @@ -1077,10 +1078,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, *result = LRESULT(MA_NOACTIVATE); return true; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->notifyActivate(); -#endif // !QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) if (platformWindow->testFlag(QWindowsWindow::BlockedByModal)) if (const QWindow *modalWindow = QGuiApplication::modalWindow()) { QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(modalWindow); diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 46306d438f9..7e1017426fe 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -39,8 +39,6 @@ #include "qwindowstabletsupport.h" -#ifndef QT_NO_TABLETEVENT - #include "qwindowscontext.h" #include "qwindowskeymapper.h" #include "qwindowswindow.h" @@ -498,5 +496,3 @@ bool QWindowsTabletSupport::translateTabletPacketEvent() } QT_END_NAMESPACE - -#endif // QT_NO_TABLETEVENT diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h index 97eceaf2ccc..7878e962e1e 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.h +++ b/src/plugins/platforms/windows/qwindowstabletsupport.h @@ -41,14 +41,15 @@ #define QWINDOWSTABLETSUPPORT_H #include "qtwindowsglobal.h" - -#if !defined(QT_NO_TABLETEVENT) +#include #include #include #include +QT_REQUIRE_CONFIG(tabletevent); + QT_BEGIN_NAMESPACE class QDebug; @@ -140,5 +141,4 @@ private: QT_END_NAMESPACE -#endif // !QT_NO_TABLETEVENT #endif // QWINDOWSTABLETSUPPORT_H diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index e29dd645cbf..514ad6775d7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1626,11 +1626,11 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex, // compress XI_Motion, but not from tablet devices if (isXIType(event, m_xiOpCode, XI_Motion)) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) xXIDeviceEvent *xdev = reinterpret_cast(event); if (const_cast(this)->tabletDataForDevice(xdev->sourceid)) return false; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) for (int j = nextIndex; j < eventqueue->size(); ++j) { xcb_generic_event_t *next = eventqueue->at(j); if (!isValid(next)) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 5b9a3887f51..40a54e0f1f5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -64,7 +64,7 @@ #undef explicit #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) #include #endif @@ -565,7 +565,7 @@ private: #ifdef XCB_USE_XINPUT22 void xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow); #endif // XCB_USE_XINPUT22 -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) struct TabletData { int deviceId = 0; QTabletEvent::PointerType pointerType = QTabletEvent::UnknownPointer; @@ -587,7 +587,7 @@ private: void xi2ReportTabletEvent(const void *event, TabletData *tabletData); QVector m_tabletData; TabletData *tabletDataForDevice(int id); -#endif // !QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) struct ScrollingDevice { int deviceId = 0; int verticalIndex = 0; @@ -695,7 +695,7 @@ private: friend class QXcbEventReader; }; #ifdef XCB_USE_XINPUT2 -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE); #endif diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 730473b983f..52873f0910d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -100,7 +100,7 @@ void QXcbConnection::initializeXInput2() void QXcbConnection::xi2SetupDevices() { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) m_tabletData.clear(); #endif m_scrollingDevices.clear(); @@ -116,7 +116,7 @@ void QXcbConnection::xi2SetupDevices() if (devices[i].use != XISlavePointer) continue; qCDebug(lcQpaXInputDevices) << "input device " << devices[i].name << "ID" << devices[i].deviceid; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) TabletData tabletData; #endif ScrollingDevice scrollingDevice; @@ -126,7 +126,7 @@ void QXcbConnection::xi2SetupDevices() XIValuatorClassInfo *vci = reinterpret_cast(devices[i].classes[c]); const int valuatorAtom = qatom(vci->label); qCDebug(lcQpaXInputDevices) << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (valuatorAtom < QXcbAtom::NAtoms) { TabletData::ValuatorClassInfo info; info.minVal = vci->min; @@ -134,7 +134,7 @@ void QXcbConnection::xi2SetupDevices() info.number = vci->number; tabletData.valuatorInfo[valuatorAtom] = info; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) scrollingDevice.lastScrollPosition.setX(vci->value); else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) @@ -191,7 +191,7 @@ void QXcbConnection::xi2SetupDevices() } } bool isTablet = false; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) // If we have found the valuators which we expect a tablet to have, it might be a tablet. if (tabletData.valuatorInfo.contains(QXcbAtom::AbsX) && tabletData.valuatorInfo.contains(QXcbAtom::AbsY) && @@ -241,7 +241,7 @@ void QXcbConnection::xi2SetupDevices() m_tabletData.append(tabletData); qCDebug(lcQpaXInputDevices) << " it's a tablet with pointer type" << dbgType; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 if (scrollingDevice.orientations || scrollingDevice.legacyOrientations) { @@ -330,7 +330,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) #endif // XCB_USE_XINPUT22 QSet tabletDevices; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast(&tabletBitMask); @@ -347,7 +347,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) } XISelectEvents(xDisplay, window, xiEventMask.data(), m_tabletData.count()); } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 // Enable each scroll device @@ -482,12 +482,12 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id) return dev; } -#if defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) +#if defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent) static inline qreal fixed1616ToReal(FP1616 val) { return qreal(val) / 0x10000; } -#endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) +#endif // defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent) void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) { @@ -536,13 +536,13 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) return; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!xiEnterEvent) { QXcbConnection::TabletData *tablet = tabletDataForDevice(sourceDeviceId); if (tablet && xi2HandleTabletEvent(xiEvent, tablet)) return; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 QHash::iterator device = m_scrollingDevices.find(sourceDeviceId); @@ -1240,6 +1240,6 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id) return Q_NULLPTR; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #endif // XCB_USE_XINPUT2 diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6ef9c1da511..fe7a9c25002 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2990,7 +2990,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: case QEvent::TabletPress: case QEvent::TabletRelease: @@ -3349,7 +3349,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; #endif // QT_NO_CONTEXTMENU -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: case QEvent::TabletPress: case QEvent::TabletRelease: @@ -3379,7 +3379,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) tablet->setAccepted(eventAccepted); } break; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #if !defined(QT_NO_TOOLTIP) || !defined(QT_NO_WHATSTHIS) case QEvent::ToolTip: diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index b710d13e670..deb638f410a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8806,7 +8806,7 @@ bool QWidget::event(QEvent *event) wheelEvent((QWheelEvent*)event); break; #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: if (static_cast(event)->buttons() == Qt::NoButton && !testAttribute(Qt::WA_TabletTracking)) break; @@ -9439,7 +9439,7 @@ void QWidget::wheelEvent(QWheelEvent *event) } #endif // QT_CONFIG(wheelevent) -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) /*! This event handler, for event \a event, can be reimplemented in a subclass to receive tablet events for the widget. @@ -9464,7 +9464,7 @@ void QWidget::tabletEvent(QTabletEvent *event) { event->ignore(); } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) /*! This event handler, for event \a event, can be reimplemented in a diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index ef456ef1dad..59e2ddd24df 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -629,7 +629,7 @@ protected: #ifndef QT_NO_CONTEXTMENU virtual void contextMenuEvent(QContextMenuEvent *event); #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) virtual void tabletEvent(QTabletEvent *event); #endif #ifndef QT_NO_ACTION diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index f9f67cb4498..abaebad821c 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -299,7 +299,7 @@ bool QWidgetWindow::event(QEvent *event) } return true; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletPress: case QEvent::TabletMove: case QEvent::TabletRelease: @@ -974,7 +974,7 @@ bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long return m_widget->nativeEvent(eventType, message, result); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) void QWidgetWindow::handleTabletEvent(QTabletEvent *event) { static QPointer qt_tablet_target = 0; @@ -1004,7 +1004,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton) qt_tablet_target = 0; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifndef QT_NO_GESTURES void QWidgetWindow::handleGestureEvent(QNativeGestureEvent *e) diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h index 944f845e3c8..50a2cfd57cb 100644 --- a/src/widgets/kernel/qwidgetwindow_p.h +++ b/src/widgets/kernel/qwidgetwindow_p.h @@ -100,7 +100,7 @@ protected: void handleExposeEvent(QExposeEvent *); void handleWindowStateChangedEvent(QWindowStateChangeEvent *event); bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) void handleTabletEvent(QTabletEvent *); #endif #ifndef QT_NO_GESTURES diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp index a0ae614a03a..26d0a9615f2 100644 --- a/src/widgets/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -183,12 +183,12 @@ static QEvent *cloneEvent(QEvent *e) return new QEvent(*e); case QEvent::Style: return new QEvent(*e); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletMove: case QEvent::TabletPress: case QEvent::TabletRelease: return new QTabletEvent(*static_cast(e)); -#endif //QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) case QEvent::OkRequest: return new QEvent(*e); case QEvent::HelpRequest: @@ -372,11 +372,11 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::DynamicPropertyChange: return new QDynamicPropertyChangeEvent(*static_cast(e)); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) case QEvent::TabletEnterProximity: case QEvent::TabletLeaveProximity: return new QTabletEvent(*static_cast(e)); -#endif //QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) case QEvent::NonClientAreaMouseMove: case QEvent::NonClientAreaMouseButtonPress: diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 4cccf080867..92f71822492 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -1644,7 +1644,7 @@ void tst_QWindow::inputReentrancy() QCOMPARE(window.touchReleasedCount, 1); } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) class TabletTestWindow : public QWindow { public: @@ -1672,7 +1672,7 @@ public: void tst_QWindow::tabletEvents() { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) TabletTestWindow window; window.setGeometry(QRect(m_availableTopLeft + QPoint(10, 10), m_testWindowSize)); qGuiApp->installEventFilter(&window); From a6073d4b30f7f948460fc1b1c1b498296e4bd115 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 12 Jun 2017 21:29:48 +0200 Subject: [PATCH 37/82] Convert features.tablewidget to QT_[REQUIRE_]CONFIG Also fix dependency of cupsjobwidget feature Change-Id: I2184bf3df814a6bb0f38755bb597ed1797dec587 Reviewed-by: Oswald Buddenhagen --- src/printsupport/configure.json | 3 ++- src/widgets/itemviews/itemviews.pri | 11 ++++++++--- src/widgets/itemviews/qtablewidget.cpp | 3 --- src/widgets/itemviews/qtablewidget.h | 8 ++------ src/widgets/itemviews/qtablewidget_p.h | 4 +--- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 8d2a6334818..ad38281145e 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -40,7 +40,8 @@ "features.combobox", "features.cups", "features.datetimeedit", - "features.groupbox" + "features.groupbox", + "features.tablewidget" ], "output": [ "privateFeature", "feature" ] }, diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri index ed0e3fe0722..799458e4adb 100644 --- a/src/widgets/itemviews/itemviews.pri +++ b/src/widgets/itemviews/itemviews.pri @@ -19,8 +19,6 @@ HEADERS += \ itemviews/qdirmodel.h \ itemviews/qlistwidget.h \ itemviews/qlistwidget_p.h \ - itemviews/qtablewidget.h \ - itemviews/qtablewidget_p.h \ itemviews/qtreewidget.h \ itemviews/qtreewidget_p.h \ itemviews/qwidgetitemdata_p.h \ @@ -41,7 +39,6 @@ SOURCES += \ itemviews/qitemdelegate.cpp \ itemviews/qdirmodel.cpp \ itemviews/qlistwidget.cpp \ - itemviews/qtablewidget.cpp \ itemviews/qtreewidget.cpp \ itemviews/qitemeditorfactory.cpp \ itemviews/qtreewidgetitemiterator.cpp \ @@ -60,6 +57,14 @@ qtConfig(columnview) { itemviews/qcolumnviewgrip.cpp } +qtConfig(tablewidget) { + HEADERS += \ + itemviews/qtablewidget.h \ + itemviews/qtablewidget_p.h + + SOURCES += itemviews/qtablewidget.cpp +} + HEADERS += \ itemviews/qfileiconprovider.h \ itemviews/qfileiconprovider_p.h \ diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 663cd4adc6a..3ff75cc23b2 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -39,7 +39,6 @@ #include "qtablewidget.h" -#ifndef QT_NO_TABLEWIDGET #include #include #include @@ -2715,5 +2714,3 @@ QT_END_NAMESPACE #include "moc_qtablewidget.cpp" #include "moc_qtablewidget_p.cpp" - -#endif // QT_NO_TABLEWIDGET diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index b91bcf7ce48..d3bcba57dd5 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -44,13 +44,11 @@ #include #include #include -//#include + +QT_REQUIRE_CONFIG(tablewidget); QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TABLEWIDGET - class Q_WIDGETS_EXPORT QTableWidgetSelectionRange { public: @@ -369,8 +367,6 @@ inline void QTableWidgetItem::setSelected(bool aselect) inline bool QTableWidgetItem::isSelected() const { return (view ? view->isItemSelected(this) : false); } -#endif // QT_NO_TABLEWIDGET - QT_END_NAMESPACE #endif // QTABLEWIDGET_H diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h index 2db7337cd6e..6412477be0e 100644 --- a/src/widgets/itemviews/qtablewidget_p.h +++ b/src/widgets/itemviews/qtablewidget_p.h @@ -58,7 +58,7 @@ #include #include -#ifndef QT_NO_TABLEWIDGET +QT_REQUIRE_CONFIG(tablewidget); QT_BEGIN_NAMESPACE @@ -218,6 +218,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_TABLEWIDGET - #endif // QTABLEWIDGET_P_H From ebe1c953c0b73867733f7890ea36e949940002e8 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 13 Jun 2017 21:03:57 +0200 Subject: [PATCH 38/82] Convert features.listwidget to QT_[REQUIRE_]CONFIG Also fix too specific #includes on the way Change-Id: Id626928513e89dd4a8854640994661f0d329470b Reviewed-by: Oswald Buddenhagen --- src/widgets/dialogs/qinputdialog.cpp | 2 +- src/widgets/dialogs/qsidebar_p.h | 2 +- src/widgets/itemviews/itemviews.pri | 11 ++++++++--- src/widgets/itemviews/qlistwidget.cpp | 3 --- src/widgets/itemviews/qlistwidget.h | 7 ++----- src/widgets/itemviews/qlistwidget_p.h | 4 +--- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp index 4ca3923d8dc..47551ae6fd8 100644 --- a/src/widgets/dialogs/qinputdialog.cpp +++ b/src/widgets/dialogs/qinputdialog.cpp @@ -48,7 +48,7 @@ #include "qlayout.h" #include "qlineedit.h" #include "qplaintextedit.h" -#include "qlistwidget.h" +#include "qlistview.h" #include "qpushbutton.h" #include "qspinbox.h" #include "qstackedlayout.h" diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h index 0685e81b2b6..ee57f2fb48f 100644 --- a/src/widgets/dialogs/qsidebar_p.h +++ b/src/widgets/dialogs/qsidebar_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include #include #include diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri index 799458e4adb..a1401aff98f 100644 --- a/src/widgets/itemviews/itemviews.pri +++ b/src/widgets/itemviews/itemviews.pri @@ -17,8 +17,6 @@ HEADERS += \ itemviews/qabstractitemdelegate_p.h \ itemviews/qitemdelegate.h \ itemviews/qdirmodel.h \ - itemviews/qlistwidget.h \ - itemviews/qlistwidget_p.h \ itemviews/qtreewidget.h \ itemviews/qtreewidget_p.h \ itemviews/qwidgetitemdata_p.h \ @@ -38,7 +36,6 @@ SOURCES += \ itemviews/qabstractitemdelegate.cpp \ itemviews/qitemdelegate.cpp \ itemviews/qdirmodel.cpp \ - itemviews/qlistwidget.cpp \ itemviews/qtreewidget.cpp \ itemviews/qitemeditorfactory.cpp \ itemviews/qtreewidgetitemiterator.cpp \ @@ -57,6 +54,14 @@ qtConfig(columnview) { itemviews/qcolumnviewgrip.cpp } +qtConfig(listwidget) { + HEADERS += \ + itemviews/qlistwidget.h \ + itemviews/qlistwidget_p.h + + SOURCES += itemviews/qlistwidget.cpp +} + qtConfig(tablewidget) { HEADERS += \ itemviews/qtablewidget.h \ diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 0a1f85facb4..21747d4e6e0 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -39,7 +39,6 @@ #include "qlistwidget.h" -#ifndef QT_NO_LISTWIDGET #include #include #include @@ -1969,5 +1968,3 @@ QT_END_NAMESPACE #include "moc_qlistwidget.cpp" #include "moc_qlistwidget_p.cpp" - -#endif // QT_NO_LISTWIDGET diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index 85ca639e503..4e674867087 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -46,11 +46,10 @@ #include #include +QT_REQUIRE_CONFIG(listwidget); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LISTWIDGET - class QListWidget; class QListModel; class QWidgetItemData; @@ -329,8 +328,6 @@ inline void QListWidgetItem::setHidden(bool ahide) inline bool QListWidgetItem::isHidden() const { return (view ? view->isItemHidden(this) : false); } -#endif // QT_NO_LISTWIDGET - QT_END_NAMESPACE #endif // QLISTWIDGET_H diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h index 0594fd511e8..e8f5540f9cc 100644 --- a/src/widgets/itemviews/qlistwidget_p.h +++ b/src/widgets/itemviews/qlistwidget_p.h @@ -58,7 +58,7 @@ #include #include -#ifndef QT_NO_LISTWIDGET +QT_REQUIRE_CONFIG(listwidget); QT_BEGIN_NAMESPACE @@ -171,6 +171,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_LISTWIDGET - #endif // QLISTWIDGET_P_H From 1d8a3d600d006b04251ec338b548440f0cdde46d Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 13 Jun 2017 21:06:50 +0200 Subject: [PATCH 39/82] Convert features.treewidget to QT_[REQUIRE_]CONFIG Also fix too specific #include on the way Change-Id: Ieff5f40584ecc5f680f09a8a4b95d5604ff1e940 Reviewed-by: Oswald Buddenhagen --- src/widgets/accessible/itemviews.cpp | 2 +- src/widgets/itemviews/itemviews.pri | 16 +++++++++++----- src/widgets/itemviews/qtreewidget.cpp | 3 --- src/widgets/itemviews/qtreewidget.h | 7 ++----- src/widgets/itemviews/qtreewidget_p.h | 4 +--- .../itemviews/qtreewidgetitemiterator.cpp | 4 ---- src/widgets/itemviews/qtreewidgetitemiterator.h | 7 ++----- 7 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index eec9a0021cc..3cef5647818 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #ifndef QT_NO_ACCESSIBILITY diff --git a/src/widgets/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri index a1401aff98f..af0a6f68981 100644 --- a/src/widgets/itemviews/itemviews.pri +++ b/src/widgets/itemviews/itemviews.pri @@ -17,12 +17,9 @@ HEADERS += \ itemviews/qabstractitemdelegate_p.h \ itemviews/qitemdelegate.h \ itemviews/qdirmodel.h \ - itemviews/qtreewidget.h \ - itemviews/qtreewidget_p.h \ itemviews/qwidgetitemdata_p.h \ itemviews/qitemeditorfactory.h \ itemviews/qitemeditorfactory_p.h \ - itemviews/qtreewidgetitemiterator.h \ itemviews/qdatawidgetmapper.h \ itemviews/qstyleditemdelegate.h @@ -36,9 +33,7 @@ SOURCES += \ itemviews/qabstractitemdelegate.cpp \ itemviews/qitemdelegate.cpp \ itemviews/qdirmodel.cpp \ - itemviews/qtreewidget.cpp \ itemviews/qitemeditorfactory.cpp \ - itemviews/qtreewidgetitemiterator.cpp \ itemviews/qdatawidgetmapper.cpp \ itemviews/qstyleditemdelegate.cpp } @@ -70,6 +65,17 @@ qtConfig(tablewidget) { SOURCES += itemviews/qtablewidget.cpp } +qtConfig(treewidget) { + HEADERS += \ + itemviews/qtreewidget.h \ + itemviews/qtreewidget_p.h \ + itemviews/qtreewidgetitemiterator.h + + SOURCES += \ + itemviews/qtreewidget.cpp \ + itemviews/qtreewidgetitemiterator.cpp +} + HEADERS += \ itemviews/qfileiconprovider.h \ itemviews/qfileiconprovider_p.h \ diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 8ce36ab47e1..337089056d2 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -39,7 +39,6 @@ #include "qtreewidget.h" -#ifndef QT_NO_TREEWIDGET #include #include #include @@ -3461,5 +3460,3 @@ QT_END_NAMESPACE #include "moc_qtreewidget.cpp" #include "moc_qtreewidget_p.cpp" - -#endif // QT_NO_TREEWIDGET diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index fc0bccf2fe1..27b7fa4fb1f 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -46,11 +46,10 @@ #include #include +QT_REQUIRE_CONFIG(treewidget); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TREEWIDGET - class QTreeWidget; class QTreeModel; class QWidgetItemData; @@ -422,8 +421,6 @@ inline void QTreeWidgetItem::setDisabled(bool disabled) inline bool QTreeWidgetItem::isDisabled() const { return !(flags() & Qt::ItemIsEnabled); } -#endif // QT_NO_TREEWIDGET - QT_END_NAMESPACE #endif // QTREEWIDGET_H diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h index 7789693db43..7aa4daefc04 100644 --- a/src/widgets/itemviews/qtreewidget_p.h +++ b/src/widgets/itemviews/qtreewidget_p.h @@ -59,7 +59,7 @@ #include #include -#ifndef QT_NO_TREEWIDGET +QT_REQUIRE_CONFIG(treewidget); QT_BEGIN_NAMESPACE @@ -242,6 +242,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_TREEWIDGET - #endif // QTREEWIDGET_P_H diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp index 4f27af70a85..1c1f60bc37a 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp +++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp @@ -42,8 +42,6 @@ #include "qtreewidget_p.h" #include "qwidgetitemdata_p.h" -#ifndef QT_NO_TREEWIDGET - QT_BEGIN_NAMESPACE /*! @@ -453,5 +451,3 @@ void QTreeWidgetItemIteratorPrivate::ensureValidIterator(const QTreeWidgetItem * */ QT_END_NAMESPACE - -#endif // QT_NO_TREEWIDGET diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h index db17a96abdb..39e02447764 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator.h +++ b/src/widgets/itemviews/qtreewidgetitemiterator.h @@ -43,11 +43,10 @@ #include #include +QT_REQUIRE_CONFIG(treewidget); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TREEWIDGET - class QTreeWidget; class QTreeWidgetItem; class QTreeModel; @@ -146,7 +145,5 @@ inline QTreeWidgetItem *QTreeWidgetItemIterator::operator*() const Q_DECLARE_OPERATORS_FOR_FLAGS(QTreeWidgetItemIterator::IteratorFlags) - QT_END_NAMESPACE -#endif // QT_NO_TREEWIDGET #endif // QTREEWIDGETITEMITERATOR_H From 769769a2ec9ac5ab48df1108f34410df8bfad814 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 13 Jun 2017 21:09:48 +0200 Subject: [PATCH 40/82] Convert features.undoview to QT_[REQUIRE_]CONFIG Change-Id: Ic2945b9317f074301acd88602e3dae45e28b7c87 Reviewed-by: Oswald Buddenhagen --- src/widgets/util/qundoview.cpp | 4 ---- src/widgets/util/qundoview.h | 3 +-- src/widgets/util/util.pri | 11 +++++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index 93c1778ea2f..94610520b5b 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -40,8 +40,6 @@ #include "qundostack.h" #include "qundoview.h" -#ifndef QT_NO_UNDOVIEW - #include "qundogroup.h" #include #include @@ -473,5 +471,3 @@ QT_END_NAMESPACE #include "qundoview.moc" #include "moc_qundoview.cpp" - -#endif // QT_NO_UNDOVIEW diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h index 3ed9ea5989d..35cffb0a283 100644 --- a/src/widgets/util/qundoview.h +++ b/src/widgets/util/qundoview.h @@ -44,7 +44,7 @@ #include #include -#ifndef QT_NO_UNDOVIEW +QT_REQUIRE_CONFIG(undoview); QT_BEGIN_NAMESPACE @@ -92,5 +92,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_UNDOVIEW #endif // QUNDOVIEW_H diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index b9b62d9bb01..60d4cd08723 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -8,16 +8,14 @@ HEADERS += \ util/qsystemtrayicon_p.h \ util/qundogroup.h \ util/qundostack.h \ - util/qundostack_p.h \ - util/qundoview.h + util/qundostack_p.h SOURCES += \ util/qsystemtrayicon.cpp \ util/qcolormap.cpp \ util/qcompleter.cpp \ util/qundogroup.cpp \ - util/qundostack.cpp \ - util/qundoview.cpp + util/qundostack.cpp qtConfig(scroller) { HEADERS += \ @@ -33,6 +31,11 @@ qtConfig(scroller) { util/qflickgesture.cpp \ } +qtConfig(undoview) { + HEADERS += util/qundoview.h + SOURCES += util/qundoview.cpp +} + win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp } else: qtConfig(xcb) { From 61b47df3915abeec44b830fda211cb1105070500 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 13 Jun 2017 21:11:17 +0200 Subject: [PATCH 41/82] Convert features.undogroup to QT_[REQUIRE_]CONFIG Change-Id: I2fe0a3335e140875c425b28dc6e2d3081f534965 Reviewed-by: Oswald Buddenhagen --- src/widgets/util/qundogroup.cpp | 4 ---- src/widgets/util/qundogroup.h | 7 ++----- src/widgets/util/qundostack.cpp | 10 ++++++---- src/widgets/util/qundoview.cpp | 16 +++++++++------- src/widgets/util/qundoview.h | 6 +++--- src/widgets/util/util.pri | 7 +++++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp index ec4fc2788ac..f9605c7a2f9 100644 --- a/src/widgets/util/qundogroup.cpp +++ b/src/widgets/util/qundogroup.cpp @@ -41,8 +41,6 @@ #include "qundostack.h" #include "qundostack_p.h" -#ifndef QT_NO_UNDOGROUP - QT_BEGIN_NAMESPACE class QUndoGroupPrivate : public QObjectPrivate @@ -502,5 +500,3 @@ QAction *QUndoGroup::createRedoAction(QObject *parent, const QString &prefix) co QT_END_NAMESPACE #include "moc_qundogroup.cpp" - -#endif // QT_NO_UNDOGROUP diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h index 4e2fdeed26a..dba79ea706c 100644 --- a/src/widgets/util/qundogroup.h +++ b/src/widgets/util/qundogroup.h @@ -44,15 +44,14 @@ #include #include +QT_REQUIRE_CONFIG(undogroup); + QT_BEGIN_NAMESPACE class QUndoGroupPrivate; class QUndoStack; class QAction; - -#ifndef QT_NO_UNDOGROUP - class Q_WIDGETS_EXPORT QUndoGroup : public QObject { Q_OBJECT @@ -97,8 +96,6 @@ private: Q_DISABLE_COPY(QUndoGroup) }; -#endif // QT_NO_UNDOGROUP - QT_END_NAMESPACE #endif // QUNDOGROUP_H diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index dc0b6855ac1..849b3c78f28 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -39,7 +39,9 @@ #include #include "qundostack.h" +#if QT_CONFIG(undogroup) #include "qundogroup.h" +#endif #include "qundostack_p.h" #ifndef QT_NO_UNDOCOMMAND @@ -544,7 +546,7 @@ bool QUndoStackPrivate::checkUndoLimit() QUndoStack::QUndoStack(QObject *parent) : QObject(*(new QUndoStackPrivate), parent) { -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) if (QUndoGroup *group = qobject_cast(parent)) group->addStack(this); #endif @@ -559,7 +561,7 @@ QUndoStack::QUndoStack(QObject *parent) QUndoStack::~QUndoStack() { -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) Q_D(QUndoStack); if (d->group != 0) d->group->removeStack(this); @@ -1247,7 +1249,7 @@ int QUndoStack::undoLimit() const void QUndoStack::setActive(bool active) { -#ifdef QT_NO_UNDOGROUP +#if !QT_CONFIG(undogroup) Q_UNUSED(active); #else Q_D(QUndoStack); @@ -1263,7 +1265,7 @@ void QUndoStack::setActive(bool active) bool QUndoStack::isActive() const { -#ifdef QT_NO_UNDOGROUP +#if !QT_CONFIG(undogroup) return true; #else Q_D(const QUndoStack); diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index 94610520b5b..b56aa42aed8 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -40,7 +40,9 @@ #include "qundostack.h" #include "qundoview.h" +#if QT_CONFIG(undogroup) #include "qundogroup.h" +#endif #include #include #include @@ -271,12 +273,12 @@ class QUndoViewPrivate : public QListViewPrivate Q_DECLARE_PUBLIC(QUndoView) public: QUndoViewPrivate() : -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) group(0), #endif model(0) {} -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) QPointer group; #endif QUndoModel *model; @@ -316,7 +318,7 @@ QUndoView::QUndoView(QUndoStack *stack, QWidget *parent) setStack(stack); } -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) /*! Constructs a new view with parent \a parent and sets the observed group to \a group. @@ -332,7 +334,7 @@ QUndoView::QUndoView(QUndoGroup *group, QWidget *parent) setGroup(group); } -#endif // QT_NO_UNDOGROUP +#endif // QT_CONFIG(undogroup) /*! Destroys this view. @@ -367,13 +369,13 @@ QUndoStack *QUndoView::stack() const void QUndoView::setStack(QUndoStack *stack) { Q_D(QUndoView); -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) setGroup(0); #endif d->model->setStack(stack); } -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) /*! Sets the group displayed by this view to \a group. If \a group is 0, the view will @@ -421,7 +423,7 @@ QUndoGroup *QUndoView::group() const return d->group; } -#endif // QT_NO_UNDOGROUP +#endif // QT_CONFIG(undogroup) /*! \property QUndoView::emptyLabel diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h index 35cffb0a283..0bfcdd0c180 100644 --- a/src/widgets/util/qundoview.h +++ b/src/widgets/util/qundoview.h @@ -64,13 +64,13 @@ class Q_WIDGETS_EXPORT QUndoView : public QListView public: explicit QUndoView(QWidget *parent = Q_NULLPTR); explicit QUndoView(QUndoStack *stack, QWidget *parent = Q_NULLPTR); -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) explicit QUndoView(QUndoGroup *group, QWidget *parent = Q_NULLPTR); #endif ~QUndoView(); QUndoStack *stack() const; -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) QUndoGroup *group() const; #endif @@ -82,7 +82,7 @@ public: public Q_SLOTS: void setStack(QUndoStack *stack); -#ifndef QT_NO_UNDOGROUP +#if QT_CONFIG(undogroup) void setGroup(QUndoGroup *group); #endif diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 60d4cd08723..99a1a62887c 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -6,7 +6,6 @@ HEADERS += \ util/qcompleter.h \ util/qcompleter_p.h \ util/qsystemtrayicon_p.h \ - util/qundogroup.h \ util/qundostack.h \ util/qundostack_p.h @@ -14,7 +13,6 @@ SOURCES += \ util/qsystemtrayicon.cpp \ util/qcolormap.cpp \ util/qcompleter.cpp \ - util/qundogroup.cpp \ util/qundostack.cpp qtConfig(scroller) { @@ -31,6 +29,11 @@ qtConfig(scroller) { util/qflickgesture.cpp \ } +qtConfig(undogroup) { + HEADERS += util/qundogroup.h + SOURCES += util/qundogroup.cpp +} + qtConfig(undoview) { HEADERS += util/qundoview.h SOURCES += util/qundoview.cpp From a4d190554ae3d35b53cd7e7823a23f548bd24cfe Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 25 Jun 2017 09:31:35 +0200 Subject: [PATCH 42/82] Convert features.undostack to QT_CONFIG Change-Id: I7fc3aa44625fc97b802def4954f88c091c53f876 Reviewed-by: Oswald Buddenhagen --- src/widgets/util/qundostack.cpp | 4 ++-- src/widgets/util/qundostack.h | 4 ++-- src/widgets/util/qundostack_p.h | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index 849b3c78f28..fd0035962e9 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -344,7 +344,7 @@ const QUndoCommand *QUndoCommand::child(int index) const #endif // QT_NO_UNDOCOMMAND -#ifndef QT_NO_UNDOSTACK +#if QT_CONFIG(undostack) /*! \class QUndoStack @@ -1334,4 +1334,4 @@ QT_END_NAMESPACE #include "moc_qundostack.cpp" #include "moc_qundostack_p.cpp" -#endif // QT_NO_UNDOSTACK +#endif // QT_CONFIG(undostack) diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h index 2a8f4decb6b..e402e16eae8 100644 --- a/src/widgets/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -85,7 +85,7 @@ private: #endif // QT_NO_UNDOCOMMAND -#ifndef QT_NO_UNDOSTACK +#if QT_CONFIG(undostack) class Q_WIDGETS_EXPORT QUndoStack : public QObject { @@ -150,7 +150,7 @@ private: friend class QUndoGroup; }; -#endif // QT_NO_UNDOSTACK +#endif // QT_CONFIG(undostack) QT_END_NAMESPACE diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h index e92a1fe620b..04bc3811148 100644 --- a/src/widgets/util/qundostack_p.h +++ b/src/widgets/util/qundostack_p.h @@ -74,7 +74,7 @@ public: bool obsolete; }; -#ifndef QT_NO_UNDOSTACK +#if QT_CONFIG(undostack) class QUndoStackPrivate : public QObjectPrivate { @@ -108,7 +108,6 @@ private: }; #endif // QT_NO_ACTION - QT_END_NAMESPACE -#endif // QT_NO_UNDOSTACK +#endif // QT_CONFIG(undostack) #endif // QUNDOSTACK_P_H From fa0ff2988eb6387bbc89160c85df8a5e1d6acccc Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 25 Jun 2017 09:40:36 +0200 Subject: [PATCH 43/82] Convert features.undocommand to QT_[REQUIRE_]CONFIG Change-Id: I1016f7e6bb1297e9c2f73e26e0d3641c873c4d4d Reviewed-by: Oswald Buddenhagen --- src/widgets/util/qundostack.cpp | 4 ---- src/widgets/util/qundostack.h | 7 ++----- src/widgets/util/util.pri | 15 ++++++++++----- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index fd0035962e9..b371e903a6a 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -44,8 +44,6 @@ #endif #include "qundostack_p.h" -#ifndef QT_NO_UNDOCOMMAND - QT_BEGIN_NAMESPACE /*! @@ -342,8 +340,6 @@ const QUndoCommand *QUndoCommand::child(int index) const return d->child_list.at(index); } -#endif // QT_NO_UNDOCOMMAND - #if QT_CONFIG(undostack) /*! diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h index e402e16eae8..7ab90b507a6 100644 --- a/src/widgets/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -44,15 +44,14 @@ #include #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(undocommand); +QT_BEGIN_NAMESPACE class QAction; class QUndoCommandPrivate; class QUndoStackPrivate; -#ifndef QT_NO_UNDOCOMMAND - class Q_WIDGETS_EXPORT QUndoCommand { QUndoCommandPrivate *d; @@ -83,8 +82,6 @@ private: friend class QUndoStack; }; -#endif // QT_NO_UNDOCOMMAND - #if QT_CONFIG(undostack) class Q_WIDGETS_EXPORT QUndoStack : public QObject diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 99a1a62887c..8b28ac8bf02 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -5,15 +5,12 @@ HEADERS += \ util/qcolormap.h \ util/qcompleter.h \ util/qcompleter_p.h \ - util/qsystemtrayicon_p.h \ - util/qundostack.h \ - util/qundostack_p.h + util/qsystemtrayicon_p.h SOURCES += \ util/qsystemtrayicon.cpp \ util/qcolormap.cpp \ - util/qcompleter.cpp \ - util/qundostack.cpp + util/qcompleter.cpp qtConfig(scroller) { HEADERS += \ @@ -29,6 +26,14 @@ qtConfig(scroller) { util/qflickgesture.cpp \ } +qtConfig(undocommand) { + HEADERS += \ + util/qundostack.h \ + util/qundostack_p.h + + SOURCES += util/qundostack.cpp +} + qtConfig(undogroup) { HEADERS += util/qundogroup.h SOURCES += util/qundogroup.cpp From b1afa3bed42224362a71008a5acc4d4c5654ea1a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 28 Jun 2017 09:38:24 +0200 Subject: [PATCH 44/82] Stabilize QDnsLookup test Use 15s instead of 10 (one check took 7.5s on my development machine, even). Port to QTR_VERIFY_WITH_TIMEOUT instead of rolling our own waitForDone(), as that reports (within limits) by how much the timeout was exceeded. Change-Id: Id76a66d5f4fe3a4e814915add329eb4de3d264a7 Reviewed-by: Friedemann Kleint --- .../kernel/qdnslookup/tst_qdnslookup.cpp | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index 715fc586cd5..d72e92b8592 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -32,16 +32,7 @@ #include #include -static bool waitForDone(QDnsLookup *lookup) -{ - if (lookup->isFinished()) - return true; - - QObject::connect(lookup, SIGNAL(finished()), - &QTestEventLoop::instance(), SLOT(exitLoop())); - QTestEventLoop::instance().enterLoop(10); - return !QTestEventLoop::instance().timeout(); -} +static const int Timeout = 15000; // 15s class tst_QDnsLookup: public QObject { @@ -231,8 +222,7 @@ void tst_QDnsLookup::lookup() lookup.setType(static_cast(type)); lookup.setName(domain); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); #if defined(Q_OS_ANDROID) if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) @@ -331,8 +321,7 @@ void tst_QDnsLookup::lookupReuse() lookup.setType(QDnsLookup::A); lookup.setName(domainName("a-single")); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); #if defined(Q_OS_ANDROID) if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) @@ -348,8 +337,7 @@ void tst_QDnsLookup::lookupReuse() lookup.setType(QDnsLookup::AAAA); lookup.setName(domainName("aaaa-single")); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); @@ -366,8 +354,7 @@ void tst_QDnsLookup::lookupAbortRetry() lookup.setName(domainName("a-single")); lookup.lookup(); lookup.abort(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); QCOMPARE(int(lookup.error()), int(QDnsLookup::OperationCancelledError)); QVERIFY(lookup.hostAddressRecords().isEmpty()); @@ -375,8 +362,7 @@ void tst_QDnsLookup::lookupAbortRetry() lookup.setType(QDnsLookup::AAAA); lookup.setName(domainName("aaaa-single")); lookup.lookup(); - QVERIFY(waitForDone(&lookup)); - QVERIFY(lookup.isFinished()); + QTRY_VERIFY_WITH_TIMEOUT(lookup.isFinished(), Timeout); #if defined(Q_OS_ANDROID) if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) From c1a6765fd90376da3b4ccc4cb96673afebaff0e3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 22 Jun 2017 20:52:33 +0200 Subject: [PATCH 45/82] QOperatingSystemVersion: remove unneded copy ctor declaration The copy constructor is not disabled by any user-defined move or copy special member function, and thus does not need to be = default'ed. Change-Id: I90586d25756885ac77f0946c147079efb5d1b1e0 Reviewed-by: Jake Petroules Reviewed-by: Thiago Macieira --- src/corelib/global/qoperatingsystemversion.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 295365aad14..9345982658f 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -81,7 +81,6 @@ public: static const QOperatingSystemVersion AndroidNougat; static const QOperatingSystemVersion AndroidNougat_MR1; - QOperatingSystemVersion(const QOperatingSystemVersion &other) = default; Q_DECL_CONSTEXPR QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1) : m_os(osType), From c2a147c3cb71a6740be9528d416a0dba6a4c9ec8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 23 Jun 2017 11:52:02 +0200 Subject: [PATCH 46/82] Fix GCC 8 warnings about ignored const on cast result types qdrawhelper.cpp:1365:25: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers] for (; i < count && (const uintptr_t)buffer & 0xF; ++i) { ^~~~~~~~~~~~~~~~~~~~~~~ etc... Change-Id: I702f9aada24ad49ebc7ede0a04e5afc1b0164e30 Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper.cpp | 2 +- .../platforminputcontexts/ibus/qibusplatforminputcontext.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 9d5710a5e96..82aceb93c73 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1359,7 +1359,7 @@ static inline void qConvertARGB64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *b const __m128i cmask = _mm_set1_epi32(0x000003ff); int i = 0; __m128i vr, vg, vb, va; - for (; i < count && (const uintptr_t)buffer & 0xF; ++i) { + for (; i < count && uintptr_t(buffer) & 0xF; ++i) { *dest++ = qConvertRgb64ToRgb30(*buffer++); } diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 1ee81fa9c98..eb9e9c8b8d9 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -395,8 +395,8 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal Qt::KeyboardModifiers modifiers = watcher->modifiers(); QVariantList args = watcher->arguments(); - const ulong time = static_cast(args.at(0).toUInt()); - const QEvent::Type type = static_cast(args.at(1).toUInt()); + const ulong time = static_cast(args.at(0).toUInt()); + const QEvent::Type type = static_cast(args.at(1).toUInt()); const int qtcode = args.at(2).toInt(); const quint32 code = args.at(3).toUInt(); const quint32 sym = args.at(4).toUInt(); From e9b44518a6b372b694d8da28f8c21971bff05d3f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 22 Jun 2017 21:11:37 +0200 Subject: [PATCH 47/82] QOperatingSystemVersion/Android: compress global data The values do not need to be 2 x 32-bits. Eight bits suffice for a long time to come. Should save 189 bytes in text size on Android builds. Change-Id: I78e31e7caa7a698f41c66d7bbac58a766c6e8834 Reviewed-by: Jake Petroules Reviewed-by: Thiago Macieira --- src/corelib/global/qoperatingsystemversion.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 244f2943123..0813b3b25fe 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -175,7 +175,10 @@ QOperatingSystemVersion QOperatingSystemVersion::current() version.m_major = -1; version.m_minor = -1; - static const int versions[][2] = { + static const struct { + uint major : 4; + uint minor : 4; + } versions[] = { { 1, 0 }, // API level 1 { 1, 1 }, // API level 2 { 1, 5 }, // API level 3 @@ -207,8 +210,8 @@ QOperatingSystemVersion QOperatingSystemVersion::current() const size_t versionIdx = size_t(QJNIObjectPrivate::getStaticField( "android/os/Build$VERSION", "SDK_INT")) - 1; if (versionIdx < sizeof(versions) / sizeof(versions[0])) { - version.m_major = versions[versionIdx][0]; - version.m_minor = versions[versionIdx][1]; + version.m_major = versions[versionIdx].major; + version.m_minor = versions[versionIdx].minor; } // API level 6 was exactly version 2.0.1 From d0ff272af3a44007fa12e7ffbe074ce7a6732cc0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 22 Jun 2017 21:28:30 +0200 Subject: [PATCH 48/82] QOperatingSystemVersion: mark as Q_RELOCATABLE_TYPE and Q_PRIMITIVE_TYPE-come-Qt-6. Change-Id: I97bb9add8ed0870fb70c231d6fed6abce8729434 Reviewed-by: Jake Petroules Reviewed-by: Thiago Macieira --- src/corelib/global/qoperatingsystemversion.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 9345982658f..697aeec9334 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -123,6 +123,7 @@ private: static int compare(const QOperatingSystemVersion &v1, const QOperatingSystemVersion &v2); }; +Q_DECLARE_TYPEINFO(QOperatingSystemVersion, QT_VERSION < QT_VERSION_CHECK(6, 0, 0) ? Q_RELOCATABLE_TYPE : Q_PRIMITIVE_TYPE); QT_END_NAMESPACE From b7227d7c40c856674cb7608f2eed6e61ca327442 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 22 Jun 2017 21:35:44 +0200 Subject: [PATCH 49/82] QOperatingSystemVersion: (potentially) fix compilation with QNX 6 According to qcompilerdetection.h, the Dinkumware C++ library does not have std::initializer_list, even though the compiler supports it. Add the missing Q_COMPILER_ guards. Change-Id: I84a7d5054c00dba38bcde15e277ceb0ee05e6cd7 Reviewed-by: Jake Petroules Reviewed-by: James McDonnell Reviewed-by: Thiago Macieira --- src/corelib/global/qoperatingsystemversion.cpp | 2 ++ src/corelib/global/qoperatingsystemversion.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 0813b3b25fe..83ba6e69eef 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -336,6 +336,7 @@ QString QOperatingSystemVersion::name() const } } +#ifdef Q_COMPILER_INITIALIZER_LISTS /*! \fn bool QOperatingSystemVersion::isAnyOfType(std::initializer_list types) const @@ -350,6 +351,7 @@ bool QOperatingSystemVersion::isAnyOfType(std::initializer_list types) c } return false; } +#endif /*! \variable QOperatingSystemVersion::Windows7 diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 697aeec9334..2e319e66d51 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -98,7 +98,9 @@ public: Q_DECL_CONSTEXPR int segmentCount() const { return m_micro >= 0 ? 3 : m_minor >= 0 ? 2 : m_major >= 0 ? 1 : 0; } +#ifdef Q_COMPILER_INITIALIZER_LISTS bool isAnyOfType(std::initializer_list types) const; +#endif Q_DECL_CONSTEXPR OSType type() const { return m_os; } QString name() const; From 807f3d32b162453e1305a588f92786f442dbb012 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Jun 2017 16:36:02 +0200 Subject: [PATCH 50/82] tst_QSharedPointer: Terminate hanging qmake-processes Change-Id: I580ff3ccbecba81c09ce3fc3e082b906f956171d Reviewed-by: Simon Hausmann --- tests/auto/corelib/tools/qsharedpointer/externaltests.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index e8f56fc1d3e..62dd33131bc 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -593,6 +593,8 @@ namespace QTest { } else { ok = qmake.waitForFinished(); exitCode = qmake.exitCode(); + if (!ok) + qmake.terminate(); std_out += qmake.readAllStandardOutput(); std_err += qmake.readAllStandardError(); From 9130c4a6bfbd4effe22ed89f7c9ead37dd58f2e7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Jun 2017 09:23:39 +0200 Subject: [PATCH 51/82] tst_QSocks5SocketEngine::downloadBigFile(): Output elapsed time Print time in the error handler to get some diagnostics about when the network connection is dropped. Task-number: QTBUG-61673 Change-Id: I376bec81f52d75c9b601f2af9b7e0b63f5883bb0 Reviewed-by: Simon Hausmann --- .../tst_qsocks5socketengine.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index 18da122000a..1212ea20e55 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -728,6 +728,10 @@ void tst_QSocks5SocketEngine::downloadBigFile() QTcpSocket socket; qint64 bytesAvailable = 0; + + QElapsedTimer stopWatch; + stopWatch.start(); + connect(&socket, &QAbstractSocket::connected, &QTestEventLoop::instance(), &QTestEventLoop::exitLoop); connect(&socket, &QIODevice::readyRead, @@ -743,10 +747,11 @@ void tst_QSocks5SocketEngine::downloadBigFile() }); connect(&socket, QOverload::of(&QAbstractSocket::error), - [&socket] (QAbstractSocket::SocketError errorCode) + [&socket, &stopWatch] (QAbstractSocket::SocketError errorCode) { qWarning().noquote().nospace() << QTest::currentTestFunction() - << ": error " << errorCode << ": " << socket.errorString(); + << ": error " << errorCode << ": " << socket.errorString() + << " (" << stopWatch.elapsed() << "ms)"; }); socket.connectToHost(QtNetworkSettings::serverName(), 80); @@ -763,11 +768,7 @@ void tst_QSocks5SocketEngine::downloadBigFile() QVERIFY(socket.write("\r\n") > 0); QVERIFY(socket.write("\r\n") > 0); - - - QTime stopWatch; - stopWatch.start(); - + stopWatch.restart(); QTestEventLoop::instance().enterLoop(60); if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); From 9131b2ac2ace2d028f27468b67ecafcd109a398f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Jun 2017 14:52:26 +0200 Subject: [PATCH 52/82] tests: Add Q_FALLTHROUGH to unmarked fallthroughs seen by GCC 7 Change-Id: I70c87912476372097517fc20b3740416c24cb819 Reviewed-by: Thiago Macieira --- .../itemviews/qtableview/tst_qtableview.cpp | 2 + tests/baselineserver/shared/lookup3.cpp | 143 +++++++++++++----- 2 files changed, 110 insertions(+), 35 deletions(-) diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 5c0bb678255..c75c1dc87e0 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -693,12 +693,14 @@ void tst_QTableView::keyboardNavigation() case Qt::Key_Backtab: if (!tabKeyNavigation) break; + Q_FALLTHROUGH(); case Qt::Key_Left: column = qMax(0, column - 1); break; case Qt::Key_Tab: if (!tabKeyNavigation) break; + Q_FALLTHROUGH(); case Qt::Key_Right: column = qMin(columnCount - 1, column + 1); break; diff --git a/tests/baselineserver/shared/lookup3.cpp b/tests/baselineserver/shared/lookup3.cpp index 03e5f96e220..3d8d763bb79 100644 --- a/tests/baselineserver/shared/lookup3.cpp +++ b/tests/baselineserver/shared/lookup3.cpp @@ -207,9 +207,12 @@ quint32 initval) /* the previous hash, or an arbitrary value */ switch(length) /* all the case statements fall through */ { case 3 : c+=k[2]; + Q_FALLTHROUGH(); case 2 : b+=k[1]; + Q_FALLTHROUGH(); case 1 : a+=k[0]; - final(a,b,c); + final(a,b,c); + Q_FALLTHROUGH(); case 0: /* case 0: nothing left to add */ break; } @@ -253,9 +256,12 @@ quint32 *pb) /* IN: more seed OUT: secondary hash value */ switch(length) /* all the case statements fall through */ { case 3 : c+=k[2]; + Q_FALLTHROUGH(); case 2 : b+=k[1]; + Q_FALLTHROUGH(); case 1 : a+=k[0]; final(a,b,c); + Q_FALLTHROUGH(); case 0: /* case 0: nothing left to add */ break; } @@ -349,16 +355,24 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ - case 10: c+=((quint32)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<8; + Q_FALLTHROUGH(); + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ - case 6 : b+=((quint32)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<8; + Q_FALLTHROUGH(); + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ - case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k8[0]; break; case 0 : return c; } @@ -388,23 +402,28 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); case 10: c+=k[4]; b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 9 : c+=k8[8]; /* fall through */ + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=k[2]; a+=k[0]+(((quint32)k[1])<<16); break; - case 5 : b+=k8[4]; /* fall through */ + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]+(((quint32)k[1])<<16); break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=k[0]; break; case 1 : a+=k8[0]; @@ -439,16 +458,27 @@ quint32 hashlittle( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=((quint32)k[11])<<24; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<16; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<8; + Q_FALLTHROUGH(); case 9 : c+=k[8]; + Q_FALLTHROUGH(); case 8 : b+=((quint32)k[7])<<24; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<8; + Q_FALLTHROUGH(); case 5 : b+=k[4]; + Q_FALLTHROUGH(); case 4 : a+=((quint32)k[3])<<24; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k[0]; break; case 0 : return c; @@ -533,16 +563,24 @@ void hashlittle2( switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ - case 10: c+=((quint32)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<8; + Q_FALLTHROUGH(); + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ - case 6 : b+=((quint32)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<8; + Q_FALLTHROUGH(); + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ - case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k8[0]; break; case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ } @@ -572,23 +610,28 @@ void hashlittle2( b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 11: c+=((quint32)k8[10])<<16; + Q_FALLTHROUGH(); case 10: c+=k[4]; b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 9 : c+=k8[8]; /* fall through */ + case 9 : c+=k8[8]; + Q_FALLTHROUGH(); case 8 : b+=k[2]+(((quint32)k[3])<<16); a+=k[0]+(((quint32)k[1])<<16); break; - case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 7 : b+=((quint32)k8[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=k[2]; a+=k[0]+(((quint32)k[1])<<16); break; - case 5 : b+=k8[4]; /* fall through */ + case 5 : b+=k8[4]; + Q_FALLTHROUGH(); case 4 : a+=k[0]+(((quint32)k[1])<<16); break; - case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=k[0]; break; case 1 : a+=k8[0]; @@ -623,16 +666,27 @@ void hashlittle2( switch(length) /* all the case statements fall through */ { case 12: c+=((quint32)k[11])<<24; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<16; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<8; + Q_FALLTHROUGH(); case 9 : c+=k[8]; + Q_FALLTHROUGH(); case 8 : b+=((quint32)k[7])<<24; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<16; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<8; + Q_FALLTHROUGH(); case 5 : b+=k[4]; + Q_FALLTHROUGH(); case 4 : a+=((quint32)k[3])<<24; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<16; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<8; + Q_FALLTHROUGH(); case 1 : a+=k[0]; break; case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ @@ -709,16 +763,24 @@ quint32 hashbig( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((quint32)k8[10])<<8; /* fall through */ - case 10: c+=((quint32)k8[9])<<16; /* fall through */ - case 9 : c+=((quint32)k8[8])<<24; /* fall through */ + case 11: c+=((quint32)k8[10])<<8; + Q_FALLTHROUGH(); + case 10: c+=((quint32)k8[9])<<16; + Q_FALLTHROUGH(); + case 9 : c+=((quint32)k8[8])<<24; + Q_FALLTHROUGH(); case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((quint32)k8[6])<<8; /* fall through */ - case 6 : b+=((quint32)k8[5])<<16; /* fall through */ - case 5 : b+=((quint32)k8[4])<<24; /* fall through */ + case 7 : b+=((quint32)k8[6])<<8; + Q_FALLTHROUGH(); + case 6 : b+=((quint32)k8[5])<<16; + Q_FALLTHROUGH(); + case 5 : b+=((quint32)k8[4])<<24; + Q_FALLTHROUGH(); case 4 : a+=k[0]; break; - case 3 : a+=((quint32)k8[2])<<8; /* fall through */ - case 2 : a+=((quint32)k8[1])<<16; /* fall through */ + case 3 : a+=((quint32)k8[2])<<8; + Q_FALLTHROUGH(); + case 2 : a+=((quint32)k8[1])<<16; + Q_FALLTHROUGH(); case 1 : a+=((quint32)k8[0])<<24; break; case 0 : return c; } @@ -752,16 +814,27 @@ quint32 hashbig( const void *key, size_t length, quint32 initval) switch(length) /* all the case statements fall through */ { case 12: c+=k[11]; + Q_FALLTHROUGH(); case 11: c+=((quint32)k[10])<<8; + Q_FALLTHROUGH(); case 10: c+=((quint32)k[9])<<16; + Q_FALLTHROUGH(); case 9 : c+=((quint32)k[8])<<24; + Q_FALLTHROUGH(); case 8 : b+=k[7]; + Q_FALLTHROUGH(); case 7 : b+=((quint32)k[6])<<8; + Q_FALLTHROUGH(); case 6 : b+=((quint32)k[5])<<16; + Q_FALLTHROUGH(); case 5 : b+=((quint32)k[4])<<24; + Q_FALLTHROUGH(); case 4 : a+=k[3]; + Q_FALLTHROUGH(); case 3 : a+=((quint32)k[2])<<8; + Q_FALLTHROUGH(); case 2 : a+=((quint32)k[1])<<16; + Q_FALLTHROUGH(); case 1 : a+=((quint32)k[0])<<24; break; case 0 : return c; From 2087f120c30fc0fd02d02a568d01932c9b78fb76 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jun 2017 12:32:32 +0200 Subject: [PATCH 53/82] QNativeSocketEnginePrivate::nativeAccept(): Add missing break Fixes GCC 7 warning: socket\qnativesocketengine_win.cpp:888:21: warning: this statement may fall through [-Wimplicit-fallthrough=] Change-Id: Idb4dce511b3ab634339ac1283d88def283a92028 Reviewed-by: Oliver Wolff Reviewed-by: Timur Pocheptsov --- src/network/socket/qnativesocketengine_win.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 28aea6be3d9..a09d611e89d 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -886,6 +886,7 @@ int QNativeSocketEnginePrivate::nativeAccept() break; case WSAENETDOWN: setError(QAbstractSocket::NetworkError, NetworkUnreachableErrorString); + break; case WSAENOTSOCK: setError(QAbstractSocket::SocketResourceError, NotSocketErrorString); break; From 4f7be34a42458db87ce2f11ed34ea2d2aa020009 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jun 2017 13:45:53 +0200 Subject: [PATCH 54/82] Windows code: Add Q_FALLTHROUGH or break to unmarked fallthroughs seen by GCC 7 Rearrange code handling QtWindows::DisplayChangedEvent. Change-Id: If9f32516108fb64c4a252c84392f2fd7f1872bf1 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowscontext.cpp | 2 +- src/plugins/platforms/windows/qwindowskeymapper.cpp | 1 + src/widgets/styles/qwindowsvistastyle.cpp | 1 + src/widgets/styles/qwindowsxpstyle.cpp | 9 ++++----- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 42cdc86fb75..38f2be7a739 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -925,9 +925,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return false; #endif case QtWindows::DisplayChangedEvent: - return d->m_screenManager.handleDisplayChange(wParam, lParam); if (QWindowsTheme *t = QWindowsTheme::instance()) t->displayChanged(); + return d->m_screenManager.handleDisplayChange(wParam, lParam); case QtWindows::SettingChangedEvent: return d->m_screenManager.handleScreenChanges(); default: diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index ab806fd3ea5..3987d8ca292 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -1008,6 +1008,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms state |= ((msg.wParam >= '0' && msg.wParam <= '9') || (msg.wParam >= VK_OEM_PLUS && msg.wParam <= VK_OEM_3)) ? 0 : int(Qt::KeypadModifier); + Q_FALLTHROUGH(); default: if (uint(msg.lParam) == 0x004c0001 || uint(msg.lParam) == 0xc04c0001) state |= Qt::KeypadModifier; diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 5a53627e951..a1aabc20c6c 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -2153,6 +2153,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt rect = visualRect(cb->direction, cb->rect, rect); return rect; } + break; #endif // QT_NO_COMBOBOX case CC_TitleBar: if (const QStyleOptionTitleBar *tb = qstyleoption_cast(option)) { diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index b50c4b6be47..25321559b3c 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -1509,10 +1509,9 @@ case PE_Frame: return; } else if (fillType == BT_NONE) { return; - } else { - break; } } + break; } case PE_FrameLineEdit: { // we try to check if this lineedit is a delegate on a QAbstractItemView-derived class. @@ -2428,6 +2427,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op p->restore(); return; } + break; #endif // QT_NO_RUBBERBAND case CE_HeaderEmptyArea: if (option->state & State_Horizontal) @@ -3754,10 +3754,9 @@ int QWindowsXPStyle::styleHint(StyleHint hint, const QStyleOption *option, const break; #ifndef QT_NO_RUBBERBAND case SH_RubberBand_Mask: - if (qstyleoption_cast(option)) { + if (qstyleoption_cast(option)) res = 0; - break; - } + break; #endif // QT_NO_RUBBERBAND case SH_ItemView_DrawDelegateFrame: From 5d31b52a1235a745cc3d5fc4c85a04ae981b043e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 27 Jun 2017 10:01:36 +0200 Subject: [PATCH 55/82] Fix some MSVC warnings in tests tst_qvariant.cpp(80): warning C4309: 'initializing': truncation of constant value tst_qvariant.cpp(4635): warning C4309: 'initializing': truncation of constant value tst_qbytearray.cpp(1438): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data tst_qbytearray.cpp(1440): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data http2srv.cpp(64): warning C4018: '<=': signed/unsigned mismatch tst_qinputdialog.cpp(352): warning C4804: '<=': unsafe use of type 'bool' in operation Change-Id: Id012d88b7b20c5c9f128f2ef53753cc1d479f358 Reviewed-by: Thiago Macieira --- tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 4 ++-- tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp | 2 +- tests/auto/network/access/http2/http2srv.cpp | 2 +- tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index ac1e1c6b459..d16948fd5d8 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -77,7 +77,7 @@ public: enum MetaEnumTest_Enum0 { MetaEnumTest_Enum0_dummy = 2, MetaEnumTest_Enum0_value = 42, MetaEnsureSignedEnum0 = -1 }; Q_ENUM(MetaEnumTest_Enum0) - enum MetaEnumTest_Enum1 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; + enum MetaEnumTest_Enum1 : qint64 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; Q_ENUM(MetaEnumTest_Enum1) enum MetaEnumTest_Enum3 ENUM_SIZE(qint64) { MetaEnumTest_Enum3_value = -47, MetaEnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5, MetaEnumTest_Enum3_bigNegValue = -(Q_INT64_C(1) << 56) - 3 }; @@ -4632,7 +4632,7 @@ void tst_QVariant::pairElements() enum EnumTest_Enum0 { EnumTest_Enum0_value = 42, EnumTest_Enum0_negValue = -8 }; Q_DECLARE_METATYPE(EnumTest_Enum0) -enum EnumTest_Enum1 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; +enum EnumTest_Enum1 : qint64 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 }; Q_DECLARE_METATYPE(EnumTest_Enum1) #if defined(Q_COMPILER_CLASS_ENUM) diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 16a9c03351a..93c10d78db3 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -1372,7 +1372,7 @@ void tst_QByteArray::toULongLong() QCOMPARE(b, ok); } -static bool checkSize(size_t value, uint min) +static bool checkSize(size_t value, size_t min) { return value >= min && value <= INT_MAX; } diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp index 9f774194619..d0686eb01c7 100644 --- a/tests/auto/network/access/http2/http2srv.cpp +++ b/tests/auto/network/access/http2/http2srv.cpp @@ -61,7 +61,7 @@ namespace inline bool is_valid_client_stream(quint32 streamID) { // A valid client stream ID is an odd integer number in the range [1, INT_MAX]. - return (streamID & 0x1) && streamID <= std::numeric_limits::max(); + return (streamID & 0x1) && streamID <= quint32(std::numeric_limits::max()); } void fill_push_header(const HttpHeader &originalRequest, HttpHeader &promisedRequest) diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index 0ea9e0259fa..4ea0de5ab9b 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -349,11 +349,12 @@ void tst_QInputDialog::taskQTBUG_54693_crashWhenParentIsDeletedWhileDialogIsOpen } // getItem - for (int editable = false; editable <= true; ++editable) { + for (int editable = 0; editable < 2; ++editable) { QAutoPointer dialog(new SelfDestructParent); bool ok = true; const QString result = QInputDialog::getItem(dialog.get(), "Title", "Label", - QStringList() << "1" << "2", 1, editable, &ok); + QStringList() << "1" << "2", 1, + editable != 0, &ok); QVERIFY(!dialog); QVERIFY(!ok); QCOMPARE(result, QLatin1String("2")); From ffe8884ac3a3b494786055aa51fd48e3d6edac16 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Jun 2017 16:02:05 -0700 Subject: [PATCH 56/82] QProcess/Unix: move strerror() up from child to parent In theory, there's nothing wrong with having it in the child process. In practice, we've found that strerror/malloc can hang: if an application- wide lock was held by another thread before fork(), the child process could wait forever for an unlocking that will not happen (no threads running). See https://sourceware.org/bugzilla/show_bug.cgi?id=19431 As an added bonus, we now use qt_error_string(), which may produce slightly different text from strerror. [ChangeLog][QtCore][QProcess] Added a workaround for a rare race- condition bug in some C libraries that caused the child process started by QProcess to hang after trying to launch a non-existent executable or change to a non-existent directory. Task-number: QTBUG-61634 Change-Id: I1eba2b016de74620bfc8fffd14cbce4b9f9af69b Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_unix.cpp | 46 +++++++++++++------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 98d196ff7bb..6b7f187fee9 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -146,10 +146,6 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() #if QT_CONFIG(process) -// POSIX requires PIPE_BUF to be 512 or larger -// so we will use 512 -static const int errorBufferMax = 512; - namespace { struct QProcessPoller { @@ -548,11 +544,18 @@ void QProcessPrivate::startProcess() } } +struct ChildError +{ + int code; + char function[8]; +}; + void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv, char **envp) { ::signal(SIGPIPE, SIG_DFL); // reset the signal that we ignored Q_Q(QProcess); + ChildError error = { 0, {} }; // force zeroing of function[8] // copy the stdin socket if asked to (without closing on exec) if (inputChannelMode != QProcess::ForwardedInputChannel) @@ -575,9 +578,9 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv qt_safe_close(childStartedPipe[0]); // enter the working directory - const char *callthatfailed = "chdir: "; if (workingDir && QT_CHDIR(workingDir) == -1) { // failed, stop the process + strcpy(error.function, "chdir"); goto report_errno; } @@ -587,7 +590,7 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv // execute the process if (!envp) { qt_safe_execvp(argv[0], argv); - callthatfailed = "execvp: "; + strcpy(error.function, "execvp"); } else { if (path) { char **arg = path; @@ -605,33 +608,22 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv #endif qt_safe_execve(argv[0], argv, envp); } - callthatfailed = "execve: "; + strcpy(error.function, "execve"); } // notify failure - // we're running in the child process, so we don't need to be thread-safe; - // we can use strerror + // don't use strerror or any other routines that may allocate memory, since + // some buggy libc versions can deadlock on locked mutexes. report_errno: - const char *msg = strerror(errno); -#if defined (QPROCESS_DEBUG) - fprintf(stderr, "QProcessPrivate::execChild() failed (%s), notifying parent process\n", msg); -#endif - qt_safe_write(childStartedPipe[1], callthatfailed, strlen(callthatfailed)); - qt_safe_write(childStartedPipe[1], msg, strlen(msg)); - qt_safe_close(childStartedPipe[1]); + error.code = errno; + qt_safe_write(childStartedPipe[1], &error, sizeof(error)); childStartedPipe[1] = -1; } bool QProcessPrivate::processStarted(QString *errorMessage) { - char buf[errorBufferMax]; - int i = 0; - int ret; - do { - ret = qt_safe_read(childStartedPipe[0], buf + i, sizeof buf - i); - if (ret > 0) - i += ret; - } while (ret > 0 && i < int(sizeof buf)); + ChildError buf; + int ret = qt_safe_read(childStartedPipe[0], &buf, sizeof(buf)); if (startupSocketNotifier) { startupSocketNotifier->setEnabled(false); @@ -646,10 +638,10 @@ bool QProcessPrivate::processStarted(QString *errorMessage) #endif // did we read an error message? - if ((i > 0) && errorMessage) - *errorMessage = QString::fromLocal8Bit(buf, i); + if (ret > 0 && errorMessage) + *errorMessage = QLatin1String(buf.function) + QLatin1String(": ") + qt_error_string(buf.code); - return i <= 0; + return ret <= 0; } qint64 QProcessPrivate::bytesAvailableInChannel(const Channel *channel) const From 6e9d24212db60743f13497f942713961d6601844 Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Fri, 16 Jun 2017 17:06:53 -0400 Subject: [PATCH 57/82] QTabBar: fix expanded tabs appearance Fix regression introduced by 175f33ed8. 'expanding' property set to true was ignored when QStyle::styleHint() returned Qt::AlignRight for SH_TabBar_Alignment. When we calculate tabs geometry, we put an empty tab at the front and back and set its expansive attribute depending on tab alignment AND 'expanding' property. Task-number: QTBUG-61480 Change-Id: I6a1827ae8a3f2c6bee5124c18c7f2b1c0a7862f3 Reviewed-by: Gabriel de Dietrich --- src/widgets/widgets/qtabbar.cpp | 18 +++++++++--------- tests/manual/qtabbar/main.cpp | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index b9020253a58..85bc9a4a09c 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -447,9 +447,10 @@ void QTabBarPrivate::layoutTabs() QVector tabChain(tabList.count() + 2); // We put an empty item at the front and back and set its expansive attribute - // depending on tabAlignment. + // depending on tabAlignment and expanding. tabChain[tabChainIndex].init(); - tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignLeft) + tabChain[tabChainIndex].expansive = (!expanding) + && (tabAlignment != Qt::AlignLeft) && (tabAlignment != Qt::AlignJustify); tabChain[tabChainIndex].empty = true; ++tabChainIndex; @@ -514,13 +515,12 @@ void QTabBarPrivate::layoutTabs() maxExtent = maxWidth; } - if (!expanding) { - // Mirror our front item. - tabChain[tabChainIndex].init(); - tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignRight) - && (tabAlignment != Qt::AlignJustify); - tabChain[tabChainIndex].empty = true; - } + // Mirror our front item. + tabChain[tabChainIndex].init(); + tabChain[tabChainIndex].expansive = (!expanding) + && (tabAlignment != Qt::AlignRight) + && (tabAlignment != Qt::AlignJustify); + tabChain[tabChainIndex].empty = true; Q_ASSERT(tabChainIndex == tabChain.count() - 1); // add an assert just to make sure. // Do the calculation diff --git a/tests/manual/qtabbar/main.cpp b/tests/manual/qtabbar/main.cpp index b1ef0df100a..5a1a558c10a 100644 --- a/tests/manual/qtabbar/main.cpp +++ b/tests/manual/qtabbar/main.cpp @@ -56,12 +56,28 @@ #include #include #include +#include + +class MyProxyStyle : public QProxyStyle +{ +public: + int styleHint(StyleHint hint, const QStyleOption *option = 0, + const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const + { + if (hint == QStyle::SH_TabBar_Alignment) + return Qt::AlignLeft; +// return Qt::AlignRight; +// return Qt::AlignCenter; + return QProxyStyle::styleHint(hint, option, widget, returnData); + } +}; const int TabCount = 5; int main(int argc, char *argv[]) { QApplication app(argc, argv); + app.setStyle(new MyProxyStyle); QWidget widget; QStackedWidget stackedWidget; @@ -69,7 +85,7 @@ int main(int argc, char *argv[]) tabBar.setDocumentMode(true); tabBar.setTabsClosable(true); tabBar.setMovable(true); - tabBar.setExpanding(true); + tabBar.setExpanding(false); // top tabBar.setShape(QTabBar::RoundedNorth); From 3c89c71da5f00ada18d9405abddb5812dc4278ea Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 13 Jun 2017 14:22:11 -0700 Subject: [PATCH 58/82] Fix handling of deprecated QMAKE_IOS_TARGETED_DEVICE_FAMILY Since the mkspecs always set QMAKE_APPLE_TARGETED_DEVICE_FAMILY, it will never be empty, and the warning message and automatic fallback to QMAKE_IOS_TARGETED_DEVICE_FAMILY will never be used. Task-number: QTBUG-60430 Change-Id: I79e36d355dae3f8a4429d73e753fed3c090a5d24 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/uikit/default_post.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf index 0a2e4122f57..f7245e48b14 100644 --- a/mkspecs/features/uikit/default_post.prf +++ b/mkspecs/features/uikit/default_post.prf @@ -19,7 +19,7 @@ equals(TEMPLATE, app):qt { load(default_post) macx-xcode { - ios:isEmpty(QMAKE_APPLE_TARGETED_DEVICE_FAMILY):!isEmpty(QMAKE_IOS_TARGETED_DEVICE_FAMILY) { + ios:!isEmpty(QMAKE_IOS_TARGETED_DEVICE_FAMILY) { warning("QMAKE_IOS_TARGETED_DEVICE_FAMILY is deprecated; use QMAKE_APPLE_TARGETED_DEVICE_FAMILY") QMAKE_APPLE_TARGETED_DEVICE_FAMILY = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY } From fa7626713b3a943609453459190e16c49d61dfd3 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 7 Jun 2017 16:42:47 -0700 Subject: [PATCH 59/82] Allow using Xcode Command Line Tools to build Qt Some users don't want to download the full Xcode installation which can weigh upwards of 5 GB download and 20 GB installed. [ChangeLog][macOS / iOS] Qt can now be built using just the Xcode Command Line Tools, without needing to install the full Xcode IDE. Task-number: QTBUG-35928 Task-number: QTBUG-41908 Change-Id: I6d13c9a03ab9087b3ab56e8547f53f0cc2806c7b Reviewed-by: Thiago Macieira Reviewed-by: Jake Petroules --- configure | 23 ++++++++++++++--------- mkspecs/features/mac/default_post.prf | 3 ++- mkspecs/features/mac/default_pre.prf | 25 +++++++++++++++---------- mkspecs/features/mac/sdk.prf | 13 +++++++++++-- mkspecs/features/xctest.prf | 3 ++- src/testlib/testlib.pro | 16 +++++++++------- 6 files changed, 53 insertions(+), 30 deletions(-) diff --git a/configure b/configure index 73679de6214..bf37224d24e 100755 --- a/configure +++ b/configure @@ -234,7 +234,7 @@ macSDKify() sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1") if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi - sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null) + sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null) if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi case "$sdk" in @@ -322,18 +322,23 @@ fi if [ "$BUILD_ON_MAC" = "yes" ]; then if ! /usr/bin/xcode-select --print-path >/dev/null 2>&1; then echo >&2 - echo " No Xcode is selected. Use xcode-select -switch to choose an Xcode" >&2 - echo " version. See the xcode-select man page for more information." >&2 + echo " No Xcode selected. Please install Xcode via the App Store, " >&2 + echo " or the command line developer tools via xcode-select --install, " >&2 + echo " and use xcode-select --switch to choose the right installation. " >&2 + echo " See the xcode-select man page for more information." >&2 echo >&2 exit 2 fi - if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then - echo >&2 - echo " Xcode not set up properly. You may need to confirm the license" >&2 - echo " agreement by running /usr/bin/xcodebuild without arguments." >&2 - echo >&2 - exit 2 + # In the else case we are probably using a Command Line Tools installation + if /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then + if ! /usr/bin/xcrun xcodebuild -license check 2>/dev/null; then + echo >&2 + echo " Xcode setup not complete. You need to confirm the license" >&2 + echo " agreement by running 'sudo xcrun xcodebuild -license accept'." >&2 + echo >&2 + exit 2 + fi fi fi diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 395ac340012..e645ba58039 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -183,6 +183,7 @@ macx-xcode { } cache(QMAKE_XCODE_DEVELOPER_PATH, stash) -cache(QMAKE_XCODE_VERSION, stash) +!isEmpty(QMAKE_XCODE_VERSION): \ + cache(QMAKE_XCODE_VERSION, stash) QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index e21e749ee90..44636f22889 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -10,18 +10,23 @@ isEmpty(QMAKE_XCODE_DEVELOPER_PATH) { # Make sure Xcode path is valid !exists($$QMAKE_XCODE_DEVELOPER_PATH): \ error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.") - - # Make sure Xcode is set up properly - isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \ - error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.") } -isEmpty(QMAKE_XCODE_VERSION) { - # Extract Xcode version using xcodebuild - xcode_version = $$system("/usr/bin/xcodebuild -version") - QMAKE_XCODE_VERSION = $$member(xcode_version, 1) - isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") - unset(xcode_version) +isEmpty(QMAKE_XCODEBUILD_PATH): \ + QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null") + +!isEmpty(QMAKE_XCODEBUILD_PATH) { + # Make sure Xcode is set up properly + !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \ + error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.") + + isEmpty(QMAKE_XCODE_VERSION) { + # Extract Xcode version using xcodebuild + xcode_version = $$system("/usr/bin/xcrun xcodebuild -version") + QMAKE_XCODE_VERSION = $$member(xcode_version, 1) + isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") + unset(xcode_version) + } } isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) { diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 68ab7e40530..3f6dc076cac 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -7,13 +7,22 @@ contains(QMAKE_MAC_SDK, .*/.*): \ defineReplace(xcodeSDKInfo) { info = $$1 + equals(info, "Path"): \ + info = --show-sdk-path + equals(info, "PlatformPath"): \ + info = --show-sdk-platform-path + equals(info, "SDKVersion"): \ + info = --show-sdk-version sdk = $$2 isEmpty(sdk): \ sdk = $$QMAKE_MAC_SDK isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) { - QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcodebuild -sdk $$sdk -version $$info 2>/dev/null") - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}): error("Could not resolve SDK $$info for \'$$sdk\'") + QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null") + # --show-sdk-platform-path won't work for Command Line Tools; this is fine + # only used by the XCTest backend to testlib + isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \ + error("Could not resolve SDK $$info for \'$$sdk\'") cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info}) } diff --git a/mkspecs/features/xctest.prf b/mkspecs/features/xctest.prf index 4b84682df76..4ee504f0ad6 100644 --- a/mkspecs/features/xctest.prf +++ b/mkspecs/features/xctest.prf @@ -2,5 +2,6 @@ equals(TEMPLATE, app) { load(sdk) # Make the XCTest framework available. This is normally handled automatically # by Xcode based on heuristics, but we need to explicitly link to XCTest. - QMAKE_LFLAGS += -F$${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks -weak_framework XCTest + !isEmpty(QMAKE_MAC_SDK_PLATFORM_PATH): \ + QMAKE_LFLAGS += -F$${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks -weak_framework XCTest } diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index e84651ccd5d..e11e25e1dac 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -88,14 +88,16 @@ mac { LIBS += -framework Foundation load(sdk) - platform_dev_frameworks_path = $${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks + !isEmpty(QMAKE_MAC_SDK_PLATFORM_PATH) { + platform_dev_frameworks_path = $${QMAKE_MAC_SDK_PLATFORM_PATH}/Developer/Library/Frameworks - # We can't put this path into LIBS (so that it propagates to the prl file), as we - # don't know yet if the target that links to testlib will build under Xcode or not. - # The corresponding flags for the target lives in xctest.prf, where we do know. - QMAKE_LFLAGS += -F$${platform_dev_frameworks_path} -weak_framework XCTest - QMAKE_CXXFLAGS += -F$${platform_dev_frameworks_path} - MODULE_CONFIG += xctest + # We can't put this path into LIBS (so that it propagates to the prl file), as we + # don't know yet if the target that links to testlib will build under Xcode or not. + # The corresponding flags for the target lives in xctest.prf, where we do know. + QMAKE_LFLAGS += -F$${platform_dev_frameworks_path} -weak_framework XCTest + QMAKE_CXXFLAGS += -F$${platform_dev_frameworks_path} + MODULE_CONFIG += xctest + } } } From 150ee7f4f1fb6280aa7fd8c15b6d72d806c0f68c Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sat, 10 Jun 2017 07:09:50 +0200 Subject: [PATCH 60/82] Convert features.whatsthis to QT_[REQUIRE_]CONFIG Move feature definition to gui/configure.json Change-Id: I00b35c0e259d0a695d84a9bf6803eba74d41465a Reviewed-by: Oswald Buddenhagen --- src/gui/configure.json | 6 ++++++ src/gui/itemmodels/qstandarditemmodel.h | 4 ++-- src/gui/kernel/qevent.cpp | 4 ++-- src/gui/kernel/qevent.h | 2 +- src/gui/kernel/qwindowsysteminterface.cpp | 2 +- src/gui/kernel/qwindowsysteminterface.h | 2 +- src/widgets/accessible/complexwidgets.cpp | 2 ++ src/widgets/accessible/qaccessiblewidget.cpp | 4 +++- src/widgets/configure.json | 7 ------- src/widgets/dialogs/qdialog.cpp | 6 ++++-- src/widgets/itemviews/qabstractitemdelegate.cpp | 4 +++- src/widgets/itemviews/qabstractitemview.cpp | 1 - src/widgets/itemviews/qheaderview.cpp | 6 ++++-- src/widgets/itemviews/qlistwidget.h | 4 ++-- src/widgets/itemviews/qtablewidget.h | 4 ++-- src/widgets/itemviews/qtreewidget.h | 4 ++-- src/widgets/kernel/kernel.pri | 7 +++++-- src/widgets/kernel/qapplication.cpp | 8 ++++---- src/widgets/kernel/qshortcut.cpp | 4 +++- src/widgets/kernel/qwhatsthis.cpp | 4 ---- src/widgets/kernel/qwhatsthis.h | 7 ++----- src/widgets/kernel/qwidget.cpp | 10 ++++++---- src/widgets/kernel/qwidget.h | 4 ++-- src/widgets/kernel/qwidget_p.h | 2 +- src/widgets/statemachine/qguistatemachine.cpp | 4 ++-- src/widgets/widgets/qlineedit.cpp | 1 - src/widgets/widgets/qmdisubwindow.cpp | 4 +++- src/widgets/widgets/qmenu.cpp | 16 ++++++++-------- src/widgets/widgets/qmenubar.cpp | 6 ++++-- src/widgets/widgets/qtabbar.cpp | 10 ++++++---- src/widgets/widgets/qtabbar.h | 2 +- src/widgets/widgets/qtabbar_p.h | 2 +- src/widgets/widgets/qtabwidget.cpp | 4 ++-- src/widgets/widgets/qtabwidget.h | 2 +- src/widgets/widgets/qtextbrowser.cpp | 4 +++- src/widgets/widgets/qtoolbutton.cpp | 2 +- 36 files changed, 90 insertions(+), 75 deletions(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index 1b2b0775a26..343cfcf798e 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -1020,6 +1020,12 @@ "section": "Utilities", "condition": "!config.integrity", "output": [ "privateFeature" ] + }, + "whatsthis": { + "label": "QWhatsThis", + "purpose": "Supports displaying \"What's this\" help.", + "section": "Widget Support", + "output": [ "publicFeature", "feature" ] } }, diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h index a9cde106c12..73107b827c6 100644 --- a/src/gui/itemmodels/qstandarditemmodel.h +++ b/src/gui/itemmodels/qstandarditemmodel.h @@ -95,7 +95,7 @@ public: inline void setStatusTip(const QString &statusTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis() const { return qvariant_cast(data(Qt::WhatsThisRole)); } @@ -272,7 +272,7 @@ inline void QStandardItem::setStatusTip(const QString &astatusTip) { setData(astatusTip, Qt::StatusTipRole); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QStandardItem::setWhatsThis(const QString &awhatsThis) { setData(awhatsThis, Qt::WhatsThisRole); } #endif diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 5ae76abb558..680acb16e72 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3325,7 +3325,7 @@ QStatusTipEvent::~QStatusTipEvent() #endif // QT_NO_STATUSTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \class QWhatsThisClickedEvent @@ -3362,7 +3362,7 @@ QWhatsThisClickedEvent::~QWhatsThisClickedEvent() This?" text. */ -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_ACTION diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 18f87183302..b8f86acd754 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -699,7 +699,7 @@ private: }; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent { public: diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 3982b5568e3..b8299e2cb83 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -860,7 +860,7 @@ void QWindowSystemInterface::handleContextMenuEvent(QWindow *window, bool mouseT } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void QWindowSystemInterface::handleEnterWhatsThisEvent() { QWindowSystemInterfacePrivate::WindowSystemEvent *e = diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index aadf63782f3..e582787dd9e 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -236,7 +236,7 @@ public: const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) static void handleEnterWhatsThisEvent(); #endif diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 397a58a5d46..4770c513cf7 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -51,7 +51,9 @@ #include #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index d5f7449e575..f18930f2732 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -48,7 +48,9 @@ #include "qlabel.h" #endif #include "qtooltip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "qwidget.h" #include "qdebug.h" #include @@ -436,7 +438,7 @@ QString QAccessibleWidget::text(QAccessible::Text t) const #endif break; case QAccessible::Help: -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) str = widget()->whatsThis(); #endif break; diff --git a/src/widgets/configure.json b/src/widgets/configure.json index f0fce9b52b5..7e2f8e15523 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -432,13 +432,6 @@ "section": "Widgets", "output": [ "publicFeature", "feature" ] }, - "whatsthis": { - "label": "QWhatsThis", - "purpose": "Supports displaying \"What's this\" help.", - "section": "Widgets", - "condition": "features.toolbutton", - "output": [ "publicFeature", "feature" ] - }, "sizegrip": { "label": "QSizeGrip", "purpose": "Provides corner-grips for resizing top-level windows.", diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 60e1c43721b..a6e9cda8ce4 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -46,7 +46,9 @@ #include "qapplication.h" #include "qlayout.h" #include "qsizegrip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "qmenu.h" #include "qcursor.h" #include "qmessagebox.h" @@ -607,7 +609,7 @@ bool QDialog::eventFilter(QObject *o, QEvent *e) /*! \reimp */ void QDialog::contextMenuEvent(QContextMenuEvent *e) { -#if defined(QT_NO_WHATSTHIS) || defined(QT_NO_MENU) +#if !QT_CONFIG(whatsthis) || defined(QT_NO_MENU) Q_UNUSED(e); #else QWidget *w = childAt(e->pos()); @@ -672,7 +674,7 @@ void QDialog::keyPressEvent(QKeyEvent *e) /*! \reimp */ void QDialog::closeEvent(QCloseEvent *e) { -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (isModal() && QWhatsThis::inWhatsThisMode()) QWhatsThis::leaveWhatsThisMode(); #endif diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index f7c170f0bb4..5b119cc79e3 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -43,7 +43,9 @@ #include #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -393,7 +395,7 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event, } break;} #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: { if (index.data(Qt::WhatsThisRole).isValid()) return true; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index d24456edef0..e8db2282561 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 76f80c680e4..c31b00959d5 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -47,7 +47,9 @@ #include #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -2641,7 +2643,7 @@ bool QHeaderView::viewportEvent(QEvent *e) } break; } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: { QHelpEvent *he = static_cast(e); int logical = logicalIndexAt(he->pos()); @@ -2661,7 +2663,7 @@ bool QHeaderView::viewportEvent(QEvent *e) } } break; } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_STATUSTIP case QEvent::StatusTip: { QHelpEvent *he = static_cast(e); diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index 4e674867087..8471645fb0c 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -99,7 +99,7 @@ public: inline void setToolTip(const QString &toolTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis() const { return data(Qt::WhatsThisRole).toString(); } inline void setWhatsThis(const QString &whatsThis); @@ -179,7 +179,7 @@ inline void QListWidgetItem::setToolTip(const QString &atoolTip) { setData(Qt::ToolTipRole, atoolTip); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QListWidgetItem::setWhatsThis(const QString &awhatsThis) { setData(Qt::WhatsThisRole, awhatsThis); } #endif diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index d3bcba57dd5..3fecf194e41 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -116,7 +116,7 @@ public: inline void setToolTip(const QString &toolTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis() const { return data(Qt::WhatsThisRole).toString(); } inline void setWhatsThis(const QString &whatsThis); @@ -196,7 +196,7 @@ inline void QTableWidgetItem::setToolTip(const QString &atoolTip) { setData(Qt::ToolTipRole, atoolTip); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QTableWidgetItem::setWhatsThis(const QString &awhatsThis) { setData(Qt::WhatsThisRole, awhatsThis); } #endif diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index 27b7fa4fb1f..d258f76621f 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -119,7 +119,7 @@ public: inline void setToolTip(int column, const QString &toolTip); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline QString whatsThis(int column) const { return data(column, Qt::WhatsThisRole).toString(); } inline void setWhatsThis(int column, const QString &whatsThis); @@ -234,7 +234,7 @@ inline void QTreeWidgetItem::setToolTip(int column, const QString &atoolTip) { setData(column, Qt::ToolTipRole, atoolTip); } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) inline void QTreeWidgetItem::setWhatsThis(int column, const QString &awhatsThis) { setData(column, Qt::WhatsThisRole, awhatsThis); } #endif diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri index c91be918b60..3e3c7958396 100644 --- a/src/widgets/kernel/kernel.pri +++ b/src/widgets/kernel/kernel.pri @@ -24,7 +24,6 @@ HEADERS += \ kernel/qsizepolicy.h \ kernel/qstackedlayout.h \ kernel/qtooltip.h \ - kernel/qwhatsthis.h \ kernel/qwidget.h \ kernel/qwidget_p.h \ kernel/qwidgetaction.h \ @@ -52,7 +51,6 @@ SOURCES += \ kernel/qsizepolicy.cpp \ kernel/qstackedlayout.cpp \ kernel/qtooltip.cpp \ - kernel/qwhatsthis.cpp \ kernel/qwidget.cpp \ kernel/qwidgetaction.cpp \ kernel/qgesture.cpp \ @@ -87,3 +85,8 @@ qtConfig(formlayout) { HEADERS += kernel/qformlayout.h SOURCES += kernel/qformlayout.cpp } + +qtConfig(whatsthis) { + HEADERS += kernel/qwhatsthis.h + SOURCES += kernel/qwhatsthis.cpp +} diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index fe7a9c25002..01bd1c5033a 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -73,7 +73,7 @@ #include #include #include -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) #include #endif @@ -1999,7 +1999,7 @@ bool QApplication::event(QEvent *e) } else if (te->timerId() == d->toolTipFallAsleep.timerId()) { d->toolTipFallAsleep.stop(); } -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) } else if (e->type() == QEvent::EnterWhatsThisMode) { QWhatsThis::enterWhatsThisMode(); return true; @@ -3381,7 +3381,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; #endif // QT_CONFIG(tabletevent) -#if !defined(QT_NO_TOOLTIP) || !defined(QT_NO_WHATSTHIS) +#if !defined(QT_NO_TOOLTIP) || QT_CONFIG(whatsthis) case QEvent::ToolTip: case QEvent::WhatsThis: case QEvent::QueryWhatsThis: @@ -3406,7 +3406,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; #endif -#if !defined(QT_NO_STATUSTIP) || !defined(QT_NO_WHATSTHIS) +#if !defined(QT_NO_STATUSTIP) || QT_CONFIG(whatsthis) case QEvent::StatusTip: case QEvent::WhatsThisClicked: { diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index be5788274e2..a09cba0ddcf 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -42,7 +42,9 @@ #ifndef QT_NO_SHORTCUT #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -641,7 +643,7 @@ bool QShortcut::event(QEvent *e) if (d->sc_enabled && e->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast(e); if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){ -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (QWhatsThis::inWhatsThisMode()) { QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis); handled = true; diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 42860197179..e2cfebb8a14 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qwhatsthis.h" -#ifndef QT_NO_WHATSTHIS #include "qpointer.h" #include "qapplication.h" #include @@ -54,7 +53,6 @@ #include "qtextdocument.h" #include #include "private/qtextdocumentlayout_p.h" -#include "qtoolbutton.h" #include "qdebug.h" #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" @@ -681,5 +679,3 @@ QAction *QWhatsThis::createAction(QObject *parent) QT_END_NAMESPACE #include "qwhatsthis.moc" - -#endif // QT_NO_WHATSTHIS diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h index 746fd3ff22c..3211796d3e4 100644 --- a/src/widgets/kernel/qwhatsthis.h +++ b/src/widgets/kernel/qwhatsthis.h @@ -44,11 +44,10 @@ #include #include +QT_REQUIRE_CONFIG(whatsthis); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_WHATSTHIS - class QAction; class Q_WIDGETS_EXPORT QWhatsThis @@ -67,8 +66,6 @@ public: }; -#endif // QT_NO_WHATSTHIS - QT_END_NAMESPACE #endif // QWHATSTHIS_H diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index deb638f410a..3104f72e82d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -71,7 +71,9 @@ #include "private/qwidgetwindow_p.h" #include "qpainter.h" #include "qtooltip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "qdebug.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" @@ -8853,7 +8855,7 @@ bool QWidget::event(QEvent *event) } } #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (!k->isAccepted() && k->modifiers() & Qt::ShiftModifier && k->key() == Qt::Key_F1 && d->whatsThis.size()) { @@ -9152,7 +9154,7 @@ bool QWidget::event(QEvent *event) event->ignore(); break; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::WhatsThis: if (d->whatsThis.size()) QWhatsThis::showText(static_cast(event)->globalPos(), d->whatsThis, this); @@ -11579,7 +11581,7 @@ QString QWidget::statusTip() const } #endif // QT_NO_STATUSTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \property QWidget::whatsThis @@ -11600,7 +11602,7 @@ QString QWidget::whatsThis() const Q_D(const QWidget); return d->whatsThis; } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_ACCESSIBILITY /*! diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 59e2ddd24df..48bc1203248 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -186,7 +186,7 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice #ifndef QT_NO_STATUSTIP Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip) #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) #endif #ifndef QT_NO_ACCESSIBILITY @@ -390,7 +390,7 @@ public: void setStatusTip(const QString &); QString statusTip() const; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void setWhatsThis(const QString &); QString whatsThis() const; #endif diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 68e063c25a2..cc0940fc088 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -697,7 +697,7 @@ public: #ifndef QT_NO_STATUSTIP QString statusTip; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QString whatsThis; #endif #ifndef QT_NO_ACCESSIBILITY diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp index 26d0a9615f2..bbe723a55a8 100644 --- a/src/widgets/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -243,10 +243,10 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::ShortcutOverride: return new QKeyEvent(*static_cast(e)); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::WhatsThisClicked: return new QWhatsThisClickedEvent(*static_cast(e)); -#endif //QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_TOOLBAR case QEvent::ToolBarChange: diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 7e24704de33..863c1e9bbeb 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -60,7 +60,6 @@ #include "qvalidator.h" #include "qvariant.h" #include "qvector.h" -#include "qwhatsthis.h" #include "qdebug.h" #include "qtextedit.h" #include diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index a8cdca1719a..b4f2c97e049 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -153,7 +153,9 @@ #include #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include #include @@ -1490,7 +1492,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() Q_Q(QMdiSubWindow); switch (activeSubControl) { case QStyle::SC_TitleBarContextHelpButton: -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QWhatsThis::enterWhatsThisMode(); #endif break; diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 95bb9765668..0b874cb09a9 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -59,7 +59,7 @@ #ifndef QT_NO_EFFECTS # include #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) # include #endif @@ -187,7 +187,7 @@ private: void QMenuPrivate::init() { Q_Q(QMenu); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) q->setAttribute(Qt::WA_CustomWhatsThis); #endif q->setAttribute(Qt::WA_X11NetWmWindowTypePopupMenu); @@ -1327,12 +1327,12 @@ void QMenuPrivate::activateCausedStack(const QVector > &caused void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e, bool self) { Q_Q(QMenu); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) bool inWhatsThisMode = QWhatsThis::inWhatsThisMode(); #endif if (!action || !q->isEnabled() || (action_e == QAction::Trigger -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) && !inWhatsThisMode #endif && (action->isSeparator() ||!action->isEnabled()))) @@ -1343,7 +1343,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e */ const QVector > causedStack = calcCausedStack(); if (action_e == QAction::Trigger) { -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (!inWhatsThisMode) actionAboutToTrigger = action; #endif @@ -1362,7 +1362,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e } } -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (inWhatsThisMode) { QString s = action->whatsThis(); if (s.isEmpty()) @@ -2971,7 +2971,7 @@ QMenu::event(QEvent *e) } break; #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: e->setAccepted(d->whatsThis.size()); if (QAction *action = d->actionAt(static_cast(e)->pos())) { @@ -3233,7 +3233,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) key_consumed = true; break; } -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case Qt::Key_F1: if (!d->currentAction || d->currentAction->whatsThis().isNull()) break; diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index c16b2a5ac13..8ec2a3ed94d 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -52,7 +52,9 @@ #include #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include "private/qguiapplication_p.h" #include "qpa/qplatformintegration.h" @@ -1013,7 +1015,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) QAction *action = d->actionAt(e->pos()); if (!action || !d->isVisible(action) || !action->isEnabled()) { d->setCurrentAction(0); -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) if (QWhatsThis::inWhatsThisMode()) QWhatsThis::showText(e->globalPos(), d->whatsThis, this); #endif @@ -1432,7 +1434,7 @@ bool QMenuBar::event(QEvent *e) } break; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) case QEvent::QueryWhatsThis: e->setAccepted(d->whatsThis.size()); if (QAction *action = d->actionAt(static_cast(e)->pos())) { diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 85bc9a4a09c..9e803f43889 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -49,7 +49,9 @@ #include "qstylepainter.h" #include "qtabwidget.h" #include "qtooltip.h" +#if QT_CONFIG(whatsthis) #include "qwhatsthis.h" +#endif #include "private/qtextengine_p.h" #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" @@ -1220,7 +1222,7 @@ QString QTabBar::tabToolTip(int index) const } #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \since 4.1 @@ -1248,7 +1250,7 @@ QString QTabBar::tabWhatsThis(int index) const return QString(); } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) /*! Sets the data of the tab at position \a index to \a data. @@ -1628,7 +1630,7 @@ bool QTabBar::event(QEvent *event) } } #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) } else if (event->type() == QEvent::QueryWhatsThis) { const QTabBarPrivate::Tab *tab = d->at(d->indexAtPos(static_cast(event)->pos())); if (!tab || tab->whatsThis.isEmpty()) @@ -1642,7 +1644,7 @@ bool QTabBar::event(QEvent *event) return true; } } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) #ifndef QT_NO_SHORTCUT } else if (event->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast(event); diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index c7d9f95d93a..2a27a986615 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -123,7 +123,7 @@ public: QString tabToolTip(int index) const; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void setTabWhatsThis(int index, const QString &text); QString tabWhatsThis(int index) const; #endif diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 7c653a95e95..354c2fc05a8 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -118,7 +118,7 @@ public: #ifndef QT_NO_TOOLTIP QString toolTip; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QString whatsThis; #endif QIcon icon; diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 7c75f859edd..c84c78275d8 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -1163,7 +1163,7 @@ QString QTabWidget::tabToolTip(int index) const } #endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) /*! \since 4.1 @@ -1187,7 +1187,7 @@ QString QTabWidget::tabWhatsThis(int index) const Q_D(const QTabWidget); return d->tabs->tabWhatsThis(index); } -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) /*! This virtual handler is called after a new tab was added or diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h index 59fcea223f2..7d8864241ab 100644 --- a/src/widgets/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -94,7 +94,7 @@ public: QString tabToolTip(int index) const; #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) void setTabWhatsThis(int index, const QString &text); QString tabWhatsThis(int index) const; #endif diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index df92fc0e1e4..902a6afb8aa 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -52,7 +52,9 @@ #include #include #include +#if QT_CONFIG(whatsthis) #include +#endif #include #include @@ -307,7 +309,7 @@ void QTextBrowserPrivate::setSource(const QUrl &url) #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) QWhatsThis::showText(QCursor::pos(), txt, q); #endif return; diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 80a061e6d55..1d06f57d7b1 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -922,7 +922,7 @@ void QToolButton::setDefaultAction(QAction *action) #ifndef QT_NO_STATUSTIP setStatusTip(action->statusTip()); #endif -#ifndef QT_NO_WHATSTHIS +#if QT_CONFIG(whatsthis) setWhatsThis(action->whatsThis()); #endif #ifndef QT_NO_MENU From 1ebe68b01f6ab7e32f4f383d979588842b050dfb Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 20:25:50 +0200 Subject: [PATCH 61/82] Convert features.filedialog to QT_[REQUIRE_]CONFIG Change-Id: I9bc229b0d1430b81eeb2cfca2b24474736d5d561 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/cocoa/cocoa.pro | 9 +++++++-- .../platforms/cocoa/qcocoafiledialoghelper.h | 3 +++ .../platforms/cocoa/qcocoafiledialoghelper.mm | 4 ---- .../platforms/cocoa/qcocoaintegration.mm | 8 +++++++- src/plugins/platforms/cocoa/qcocoatheme.mm | 10 ++++++++-- .../dialogs/qprintdialog_unix.cpp | 4 +++- .../dialogs/qprintpreviewdialog.cpp | 2 ++ src/widgets/dialogs/dialogs.pri | 20 ++++++++++++------- src/widgets/dialogs/qdialog.cpp | 4 +++- src/widgets/dialogs/qfiledialog.cpp | 3 --- src/widgets/dialogs/qfiledialog.h | 8 ++------ src/widgets/dialogs/qfiledialog_p.h | 6 ++---- src/widgets/dialogs/qsidebar.cpp | 4 ---- src/widgets/dialogs/qsidebar_p.h | 4 +--- .../kernel/qprinter/tst_qprinter.cpp | 4 ++-- 15 files changed, 53 insertions(+), 40 deletions(-) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 62935210be7..0f478a79f33 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -21,7 +21,6 @@ OBJECTIVE_SOURCES += main.mm \ qcocoaaccessibilityelement.mm \ qcocoaaccessibility.mm \ qcocoacolordialoghelper.mm \ - qcocoafiledialoghelper.mm \ qcocoafontdialoghelper.mm \ qcocoacursor.mm \ qcocoaclipboard.mm \ @@ -56,7 +55,6 @@ HEADERS += qcocoaintegration.h \ qcocoaaccessibilityelement.h \ qcocoaaccessibility.h \ qcocoacolordialoghelper.h \ - qcocoafiledialoghelper.h \ qcocoafontdialoghelper.h \ qcocoacursor.h \ qcocoaclipboard.h \ @@ -89,6 +87,8 @@ QT += \ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { + QT_FOR_CONFIG += widgets + OBJECTIVE_SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ @@ -101,6 +101,11 @@ qtHaveModule(widgets) { qcocoaprintersupport.h \ qcocoaprintdevice.h \ + qtConfig(filedialog) { + SOURCES += qcocoafiledialoghelper.mm + HEADERS += qcocoafiledialoghelper.h + } + QT += widgets-private printsupport-private } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h index 1cff6f97bab..f5ba1dc22e1 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h @@ -41,8 +41,11 @@ #define QCOCOAFILEDIALOGHELPER_H #include +#include #include +QT_REQUIRE_CONFIG(filedialog); + Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)); QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4ba3dcb9a68..74148b7cbf9 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -41,8 +41,6 @@ #include "qcocoafiledialoghelper.h" -#ifndef QT_NO_FILEDIALOG - /***************************************************************************** QFileDialog debug facilities *****************************************************************************/ @@ -775,5 +773,3 @@ bool QCocoaFileDialogHelper::defaultNameFilterDisables() const } QT_END_NAMESPACE - -#endif // QT_NO_FILEDIALOG diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index d48ec8c6f7a..bac49cfad9e 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -47,7 +47,6 @@ #include "qcocoahelpers.h" #include "qcocoaapplication.h" #include "qcocoaapplicationdelegate.h" -#include "qcocoafiledialoghelper.h" #include "qcocoatheme.h" #include "qcocoainputcontext.h" #include "qcocoamimetypes.h" @@ -60,6 +59,13 @@ #include +#ifdef QT_WIDGETS_LIB +#include +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include static void initResources() diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index d2345f9abcd..53ccf68c0c7 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -45,7 +45,6 @@ #include #include "qcocoacolordialoghelper.h" -#include "qcocoafiledialoghelper.h" #include "qcocoafontdialoghelper.h" #include "qcocoasystemsettings.h" #include "qcocoasystemtrayicon.h" @@ -63,6 +62,13 @@ #include #include +#ifdef QT_WIDGETS_LIB +#include +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include @interface QT_MANGLE_NAMESPACE(QCocoaThemeNotificationReceiver) : NSObject { @@ -138,7 +144,7 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const { switch (dialogType) { -#ifndef QT_NO_FILEDIALOG +#if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog) case QPlatformTheme::FileDialog: return new QCocoaFileDialogHelper(); #endif diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 32a06a4f7e2..d80cc1fa3d3 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -43,7 +43,9 @@ #include "private/qabstractprintdialog_p.h" #include #include "qprintdialog.h" +#if QT_CONFIG(filedialog) #include "qfiledialog.h" +#endif #include #include #include @@ -780,7 +782,7 @@ void QUnixPrintWidgetPrivate::setOptionsPane(QPrintDialogPrivate *pane) void QUnixPrintWidgetPrivate::_q_btnBrowseClicked() { QString filename = widget.filename->text(); -#ifndef QT_NO_FILEDIALOG +#if QT_CONFIG(filedialog) filename = QFileDialog::getSaveFileName(parent, QPrintDialog::tr("Print To File ..."), filename, QString(), 0, QFileDialog::DontConfirmOverwrite); #else diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp index fd23aea4603..dbcbaf3ce5c 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.cpp +++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp @@ -51,7 +51,9 @@ #include #include #include +#if QT_CONFIG(filedialog) #include +#endif #include #include #include diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index c9438696fa4..584aef1da1c 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -4,14 +4,11 @@ HEADERS += \ dialogs/qcolordialog.h \ dialogs/qfscompleter_p.h \ dialogs/qerrormessage.h \ - dialogs/qfiledialog.h \ - dialogs/qfiledialog_p.h \ dialogs/qfontdialog.h \ dialogs/qfontdialog_p.h \ dialogs/qinputdialog.h \ dialogs/qmessagebox.h \ dialogs/qprogressdialog.h \ - dialogs/qsidebar_p.h \ dialogs/qfilesystemmodel.h \ dialogs/qfilesystemmodel_p.h \ dialogs/qfileinfogatherer_p.h \ @@ -22,18 +19,14 @@ win32 { SOURCES += dialogs/qwizard_win.cpp } -FORMS += dialogs/qfiledialog.ui - INCLUDEPATH += $$PWD SOURCES += \ dialogs/qcolordialog.cpp \ dialogs/qerrormessage.cpp \ - dialogs/qfiledialog.cpp \ dialogs/qfontdialog.cpp \ dialogs/qinputdialog.cpp \ dialogs/qmessagebox.cpp \ dialogs/qprogressdialog.cpp \ - dialogs/qsidebar.cpp \ dialogs/qfilesystemmodel.cpp \ dialogs/qfileinfogatherer.cpp \ dialogs/qwizard.cpp \ @@ -47,4 +40,17 @@ qtConfig(dialog) { dialogs/qdialog.cpp } +qtConfig(filedialog) { + HEADERS += \ + dialogs/qfiledialog.h \ + dialogs/qfiledialog_p.h \ + dialogs/qsidebar_p.h + + SOURCES += \ + dialogs/qfiledialog.cpp \ + dialogs/qsidebar.cpp + + FORMS += dialogs/qfiledialog.ui +} + RESOURCES += dialogs/qmessagebox.qrc diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index a6e9cda8ce4..6169951b49d 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -39,7 +39,9 @@ #include "qcolordialog.h" #include "qfontdialog.h" +#if QT_CONFIG(filedialog) #include "qfiledialog.h" +#endif #include "qevent.h" #include "qdesktopwidget.h" @@ -64,7 +66,7 @@ QT_BEGIN_NAMESPACE static inline int themeDialogType(const QDialog *dialog) { -#ifndef QT_NO_FILEDIALOG +#if QT_CONFIG(filedialog) if (qobject_cast(dialog)) return QPlatformTheme::FileDialog; #endif diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 98f8147236d..5c4b42a470c 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -43,7 +43,6 @@ #include #include "qfiledialog.h" -#ifndef QT_NO_FILEDIALOG #include "qfiledialog_p.h" #include #include @@ -4134,5 +4133,3 @@ QStringList QFSCompleter::splitPath(const QString &path) const QT_END_NAMESPACE #include "moc_qfiledialog.cpp" - -#endif // QT_NO_FILEDIALOG diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 733dd030926..b9092e036d8 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -44,13 +44,11 @@ #include #include #include - -#ifndef QT_NO_FILEDIALOG - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(filedialog); +QT_BEGIN_NAMESPACE class QModelIndex; class QItemSelection; @@ -316,6 +314,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options) QT_END_NAMESPACE -#endif // QT_NO_FILEDIALOG - #endif // QFILEDIALOG_H diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index d5df7542b6c..d06a089e42d 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -53,8 +53,6 @@ #include -#ifndef QT_NO_FILEDIALOG - #include "qfiledialog.h" #include "private/qdialog_p.h" #include "qplatformdefs.h" @@ -81,6 +79,8 @@ #include #endif +QT_REQUIRE_CONFIG(filedialog); + QT_BEGIN_NAMESPACE class QFileDialogListView; @@ -432,6 +432,4 @@ QString QFileDialogPrivate::selectedNameFilter_sys() const QT_END_NAMESPACE -#endif // QT_NO_FILEDIALOG - #endif // QFILEDIALOG_P_H diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index 9bb046db615..b8b042ddb5e 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -40,8 +40,6 @@ #include "qsidebar_p.h" #include "qfilesystemmodel.h" -#ifndef QT_NO_FILEDIALOG - #include #include #include @@ -518,5 +516,3 @@ bool QSidebar::event(QEvent * event) QT_END_NAMESPACE #include "moc_qsidebar_p.cpp" - -#endif diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h index ee57f2fb48f..17d576e54d7 100644 --- a/src/widgets/dialogs/qsidebar_p.h +++ b/src/widgets/dialogs/qsidebar_p.h @@ -58,7 +58,7 @@ #include #include -#ifndef QT_NO_FILEDIALOG +QT_REQUIRE_CONFIG(filedialog); QT_BEGIN_NAMESPACE @@ -159,7 +159,5 @@ private: QT_END_NAMESPACE -#endif // QT_NO_FILEDIALOG - #endif // QSIDEBAR_H diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index eb056475d13..3a6102f2faa 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -94,7 +94,7 @@ private slots: void customPaperSizeAndMargins(); void customPaperNameSettingBySize(); void customPaperNameSettingByName(); -#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG) +#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog) void printDialogCompleter(); #endif void testCurrentPage(); @@ -601,7 +601,7 @@ void tst_QPrinter::customPaperSizeAndMargins() } } -#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG) +#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog) void tst_QPrinter::printDialogCompleter() { QPrintDialog dialog; From fd4f9c5e0cba786b34225718f9bb7bf1a1bafec1 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 20:43:59 +0200 Subject: [PATCH 62/82] Convert features.progressdialog to QT_[REQUIRE_]CONFIG Change-Id: Ic12a30480260e426f106baf7e2121889ea01db88 Reviewed-by: Oswald Buddenhagen --- src/widgets/dialogs/dialogs.pri | 7 +++++-- src/widgets/dialogs/qprogressdialog.cpp | 4 ---- src/widgets/dialogs/qprogressdialog.h | 7 ++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index 584aef1da1c..9307a800097 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -8,7 +8,6 @@ HEADERS += \ dialogs/qfontdialog_p.h \ dialogs/qinputdialog.h \ dialogs/qmessagebox.h \ - dialogs/qprogressdialog.h \ dialogs/qfilesystemmodel.h \ dialogs/qfilesystemmodel_p.h \ dialogs/qfileinfogatherer_p.h \ @@ -26,7 +25,6 @@ SOURCES += \ dialogs/qfontdialog.cpp \ dialogs/qinputdialog.cpp \ dialogs/qmessagebox.cpp \ - dialogs/qprogressdialog.cpp \ dialogs/qfilesystemmodel.cpp \ dialogs/qfileinfogatherer.cpp \ dialogs/qwizard.cpp \ @@ -53,4 +51,9 @@ qtConfig(filedialog) { FORMS += dialogs/qfiledialog.ui } +qtConfig(progressdialog) { + HEADERS += dialogs/qprogressdialog.h + SOURCES += dialogs/qprogressdialog.cpp +} + RESOURCES += dialogs/qmessagebox.qrc diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 26a8fcc92df..893920cbd91 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -39,8 +39,6 @@ #include "qprogressdialog.h" -#ifndef QT_NO_PROGRESSDIALOG - #include "qshortcut.h" #include "qpainter.h" #include "qdrawutil.h" @@ -886,5 +884,3 @@ void QProgressDialog::open(QObject *receiver, const char *member) QT_END_NAMESPACE #include "moc_qprogressdialog.cpp" - -#endif // QT_NO_PROGRESSDIALOG diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h index f4e63fb0885..902a4de5d2e 100644 --- a/src/widgets/dialogs/qprogressdialog.h +++ b/src/widgets/dialogs/qprogressdialog.h @@ -42,12 +42,11 @@ #include -#ifndef QT_NO_PROGRESSDIALOG - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(progressdialog); +QT_BEGIN_NAMESPACE class QPushButton; class QLabel; @@ -130,6 +129,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PROGRESSDIALOG - #endif // QPROGRESSDIALOG_H From 003dc8e29a89c18729fc696ea9ca224645e792fd Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 20:52:39 +0200 Subject: [PATCH 63/82] Convert features.inputdialog to QT_[REQUIRE_]CONFIG Change-Id: Ie480efcfc1fdc00e2b2697cf4c5abb231b42cc0e Reviewed-by: Oswald Buddenhagen --- src/widgets/dialogs/dialogs.pri | 7 +++++-- src/widgets/dialogs/qfiledialog.cpp | 1 - src/widgets/dialogs/qinputdialog.cpp | 4 ---- src/widgets/dialogs/qinputdialog.h | 7 ++----- src/widgets/styles/qwindowsvistastyle.cpp | 12 ++++++------ 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index 9307a800097..b745607c906 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -6,7 +6,6 @@ HEADERS += \ dialogs/qerrormessage.h \ dialogs/qfontdialog.h \ dialogs/qfontdialog_p.h \ - dialogs/qinputdialog.h \ dialogs/qmessagebox.h \ dialogs/qfilesystemmodel.h \ dialogs/qfilesystemmodel_p.h \ @@ -23,7 +22,6 @@ SOURCES += \ dialogs/qcolordialog.cpp \ dialogs/qerrormessage.cpp \ dialogs/qfontdialog.cpp \ - dialogs/qinputdialog.cpp \ dialogs/qmessagebox.cpp \ dialogs/qfilesystemmodel.cpp \ dialogs/qfileinfogatherer.cpp \ @@ -51,6 +49,11 @@ qtConfig(filedialog) { FORMS += dialogs/qfiledialog.ui } +qtConfig(inputdialog) { + HEADERS += dialogs/qinputdialog.h + SOURCES += dialogs/qinputdialog.cpp +} + qtConfig(progressdialog) { HEADERS += dialogs/qprogressdialog.h SOURCES += dialogs/qprogressdialog.cpp diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 5c4b42a470c..61ee933dc64 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp index 47551ae6fd8..04d13045e59 100644 --- a/src/widgets/dialogs/qinputdialog.cpp +++ b/src/widgets/dialogs/qinputdialog.cpp @@ -39,8 +39,6 @@ #include "qinputdialog.h" -#ifndef QT_NO_INPUTDIALOG - #include "qapplication.h" #include "qcombobox.h" #include "qdialogbuttonbox.h" @@ -1507,5 +1505,3 @@ QT_END_NAMESPACE #include "qinputdialog.moc" #include "moc_qinputdialog.cpp" - -#endif // QT_NO_INPUTDIALOG diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h index 7b43e774a7c..5f067858861 100644 --- a/src/widgets/dialogs/qinputdialog.h +++ b/src/widgets/dialogs/qinputdialog.h @@ -44,12 +44,11 @@ #include #include -#ifndef QT_NO_INPUTDIALOG - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(inputdialog); +QT_BEGIN_NAMESPACE class QInputDialogPrivate; @@ -212,6 +211,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions) QT_END_NAMESPACE -#endif // QT_NO_INPUTDIALOG - #endif // QINPUTDIALOG_H diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index a1aabc20c6c..ae1b83957cc 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -780,10 +780,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt if (qobject_cast (widget)) buttonBox = widget->findChild(QLatin1String("qt_msgbox_buttonbox")); -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast (widget)) buttonBox = widget->findChild(QLatin1String("qt_inputdlg_buttonbox")); -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) if (buttonBox) { //draw white panel part @@ -2324,7 +2324,7 @@ void QWindowsVistaStyle::polish(QWidget *widget) buttonBox->setContentsMargins(0, 9, 0, 0); #endif } -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast (widget)) { widget->setAttribute(Qt::WA_StyledBackground); #if QT_CONFIG(dialogbuttonbox) @@ -2333,7 +2333,7 @@ void QWindowsVistaStyle::polish(QWidget *widget) buttonBox->setContentsMargins(0, 9, 0, 0); #endif } -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) else if (QTreeView *tree = qobject_cast (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover); } @@ -2368,7 +2368,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) buttonBox->setContentsMargins(0, 0, 0, 0); #endif } -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast (widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); #if QT_CONFIG(dialogbuttonbox) @@ -2377,7 +2377,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) buttonBox->setContentsMargins(0, 0, 0, 0); #endif } -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) else if (QTreeView *tree = qobject_cast (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover, false); } else if (qobject_cast(widget)) { From 63cc734abb7b31a73c60767b9af521783c102bd4 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 31 May 2017 20:43:28 +0200 Subject: [PATCH 64/82] Convert features.messagebox to QT_[REQUIRE_]CONFIG Change-Id: Ie25dc672f8a675c06585c7757255f7dbadbfc5ec Reviewed-by: Oswald Buddenhagen --- src/printsupport/dialogs/qprintdialog.h | 4 ++-- .../dialogs/qprintdialog_unix.cpp | 14 ++++++----- src/widgets/dialogs/dialogs.pri | 10 ++++---- src/widgets/dialogs/qdialog.cpp | 4 +++- src/widgets/dialogs/qerrormessage.cpp | 4 +++- src/widgets/dialogs/qfiledialog.cpp | 24 ++++++++++--------- src/widgets/dialogs/qfilesystemmodel.cpp | 6 +++-- src/widgets/dialogs/qmessagebox.cpp | 4 ---- src/widgets/dialogs/qmessagebox.h | 7 ++---- src/widgets/kernel/qapplication.cpp | 6 +++-- 10 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h index 53a6224f49d..5b81440a3c0 100644 --- a/src/printsupport/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -94,9 +94,9 @@ private: #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool)) Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog()) -# if !defined(QT_NO_MESSAGEBOX) +#if QT_CONFIG(messagebox) Q_PRIVATE_SLOT(d_func(), void _q_checkFields()) -# endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) friend class QUnixPrintWidget; # endif // Q_OS_UNIX }; diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index d80cc1fa3d3..1af682f74a6 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -41,7 +41,9 @@ #include #include "private/qabstractprintdialog_p.h" +#if QT_CONFIG(messagebox) #include +#endif #include "qprintdialog.h" #if QT_CONFIG(filedialog) #include "qfiledialog.h" @@ -203,7 +205,7 @@ public: void selectPrinter(const QPrinter::OutputFormat outputFormat); void _q_togglePageSetCombo(bool); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) void _q_checkFields(); #endif void _q_collapseOrExpandDialog(); @@ -337,7 +339,7 @@ void QPrintDialogPrivate::init() lay->addWidget(bottom); lay->addWidget(buttons); -#ifdef QT_NO_MESSAGEBOX +#if !QT_CONFIG(messagebox) QObject::connect(buttons, SIGNAL(accepted()), q, SLOT(accept())); #else QObject::connect(buttons, SIGNAL(accepted()), q, SLOT(_q_checkFields())); @@ -496,14 +498,14 @@ void QPrintDialogPrivate::_q_collapseOrExpandDialog() } } -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) void QPrintDialogPrivate::_q_checkFields() { Q_Q(QPrintDialog); if (top->d->checkFields()) q->accept(); } -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) void QPrintDialogPrivate::updateWidgets() @@ -836,7 +838,7 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties() propertiesDialog->applyPrinterProperties(printer); } -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) bool QUnixPrintWidgetPrivate::checkFields() { if (widget.filename->isEnabled()) { @@ -887,7 +889,7 @@ bool QUnixPrintWidgetPrivate::checkFields() // Every test passed. Accept the dialog. return true; } -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) void QUnixPrintWidgetPrivate::setupPrinterProperties() { diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index b745607c906..1ea5403b797 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -6,7 +6,6 @@ HEADERS += \ dialogs/qerrormessage.h \ dialogs/qfontdialog.h \ dialogs/qfontdialog_p.h \ - dialogs/qmessagebox.h \ dialogs/qfilesystemmodel.h \ dialogs/qfilesystemmodel_p.h \ dialogs/qfileinfogatherer_p.h \ @@ -22,7 +21,6 @@ SOURCES += \ dialogs/qcolordialog.cpp \ dialogs/qerrormessage.cpp \ dialogs/qfontdialog.cpp \ - dialogs/qmessagebox.cpp \ dialogs/qfilesystemmodel.cpp \ dialogs/qfileinfogatherer.cpp \ dialogs/qwizard.cpp \ @@ -54,9 +52,13 @@ qtConfig(inputdialog) { SOURCES += dialogs/qinputdialog.cpp } +qtConfig(messagebox) { + HEADERS += dialogs/qmessagebox.h + SOURCES += dialogs/qmessagebox.cpp + RESOURCES += dialogs/qmessagebox.qrc +} + qtConfig(progressdialog) { HEADERS += dialogs/qprogressdialog.h SOURCES += dialogs/qprogressdialog.cpp } - -RESOURCES += dialogs/qmessagebox.qrc diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 6169951b49d..e1a38438d14 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -53,7 +53,9 @@ #endif #include "qmenu.h" #include "qcursor.h" +#if QT_CONFIG(messagebox) #include "qmessagebox.h" +#endif #include "qerrormessage.h" #include #include "private/qdialog_p.h" @@ -78,7 +80,7 @@ static inline int themeDialogType(const QDialog *dialog) if (qobject_cast(dialog)) return QPlatformTheme::FontDialog; #endif -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) if (qobject_cast(dialog)) return QPlatformTheme::MessageDialog; #endif diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 4ec4da6e1af..38f0954b1c3 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -45,7 +45,9 @@ #include "qcheckbox.h" #include "qlabel.h" #include "qlayout.h" +#if QT_CONFIG(messagebox) #include "qmessagebox.h" +#endif #include "qpushbutton.h" #include "qstringlist.h" #include "qtextedit.h" @@ -234,7 +236,7 @@ QErrorMessage::QErrorMessage(QWidget * parent) grid->setColumnStretch(1, 42); grid->setRowStretch(0, 42); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information)); d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); #endif diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 61ee933dc64..0c609dc5f7f 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -51,7 +51,9 @@ #include #include #include +#if QT_CONFIG(messagebox) #include +#endif #include #include #include @@ -2627,11 +2629,11 @@ void QFileDialog::accept() if (!info.exists()) info = QFileInfo(d->getEnvironmentVariable(fn)); if (!info.exists()) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QString message = tr("%1\nDirectory not found.\nPlease verify the " "correct directory name was given."); QMessageBox::warning(this, windowTitle(), message.arg(info.fileName())); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) return; } if (info.isDir()) { @@ -2659,7 +2661,7 @@ void QFileDialog::accept() if (!info.exists() || !confirmOverwrite() || acceptMode() == AcceptOpen) { d->emitFilesSelected(QStringList(fn)); QDialog::accept(); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) } else { if (QMessageBox::warning(this, windowTitle(), tr("%1 already exists.\nDo you want to replace it?") @@ -2681,11 +2683,11 @@ void QFileDialog::accept() if (!info.exists()) info = QFileInfo(d->getEnvironmentVariable(file)); if (!info.exists()) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QString message = tr("%1\nFile not found.\nPlease verify the " "correct file name was given."); QMessageBox::warning(this, windowTitle(), message.arg(info.fileName())); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) return; } if (info.isDir()) { @@ -3428,7 +3430,7 @@ void QFileDialogPrivate::_q_deleteCurrent() bool isDir = model->isDir(index); QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt()); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) Q_Q(QFileDialog); if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") @@ -3444,12 +3446,12 @@ void QFileDialogPrivate::_q_deleteCurrent() #else if (!(p & QFile::WriteUser)) return; -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) // the event loop has run, we can NOT reuse index because the model might have removed it. if (isDir) { if (!removeDirectory(filePath)) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QMessageBox::warning(q, q->windowTitle(), QFileDialog::tr("Could not delete directory.")); #endif @@ -3630,7 +3632,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index) */ void QFileDialogPrivate::_q_goToDirectory(const QString &path) { - #ifndef QT_NO_MESSAGEBOX + #if QT_CONFIG(messagebox) Q_Q(QFileDialog); #endif QModelIndex index = qFileDialogUi->lookInCombo->model()->index(qFileDialogUi->lookInCombo->currentIndex(), @@ -3649,12 +3651,12 @@ void QFileDialogPrivate::_q_goToDirectory(const QString &path) if (dir.exists() || path2.isEmpty() || path2 == model->myComputer().toString()) { _q_enterDirectory(index); -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) } else { QString message = QFileDialog::tr("%1\nDirectory not found.\nPlease verify the " "correct directory name was given."); QMessageBox::warning(q, q->windowTitle(), message.arg(path2)); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) } } diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index db1ce3fe0e0..0ada9c6c58a 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -43,7 +43,9 @@ #include #include #include +#if QT_CONFIG(messagebox) #include +#endif #include #include @@ -881,12 +883,12 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in if (newName.isEmpty() || QDir::toNativeSeparators(newName).contains(QDir::separator()) || !QDir(parentPath).rename(oldName, newName)) { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"), QFileSystemModel::tr("The name \"%1\" can not be used.

Try using another name, with fewer characters or no punctuations marks.") .arg(newName), QMessageBox::Ok); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) return false; } else { /* diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 7a98fae99c0..843a1bf341f 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -39,8 +39,6 @@ #include -#ifndef QT_NO_MESSAGEBOX - #include #include "private/qlabel_p.h" #include "private/qapplication_p.h" @@ -2737,5 +2735,3 @@ QT_END_NAMESPACE #include "moc_qmessagebox.cpp" #include "qmessagebox.moc" - -#endif // QT_NO_MESSAGEBOX diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index 40e5c701fef..6d5179602b5 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -42,12 +42,11 @@ #include -#ifndef QT_NO_MESSAGEBOX - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(messagebox); +QT_BEGIN_NAMESPACE class QLabel; class QMessageBoxPrivate; @@ -325,6 +324,4 @@ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplicatio QT_END_NAMESPACE -#endif // QT_NO_MESSAGEBOX - #endif // QMESSAGEBOX_H diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 01bd1c5033a..9f90fe4d00e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -65,7 +65,9 @@ #include "qdebug.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" +#if QT_CONFIG(messagebox) #include "qmessagebox.h" +#endif #include "qwidgetwindow_p.h" #include #include @@ -1916,9 +1918,9 @@ void QApplication::closeAllWindows() */ void QApplication::aboutQt() { -#ifndef QT_NO_MESSAGEBOX +#if QT_CONFIG(messagebox) QMessageBox::aboutQt(activeWindow()); -#endif // QT_NO_MESSAGEBOX +#endif // QT_CONFIG(messagebox) } /*! From bf6f91e527e0fec49a8cd82eb4b9a55ff3db6d98 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 12 Jun 2017 08:44:53 +0200 Subject: [PATCH 65/82] Convert features.statustip to QT_CONFIG Change-Id: Ic719ab93ed1802fcc713885ad0421cb44c7a998b Reviewed-by: Oswald Buddenhagen --- examples/widgets/widgets/tablet/tabletcanvas.cpp | 4 ++-- src/widgets/itemviews/qabstractitemview.cpp | 6 +++--- src/widgets/itemviews/qheaderview.cpp | 4 ++-- src/widgets/itemviews/qtreewidget.h | 2 +- src/widgets/kernel/qaction.cpp | 2 +- src/widgets/kernel/qapplication.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 8 ++++---- src/widgets/kernel/qwidget.h | 4 ++-- src/widgets/kernel/qwidget_p.h | 2 +- src/widgets/statemachine/qguistatemachine.cpp | 4 ++-- src/widgets/widgets/qmainwindow.cpp | 4 ++-- src/widgets/widgets/qmenu.cpp | 2 +- src/widgets/widgets/qmenubar.cpp | 4 ++-- src/widgets/widgets/qtoolbutton.cpp | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp index 03e05e42f68..90b3222970a 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp @@ -188,7 +188,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) case QTabletEvent::FourDMouse: { const QString error(tr("This input device is not supported by the example.")); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QStatusTipEvent status(error); QApplication::sendEvent(this, &status); #else @@ -199,7 +199,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) default: { const QString error(tr("Unknown tablet device - treating as stylus")); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QStatusTipEvent status(error); QApplication::sendEvent(this, &status); #else diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index e8db2282561..c8fdf06d64f 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -173,7 +173,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index if (index.isValid()) { emit q->entered(index); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QString statustip = model->data(index, Qt::StatusTipRole).toString(); if (parent && (shouldClearStatusTip || !statustip.isEmpty())) { QStatusTipEvent tip(statustip); @@ -182,7 +182,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index } #endif } else { -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) if (parent && shouldClearStatusTip) { QString emptyString; QStatusTipEvent tip( emptyString ); @@ -1703,7 +1703,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event) break; case QEvent::Leave: d->setHoverIndex(QModelIndex()); // If we've left, no hover should be needed anymore - #ifndef QT_NO_STATUSTIP + #if QT_CONFIG(statustip) if (d->shouldClearStatusTip && d->parent) { QString empty; QStatusTipEvent tip(empty); diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index c31b00959d5..6a6991ebb81 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2664,7 +2664,7 @@ bool QHeaderView::viewportEvent(QEvent *e) } break; } #endif // QT_CONFIG(whatsthis) -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) case QEvent::StatusTip: { QHelpEvent *he = static_cast(e); int logical = logicalIndexAt(he->pos()); @@ -2675,7 +2675,7 @@ bool QHeaderView::viewportEvent(QEvent *e) setStatusTip(statustip); } return true; } -#endif // QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) case QEvent::FontChange: case QEvent::StyleChange: d->invalidateCachedSizeHint(); diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index d258f76621f..3bdeae08d88 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -224,7 +224,7 @@ inline void QTreeWidgetItem::setText(int column, const QString &atext) inline void QTreeWidgetItem::setIcon(int column, const QIcon &aicon) { setData(column, Qt::DecorationRole, aicon); } -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) inline void QTreeWidgetItem::setStatusTip(int column, const QString &astatusTip) { setData(column, Qt::StatusTipRole, astatusTip); } #endif diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 4582a553946..7dd2f72f034 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -91,7 +91,7 @@ QActionPrivate::~QActionPrivate() bool QActionPrivate::showStatusText(QWidget *widget, const QString &str) { -#ifdef QT_NO_STATUSTIP +#if !QT_CONFIG(statustip) Q_UNUSED(widget); Q_UNUSED(str); #else diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 9f90fe4d00e..6536da4e90c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3408,7 +3408,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; #endif -#if !defined(QT_NO_STATUSTIP) || QT_CONFIG(whatsthis) +#if QT_CONFIG(statustip) || QT_CONFIG(whatsthis) case QEvent::StatusTip: case QEvent::WhatsThisClicked: { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 3104f72e82d..1265052281b 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8923,7 +8923,7 @@ bool QWidget::event(QEvent *event) break; case QEvent::Enter: -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) if (d->statusTip.size()) { QStatusTipEvent tip(d->statusTip); QApplication::sendEvent(const_cast(this), &tip); @@ -8933,7 +8933,7 @@ bool QWidget::event(QEvent *event) break; case QEvent::Leave: -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) if (d->statusTip.size()) { QString empty; QStatusTipEvent tip(empty); @@ -11559,7 +11559,7 @@ int QWidget::toolTipDuration() const #endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) /*! \property QWidget::statusTip \brief the widget's status tip @@ -11579,7 +11579,7 @@ QString QWidget::statusTip() const Q_D(const QWidget); return d->statusTip; } -#endif // QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) #if QT_CONFIG(whatsthis) /*! diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 48bc1203248..87a841c7295 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -183,7 +183,7 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) Q_PROPERTY(int toolTipDuration READ toolTipDuration WRITE setToolTipDuration) #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip) #endif #if QT_CONFIG(whatsthis) @@ -386,7 +386,7 @@ public: void setToolTipDuration(int msec); int toolTipDuration() const; #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) void setStatusTip(const QString &); QString statusTip() const; #endif diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index cc0940fc088..da3e9bd2f68 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -694,7 +694,7 @@ public: QString toolTip; int toolTipDuration; #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QString statusTip; #endif #if QT_CONFIG(whatsthis) diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp index bbe723a55a8..543011b7541 100644 --- a/src/widgets/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -223,10 +223,10 @@ static QEvent *cloneEvent(QEvent *e) return new QHelpEvent(*static_cast(e)); case QEvent::WhatsThis: return new QHelpEvent(*static_cast(e)); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) case QEvent::StatusTip: return new QStatusTipEvent(*static_cast(e)); -#endif //QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) #ifndef QT_NO_ACTION case QEvent::ActionChanged: case QEvent::ActionAdded: diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index c9349ac72d0..2cc7ce35dae 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1498,7 +1498,7 @@ bool QMainWindow::event(QEvent *event) } #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) case QEvent::StatusTip: #ifndef QT_NO_STATUSBAR if (QStatusBar *sb = d->layout->statusBar()) @@ -1507,7 +1507,7 @@ bool QMainWindow::event(QEvent *event) #endif static_cast(event)->ignore(); return true; -#endif // QT_NO_STATUSTIP +#endif // QT_CONFIG(statustip) case QEvent::StyleChange: #ifndef QT_NO_DOCKWIDGET diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 0b874cb09a9..167a10efc35 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -657,7 +657,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } } } -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) } else if (previousAction) { previousAction->d_func()->showStatusText(topCausedWidget(), QString()); #endif diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 8ec2a3ed94d..552409a4ed3 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -378,7 +378,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat q->update(actionRect(currentAction)); popupState = popup; -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) QAction *previousAction = currentAction; #endif currentAction = action; @@ -387,7 +387,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat if(popup) popupAction(action, activateFirst); q->update(actionRect(action)); -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) } else if (previousAction) { QString empty; QStatusTipEvent tip(empty); diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 1d06f57d7b1..13595575e63 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -919,7 +919,7 @@ void QToolButton::setDefaultAction(QAction *action) #ifndef QT_NO_TOOLTIP setToolTip(action->toolTip()); #endif -#ifndef QT_NO_STATUSTIP +#if QT_CONFIG(statustip) setStatusTip(action->statusTip()); #endif #if QT_CONFIG(whatsthis) From 3aed1fccda2e3bcc0d8328543ef511b411b230d6 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 21:25:32 +0200 Subject: [PATCH 66/82] Convert features.fontcombobox to QT_[REQUIRE_]CONFIG Change-Id: I98f85cdb3b1c1ceae010362a5d5747d62ba62a22 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qfontcombobox.cpp | 4 ---- src/widgets/widgets/qfontcombobox.h | 4 +--- src/widgets/widgets/widgets.pri | 7 +++++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 9bd33409aeb..f206d01999a 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -39,8 +39,6 @@ #include "qfontcombobox.h" -#ifndef QT_NO_FONTCOMBOBOX - #include #include #include @@ -563,5 +561,3 @@ QT_END_NAMESPACE #include "qfontcombobox.moc" #include "moc_qfontcombobox.cpp" - -#endif // QT_NO_FONTCOMBOBOX diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h index 983d5224ddf..1e4555ce2d6 100644 --- a/src/widgets/widgets/qfontcombobox.h +++ b/src/widgets/widgets/qfontcombobox.h @@ -44,11 +44,10 @@ #include #include -#ifndef QT_NO_FONTCOMBOBOX +QT_REQUIRE_CONFIG(fontcombobox); QT_BEGIN_NAMESPACE - class QFontComboBoxPrivate; class Q_WIDGETS_EXPORT QFontComboBox : public QComboBox @@ -101,5 +100,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontComboBox::FontFilters) QT_END_NAMESPACE -#endif // QT_NO_FONTCOMBOBOX #endif diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 1779c8d1836..726235ef4e5 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -14,7 +14,6 @@ HEADERS += \ widgets/qdockwidget.h \ widgets/qdockwidget_p.h \ widgets/qdockarealayout_p.h \ - widgets/qfontcombobox.h \ widgets/qframe.h \ widgets/qframe_p.h \ widgets/qgroupbox.h \ @@ -78,7 +77,6 @@ SOURCES += \ widgets/qdockwidget.cpp \ widgets/qdockarealayout.cpp \ widgets/qeffects.cpp \ - widgets/qfontcombobox.cpp \ widgets/qframe.cpp \ widgets/qgroupbox.cpp \ widgets/qkeysequenceedit.cpp \ @@ -152,6 +150,11 @@ qtConfig(commandlinkbutton) { widgets/qcommandlinkbutton.cpp } +qtConfig(fontcombobox) { + HEADERS += widgets/qfontcombobox.h + SOURCES += widgets/qfontcombobox.cpp +} + qtConfig(label) { HEADERS += \ widgets/qlabel.h \ From 5cc5c97554c1e0010f3d2e0ab379a68743b66b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 27 Jun 2017 12:02:24 +0200 Subject: [PATCH 67/82] Doc: Add note about fromPercentEncoding's behavior on invalid input Add a note saying that invalid input to QByteArray::fromPercentEncoding and QUrl::fromPercentEncoding will produce invalid output, and provide an example. Change-Id: Icc68f59c23cf199640b646cd4a6ca8e4808a3f71 Reviewed-by: Thiago Macieira --- src/corelib/io/qurl.cpp | 4 ++++ src/corelib/tools/qbytearray.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 9663235a67e..ac694a464ac 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3440,6 +3440,10 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode) /*! Returns a decoded copy of \a input. \a input is first decoded from percent encoding, then converted from UTF-8 to unicode. + + \note Given invalid input (such as a string containing the sequence "%G5", + which is not a valid hexadecimal number) the output will be invalid as + well. As an example: the sequence "%G5" could be decoded to 'W'. */ QString QUrl::fromPercentEncoding(const QByteArray &input) { diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 8df439f7cd0..38df38a32f9 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -4484,6 +4484,10 @@ void q_fromPercentEncoding(QByteArray *ba) text.data(); // returns "Qt is great!" \endcode + \note Given invalid input (such as a string containing the sequence "%G5", + which is not a valid hexadecimal number) the output will be invalid as + well. As an example: the sequence "%G5" could be decoded to 'W'. + \sa toPercentEncoding(), QUrl::fromPercentEncoding() */ QByteArray QByteArray::fromPercentEncoding(const QByteArray &input, char percent) From 6dd61b4e62d9b67a721bbf671b7ffd62c0a50809 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 22 Feb 2017 14:06:51 +0300 Subject: [PATCH 68/82] xcb: Replace XCB_USE_XINPUT define by QT_CONFIG macro .. and remove it from qxcbconnection_xi2.cpp as this file is build _only_ when xinput2 is available. Change-Id: I66d6a299c120fc034f8519cd188e1b845d5bd1bc Reviewed-by: Gatis Paeglis --- src/gui/configure.json | 2 +- .../gl_integrations_plugin_base.pri | 7 ------- src/plugins/platforms/xcb/qxcbconnection.cpp | 20 +++++++++---------- src/plugins/platforms/xcb/qxcbconnection.h | 12 +++++------ .../platforms/xcb/qxcbconnection_xi2.cpp | 6 ------ src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++-- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 3 +-- 7 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/gui/configure.json b/src/gui/configure.json index 343cfcf798e..a2a78aa071b 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -799,7 +799,7 @@ "xinput2": { "label": "Xinput2", "emitIf": "features.xcb", - "condition": "libs.xinput2", + "condition": "features.xcb-xlib && libs.xinput2", "output": [ "privateFeature" ] }, "xkbcommon-evdev": { diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 063a74c395d..e6e352a21d3 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -5,13 +5,6 @@ INCLUDEPATH += $$PWD/../ load(qt_build_paths) -# needed by Xcursor ... -qtConfig(xcb-xlib) { - qtConfig(xinput2) { - DEFINES += XCB_USE_XINPUT2 - } -} - # build with session management support qtConfig(xcb-sm) { DEFINES += XCB_USE_SM diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 514ad6775d7..cd170e3dbcd 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -76,7 +76,7 @@ #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #endif @@ -116,7 +116,7 @@ Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen") #define XCB_GE_GENERIC 35 #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed: // - "pad0" became "extension" // - "pad1" and "pad" became "pad0" @@ -134,7 +134,7 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) qt_xcb_ge_event_t *e = reinterpret_cast(event); return e->extension == opCode; } -#endif // XCB_USE_XINPUT2 +#endif // QT_CONFIG(xinput2) #if QT_CONFIG(xcb_xlib) static const char * const xcbConnectionErrors[] = { @@ -604,7 +604,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra initializeScreens(); initializeXRender(); -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2")) initializeXInput2(); #endif @@ -664,7 +664,7 @@ QXcbConnection::~QXcbConnection() delete m_drag; #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) finalizeXInput2(); #endif @@ -1201,7 +1201,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) } break; } -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) case XCB_GE_GENERIC: // Here the windowEventListener is invoked from xi2HandleEvent() if (m_xi2Enabled && isXIEvent(event, m_xiOpCode)) @@ -1573,7 +1573,7 @@ void *QXcbConnection::createVisualInfoForDefaultVisualId() const #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // it is safe to cast XI_* events here as long as we are only touching the first 32 bytes, // after that position event needs memmove, see xi2PrepareXIGenericDeviceEvent static inline bool isXIType(xcb_generic_event_t *event, int opCode, uint16_t type) @@ -1618,7 +1618,7 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex, } return false; } -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // compress XI_* events if (responseType == XCB_GE_GENERIC) { if (!m_xi2Enabled) @@ -2232,7 +2232,7 @@ bool QXcbConnection::xi2MouseEvents() const } #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) static int xi2ValuatorOffset(const unsigned char *maskPtr, int maskLen, int number) { int offset = 0; @@ -2276,7 +2276,7 @@ void QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event) // and allow casting, overwriting the full_sequence field. memmove((char*) event + 32, (char*) event + 36, event->length * 4); } -#endif // defined(XCB_USE_XINPUT2) +#endif // QT_CONFIG(xinput2) QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 40a54e0f1f5..bba987983e0 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -68,7 +68,7 @@ #include #endif -#if XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) #include #ifdef XIScrollClass #define XCB_USE_XINPUT21 // XI 2.1 adds smooth scrolling support @@ -77,7 +77,7 @@ #endif #endif struct XInput2TouchDeviceData; -#endif // XCB_USE_XINPUT2 +#endif // QT_CONFIG(xinput2) struct xcb_randr_get_output_info_reply_t; @@ -426,7 +426,7 @@ public: void *createVisualInfoForDefaultVisualId() const; #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) void xi2Select(xcb_window_t window); #endif #ifdef XCB_USE_XINPUT21 @@ -551,7 +551,7 @@ private: void destroyScreen(QXcbScreen *screen); void initializeScreens(); bool compressEvent(xcb_generic_event_t *event, int currentIndex, QXcbEventArray *eventqueue) const; -#ifdef XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) bool m_xi2Enabled = false; int m_xi2Minor = 2; void initializeXInput2(); @@ -636,7 +636,7 @@ private: void *m_xlib_display = nullptr; #endif QXcbEventReader *m_reader = nullptr; -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) QHash m_touchDevices; #ifdef XCB_USE_XINPUT22 struct StartSystemResizeInfo { @@ -694,7 +694,7 @@ private: friend class QXcbEventReader; }; -#ifdef XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) #if QT_CONFIG(tabletevent) Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE); diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 52873f0910d..4d2a83b3cf9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -47,8 +47,6 @@ #include #include -#ifdef XCB_USE_XINPUT2 - #include #include @@ -698,10 +696,8 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo if (m_xiGrab) { // XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2) // http://lists.x.org/archives/xorg-devel/2014-July/043059.html -#ifdef XCB_USE_XINPUT2 XIAllowTouchEvents(static_cast(m_xlib_display), xiDeviceEvent->deviceid, xiDeviceEvent->detail, xiDeviceEvent->event, XIAcceptTouch); -#endif } break; case XI_TouchUpdate: @@ -1241,5 +1237,3 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id) } #endif // QT_CONFIG(tabletevent) - -#endif // XCB_USE_XINPUT2 diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 31757ca6f6e..4acc827bf60 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -104,7 +104,7 @@ #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #include #endif @@ -558,7 +558,7 @@ void QXcbWindow::create() 32, 2, (void *)data)); -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) connection()->xi2Select(m_window); #endif diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 6c9a3259b64..d0dc8f30755 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -48,12 +48,11 @@ HEADERS = \ load(qt_build_paths) DEFINES += QT_BUILD_XCB_PLUGIN -# needed by Xcursor ... + qtConfig(xcb-xlib) { QMAKE_USE += xcb_xlib qtConfig(xinput2) { - DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp QMAKE_USE += xinput2 } From b2ec7317c889c1eae1eab1060f572680c28ed997 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Tue, 6 Jun 2017 15:34:56 -0400 Subject: [PATCH 69/82] Add query of default include/library paths for QNX Change-Id: Iafc5a573a2ddb277d2a786cb6b48521985defe44 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/toolchain.prf | 81 +++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 26 deletions(-) diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 9687767cf1f..a7c91721336 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -25,9 +25,11 @@ isEmpty($${target_prefix}.INCDIRS) { !equals(QMAKE_HOST.os, Windows) { cmd_prefix = "LC_ALL=C" cmd_suffix = "/dev/null" + null_file = /dev/null } else { cmd_prefix = "set LC_ALL=C&" cmd_suffix = "NUL" + null_file = NUL } cxx_flags = $$QMAKE_CXXFLAGS @@ -40,7 +42,10 @@ isEmpty($${target_prefix}.INCDIRS) { # QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass. darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH - clang: \ + rim_qcc: \ + # Need the cc1plus and ld command lines to pick up the paths + cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v + else: clang: \ # Need to link to pick up library paths cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v else: \ @@ -50,35 +55,59 @@ isEmpty($${target_prefix}.INCDIRS) { output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec) !equals(ec, 0): \ error("Cannot run compiler '$$QMAKE_CXX'. Maybe you forgot to setup the environment?") - add_includes = false - add_libraries = false - for (line, output) { - line ~= s/^[ \\t]*// # remove leading spaces - contains(line, "LIBRARY_PATH=.*") { - line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH= - paths = $$split(line, $$QMAKE_DIRLIST_SEP) - for (path, paths): \ - QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path) - } else: contains(line, "Library search paths:") { - add_libraries = true - } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here: - add_includes = true - } else: contains(line, "End of search.*") { - add_includes = false - } else: $$add_libraries { - # We assume all library search paths are absolute - !contains(line, "^/.*") { - add_libraries = false - next() + + rim_qcc { + for (line, output) { + contains(line, "^[^ ]*cc1plus .*") { + take_next = false + for (parameter, $$list($$line)) { + $$take_next { + QMAKE_DEFAULT_INCDIRS += $$clean_path($$parameter) + take_next = false + } else: equals(parameter, "-isystem") { + take_next = true + } + } + } else: contains(line, "^[^ ]*-ld .*") { + for (parameter, $$list($$line)) { + contains(parameter, "^-L.*") { + parameter ~= s/^-L// + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$parameter) + } + } + } + } + } else { + add_includes = false + add_libraries = false + for (line, output) { + line ~= s/^[ \\t]*// # remove leading spaces + contains(line, "LIBRARY_PATH=.*") { + line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH= + paths = $$split(line, $$QMAKE_DIRLIST_SEP) + for (path, paths): \ + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path) + } else: contains(line, "Library search paths:") { + add_libraries = true + } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here: + add_includes = true + } else: contains(line, "End of search.*") { + add_includes = false + } else: $$add_libraries { + # We assume all library search paths are absolute + !contains(line, "^/.*") { + add_libraries = false + next() + } + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$line) + } else: $$add_includes { + !contains(line, ".* \\(framework directory\\)"): \ + QMAKE_DEFAULT_INCDIRS += $$clean_path($$line) } - QMAKE_DEFAULT_LIBDIRS += $$clean_path($$line) - } else: $$add_includes { - !contains(line, ".* \\(framework directory\\)"): \ - QMAKE_DEFAULT_INCDIRS += $$clean_path($$line) } } isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \ - !if(qnx|integrity): \ + !integrity: \ error("failed to parse default search paths from compiler output") QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) } else: msvc { From d0c5e294323c69ef16c44466c3cff8decf4face5 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 29 Jun 2017 12:19:27 +0200 Subject: [PATCH 70/82] Respect the application and system configuration settings for the proxy If an application proxy has been set or the usage of the system proxy configuration has been turned off then these should be respected rather than querying the system for the proxy. By using proxyForQuery() over systemProxyForQuery() it ensures that it first checks if there is an application proxy set before falling back to the system proxy, if using the system proxy has not been turned off. Task-number: QTBUG-61692 Change-Id: I65ed3e6bd7b3449cd4ae3757e583aa8d7724221b Reviewed-by: Timur Pocheptsov Reviewed-by: Thiago Macieira --- src/network/socket/qnativesocketengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index b796934199e..3f7c0d94e1a 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -395,7 +395,7 @@ bool QNativeSocketEnginePrivate::checkProxy(const QHostAddress &address) // QNetworkProxyQuery). QNetworkProxyQuery query; query.setQueryType(queryType); - proxy = QNetworkProxyFactory::systemProxyForQuery(query).constFirst(); + proxy = QNetworkProxyFactory::proxyForQuery(query).constFirst(); } if (proxy.type() != QNetworkProxy::DefaultProxy && From 628f3becf929efa284628884716bc2ea772c4cc6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 30 Jun 2017 14:57:46 +0200 Subject: [PATCH 71/82] macOS: Blacklist tst_QProgressDialog::autoShow() The test is apparently flaky. Change-Id: Ib0161fb18cdef1d532c81ac7196c57af1f7c8ee1 Reviewed-by: Simon Hausmann --- tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST index a2670e8f365..1789f515075 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST @@ -1,2 +1,2 @@ -[autoShow:50_to_100_fast_0_compat] -osx +[autoShow] +osx ci From fd897629bf698c9efb4628188db79f2937ef3d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 13 Jun 2017 12:09:59 +0100 Subject: [PATCH 72/82] Fix moving a hidden QOpenGLWidget to another window A visibile QOpenGLWidget receives a QEvent::WindowChangeInternal which triggers a QOpenGLWidget::reset(). A hidden QOpenGLWidget never received this event so it was never reset, resulting in a black rendering. Includes unit-test that fails without this patch. Change-Id: I9d2c57d66fa629f631a9829a5ebf4de09998ad75 Task-Id: QTBUG-60896 Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qopenglwidget.cpp | 2 ++ src/widgets/kernel/qwidget.cpp | 2 +- .../qopenglwidget/tst_qopenglwidget.cpp | 31 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 9aab0bd76a5..218d3c4a46b 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -1342,6 +1342,8 @@ bool QOpenGLWidget::event(QEvent *e) break; if (d->initialized) d->reset(); + if (isHidden()) + break; // FALLTHROUGH case QEvent::Show: // reparenting may not lead to a resize so reinitalize on Show too if (!d->initialized && !size().isEmpty() && window() && window()->windowHandle()) { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1265052281b..d4cbe81c2d2 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -10511,7 +10511,7 @@ static void sendWindowChangeToTextureChildrenRecursively(QWidget *widget) for (int i = 0; i < d->children.size(); ++i) { QWidget *w = qobject_cast(d->children.at(i)); - if (w && !w->isWindow() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen) + if (w && !w->isWindow() && QWidgetPrivate::get(w)->textureChildSeen) sendWindowChangeToTextureChildrenRecursively(w); } } diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index f51c566f20a..2a05900adc6 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -55,6 +55,7 @@ private slots: void painter(); void reparentToAlreadyCreated(); void reparentToNotYetCreated(); + void reparentHidden(); void asViewport(); void requestUpdate(); void fboRedirect(); @@ -279,6 +280,36 @@ void tst_QOpenGLWidget::reparentToNotYetCreated() QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255)); } +void tst_QOpenGLWidget::reparentHidden() +{ + // Tests QTBUG-60896 + QWidget topLevel1; + + QWidget *container = new QWidget(&topLevel1); + PainterWidget *glw = new PainterWidget(container); + topLevel1.resize(640, 480); + glw->resize(320, 200); + topLevel1.show(); + + glw->hide(); // Explicitly hidden + + QTest::qWaitForWindowExposed(&topLevel1); + + QWidget topLevel2; + topLevel2.resize(640, 480); + topLevel2.show(); + QTest::qWaitForWindowExposed(&topLevel2); + + QOpenGLContext *originalContext = glw->context(); + QVERIFY(originalContext); + + container->setParent(&topLevel2); + glw->show(); // Should get a new context now + + QOpenGLContext *newContext = glw->context(); + QVERIFY(originalContext != newContext); +} + class CountingGraphicsView : public QGraphicsView { public: From 7a1b7c74209cdd26510edd440651b259897b8769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Wed, 7 Jun 2017 09:58:01 +0100 Subject: [PATCH 73/82] docs: Reference QOpenGLWidget::grabFramebuffer, not QGLWidget::grabFrameBuffer QGLWidget is obsolete Change-Id: I8db3bfd534a328d41815d445557d899dc17d6061 Reviewed-by: Friedemann Kleint Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index d4cbe81c2d2..f1319d9cdab 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5133,8 +5133,11 @@ void qt_qpa_set_cursor(QWidget *w, bool force) \snippet code/src_gui_kernel_qwidget.cpp 8 - \note To obtain the contents of an OpenGL widget, use QGLWidget::grabFrameBuffer() - or QGLWidget::renderPixmap() instead. + \note To obtain the contents of a QOpenGLWidget, use QOpenGLWidget::grabFramebuffer() + instead. + + \note To obtain the contents of a QGLWidget (deprecated), use + QGLWidget::grabFrameBuffer() or QGLWidget::renderPixmap() instead. */ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, RenderFlags renderFlags) From 3ab0ba7bf2b27f73b38a6f60181426c05f1d3af0 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 31 May 2017 21:00:22 +0200 Subject: [PATCH 74/82] Convert features.colordialog to QT_[REQUIRE_]CONFIG Change-Id: If2ac57a10f38002db5a49be3882dfc507a84a3df Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/cocoa/cocoa.pro | 7 +++++-- src/plugins/platforms/cocoa/qcocoacolordialoghelper.h | 4 ++++ src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 4 ---- src/plugins/platforms/cocoa/qcocoatheme.mm | 4 ++-- src/widgets/dialogs/dialogs.pri | 7 +++++-- src/widgets/dialogs/qcolordialog.cpp | 5 ----- src/widgets/dialogs/qcolordialog.h | 7 ++----- src/widgets/dialogs/qdialog.cpp | 5 ++++- 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 0f478a79f33..23a049bebc6 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -20,7 +20,6 @@ OBJECTIVE_SOURCES += main.mm \ qmultitouch_mac.mm \ qcocoaaccessibilityelement.mm \ qcocoaaccessibility.mm \ - qcocoacolordialoghelper.mm \ qcocoafontdialoghelper.mm \ qcocoacursor.mm \ qcocoaclipboard.mm \ @@ -54,7 +53,6 @@ HEADERS += qcocoaintegration.h \ qmultitouch_mac_p.h \ qcocoaaccessibilityelement.h \ qcocoaaccessibility.h \ - qcocoacolordialoghelper.h \ qcocoafontdialoghelper.h \ qcocoacursor.h \ qcocoaclipboard.h \ @@ -101,6 +99,11 @@ qtHaveModule(widgets) { qcocoaprintersupport.h \ qcocoaprintdevice.h \ + qtConfig(colordialog) { + SOURCES += qcocoacolordialoghelper.mm + HEADERS += qcocoacolordialoghelper.h + } + qtConfig(filedialog) { SOURCES += qcocoafiledialoghelper.mm HEADERS += qcocoafiledialoghelper.h diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h index 55017668d1b..133efd6db87 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h @@ -40,9 +40,13 @@ #ifndef QCOCOACOLORDIALOGHELPER_H #define QCOCOACOLORDIALOGHELPER_H +#include + #include #include +QT_REQUIRE_CONFIG(colordialog); + QT_BEGIN_NAMESPACE class QCocoaColorDialogHelper : public QPlatformColorDialogHelper diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index a8974c4de5d..5d331c0e960 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -37,8 +37,6 @@ ** ****************************************************************************/ -#ifndef QT_NO_COLORDIALOG - #include #include #include @@ -424,5 +422,3 @@ QColor QCocoaColorDialogHelper::currentColor() const } QT_END_NAMESPACE - -#endif // QT_NO_COLORDIALOG diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 53ccf68c0c7..faa3df39a03 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -130,7 +130,7 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const { if (dialogType == QPlatformTheme::FileDialog) return true; -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) if (dialogType == QPlatformTheme::ColorDialog) return true; #endif @@ -148,7 +148,7 @@ QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialo case QPlatformTheme::FileDialog: return new QCocoaFileDialogHelper(); #endif -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) case QPlatformTheme::ColorDialog: return new QCocoaColorDialogHelper(); #endif diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index 1ea5403b797..0ebb912ffc5 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -1,7 +1,6 @@ # Qt dialogs module HEADERS += \ - dialogs/qcolordialog.h \ dialogs/qfscompleter_p.h \ dialogs/qerrormessage.h \ dialogs/qfontdialog.h \ @@ -18,13 +17,17 @@ win32 { INCLUDEPATH += $$PWD SOURCES += \ - dialogs/qcolordialog.cpp \ dialogs/qerrormessage.cpp \ dialogs/qfontdialog.cpp \ dialogs/qfilesystemmodel.cpp \ dialogs/qfileinfogatherer.cpp \ dialogs/qwizard.cpp \ +qtConfig(colordialog) { + HEADERS += dialogs/qcolordialog.h + SOURCES += dialogs/qcolordialog.cpp +} + qtConfig(dialog) { HEADERS += \ dialogs/qdialog.h \ diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index dbcd2d7fe2e..f361770c3ef 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -39,8 +39,6 @@ #include "qcolordialog.h" -#ifndef QT_NO_COLORDIALOG - #include "qapplication.h" #include "qdesktopwidget.h" #include "qdrawutil.h" @@ -2289,6 +2287,3 @@ QT_END_NAMESPACE #include "qcolordialog.moc" #include "moc_qcolordialog.cpp" - -#endif // QT_NO_COLORDIALOG - diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index fb5b843ce4d..a27cfaf9532 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -42,12 +42,11 @@ #include -#ifndef QT_NO_COLORDIALOG - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(colordialog); +QT_BEGIN_NAMESPACE class QColorDialogPrivate; @@ -127,6 +126,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions) QT_END_NAMESPACE -#endif // QT_NO_COLORDIALOG - #endif // QCOLORDIALOG_H diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index e1a38438d14..851f1956336 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -37,7 +37,10 @@ ** ****************************************************************************/ +#include +#if QT_CONFIG(colordialog) #include "qcolordialog.h" +#endif #include "qfontdialog.h" #if QT_CONFIG(filedialog) #include "qfiledialog.h" @@ -72,7 +75,7 @@ static inline int themeDialogType(const QDialog *dialog) if (qobject_cast(dialog)) return QPlatformTheme::FileDialog; #endif -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) if (qobject_cast(dialog)) return QPlatformTheme::ColorDialog; #endif From 330f0245898dd2c163a3a8b8dfb7b672cf8def3b Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 31 May 2017 21:28:32 +0200 Subject: [PATCH 75/82] Convert features.wizard to QT_[REQUIRE_]CONFIG Change-Id: I43e3d9f55a21ae0f602fc43c570321d0152cd8b6 Reviewed-by: Oswald Buddenhagen --- examples/widgets/dialogs/dialogs.pro | 6 +++++- src/widgets/dialogs/dialogs.pri | 21 ++++++++++++--------- src/widgets/dialogs/qwizard.cpp | 4 ---- src/widgets/dialogs/qwizard.h | 8 ++------ src/widgets/dialogs/qwizard_win.cpp | 4 ---- src/widgets/dialogs/qwizard_win_p.h | 4 ++-- src/widgets/styles/qcommonstyle.cpp | 4 +++- src/widgets/styles/qfusionstyle.cpp | 4 +++- src/widgets/styles/qmacstyle_mac.mm | 4 +++- src/widgets/styles/qmacstyle_mac_p_p.h | 1 - src/widgets/styles/qwindowsstyle.cpp | 4 +++- 11 files changed, 33 insertions(+), 31 deletions(-) diff --git a/examples/widgets/dialogs/dialogs.pro b/examples/widgets/dialogs/dialogs.pro index 7a01e818e0d..6f193094407 100644 --- a/examples/widgets/dialogs/dialogs.pro +++ b/examples/widgets/dialogs/dialogs.pro @@ -1,3 +1,5 @@ +QT_FOR_CONFIG += widgets + TEMPLATE = subdirs SUBDIRS = classwizard \ configdialog \ @@ -13,5 +15,7 @@ SUBDIRS = classwizard \ } !qtHaveModule(printsupport): SUBDIRS -= licensewizard -contains(DEFINES, QT_NO_WIZARD): SUBDIRS -= trivialwizard licensewizard classwizard +!qtConfig(wizard) { + SUBDIRS -= trivialwizard licensewizard classwizard +} wince: SUBDIRS += sipdialog diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index 0ebb912ffc5..718db3bb5d6 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -7,21 +7,14 @@ HEADERS += \ dialogs/qfontdialog_p.h \ dialogs/qfilesystemmodel.h \ dialogs/qfilesystemmodel_p.h \ - dialogs/qfileinfogatherer_p.h \ - dialogs/qwizard.h - -win32 { - HEADERS += dialogs/qwizard_win_p.h - SOURCES += dialogs/qwizard_win.cpp -} + dialogs/qfileinfogatherer_p.h INCLUDEPATH += $$PWD SOURCES += \ dialogs/qerrormessage.cpp \ dialogs/qfontdialog.cpp \ dialogs/qfilesystemmodel.cpp \ - dialogs/qfileinfogatherer.cpp \ - dialogs/qwizard.cpp \ + dialogs/qfileinfogatherer.cpp qtConfig(colordialog) { HEADERS += dialogs/qcolordialog.h @@ -65,3 +58,13 @@ qtConfig(progressdialog) { HEADERS += dialogs/qprogressdialog.h SOURCES += dialogs/qprogressdialog.cpp } + +qtConfig(wizard) { + HEADERS += dialogs/qwizard.h + SOURCES += dialogs/qwizard.cpp + + win32 { + HEADERS += dialogs/qwizard_win_p.h + SOURCES += dialogs/qwizard_win.cpp + } +} diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index d1abbc85d2a..432b6f18797 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -40,8 +40,6 @@ #include "qwizard.h" #include -#ifndef QT_NO_WIZARD - #include "qabstractspinbox.h" #include "qalgorithms.h" #include "qapplication.h" @@ -3987,5 +3985,3 @@ QWizard *QWizardPage::wizard() const QT_END_NAMESPACE #include "moc_qwizard.cpp" - -#endif // QT_NO_WIZARD diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h index 3236ee90df5..4d03bf91d4a 100644 --- a/src/widgets/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -41,13 +41,11 @@ #define QWIZARD_H #include - -#ifndef QT_NO_WIZARD - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(wizard); +QT_BEGIN_NAMESPACE class QAbstractButton; class QWizardPage; @@ -261,6 +259,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_WIZARD - #endif // QWIZARD_H diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 4ab01aca665..666b192e9c7 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -37,8 +37,6 @@ ** ****************************************************************************/ -#ifndef QT_NO_WIZARD - #include #if QT_CONFIG(style_windowsvista) @@ -724,5 +722,3 @@ int QVistaHelper::topOffset() QT_END_NAMESPACE #endif // style_windowsvista - -#endif // QT_NO_WIZARD diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h index bbba53b8796..f9122865c28 100644 --- a/src/widgets/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -53,7 +53,6 @@ #include -#ifndef QT_NO_WIZARD #if QT_CONFIG(style_windowsvista) #include @@ -63,6 +62,8 @@ #include #include +QT_REQUIRE_CONFIG(wizard); + QT_BEGIN_NAMESPACE class QVistaBackButton : public QAbstractButton @@ -157,5 +158,4 @@ private: QT_END_NAMESPACE #endif // style_windowsvista -#endif // QT_NO_WIZARD #endif // QWIZARD_WIN_P_H diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index afcb50c8662..ad3ba88756b 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -74,7 +74,9 @@ #include #include #include +#if QT_CONFIG(wizard) #include +#endif #include #include #include @@ -5187,7 +5189,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget vret->variant = fmt; } break; -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::ClassicStyle; break; diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index dc703e3e8de..983413d149d 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -65,7 +65,9 @@ #include #include #include +#if QT_CONFIG(wizard) #include +#endif #include #include #include @@ -3727,7 +3729,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW case SH_MessageBox_TextInteractionFlags: return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: return QWizard::ClassicStyle; #endif diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index cf2929db7ed..147b2027bfc 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -89,7 +89,9 @@ #include #include #include +#if QT_CONFIG(wizard) #include +#endif #include #include #include @@ -2990,7 +2992,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_FocusFrame_AboveWidget: ret = true; break; -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::MacStyle; break; diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index e5d2ffdc9d2..e16f17c67f9 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -93,7 +93,6 @@ #include #include #include -#include #include #include #include diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index b537931f49a..efbb972a060 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -60,7 +60,9 @@ #include "qfile.h" #include "qtextstream.h" #include "qpixmapcache.h" +#if QT_CONFIG(wizard) #include "qwizard.h" +#endif #include "qlistview.h" #include #include @@ -621,7 +623,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid } break; #endif // QT_NO_RUBBERBAND -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::ModernStyle; break; From 379179df9d172fd350f869c9f87391c05090187d Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 31 May 2017 22:08:27 +0200 Subject: [PATCH 76/82] Convert features.errormessage to QT_[REQUIRE_]CONFIG Change-Id: I9cc4f5190108c4bb96ddbd782ef1a031c9889f7e Reviewed-by: Oswald Buddenhagen --- src/widgets/dialogs/dialogs.pri | 7 +++++-- src/widgets/dialogs/qdialog.cpp | 4 +++- src/widgets/dialogs/qerrormessage.cpp | 4 ---- src/widgets/dialogs/qerrormessage.h | 7 ++----- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index 718db3bb5d6..a9da4658849 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -2,7 +2,6 @@ HEADERS += \ dialogs/qfscompleter_p.h \ - dialogs/qerrormessage.h \ dialogs/qfontdialog.h \ dialogs/qfontdialog_p.h \ dialogs/qfilesystemmodel.h \ @@ -11,7 +10,6 @@ HEADERS += \ INCLUDEPATH += $$PWD SOURCES += \ - dialogs/qerrormessage.cpp \ dialogs/qfontdialog.cpp \ dialogs/qfilesystemmodel.cpp \ dialogs/qfileinfogatherer.cpp @@ -30,6 +28,11 @@ qtConfig(dialog) { dialogs/qdialog.cpp } +qtConfig(errormessage) { + HEADERS += dialogs/qerrormessage.h + SOURCES += dialogs/qerrormessage.cpp +} + qtConfig(filedialog) { HEADERS += \ dialogs/qfiledialog.h \ diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 851f1956336..7cb24d65fc8 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -59,7 +59,9 @@ #if QT_CONFIG(messagebox) #include "qmessagebox.h" #endif +#if QT_CONFIG(errormessage) #include "qerrormessage.h" +#endif #include #include "private/qdialog_p.h" #include "private/qguiapplication_p.h" @@ -87,7 +89,7 @@ static inline int themeDialogType(const QDialog *dialog) if (qobject_cast(dialog)) return QPlatformTheme::MessageDialog; #endif -#ifndef QT_NO_ERRORMESSAGE +#if QT_CONFIG(errormessage) if (qobject_cast(dialog)) return QPlatformTheme::MessageDialog; #endif diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 38f0954b1c3..39035b743d2 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -39,8 +39,6 @@ #include "qerrormessage.h" -#ifndef QT_NO_ERRORMESSAGE - #include "qapplication.h" #include "qcheckbox.h" #include "qlabel.h" @@ -392,5 +390,3 @@ void QErrorMessagePrivate::retranslateStrings() QT_END_NAMESPACE #include "moc_qerrormessage.cpp" - -#endif // QT_NO_ERRORMESSAGE diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h index 976ba9abd5d..4cb1fad8453 100644 --- a/src/widgets/dialogs/qerrormessage.h +++ b/src/widgets/dialogs/qerrormessage.h @@ -42,12 +42,11 @@ #include -#ifndef QT_NO_ERRORMESSAGE - #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(errormessage); +QT_BEGIN_NAMESPACE class QErrorMessagePrivate; @@ -75,6 +74,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_ERRORMESSAGE - #endif // QERRORMESSAGE_H From 341554e34393199d8f6ba401df1fab0bfbb10188 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 31 May 2017 22:34:24 +0200 Subject: [PATCH 77/82] Convert features.fscompleter to QT_[REQUIRE_]CONFIG Fix one #include as only QCompleter is used and not QFSCompleter. Change-Id: Ia1e722122f7e322c678d2db6962c6086c684ddd9 Reviewed-by: Oswald Buddenhagen --- src/printsupport/dialogs/qprintdialog_unix.cpp | 2 +- src/widgets/dialogs/dialogs.pri | 5 ++++- src/widgets/dialogs/qfiledialog.cpp | 16 ++++++++-------- src/widgets/dialogs/qfiledialog_p.h | 6 ++++-- src/widgets/dialogs/qfscompleter_p.h | 6 ++---- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 1af682f74a6..e215e6cb9cd 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -61,7 +61,7 @@ #include -#include "private/qfscompleter_p.h" +#include #include "ui_qprintpropertieswidget.h" #include "ui_qprintsettingsoutput.h" #include "ui_qprintwidget.h" diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index a9da4658849..f072576acc4 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -1,7 +1,6 @@ # Qt dialogs module HEADERS += \ - dialogs/qfscompleter_p.h \ dialogs/qfontdialog.h \ dialogs/qfontdialog_p.h \ dialogs/qfilesystemmodel.h \ @@ -46,6 +45,10 @@ qtConfig(filedialog) { FORMS += dialogs/qfiledialog.ui } +qtConfig(fscompleter) { + HEADERS += dialogs/qfscompleter_p.h +} + qtConfig(inputdialog) { HEADERS += dialogs/qinputdialog.h SOURCES += dialogs/qinputdialog.cpp diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 0c609dc5f7f..b638adeaec6 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -841,7 +841,7 @@ void QFileDialog::setVisible(bool visible) // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below // updates the state correctly, but skips showing the non-native version: setAttribute(Qt::WA_DontShowOnScreen); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) // So the completer doesn't try to complete and therefore show a popup if (!d->nativeDialogInUse) d->completer->setModel(0); @@ -849,7 +849,7 @@ void QFileDialog::setVisible(bool visible) } else { d->createWidgets(); setAttribute(Qt::WA_DontShowOnScreen, false); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) if (!d->nativeDialogInUse) { if (d->proxyModel != 0) d->completer->setModel(d->proxyModel); @@ -922,7 +922,7 @@ void QFileDialog::setDirectory(const QString &directory) if (!d->nativeDialogInUse) { d->qFileDialogUi->newFolderButton->setEnabled(d->model->flags(root) & Qt::ItemIsDropEnabled); if (root != d->rootIndex()) { -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) if (directory.endsWith(QLatin1Char('/'))) d->completer->setCompletionPrefix(newDirectory); else @@ -2909,10 +2909,10 @@ void QFileDialogPrivate::createWidgets() #ifndef QT_NO_SHORTCUT qFileDialogUi->fileNameLabel->setBuddy(qFileDialogUi->fileNameEdit); #endif -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) completer = new QFSCompleter(model, q); qFileDialogUi->fileNameEdit->setCompleter(completer); -#endif // QT_NO_FSCOMPLETER +#endif // QT_CONFIG(fscompleter) qFileDialogUi->fileNameEdit->setInputMethodHints(Qt::ImhNoPredictiveText); @@ -3078,7 +3078,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) proxyModel->setSourceModel(d->model); d->qFileDialogUi->listView->setModel(d->proxyModel); d->qFileDialogUi->treeView->setModel(d->proxyModel); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) d->completer->setModel(d->proxyModel); d->completer->proxyModel = d->proxyModel; #endif @@ -3088,7 +3088,7 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) d->proxyModel = 0; d->qFileDialogUi->listView->setModel(d->model); d->qFileDialogUi->treeView->setModel(d->model); -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) d->completer->setModel(d->model); d->completer->sourceModel = d->model; d->completer->proxyModel = 0; @@ -4028,7 +4028,7 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) e->accept(); } -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) QString QFSCompleter::pathFromIndex(const QModelIndex &index) const { diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index d06a089e42d..f7a3c6b0914 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -73,7 +73,9 @@ #include #include #include "qsidebar_p.h" +#if QT_CONFIG(fscompleter) #include "qfscompleter_p.h" +#endif #if defined (Q_OS_UNIX) #include @@ -231,9 +233,9 @@ public: QStringList watching; QFileSystemModel *model; -#ifndef QT_NO_FSCOMPLETER +#if QT_CONFIG(fscompleter) QFSCompleter *completer; -#endif //QT_NO_FSCOMPLETER +#endif //QT_CONFIG(fscompleter) QString setWindowTitle; diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h index c073fa15215..ce0612f2934 100644 --- a/src/widgets/dialogs/qfscompleter_p.h +++ b/src/widgets/dialogs/qfscompleter_p.h @@ -55,9 +55,9 @@ #include "qcompleter.h" #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(fscompleter); -#ifndef QT_NO_FSCOMPLETER +QT_BEGIN_NAMESPACE /*! QCompleter that can deal with QFileSystemModel @@ -78,8 +78,6 @@ public: QFileSystemModel *sourceModel; }; -#endif // QT_NO_FSCOMPLETER - QT_END_NAMESPACE #endif // QFSCOMPLETOR_P_H From 2fb9705521bc2879dc89b54c1488d6a20a310d85 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 31 May 2017 23:08:35 +0200 Subject: [PATCH 78/82] Convert features.filesystemmodel to QT_[REQUIRE_]CONFIG Change-Id: I862510387e79d04221ec075f3e79896908ee9d8f Reviewed-by: Oswald Buddenhagen --- .../dialogs/qprintdialog_unix.cpp | 4 +++- src/widgets/dialogs/dialogs.pri | 20 ++++++++++++------- src/widgets/dialogs/qfileinfogatherer.cpp | 4 ---- src/widgets/dialogs/qfileinfogatherer_p.h | 7 ++----- src/widgets/dialogs/qfilesystemmodel.cpp | 4 ---- src/widgets/dialogs/qfilesystemmodel.h | 8 ++------ src/widgets/dialogs/qfilesystemmodel_p.h | 6 ++---- src/widgets/util/qcompleter.cpp | 18 +++++++++-------- .../util/qcompleter/tst_qcompleter.cpp | 4 ++-- 9 files changed, 34 insertions(+), 41 deletions(-) diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index e215e6cb9cd..51c8a593a16 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -50,7 +50,9 @@ #endif #include #include +#if QT_CONFIG(filesystemmodel) #include +#endif #include #include @@ -677,7 +679,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter * } widget.properties->setEnabled(true); -#if !defined(QT_NO_FILESYSTEMMODEL) && !defined(QT_NO_COMPLETER) +#if QT_CONFIG(filesystemmodel) && !defined(QT_NO_COMPLETER) QFileSystemModel *fsm = new QFileSystemModel(widget.filename); fsm->setRootPath(QDir::homePath()); widget.filename->setCompleter(new QCompleter(fsm, widget.filename)); diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index f072576acc4..c2625ec1f4e 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -2,16 +2,11 @@ HEADERS += \ dialogs/qfontdialog.h \ - dialogs/qfontdialog_p.h \ - dialogs/qfilesystemmodel.h \ - dialogs/qfilesystemmodel_p.h \ - dialogs/qfileinfogatherer_p.h + dialogs/qfontdialog_p.h INCLUDEPATH += $$PWD SOURCES += \ - dialogs/qfontdialog.cpp \ - dialogs/qfilesystemmodel.cpp \ - dialogs/qfileinfogatherer.cpp + dialogs/qfontdialog.cpp qtConfig(colordialog) { HEADERS += dialogs/qcolordialog.h @@ -45,6 +40,17 @@ qtConfig(filedialog) { FORMS += dialogs/qfiledialog.ui } +qtConfig(filesystemmodel) { + HEADERS += \ + dialogs/qfilesystemmodel.h \ + dialogs/qfilesystemmodel_p.h \ + dialogs/qfileinfogatherer_p.h + + SOURCES += \ + dialogs/qfilesystemmodel.cpp \ + dialogs/qfileinfogatherer.cpp +} + qtConfig(fscompleter) { HEADERS += dialogs/qfscompleter_p.h } diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 08c5a40c7ca..9f2d15d31be 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_FILESYSTEMMODEL - #ifdef QT_BUILD_INTERNAL static QBasicAtomicInt fetchedRoot = Q_BASIC_ATOMIC_INITIALIZER(false); Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot() @@ -366,8 +364,6 @@ void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bo } } -#endif // QT_NO_FILESYSTEMMODEL - QT_END_NAMESPACE #include "moc_qfileinfogatherer_p.cpp" diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h index 0018b6c387f..52578126ded 100644 --- a/src/widgets/dialogs/qfileinfogatherer_p.h +++ b/src/widgets/dialogs/qfileinfogatherer_p.h @@ -66,6 +66,8 @@ #include +QT_REQUIRE_CONFIG(filesystemmodel); + QT_BEGIN_NAMESPACE class QExtendedInformation { @@ -150,8 +152,6 @@ private : class QFileIconProvider; -#ifndef QT_NO_FILESYSTEMMODEL - class Q_AUTOTEST_EXPORT QFileInfoGatherer : public QThread { Q_OBJECT @@ -208,9 +208,6 @@ private: QFileIconProvider *m_iconProvider; // not accessed by run() QFileIconProvider defaultProvider; }; -#endif // QT_NO_FILESYSTEMMODEL - QT_END_NAMESPACE #endif // QFILEINFOGATHERER_H - diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 0ada9c6c58a..63b5cf7aaf2 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -58,8 +58,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_FILESYSTEMMODEL - /*! \enum QFileSystemModel::Roles \value FileIconRole @@ -1995,5 +1993,3 @@ bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const QT_END_NAMESPACE #include "moc_qfilesystemmodel.cpp" - -#endif // QT_NO_FILESYSTEMMODEL diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index 7d790124c8d..a5f23c92206 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -47,11 +47,10 @@ #include #include +QT_REQUIRE_CONFIG(filesystemmodel); + QT_BEGIN_NAMESPACE - -#ifndef QT_NO_FILESYSTEMMODEL - class ExtendedInformation; class QFileSystemModelPrivate; class QFileIconProvider; @@ -166,9 +165,6 @@ inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const { return qvariant_cast(aindex.data(Qt::DecorationRole)); } -#endif // QT_NO_FILESYSTEMMODEL - QT_END_NAMESPACE #endif // QFILESYSTEMMODEL_H - diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index e7149a30975..640225529b8 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -54,8 +54,6 @@ #include #include "qfilesystemmodel.h" -#ifndef QT_NO_FILESYSTEMMODEL - #include #include #include "qfileinfogatherer_p.h" @@ -66,6 +64,8 @@ #include #include +QT_REQUIRE_CONFIG(filesystemmodel); + QT_BEGIN_NAMESPACE class ExtendedInformation; @@ -313,9 +313,7 @@ public: }; Q_DECLARE_TYPEINFO(QFileSystemModelPrivate::Fetching, Q_MOVABLE_TYPE); -#endif // QT_NO_FILESYSTEMMODEL QT_END_NAMESPACE #endif - diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 5a31eb4e526..c412c4cbd55 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -148,7 +148,9 @@ #include "QtWidgets/qscrollbar.h" #include "QtCore/qstringlistmodel.h" #include "QtWidgets/qdirmodel.h" +#if QT_CONFIG(filesystemmodel) #include "QtWidgets/qfilesystemmodel.h" +#endif #include "QtWidgets/qheaderview.h" #include "QtWidgets/qlistview.h" #include "QtWidgets/qapplication.h" @@ -467,7 +469,7 @@ QMatchData QCompletionEngine::filterHistory() const bool isDirModel = false; #endif Q_UNUSED(isDirModel) -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) const bool isFsModel = (qobject_cast(source) != 0); #else const bool isFsModel = false; @@ -872,7 +874,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted) completion += QDir::separator(); } #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) // add a trailing separator in inline if (mode == QCompleter::InlineCompletion) { if (qobject_cast(proxy->sourceModel()) && QFileInfo(completion).isDir()) @@ -1044,7 +1046,7 @@ void QCompleter::setModel(QAbstractItemModel *model) { Q_D(QCompleter); QAbstractItemModel *oldModel = d->proxy->sourceModel(); -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) if (qobject_cast(oldModel)) setCompletionRole(Qt::EditRole); // QTBUG-54642, clear FileNameRole set by QFileSystemModel #endif @@ -1062,7 +1064,7 @@ void QCompleter::setModel(QAbstractItemModel *model) #endif } #endif // QT_NO_DIRMODEL -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) QFileSystemModel *fsModel = qobject_cast(model); if (fsModel) { #if defined(Q_OS_WIN) @@ -1073,7 +1075,7 @@ void QCompleter::setModel(QAbstractItemModel *model) setCompletionRole(QFileSystemModel::FileNameRole); connect(fsModel, SIGNAL(directoryLoaded(QString)), this, SLOT(_q_fileSystemModelDirectoryLoaded(QString))); } -#endif // QT_NO_FILESYSTEMMODEL +#endif // QT_CONFIG(filesystemmodel) } /*! @@ -1770,7 +1772,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const #ifndef QT_NO_DIRMODEL isDirModel = qobject_cast(d->proxy->sourceModel()) != 0; #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) isFsModel = qobject_cast(d->proxy->sourceModel()) != 0; #endif if (!isDirModel && !isFsModel) @@ -1782,7 +1784,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const QString t; if (isDirModel) t = sourceModel->data(idx, Qt::EditRole).toString(); -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) else t = sourceModel->data(idx, QFileSystemModel::FileNameRole).toString(); #endif @@ -1820,7 +1822,7 @@ QStringList QCompleter::splitPath(const QString& path) const Q_D(const QCompleter); isDirModel = qobject_cast(d->proxy->sourceModel()) != 0; #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) #ifdef QT_NO_DIRMODEL Q_D(const QCompleter); #endif diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index 937be944a10..f8095badb81 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -348,7 +348,7 @@ void tst_QCompleter::getSetCheck() completer.setWrapAround(false); QCOMPARE(completer.wrapAround(), false); -#ifndef QT_NO_FILESYSTEMMODEL +#if QT_CONFIG(filesystemmodel) // QTBUG-54642, changing from QFileSystemModel to another model should restore role. completer.setCompletionRole(Qt::EditRole); QCOMPARE(completer.completionRole(), static_cast(Qt::EditRole)); // default value @@ -361,7 +361,7 @@ void tst_QCompleter::getSetCheck() QStandardItemModel standardItemModel2(2, 2); // Do not clobber a custom role when changing models completer.setModel(&standardItemModel2); QCOMPARE(completer.completionRole(), static_cast(Qt::ToolTipRole)); -#endif // QT_NO_FILESYSTEMMODEL +#endif // QT_CONFIG(filesystemmodel) } void tst_QCompleter::csMatchingOnCsSortedModel_data() From afdc4f439c82cfa70f6fb6a66c816ba540226f43 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 12 Jun 2017 11:18:27 +0200 Subject: [PATCH 79/82] actually make use of the detected ICU Task-number: QTBUG-58012 Change-Id: I7a3d99277daa6566811b24111205548b89e77c53 Reviewed-by: Lars Knoll --- src/3rdparty/icu_dependency.pri | 13 ------------- src/corelib/configure.json | 1 - src/corelib/tools/tools.pri | 2 +- 3 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 src/3rdparty/icu_dependency.pri diff --git a/src/3rdparty/icu_dependency.pri b/src/3rdparty/icu_dependency.pri deleted file mode 100644 index 6318631f6e0..00000000000 --- a/src/3rdparty/icu_dependency.pri +++ /dev/null @@ -1,13 +0,0 @@ -win32 { - CONFIG(static, static|shared) { - CONFIG(debug, debug|release) { - LIBS_PRIVATE += -lsicuind -lsicuucd -lsicudtd - } else { - LIBS_PRIVATE += -lsicuin -lsicuuc -lsicudt - } - } else { - LIBS_PRIVATE += -licuin -licuuc -licudt - } -} else { - LIBS_PRIVATE += -licui18n -licuuc -licudata -} diff --git a/src/corelib/configure.json b/src/corelib/configure.json index deb7a544efa..2b3efbeb154 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -44,7 +44,6 @@ }, "icu": { "label": "ICU", - "export": "", "test": "unix/icu", "sources": [ { diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index b93ec824ed2..b705d4221a9 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -138,7 +138,7 @@ qtConfig(system-zlib) { } qtConfig(icu) { - include($$PWD/../../3rdparty/icu_dependency.pri) + QMAKE_USE_PRIVATE += icu SOURCES += tools/qlocale_icu.cpp \ tools/qcollator_icu.cpp From 23e2cc38ffcc725e8b5a4ac76941c278af86e388 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 28 Jun 2017 18:01:37 +0200 Subject: [PATCH 80/82] fix QMAKE_DEFAULT_INCDIRS detection with Xcode targeting uikit platforms uikit/sdk.prf replaces QMAKE_MAC_SDK_PATH with a make expansion of that variable, which of course does not work when we use the contents directly. amends 6d5489f5d. Task-number: QTBUG-61690 Change-Id: Id77dff8ee7d737dd35f74cc7d39faaa50b4b1ab9 Reviewed-by: Eike Ziller --- mkspecs/features/toolchain.prf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index a7c91721336..eb7b1385f23 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -40,7 +40,12 @@ isEmpty($${target_prefix}.INCDIRS) { # While technically incorrect but without any likely practical effect, # UIKit simulator platforms will see the device SDK's sysroot in # QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass. - darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH + darwin { + uikit:macx-xcode: \ + cxx_flags += -isysroot $$sdk_path_device.value + else: \ + cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH + } rim_qcc: \ # Need the cc1plus and ld command lines to pick up the paths From d23e18189c371eca5725e2ff394d720724625d2c Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Fri, 30 Jun 2017 16:17:15 +0300 Subject: [PATCH 81/82] Skip QThread stress test on Qemu Qemu uses some memory for each generated thread. This test creates > 80000 threads and consumes about 10Gb of memory which is too heavy for a VM. Task-number: QTBUG-59966 Change-Id: I1bb8a0d7955778f5201948b41befcb9f1f391514 Reviewed-by: Simon Hausmann --- tests/auto/corelib/thread/qthread/qthread.pro | 3 +++ tests/auto/corelib/thread/qthread/tst_qthread.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/tests/auto/corelib/thread/qthread/qthread.pro b/tests/auto/corelib/thread/qthread/qthread.pro index 18d867ecef4..e0ef506d2c0 100644 --- a/tests/auto/corelib/thread/qthread/qthread.pro +++ b/tests/auto/corelib/thread/qthread/qthread.pro @@ -2,3 +2,6 @@ CONFIG += testcase TARGET = tst_qthread QT = core testlib SOURCES = tst_qthread.cpp + +INCLUDEPATH += ../../../../shared/ +HEADERS += ../../../../shared/emulationdetector.h diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 0efbc5d01e7..5c8522a313d 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -47,6 +47,8 @@ #endif #endif +#include "emulationdetector.h" + class tst_QThread : public QObject { Q_OBJECT @@ -937,6 +939,9 @@ void tst_QThread::adoptMultipleThreadsOverlap() // Disconnects on WinCE void tst_QThread::stressTest() { + if (EmulationDetector::isRunningArmOnX86()) + QSKIP("Qemu uses too much memory for each thread. Test would run out of memory."); + QTime t; t.start(); while (t.elapsed() < one_minute) { From eaee1209f0ead5be786e81db8aee604ccfea85b0 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 12 Apr 2017 17:34:41 +0200 Subject: [PATCH 82/82] Switch QSemaphore::tryAcquire to using QDeadlineTimer A deadline timer is more correct for timeouts. Also starts the timer before trying to acquire the mutex for more precise timeouts. Task-number: QTBUG-58745 Change-Id: I230266a3a5d7b7af33981efed4e6882e5727a41c Reviewed-by: Thiago Macieira --- src/corelib/thread/qsemaphore.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 8427b0e696b..ce0c1c91df4 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -42,7 +42,7 @@ #ifndef QT_NO_THREAD #include "qmutex.h" #include "qwaitcondition.h" -#include "qelapsedtimer.h" +#include "qdeadlinetimer.h" #include "qdatetime.h" QT_BEGIN_NAMESPACE @@ -214,20 +214,19 @@ bool QSemaphore::tryAcquire(int n) bool QSemaphore::tryAcquire(int n, int timeout) { Q_ASSERT_X(n >= 0, "QSemaphore::tryAcquire", "parameter 'n' must be non-negative"); + if (timeout < 0) + return tryAcquire(n); + + QDeadlineTimer timer(timeout); QMutexLocker locker(&d->mutex); - if (timeout < 0) { - while (n > d->avail) - d->cond.wait(locker.mutex()); - } else { - QElapsedTimer timer; - timer.start(); - while (n > d->avail) { - const qint64 elapsed = timer.elapsed(); - if (timeout - elapsed <= 0 - || !d->cond.wait(locker.mutex(), timeout - elapsed)) - return false; - } + qint64 remainingTime = timer.remainingTime(); + while (n > d->avail && remainingTime > 0) { + if (!d->cond.wait(locker.mutex(), remainingTime)) + return false; + remainingTime = timer.remainingTime(); } + if (n > d->avail) + return false; d->avail -= n; return true;