From 50b9d8a931e859c027726a74ea0616e7b292e782 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 18 Oct 2016 19:12:55 +0200 Subject: Windows: Fix regression in QFSFileEnginePrivate::nativeWrite() Change 0696566b1e19c8178e00c0d14f185935e17d9e8b caused the block size to be incorrect for data > 32MB. Since bytesToWrite changes within the do...while loop, then the block size can potentially change too each time. So it needs to be recalculated each time rather than just once. Task-number: QTBUG-56616 Change-Id: I9880d0985f2d0242c30e67230be7271eb806db95 Reviewed-by: Oliver Wolff Reviewed-by: Friedemann Kleint (cherry picked from commit 683c9bc4a8e656b2251871b9d8c9952e58681a52) --- src/corelib/io/qfsfileengine_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index af026b8976..3251c481dd 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -433,11 +433,11 @@ qint64 QFSFileEnginePrivate::nativeWrite(const char *data, qint64 len) // Writing on Windows fails with ERROR_NO_SYSTEM_RESOURCES when // the chunks are too large, so we limit the block size to 32MB. - const DWORD blockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024))); qint64 totalWritten = 0; do { + const DWORD currentBlockSize = DWORD(qMin(bytesToWrite, qint64(32 * 1024 * 1024))); DWORD bytesWritten; - if (!WriteFile(fileHandle, data + totalWritten, blockSize, &bytesWritten, NULL)) { + if (!WriteFile(fileHandle, data + totalWritten, currentBlockSize, &bytesWritten, NULL)) { if (totalWritten == 0) { // Note: Only return error if the first WriteFile failed. q->setError(QFile::WriteError, qt_error_string()); -- cgit v1.2.3 From ab0ba668642d2d4c941f57e949118327530234af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 3 Oct 2016 18:41:30 +0200 Subject: Apple OS: Handle QSetting strings with embedded zero-bytes Saving strings with embedded zero-bytes (\0) as CFStrings would sometimes fail, and only write the part of the string leading up to the first zero-byte, instead of all the way to the final zero-terminator. This bug was revealed by the code-path that falls back to storing e.g. QTime as strings, via the helper method QSettingsPrivate::variantToString(). We now use the same approach as on platforms such as Windows and WinRT, where the string produced by variantToString() is checked for null-bytes, and if so, stored using a binary representation instead of as a string. For our case that means we fall back to CFData when detecting the null-byte. To separate strings from regular byte arrays, new logic has been added to variantToString() that wraps the null-byte strings in @String(). That way we can implement a fast-path when converting back from CFData, that doesn't go via the slow and lossy conversion via UTF8, and the resulting QVariant will be of type QVariant::ByteArray. The reason for using UTF-8 as the binary representation of the string is that in the case of storing a QByteArray("@foo") we need to still be able to convert it back to the same byte array, which doesn't work if the on-disk format is UTF-16. Task-number: QTBUG-56124 Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8 Cherry-picked: 764f5bf48cc87f4c72550b853ab93b815454cd48 Reviewed-by: Thiago Macieira Reviewed-by: Jani Heikkinen --- src/corelib/io/qsettings.cpp | 6 ++- src/corelib/io/qsettings_mac.cpp | 20 ++++++++- src/corelib/io/qsettings_win.cpp | 13 +----- src/corelib/io/qsettings_winrt.cpp | 4 +- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 50 ++++++++++++++++++++++- 5 files changed, 76 insertions(+), 17 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 8bdd148e28..05f6c22fc2 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -417,7 +417,9 @@ QString QSettingsPrivate::variantToString(const QVariant &v) case QVariant::Double: case QVariant::KeySequence: { result = v.toString(); - if (result.startsWith(QLatin1Char('@'))) + if (result.contains(QChar::Null)) + result = QLatin1String("@String(") + result + QLatin1Char(')'); + else if (result.startsWith(QLatin1Char('@'))) result.prepend(QLatin1Char('@')); break; } @@ -477,6 +479,8 @@ QVariant QSettingsPrivate::stringToVariant(const QString &s) if (s.endsWith(QLatin1Char(')'))) { if (s.startsWith(QLatin1String("@ByteArray("))) { return QVariant(s.midRef(11, s.size() - 12).toLatin1()); + } else if (s.startsWith(QLatin1String("@String("))) { + return QVariant(s.midRef(8, s.size() - 9).toString()); } else if (s.startsWith(QLatin1String("@Variant(")) || s.startsWith(QLatin1String("@DateTime("))) { #ifndef QT_NO_DATASTREAM diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index d73cc4d298..4282fcbe2c 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -214,7 +214,14 @@ static QCFType macValue(const QVariant &value) case QVariant::String: string_case: default: - result = QCFString::toCFStringRef(QSettingsPrivate::variantToString(value)); + QString string = QSettingsPrivate::variantToString(value); + if (string.contains(QChar::Null)) { + QByteArray ba = string.toUtf8(); + result = CFDataCreate(kCFAllocatorDefault, reinterpret_cast(ba.data()), + CFIndex(ba.size())); + } else { + result = QCFString::toCFStringRef(string); + } } return result; } @@ -267,8 +274,17 @@ static QVariant qtValue(CFPropertyListRef cfvalue) return (bool)CFBooleanGetValue(static_cast(cfvalue)); } else if (typeId == CFDataGetTypeID()) { CFDataRef cfdata = static_cast(cfvalue); - return QByteArray(reinterpret_cast(CFDataGetBytePtr(cfdata)), + QByteArray byteArray = QByteArray(reinterpret_cast(CFDataGetBytePtr(cfdata)), CFDataGetLength(cfdata)); + + // Fast-path for QByteArray, so that we don't have to go + // though the expensive and lossy conversion via UTF-8. + if (!byteArray.startsWith('@')) + return byteArray; + + const QString str = QString::fromUtf8(byteArray.constData(), byteArray.size()); + return QSettingsPrivate::stringToVariant(str); + } else if (typeId == CFDictionaryGetTypeID()) { CFDictionaryRef cfdict = static_cast(cfvalue); CFTypeID arrayTypeId = CFArrayGetTypeID(); diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 05ed51e999..53e1ed360b 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -675,15 +675,6 @@ void QWinSettingsPrivate::remove(const QString &uKey) } } -static bool stringContainsNullChar(const QString &s) -{ - for (int i = 0; i < s.length(); ++i) { - if (s.at(i).unicode() == 0) - return true; - } - return false; -} - void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) { if (writeHandle() == 0) { @@ -712,7 +703,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) QStringList l = variantListToStringList(value.toList()); QStringList::const_iterator it = l.constBegin(); for (; it != l.constEnd(); ++it) { - if ((*it).length() == 0 || stringContainsNullChar(*it)) { + if ((*it).length() == 0 || it->contains(QChar::Null)) { type = REG_BINARY; break; } @@ -756,7 +747,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) // If the string does not contain '\0', we can use REG_SZ, the native registry // string type. Otherwise we use REG_BINARY. QString s = variantToString(value); - type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ; + type = s.contains(QChar::Null) ? REG_BINARY : REG_SZ; if (type == REG_BINARY) { regValueBuff = QByteArray((const char*)s.utf16(), s.length() * 2); } else { diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 708287ce5e..209b56d920 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -402,7 +402,7 @@ void QWinRTSettingsPrivate::set(const QString &uKey, const QVariant &value) QStringList::const_iterator it = l.constBegin(); bool containsNull = false; for (; it != l.constEnd(); ++it) { - if ((*it).length() == 0 || it->indexOf(QChar::Null) != -1) { + if ((*it).length() == 0 || it->contains(QChar::Null)) { // We can only store as binary containsNull = true; break; @@ -445,7 +445,7 @@ void QWinRTSettingsPrivate::set(const QString &uKey, const QVariant &value) break; default: { const QString s = variantToString(value); - if (s.indexOf(QChar::Null) != -1) { + if (s.contains(QChar::Null)) { hr = valueStatics->CreateUInt8Array(s.length() * 2, (BYTE*) s.utf16(), &val); } else { HStringReference ref((const wchar_t*)s.utf16(), s.size()); diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 87a801c9dd..ed298bfafa 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -158,6 +158,8 @@ private slots: void testByteArray(); void iniCodec(); void bom(); + void embeddedZeroByte_data(); + void embeddedZeroByte(); private: void cleanupTestFiles(); @@ -627,7 +629,6 @@ void tst_QSettings::testByteArray_data() #ifndef QT_NO_COMPRESS QTest::newRow("compressed") << qCompress(bytes); #endif - QTest::newRow("with \\0") << bytes + '\0' + bytes; } void tst_QSettings::testByteArray() @@ -678,6 +679,53 @@ void tst_QSettings::bom() QVERIFY(allkeys.contains("section2/foo2")); } +void tst_QSettings::embeddedZeroByte_data() +{ + QTest::addColumn("value"); + + QByteArray bytes("hello\0world", 11); + + QTest::newRow("bytearray\\0") << QVariant(bytes); + QTest::newRow("string\\0") << QVariant(QString::fromLatin1(bytes.data(), bytes.size())); + + bytes = QByteArray("@String("); + + QTest::newRow("@bytearray") << QVariant(bytes); + QTest::newRow("@string") << QVariant(QString(bytes)); + + bytes = QByteArray("@String(\0test", 13); + + QTest::newRow("@bytearray\\0") << QVariant(bytes); + QTest::newRow("@string\\0") << QVariant(QString::fromLatin1(bytes.data(), bytes.size())); +} + +void tst_QSettings::embeddedZeroByte() +{ + QFETCH(QVariant, value); + { + QSettings settings("QtProject", "tst_qsettings"); + settings.setValue(QTest::currentDataTag(), value); + } + { + QSettings settings("QtProject", "tst_qsettings"); + QVariant outValue = settings.value(QTest::currentDataTag()); + + switch (value.type()) { + case QVariant::ByteArray: + QCOMPARE(outValue.toByteArray(), value.toByteArray()); + break; + case QVariant::String: + QCOMPARE(outValue.toString(), value.toString()); + break; + default: + Q_UNREACHABLE(); + } + + if (value.toByteArray().contains(QChar::Null)) + QVERIFY(outValue.toByteArray().contains(QChar::Null)); + } +} + void tst_QSettings::testErrorHandling_data() { QTest::addColumn("filePerms"); // -1 means file should not exist -- cgit v1.2.3 From 65858057f0f76908e4734fd06e0cfaeb2ee233cd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 10 Oct 2016 13:57:33 +0200 Subject: configure: Determine MSVC version by evaluating macro _MSC_FULL_VER The previously used regular expression failed for messages in local languages, particularly for the French message containing a non-breaking space. Task-number: QTBUG-56388 Change-Id: Ie757617f1b3a31820d0ed274c4b157d544ac1ea6 Reviewed-by: Oswald Buddenhagen (cherry picked from commit 1bd53131d83cdf595f95f82f0c049d2d68957159) --- tools/configure/environment.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 1a05c9ce62..8f18f3c489 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -150,24 +151,23 @@ QString Environment::gccVersion() QString Environment::msvcVersion() { int returnValue = 0; - // Extract version from standard error output of "cl /?" - const QString command = QFile::decodeName(qgetenv("ComSpec")) - + QLatin1String(" /c ") + QLatin1String(compilerInfo(CC_MSVC2015)->executable) - + QLatin1String(" /? 2>&1"); - QString version = execute(command, &returnValue); - if (returnValue != 0) { - cout << "Could not get cl version" << returnValue << qPrintable(version) << '\n';; - version.clear(); - } else { - QRegExp versionRegexp(QStringLiteral("^.*Compiler Version ([0-9.]+) for.*$")); - Q_ASSERT(versionRegexp.isValid()); - if (versionRegexp.exactMatch(version)) { - version = versionRegexp.cap(1); - } else { - cout << "Unable to determine cl version from the output of \"" - << qPrintable(command) << "\"\n"; - } + QString tempSourceName; + { // QTemporaryFile needs to go out of scope, otherwise cl.exe refuses to open it. + QTemporaryFile tempSource(QDir::tempPath() + QLatin1String("/XXXXXX.cpp")); + tempSource.setAutoRemove(false); + if (!tempSource.open()) + return QString(); + tempSource.write("_MSC_FULL_VER\n"); + tempSourceName = tempSource.fileName(); } + QString version = execute(QLatin1String("cl /nologo /EP \"") + + QDir::toNativeSeparators(tempSourceName) + QLatin1Char('"'), + &returnValue).trimmed(); + QFile::remove(tempSourceName); + if (returnValue || version.size() < 9 || !version.at(0).isDigit()) + return QString(); + version.insert(4, QLatin1Char('.')); + version.insert(2, QLatin1Char('.')); return version; } -- cgit v1.2.3 From 3f347262da369b0a4adae89750f9fe0247fcd486 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 25 Oct 2016 12:12:09 -0700 Subject: Add changes file for 5.7.1 Change-Id: I96f1a5d4d7b559f7c5d3aba3c45eb77744b35cb5 Reviewed-by: Lars Knoll Reviewed-by: Timur Pocheptsov Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Thiago Macieira --- dist/changes-5.7.1 | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 dist/changes-5.7.1 diff --git a/dist/changes-5.7.1 b/dist/changes-5.7.1 new file mode 100644 index 0000000000..83065f01c1 --- /dev/null +++ b/dist/changes-5.7.1 @@ -0,0 +1,221 @@ +Qt 5.7.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.7.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.7 series is binary compatible with the 5.6.x series. +Applications compiled for 5.6 will continue to run with 5.7. + +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. + +This release contains all fixes included in the Qt 5.6.2 release. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - [QTBUG-45031] The NSURLConnection backend of QNetworkAccessManager has + been removed, since SecureTransport is the default SSL backend on iOS + and is enabled by default. This means that building with -no-openssl + -no-securetransport will no longer provide SSL capabilities on iOS. + + - QtCore / QDataStream: + * [QTBUG-54022] Incomplete reads of Qt containers are now handled same + way as for primitive types, meaning that previous errors are latched. + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - QLockFile: + * Fixed permissions on lock files on Unix to allow for adjustments via + umask. + + - QMimeType: + * [QTBUG-50776] QMimeType::comment() now uses the default locale rather + than system locale, so that applications can control which language is + being used. + + - QUrl: + * QUrl::resolved() no longer treats a URL with a scheme as a relative URL + if it matches this URL's scheme. For now it still treats "file:name.txt" + as relative for compatibility, but be warned that in Qt 5.8 it will no + longer consider those to be relative. Both isRelative() and RFC 3986 say + that such URLs are not relative, so starting from Qt 5.8, resolved() will + return them as is. + + - QXmlStreamReader: + * Fixed a bug in the XML parser that prevented to load XML that + contained invalid characters for XML 1.0. + + - QXmlStreamWriter: + * Fixed a bug that prevented the generation of valid XML files when + using encoding with 8 bit per character but not ASCII compatible. + QXMLStreamWriter generated XML markup using always ASCII in this case. + +QtGui +----- + + - QGuiApplication: + * [QTBUG-51703] Fixed a bug that would cause QGuiApplication::sync() to + be left undefined for Qt builds without session management support. + + - QIconLoaderEngine: + * Fixed theme lookup for scalable entries + + - QTextDocument: + * [QTBUG-48182] Fixed a bug that would return a wrong position when + searching backward from the end of the document. + + - Text: + * [QTBUG-49452] Fixed a performance regression in Freetype engine that + was introduced in Qt 5.5. + * [QTBUG-53911] Fixed a crash that could happen if you were doing many + different text layouts with different fonts and superscript or + subscript alignment. + * [QTBUG-42033] Fixed bug where a QTextLayout with + ShowLineAndParagraphSeparators would modify the layout's input string. + * [QTBUG-54180] Fixed performance regression when rapidly switching + between a large set of fonts. + +QtNetwork +--------- + +- QSslSocket: + * [QTBUG-55170] Fixed a bug in SecureTransport backend that would cause + a memory usage growth in case 'readBufferMaxSize' is set. + * [QTBUG-52975] Fixed a bug in SecureTransport backend where transmit + was using invalid SSL context and reporting (incorrectly) some irrelevant + errors as a result. + +QtSql +----- + + - [QTBUG-53969][QTBUG-53237] Fixed QSqlQuery::prepare value truncation + error when using UNSIGNED values in a MySQL database. + +QtWidgets +--------- + + - QAbstractItemDelegate: + * [QTBUG-16469] Show localized detailed tooltips and "What's this?" + texts. + + - QTreeView: + * [QTBUG-52793] Fixed a key navigation bug when the columns were + reordered. + +**************************************************************************** +* Platform-specific Changes * +**************************************************************************** + +Android +------- + + - [QTBUG-50724] Added support for clang compiler + - [QTBUG-53511] Fixed CJK font resolution on Android 7. + +FreeBSD +------- + + - The freebsd-g++ mkspec was moved back and no longer requires the + "unsupported/" prefix, matching the FreeBSD ports tree, as FreeBSD 9.3 + still defaults to using GCC. Users of GCC that did not previously use + the ports patch will need to adapt their build scripts and drop the + "unsupported/" prefix. + +Linux +----- + +- [QTBUG-54733] It is now possible to opt out from installing signal + handlers when running with eglfs and linuxfb by setting the + QT_QPA_NO_SIGNAL_HANDLER environment variable to a non-zero value. +- [QTBUG-55140] xcb with EGL and OpenGL ES, as well as eglfs with the + eglfs_x11 backend, are now supported on DRIVE CX boards when using the + linux-drive-cx-g++ device spec. + + +Windows +------- + + - [QTBUG-41186] QWindow::fromWinId() may return 0 when passing invalid + window handles. + - [QTBUG-55595] Fixed crash when loading color fonts from data. + - [QTBUG-55097] Fixed rendering Adobe/Mozilla format color fonts with + other colors than black after Windows 10 Anniversary update. + - [QTBUG-54494] Fixed stretch when combined with either no or vertical + hinting preference or a device pixel ratio different from 1. + - [QTBUG-51024] Fixed height of text bounding box when using no or + vertical hinting preference, or when the device pixel ratio is + different from 1. + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-35886][QTBUG-51417] Fixed Fontconfig vs. system FreeType + configuration. + - [QTBUG-43784][X11] Fixed detection of GLX with -qt-xcb. + - [QTBUG-51534][Windows] The configure.exe bootstrapping now prefers + cl over clang-cl, to avoid header incompatibility problems. + - [QTBUG-52940] Fixed missing plugins.qmltypes files in static builds. + - [QTBUG-52951] Fixed dynamic library support detection for platforms + without libdl. + - [QTBUG-53038] Fixed running of configure tests outside qtbase when + cross compiling on Windows (for example for Android). + - [QTBUG-53312] The flags supplied by the configure -D/-I/-L/-l options + are now applied after Qt's own flags. This helps in some cases when + the provided paths contain files which conflict with the Qt build. + - [QTBUG-53926] Fixed linkage of QML plugins in static prefix builds. + - [QTBUG-55011][Unix] Fixed -no-pkg-config being ignored by some + configure tests, which led to build failures later on. + - Fixed configure tests outside qtbase when $MAKEFLAGS contains the + -i flag. + - [Android] Some unused plugins are not built anymore. + - [MinGW] Added support for -separate-debug-info. + - [Unix] Added configure -no-opengles3 option. + - [Unix] Fixed MySQL detection/use on RHEL 6.6. + +qmake +----- + + - [QTBUG-41830] Fixed nested custom functions inheriting their callers' + arguments. + - [QTBUG-53895][MSVC] Started using separate PDB files for compiling + and linking. + - [QTBUG-54036][Darwin] Fixed installation of debug symbols. + - [QTBUG-54299] Various QMAKE_EXTRA_COMPILERS' .depends entries are now + appended to rather than overwritten. + - [QTBUG-54346][MSys/Apple] Fixed detection of QMAKE_DEFAULT_{INC,LIB}DIRS. + - [QTBUG-54550] Fixed access to freed memory in $$absolute_path(). + - [QTBUG-54674] The obsolete -target xp is now properly rejected. + - [QTBUG-55183][nmake] _WINDLL is now automatically defined when building + a DLL, consistently with Visual Studio. + - [QTBUG-55505] Fixed build of projects with spaces in the source or build + path against static builds of Qt. + - [QTBUG-55649][QTBUG-55915][Xcode] Fixed support for Xcode 8. + - [QTBUG-56162][MinGW] Fixed -release -force-debug-info missing both + optimization and debug info. + - Fixed several cases where the error() function would not abort qmake. + - Interrupting a command run via system() will now abort qmake as well. + - The packagesExist() function will now warn when used when Qt was + configured with -no-pkg-config. + - [Android] The default compiler flags were adjusted to match newer + NDK versions. + - [Darwin] Fixed detection of QMAKE_DEFAULT_INCDIRS. + - [Darwin][make] Added support for building Xcode asset catalogs. -- cgit v1.2.3 From e79b40ee8f78a9669ed0b7b6def2a69ef7ab02fa Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 1 Nov 2016 15:28:17 -0700 Subject: macOS: Clear event dispatcher interrupt state A pending interrupt of a QEventLoop may interfere with native runModal calls, resulting in Cocoa's main event loop to be stopped unexpectedly. After commit 9ab60b9c processEvents() no longer resets the event dispatcher interrupt flag. Add QCocoaEventDispatcher::clearCurrentThreadCocoa EventDispatcherInterruptFlag(). Use it to clear the interrupt state before calling runModal and variants. Work around the inability to use platform API in the print support code. Change-Id: I3e03e7ec21ff6c49442c7a6e803a7200aac0b58d Task-number: QTBUG-56746 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 5 +++++ src/plugins/platforms/cocoa/qcocoaeventdispatcher.h | 2 ++ src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 13 +++++++++++++ src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 5 +++++ src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 5 +++++ src/plugins/platforms/cocoa/qcocoanativeinterface.h | 2 ++ src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 6 ++++++ src/printsupport/dialogs/qpagesetupdialog_mac.mm | 5 +++++ src/printsupport/dialogs/qprintdialog_mac.mm | 5 +++++ 9 files changed, 48 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 0319d4ca6d..7d12804d47 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -45,6 +45,7 @@ #include "qcocoacolordialoghelper.h" #include "qcocoahelpers.h" +#include "qcocoaeventdispatcher.h" #import @@ -322,6 +323,10 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will // close down during the cleanup. qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + + // Make sure we don't interrupt the runModalForWindow call. + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + [NSApp runModalForWindow:mColorPanel]; mDialogIsExecuting = false; return (mResultCode == NSOKButton); diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h index 84880d51c5..70887c41c9 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -131,6 +131,8 @@ public: void interrupt(); void flush(); + static void clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + friend void qt_mac_maybeCancelWaitForMoreEventsForwarder(QAbstractEventDispatcher *eventDispatcher); }; diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 5c27cf8059..d9c835d797 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -966,6 +966,19 @@ void QCocoaEventDispatcher::interrupt() void QCocoaEventDispatcher::flush() { } +// QTBUG-56746: The behavior of processEvents() has been changed to not clear +// the interrupt flag. Use this function to clear it. + void QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag() +{ + QCocoaEventDispatcher *cocoaEventDispatcher = + qobject_cast(QThread::currentThread()->eventDispatcher()); + if (!cocoaEventDispatcher) + return; + QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = + static_cast(QObjectPrivate::get(cocoaEventDispatcher)); + cocoaEventDispatcherPrivate->interrupt = false; +} + QCocoaEventDispatcher::~QCocoaEventDispatcher() { Q_D(QCocoaEventDispatcher); diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4eb35f5495..c7191e4841 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -53,6 +53,7 @@ #include "qt_mac_p.h" #include "qcocoahelpers.h" #include "qcocoamenubar.h" +#include "qcocoaeventdispatcher.h" #include #include #include @@ -243,6 +244,10 @@ static QString strippedText(QString s) // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will // close down during the cleanup. qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + + // Make sure we don't interrupt the runModal call below. + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder(); mReturnCode = [mSavePanel runModal]; QCocoaMenuBar::resetKnownMenuItemsToQt(); diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index dc7dfb788f..d0b76861d8 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -49,6 +49,7 @@ #include "qcocoafontdialoghelper.h" #include "qcocoahelpers.h" +#include "qcocoaeventdispatcher.h" #import @@ -319,6 +320,10 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will // close down during the cleanup. qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); + + // Make sure we don't interrupt the runModalForWindow call. + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + [NSApp runModalForWindow:mFontPanel]; mDialogIsExecuting = false; return (mResultCode == NSOKButton); diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index 7065a364bf..b06fff1375 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -100,6 +100,8 @@ private: */ Q_INVOKABLE QPixmap defaultBackgroundPixmapForQWizard(); + Q_INVOKABLE void clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + // QMacPastebardMime support. The mac pasteboard void pointers are // QMacPastebardMime instances from the cocoa plugin or qtmacextras // These two classes are kept in sync and can be casted between. diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 8562246817..a327750ffd 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -44,6 +44,7 @@ #include "qcocoahelpers.h" #include "qcocoaapplication.h" #include "qcocoaintegration.h" +#include "qcocoaeventdispatcher.h" #include #include @@ -194,6 +195,11 @@ QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() return QPixmap(); } +void QCocoaNativeInterface::clearCurrentThreadCocoaEventDispatcherInterruptFlag() +{ + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); +} + void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window) { Q_UNUSED(window); diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm index e3e7523a16..c29b911e35 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm +++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm @@ -133,6 +133,11 @@ void QMacPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithNSPrintInfo:printInfo]; if (modality == Qt::ApplicationModal) { + + // Make sure we don't interrupt the runModalWithPrintInfo call. + (void) QMetaObject::invokeMethod(qApp->platformNativeInterface(), + "clearCurrentThreadCocoaEventDispatcherInterruptFlag"); + int rval = [pageLayout runModalWithPrintInfo:printInfo]; [delegate pageLayoutDidEnd:pageLayout returnCode:rval contextInfo:q]; } else { diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index c16bb93013..c630ab634a 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -245,6 +245,11 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality) if (modality == Qt::ApplicationModal || !q->parentWidget()) { if (modality == Qt::NonModal) qWarning("QPrintDialog is required to be modal on OS X"); + + // Make sure we don't interrupt the runModalWithPrintInfo call. + (void) QMetaObject::invokeMethod(qApp->platformNativeInterface(), + "clearCurrentThreadCocoaEventDispatcherInterruptFlag"); + int rval = [printPanel runModalWithPrintInfo:printInfo]; [delegate printPanelDidEnd:printPanel returnCode:rval contextInfo:q]; } else { -- cgit v1.2.3 From 3654a401f8e046e2fa5a340d0380cc0088a03048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 27 Oct 2016 09:57:54 +0200 Subject: Prevent stale QOpenGLContext fbo pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is logic for clearing the qgl_curent_fbo pointer in release(), but it is not always called, causing the pointer to become stale on QOpenGLFramebufferObject deletion. As a last resort, clear the qgl_curent_fbo pointer on the current context if it’s pointing to the object that is being deleted. Change-Id: I0a91d686cec5fcbe4c1520a9ba96cea833bb2249 Task-number: QTBUG-56639 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qopenglcontext_p.h | 2 +- src/gui/opengl/qopenglframebufferobject.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 2fe8446c65..736f816bfe 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -264,7 +264,7 @@ public: static QOpenGLContextPrivate *get(QOpenGLContext *context) { - return context->d_func(); + return context ? context->d_func() : Q_NULLPTR; } #if !defined(QT_NO_DEBUG) diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 14581c89f6..be5407ccbd 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -955,6 +955,12 @@ QOpenGLFramebufferObject::~QOpenGLFramebufferObject() d->stencil_buffer_guard->free(); if (d->fbo_guard) d->fbo_guard->free(); + + QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(QOpenGLContext::currentContext()); + if (contextPrv && contextPrv->qgl_current_fbo == this) { + contextPrv->qgl_current_fbo_invalid = true; + contextPrv->qgl_current_fbo = Q_NULLPTR; + } } /*! -- cgit v1.2.3 From 628d367a9d618568167d43195c1118b7d7979da0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Nov 2016 10:44:37 +0100 Subject: Stabilize tst_QFileDialog2::task143519_deleteAndRenameActionBehavior() The test relied on the file created being automatically selected, which sometimes does not happen when executing the entire test. Explicitly select the file and check the selection. Use the temporary directory for testing. Change-Id: Ia58641c1ac32ba21effa8a5ace9623eb5d48a1c2 Reviewed-by: Maurice Kalinowski --- tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index b457558879..656d4d46de 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -372,8 +372,7 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior() // test based on task233037_selectingDirectory struct TestContext { - TestContext() - : current(QDir::current()) {} + explicit TestContext(const QString &path) : current(path) {} ~TestContext() { file.remove(); current.rmdir(test.dirName()); @@ -381,7 +380,9 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior() QDir current; QDir test; QFile file; - } ctx; + }; + + TestContext ctx(tempDir.path()); // setup testbed QVERIFY(ctx.current.mkdir("task143519_deleteAndRenameActionBehavior_test")); // ensure at least one item @@ -395,6 +396,7 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior() QNonNativeFileDialog fd; fd.setViewMode(QFileDialog::List); fd.setDirectory(ctx.test.absolutePath()); + fd.selectFile(ctx.file.fileName()); fd.show(); QTest::qWaitForWindowActive(&fd); @@ -409,7 +411,7 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior() // defaults QVERIFY(openContextMenu(fd)); - QCOMPARE(fd.selectedFiles().size(), 1); + QCOMPARE(fd.selectedFiles(), QStringList(ctx.file.fileName())); QCOMPARE(rm->isEnabled(), !fd.isReadOnly()); QCOMPARE(mv->isEnabled(), !fd.isReadOnly()); -- cgit v1.2.3 From f2205c48c21a6b135f2f59d0cf46e72f90f9f0f4 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 11 Nov 2016 15:29:28 +0100 Subject: QFontEngine: Cache whether or not a font can be smoothly scaled This will be used by QtQuick to correct a performance regression introduced by 592614ea3ecd90ede2ae1b8e6579d1b898f474ec -- QFontDatabase::isSmoothlyScalable is quite computationally expensive; and now it is unconditionally expensive regardless of the platform. Change-Id: I82bfa65a963c6c3c276d574f2b379da4a9ba5b69 Reviewed-by: Konstantin Ritt Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase.cpp | 3 ++- src/gui/text/qfontengine.cpp | 1 + src/gui/text/qfontengine_p.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index f1b2e84a1e..f1478515f4 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -948,8 +948,8 @@ QFontEngine *loadSingleEngine(int script, return 0; } + engine->isSmoothlyScalable = style->smoothScalable; fontCache->insertEngine(key, engine); - return engine; } } @@ -972,6 +972,7 @@ QFontEngine *loadSingleEngine(int script, return 0; } + engine->isSmoothlyScalable = style->smoothScalable; fontCache->insertEngine(key, engine); if (Q_LIKELY(cacheForCommonScript && !engine->symbol)) { diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index fa49b25073..790dd0b64b 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -251,6 +251,7 @@ QFontEngine::QFontEngine(Type type) cache_cost = 0; fsType = 0; symbol = false; + isSmoothlyScalable = false; glyphFormat = Format_None; m_subPixelPositionCount = 0; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 39cf826ee2..893dfb5092 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -283,6 +283,7 @@ public: uint cache_cost; // amount of mem used in bytes by the font uint fsType : 16; bool symbol; + bool isSmoothlyScalable; struct KernPair { uint left_right; QFixed adjust; -- cgit v1.2.3 From 083d8caee10892d2f3d9597609315231b6f8493a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 20 Oct 2016 23:43:26 +0200 Subject: QXbmHandler: fix missing NUL-termination The buffer is fed into strstr() on the next loop iteration, but strstr() expects a NUL-terminated string. In the equivalent code some lines up, the buffer is explicitly terminated, and we never write the last character of the buffer again, so we'll not fall off the end of the buffer, but if we read less bytes than in the last line, we'll parse garbage from the previous line. Change-Id: I354e1ce1dea71188942305190500b4778a69b4ff Reviewed-by: Edward Welbourne --- src/gui/image/qxbmhandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index 44d07f1624..b21bc75bc4 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -157,6 +157,7 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) } else { // read another line if ((readBytes = device->readLine(buf,buflen)) <= 0) // EOF ==> truncated image break; + buf[readBytes] = '\0'; p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x"); } } -- cgit v1.2.3 From 1753d696070895f309c46ba5aee662b0f3a18bde Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sat, 15 Oct 2016 14:14:00 +0200 Subject: QCss: Fix parsing of charset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When including a CSS file in a HTML file sent to QTextDocument, and the CSS file starts with «@charset "UTF-8";», which is the correct way of declaring that, the parsing fails. If you omit the space, like «@charset"UTF-8";» the parsing succeeds, which is wrong. Fix this by expecting and swallowing whitespace after the @charset tokens. Task-number: QTBUG-54829 Change-Id: I32044e8d24bda70c1eb06bf74af50d4cabe2211d Reviewed-by: Allan Sandfeld Jensen --- src/gui/text/qcssparser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index e96aecdf68..3d6acccdb8 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -2175,6 +2175,7 @@ void Parser::init(const QString &css, bool isFile) bool Parser::parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity) { if (testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("charset"))) { + while (test(S) || test(CDO) || test(CDC)) {} if (!next(STRING)) return false; if (!next(SEMICOLON)) return false; } -- cgit v1.2.3 From e655426e7ac8396713272e123fe0218380e13de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 15 Nov 2016 13:45:22 +0000 Subject: docs: Reference QLineEdit::hasAcceptableInput() in setValidator() Easy to miss otherwise and hasAcceptableInput() already references setValidator(). Change-Id: Id2d63050db670ab8f7150d7f76492664751cd2da Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qlineedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 2cad5d325c..2069c91664 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -605,7 +605,7 @@ const QValidator * QLineEdit::validator() const The initial setting is to have no input validator (i.e. any input is accepted up to maxLength()). - \sa validator(), QIntValidator, QDoubleValidator, QRegExpValidator + \sa validator(), hasAcceptableInput(), QIntValidator, QDoubleValidator, QRegExpValidator */ void QLineEdit::setValidator(const QValidator *v) -- cgit v1.2.3 From 8d8991c697d001e3e205ad03533dc0e5ca5dde0b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 20 Oct 2016 23:33:02 +0200 Subject: QXbmHandler: don't construct a QByteArray just to find '0x' in text Even QByteArray::fromRawData() allocates memory. Instead of QByteArray::contains() and indexOf(), use good ol' strstr(), like already done elsewhere in the same function. Apart from the memory allocations saved, this fixes a Coverity error complaining that indexOf() can return -1. It's a false positive on the first occurrence, because we didn't call that function unless we know there is a "0x" in the string, but the second _was_ wrong, because we applied it on a new buffer, with unknown content. Coverity-Id: 11262 Change-Id: I18f352c5576e24f89a5c3ef7f2f1b2176f2a235d Reviewed-by: Edward Welbourne --- src/gui/image/qxbmhandler.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index b21bc75bc4..ada2485363 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -118,17 +118,18 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) qint64 readBytes = 0; + char *p; + // scan for database - for (;;) { + do { if ((readBytes = device->readLine(buf, buflen)) <= 0) { // end of file return false; } buf[readBytes] = '\0'; - if (QByteArray::fromRawData(buf, readBytes).contains("0x")) - break; - } + p = strstr(buf, "0x"); + } while (!p); if (outImage->size() != QSize(w, h) || outImage->format() != QImage::Format_MonoLSB) { *outImage = QImage(w, h, QImage::Format_MonoLSB); @@ -142,7 +143,6 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) int x = 0, y = 0; uchar *b = outImage->scanLine(0); - char *p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x"); w = (w+7)/8; // byte width while (y < h) { // for all encoded bytes... @@ -158,7 +158,7 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) if ((readBytes = device->readLine(buf,buflen)) <= 0) // EOF ==> truncated image break; buf[readBytes] = '\0'; - p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x"); + p = strstr(buf, "0x"); } } -- cgit v1.2.3 From bebbaa43fd21baf0b2235199e84898f18d6cc861 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 30 Sep 2016 15:51:30 +0200 Subject: Fix warnings in tst_q{table,list}widget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC warned: tst_qtablewidget.cpp:30: tst_qtablewidget.cpp: In member function ‘void tst_QTableWidget::mimeData()’: qtestcase.h:66:52: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if (!QTest::qVerify(static_cast(statement), #statement, "", __FILE__, __LINE__))\ ^ tst_qtablewidget.cpp:1523:5: note: in expansion of macro ‘QVERIFY’ QVERIFY(data = table.mimeData(tableWidgetItemList)); ^~~~~~~ Fix by adding the extra parentheses, as usual. Change-Id: I2826d7a865b4113b468d5a958ede06e03aa0e278 Reviewed-by: Edward Welbourne Reviewed-by: Marc Mutz --- tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp | 8 ++++---- tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index ecf72613da..f526c041f5 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -1688,16 +1688,16 @@ void tst_QListWidget::mimeData() QMimeData *data; - QVERIFY(data = list.mimeData(tableWidgetItemList)); + QVERIFY((data = list.mimeData(tableWidgetItemList))); delete data; - QVERIFY(data = list.model()->mimeData(modelIndexList)); + QVERIFY((data = list.model()->mimeData(modelIndexList))); delete data; - QVERIFY(data = list.model()->mimeData(modelIndexList)); + QVERIFY((data = list.model()->mimeData(modelIndexList))); delete data; - QVERIFY(data = list.mimeData(tableWidgetItemList)); + QVERIFY((data = list.mimeData(tableWidgetItemList))); delete data; // check the saved data is actually the same diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index ea31fd19dd..ff3cb72832 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -1537,16 +1537,16 @@ void tst_QTableWidget::mimeData() QMimeData *data; - QVERIFY(data = table.mimeData(tableWidgetItemList)); + QVERIFY((data = table.mimeData(tableWidgetItemList))); delete data; - QVERIFY(data = table.model()->mimeData(modelIndexList)); + QVERIFY((data = table.model()->mimeData(modelIndexList))); delete data; - QVERIFY(data = table.model()->mimeData(modelIndexList)); + QVERIFY((data = table.model()->mimeData(modelIndexList))); delete data; - QVERIFY(data = table.mimeData(tableWidgetItemList)); + QVERIFY((data = table.mimeData(tableWidgetItemList))); delete data; // check the saved data is actually the same -- cgit v1.2.3 From 48d7db6b3119ee27d9ae6b1bd0fdb24333f44756 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 16 Nov 2016 13:51:08 +0300 Subject: QtCore: Add missing override Change-Id: Ifdec31aabdd0371f36abbb382e49f52f5b58ee94 Reviewed-by: hjk --- src/corelib/codecs/qsimplecodec_p.h | 10 +++++----- src/corelib/io/qfile_p.h | 2 +- src/corelib/io/qtemporaryfile_p.h | 14 +++++++------- src/corelib/mimetypes/qmimetypeparser_p.h | 10 +++++----- src/corelib/statemachine/qhistorystate_p.h | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/corelib/codecs/qsimplecodec_p.h b/src/corelib/codecs/qsimplecodec_p.h index d45cf2377f..a84f9af1e9 100644 --- a/src/corelib/codecs/qsimplecodec_p.h +++ b/src/corelib/codecs/qsimplecodec_p.h @@ -66,12 +66,12 @@ public: explicit QSimpleTextCodec(int); ~QSimpleTextCodec(); - QString convertToUnicode(const char *, int, ConverterState *) const; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; - QByteArray name() const; - QList aliases() const; - int mibEnum() const; + QByteArray name() const override; + QList aliases() const override; + int mibEnum() const override; private: int forwardIndex; diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h index fd7db3c120..545890c6b3 100644 --- a/src/corelib/io/qfile_p.h +++ b/src/corelib/io/qfile_p.h @@ -70,7 +70,7 @@ protected: bool openExternalFile(int flags, int fd, QFile::FileHandleFlags handleFlags); bool openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handleFlags); - virtual QAbstractFileEngine *engine() const; + QAbstractFileEngine *engine() const override; QString fileName; }; diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index 58cc318ffd..40974bd6cd 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -69,7 +69,7 @@ protected: QTemporaryFilePrivate(); ~QTemporaryFilePrivate(); - QAbstractFileEngine *engine() const; + QAbstractFileEngine *engine() const override; void resetFileEngine() const; bool autoRemove; @@ -98,14 +98,14 @@ public: ~QTemporaryFileEngine(); bool isReallyOpen() const; - void setFileName(const QString &file); + void setFileName(const QString &file) override; void setFileTemplate(const QString &fileTemplate); - bool open(QIODevice::OpenMode flags); - bool remove(); - bool rename(const QString &newName); - bool renameOverwrite(const QString &newName); - bool close(); + bool open(QIODevice::OpenMode flags) override; + bool remove() override; + bool rename(const QString &newName) override; + bool renameOverwrite(const QString &newName) override; + bool close() override; quint32 fileMode; bool filePathIsTemplate; diff --git a/src/corelib/mimetypes/qmimetypeparser_p.h b/src/corelib/mimetypes/qmimetypeparser_p.h index a502439419..0ce39e701c 100644 --- a/src/corelib/mimetypes/qmimetypeparser_p.h +++ b/src/corelib/mimetypes/qmimetypeparser_p.h @@ -108,19 +108,19 @@ public: explicit QMimeTypeParser(QMimeXMLProvider &provider) : m_provider(provider) {} protected: - inline bool process(const QMimeType &t, QString *) + inline bool process(const QMimeType &t, QString *) override { m_provider.addMimeType(t); return true; } - inline bool process(const QMimeGlobPattern &glob, QString *) + inline bool process(const QMimeGlobPattern &glob, QString *) override { m_provider.addGlobPattern(glob); return true; } - inline void processParent(const QString &child, const QString &parent) + inline void processParent(const QString &child, const QString &parent) override { m_provider.addParent(child, parent); } - inline void processAlias(const QString &alias, const QString &name) + inline void processAlias(const QString &alias, const QString &name) override { m_provider.addAlias(alias, name); } - inline void processMagicMatcher(const QMimeMagicRuleMatcher &matcher) + inline void processMagicMatcher(const QMimeMagicRuleMatcher &matcher) override { m_provider.addMagicMatcher(matcher); } private: diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h index 2e93c31982..f3eb20f194 100644 --- a/src/corelib/statemachine/qhistorystate_p.h +++ b/src/corelib/statemachine/qhistorystate_p.h @@ -87,8 +87,8 @@ protected: // state, it will handle this transition as a special case. The history state itself is never // entered either: either the stored configuration will be used, or the target(s) of this // transition are used. - virtual bool eventTest(QEvent *event) { Q_UNUSED(event); return false; } - virtual void onTransition(QEvent *event) { Q_UNUSED(event); } + bool eventTest(QEvent *event) override { Q_UNUSED(event); return false; } + void onTransition(QEvent *event) override { Q_UNUSED(event); } }; QT_END_NAMESPACE -- cgit v1.2.3 From bd591064be388216f91d48522b3bdbc1be93bb92 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 21 Oct 2016 17:14:31 +0200 Subject: Use QPersistentModelIndex for storing a model index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QModelIndex is not safe to be used to store an index as it is designed to be discarded right after use as the index information can change. Therefore a QPersistentModelIndex should be used instead to store the index. Subsequently the m_index does not need to be updated whenever the model changes anymore as this is already done for us. Task-number: QTBUG-49907 Change-Id: Icc93e410de2821c503ea15a7a1dd9ae32634914e Reviewed-by: Jan Arve Sæther --- src/widgets/accessible/itemviews.cpp | 42 ++++------------------ src/widgets/accessible/itemviews_p.h | 2 +- .../other/qaccessibility/tst_qaccessibility.cpp | 5 ++- 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index 1b724c9a17..d58db8de32 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -550,20 +550,8 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event) QAccessible::Id id = iter.value(); QAccessibleInterface *iface = QAccessible::accessibleInterface(id); Q_ASSERT(iface); - if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) { - Q_ASSERT(iface->tableCellInterface()); - QAccessibleTableCell *cell = static_cast(iface->tableCellInterface()); - if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted - && cell->m_index.row() >= event->firstRow()) { - int newRow = cell->m_index.row() + newRows; - cell->m_index = cell->m_index.sibling(newRow, cell->m_index.column()); - } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsInserted - && cell->m_index.column() >= event->firstColumn()) { - int newColumn = cell->m_index.column() + newColumns; - cell->m_index = cell->m_index.sibling(cell->m_index.row(), newColumn); - } - } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted - && iface->role() == QAccessible::RowHeader) { + if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted + && iface->role() == QAccessible::RowHeader) { QAccessibleTableHeaderCell *cell = static_cast(iface); if (cell->index >= event->firstRow()) { cell->index += newRows; @@ -602,27 +590,11 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event) if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) { Q_ASSERT(iface->tableCellInterface()); QAccessibleTableCell *cell = static_cast(iface->tableCellInterface()); - if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsRemoved) { - if (cell->m_index.row() < event->firstRow()) { - newCache.insert(indexOfChild(cell), id); - } else if (cell->m_index.row() > event->lastRow()) { - int newRow = cell->m_index.row() - deletedRows; - cell->m_index = cell->m_index.sibling(newRow, cell->m_index.column()); - newCache.insert(indexOfChild(cell), id); - } else { - QAccessible::deleteAccessibleInterface(id); - } - } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsRemoved) { - if (cell->m_index.column() < event->firstColumn()) { - newCache.insert(indexOfChild(cell), id); - } else if (cell->m_index.column() > event->lastColumn()) { - int newColumn = cell->m_index.column() - deletedColumns; - cell->m_index = cell->m_index.sibling(cell->m_index.row(), newColumn); - newCache.insert(indexOfChild(cell), id); - } else { - QAccessible::deleteAccessibleInterface(id); - } - } + // Since it is a QPersistentModelIndex, we only need to check if it is valid + if (cell->m_index.isValid()) + newCache.insert(indexOfChild(cell), id); + else + QAccessible::deleteAccessibleInterface(id); } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsRemoved && iface->role() == QAccessible::RowHeader) { QAccessibleTableHeaderCell *cell = static_cast(iface); diff --git a/src/widgets/accessible/itemviews_p.h b/src/widgets/accessible/itemviews_p.h index 6a18a1231b..b3cd456585 100644 --- a/src/widgets/accessible/itemviews_p.h +++ b/src/widgets/accessible/itemviews_p.h @@ -207,7 +207,7 @@ private: QHeaderView *verticalHeader() const; QHeaderView *horizontalHeader() const; QPointer view; - QModelIndex m_index; + QPersistentModelIndex m_index; QAccessible::Role m_role; void selectCell(); diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 62c2c0a916..3d78749024 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -2903,7 +2903,10 @@ void tst_QAccessibility::listTest() QAccessibleInterface *cellMunich3 = table2->cellAt(2,0); QCOMPARE(cell4, cellMunich3); QCOMPARE(axidMunich, QAccessible::uniqueId(cellMunich3)); - + delete listView->takeItem(2); + // list: Oslo, Helsinki + // verify that it doesn't return an invalid item from the cache + QVERIFY(table2->cellAt(2,0) == 0); delete listView; } -- cgit v1.2.3 From 658c8370e4dd74ee82046799b56947bb3c738b92 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 22 Jan 2016 17:03:48 +0100 Subject: QDateTimeParser: localize variable to avoid shadowing The outer scope it was in had a later clause with its own pos variable. Change-Id: I8d083d3d5935416ef82a78890ed145f02d6d6ded Reviewed-by: Timur Pocheptsov --- src/corelib/tools/qdatetimeparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 5b7bf0d3d4..bda786aa24 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -879,12 +879,12 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos State state = Acceptable; QDateTime newCurrentValue; - int pos = 0; bool conflicts = false; const int sectionNodesCount = sectionNodes.size(); QDTPDEBUG << "parse" << input; { + int pos = 0; int year, month, day; currentValue.date().getDate(&year, &month, &day); int year2digits = year % 100; -- cgit v1.2.3 From ac384524c8fa6b19153811e2eaf6dac6b911f930 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 14 Oct 2016 14:51:16 +0200 Subject: Speculative fix for tst_QThread::wait2() flakiness This test fails on Windows occasionally with values just short of 800, the lowest observed being 791. It is probably rounding somehow to 10ms segments, so allow it to be up to 10 ms too fast. Change-Id: Ie28e9f61588b68a9060a006f78eedc3a26d05155 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira Reviewed-by: Simon Hausmann --- tests/auto/corelib/thread/qthread/tst_qthread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 3230472d5b..d7294c3ee6 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -1082,8 +1082,8 @@ void tst_QThread::wait2() thread.start(); timer.start(); QVERIFY(!thread.wait(Waiting_Thread::WaitTime)); - qint64 elapsed = timer.elapsed(); // On Windows, we sometimes get (WaitTime - 1). - QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 1, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed))); + qint64 elapsed = timer.elapsed(); // On Windows, we sometimes get (WaitTime - 9). + QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 10, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed))); timer.start(); thread.cond1.wakeOne(); -- cgit v1.2.3 From 35953be53bfe06f01f6b8cfde70d7e793341e481 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 7 Oct 2016 20:16:58 +0200 Subject: fix xcodebuilds without -sdk iphonesimulator the order of the arguments passed to addExclusiveBuilds() determines the name of the CONFIG flag which actually enables the mode. that is historically fixed to iphonesimulator_and_iphoneos and we cannot just change the order. to get around this, add a new "overload" of the function which allows specifying the flag independently from the order of the builds, and make use of it in ios' resolve_config.prf. amends d2b4a789c. Change-Id: Ia3fabea0c0c30beae680b57e75bdcdf35ef6503d (cherry picked from 59985b3c291f769cfc24cf361367757fce229397) Reviewed-by: Jake Petroules Reviewed-by: Oswald Buddenhagen --- mkspecs/features/exclusive_builds.prf | 18 +++++++++++------- mkspecs/macx-ios-clang/features/resolve_config.prf | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/mkspecs/features/exclusive_builds.prf b/mkspecs/features/exclusive_builds.prf index 5d06198ae4..f40cc99172 100644 --- a/mkspecs/features/exclusive_builds.prf +++ b/mkspecs/features/exclusive_builds.prf @@ -1,12 +1,9 @@ -defineTest(addExclusiveBuilds) { - lessThan(ARGC, 2): \ - error("addExclusiveBuilds() requires at least two arguments") - - !$$join(ARGS, _and_):!fix_output_dirs: \ +defineTest(addExclusiveBuildsProper) { + !$$1:!fix_output_dirs: \ return(true) - for(build, ARGS) { + for(build, 2) { isEmpty($${build}.name) { $${build}.name = $$title($$build) export($${build}.name) @@ -20,7 +17,7 @@ defineTest(addExclusiveBuilds) { export($${build}.dir_affix) } - $${build}.exclusive = $$ARGS + $${build}.exclusive = $$2 export($${build}.exclusive) QMAKE_EXCLUSIVE_BUILDS += $$build @@ -33,6 +30,13 @@ defineTest(addExclusiveBuilds) { return(true) } +defineTest(addExclusiveBuilds) { + lessThan(ARGC, 2): \ + error("addExclusiveBuilds() requires at least two arguments") + + addExclusiveBuildsProper($$join(ARGS, _and_), $$ARGS) +} + # Default directories to process QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR QGLTF_DIR DESTDIR QMAKE_DIR_REPLACE_SANE += QGLTF_DIR diff --git a/mkspecs/macx-ios-clang/features/resolve_config.prf b/mkspecs/macx-ios-clang/features/resolve_config.prf index a964ee3278..22d962af38 100644 --- a/mkspecs/macx-ios-clang/features/resolve_config.prf +++ b/mkspecs/macx-ios-clang/features/resolve_config.prf @@ -32,9 +32,9 @@ macx-xcode { } else { # Switch the order to make sure that the first Makefile target is the right one !contains(QT_CONFIG, simulator_and_device):contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \ - addExclusiveBuilds(simulator, device) + addExclusiveBuildsProper(simulator_and_device, simulator device) else: \ - addExclusiveBuilds(device, simulator) + addExclusiveBuildsProper(simulator_and_device, device simulator) } equals(TEMPLATE, subdirs) { -- cgit v1.2.3 From db6c31af0177025f178cb42d5febbdc47dc87778 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Fri, 11 Nov 2016 12:34:54 -0800 Subject: qmake: fix installation of asset catalog files This strips leading whitespace from asset catalog filenames, which was causing installation to fail due to incorrectly calculated paths. Task-number: QTBUG-57090 Change-Id: I80db627262f9d58f4403e2d8ab205bef2113992b (cherry picked from commit addf1f45f3e2c37a09ef7f7bab909467c2bf79f7) Reviewed-by: Jake Petroules Reviewed-by: Oswald Buddenhagen --- mkspecs/features/mac/asset_catalogs.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/mac/asset_catalogs.prf b/mkspecs/features/mac/asset_catalogs.prf index 57d93d56d5..87875136c2 100644 --- a/mkspecs/features/mac/asset_catalogs.prf +++ b/mkspecs/features/mac/asset_catalogs.prf @@ -65,7 +65,7 @@ actool_output_files = $$system(\ mkdir -p $$system_quote($$QMAKE_ASSET_CATALOGS_BUILD_PATH) && \ /usr/libexec/PlistBuddy -c \'Print :com.apple.actool.compilation-results:output-files\' \ - /dev/stdin <<< $($${asset_catalog_compiler.commands} 2>/dev/null) | grep \'^ .*$\', lines) + /dev/stdin <<< $($${asset_catalog_compiler.commands} 2>/dev/null) | sed -Ene \'s/^ +//p\', lines) for (output_file, actool_output_files) { !equals(output_file, $$asset_catalog_compiler.target): \ -- cgit v1.2.3 From a56dd0b82855dd91d95159de4b568203a026b66c Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 18 Jan 2016 17:07:56 +0100 Subject: tst_QDateTimeEdit: Use base method, not direct member access A test was directly accessing the .text member of QDateTimeParser (which presently has nothing private). Use the virtual .displayText() method of this base instead, to let the base have some hope of data-hiding (maybe, some day). Change-Id: I8b6e39fba130de56f117bffb2aec346197969c5b Reviewed-by: Timur Pocheptsov --- tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 08a28f3ea0..ee54b16990 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -3749,7 +3749,7 @@ void tst_QDateTimeEdit::dateEditCorrectSectionSize() QTest::keyClick(&edit, keyPair.first, keyPair.second); QDateTimeEditPrivate* edit_d_ptr(static_cast(qt_widget_private(&edit))); - QCOMPARE(edit_d_ptr->text, expectedDisplayString); + QCOMPARE(edit_d_ptr->QDateTimeParser::displayText(), expectedDisplayString); } #endif -- cgit v1.2.3 From 1a3a8cf87b322b45fe38db7c270ce8235e979d3b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 17 Nov 2016 11:17:33 +0100 Subject: QDeadlineTimer: mark more functions nothrow Change-Id: I3be9c69b46901311e9150a7f718707d8ff523e9e Reviewed-by: Thiago Macieira --- src/corelib/kernel/qdeadlinetimer.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h index 3b97b89359..aa0f735fcc 100644 --- a/src/corelib/kernel/qdeadlinetimer.h +++ b/src/corelib/kernel/qdeadlinetimer.h @@ -62,7 +62,7 @@ public: : t1(std::numeric_limits::max()), t2(0), type(type_) {} explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW; - void swap(QDeadlineTimer &other) + void swap(QDeadlineTimer &other) Q_DECL_NOTHROW { qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); } Q_DECL_CONSTEXPR bool isForever() const Q_DECL_NOTHROW @@ -88,17 +88,17 @@ public: static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION; static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW; - friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) + friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW { return d1.t1 == d2.t1 && d1.t2 == d2.t2; } - friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) + friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW { return !(d1 == d2); } - friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) + friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW { return d1.t1 < d2.t1 || (d1.t1 == d2.t1 && d1.t2 < d2.t2); } - friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) + friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW { return d1 == d2 || d1 < d2; } - friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) + friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW { return d2 < d1; } - friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) + friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW { return !(d1 < d2); } friend QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs) -- cgit v1.2.3 From f817a995b2f72d4d293816de7ae05b37585eb48d Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 14 Nov 2016 12:16:20 +0100 Subject: tst_qhooks: test that it's possible to chain multiple hooks together Chaining hooks together was mentioned by Ossi in the comments of d953d9a4. This patch justs add a test that verifies that it works, and also serves as an informal example for developers looking how to do it. Change-Id: I53a014d5663c289ea0559e0926ed301f4e5110e6 Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- tests/auto/corelib/global/qhooks/tst_qhooks.cpp | 70 +++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp index f0685d64c5..5fa7566e86 100644 --- a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp +++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp @@ -35,10 +35,18 @@ class tst_QHooks: public QObject Q_OBJECT private slots: + void cleanup(); void testVersion(); void testAddRemoveObject(); + void testChaining(); }; +void tst_QHooks::cleanup() +{ + qtHookData[QHooks::AddQObject] = 0; + qtHookData[QHooks::RemoveQObject] = 0; +} + void tst_QHooks::testVersion() { QVERIFY(qtHookData[QHooks::HookDataVersion] >= 3); @@ -73,5 +81,67 @@ void tst_QHooks::testAddRemoveObject() QCOMPARE(objectCount, 0); } +static QVector hookOrder; + +static QHooks::AddQObjectCallback existingAddHook = 0; +static QHooks::RemoveQObjectCallback existingRemoveHook = 0; + +static void firstAddHook(QObject *) +{ + hookOrder.append(QLatin1String("firstAddHook")); +} + +static void firstRemoveHook(QObject *) +{ + hookOrder.append(QLatin1String("firstRemoveHook")); +} + +static void secondAddHook(QObject *object) +{ + if (existingAddHook) + existingAddHook(object); + + hookOrder.append(QLatin1String("secondAddHook")); +} + +static void secondRemoveHook(QObject *object) +{ + if (existingRemoveHook) + existingRemoveHook(object); + + hookOrder.append(QLatin1String("secondRemoveHook")); +} + +// Tests that it's possible to "chain" hooks together (i.e. have multiple hooks) +void tst_QHooks::testChaining() +{ + QCOMPARE(qtHookData[QHooks::AddQObject], (quintptr)0); + QCOMPARE(qtHookData[QHooks::RemoveQObject], (quintptr)0); + + // Set the add and remove hooks (could just skip this and go straight to the next step, + // but it's for illustrative purposes). + qtHookData[QHooks::AddQObject] = (quintptr)&firstAddHook; + qtHookData[QHooks::RemoveQObject] = (quintptr)&firstRemoveHook; + + // Store them so that we can call them later. + existingAddHook = reinterpret_cast(qtHookData[QHooks::AddQObject]); + existingRemoveHook = reinterpret_cast(qtHookData[QHooks::RemoveQObject]); + + // Overide them with hooks that call them first. + qtHookData[QHooks::AddQObject] = (quintptr)&secondAddHook; + qtHookData[QHooks::RemoveQObject] = (quintptr)&secondRemoveHook; + + QObject *obj = new QObject; + QCOMPARE(hookOrder.size(), 2); + QCOMPARE(hookOrder.at(0), QLatin1String("firstAddHook")); + QCOMPARE(hookOrder.at(1), QLatin1String("secondAddHook")); + delete obj; + QCOMPARE(hookOrder.size(), 4); + QCOMPARE(hookOrder.at(2), QLatin1String("firstRemoveHook")); + QCOMPARE(hookOrder.at(3), QLatin1String("secondRemoveHook")); + + hookOrder.clear(); +} + QTEST_APPLESS_MAIN(tst_QHooks) #include "tst_qhooks.moc" -- cgit v1.2.3 From 4b1c343e5e8f75b567e88541c1b8ea89a3a5b666 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 15 Nov 2016 15:11:00 +0100 Subject: Doc: Add missing reference to qInfo() Change-Id: I7438aa8ff9fddf2e0155ffe0d442f96d4d9265d4 Reviewed-by: Leena Miettinen --- src/corelib/global/qlogging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index eb26b6198d..6b95449b3d 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1748,7 +1748,7 @@ void qErrnoWarning(int code, const char *msg, ...) \snippet code/src_corelib_global_qglobal.cpp 23 - \sa QtMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(), + \sa QtMessageHandler, QtMsgType, qDebug(), qInfo(), qWarning(), qCritical(), qFatal(), {Debugging Techniques} */ -- cgit v1.2.3 From 0d2f0164f45cb626c40a7c95026ba00fa56ac249 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 15 Nov 2016 15:12:16 +0100 Subject: Also release winmain, qopenglextensions under commercial licenses Add commercial licenses as an alternative to BSD for code that is statically linked into applications by default. BSD requires attribution even for commercial customers, which is not intended. This is a manual backport of parts of change 71404b0be146 in 5.7, and should be dropped when merging to 5.7. [ChangeLog][License Changes] Static libraries that are linked into executables (winmain and qopenglextensions) are now licensed under BSD _and_ commercial licenses. Change-Id: I0d33bc09c06548d63b11a39027e9bb12c1b9a915 Reviewed-by: Lars Knoll --- header.BSD-NEW | 50 ++++++++++++++++++++++++++++++ src/openglextensions/qopenglextensions.cpp | 14 +++++++-- src/openglextensions/qopenglextensions.h | 14 +++++++-- src/winmain/qtmain_win.cpp | 16 ++++++++-- src/winmain/qtmain_winrt.cpp | 16 ++++++++-- util/glgen/qopenglextensions.cpp.header | 14 +++++++-- util/glgen/qopenglextensions.h.header | 14 +++++++-- 7 files changed, 124 insertions(+), 14 deletions(-) create mode 100644 header.BSD-NEW diff --git a/header.BSD-NEW b/header.BSD-NEW new file mode 100644 index 0000000000..980b021aad --- /dev/null +++ b/header.BSD-NEW @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD-NEW$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/src/openglextensions/qopenglextensions.cpp b/src/openglextensions/qopenglextensions.cpp index 37c5a5d1f0..f35d5b298a 100644 --- a/src/openglextensions/qopenglextensions.cpp +++ b/src/openglextensions/qopenglextensions.cpp @@ -5,8 +5,18 @@ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:BSD-NEW$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/openglextensions/qopenglextensions.h b/src/openglextensions/qopenglextensions.h index c9d1ef1267..7ecdee44c0 100644 --- a/src/openglextensions/qopenglextensions.h +++ b/src/openglextensions/qopenglextensions.h @@ -5,8 +5,18 @@ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:BSD-NEW$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index 2944e07e00..da3d722aa6 100644 --- a/src/winmain/qtmain_win.cpp +++ b/src/winmain/qtmain_win.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Windows main function of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:BSD-NEW$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp index 81ca07e447..a11efc1b74 100644 --- a/src/winmain/qtmain_winrt.cpp +++ b/src/winmain/qtmain_winrt.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Windows main function of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:BSD-NEW$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/util/glgen/qopenglextensions.cpp.header b/util/glgen/qopenglextensions.cpp.header index 1127d0bb20..a5ced11ce1 100644 --- a/util/glgen/qopenglextensions.cpp.header +++ b/util/glgen/qopenglextensions.cpp.header @@ -5,8 +5,18 @@ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:BSD-NEW$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are diff --git a/util/glgen/qopenglextensions.h.header b/util/glgen/qopenglextensions.h.header index 8355163dcd..93dcb026d1 100644 --- a/util/glgen/qopenglextensions.h.header +++ b/util/glgen/qopenglextensions.h.header @@ -5,8 +5,18 @@ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** $QT_BEGIN_LICENSE:BSD-NEW$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are -- cgit v1.2.3 From cb0d8ffdd930ed0b8b3966e133e91d8de44b0239 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 16 Nov 2016 12:34:00 +0100 Subject: Extend manual test windowflags Change the main window to contain a QTabWidget and add a log widget logging relevant events on the top level widgets for testing changes. In the preview window, add new window flags of Qt 5 and output geometry, margins and window state in addition. Change-Id: Icec366223b6c163d58a69034687f3d9323a91533 Reviewed-by: Oliver Wolff --- tests/manual/windowflags/controllerwindow.cpp | 237 +++++++++++++++++----- tests/manual/windowflags/controllerwindow.h | 39 +++- tests/manual/windowflags/main.cpp | 8 + tests/manual/windowflags/previewwindow.cpp | 271 ++++++++++++++++++-------- tests/manual/windowflags/previewwindow.h | 31 +-- 5 files changed, 434 insertions(+), 152 deletions(-) diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp index 7196608aa5..d02f64c27b 100644 --- a/tests/manual/windowflags/controllerwindow.cpp +++ b/tests/manual/windowflags/controllerwindow.cpp @@ -26,20 +26,33 @@ ** ****************************************************************************/ -#include -#include -#include -#include +#include "controllerwindow.h" +#include "controls.h" + +#include +#include #include #include -#include #include +#include +#include +#include +#include +#include +#include -#include "controllerwindow.h" -#include "controls.h" +#include + +#if QT_VERSION >= 0x050000 +# include +# include +# include +#endif +#include -//! [0] -ControllerWindow::ControllerWindow() : previewWidget(0) +ControllerWidget::ControllerWidget(QWidget *parent) + : QWidget(parent) + , previewWidget(0) { parentWindow = new QMainWindow; parentWindow->setWindowTitle(tr("Preview parent window")); @@ -53,18 +66,6 @@ ControllerWindow::ControllerWindow() : previewWidget(0) createTypeGroupBox(); - quitButton = new QPushButton(tr("&Quit")); - connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); - - QHBoxLayout *bottomLayout = new QHBoxLayout; - bottomLayout->addStretch(); - - QPushButton *updateControlsButton = new QPushButton(tr("&Update")); - connect(updateControlsButton, SIGNAL(clicked()), this, SLOT(updateStateControl())); - - bottomLayout->addWidget(updateControlsButton); - bottomLayout->addWidget(quitButton); - hintsControl = new HintControl; hintsControl->setHints(previewWindow->windowFlags()); connect(hintsControl, SIGNAL(changed(Qt::WindowFlags)), this, SLOT(updatePreview())); @@ -78,39 +79,30 @@ ControllerWindow::ControllerWindow() : previewWidget(0) typeControl->setType(previewWindow->windowFlags()); connect(typeControl, SIGNAL(changed(Qt::WindowFlags)), this, SLOT(updatePreview())); - QVBoxLayout *mainLayout = new QVBoxLayout; + QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(widgetTypeGroupBox); mainLayout->addWidget(additionalOptionsGroupBox); mainLayout->addWidget(typeControl); mainLayout->addWidget(hintsControl); mainLayout->addWidget(statesControl); - mainLayout->addLayout(bottomLayout); - setLayout(mainLayout); - setWindowTitle(tr("Window Flags (Qt version %1, %2)") - .arg(QLatin1String(qVersion()), -#if QT_VERSION >= 0x050000 - qApp->platformName())); -#else - QLatin1String(""))); -#endif updatePreview(); } -bool ControllerWindow::eventFilter(QObject *, QEvent *e) +bool ControllerWidget::eventFilter(QObject *, QEvent *e) { if (e->type() == QEvent::WindowStateChange) updateStateControl(); return false; } -void ControllerWindow::updateStateControl() +void ControllerWidget::updateStateControl() { if (previewWidget) statesControl->setStates(previewWidget->windowState()); } -void ControllerWindow::updatePreview() +void ControllerWidget::updatePreview() { const Qt::WindowFlags flags = typeControl->type() | hintsControl->hints(); @@ -154,7 +146,7 @@ void ControllerWindow::updatePreview() previewWidget->setVisible(statesControl->visibleValue()); } -void ControllerWindow::createTypeGroupBox() +void ControllerWidget::createTypeGroupBox() { widgetTypeGroupBox = new QGroupBox(tr("Widget Type")); previewWidgetButton = createRadioButton(tr("QWidget")); @@ -173,24 +165,181 @@ void ControllerWindow::createTypeGroupBox() l->addWidget(fixedSizeWindowCheckBox); additionalOptionsGroupBox->setLayout(l); } -//! [5] - -//! [6] -//! [7] -QCheckBox *ControllerWindow::createCheckBox(const QString &text) +QCheckBox *ControllerWidget::createCheckBox(const QString &text) { QCheckBox *checkBox = new QCheckBox(text); connect(checkBox, SIGNAL(clicked()), this, SLOT(updatePreview())); return checkBox; } -//! [7] -//! [8] -QRadioButton *ControllerWindow::createRadioButton(const QString &text) +QRadioButton *ControllerWidget::createRadioButton(const QString &text) { QRadioButton *button = new QRadioButton(text); connect(button, SIGNAL(clicked()), this, SLOT(updatePreview())); return button; } -//! [8] + +static bool isTopLevel(const QObject *o) +{ + if (o->isWidgetType()) + return static_cast(o)->isWindow(); +#if QT_VERSION >= 0x050000 + if (o->isWindowType()) + return static_cast(o)->isTopLevel(); +#endif + return false; +} + +static Qt::WindowState windowState(const QObject *o) +{ + if (o->isWidgetType()) { + Qt::WindowStates states = static_cast(o)->windowState(); + states &= ~Qt::WindowActive; + return static_cast(int(states)); + } +#if QT_VERSION >= 0x050000 + if (o->isWindowType()) + return static_cast(o)->windowState(); +#endif + return Qt::WindowNoState; +} + +class EventFilter : public QObject { +public: + explicit EventFilter(QObject *parent = 0) : QObject(parent) {} + + bool eventFilter(QObject *o, QEvent *e) + { + switch (e->type()) { + case QEvent::Move: + case QEvent::Resize: + case QEvent::WindowStateChange: + case QEvent::ApplicationActivate: + case QEvent::ApplicationDeactivate: +#if QT_VERSION >= 0x050000 + case QEvent::ApplicationStateChange: +#endif + if (isTopLevel(o)) + formatEvent(o, e); + break; + default: + break; + } + return QObject::eventFilter(o ,e); + } + +private: + void formatEvent(QObject *o, QEvent *e) + { + static int n = 0; + QDebug debug = qDebug().nospace(); +#if QT_VERSION >= 0x050000 + debug.noquote(); +#endif + debug << '#' << n++ << ' ' << o->metaObject()->className(); + const QString name = o->objectName(); + if (!name.isEmpty()) + debug << "/\"" << name << '"'; + debug << ' ' << e; + if (e->type() == QEvent::WindowStateChange) + debug << ' ' << windowState(o); + } +}; + +LogWidget *LogWidget::m_instance = 0; + +#if QT_VERSION >= 0x050000 +static void qt5MessageHandler(QtMsgType, const QMessageLogContext &, const QString &text) +{ + if (LogWidget *lw = LogWidget::instance()) + lw->appendText(text); +} +#else // Qt 5 +static void qt4MessageHandler(QtMsgType, const char *text) +{ + if (LogWidget *lw = LogWidget::instance()) + lw->appendText(QString::fromLocal8Bit(text)); +} +#endif // Qt 4 + +LogWidget::LogWidget(QWidget *parent) + : QPlainTextEdit(parent) +{ + LogWidget::m_instance = this; + setReadOnly(true); + appendText(startupMessage()); +} + +LogWidget::~LogWidget() +{ + LogWidget::m_instance = 0; +} + +void LogWidget::install() +{ +#if QT_VERSION >= 0x050000 + qInstallMessageHandler(qt5MessageHandler); +#else + qInstallMsgHandler(qt4MessageHandler); +#endif +} + +QString LogWidget::startupMessage() +{ + QString result; +#if QT_VERSION >= 0x050300 + result += QLatin1String(QLibraryInfo::build()); +#else + result += QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR); +#endif +#if QT_VERSION >= 0x050000 + result += QLatin1Char(' '); + result += QGuiApplication::platformName(); +#endif + return result; +} + +void LogWidget::appendText(const QString &message) +{ + appendPlainText(message); + ensureCursorVisible(); +} + +ControllerWindow::ControllerWindow() +{ + setWindowTitle(tr("Window Flags (Qt version %1, %2)") + .arg(QLatin1String(qVersion()), +#if QT_VERSION >= 0x050000 + qApp->platformName())); +#else + QLatin1String(""))); +#endif + + QVBoxLayout *layout = new QVBoxLayout(this); + QTabWidget *tabWidget = new QTabWidget(this); + ControllerWidget *controllerWidget = new ControllerWidget(tabWidget); + tabWidget->addTab(controllerWidget, tr("Control")); + LogWidget *logWidget = new LogWidget(tabWidget); + tabWidget->addTab(logWidget, tr("Event log")); + layout->addWidget(tabWidget); + + QHBoxLayout *bottomLayout = new QHBoxLayout; + layout->addLayout(bottomLayout); + bottomLayout->addStretch(); + QPushButton *updateControlsButton = new QPushButton(tr("&Update")); + connect(updateControlsButton, SIGNAL(clicked()), controllerWidget, SLOT(updateStateControl())); + bottomLayout->addWidget(updateControlsButton); + QPushButton *clearLogButton = new QPushButton(tr("Clear &Log")); + connect(clearLogButton, SIGNAL(clicked()), logWidget, SLOT(clear())); + bottomLayout->addWidget(clearLogButton); + QPushButton *quitButton = new QPushButton(tr("&Quit")); + connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); + quitButton->setShortcut(Qt::CTRL + Qt::Key_Q); + bottomLayout->addWidget(quitButton); +} + +void ControllerWindow::registerEventFilter() +{ + qApp->installEventFilter(new EventFilter(qApp)); +} diff --git a/tests/manual/windowflags/controllerwindow.h b/tests/manual/windowflags/controllerwindow.h index 81126085ea..43a125a9ae 100644 --- a/tests/manual/windowflags/controllerwindow.h +++ b/tests/manual/windowflags/controllerwindow.h @@ -29,7 +29,7 @@ #ifndef CONTROLLERWINDOW_H #define CONTROLLERWINDOW_H -#include +#include #include "previewwindow.h" @@ -46,13 +46,12 @@ class HintControl; class WindowStatesControl; class TypeControl; -//! [0] -class ControllerWindow : public QWidget +class ControllerWidget : public QWidget { Q_OBJECT public: - ControllerWindow(); + explicit ControllerWidget(QWidget *parent = 0); virtual bool eventFilter(QObject *o, QEvent *e); @@ -75,13 +74,37 @@ private: HintControl *hintsControl; WindowStatesControl *statesControl; - QPushButton *quitButton; - QRadioButton *previewWidgetButton; QRadioButton *previewDialogButton; QCheckBox *modalWindowCheckBox; QCheckBox *fixedSizeWindowCheckBox; }; -//! [0] -#endif +class LogWidget : public QPlainTextEdit +{ + Q_OBJECT +public: + explicit LogWidget(QWidget *parent = 0); + ~LogWidget(); + + static LogWidget *instance() { return m_instance; } + static void install(); + +public slots: + void appendText(const QString &); + +private: + static QString startupMessage(); + + static LogWidget *m_instance; +}; + +class ControllerWindow : public QWidget { + Q_OBJECT +public: + ControllerWindow(); + + void registerEventFilter(); +}; + +#endif // CONTROLLERWINDOW_H diff --git a/tests/manual/windowflags/main.cpp b/tests/manual/windowflags/main.cpp index 86825dbb0d..a7d7307525 100644 --- a/tests/manual/windowflags/main.cpp +++ b/tests/manual/windowflags/main.cpp @@ -27,13 +27,21 @@ ****************************************************************************/ #include +#include #include "controllerwindow.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); + QStringList arguments = QCoreApplication::arguments(); + arguments.pop_front(); + ControllerWindow controller; + if (!arguments.contains(QLatin1String("-l"))) + LogWidget::install(); + if (!arguments.contains(QLatin1String("-e"))) + controller.registerEventFilter(); controller.show(); return app.exec(); } diff --git a/tests/manual/windowflags/previewwindow.cpp b/tests/manual/windowflags/previewwindow.cpp index 11810763e7..54084fd1bc 100644 --- a/tests/manual/windowflags/previewwindow.cpp +++ b/tests/manual/windowflags/previewwindow.cpp @@ -26,136 +26,235 @@ ** ****************************************************************************/ -#include +#include #include +#include #include +#include +#include #include "previewwindow.h" -static QString windowFlagsToString(Qt::WindowFlags flags) +static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) { - QString text; - - Qt::WindowFlags type = (flags & Qt::WindowType_Mask); - if (type == Qt::Window) { - text = "Qt::Window"; - } else if (type == Qt::Dialog) { - text = "Qt::Dialog"; - } else if (type == Qt::Sheet) { - text = "Qt::Sheet"; - } else if (type == Qt::Drawer) { - text = "Qt::Drawer"; - } else if (type == Qt::Popup) { - text = "Qt::Popup"; - } else if (type == Qt::Tool) { - text = "Qt::Tool"; - } else if (type == Qt::ToolTip) { - text = "Qt::ToolTip"; - } else if (type == Qt::SplashScreen) { - text = "Qt::SplashScreen"; + str << "Window flags: " << hex << showbase << unsigned(flags) << noshowbase << dec << ' '; + switch (flags & Qt::WindowType_Mask) { + case Qt::Window: + str << "Qt::Window"; + break; + case Qt::Dialog: + str << "Qt::Dialog"; + break; + case Qt::Sheet: + str << "Qt::Sheet"; + break; + case Qt::Drawer: + str << "Qt::Drawer"; + break; + case Qt::Popup: + str << "Qt::Popup"; + break; + case Qt::Tool: + str << "Qt::Tool"; + break; + case Qt::ToolTip: + str << "Qt::ToolTip"; + break; + case Qt::SplashScreen: + str << "Qt::SplashScreen"; + break; } if (flags & Qt::MSWindowsFixedSizeDialogHint) - text += "\n| Qt::MSWindowsFixedSizeDialogHint"; + str << "\n| Qt::MSWindowsFixedSizeDialogHint"; +#if QT_VERSION >= 0x050000 + if (flags & Qt::BypassWindowManagerHint) + str << "\n| Qt::BypassWindowManagerHint"; +#else if (flags & Qt::X11BypassWindowManagerHint) - text += "\n| Qt::X11BypassWindowManagerHint"; + str << "\n| Qt::X11BypassWindowManagerHint"; +#endif if (flags & Qt::FramelessWindowHint) - text += "\n| Qt::FramelessWindowHint"; + str << "\n| Qt::FramelessWindowHint"; if (flags & Qt::WindowTitleHint) - text += "\n| Qt::WindowTitleHint"; + str << "\n| Qt::WindowTitleHint"; if (flags & Qt::WindowSystemMenuHint) - text += "\n| Qt::WindowSystemMenuHint"; + str << "\n| Qt::WindowSystemMenuHint"; if (flags & Qt::WindowMinimizeButtonHint) - text += "\n| Qt::WindowMinimizeButtonHint"; + str << "\n| Qt::WindowMinimizeButtonHint"; if (flags & Qt::WindowMaximizeButtonHint) - text += "\n| Qt::WindowMaximizeButtonHint"; + str << "\n| Qt::WindowMaximizeButtonHint"; if (flags & Qt::WindowCloseButtonHint) - text += "\n| Qt::WindowCloseButtonHint"; + str << "\n| Qt::WindowCloseButtonHint"; if (flags & Qt::WindowContextHelpButtonHint) - text += "\n| Qt::WindowContextHelpButtonHint"; + str << "\n| Qt::WindowContextHelpButtonHint"; if (flags & Qt::WindowShadeButtonHint) - text += "\n| Qt::WindowShadeButtonHint"; + str << "\n| Qt::WindowShadeButtonHint"; if (flags & Qt::WindowStaysOnTopHint) - text += "\n| Qt::WindowStaysOnTopHint"; + str << "\n| Qt::WindowStaysOnTopHint"; if (flags & Qt::CustomizeWindowHint) - text += "\n| Qt::CustomizeWindowHint"; - return text; + str << "\n| Qt::CustomizeWindowHint"; + if (flags & Qt::WindowStaysOnBottomHint) + str << "\n| Qt::WindowStaysOnBottomHint"; +#if QT_VERSION >= 0x050000 + if (flags & Qt::WindowFullscreenButtonHint) + str << "\n| Qt::WindowFullscreenButtonHint"; + if (flags & Qt::WindowTransparentForInput) + str << "\n| Qt::WindowTransparentForInput"; + if (flags & Qt::WindowOverridesSystemGestures) + str << "\n| Qt::WindowOverridesSystemGestures"; + if (flags & Qt::WindowDoesNotAcceptFocus) + str << "\n| Qt::WindowDoesNotAcceptFocus"; + if (flags & Qt::MaximizeUsingFullscreenGeometryHint) + str << "\n| Qt::MaximizeUsingFullscreenGeometryHint"; + if (flags & Qt::NoDropShadowWindowHint) + str << "\n| Qt::NoDropShadowWindowHint"; +#endif // Qt 5 } -PreviewWindow::PreviewWindow(QWidget *parent) - : QWidget(parent) +static void formatWindowStates(QTextStream &str, Qt::WindowStates states) { - textEdit = new QTextEdit; - textEdit->setReadOnly(true); - textEdit->setLineWrapMode(QTextEdit::NoWrap); + str << "Window states: " << hex << showbase << unsigned(states) << noshowbase << dec << ' '; + if (states & Qt::WindowActive) { + str << "Qt::WindowActive "; + states &= ~Qt::WindowActive; + } + switch (states) { + case Qt::WindowNoState: + str << "Qt::WindowNoState"; + break; + case Qt::WindowMinimized: + str << "Qt::WindowMinimized"; + break; + case Qt::WindowMaximized: + str << "Qt::WindowMaximized"; + break; + case Qt::WindowFullScreen: + str << "Qt::WindowFullScreen"; + break; + default: + break; + } +} - closeButton = new QPushButton(tr("&Close")); - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); +QTextStream &operator<<(QTextStream &str, const QRect &r) +{ + str << r.width() << 'x' << r.height() << forcesign << r.x() << r.y() << noforcesign; + return str; +} - showNormalButton = new QPushButton(tr("Show normal")); - connect(showNormalButton, SIGNAL(clicked()), this, SLOT(showNormal())); - showMinimizedButton = new QPushButton(tr("Show minimized")); - connect(showMinimizedButton, SIGNAL(clicked()), this, SLOT(showMinimized())); - showMaximizedButton = new QPushButton(tr("Show maximized")); - connect(showMaximizedButton, SIGNAL(clicked()), this, SLOT(showMaximized())); - showFullScreenButton = new QPushButton(tr("Show fullscreen")); - connect(showFullScreenButton, SIGNAL(clicked()), this, SLOT(showFullScreen())); +static QString formatWidgetInfo(const QWidget *w) +{ + QString result; + QTextStream str(&result); + formatWindowFlags(str, w->windowFlags()); + str << '\n'; + formatWindowStates(str, w->windowState()); + const QRect frame = w->frameGeometry(); + const QRect geometry = w->geometry(); + str << "\n\nFrame: " << frame << "\nGeometry: " << geometry << "\nMargins: " + << (geometry.x() - frame.x()) << ", " << (geometry.top() - frame.top()) + << ", " << (frame.right() - geometry.right()) << ", " + << (frame.bottom() - geometry.bottom()); + return result; +} - QVBoxLayout *layout = new QVBoxLayout; +static QPlainTextEdit *createControlPanel(QWidget *widget) +{ + QVBoxLayout *layout = new QVBoxLayout(widget); + QPlainTextEdit *textEdit = new QPlainTextEdit; + textEdit->setReadOnly(true); + textEdit->setLineWrapMode(QPlainTextEdit::NoWrap); layout->addWidget(textEdit); - layout->addWidget(showNormalButton); - layout->addWidget(showMinimizedButton); - layout->addWidget(showMaximizedButton); - layout->addWidget(showFullScreenButton); - layout->addWidget(closeButton); - setLayout(layout); - - setWindowTitle(tr("Preview ")); + + QHBoxLayout *bottomLayout = new QHBoxLayout; + layout ->addLayout(bottomLayout); + QGridLayout *buttonLayout = new QGridLayout; + bottomLayout->addStretch(); + bottomLayout->addLayout(buttonLayout); + QPushButton *showNormalButton = new QPushButton(PreviewWindow::tr("Show normal")); + QObject::connect(showNormalButton, SIGNAL(clicked()), widget, SLOT(showNormal())); + buttonLayout->addWidget(showNormalButton, 0, 0); + QPushButton *showMinimizedButton = new QPushButton(PreviewWindow::tr("Show minimized")); + QObject::connect(showMinimizedButton, SIGNAL(clicked()), widget, SLOT(showMinimized())); + buttonLayout->addWidget(showMinimizedButton, 0, 1); + QPushButton *showMaximizedButton = new QPushButton(PreviewWindow::tr("Show maximized")); + QObject::connect(showMaximizedButton, SIGNAL(clicked()), widget, SLOT(showMaximized())); + buttonLayout->addWidget(showMaximizedButton, 0, 2); + QPushButton *showFullScreenButton = new QPushButton(PreviewWindow::tr("Show fullscreen")); + QObject::connect(showFullScreenButton, SIGNAL(clicked()), widget, SLOT(showFullScreen())); + buttonLayout->addWidget(showFullScreenButton, 0, 3); + + QPushButton *updateInfoButton = new QPushButton(PreviewWindow::tr("&Update Info")); + QObject::connect(updateInfoButton, SIGNAL(clicked()), widget, SLOT(updateInfo())); + buttonLayout->addWidget(updateInfoButton, 1, 0); + QPushButton *closeButton = new QPushButton(PreviewWindow::tr("&Close")); + QObject::connect(closeButton, SIGNAL(clicked()), widget, SLOT(close())); + buttonLayout->addWidget(closeButton, 1, 3); + + return textEdit; +} + +PreviewWindow::PreviewWindow(QWidget *parent) + : QWidget(parent) +{ + textEdit = createControlPanel(this); + setWindowTitle(tr("Preview Qt %1").arg(QLatin1String(QT_VERSION_STR))); +} + +void PreviewWindow::resizeEvent(QResizeEvent *e) +{ + QWidget::resizeEvent(e); + updateInfo(); +} + +void PreviewWindow::moveEvent(QMoveEvent *e) +{ + QWidget::moveEvent(e); + updateInfo(); } void PreviewWindow::setWindowFlags(Qt::WindowFlags flags) { + if (flags == windowFlags()) + return; QWidget::setWindowFlags(flags); + QTimer::singleShot(0, this, SLOT(updateInfo())); +} - QString text = windowFlagsToString(flags); - textEdit->setPlainText(text); +void PreviewWindow::updateInfo() +{ + textEdit->setPlainText(formatWidgetInfo(this)); } PreviewDialog::PreviewDialog(QWidget *parent) : QDialog(parent) { - textEdit = new QTextEdit; - textEdit->setReadOnly(true); - textEdit->setLineWrapMode(QTextEdit::NoWrap); - - closeButton = new QPushButton(tr("&Close")); - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); + textEdit = createControlPanel(this); + setWindowTitle(tr("Preview Qt %1").arg(QLatin1String(QT_VERSION_STR))); +} - showNormalButton = new QPushButton(tr("Show normal")); - connect(showNormalButton, SIGNAL(clicked()), this, SLOT(showNormal())); - showMinimizedButton = new QPushButton(tr("Show minimized")); - connect(showMinimizedButton, SIGNAL(clicked()), this, SLOT(showMinimized())); - showMaximizedButton = new QPushButton(tr("Show maximized")); - connect(showMaximizedButton, SIGNAL(clicked()), this, SLOT(showMaximized())); - showFullScreenButton = new QPushButton(tr("Show fullscreen")); - connect(showFullScreenButton, SIGNAL(clicked()), this, SLOT(showFullScreen())); +void PreviewDialog::resizeEvent(QResizeEvent *e) +{ + QDialog::resizeEvent(e); + updateInfo(); +} - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(textEdit); - layout->addWidget(showNormalButton); - layout->addWidget(showMinimizedButton); - layout->addWidget(showMaximizedButton); - layout->addWidget(showFullScreenButton); - layout->addWidget(closeButton); - setLayout(layout); - - setWindowTitle(tr("Preview ")); +void PreviewDialog::moveEvent(QMoveEvent *e) +{ + QDialog::moveEvent(e); + updateInfo(); } void PreviewDialog::setWindowFlags(Qt::WindowFlags flags) { + if (flags == windowFlags()) + return; QWidget::setWindowFlags(flags); + QTimer::singleShot(0, this, SLOT(updateInfo())); +} - QString text = windowFlagsToString(flags); - textEdit->setPlainText(text); +void PreviewDialog::updateInfo() +{ + textEdit->setPlainText(formatWidgetInfo(this)); } diff --git a/tests/manual/windowflags/previewwindow.h b/tests/manual/windowflags/previewwindow.h index 00d5cc39f9..acd79735ad 100644 --- a/tests/manual/windowflags/previewwindow.h +++ b/tests/manual/windowflags/previewwindow.h @@ -32,8 +32,7 @@ #include QT_BEGIN_NAMESPACE -class QPushButton; -class QTextEdit; +class QPlainTextEdit; QT_END_NAMESPACE class PreviewWindow : public QWidget @@ -45,13 +44,15 @@ public: void setWindowFlags(Qt::WindowFlags flags); +public slots: + void updateInfo(); + +protected: + void resizeEvent(QResizeEvent *); + void moveEvent(QMoveEvent *); + private: - QTextEdit *textEdit; - QPushButton *closeButton; - QPushButton *showNormalButton; - QPushButton *showMinimizedButton; - QPushButton *showMaximizedButton; - QPushButton *showFullScreenButton; + QPlainTextEdit *textEdit; }; class PreviewDialog : public QDialog @@ -63,13 +64,15 @@ public: void setWindowFlags(Qt::WindowFlags flags); +public slots: + void updateInfo(); + +protected: + void resizeEvent(QResizeEvent *); + void moveEvent(QMoveEvent *); + private: - QTextEdit *textEdit; - QPushButton *closeButton; - QPushButton *showNormalButton; - QPushButton *showMinimizedButton; - QPushButton *showMaximizedButton; - QPushButton *showFullScreenButton; + QPlainTextEdit *textEdit; }; #endif -- cgit v1.2.3 From 32b99a38c563e4037362a25b2a749e2261bf16da Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 18 Nov 2016 10:02:33 +0100 Subject: PCRE: Document upstream version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also update copyright. Change-Id: I42a23701734c2c8d3ae43f70cc69dfb609b3a7a3 Reviewed-by: André Klitzing Reviewed-by: Topi Reiniö --- src/3rdparty/pcre/qt_attribution.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/pcre/qt_attribution.json b/src/3rdparty/pcre/qt_attribution.json index ec8832486b..fc7515175a 100644 --- a/src/3rdparty/pcre/qt_attribution.json +++ b/src/3rdparty/pcre/qt_attribution.json @@ -6,10 +6,11 @@ "Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.", "Homepage": "http://www.pcre.org/", + "Version": "8.39", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENCE", - "Copyright": "Copyright (c) 1997-2015 University of Cambridge -Copyright (c) 2010-2015 Zoltan Herczeg + "Copyright": "Copyright (c) 1997-2016 University of Cambridge +Copyright (c) 2009-2016 Zoltan Herczeg Copyright (c) 2007-2012, Google Inc." } -- cgit v1.2.3 From f1b4bd4790860e1ff5afcec111a359bc3a91cfda Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Tue, 15 Nov 2016 20:09:47 +0100 Subject: eglfs: fix eglfs_mali compile for odroid-mali Avoid duplicated struct fbdev_window definition (introduced by commit 58bed4cda98e8e25db8adc61c7db73b6853077dc) by renaming the local shadow definition to struct shadow_fbdev_window. Task-number: QTBUG-57156 Change-Id: I72b03f09fc57ddcd0284d6d3554a5658e02b80fc Reviewed-by: Laszlo Agocs Reviewed-by: Julien Corjon --- .../eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp index 43decdf849..aeba83f9bf 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp @@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE -struct fbdev_window { +struct shadow_fbdev_window { unsigned short width; unsigned short height; }; @@ -85,7 +85,7 @@ EGLNativeWindowType QEglFSMaliIntegration::createNativeWindow(QPlatformWindow *w Q_UNUSED(window); Q_UNUSED(format); - fbdev_window *fbwin = reinterpret_cast(malloc(sizeof(fbdev_window))); + shadow_fbdev_window *fbwin = reinterpret_cast(malloc(sizeof(shadow_fbdev_window))); if (NULL == fbwin) return 0; -- cgit v1.2.3 From 3691f7ca0c7117f18ea38ca3950ee9a8a91a53c8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 20 Sep 2013 02:38:22 +0200 Subject: QFutureInterface: make accesses to 'state' thread-safe Introduce helper functions switch_{on,off,from_to} to make the code more readable, and prepare everything for later optimizations reducing the sizes of critical sections (by locking the mutex later, or even never). This commit, however, is only concerned with shutting up tsan. In waitForResult(), simplified the code by removing an unneeded if guard: the condition is checked in the while loop immediately following in the then-block, and the local variable declaration that precedes the loop is not worth guarding. Change-Id: I24bfd864ca96f862302536ad8662065e6f366fa8 Reviewed-by: David Faure --- src/corelib/thread/qfutureinterface.cpp | 109 ++++++++++++++++++-------------- src/corelib/thread/qfutureinterface_p.h | 2 +- 2 files changed, 64 insertions(+), 47 deletions(-) diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index 2fe038165b..a29f8ebba7 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -77,13 +77,33 @@ QFutureInterfaceBase::~QFutureInterfaceBase() delete d; } +static inline int switch_on(QAtomicInt &a, int which) +{ + return a.fetchAndOrRelaxed(which) | which; +} + +static inline int switch_off(QAtomicInt &a, int which) +{ + return a.fetchAndAndRelaxed(~which) & ~which; +} + +static inline int switch_from_to(QAtomicInt &a, int from, int to) +{ + int newValue; + int expected = a.load(); + do { + newValue = (expected & ~from) | to; + } while (!a.testAndSetRelaxed(expected, newValue, expected)); + return newValue; +} + void QFutureInterfaceBase::cancel() { QMutexLocker locker(&d->m_mutex); - if (d->state & Canceled) + if (d->state.load() & Canceled) return; - d->state = State((d->state & ~Paused) | Canceled); + switch_from_to(d->state, Paused, Canceled); d->waitCondition.wakeAll(); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled)); @@ -93,10 +113,10 @@ void QFutureInterfaceBase::setPaused(bool paused) { QMutexLocker locker(&d->m_mutex); if (paused) { - d->state = State(d->state | Paused); + switch_on(d->state, Paused); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused)); } else { - d->state = State(d->state & ~Paused); + switch_off(d->state, Paused); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed)); } @@ -105,29 +125,24 @@ void QFutureInterfaceBase::setPaused(bool paused) void QFutureInterfaceBase::togglePaused() { QMutexLocker locker(&d->m_mutex); - if (d->state & Paused) { - d->state = State(d->state & ~Paused); + if (d->state.load() & Paused) { + switch_off(d->state, Paused); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed)); } else { - d->state = State(d->state | Paused); + switch_on(d->state, Paused); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused)); } } void QFutureInterfaceBase::setThrottled(bool enable) { - // bail out if we are not changing the state - if ((enable && (d->state & Throttled)) || (!enable && !(d->state & Throttled))) - return; - - // lock and change the state QMutexLocker lock(&d->m_mutex); if (enable) { - d->state = State(d->state | Throttled); + switch_on(d->state, Throttled); } else { - d->state = State(d->state & ~Throttled); - if (!(d->state & Paused)) + switch_off(d->state, Throttled); + if (!(d->state.load() & Paused)) d->pausedWaitCondition.wakeAll(); } } @@ -178,11 +193,15 @@ bool QFutureInterfaceBase::waitForNextResult() void QFutureInterfaceBase::waitForResume() { // return early if possible to avoid taking the mutex lock. - if ((d->state & Paused) == false || (d->state & Canceled)) - return; + { + const int state = d->state.load(); + if (!(state & Paused) || (state & Canceled)) + return; + } QMutexLocker lock(&d->m_mutex); - if ((d->state & Paused) == false || (d->state & Canceled)) + const int state = d->state.load(); + if (!(state & Paused) || (state & Canceled)) return; // decrease active thread count since this thread will wait. @@ -230,7 +249,7 @@ bool QFutureInterfaceBase::isProgressUpdateNeeded() const void QFutureInterfaceBase::reportStarted() { QMutexLocker locker(&d->m_mutex); - if ((d->state & Started) || (d->state & Canceled) || (d->state & Finished)) + if (d->state.load() & (Started|Canceled|Finished)) return; d->setState(State(Started | Running)); @@ -246,11 +265,11 @@ void QFutureInterfaceBase::reportCanceled() void QFutureInterfaceBase::reportException(const QException &exception) { QMutexLocker locker(&d->m_mutex); - if ((d->state & Canceled) || (d->state & Finished)) + if (d->state.load() & (Canceled|Finished)) return; d->m_exceptionStore.setException(exception); - d->state = State(d->state | Canceled); + switch_on(d->state, Canceled); d->waitCondition.wakeAll(); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled)); @@ -260,8 +279,8 @@ void QFutureInterfaceBase::reportException(const QException &exception) void QFutureInterfaceBase::reportFinished() { QMutexLocker locker(&d->m_mutex); - if (!(d->state & Finished)) { - d->state = State((d->state & ~Running) | Finished); + if (!isFinished()) { + switch_from_to(d->state, Running, Finished); d->waitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Finished)); } @@ -281,7 +300,7 @@ int QFutureInterfaceBase::expectedResultCount() bool QFutureInterfaceBase::queryState(State state) const { - return (d->state & state); + return d->state.load() & state; } void QFutureInterfaceBase::waitForResult(int resultIndex) @@ -289,7 +308,7 @@ void QFutureInterfaceBase::waitForResult(int resultIndex) d->m_exceptionStore.throwPossibleException(); QMutexLocker lock(&d->m_mutex); - if (!(d->state & Running)) + if (!isRunning()) return; lock.unlock(); @@ -299,11 +318,9 @@ void QFutureInterfaceBase::waitForResult(int resultIndex) lock.relock(); - if (d->state & Running) { - const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex; - while ((d->state & Running) && d->internal_isResultReadyAt(waitIndex) == false) - d->waitCondition.wait(&d->m_mutex); - } + const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex; + while (isRunning() && !d->internal_isResultReadyAt(waitIndex)) + d->waitCondition.wait(&d->m_mutex); d->m_exceptionStore.throwPossibleException(); } @@ -311,7 +328,7 @@ void QFutureInterfaceBase::waitForResult(int resultIndex) void QFutureInterfaceBase::waitForFinished() { QMutexLocker lock(&d->m_mutex); - const bool alreadyFinished = !(d->state & Running); + const bool alreadyFinished = !isRunning(); lock.unlock(); if (!alreadyFinished) { @@ -319,7 +336,7 @@ void QFutureInterfaceBase::waitForFinished() lock.relock(); - while (d->state & Running) + while (isRunning()) d->waitCondition.wait(&d->m_mutex); } @@ -328,7 +345,7 @@ void QFutureInterfaceBase::waitForFinished() void QFutureInterfaceBase::reportResultsReady(int beginIndex, int endIndex) { - if ((d->state & Canceled) || (d->state & Finished) || beginIndex == endIndex) + if (beginIndex == endIndex || (d->state.load() & (Canceled|Finished))) return; d->waitCondition.wakeAll(); @@ -390,7 +407,7 @@ void QFutureInterfaceBase::setProgressValueAndText(int progressValue, if (d->m_progressValue >= progressValue) return; - if ((d->state & Canceled) || (d->state & Finished)) + if (d->state.load() & (Canceled|Finished)) return; if (d->internal_updateProgress(progressValue, progressText)) { @@ -462,10 +479,10 @@ bool QFutureInterfaceBasePrivate::internal_waitForNextResult() if (m_results.hasNextResult()) return true; - while ((state & QFutureInterfaceBase::Running) && m_results.hasNextResult() == false) + while ((state.load() & QFutureInterfaceBase::Running) && m_results.hasNextResult() == false) waitCondition.wait(&m_mutex); - return (!(state & QFutureInterfaceBase::Canceled) && m_results.hasNextResult()); + return !(state.load() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult(); } bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress, @@ -488,16 +505,16 @@ bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress, void QFutureInterfaceBasePrivate::internal_setThrottled(bool enable) { // bail out if we are not changing the state - if ((enable && (state & QFutureInterfaceBase::Throttled)) - || (!enable && !(state & QFutureInterfaceBase::Throttled))) + if ((enable && (state.load() & QFutureInterfaceBase::Throttled)) + || (!enable && !(state.load() & QFutureInterfaceBase::Throttled))) return; // change the state if (enable) { - state = QFutureInterfaceBase::State(state | QFutureInterfaceBase::Throttled); + switch_on(state, QFutureInterfaceBase::Throttled); } else { - state = QFutureInterfaceBase::State(state & ~QFutureInterfaceBase::Throttled); - if (!(state & QFutureInterfaceBase::Paused)) + switch_off(state, QFutureInterfaceBase::Throttled); + if (!(state.load() & QFutureInterfaceBase::Paused)) pausedWaitCondition.wakeAll(); } } @@ -532,7 +549,7 @@ void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface { QMutexLocker locker(&m_mutex); - if (state & QFutureInterfaceBase::Started) { + if (state.load() & QFutureInterfaceBase::Started) { interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Started)); interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::ProgressRange, m_progressMinimum, @@ -552,13 +569,13 @@ void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface it.batchedAdvance(); } - if (state & QFutureInterfaceBase::Paused) + if (state.load() & QFutureInterfaceBase::Paused) interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Paused)); - if (state & QFutureInterfaceBase::Canceled) + if (state.load() & QFutureInterfaceBase::Canceled) interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Canceled)); - if (state & QFutureInterfaceBase::Finished) + if (state.load() & QFutureInterfaceBase::Finished) interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Finished)); outputConnections.append(interface); @@ -577,7 +594,7 @@ void QFutureInterfaceBasePrivate::disconnectOutputInterface(QFutureCallOutInterf void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState) { - state = newState; + state.store(newState); } QT_END_NAMESPACE diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h index e2d588cd07..eb0c38421b 100644 --- a/src/corelib/thread/qfutureinterface_p.h +++ b/src/corelib/thread/qfutureinterface_p.h @@ -155,7 +155,7 @@ public: int m_progressValue; // TQ int m_progressMinimum; // TQ int m_progressMaximum; // TQ - QFutureInterfaceBase::State state; + QAtomicInt state; // reads and writes can happen unprotected, both must be atomic QElapsedTimer progressTime; QWaitCondition pausedWaitCondition; QtPrivate::ResultStoreBase m_results; -- cgit v1.2.3 From d20773824529d191e7b483b505107dce6c1b1c3d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 18 Nov 2016 16:54:09 +0100 Subject: Fix missing last modification time stamp in qrc content The time stamp is added at the end of the node information and consequently this also bumps the version. Task-number: QTBUG-57182 Change-Id: Ia10e006f28c0b168b2bcd74ed8b7098f84d10af3 Reviewed-by: hjk --- src/corelib/io/qresource.cpp | 65 +++++++++++++++++----- src/corelib/io/qresource.h | 1 + src/tools/rcc/rcc.cpp | 46 +++++++++++++-- src/tools/rcc/rcc.h | 1 + .../io/qresourceengine/tst_qresourceengine.cpp | 15 +++++ tests/auto/tools/rcc/data/images/images.expected | 10 +++- tests/auto/tools/rcc/tst_rcc.cpp | 17 +++++- 7 files changed, 133 insertions(+), 22 deletions(-) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 7fe3753da4..72042e1600 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -101,35 +101,38 @@ class QResourceRoot Directory = 0x02 }; const uchar *tree, *names, *payloads; - inline int findOffset(int node) const { return node * 14; } //sizeof each tree element + int version; + inline int findOffset(int node) const { return node * (14 + (version >= 0x02 ? 8 : 0)); } //sizeof each tree element uint hash(int node) const; QString name(int node) const; short flags(int node) const; public: mutable QAtomicInt ref; - inline QResourceRoot(): tree(0), names(0), payloads(0) {} - inline QResourceRoot(const uchar *t, const uchar *n, const uchar *d) { setSource(t, n, d); } + inline QResourceRoot(): tree(0), names(0), payloads(0), version(0) {} + inline QResourceRoot(int version, const uchar *t, const uchar *n, const uchar *d) { setSource(version, t, n, d); } virtual ~QResourceRoot() { } int findNode(const QString &path, const QLocale &locale=QLocale()) const; inline bool isContainer(int node) const { return flags(node) & Directory; } inline bool isCompressed(int node) const { return flags(node) & Compressed; } const uchar *data(int node, qint64 *size) const; + QDateTime lastModified(int node) const; QStringList children(int node) const; virtual QString mappingRoot() const { return QString(); } bool mappingRootSubdir(const QString &path, QString *match=0) const; inline bool operator==(const QResourceRoot &other) const - { return tree == other.tree && names == other.names && payloads == other.payloads; } + { return tree == other.tree && names == other.names && payloads == other.payloads && version == other.version; } inline bool operator!=(const QResourceRoot &other) const { return !operator==(other); } enum ResourceRootType { Resource_Builtin, Resource_File, Resource_Buffer }; virtual ResourceRootType type() const { return Resource_Builtin; } protected: - inline void setSource(const uchar *t, const uchar *n, const uchar *d) { + inline void setSource(int v, const uchar *t, const uchar *n, const uchar *d) { tree = t; names = n; payloads = d; + version = v; } }; @@ -231,6 +234,7 @@ public: mutable qint64 size; mutable const uchar *data; mutable QStringList children; + mutable QDateTime lastModified; QResource *q_ptr; Q_DECLARE_PUBLIC(QResource) @@ -244,6 +248,7 @@ QResourcePrivate::clear() data = 0; size = 0; children.clear(); + lastModified = QDateTime(); container = 0; for(int i = 0; i < related.size(); ++i) { QResourceRoot *root = related.at(i); @@ -274,6 +279,7 @@ QResourcePrivate::load(const QString &file) size = 0; compressed = 0; } + lastModified = res->lastModified(node); } else if(res->isContainer(node) != container) { qWarning("QResourceInfo: Resource [%s] has both data and children!", file.toLatin1().constData()); } @@ -284,6 +290,7 @@ QResourcePrivate::load(const QString &file) data = 0; size = 0; compressed = 0; + lastModified = QDateTime(); res->ref.ref(); related.append(res); } @@ -513,6 +520,17 @@ const uchar *QResource::data() const return d->data; } +/*! + Returns the date and time when the file was last modified before + packaging into a resource. +*/ +QDateTime QResource::lastModified() const +{ + Q_D(const QResource); + d->ensureInitialized(); + return d->lastModified; +} + /*! Returns \c true if the resource represents a directory and thus may have children() in it, false if it represents a file. @@ -780,6 +798,24 @@ const uchar *QResourceRoot::data(int node, qint64 *size) const *size = 0; return 0; } + +QDateTime QResourceRoot::lastModified(int node) const +{ + if (node == -1 || version < 0x02) + return QDateTime(); + + const int offset = findOffset(node) + 14; + + const quint64 timeStamp = (quint64(tree[offset+0]) << 56) + (quint64(tree[offset+1]) << 48) + + (quint64(tree[offset+2]) << 40) + (quint64(tree[offset+3]) << 32) + + (quint64(tree[offset+4]) << 24) + (quint64(tree[offset+5]) << 16) + + (quint64(tree[offset+6]) << 8) + (quint64(tree[offset+7])); + if (timeStamp == 0) + return QDateTime(); + + return QDateTime::fromMSecsSinceEpoch(timeStamp); +} + QStringList QResourceRoot::children(int node) const { if(node == -1) @@ -829,9 +865,9 @@ Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree, const unsigned char *name, const unsigned char *data) { QMutexLocker lock(resourceMutex()); - if(version == 0x01 && resourceList()) { + if ((version == 0x01 || version == 0x2) && resourceList()) { bool found = false; - QResourceRoot res(tree, name, data); + QResourceRoot res(version, tree, name, data); for(int i = 0; i < resourceList()->size(); ++i) { if(*resourceList()->at(i) == res) { found = true; @@ -839,7 +875,7 @@ Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree, } } if(!found) { - QResourceRoot *root = new QResourceRoot(tree, name, data); + QResourceRoot *root = new QResourceRoot(version, tree, name, data); root->ref.ref(); resourceList()->append(root); } @@ -852,8 +888,8 @@ Q_CORE_EXPORT bool qUnregisterResourceData(int version, const unsigned char *tre const unsigned char *name, const unsigned char *data) { QMutexLocker lock(resourceMutex()); - if(version == 0x01 && resourceList()) { - QResourceRoot res(tree, name, data); + if ((version == 0x01 || version == 0x02) && resourceList()) { + QResourceRoot res(version, tree, name, data); for(int i = 0; i < resourceList()->size(); ) { if(*resourceList()->at(i) == res) { QResourceRoot *root = resourceList()->takeAt(i); @@ -919,9 +955,9 @@ public: if (size >= 0 && (tree_offset >= size || data_offset >= size || name_offset >= size)) return false; - if(version == 0x01) { + if (version == 0x01 || version == 0x02) { buffer = b; - setSource(b+tree_offset, b+name_offset, b+data_offset); + setSource(version, b+tree_offset, b+name_offset, b+data_offset); return true; } return false; @@ -1430,8 +1466,11 @@ QString QResourceFileEngine::owner(FileOwner) const return QString(); } -QDateTime QResourceFileEngine::fileTime(FileTime) const +QDateTime QResourceFileEngine::fileTime(FileTime time) const { + Q_D(const QResourceFileEngine); + if (time == ModificationTime) + return d->resource.lastModified(); return QDateTime(); } diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h index a50bbbdaca..895cf0456e 100644 --- a/src/corelib/io/qresource.h +++ b/src/corelib/io/qresource.h @@ -69,6 +69,7 @@ public: bool isCompressed() const; qint64 size() const; const uchar *data() const; + QDateTime lastModified() const; static void addSearchPath(const QString &path); static QStringList searchPaths(); diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 18772d2816..c8ac554cd4 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -203,6 +203,12 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib) } if (text || pass1) lib.writeChar('\n'); + + // last modified time stamp + const QDateTime lastModified = m_fileInfo.lastModified(); + lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0)); + if (text || pass1) + lib.writeChar('\n'); } qint64 RCCFileInfo::writeDataBlob(RCCResourceLibrary &lib, qint64 offset, @@ -833,6 +839,38 @@ void RCCResourceLibrary::writeNumber4(quint32 number) } } +void RCCResourceLibrary::writeNumber8(quint64 number) +{ + if (m_format == RCCResourceLibrary::Pass2) { + m_outDevice->putChar(char(number >> 56)); + m_outDevice->putChar(char(number >> 48)); + m_outDevice->putChar(char(number >> 40)); + m_outDevice->putChar(char(number >> 32)); + m_outDevice->putChar(char(number >> 24)); + m_outDevice->putChar(char(number >> 16)); + m_outDevice->putChar(char(number >> 8)); + m_outDevice->putChar(char(number)); + } else if (m_format == RCCResourceLibrary::Binary) { + writeChar(number >> 56); + writeChar(number >> 48); + writeChar(number >> 40); + writeChar(number >> 32); + writeChar(number >> 24); + writeChar(number >> 16); + writeChar(number >> 8); + writeChar(number); + } else { + writeHex(number >> 56); + writeHex(number >> 48); + writeHex(number >> 40); + writeHex(number >> 32); + writeHex(number >> 24); + writeHex(number >> 16); + writeHex(number >> 8); + writeHex(number); + } +} + bool RCCResourceLibrary::writeHeader() { if (m_format == C_Code || m_format == Pass1) { @@ -1076,7 +1114,7 @@ bool RCCResourceLibrary::writeInitializer() if (m_root) { writeString(" "); writeAddNamespaceFunction("qRegisterResourceData"); - writeString("\n (0x01, qt_resource_struct, " + writeString("\n (0x02, qt_resource_struct, " "qt_resource_name, qt_resource_data);\n"); } writeString(" return 1;\n"); @@ -1097,7 +1135,7 @@ bool RCCResourceLibrary::writeInitializer() if (m_root) { writeString(" "); writeAddNamespaceFunction("qUnregisterResourceData"); - writeString("\n (0x01, qt_resource_struct, " + writeString("\n (0x02, qt_resource_struct, " "qt_resource_name, qt_resource_data);\n"); } writeString(" return 1;\n"); @@ -1114,10 +1152,10 @@ bool RCCResourceLibrary::writeInitializer() } else if (m_format == Binary) { int i = 4; char *p = m_out.data(); - p[i++] = 0; // 0x01 + p[i++] = 0; // 0x02 p[i++] = 0; p[i++] = 0; - p[i++] = 1; + p[i++] = 2; p[i++] = (m_treeOffset >> 24) & 0xff; p[i++] = (m_treeOffset >> 16) & 0xff; diff --git a/src/tools/rcc/rcc.h b/src/tools/rcc/rcc.h index 8d0d83e00c..157cd4809f 100644 --- a/src/tools/rcc/rcc.h +++ b/src/tools/rcc/rcc.h @@ -118,6 +118,7 @@ private: void writeHex(quint8 number); void writeNumber2(quint16 number); void writeNumber4(quint32 number); + void writeNumber8(quint64 number); void writeChar(char c) { m_out.append(c); } void writeByteArray(const QByteArray &); void write(const char *, int len); diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 561ab193c6..7fdd00876f 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -55,6 +55,7 @@ private slots: void searchPath(); void doubleSlashInRoot(); void setLocale(); + void lastModified(); private: const QString m_runtimeResourceRcc; @@ -489,6 +490,20 @@ void tst_QResourceEngine::setLocale() QLocale::setDefault(QLocale::system()); } +void tst_QResourceEngine::lastModified() +{ + { + QFileInfo fi(":/"); + QVERIFY(fi.exists()); + QVERIFY2(!fi.lastModified().isValid(), qPrintable(fi.lastModified().toString())); + } + { + QFileInfo fi(":/search_file.txt"); + QVERIFY(fi.exists()); + QVERIFY(fi.lastModified().isValid()); + } +} + QTEST_MAIN(tst_QResourceEngine) #include "tst_qresourceengine.moc" diff --git a/tests/auto/tools/rcc/data/images/images.expected b/tests/auto/tools/rcc/data/images/images.expected index 1f0157d51c..eb5d9222c8 100644 --- a/tests/auto/tools/rcc/data/images/images.expected +++ b/tests/auto/tools/rcc/data/images/images.expected @@ -79,16 +79,22 @@ static const unsigned char qt_resource_name[] = { static const unsigned char qt_resource_struct[] = { // : 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/images 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x2, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/images/subdir 0x0,0x0,0x0,0x12,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x5, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/images/square.png 0x0,0x0,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0xa9, +TIMESTAMP:images/square.png // :/images/circle.png 0x0,0x0,0x0,0x24,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, +TIMESTAMP:images/circle.png // :/images/subdir/triangle.png 0x0,0x0,0x0,0x58,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0xb, +TIMESTAMP:images/subdir/triangle.png }; @@ -120,7 +126,7 @@ int QT_RCC_MANGLE_NAMESPACE(qInitResources)(); int QT_RCC_MANGLE_NAMESPACE(qInitResources)() { QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData) - (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); + (0x02, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } @@ -128,7 +134,7 @@ int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)() { QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData) - (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); + (0x02, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index 8d95d06e30..54a2854ede 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -92,12 +92,23 @@ static QString doCompare(const QStringList &actual, const QStringList &expected) QByteArray ba; for (int i = 0, n = expected.size(); i != n; ++i) { - if (expected.at(i).startsWith("IGNORE:")) + QString expectedLine = expected.at(i); + if (expectedLine.startsWith("IGNORE:")) continue; - if (expected.at(i) != actual.at(i)) { + if (expectedLine.startsWith("TIMESTAMP:")) { + const QString relativePath = expectedLine.mid(strlen("TIMESTAMP:")); + const quint64 timeStamp = QFileInfo(relativePath).lastModified().toMSecsSinceEpoch(); + expectedLine.clear(); + for (int shift = 56; shift >= 0; shift -= 8) { + expectedLine.append(QLatin1String("0x")); + expectedLine.append(QString::number(quint8(timeStamp >> shift), 16)); + expectedLine.append(QLatin1Char(',')); + } + } + if (expectedLine != actual.at(i)) { qDebug() << "LINES" << i << "DIFFER"; ba.append( - "\n<<<<<< actual\n" + actual.at(i) + "\n======\n" + expected.at(i) + "\n<<<<<< actual\n" + actual.at(i) + "\n======\n" + expectedLine + "\n>>>>>> expected\n" ); } -- cgit v1.2.3 From e798d0b18acfb6756a614aec3e7b4bcb1ef5ff58 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 21 Nov 2016 12:55:54 +0100 Subject: qnativesocketengine_winrt - do not shadow a variable We first hide identifier 'hr' and then later we check the one that was never correctly initialized. Task-number: QTBUG-57226 Change-Id: Ibbf1bb99aa752c2e4090caf4533dc5f5b71b5e41 Reviewed-by: Oliver Wolff --- src/network/socket/qnativesocketengine_winrt.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 32fafc2cb0..934c8fe785 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -252,19 +252,18 @@ bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket:: // Start processing incoming data if (d->socketType == QAbstractSocket::TcpSocket) { - HRESULT hr; - QEventDispatcherWinRT::runOnXamlThread([d, &hr, socket, this]() { + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, socket, this]() { ComPtr buffer; HRESULT hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer); - RETURN_OK_IF_FAILED("initialize(): Could not create buffer"); + RETURN_HR_IF_FAILED("initialize(): Could not create buffer"); ComPtr stream; hr = socket->get_InputStream(&stream); - RETURN_OK_IF_FAILED("initialize(): Could not obtain input stream"); + RETURN_HR_IF_FAILED("initialize(): Could not obtain input stream"); hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, d->readOp.GetAddressOf()); - RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).", + RETURN_HR_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).", socketDescription(this).constData()); hr = d->readOp->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); - RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to set socket read callback (%s).", + RETURN_HR_IF_FAILED_WITH_ARGS("initialize(): Failed to set socket read callback (%s).", socketDescription(this).constData()); return S_OK; }); -- cgit v1.2.3 From ad788c1014ea7a84f4ad9c52f50b957074cb3e38 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 18 Nov 2016 12:39:36 +0100 Subject: tst_qstandardpaths: Disable WOW64 redirection on Windows The logo (microsoft.windows.softwarelogo.showdesktop.exe) is otherwise not found. Change-Id: Ic52329462612a027e2928922a1f9a541dcbc67a3 Reviewed-by: Jesus Fernandez Reviewed-by: Oliver Wolff --- .../auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index e1c277717d..92e66e20c2 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -38,6 +38,9 @@ #include #include #include +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) +# include +#endif #ifdef Q_OS_UNIX #include @@ -131,6 +134,16 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths void tst_qstandardpaths::initTestCase() { +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) + // Disable WOW64 redirection, see testFindExecutable() + if (QSysInfo::buildCpuArchitecture() != QSysInfo::currentCpuArchitecture()) { + void *oldMode; + const bool disabledDisableWow64FsRedirection = Wow64DisableWow64FsRedirection(&oldMode) == TRUE; + if (!disabledDisableWow64FsRedirection) + qErrnoWarning("Wow64DisableWow64FsRedirection() failed"); + QVERIFY(disabledDisableWow64FsRedirection); + } +#endif // Q_OS_WIN && !Q_OS_WINRT && !Q_OS_WINCE QVERIFY2(m_localConfigTempDir.isValid(), qPrintable(m_localConfigTempDir.errorString())); QVERIFY2(m_globalConfigTempDir.isValid(), qPrintable(m_globalConfigTempDir.errorString())); QVERIFY2(m_localAppTempDir.isValid(), qPrintable(m_localAppTempDir.errorString())); @@ -380,6 +393,7 @@ void tst_qstandardpaths::testFindExecutable_data() if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) { // The logo executable on Windows 8 is perfectly suited for testing that the // suffix mechanism is not thrown off by dots in the name. + // Note: Requires disabling WOW64 redirection, see initTestCase() const QString logo = QLatin1String("microsoft.windows.softwarelogo.showdesktop"); const QString logoPath = cmdFi.absolutePath() + QLatin1Char('/') + logo + QLatin1String(".exe"); QTest::newRow("win8-logo") -- cgit v1.2.3 From 4bf5a3c885c26150317e83555c0c3213bd7b417e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 28 Sep 2016 00:12:36 +0200 Subject: tst_QFormLayout: Fix UB (invalid enum value) in several functions The code coerced a -123 into a QFormLayout::ItemFlags, which, however, being an enum with enumeration values 0..2, only has valid numerical values 0..3. Fix by using 3 as the value to represent the invalid enum value, and store this in a constant so as not to distribute this magic number all around the test class. Change-Id: Ie5e93a69ef5a3acdde43030b022e0cce8aec484d Reviewed-by: Thiago Macieira Reviewed-by: Marc Mutz --- .../widgets/kernel/qformlayout/tst_qformlayout.cpp | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index 5703d7e114..5b87c0114d 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -48,6 +48,10 @@ #include +// ItemRole has enumerators for numerical values 0..2, thus the only +// valid numerical values for storing into an ItemRole variable are 0..3: +Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3); + static inline void setFrameless(QWidget *w) { Qt::WindowFlags flags = w->windowFlags(); @@ -528,7 +532,7 @@ void tst_QFormLayout::insertRow_QWidget_QWidget() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout->getWidgetPosition(lbl1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::LabelRole)); @@ -536,7 +540,7 @@ void tst_QFormLayout::insertRow_QWidget_QWidget() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout->getWidgetPosition(fld1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::FieldRole)); @@ -597,7 +601,7 @@ void tst_QFormLayout::insertRow_QWidget_QLayout() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout->getWidgetPosition(lbl1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::LabelRole)); @@ -605,7 +609,7 @@ void tst_QFormLayout::insertRow_QWidget_QLayout() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout->getLayoutPosition(fld1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::FieldRole)); @@ -722,7 +726,7 @@ void tst_QFormLayout::setWidget() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getWidgetPosition(&w1, &row, &role); QCOMPARE(row, 5); QCOMPARE(int(role), int(QFormLayout::LabelRole)); @@ -730,7 +734,7 @@ void tst_QFormLayout::setWidget() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getWidgetPosition(&w2, &row, &role); QCOMPARE(row, 3); QCOMPARE(int(role), int(QFormLayout::FieldRole)); @@ -738,7 +742,7 @@ void tst_QFormLayout::setWidget() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getWidgetPosition(&w3, &row, &role); QCOMPARE(row, 3); QCOMPARE(int(role), int(QFormLayout::LabelRole)); @@ -746,18 +750,20 @@ void tst_QFormLayout::setWidget() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getWidgetPosition(&w4, &row, &role); + // not found QCOMPARE(row, -1); - QCOMPARE(int(role), -123); + QCOMPARE(int(role), int(invalidRole)); } { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getWidgetPosition(0, &row, &role); + // not found QCOMPARE(row, -1); - QCOMPARE(int(role), -123); + QCOMPARE(int(role), int(invalidRole)); } } @@ -790,7 +796,7 @@ void tst_QFormLayout::setLayout() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getLayoutPosition(&l1, &row, &role); QCOMPARE(row, 5); QCOMPARE(int(role), int(QFormLayout::LabelRole)); @@ -798,7 +804,7 @@ void tst_QFormLayout::setLayout() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getLayoutPosition(&l2, &row, &role); QCOMPARE(row, 3); QCOMPARE(int(role), int(QFormLayout::FieldRole)); @@ -806,7 +812,7 @@ void tst_QFormLayout::setLayout() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getLayoutPosition(&l3, &row, &role); QCOMPARE(row, 3); QCOMPARE(int(role), int(QFormLayout::LabelRole)); @@ -814,18 +820,18 @@ void tst_QFormLayout::setLayout() { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getLayoutPosition(&l4, &row, &role); QCOMPARE(row, -1); - QCOMPARE(int(role), -123); + QCOMPARE(int(role), int(invalidRole)); } { int row = -1; - QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); + QFormLayout::ItemRole role = invalidRole; layout.getLayoutPosition(0, &row, &role); QCOMPARE(row, -1); - QCOMPARE(int(role), -123); + QCOMPARE(int(role), int(invalidRole)); } } -- cgit v1.2.3 From 0a203faa7f0bb836afbdd3addfba99190f69ff5f Mon Sep 17 00:00:00 2001 From: Vyacheslav Koscheev Date: Mon, 21 Nov 2016 13:17:47 +0700 Subject: Adjust comment to "new" spec name Change-Id: I58250de09f10637b145a5f43c3764a86e47bce96 Reviewed-by: Oswald Buddenhagen --- mkspecs/android-clang/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf index b25a4399f3..c33bbe7eed 100644 --- a/mkspecs/android-clang/qmake.conf +++ b/mkspecs/android-clang/qmake.conf @@ -1,4 +1,4 @@ -# qmake configuration for building with android-g++ +# qmake configuration for building with android-clang MAKEFILE_GENERATOR = UNIX QMAKE_PLATFORM = android QMAKE_COMPILER = gcc clang llvm -- cgit v1.2.3 From 38675e18fcc841228141568a2ecfafdeb99eba2a Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 17 Nov 2016 10:40:44 +0100 Subject: Add support for Visual Studio 2017 Tested with RC Task-number: QTBUG-57086 Change-Id: I21f56edca3852b52edd2c5fdcce76817141e8d4a Reviewed-by: Friedemann Kleint --- mkspecs/win32-msvc2017/qmake.conf | 10 +++++++++ mkspecs/win32-msvc2017/qplatformdefs.h | 34 +++++++++++++++++++++++++++++++ qmake/Makefile.win32 | 2 +- qmake/generators/win32/msvc_objectmodel.h | 3 ++- qmake/generators/win32/msvc_vcproj.cpp | 11 ++++++++++ qmake/library/qmakeevaluator.cpp | 13 +++++++++++- src/corelib/global/qlibraryinfo.cpp | 4 +++- tools/configure/configureapp.cpp | 3 ++- tools/configure/environment.cpp | 6 ++++++ tools/configure/environment.h | 3 ++- 10 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 mkspecs/win32-msvc2017/qmake.conf create mode 100644 mkspecs/win32-msvc2017/qplatformdefs.h diff --git a/mkspecs/win32-msvc2017/qmake.conf b/mkspecs/win32-msvc2017/qmake.conf new file mode 100644 index 0000000000..b8351eb3fe --- /dev/null +++ b/mkspecs/win32-msvc2017/qmake.conf @@ -0,0 +1,10 @@ +# +# qmake configuration for win32-msvc2017 +# +# Written for Microsoft Visual C++ 2017 +# + +MSC_VER = 1910 +MSVC_VER = 15.0 +include(../common/msvc-desktop.conf) +load(qt_config) diff --git a/mkspecs/win32-msvc2017/qplatformdefs.h b/mkspecs/win32-msvc2017/qplatformdefs.h new file mode 100644 index 0000000000..7100e3aa41 --- /dev/null +++ b/mkspecs/win32-msvc2017/qplatformdefs.h @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../win32-msvc2005/qplatformdefs.h" diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index e61e9503f3..96d9cb62cf 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -21,7 +21,7 @@ LINKER = link CFLAGS_EXTRA = /Zc:wchar_t- ! elseif "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2013" CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS $(CFLAGS_CRT) -! elseif "$(QMAKESPEC)" == "win32-msvc2015" +! elseif "$(QMAKESPEC)" == "win32-msvc2015" || "$(QMAKESPEC)" == "win32-msvc2017" CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /Zc:strictStrings /w44456 /w44457 /w44458 /wd4577 $(CFLAGS_CRT) ! else ! error Unsupported compiler for this Makefile diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 96923ba23d..7f924a9a2b 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -57,7 +57,8 @@ enum DotNET { NET2010 = 0xa0, NET2012 = 0xb0, NET2013 = 0xc0, - NET2015 = 0xd0 + NET2015 = 0xd0, + NET2017 = 0xe0 }; /* diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 5e3e11fd5c..d4930d9a05 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -70,6 +70,7 @@ struct DotNetCombo { const char *versionStr; const char *regKey; } dotNetCombo[] = { + {NET2017, "MSVC.NET 2017 (15.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\15.0"}, {NET2015, "MSVC.NET 2015 (14.0)", "Software\\Microsoft\\VisualStudio\\14.0\\Setup\\VC\\ProductDir"}, {NET2013, "MSVC.NET 2013 (12.0)", "Software\\Microsoft\\VisualStudio\\12.0\\Setup\\VC\\ProductDir"}, {NET2013, "MSVC.NET 2013 Express Edition (12.0)", "Software\\Microsoft\\VCExpress\\12.0\\Setup\\VC\\ProductDir"}, @@ -164,6 +165,8 @@ const char _slnHeader120[] = "Microsoft Visual Studio Solution File, Format "\n# Visual Studio 2013"; const char _slnHeader140[] = "Microsoft Visual Studio Solution File, Format Version 12.00" "\n# Visual Studio 2015"; +const char _slnHeader141[] = "Microsoft Visual Studio Solution File, Format Version 12.00" + "\n# Visual Studio 2017"; // The following UUID _may_ change for later servicepacks... // If so we need to search through the registry at // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects @@ -394,6 +397,8 @@ QString VcprojGenerator::retrievePlatformToolSet() const return QStringLiteral("v120") + suffix; case NET2015: return QStringLiteral("v140") + suffix; + case NET2017: + return QStringLiteral("v141") + suffix; default: return QString(); } @@ -620,6 +625,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) } switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) { + case NET2017: + t << _slnHeader141; + break; case NET2015: t << _slnHeader140; break; @@ -954,6 +962,9 @@ void VcprojGenerator::initProject() // Own elements ----------------------------- vcProject.Name = project->first("QMAKE_ORIG_TARGET").toQString(); switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) { + case NET2017: + vcProject.Version = "15.00"; + break; case NET2015: vcProject.Version = "14.00"; break; diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index cd5676093d..4083fc5291 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -973,6 +973,13 @@ static ProString msvcBinDirToQMakeArch(QString subdir) subdir = subdir.toLower(); if (subdir == QLatin1String("amd64")) return ProString("x86_64"); + // Since 2017 the folder structure from here is HostX64|X86/x64|x86 + idx = subdir.indexOf(QLatin1Char('\\')); + if (idx == -1) + return ProString("x86"); + subdir.remove(0, idx + 1); + if (subdir == QLatin1String("x64")) + return ProString("x86_64"); return ProString(subdir); } @@ -1064,8 +1071,12 @@ void QMakeEvaluator::loadDefaults() vars[ProKey("QMAKE_HOST.arch")] << archStr; # if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake + // Since VS 2017 we need VCToolsInstallDir instead of VCINSTALLDIR + QString vcInstallDir = m_option->getEnv(QLatin1String("VCToolsInstallDir")); + if (vcInstallDir.isEmpty()) + vcInstallDir = m_option->getEnv(QLatin1String("VCINSTALLDIR")); vars[ProKey("QMAKE_TARGET.arch")] = msvcArchitecture( - m_option->getEnv(QLatin1String("VCINSTALLDIR")), + vcInstallDir, m_option->getEnv(QLatin1String("PATH"))); # endif #elif defined(Q_OS_UNIX) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8bcacca13f..14be4c3475 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -310,8 +310,10 @@ QLibraryInfo::buildDate() # define COMPILER_STRING "MSVC 2012" # elif _MSC_VER < 1900 # define COMPILER_STRING "MSVC 2013" -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1910 # define COMPILER_STRING "MSVC 2015" +# elif _MSC_VER < 2000 +# define COMPILER_STRING "MSVC 2017" # else # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER) # endif diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 88dcd8170b..a908db0707 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1458,7 +1458,8 @@ void Configure::parseCmdLine() dictionary[ "QMAKESPEC" ].endsWith("-msvc2010") || dictionary[ "QMAKESPEC" ].endsWith("-msvc2012") || dictionary[ "QMAKESPEC" ].endsWith("-msvc2013") || - dictionary[ "QMAKESPEC" ].endsWith("-msvc2015")) { + dictionary[ "QMAKESPEC" ].endsWith("-msvc2015") || + dictionary[ "QMAKESPEC" ].endsWith("-msvc2017")) { if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake"; dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) { diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 153a141d7a..f950945597 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -76,6 +76,7 @@ struct CompilerInfo{ {CC_MSVC2013, "Microsoft (R) Visual Studio 2013 C/C++ Compiler (12.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe // Microsoft skipped version 13 {CC_MSVC2015, "Microsoft (R) Visual Studio 2015 C/C++ Compiler (14.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\14.0", "cl.exe"}, // link.exe, lib.exe + {CC_MSVC2017, "Microsoft (R) Visual Studio 2017 C/C++ Compiler (15.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\15.0", "cl.exe"}, // link.exe, lib.exe {CC_UNKNOWN, "Unknown", 0, 0}, }; @@ -101,6 +102,9 @@ QString Environment::detectQMakeSpec() { QString spec; switch (detectCompiler()) { + case CC_MSVC2017: + spec = "win32-msvc2017"; + break; case CC_MSVC2015: spec = "win32-msvc2015"; break; @@ -137,6 +141,8 @@ QString Environment::detectQMakeSpec() Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec) { + if (qmakeSpec == QLatin1String("win32-msvc2017")) + return CC_MSVC2017; if (qmakeSpec == QLatin1String("win32-msvc2015")) return CC_MSVC2015; if (qmakeSpec == QLatin1String("win32-msvc2013")) diff --git a/tools/configure/environment.h b/tools/configure/environment.h index d096782e70..6b0e9bb9fe 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -46,7 +46,8 @@ enum Compiler { CC_MSVC2010 = 0xA0, CC_MSVC2012 = 0xB0, CC_MSVC2013 = 0xC0, - CC_MSVC2015 = 0xD0 + CC_MSVC2015 = 0xD0, + CC_MSVC2017 = 0xE0 }; struct CompilerInfo; -- cgit v1.2.3 From 9f17c245893e296d5c92ed1ef1e5d08896b469b1 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 17 Nov 2016 10:40:44 +0100 Subject: Enable constexpr support for Visual Studio 2017 Change-Id: I894789c41cc2c1a327c14d0526e658520d096085 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 3 +++ src/corelib/thread/qbasicatomic.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e324c043af..25e6e4c6bf 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -931,6 +931,9 @@ # define Q_COMPILER_THREADSAFE_STATICS # define Q_COMPILER_UNIFORM_INIT # endif +# if _MSC_VER >= 1910 +# define Q_COMPILER_CONSTEXPR +# endif # endif /* __cplusplus */ #endif /* Q_CC_MSVC */ diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 7960174277..c1e01a3212 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -78,6 +78,9 @@ # error "Qt has not been ported to this platform" #endif +QT_WARNING_PUSH +QT_WARNING_DISABLE_MSVC(4522) + QT_BEGIN_NAMESPACE #if 0 @@ -340,4 +343,6 @@ public: QT_END_NAMESPACE +QT_WARNING_POP + #endif // QBASICATOMIC_H -- cgit v1.2.3 From 3cd457bdad6eee4a703ef9773b80165a272fbdc7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 21 Nov 2016 11:38:43 +0100 Subject: Handle RemovePath correctly when calling matches() Change-Id: Ied324a537df127e676fad26b42e658a9d5aeec9b Reviewed-by: David Faure --- src/corelib/io/qurl.cpp | 3 ++ tests/auto/corelib/io/qurl/tst_qurl.cpp | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 7512bcd83f..de78d09dd9 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3703,6 +3703,9 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask)) return false; + if (options & QUrl::RemovePath) + return true; + // Compare paths, after applying path-related options QString path1; d->appendPath(path1, options, QUrlPrivate::Path); diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 8f99047df3..670b72acc8 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -182,6 +182,8 @@ private slots: void streaming(); void detach(); void testThreading(); + void matches_data(); + void matches(); private: void testThreadingHelper(); @@ -4023,6 +4025,54 @@ void tst_QUrl::testThreading() delete s_urlStorage; } +void tst_QUrl::matches_data() +{ + QTest::addColumn("urlStrOne"); + QTest::addColumn("urlStrTwo"); + QTest::addColumn("options"); + QTest::addColumn("matches"); + + QTest::newRow("matchingString-none") << "http://www.website.com/directory/?#ref" + << "http://www.website.com/directory/?#ref" + << uint(QUrl::None) << true; + QTest::newRow("nonMatchingString-none") << "http://www.website.com/directory/?#ref" + << "http://www.nomatch.com/directory/?#ref" + << uint(QUrl::None) << false; + QTest::newRow("matchingHost-removePath") << "http://www.website.com/directory" + << "http://www.website.com/differentdir" + << uint(QUrl::RemovePath) << true; + QTest::newRow("nonMatchingHost-removePath") << "http://www.website.com/directory" + << "http://www.different.com/differentdir" + << uint(QUrl::RemovePath) << false; + QTest::newRow("matchingHost-removePathAuthority") << "http://user:pass@www.website.com/directory" + << "http://www.website.com/differentdir" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) + << true; + QTest::newRow("nonMatchingHost-removePathAuthority") << "http://user:pass@www.website.com/directory" + << "http://user:pass@www.different.com/differentdir" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) + << true; + QTest::newRow("matchingHostAuthority-removePathAuthority") + << "http://user:pass@www.website.com/directory" << "http://www.website.com/differentdir" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true; + QTest::newRow("nonMatchingAuthority-removePathAuthority") + << "http://user:pass@www.website.com/directory" + << "http://otheruser:otherpass@www.website.com/directory" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true; +} + +void tst_QUrl::matches() +{ + QFETCH(QString, urlStrOne); + QFETCH(QString, urlStrTwo); + QFETCH(uint, options); + QFETCH(bool, matches); + + QUrl urlOne(urlStrOne); + QUrl urlTwo(urlStrTwo); + QCOMPARE(urlOne.matches(urlTwo, QUrl::FormattingOptions(options)), matches); +} + QTEST_MAIN(tst_QUrl) #include "tst_qurl.moc" -- cgit v1.2.3 From 7920cfe46ad11ce1cd5592a71cfa16422e9207e1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Nov 2016 10:57:25 +0100 Subject: Fix SCTP API according to Qt conventions inDatagramMode() -> isInDatagramMode() maxChannelCount -> maximumChannelCount Change-Id: Ib64bf52cc3b40354927ee11e3f41d47e84c6d9c4 Reviewed-by: Lars Knoll --- examples/network/multistreamserver/server.cpp | 2 +- src/network/socket/qsctpserver.cpp | 28 +++++++------- src/network/socket/qsctpserver.h | 4 +- src/network/socket/qsctpserver_p.h | 2 +- src/network/socket/qsctpsocket.cpp | 44 +++++++++++----------- src/network/socket/qsctpsocket.h | 6 +-- src/network/socket/qsctpsocket_p.h | 2 +- .../network/socket/qsctpsocket/tst_qsctpsocket.cpp | 16 ++++---- 8 files changed, 52 insertions(+), 52 deletions(-) diff --git a/examples/network/multistreamserver/server.cpp b/examples/network/multistreamserver/server.cpp index 3b06c0fd37..1d18514c0e 100644 --- a/examples/network/multistreamserver/server.cpp +++ b/examples/network/multistreamserver/server.cpp @@ -66,7 +66,7 @@ Server::Server(QWidget *parent) setWindowTitle(tr("Multi-stream Server")); sctpServer = new QSctpServer(this); - sctpServer->setMaxChannelCount(NumberOfChannels); + sctpServer->setMaximumChannelCount(NumberOfChannels); statusLabel = new QLabel; QPushButton *quitButton = new QPushButton(tr("Quit")); diff --git a/src/network/socket/qsctpserver.cpp b/src/network/socket/qsctpserver.cpp index 24f18e1ee8..77cb997192 100644 --- a/src/network/socket/qsctpserver.cpp +++ b/src/network/socket/qsctpserver.cpp @@ -60,7 +60,7 @@ The most common way to use QSctpServer is to construct an object and set the maximum number of channels that the server is - prepared to support, by calling setMaxChannelCount(). You can set + prepared to support, by calling setMaximumChannelCount(). You can set the TCP emulation mode by passing a negative argument in this call. Also, a special value of 0 (the default) indicates to use the peer's value as the actual number of channels. The new incoming @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ QSctpServerPrivate::QSctpServerPrivate() - : maxChannelCount(0) + : maximumChannelCount(0) { } @@ -119,7 +119,7 @@ void QSctpServerPrivate::configureCreatedSocket() QTcpServerPrivate::configureCreatedSocket(); if (socketEngine) socketEngine->setOption(QAbstractSocketEngine::MaxStreamsSocketOption, - maxChannelCount == -1 ? 1 : maxChannelCount); + maximumChannelCount == -1 ? 1 : maximumChannelCount); } /*! @@ -128,7 +128,7 @@ void QSctpServerPrivate::configureCreatedSocket() Sets the datagram operation mode. The \a parent argument is passed to QObject's constructor. - \sa setMaxChannelCount(), listen(), setSocketDescriptor() + \sa setMaximumChannelCount(), listen(), setSocketDescriptor() */ QSctpServer::QSctpServer(QObject *parent) : QTcpServer(QAbstractSocket::SctpSocket, *new QSctpServerPrivate, parent) @@ -159,19 +159,19 @@ QSctpServer::~QSctpServer() Call this method only when QSctpServer is in UnconnectedState. - \sa maxChannelCount(), QSctpSocket + \sa maximumChannelCount(), QSctpSocket */ -void QSctpServer::setMaxChannelCount(int count) +void QSctpServer::setMaximumChannelCount(int count) { Q_D(QSctpServer); if (d->state != QAbstractSocket::UnconnectedState) { - qWarning("QSctpServer::setMaxChannelCount() is only allowed in UnconnectedState"); + qWarning("QSctpServer::setMaximumChannelCount() is only allowed in UnconnectedState"); return; } #if defined(QSCTPSERVER_DEBUG) - qDebug("QSctpServer::setMaxChannelCount(%i)", count); + qDebug("QSctpServer::setMaximumChannelCount(%i)", count); #endif - d->maxChannelCount = count; + d->maximumChannelCount = count; } /*! @@ -183,11 +183,11 @@ void QSctpServer::setMaxChannelCount(int count) Returns -1, if QSctpServer running in TCP emulation mode. - \sa setMaxChannelCount() + \sa setMaximumChannelCount() */ -int QSctpServer::maxChannelCount() const +int QSctpServer::maximumChannelCount() const { - return d_func()->maxChannelCount; + return d_func()->maximumChannelCount; } /*! \reimp @@ -199,7 +199,7 @@ void QSctpServer::incomingConnection(qintptr socketDescriptor) #endif QSctpSocket *socket = new QSctpSocket(this); - socket->setMaxChannelCount(d_func()->maxChannelCount); + socket->setMaximumChannelCount(d_func()->maximumChannelCount); socket->setSocketDescriptor(socketDescriptor); addPendingConnection(socket); } @@ -234,7 +234,7 @@ QSctpSocket *QSctpServer::nextPendingDatagramConnection() QSctpSocket *socket = qobject_cast(i.next()); Q_ASSERT(socket); - if (socket->inDatagramMode()) { + if (socket->isInDatagramMode()) { i.remove(); Q_ASSERT(d->socketEngine); d->socketEngine->setReadNotificationEnabled(true); diff --git a/src/network/socket/qsctpserver.h b/src/network/socket/qsctpserver.h index fb017a924d..f39257485d 100644 --- a/src/network/socket/qsctpserver.h +++ b/src/network/socket/qsctpserver.h @@ -57,8 +57,8 @@ public: explicit QSctpServer(QObject *parent = nullptr); virtual ~QSctpServer(); - void setMaxChannelCount(int count); - int maxChannelCount() const; + void setMaximumChannelCount(int count); + int maximumChannelCount() const; QSctpSocket *nextPendingDatagramConnection(); diff --git a/src/network/socket/qsctpserver_p.h b/src/network/socket/qsctpserver_p.h index 32760caffe..274939fc3d 100644 --- a/src/network/socket/qsctpserver_p.h +++ b/src/network/socket/qsctpserver_p.h @@ -64,7 +64,7 @@ public: QSctpServerPrivate(); virtual ~QSctpServerPrivate(); - int maxChannelCount; + int maximumChannelCount; void configureCreatedSocket() Q_DECL_OVERRIDE; }; diff --git a/src/network/socket/qsctpsocket.cpp b/src/network/socket/qsctpsocket.cpp index cb07e80299..fe76f64c42 100644 --- a/src/network/socket/qsctpsocket.cpp +++ b/src/network/socket/qsctpsocket.cpp @@ -83,14 +83,14 @@ \endlist To set a continuous byte stream mode, instantiate QSctpSocket and - call setMaxChannelCount() with a negative value. This gives the + call setMaximumChannelCount() with a negative value. This gives the ability to use QSctpSocket as a regular buffered QTcpSocket. You can call connectToHost() to initiate connection with endpoint, write() to transmit and read() to receive data from the peer, but you cannot distinguish message boundaries. By default, QSctpSocket operates in datagram mode. Before - connecting, call setMaxChannelCount() to set the maximum number of + connecting, call setMaximumChannelCount() to set the maximum number of channels that the application is prepared to support. This number is a parameter negotiated with the remote endpoint and its value can be bounded by the operating system. The default value of 0 @@ -130,7 +130,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ QSctpSocketPrivate::QSctpSocketPrivate() - : maxChannelCount(0) + : maximumChannelCount(0) { } @@ -150,7 +150,7 @@ bool QSctpSocketPrivate::canReadNotification() #endif // Handle TCP emulation mode in the base implementation. - if (!q->inDatagramMode()) + if (!q->isInDatagramMode()) return QTcpSocketPrivate::canReadNotification(); const int savedCurrentChannel = currentReadChannel; @@ -248,7 +248,7 @@ bool QSctpSocketPrivate::writeToSocket() #endif // Handle TCP emulation mode in the base implementation. - if (!q->inDatagramMode()) + if (!q->isInDatagramMode()) return QTcpSocketPrivate::writeToSocket(); if (!socketEngine) @@ -331,7 +331,7 @@ void QSctpSocketPrivate::configureCreatedSocket() { if (socketEngine) socketEngine->setOption(QAbstractSocketEngine::MaxStreamsSocketOption, - maxChannelCount < 0 ? 1 : maxChannelCount); + maximumChannelCount < 0 ? 1 : maximumChannelCount); } /*! @@ -340,7 +340,7 @@ void QSctpSocketPrivate::configureCreatedSocket() Sets the datagram operation mode. The \a parent argument is passed to QObject's constructor. - \sa socketType(), setMaxChannelCount() + \sa socketType(), setMaximumChannelCount() */ QSctpSocket::QSctpSocket(QObject *parent) : QTcpSocket(SctpSocket, *new QSctpSocketPrivate, parent) @@ -418,19 +418,19 @@ void QSctpSocket::disconnectFromHost() Call this method only when QSctpSocket is in UnconnectedState. - \sa maxChannelCount(), readChannelCount(), writeChannelCount() + \sa maximumChannelCount(), readChannelCount(), writeChannelCount() */ -void QSctpSocket::setMaxChannelCount(int count) +void QSctpSocket::setMaximumChannelCount(int count) { Q_D(QSctpSocket); if (d->state != QAbstractSocket::UnconnectedState) { - qWarning("QSctpSocket::setMaxChannelCount() is only allowed in UnconnectedState"); + qWarning("QSctpSocket::setMaximumChannelCount() is only allowed in UnconnectedState"); return; } #if defined(QSCTPSOCKET_DEBUG) - qDebug("QSctpSocket::setMaxChannelCount(%i)", count); + qDebug("QSctpSocket::setMaximumChannelCount(%i)", count); #endif - d->maxChannelCount = qMax(count, -1); + d->maximumChannelCount = qMax(count, -1); } /*! @@ -443,22 +443,22 @@ void QSctpSocket::setMaxChannelCount(int count) Returns -1 if QSctpSocket is running in continuous byte stream mode. - \sa setMaxChannelCount(), readChannelCount(), writeChannelCount() + \sa setMaximumChannelCount(), readChannelCount(), writeChannelCount() */ -int QSctpSocket::maxChannelCount() const +int QSctpSocket::maximumChannelCount() const { - return d_func()->maxChannelCount; + return d_func()->maximumChannelCount; } /*! Returns \c true if the socket is running in datagram mode. - \sa setMaxChannelCount() + \sa setMaximumChannelCount() */ -bool QSctpSocket::inDatagramMode() const +bool QSctpSocket::isInDatagramMode() const { Q_D(const QSctpSocket); - return d->maxChannelCount != -1 && d->isBuffered; + return d->maximumChannelCount != -1 && d->isBuffered; } /*! @@ -471,13 +471,13 @@ bool QSctpSocket::inDatagramMode() const On failure, returns a QNetworkDatagram that reports \l {QNetworkDatagram::isValid()}{not valid}. - \sa writeDatagram(), inDatagramMode(), currentReadChannel() + \sa writeDatagram(), isInDatagramMode(), currentReadChannel() */ QNetworkDatagram QSctpSocket::readDatagram() { Q_D(QSctpSocket); - if (!isReadable() || !inDatagramMode()) { + if (!isReadable() || !isInDatagramMode()) { qWarning("QSctpSocket::readDatagram(): operation is not permitted"); return QNetworkDatagram(); } @@ -507,14 +507,14 @@ QNetworkDatagram QSctpSocket::readDatagram() Writes a \a datagram to the buffer of the current write channel. Returns true on success; otherwise returns false. - \sa readDatagram(), inDatagramMode(), currentWriteChannel() + \sa readDatagram(), isInDatagramMode(), currentWriteChannel() */ bool QSctpSocket::writeDatagram(const QNetworkDatagram &datagram) { Q_D(QSctpSocket); if (!isWritable() || d->state != QAbstractSocket::ConnectedState || !d->socketEngine - || !d->socketEngine->isValid() || !inDatagramMode()) { + || !d->socketEngine->isValid() || !isInDatagramMode()) { qWarning("QSctpSocket::writeDatagram(): operation is not permitted"); return false; } diff --git a/src/network/socket/qsctpsocket.h b/src/network/socket/qsctpsocket.h index aaa4e1ecca..3e5a545c4b 100644 --- a/src/network/socket/qsctpsocket.h +++ b/src/network/socket/qsctpsocket.h @@ -59,9 +59,9 @@ public: void close() Q_DECL_OVERRIDE; void disconnectFromHost() Q_DECL_OVERRIDE; - void setMaxChannelCount(int count); - int maxChannelCount() const; - bool inDatagramMode() const; + void setMaximumChannelCount(int count); + int maximumChannelCount() const; + bool isInDatagramMode() const; QNetworkDatagram readDatagram(); bool writeDatagram(const QNetworkDatagram &datagram); diff --git a/src/network/socket/qsctpsocket_p.h b/src/network/socket/qsctpsocket_p.h index f38095330f..3f765ebed9 100644 --- a/src/network/socket/qsctpsocket_p.h +++ b/src/network/socket/qsctpsocket_p.h @@ -74,7 +74,7 @@ public: bool writeToSocket() Q_DECL_OVERRIDE; QByteArray incomingDatagram; - int maxChannelCount; + int maximumChannelCount; typedef std::deque IpHeaderList; QVector readHeaders; diff --git a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp index fc976fbd0d..cf15e60531 100644 --- a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp +++ b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp @@ -112,7 +112,7 @@ void tst_QSctpSocket::constructing() QVERIFY(!socket.isOpen()); QVERIFY(!socket.isValid()); QCOMPARE(socket.socketType(), QAbstractSocket::SctpSocket); - QCOMPARE(socket.maxChannelCount(), 0); + QCOMPARE(socket.maximumChannelCount(), 0); QCOMPARE(socket.readChannelCount(), 0); QCOMPARE(socket.writeChannelCount(), 0); @@ -202,7 +202,7 @@ void tst_QSctpSocket::setSocketDescriptor() { QSctpServer server; - server.setMaxChannelCount(16); + server.setMaximumChannelCount(16); QVERIFY(server.listen()); SOCKET sock = ::socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); @@ -218,8 +218,8 @@ void tst_QSctpSocket::setSocketDescriptor() QVERIFY(socket.waitForConnected(3000)); QVERIFY(server.waitForNewConnection(3000)); - QCOMPARE(socket.readChannelCount(), server.maxChannelCount()); - QVERIFY(socket.writeChannelCount() <= server.maxChannelCount()); + QCOMPARE(socket.readChannelCount(), server.maximumChannelCount()); + QVERIFY(socket.writeChannelCount() <= server.maximumChannelCount()); QSctpSocket *acceptedSocket = server.nextPendingDatagramConnection(); QVERIFY(acceptedSocket); @@ -338,11 +338,11 @@ void tst_QSctpSocket::loop() QSctpServer server; - server.setMaxChannelCount(10); + server.setMaximumChannelCount(10); QVERIFY(server.listen()); QSctpSocket peter; - peter.setMaxChannelCount(10); + peter.setMaximumChannelCount(10); peter.connectToHost(QHostAddress::LocalHost, server.serverPort()); QVERIFY(peter.waitForConnected(3000)); @@ -389,11 +389,11 @@ void tst_QSctpSocket::loopInTCPMode() QSctpServer server; - server.setMaxChannelCount(-1); + server.setMaximumChannelCount(-1); QVERIFY(server.listen()); QSctpSocket peter; - peter.setMaxChannelCount(-1); + peter.setMaximumChannelCount(-1); peter.connectToHost(QHostAddress::LocalHost, server.serverPort()); QVERIFY(peter.waitForConnected(3000)); QVERIFY(server.waitForNewConnection(3000)); -- cgit v1.2.3 From e1f0e08e9a290689f2778ffcfafc133f8a1b99cf Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Fri, 18 Nov 2016 17:39:01 +0100 Subject: Add more information for QKeySequence::toString on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous documentation said: "On OS X, the string returned resembles the sequence that is shown in the menu bar." That was not completely true because the string returned depends on the format passed to the function. Task-number: QTWEBSITE-744 Change-Id: I1b7d9367547326670d1b3a8cfe48f066910f5a10 Reviewed-by: Topi Reiniö --- src/gui/kernel/qkeysequence.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index ea71e34e4b..77c5ae7a02 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1517,7 +1517,9 @@ bool QKeySequence::isDetached() const If the key sequence has no keys, an empty string is returned. On \macos, the string returned resembles the sequence that is - shown in the menu bar. + shown in the menu bar if \a format is + QKeySequence::NativeText; otherwise, the string uses the + "portable" format, suitable for writing to a file. \sa fromString() */ -- cgit v1.2.3 From a9af3c85022994cfe18a05cd92db9fc0b0ad902c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 16 Sep 2016 11:27:00 +0200 Subject: win: Show Tech Preview license Show the tech preview license for commercial users if -confirm-license is not set. This matches what the configure shell script is doing, too. Task-number: QTBUG-55676 Change-Id: I69f5553ab53dfcdc14c200e682c024a6cebee8fe Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 34 ++++++++++++++++++++-------------- tools/configure/tools.cpp | 8 +------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index a908db0707..2b7a1d6b07 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -4550,11 +4550,6 @@ Configure::ProjectType Configure::projectType(const QString& proFileName) bool Configure::showLicense(QString orgLicenseFile) { - if (dictionary["LICENSE_CONFIRMED"] == "yes") { - cout << "You have already accepted the terms of the license." << endl << endl; - return true; - } - bool showLgpl2 = true; QString licenseFile = orgLicenseFile; QString theLicense; @@ -4665,21 +4660,32 @@ void Configure::readLicense() } } if (hasOpenSource && openSource) { - cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl; + cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl << endl; dictionary["LICENSEE"] = "Open Source"; dictionary["EDITION"] = "OpenSource"; - cout << endl; - if (!showLicense(dictionary["LICENSE FILE"])) { - cout << "Configuration aborted since license was not accepted"; - dictionary["DONE"] = "error"; - return; - } } else if (openSource) { cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl; dictionary["DONE"] = "error"; + } else { + QString tpLicense = sourcePath + "/LICENSE.PREVIEW.COMMERCIAL"; + if (QFile::exists(tpLicense)) { + cout << endl << "This is the Qt Preview Edition." << endl << endl; + + dictionary["EDITION"] = "Preview"; + dictionary["LICENSE FILE"] = tpLicense; + } else { + Tools::checkLicense(dictionary, sourcePath, buildPath); + } } - else { - Tools::checkLicense(dictionary, sourcePath, buildPath); + + if (dictionary["LICENSE_CONFIRMED"] != "yes") { + if (!showLicense(dictionary["LICENSE FILE"])) { + cout << "Configuration aborted since license was not accepted" << endl; + dictionary["DONE"] = "error"; + return; + } + } else if (dictionary["LICHECK"].isEmpty()) { // licheck executable shows license + cout << "You have already accepted the terms of the license." << endl << endl; } } diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index 095e798332..02c74282cd 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -47,13 +47,6 @@ using namespace std; void Tools::checkLicense(QMap &dictionary, const QString &sourcePath, const QString &buildPath) { - QString tpLicense = sourcePath + "/LICENSE.PREVIEW.COMMERCIAL"; - if (QFile::exists(tpLicense)) { - dictionary["EDITION"] = "Preview"; - dictionary["LICENSE FILE"] = tpLicense; - return; - } - dictionary["LICHECK"] = "licheck.exe"; const QString licenseChecker = @@ -80,6 +73,7 @@ void Tools::checkLicense(QMap &dictionary, } else { foreach (const QString &var, licheckOutput.split('\n')) dictionary[var.section('=', 0, 0).toUpper()] = var.section('=', 1, 1); + dictionary["LICENSE_CONFIRMED"] = "yes"; } } else { cout << endl << "Error: Could not find licheck.exe" << endl -- cgit v1.2.3 From 34c2a1dcf05661562cd00fe6dbdf884d8917933d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 27 Sep 2016 15:30:15 +0200 Subject: QFormLayout: fix use-after-free in clearQLayoutItem() Found by ASan when it should have been found by me in the initial review... The old code did, in this order: 1. delete item->layout() (which deletes item, as QLayoutItem::layout() is just a dynamic_cast implemented with virtual functions) 2. delete item->widget() (which is correct, but too late, as 'item' may have already been deleted; this is the first use-after-free bug) 3. delete item->spacerItem() (which is the second use-after-free). Fix by deleting item->widget() (which may be a no-op), _then_ checking for a QLayout, deleting all children (but not the layout), and finally deleting item as a QLayoutItem. Rename clearQLayoutItem() to clearAndDestroyQLayoutItem() to better match what it actually does. Change-Id: Id70a7a137dac5de466ef619f01bfd61dfc150418 Reviewed-by: Thiago Macieira Reviewed-by: Samuel Gaist Reviewed-by: Marc Mutz --- src/widgets/kernel/qformlayout.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 3e60723f17..f3f7280030 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1410,18 +1410,15 @@ static QLayoutItem *ownershipCleanedItem(QFormLayoutItem *item, QFormLayout *lay return i; } -static void clearQLayoutItem(QLayoutItem *item) +static void clearAndDestroyQLayoutItem(QLayoutItem *item) { if (Q_LIKELY(item)) { + delete item->widget(); if (QLayout *layout = item->layout()) { - while (QLayoutItem *child = layout->takeAt(0)) { - clearQLayoutItem(child); - delete child; - } - delete layout; + while (QLayoutItem *child = layout->takeAt(0)) + clearAndDestroyQLayoutItem(child); } - delete item->widget(); - delete item->spacerItem(); + delete item; } } @@ -1453,8 +1450,8 @@ static void clearQLayoutItem(QLayoutItem *item) void QFormLayout::removeRow(int row) { TakeRowResult result = takeRow(row); - clearQLayoutItem(result.labelItem); - clearQLayoutItem(result.fieldItem); + clearAndDestroyQLayoutItem(result.labelItem); + clearAndDestroyQLayoutItem(result.fieldItem); } /*! @@ -1485,8 +1482,8 @@ void QFormLayout::removeRow(int row) void QFormLayout::removeRow(QWidget *widget) { TakeRowResult result = takeRow(widget); - clearQLayoutItem(result.labelItem); - clearQLayoutItem(result.fieldItem); + clearAndDestroyQLayoutItem(result.labelItem); + clearAndDestroyQLayoutItem(result.fieldItem); } /*! @@ -1518,8 +1515,8 @@ void QFormLayout::removeRow(QWidget *widget) void QFormLayout::removeRow(QLayout *layout) { TakeRowResult result = takeRow(layout); - clearQLayoutItem(result.labelItem); - clearQLayoutItem(result.fieldItem); + clearAndDestroyQLayoutItem(result.labelItem); + clearAndDestroyQLayoutItem(result.fieldItem); } /*! -- cgit v1.2.3 From d6c8fab8805f5085568065cdc8bfbfddfcfd8f2e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 17 Oct 2016 13:00:04 +0200 Subject: QMutex: make sure we try_lock_for no shorter than the duration passed By templating on the types and unconditionally using duration_cast to coerce the duration into a milliseconds, we allowed code such as mutex.try_lock_for(10us) to compile, which is misleading, since it's actually a zero- timeout try_lock(). Feedback from the std-discussions mailing list is that the wait_for functions should wait for _at least_ the duration given, because that is the natural direction of variance (tasks becoming ready to run might not get a CPU immediately, causing delays), while an interface that documents to wait _no more_ than the given duration is promising something it cannot fulfill. Fix by converting the given duration to the smallest number of milliseconds not less than the original duration. If that is not representable in an int, use INT_MAX, emulating the effect of a spurious wakeup, which are allowed to happen if the function returns false in that case. In the above example, the try_lock_for call is now equivalent to mutex.tryLock(1); The tryLock() docs state that the actual waiting time does not exceed the given milliseconds, but fixing that is a separate issue. Change-Id: Id4cbbea0ecc6fd2f94bb5aef28a1658be3728e52 Reviewed-by: Thiago Macieira --- src/corelib/thread/qmutex.cpp | 4 +- src/corelib/thread/qmutex.h | 38 ++++++-- tests/auto/corelib/thread/qmutex/tst_qmutex.cpp | 114 ++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 10 deletions(-) diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 6e0fa4eedb..0aee4aeda4 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -275,7 +275,7 @@ bool QMutex::tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT Attempts to lock the mutex. This function returns \c true if the lock was obtained; otherwise it returns \c false. If another thread has - locked the mutex, this function will wait for at most \a duration + locked the mutex, this function will wait for at least \a duration for the mutex to become available. Note: Passing a negative duration as the \a duration is equivalent to @@ -299,7 +299,7 @@ bool QMutex::tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT Attempts to lock the mutex. This function returns \c true if the lock was obtained; otherwise it returns \c false. If another thread has - locked the mutex, this function will wait at most until \a timePoint + locked the mutex, this function will wait at least until \a timePoint for the mutex to become available. Note: Passing a \a timePoint which has already passed is equivalent diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 3a0e22e3bd..056ebdeaa5 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -46,8 +46,11 @@ #if QT_HAS_INCLUDE() # include +# include #endif +class tst_QMutex; + QT_BEGIN_NAMESPACE @@ -135,14 +138,7 @@ public: template bool try_lock_for(std::chrono::duration duration) { - // N4606 § 30.4.1.3 [thread.timedmutex.requirements]/5 specifies that - // a duration less than or equal to duration.zero() shall result in a - // try_lock, unlike QMutex's tryLock with a negative duration which - // results in a lock. - - if (duration <= duration.zero()) - return tryLock(0); - return tryLock(std::chrono::duration_cast(duration).count()); + return tryLock(convertToMilliseconds(duration)); } // TimedLockable concept @@ -162,6 +158,32 @@ public: private: Q_DISABLE_COPY(QMutex) friend class QMutexLocker; + friend class ::tst_QMutex; + +#if QT_HAS_INCLUDE() + template + static int convertToMilliseconds(std::chrono::duration duration) + { + // N4606 § 30.4.1.3.5 [thread.timedmutex.requirements] specifies that a + // duration less than or equal to duration.zero() shall result in a + // try_lock, unlike QMutex's tryLock with a negative duration which + // results in a lock. + + if (duration <= duration.zero()) + return 0; + + // when converting from 'duration' to milliseconds, make sure that + // the result is not shorter than 'duration': + std::chrono::milliseconds wait = std::chrono::duration_cast(duration); + if (wait < duration) + wait += std::chrono::milliseconds(1); + Q_ASSERT(wait >= duration); + const auto ms = wait.count(); + const auto maxInt = (std::numeric_limits::max)(); + + return ms < maxInt ? int(ms) : maxInt; + } +#endif }; class Q_CORE_EXPORT QMutexLocker diff --git a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp index b24ecfcd43..bf778e9fd1 100644 --- a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp @@ -44,8 +44,19 @@ class tst_QMutex : public QObject { Q_OBJECT +public: + enum class TimeUnit { + Nanoseconds, + Microseconds, + Milliseconds, + Seconds, + }; + Q_ENUM(TimeUnit); + private slots: void initTestCase(); + void convertToMilliseconds_data(); + void convertToMilliseconds(); void tryLock_non_recursive(); void try_lock_for_non_recursive(); void try_lock_until_non_recursive(); @@ -122,6 +133,109 @@ void tst_QMutex::initTestCase() initializeSystemTimersResolution(); } +void tst_QMutex::convertToMilliseconds_data() +{ + QTest::addColumn("unit"); + QTest::addColumn("doubleValue"); + QTest::addColumn("intValue"); + QTest::addColumn("expected"); + + + auto add = [](TimeUnit unit, double d, long long i, qint64 expected) { + const QScopedArrayPointer enumName(QTest::toString(unit)); + QTest::newRow(qPrintable(QString::asprintf("%s:%f:%lld", enumName.data(), d, i))) + << unit << d << qint64(i) << expected; + }; + + auto forAllUnitsAdd = [=](double d, long long i, qint64 expected) { + for (auto unit : {TimeUnit::Nanoseconds, TimeUnit::Microseconds, TimeUnit::Milliseconds, TimeUnit::Seconds}) + add(unit, d, i, expected); + }; + + forAllUnitsAdd(-0.5, -1, 0); // all negative values result in 0 + + forAllUnitsAdd(0, 0, 0); + + add(TimeUnit::Nanoseconds, 1, 1, 1); + add(TimeUnit::Nanoseconds, 1000 * 1000, 1000 * 1000, 1); + add(TimeUnit::Nanoseconds, 1000 * 1000 + 0.5, 1000 * 1000 + 1, 2); + + add(TimeUnit::Microseconds, 1, 1, 1); + add(TimeUnit::Microseconds, 1000, 1000, 1); + add(TimeUnit::Microseconds, 1000 + 0.5, 1000 + 1, 2); + + add(TimeUnit::Milliseconds, 1, 1, 1); + add(TimeUnit::Milliseconds, 1.5, 2, 2); + + add(TimeUnit::Seconds, 0.9991, 1, 1000); + + // + // overflowing int results in INT_MAX (equivalent to a spurious wakeup after ~24 days); check it: + // + + // spot on: + add(TimeUnit::Nanoseconds, INT_MAX * 1000. * 1000, INT_MAX * Q_INT64_C(1000) * 1000, INT_MAX); + add(TimeUnit::Microseconds, INT_MAX * 1000., INT_MAX * Q_INT64_C(1000), INT_MAX); + add(TimeUnit::Milliseconds, INT_MAX, INT_MAX, INT_MAX); + + // minimally above: + add(TimeUnit::Nanoseconds, INT_MAX * 1000. * 1000 + 1, INT_MAX * Q_INT64_C(1000) * 1000 + 1, INT_MAX); + add(TimeUnit::Microseconds, INT_MAX * 1000. + 1, INT_MAX * Q_INT64_C(1000) + 1, INT_MAX); + add(TimeUnit::Milliseconds, INT_MAX + 1., INT_MAX + Q_INT64_C(1), INT_MAX); + add(TimeUnit::Seconds, INT_MAX / 1000. + 1, INT_MAX / 1000 + 1, INT_MAX); + + // minimally below: + add(TimeUnit::Nanoseconds, INT_MAX * 1000. * 1000 - 1, INT_MAX * Q_INT64_C(1000) * 1000 - 1, INT_MAX); + add(TimeUnit::Microseconds, INT_MAX * 1000. - 1, INT_MAX * Q_INT64_C(1000) - 1, INT_MAX); + add(TimeUnit::Milliseconds, INT_MAX - 0.1, INT_MAX , INT_MAX); + +} + +void tst_QMutex::convertToMilliseconds() +{ +#if !QT_HAS_INCLUDE() + QSKIP("This test requires "); +#else + QFETCH(TimeUnit, unit); + QFETCH(double, doubleValue); + QFETCH(qint64, intValue); + QFETCH(qint64, expected); + + Q_CONSTEXPR qint64 maxShort = std::numeric_limits::max(); + Q_CONSTEXPR qint64 maxInt = std::numeric_limits::max(); + Q_CONSTEXPR qint64 maxUInt = std::numeric_limits::max(); + + switch (unit) { +#define CASE(Unit, Period) \ + case TimeUnit::Unit: \ + DO(double, Period, doubleValue); \ + if (intValue < maxShort) \ + DO(short, Period, short(intValue)); \ + if (intValue < maxInt) \ + DO(int, Period, int(intValue)); \ + DO(qint64, Period, intValue); \ + if (intValue >= 0) { \ + if (intValue < maxUInt) \ + DO(uint, Period, uint(intValue)); \ + DO(quint64, Period, quint64(intValue)); \ + } \ + break +#define DO(Rep, Period, val) \ + do { \ + const std::chrono::duration wait((val)); \ + QCOMPARE(QMutex::convertToMilliseconds(wait), expected); \ + } while (0) + + CASE(Nanoseconds, std::nano); + CASE(Microseconds, std::micro); + CASE(Milliseconds, std::milli); + CASE(Seconds, std::ratio<1>); +#undef DO +#undef CASE + } +#endif +} + void tst_QMutex::tryLock_non_recursive() { class Thread : public QThread -- cgit v1.2.3 From d377f14fd5b4fe3ed64392c6b743bac395f9f891 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 7 Nov 2016 11:28:16 +0100 Subject: Windows QPA: Detect Windows 10 tablet mode Add new file for dynamically loading Window 10 Helpers via combase.dll and add function qt_windowsIsTabletMode() querying UIViewSettings::get_UserInteractionMode() for "Touch" mode. The style hint QPlatformIntegration::ShowIsMaximized will then reflect the tablet mode setting. Task-number: QTBUG-56831 Change-Id: Ia361dd172fcf0e54fdfc70863c43527f3ea72fe2 Reviewed-by: Oliver Wolff Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/windows/qwin10helpers.cpp | 167 +++++++++++++++++++++ src/plugins/platforms/windows/qwin10helpers.h | 52 +++++++ src/plugins/platforms/windows/qwindowsclipboard.h | 2 + .../platforms/windows/qwindowsintegration.cpp | 7 + src/plugins/platforms/windows/windows.pri | 4 +- 5 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 src/plugins/platforms/windows/qwin10helpers.cpp create mode 100644 src/plugins/platforms/windows/qwin10helpers.h diff --git a/src/plugins/platforms/windows/qwin10helpers.cpp b/src/plugins/platforms/windows/qwin10helpers.cpp new file mode 100644 index 0000000000..3ded96b9d6 --- /dev/null +++ b/src/plugins/platforms/windows/qwin10helpers.cpp @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwin10helpers.h" + +#include +#include + +#if defined(Q_CC_MINGW) +# define HAS_UI_VIEW_SETTINGS_INTEROP +#elif !defined(Q_CC_MSVC) || _MSC_VER >= 1900 // MSVC2013 is lacking both +# define HAS_UI_VIEW_SETTINGS_INTEROP +# define HAS_UI_VIEW_SETTINGS +#endif + +#include + +#ifdef HAS_UI_VIEW_SETTINGS +# include +#endif + +#ifdef HAS_UI_VIEW_SETTINGS_INTEROP +# include +#endif + +#ifndef HAS_UI_VIEW_SETTINGS_INTEROP +MIDL_INTERFACE("3694dbf9-8f68-44be-8ff5-195c98ede8a6") +IUIViewSettingsInterop : public IInspectable +{ +public: + virtual HRESULT STDMETHODCALLTYPE GetForWindow( + __RPC__in HWND hwnd, + __RPC__in REFIID riid, + __RPC__deref_out_opt void **ppv) = 0; +}; +#endif // !HAS_UI_VIEW_SETTINGS_INTEROP + +#ifndef HAS_UI_VIEW_SETTINGS +namespace ABI { +namespace Windows { +namespace UI { +namespace ViewManagement { + +enum UserInteractionMode { Mouse, Touch }; + +MIDL_INTERFACE("C63657F6-8850-470D-88F8-455E16EA2C26") +IUIViewSettings : public IInspectable +{ +public: + virtual HRESULT STDMETHODCALLTYPE get_UserInteractionMode(UserInteractionMode *value) = 0; +}; + +} // namespace ViewManagement +} // namespace UI +} // namespace Windows +} // namespace ABI +#endif // HAS_UI_VIEW_SETTINGS + +QT_BEGIN_NAMESPACE + +// Starting from Windows 10 +struct QWindowsComBaseDLL +{ + bool init(); + bool isValid() const + { + return roGetActivationFactory != nullptr && windowsCreateStringReference != nullptr; + } + + typedef HRESULT (WINAPI *RoGetActivationFactory)(HSTRING, REFIID, void **); + typedef HRESULT (WINAPI *WindowsCreateStringReference)(PCWSTR, UINT32, HSTRING_HEADER *, HSTRING *); + + RoGetActivationFactory roGetActivationFactory = nullptr; + WindowsCreateStringReference windowsCreateStringReference = nullptr; +}; + +static QWindowsComBaseDLL baseComDll; + +bool QWindowsComBaseDLL::init() +{ + if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && !isValid()) { + QSystemLibrary library(QStringLiteral("combase")); + roGetActivationFactory = + reinterpret_cast(library.resolve("RoGetActivationFactory")); + windowsCreateStringReference = + reinterpret_cast(library.resolve("WindowsCreateStringReference")); + } + return isValid(); +} + +// Return tablet mode, note: Does not work for GetDesktopWindow(). +bool qt_windowsIsTabletMode(HWND hwnd) +{ + bool result = false; + + if (!baseComDll.init()) + return false; + + const wchar_t uiViewSettingsId[] = L"Windows.UI.ViewManagement.UIViewSettings"; + HSTRING_HEADER uiViewSettingsIdRefHeader; + HSTRING uiViewSettingsIdHs = nullptr; + const UINT32 uiViewSettingsIdLen = UINT32(sizeof(uiViewSettingsId) / sizeof(uiViewSettingsId[0]) - 1); + if (FAILED(baseComDll.windowsCreateStringReference(uiViewSettingsId, uiViewSettingsIdLen, &uiViewSettingsIdRefHeader, &uiViewSettingsIdHs))) + return false; + + IUIViewSettingsInterop *uiViewSettingsInterop = nullptr; + // __uuidof(IUIViewSettingsInterop); + const GUID uiViewSettingsInteropRefId = {0x3694dbf9, 0x8f68, 0x44be,{0x8f, 0xf5, 0x19, 0x5c, 0x98, 0xed, 0xe8, 0xa6}}; + + HRESULT hr = baseComDll.roGetActivationFactory(uiViewSettingsIdHs, uiViewSettingsInteropRefId, + reinterpret_cast(&uiViewSettingsInterop)); + if (FAILED(hr)) + return false; + + // __uuidof(ABI::Windows::UI::ViewManagement::IUIViewSettings); + const GUID uiViewSettingsRefId = {0xc63657f6, 0x8850, 0x470d,{0x88, 0xf8, 0x45, 0x5e, 0x16, 0xea, 0x2c, 0x26}}; + ABI::Windows::UI::ViewManagement::IUIViewSettings *viewSettings = nullptr; + hr = uiViewSettingsInterop->GetForWindow(hwnd, uiViewSettingsRefId, + reinterpret_cast(&viewSettings)); + if (SUCCEEDED(hr)) { + ABI::Windows::UI::ViewManagement::UserInteractionMode currentMode; + hr = viewSettings->get_UserInteractionMode(¤tMode); + if (SUCCEEDED(hr)) + result = currentMode == 1; // Touch, 1 + viewSettings->Release(); + } + uiViewSettingsInterop->Release(); + return result; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwin10helpers.h b/src/plugins/platforms/windows/qwin10helpers.h new file mode 100644 index 0000000000..e1485003dd --- /dev/null +++ b/src/plugins/platforms/windows/qwin10helpers.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWIN10HELPERS_H +#define QWIN10HELPERS_H + +#include +#include + +QT_BEGIN_NAMESPACE + +bool qt_windowsIsTabletMode(HWND hwnd); + +QT_END_NAMESPACE + +#endif // QWIN10HELPERS_H diff --git a/src/plugins/platforms/windows/qwindowsclipboard.h b/src/plugins/platforms/windows/qwindowsclipboard.h index 3fe0c74e78..992d34d492 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.h +++ b/src/plugins/platforms/windows/qwindowsclipboard.h @@ -73,6 +73,8 @@ public: static QWindowsClipboard *instance() { return m_instance; } + HWND clipboardViewer() const { return m_clipboardViewer; } + private: void clear(); void releaseIData(); diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 004b03d9a9..f49ad0e767 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -41,6 +41,7 @@ #include "qwindowsintegration.h" #include "qwindowswindow.h" #include "qwindowscontext.h" +#include "qwin10helpers.h" #include "qwindowsopenglcontext.h" #include "qwindowsscreen.h" @@ -509,6 +510,12 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: return QVariant(keyBoardAutoRepeatRateMS()); +#endif + case QPlatformIntegration::ShowIsMaximized: +#ifndef QT_NO_CLIPBOARD + return qt_windowsIsTabletMode(d->m_clipboard.clipboardViewer()); +#else + break; #endif case QPlatformIntegration::StartDragTime: case QPlatformIntegration::StartDragDistance: diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index d97e49309f..20e0b81da9 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -25,7 +25,8 @@ SOURCES += \ $$PWD/qwindowsdialoghelpers.cpp \ $$PWD/qwindowsservices.cpp \ $$PWD/qwindowsnativeinterface.cpp \ - $$PWD/qwindowsopengltester.cpp + $$PWD/qwindowsopengltester.cpp \ + $$PWD/qwin10helpers.cpp HEADERS += \ $$PWD/qwindowswindow.h \ @@ -46,6 +47,7 @@ HEADERS += \ $$PWD/qwindowsnativeinterface.h \ $$PWD/qwindowsopengltester.h \ $$PWD/qwindowsthreadpoolrunner.h + $$PWD/qwin10helpers.h INCLUDEPATH += $$PWD -- cgit v1.2.3 From cff48c7845ccf51ac53a550a43dec78428124f70 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 21 Nov 2016 12:46:46 +0100 Subject: eglfs: Avoid unexpectedly flushing QPA input events Flushing all events to ensure that the expose (or other queued events) get processed right away is dangerous. Instead, pass ExcludeUserInputEvents like many other platform plugins do. This way queued input events do not get processed at an unexpected point in time and so do not interfere with modal dialogs for instance. Task-number: QTBUG-57229 Change-Id: I9da09e62627d26485fb5a37fc190cb4a4bcb28b6 Reviewed-by: Andy Nichols --- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 2 +- src/plugins/platforms/eglfs/qeglfswindow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index bb62506f33..2a6f3aa7cf 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -176,7 +176,7 @@ QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *wi QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const { - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); QEglFSWindow *w = qt_egl_device_integration()->createWindow(window); w->create(); if (window->type() != Qt::ToolTip) diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index 84856831c3..3cc7079fbb 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -208,7 +208,7 @@ void QEglFSWindow::setVisible(bool visible) QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); if (visible) - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); } void QEglFSWindow::setGeometry(const QRect &r) -- cgit v1.2.3 From 53edaf0fb7146e20029afcdbb57003025db8b7bf Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Tue, 22 Nov 2016 15:27:44 +0100 Subject: Document QMAKE_OBJECTIVE_CFLAGS Task-number: QTBUG-57264 Change-Id: Iae06d9428d320a99cfd070154ed7bc94ec450b91 Reviewed-by: Oswald Buddenhagen --- qmake/doc/src/qmake-manual.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index ccb79f4a9f..fe67568c51 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2057,6 +2057,12 @@ value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + \section1 QMAKE_OBJECTIVE_CFLAGS + + Specifies the Objective C/C++ compiler flags for building + a project. These flags are used in addition to QMAKE_CFLAGS and + QMAKE_CXXFLAGS. + \section1 QMAKE_POST_LINK Specifies the command to execute after linking the \l{TARGET} -- cgit v1.2.3 From e2b856d56290e9b3eaaf889b3e0a08badbaa6046 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 17 Nov 2016 16:10:11 +0100 Subject: QDir::tempPath - use NSTemporaryDirectory on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of hardcoded "/tmp". Task-number: QTBUG-57165 Change-Id: I9d3ae157c22ce131281b8279149eea87a26244e8 Reviewed-by: Morten Johan Sørvig --- src/corelib/io/qfilesystemengine_unix.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 3cc27bf847..a3b28a8d95 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -59,6 +59,13 @@ #include #endif +#if defined(Q_OS_DARWIN) +// We cannot include (it's an Objective-C header), but +// we need these declarations: +Q_FORWARD_DECLARE_OBJC_CLASS(NSString); +extern "C" NSString *NSTemporaryDirectory(); +#endif + QT_BEGIN_NAMESPACE #if defined(Q_OS_DARWIN) @@ -706,8 +713,17 @@ QString QFileSystemEngine::tempPath() return QDir::cleanPath(temp); #else QString temp = QFile::decodeName(qgetenv("TMPDIR")); - if (temp.isEmpty()) - temp = QLatin1String("/tmp"); + if (temp.isEmpty()) { +#if defined(Q_OS_DARWIN) && !defined(QT_BOOTSTRAPPED) + if (NSString *nsPath = NSTemporaryDirectory()) { + temp = QString::fromCFString((CFStringRef)nsPath); + } else { +#else + { +#endif + temp = QLatin1String("/tmp"); + } + } return QDir::cleanPath(temp); #endif } -- cgit v1.2.3 From b5222307af591c5360a64ffa311bde4a61af97d6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 19 Oct 2016 16:37:53 +0200 Subject: Fix some qdoc-warnings qtbase/src/corelib/kernel/qdeadlinetimer.cpp:343: warning: Cannot find 'setPreciseRemainingTime(...)' in '\fn' void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, unsigned nsecs, Qt::TimerType type) qtbase/src/corelib/kernel/qdeadlinetimer.cpp:459: warning: Overrides a previous doc qtbase/src/corelib/kernel/qelapsedtimer.cpp:86: warning: Unknown command '\ref' qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_2_2' in QSysInfo::MacVersion qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_3_0' in QSysInfo::MacVersion qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS' in QSysInfo::MacVersion qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_2_1' in QSysInfo::MacVersion qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_2_0' in QSysInfo::MacVersion qtbase/src/corelib/kernel/qdeadlinetimer.cpp:175: warning: Missing parameter name qtbase/src/corelib/kernel/qdeadlinetimer.cpp:175: warning: No such parameter 'ForeverConstant' in QDeadlineTimer::QDeadlineTimer() qtbase/src/corelib/kernel/qdeadlinetimer.h:156: warning: No documentation for 'QDeadlineTimer::remainingTimeAsDuration()' qtbase/src/gui/painting/qcolor.cpp:796: warning: Undocumented parameter 'name' in QColor::QColor() qtbase/src/gui/painting/qcolor.cpp:802: warning: Undocumented parameter 'name' in QColor::QColor() Some errors in QDeadlineTimer remain due to qdoc not fully supporting templates. Change-Id: Ie7afd91c48048748eeda23c32056583c31fd7490 Reviewed-by: Nico Vertriest Reviewed-by: Jake Petroules --- src/corelib/global/qglobal.cpp | 6 ++++++ src/corelib/kernel/qdeadlinetimer.cpp | 25 ++++--------------------- src/corelib/kernel/qelapsedtimer.cpp | 2 +- src/gui/painting/qcolor.cpp | 8 ++++++++ 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index d06acb83b2..6efdc4c22c 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1244,6 +1244,12 @@ bool qSharedBuild() Q_DECL_NOTHROW \value MV_TVOS_9_2 tvOS 9.2 \value MV_TVOS_10_0 tvOS 10.0 + \value MV_WATCHOS watchOS (any) + \value MV_WATCHOS_2_0 watchOS 2.0 + \value MV_WATCHOS_2_1 watchOS 2.1 + \value MV_WATCHOS_2_2 watchOS 2.2 + \value MV_WATCHOS_3_0 watchOS 3.0 + \value MV_None Not a Darwin operating system \sa WinVersion diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp index 17a74b22d7..d670637d53 100644 --- a/src/corelib/kernel/qdeadlinetimer.cpp +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -173,9 +173,9 @@ Q_DECL_CONST_FUNCTION static inline QPair toSecsAndNSecs(qint64 */ /*! - \fn QDeadlineTimer::QDeadlineTimer(ForeverConstant, Qt::TimerType timerType) + \fn QDeadlineTimer::QDeadlineTimer(ForeverConstant foreverConstant, Qt::TimerType timerType) - QDeadlineTimer objects created with parameter \a ForeverConstant never expire. + QDeadlineTimer objects created with parameter \a foreverConstant never expire. For such objects, remainingTime() will return -1, deadline() will return the maximum value, and isForever() will return true. @@ -295,7 +295,7 @@ void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_D parameters are zero, this QDeadlineTimer will be marked as expired. The timer type for this QDeadlineTimer object will be set to the specified - \a type. + \a timerType. \sa setRemainingTime(), hasExpired(), isForever(), remainingTime() */ @@ -341,24 +341,7 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time */ /*! - \fn void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, unsigned nsecs, Qt::TimerType type) - - Sets the remaining time for this QDeadlineTimer object to \a secs seconds - and \a nsecs nanoseconds from now, if \a secs is a positive value. If both - values are zero, this QDeadlineTimer object will be marked as expired, - whereas if \a secs is -1, it will set it to never expire. - - If value of \a nsecs is more than 1 billion nanoseconds (1 second), this - function will adjust \a secs accordingly. - - The timer type for this QDeadlineTimer object will be set to the specified \a type. - - \sa setRemainingTime(), hasExpired(), isForever(), remainingTime() -*/ - -/*! - \overload - \fn Duration QDeadlineTimer::remainingTime() const + \fn std::chrono::nanoseconds remainingTimeAsDuration() const Returns a \c{std::chrono::duration} object of type \c{Duration} containing the remaining time in this QDeadlineTimer, if it still has time left. If diff --git a/src/corelib/kernel/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp index 5e9d1317ac..e578b5b8b3 100644 --- a/src/corelib/kernel/qelapsedtimer.cpp +++ b/src/corelib/kernel/qelapsedtimer.cpp @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE \snippet qelapsedtimer/main.cpp 2 - It is often more convenient to use \ref{QDeadlineTimer} in this case, which + It is often more convenient to use \l{QDeadlineTimer} in this case, which counts towards a timeout in the future instead of tracking elapsed time. \section1 Reference Clocks diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index e3dbf663e1..6a8091bf8b 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -795,12 +795,20 @@ QColor::QColor(Spec spec) Q_DECL_NOTHROW /*! \fn QColor::QColor(const char *name) + + Constructs a named color in the same way as setNamedColor() using + the given \a name. + \overload \sa setNamedColor(), name(), isValid() */ /*! \fn QColor::QColor(QLatin1String name) + + Constructs a named color in the same way as setNamedColor() using + the given \a name. + \overload \since 5.8 \sa setNamedColor(), name(), isValid() -- cgit v1.2.3 From be94fc445a664fa10ce5ff5ea1e4fbe7d23585e7 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Sun, 13 Nov 2016 15:04:33 +0300 Subject: QString: optimize remove(QChar, Qt::CaseSensitivity) remove(int, int) with O(N) was used in a loop. We had a quadratic complexity. Use erase-remove idiom to fix it. Change-Id: I643a2a75619ec5ea2bf99e48a25f64a7f69ba156 Reviewed-by: Edward Welbourne Reviewed-by: Marc Mutz --- src/corelib/tools/qstring.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 8520bb5740..4262899e02 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -2300,21 +2300,20 @@ QString &QString::remove(const QString &str, Qt::CaseSensitivity cs) */ QString &QString::remove(QChar ch, Qt::CaseSensitivity cs) { - int i = 0; - ushort c = ch.unicode(); - if (cs == Qt::CaseSensitive) { - while (i < d->size) - if (d->data()[i] == ch) - remove(i, 1); - else - i++; - } else { - c = foldCase(c); - while (i < d->size) - if (foldCase(d->data()[i]) == c) - remove(i, 1); - else - i++; + const int idx = indexOf(ch, 0, cs); + if (idx != -1) { + const auto first = begin(); // implicit detach() + auto last = end(); + if (cs == Qt::CaseSensitive) { + last = std::remove(first + idx, last, ch); + } else { + const QChar c = ch.toCaseFolded(); + auto caseInsensEqual = [c](QChar x) { + return c == x.toCaseFolded(); + }; + last = std::remove_if(first + idx, last, caseInsensEqual); + } + resize(last - first); } return *this; } -- cgit v1.2.3 From d8857f21ac2640215177b9cb7bb681b74bc66068 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 22 Nov 2016 09:46:14 +0100 Subject: If there are no available sizes, then fallback to the requested size In a case like the SVG iconengine there is no available sizes implementation. However in that case we don't need to provide different sizes as we can have SVG scale it for us to the one requested. So it is assumed that with no available sizes implementation that the icon engine will take care of this for us. This ensures that SVG files can be used as icons inside the menu on macOS. Task-number: QTBUG-40225 Task-number: QTBUG-55932 Change-Id: If01ca582c4c07834e6de16652924e0b7e118c87c Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoahelpers.h | 2 +- src/plugins/platforms/cocoa/qcocoahelpers.mm | 7 +++++-- src/plugins/platforms/cocoa/qcocoamenuitem.mm | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index c2abe4e245..bbb37937d2 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -64,7 +64,7 @@ inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qst NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); NSImage *qt_mac_create_nsimage(const QPixmap &pm); -NSImage *qt_mac_create_nsimage(const QIcon &icon); +NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0); CGImageRef qt_mac_toCGImage(const QImage &qImage); CGImageRef qt_mac_toCGImageMask(const QImage &qImage); QImage qt_mac_toQImage(CGImageRef image); diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 058209da7e..cd73148752 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -152,13 +152,16 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm) return nsImage; } -NSImage *qt_mac_create_nsimage(const QIcon &icon) +NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize) { if (icon.isNull()) return nil; NSImage *nsImage = [[NSImage alloc] init]; - foreach (QSize size, icon.availableSizes()) { + QList availableSizes = icon.availableSizes(); + if (availableSizes.isEmpty() && defaultSize > 0) + availableSizes << QSize(defaultSize, defaultSize); + foreach (QSize size, availableSizes) { QPixmap pm = icon.pixmap(size); QImage image = pm.toImage(); CGImageRef cgImage = qt_mac_toCGImage(image); diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 2d4073956a..fa8eb22569 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -348,7 +348,7 @@ NSMenuItem *QCocoaMenuItem::sync() NSImage *img = nil; if (!m_icon.isNull()) { - img = qt_mac_create_nsimage(m_icon); + img = qt_mac_create_nsimage(m_icon, m_iconSize); [img setSize:NSMakeSize(m_iconSize, m_iconSize)]; } [m_native setImage:img]; -- cgit v1.2.3 From a32424b46cd3ef6fd8d644354e3cec434d5ab951 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 15 Nov 2016 17:15:56 +0100 Subject: AreArgumentsNarrowedBase: Correct logic for narrowing connect() casts The prior test deemed there to be narrowing if source and destination integral-or-enum types didn't have the same signedness; but all values of an unsigned source type can be represented in a larger signed destination type, so there is no narrowing in this case. Updated QObject test-case to match. Change-Id: I517a5997adcad70e185d7469a8d26788e463cb75 Reviewed-by: Giuseppe D'Angelo --- src/corelib/kernel/qobjectdefs_impl.h | 10 ++++-- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 40 +++++++++++------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index e94e713e1f..79c9c8303e 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -229,8 +229,14 @@ namespace QtPrivate { (std::is_floating_point::value && std::is_integral::value) || (std::is_floating_point::value && std::is_floating_point::value && sizeof(From) > sizeof(To)) || ((std::is_integral::value || std::is_enum::value) && std::is_floating_point::value) || - (std::is_integral::value && std::is_integral::value && (sizeof(From) > sizeof(To) || std::is_signed::value != std::is_signed::value)) || - (std::is_enum::value && std::is_integral::value && (sizeof(From) > sizeof(To) || IsEnumUnderlyingTypeSigned::value != std::is_signed::value)) + (std::is_integral::value && std::is_integral::value + && (sizeof(From) > sizeof(To) + || (std::is_signed::value ? !std::is_signed::value + : (std::is_signed::value && sizeof(From) == sizeof(To))))) || + (std::is_enum::value && std::is_integral::value + && (sizeof(From) > sizeof(To) + || (IsEnumUnderlyingTypeSigned::value ? !std::is_signed::value + : (std::is_signed::value && sizeof(From) == sizeof(To))))) > { }; diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 0f7f75fb2e..91810cdcd8 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -6969,10 +6969,10 @@ void tst_QObject::checkArgumentsForNarrowing() QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); @@ -6980,23 +6980,23 @@ void tst_QObject::checkArgumentsForNarrowing() QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(int) >= sizeof(long)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(long) >= sizeof(long long)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); @@ -7206,28 +7206,28 @@ void tst_QObject::checkArgumentsForNarrowing() QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(ScopedEnumBackedByUInt) >= sizeof(long)); + QVERIFY((!QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); - QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); + QCOMPARE((QtPrivate::AreArgumentsNarrowedBase::value), sizeof(ScopedEnumBackedByULong) >= sizeof(long long)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); QVERIFY((QtPrivate::AreArgumentsNarrowedBase::value)); -- cgit v1.2.3 From 20017d0b1bde34190d96bebe34b4e641efdde779 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 21 Nov 2016 14:56:09 +0100 Subject: Remove some #if 0 blocks from API headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Noticed in API review for 5.8 release. Change-Id: I1dd48c676924048c32fab8307868cf61915df131 Reviewed-by: Jędrzej Nowacki --- src/widgets/kernel/qwidget.h | 10 ---------- src/widgets/widgets/qpushbutton.h | 3 --- 2 files changed, 13 deletions(-) diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 5edf2c62da..58413c6bd3 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -570,16 +570,6 @@ public: inline QWidget *childAt(int x, int y) const; QWidget *childAt(const QPoint &p) const; -#if 0 // Used to be included in Qt4 for Q_WS_X11 - const QX11Info &x11Info() const; - Qt::HANDLE x11PictureHandle() const; -#endif - -#if 0 // Used to be included in Qt4 for Q_WS_MAC - Qt::HANDLE macQDHandle() const; - Qt::HANDLE macCGHandle() const; -#endif - void setAttribute(Qt::WidgetAttribute, bool on = true); inline bool testAttribute(Qt::WidgetAttribute) const; diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h index 859ac247fb..b0d1ccacdb 100644 --- a/src/widgets/widgets/qpushbutton.h +++ b/src/widgets/widgets/qpushbutton.h @@ -87,9 +87,6 @@ public Q_SLOTS: protected: bool event(QEvent *e) Q_DECL_OVERRIDE; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - bool hitButton(const QPoint &pos) const; -#endif void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE; -- cgit v1.2.3 From e9fa435652ef064515bd5c04c0b5e5c4a30ebca4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 4 Nov 2016 13:46:36 +0100 Subject: winrt: Add support for Windows Information Protection Windows Information Protection is used for splitting corporate and personal data, requiring connections to be established in a different way instantiating ThreadNetworkContext. Usage is enabled via the QT_WINRT_USE_THREAD_NETWORK_CONTEXT environment variable. Change-Id: I3aaa097b66fc616d42cd05a1e20bbcb004f6e467 Reviewed-by: James Tong Reviewed-by: Oliver Wolff --- src/network/socket/qabstractsocket.cpp | 13 +++-- src/network/socket/qnativesocketengine_winrt.cpp | 68 +++++++++++++++++++++++- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 02bba2d293..57c40194a3 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1113,10 +1113,15 @@ void QAbstractSocketPrivate::_q_connectToNextAddress() // Tries to connect to the address. If it succeeds immediately // (localhost address on BSD or any UDP connect), emit // connected() and return. - if (socketEngine->connectToHost(host, port)) { - //_q_testConnection(); - fetchConnectionParameters(); - return; + if ( +#if defined(Q_OS_WINRT) && _MSC_VER >= 1900 + !qEnvironmentVariableIsEmpty("QT_WINRT_USE_THREAD_NETWORK_CONTEXT") ? + socketEngine->connectToHostByName(hostName, port) : +#endif + socketEngine->connectToHost(host, port)) { + //_q_testConnection(); + fetchConnectionParameters(); + return; } // Check that we're in delayed connection state. If not, try diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 3daca38959..d0b8bff7f9 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -75,6 +75,9 @@ using namespace ABI::Windows::Storage::Streams; using namespace ABI::Windows::Networking; using namespace ABI::Windows::Networking::Connectivity; using namespace ABI::Windows::Networking::Sockets; +#if _MSC_VER >= 1900 +using namespace ABI::Windows::Security::EnterpriseData; +#endif typedef ITypedEventHandler ClientConnectedHandler; typedef ITypedEventHandler DatagramReceivedHandler; @@ -84,6 +87,45 @@ typedef IAsyncOperationWithProgress IAsyncBufferOperation; QT_BEGIN_NAMESPACE +#if _MSC_VER >= 1900 +static HRESULT qt_winrt_try_create_thread_network_context(QString host, ComPtr &context) +{ + HRESULT hr; + ComPtr protectionPolicyManager; + + hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Security_EnterpriseData_ProtectionPolicyManager).Get(), + &protectionPolicyManager); + RETURN_HR_IF_FAILED("Could not access ProtectionPolicyManager statics."); + + ComPtr hostNameFactory; + hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), + &hostNameFactory); + RETURN_HR_IF_FAILED("Could not access HostName factory."); + + ComPtr hostName; + HStringReference hostRef(reinterpret_cast(host.utf16()), host.length()); + hr = hostNameFactory->CreateHostName(hostRef.Get(), &hostName); + RETURN_HR_IF_FAILED("Could not create hostname."); + + ComPtr> op; + hr = protectionPolicyManager->GetPrimaryManagedIdentityForNetworkEndpointAsync(hostName.Get(), &op); + RETURN_HR_IF_FAILED("Could not get identity operation."); + + HSTRING hIdentity; + hr = QWinRTFunctions::await(op, &hIdentity); + RETURN_HR_IF_FAILED("Could not wait for identity operation."); + + // Implies there is no need for a network context for this address + if (hIdentity == nullptr) + return S_OK; + + hr = protectionPolicyManager->CreateCurrentThreadNetworkContext(hIdentity, &context); + RETURN_HR_IF_FAILED("Could not create thread network context"); + + return S_OK; +} +#endif // _MSC_VER >= 1900 + static inline QString qt_QStringFromHString(const HString &string) { UINT32 length; @@ -367,9 +409,23 @@ bool QNativeSocketEngine::connectToHost(const QHostAddress &address, quint16 por bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port) { Q_D(QNativeSocketEngine); + HRESULT hr; + +#if _MSC_VER >= 1900 + ComPtr networkContext; + if (!qEnvironmentVariableIsEmpty("QT_WINRT_USE_THREAD_NETWORK_CONTEXT")) { + hr = qt_winrt_try_create_thread_network_context(name, networkContext); + if (FAILED(hr)) { + setError(QAbstractSocket::ConnectionRefusedError, QLatin1String("Could not create thread network context.")); + d->socketState = QAbstractSocket::ConnectedState; + return true; + } + } +#endif // _MSC_VER >= 1900 + HStringReference hostNameRef(reinterpret_cast(name.utf16())); ComPtr hostNameFactory; - HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), + hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), &hostNameFactory); Q_ASSERT_SUCCEEDED(hr); ComPtr remoteHost; @@ -390,6 +446,16 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port) } Q_ASSERT_SUCCEEDED(hr); +#if _MSC_VER >= 1900 + if (networkContext != nullptr) { + ComPtr networkContextCloser; + hr = networkContext.As(&networkContextCloser); + Q_ASSERT_SUCCEEDED(hr); + hr = networkContextCloser->Close(); + Q_ASSERT_SUCCEEDED(hr); + } +#endif // _MSC_VER >= 1900 + d->socketState = QAbstractSocket::ConnectingState; QEventDispatcherWinRT::runOnXamlThread([d, &hr]() { hr = d->connectOp->put_Completed(Callback( -- cgit v1.2.3 From d20a99c081491f020836904eaa1c9323b9b56921 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 17 Nov 2016 16:19:32 +0100 Subject: winrt: Add printsupport For WinRT QPrinter and co are disabled in the new configure system. Still, we need to have printsupport enabled as a module, providing no printer. Task-number: QTBUG-56321 Change-Id: I95ce538e8f54073832af551ccf7f981e877a3b25 Reviewed-by: Oliver Wolff --- src/printsupport/kernel/kernel.pri | 2 +- src/src.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index 22d12e4cc3..90eab4a634 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -30,7 +30,7 @@ win32 { $$PWD/qprintengine_win_p.h SOURCES += \ $$PWD/qprintengine_win.cpp - LIBS_PRIVATE += -lwinspool -lcomdlg32 -lgdi32 -luser32 + !winrt: LIBS_PRIVATE += -lwinspool -lcomdlg32 -lgdi32 -luser32 } unix:!darwin:qtConfig(cups) { diff --git a/src/src.pro b/src/src.pro index f19b0bd354..54f3b6e020 100644 --- a/src/src.pro +++ b/src/src.pro @@ -186,7 +186,7 @@ qtConfig(gui) { SUBDIRS += src_opengl src_plugins.depends += src_opengl } - !wince:!winrt { + !wince { SUBDIRS += src_printsupport src_plugins.depends += src_printsupport } -- cgit v1.2.3 From 2c8c6dd9a478f0f2e2b811a9d3e68891ee1bef0b Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 17 Nov 2016 16:32:04 +0100 Subject: Fix compilation without QPrinter support Task-number: QTBUG-56321 Change-Id: Ic77d01431ee58d609eca895d1f2d216042406bc9 Reviewed-by: Oliver Wolff --- examples/widgets/graphicsview/chip/view.cpp | 2 -- examples/widgets/painting/fontsampler/mainwindow.cpp | 4 ---- examples/widgets/painting/fontsampler/mainwindow.h | 2 ++ 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index 7a26227628..62aa25b575 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -50,10 +50,8 @@ #include "view.h" -#ifndef QT_NO_PRINTER #include #include -#endif #ifndef QT_NO_OPENGL #include #else diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp index 33d560edf3..06ffac3728 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.cpp +++ b/examples/widgets/painting/fontsampler/mainwindow.cpp @@ -49,11 +49,7 @@ ****************************************************************************/ #include -#ifndef QT_NO_PRINTER -#include -#include #include -#endif #include "mainwindow.h" diff --git a/examples/widgets/painting/fontsampler/mainwindow.h b/examples/widgets/painting/fontsampler/mainwindow.h index f39e1b1916..ada0d47354 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.h +++ b/examples/widgets/painting/fontsampler/mainwindow.h @@ -52,6 +52,8 @@ #define MAINWINDOW_H #include "ui_mainwindowbase.h" +#include +#include QT_BEGIN_NAMESPACE class QPrinter; -- cgit v1.2.3 From fca4acbfba12121bffb3d49aa2198a55e4a762cf Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 18 Nov 2016 12:10:38 +0100 Subject: Remove wince checks Windows CE is not supported since 5.6. No need to have checks anymore. Change-Id: I384bd67e04dec06e83ee69b4ef5dc7dd97888c14 Reviewed-by: Oliver Wolff Reviewed-by: Oswald Buddenhagen --- src/src.pro | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/src.pro b/src/src.pro index 54f3b6e020..b13bc4fa43 100644 --- a/src/src.pro +++ b/src/src.pro @@ -178,18 +178,14 @@ qtConfig(gui) { src_plugins.depends += src_gui src_platformsupport src_platformheaders src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers qtConfig(widgets) { - SUBDIRS += src_tools_uic src_widgets + SUBDIRS += src_tools_uic src_widgets src_printsupport TOOLS += src_tools_uic - src_plugins.depends += src_widgets + src_plugins.depends += src_widgets src_printsupport src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers qtConfig(opengl) { SUBDIRS += src_opengl src_plugins.depends += src_opengl } - !wince { - SUBDIRS += src_printsupport - src_plugins.depends += src_printsupport - } } } SUBDIRS += src_plugins -- cgit v1.2.3 From 6542712dfafc4a64d505522ed23b02ae626ad38f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 17 Nov 2016 16:52:31 +0100 Subject: Extend documentation for SHA-3 third-party license MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Write down which files are under CC0, and which under BSD. Change-Id: Ifdbfa3393b2a0f0d857e6c569bd105426c0719cb Reviewed-by: Topi Reiniö --- src/3rdparty/sha3/qt_attribution.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/3rdparty/sha3/qt_attribution.json b/src/3rdparty/sha3/qt_attribution.json index 13e6e971d9..4866be32ea 100644 --- a/src/3rdparty/sha3/qt_attribution.json +++ b/src/3rdparty/sha3/qt_attribution.json @@ -4,6 +4,7 @@ "Name": "Secure Hash Algorithm SHA-3 - brg_endian", "QDocModule": "qtcore", "QtUsage": "Used in Qt Core (QCryptographicHash).", + "Files": "brg_endian.h", "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.", "License": "BSD 3-clause \"New\" or \"Revised\" License", @@ -16,6 +17,7 @@ "Name": "Secure Hash Algorithm SHA-3 - Keccak", "QDocModule": "qtcore", "QtUsage": "Used in Qt Core (QCryptographicHash).", + "Files": "KeccakF-1600-32-rvk.macros KeccakF-1600-32.macros KeccakF-1600-64.macros KeccakF-1600-interface.h KeccakF-1600-opt32.c KeccakF-1600-opt64.c KeccakF-1600-unrolling.macros KeccakNISTInterface.c KeccakNISTInterface.h KeccakSponge.c KeccakSponge.h", "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.", "License": "Creative Commons Zero v1.0 Universal", -- cgit v1.2.3 From ae93a76c931d7de768d5ac600a092bdc87915d3e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 19 Oct 2016 16:33:27 +0200 Subject: Document The Public Suffix List MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3c8b00e04ed30209b0de0927b473ba2b9a4f0c87 Reviewed-by: Thiago Macieira Reviewed-by: Topi Reiniö --- src/corelib/io/PSL-LICENSE.txt | 373 +++++++++++++++++++++++++++++++++++++ src/corelib/io/qt_attribution.json | 29 +++ src/corelib/io/qurltlds_p.h.INFO | 3 - 3 files changed, 402 insertions(+), 3 deletions(-) create mode 100644 src/corelib/io/PSL-LICENSE.txt diff --git a/src/corelib/io/PSL-LICENSE.txt b/src/corelib/io/PSL-LICENSE.txt new file mode 100644 index 0000000000..d0a1fa1482 --- /dev/null +++ b/src/corelib/io/PSL-LICENSE.txt @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/src/corelib/io/qt_attribution.json b/src/corelib/io/qt_attribution.json index 2a616a2819..c64f8cae4b 100644 --- a/src/corelib/io/qt_attribution.json +++ b/src/corelib/io/qt_attribution.json @@ -1,3 +1,4 @@ +[ { "Id": "qtemporaryfile", "Name": "Parts of QTemporaryFile", @@ -10,4 +11,32 @@ "LicenseId": "BSD-3-Clause", "LicenseFile": "QTEMPORARYFILE_LICENSE.txt", "Copyright": "Copyright (c) 1987, 1993 The Regents of the University of California." +}, +{ + "Id": "psl", + "Name": "The Public Suffix List", + "QDocModule": "qtcore", + "Description": "The Public Suffix List is an initiative of the Mozilla Project, +but is maintained as a community resource. It is available for use in any software, +but was originally created to meet the needs of browser manufacturers. +It allows browsers to, for example: + +- Avoid privacy-damaging \"supercookies\" being set for high-level domain name suffixes + +- Highlight the most important part of a domain name in the user interface + +- Accurately sort history entries by site", + + "Files": "qurltlds_p.h", + "QtUsage": "Used in Qt Core to avoid \"supercookies\" being set in the cookie jar +supported by Qt (by the QNetworkCookieJar class).", + + "Homepage": "http://publicsuffix.org/", + "Version": "Generated on 2016-10-20 from revision 915565885d0fbd25caf7d8b339cd3478f558da94", + "License": "Mozilla Public License 2.0", + "LicenseFile": "PSL-LICENSE.txt", + "LicenseId": "MPL-2.0", + "Copyright": "The list was originally provided by Jo Hermans . +It is now maintained on github (https://github.com/publicsuffix/list)." } +] diff --git a/src/corelib/io/qurltlds_p.h.INFO b/src/corelib/io/qurltlds_p.h.INFO index 3f3d808a21..33ccd458bf 100644 --- a/src/corelib/io/qurltlds_p.h.INFO +++ b/src/corelib/io/qurltlds_p.h.INFO @@ -9,9 +9,6 @@ Those arrays in qurltlds_p.h are derived from the Public Suffix List ([2]), which was originally provided by Jo Hermans . -The file qurltlds_p.h was last generated Thursday, -October 20th 8:40 2016. - ---- [1] list: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 [2] homepage: http://publicsuffix.org/ -- cgit v1.2.3 From b6f4003b87c92061cc5ef22f40f844ae16bf09bb Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 17 Nov 2016 15:48:17 +0100 Subject: Fix forkfd 3rd party documenation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bring the copyright lines in the license and the one's in the metadata into line by using the ones from forkfd.c. Also bring back description of forkfd from 5.6 documentation. Change-Id: I423ee8d5d1e1c866a34c346f78520d33ea099b5e Reviewed-by: Topi Reiniö --- src/3rdparty/forkfd/LICENSE | 1 + src/3rdparty/forkfd/qt_attribution.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/forkfd/LICENSE b/src/3rdparty/forkfd/LICENSE index 351ebf705d..36ab612951 100644 --- a/src/3rdparty/forkfd/LICENSE +++ b/src/3rdparty/forkfd/LICENSE @@ -1,4 +1,5 @@ Copyright (C) 2016 Intel Corporation. +Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/3rdparty/forkfd/qt_attribution.json b/src/3rdparty/forkfd/qt_attribution.json index 89f25f4870..f004116753 100644 --- a/src/3rdparty/forkfd/qt_attribution.json +++ b/src/3rdparty/forkfd/qt_attribution.json @@ -7,6 +7,6 @@ "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "LICENSE", - "Copyright": "Copyright (C) 2013-2016 Intel Corporation + "Copyright": "Copyright (C) 2016 Intel Corporation Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com" } -- cgit v1.2.3 From b200bc662ee0e593306a2a96a89b57d0e340d2c3 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 17 Nov 2016 15:58:44 +0100 Subject: Improve documentation for 3rdparty freebsd code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iad5c659c2c422bf20e7ba6161889c7b261512e9e Reviewed-by: Topi Reiniö --- src/3rdparty/freebsd/qt_attribution.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/freebsd/qt_attribution.json b/src/3rdparty/freebsd/qt_attribution.json index 40c337cc67..57f425cdbc 100644 --- a/src/3rdparty/freebsd/qt_attribution.json +++ b/src/3rdparty/freebsd/qt_attribution.json @@ -4,14 +4,10 @@ "QDocModule": "qtcore", "QtUsage": "Used in Qt Core.", + "Description": "strtoll() and strtoull() are functions for converting a string to (unsigned) long long integer.", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENSE", - "Copyright": "Copyright (c) 1992, 1993 - The Regents of the University of California. All rights reserved. - -Copyright (c) 2011 The FreeBSD Foundation -All rights reserved. -Portions of this software were developed by David Chisnall -under sponsorship from the FreeBSD Foundation." + "Copyright": "Copyright (c) 1992, 1993 The Regents of the University of California. +Copyright (c) 2011 The FreeBSD Foundation" } -- cgit v1.2.3 From 7611028879c81e5072ed96301d7f392a74d7e42c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 22 Nov 2016 15:39:28 +0100 Subject: List ANGLE contributions after another MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Place ANGLE at the start of the title, so that the different entries are sorted correctly. Change-Id: I11e9d25874f06450a3d9049b5f5c94aa53621e08 Reviewed-by: Topi Reiniö --- src/3rdparty/angle/qt_attribution.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/angle/qt_attribution.json b/src/3rdparty/angle/qt_attribution.json index 230f30940b..e35e1f0eb9 100644 --- a/src/3rdparty/angle/qt_attribution.json +++ b/src/3rdparty/angle/qt_attribution.json @@ -12,7 +12,7 @@ }, { "Id": "angle-arrayboundsclamper", - "Name": "ANGLE Array Bounds Clamper for WebKit", + "Name": "ANGLE: Array Bounds Clamper for WebKit", "QDocModule": "qtgui", "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", @@ -25,7 +25,7 @@ }, { "Id": "angle-murmurhash", - "Name": "Murmurhash (as part of ANGLE)", + "Name": "ANGLE: Murmurhash", "QDocModule": "qtgui", "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", @@ -36,7 +36,7 @@ }, { "Id": "angle-systeminfo", - "Name": "Systeminfo (as part of ANGLE)", + "Name": "ANGLE: Systeminfo", "QDocModule": "qtgui", "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", @@ -48,7 +48,7 @@ }, { "Id": "angle-trace_event", - "Name": "trace_event (as part of ANGLE)", + "Name": "ANGLE: trace_event", "QDocModule": "qtgui", "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.", -- cgit v1.2.3 From a5cf8d76c265913864298b78fadda61889a1babe Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 1 Nov 2016 15:28:12 +0100 Subject: Remove second mentioning of cycle.h 3rdparty license MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is now documented in the qt_attribution.json file added in commit 41a7d74385eece725435159ca021151e871bf116 . Change-Id: I4f13397a14de7d9f98ba146cabf64dafac5dada4 Reviewed-by: Topi Reiniö --- src/testlib/doc/src/qttestlib-manual.qdoc | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index d775ae5b76..6bdf6c33c7 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -361,35 +361,6 @@ See \l {Chapter 5: Writing a Benchmark}{Writing a Benchmark} in the Qt Test Tutorial for more benchmarking examples. - - \section1 3rd Party Code - - The CPU tick counters used for benchmarking are licensed under the following - license: (from src/testlib/3rdparty/cycle.h) - - \legalese - Copyright (c) 2003, 2006 Matteo Frigo\br - Copyright (c) 2003, 2006 Massachusetts Institute of Technology - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - \endlegalese */ /*! -- cgit v1.2.3 From fedc09daa4d2db7435bb0e95641bb3c05fb04acf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 16 Nov 2016 15:15:51 +0100 Subject: don't mention config.log in error messages before it even exists Change-Id: I0d56aff4988e92f2e4ce63a6a7939fbb4ceab590 Reviewed-by: Lars Knoll Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_configure.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 289e2250bd..eaaa161270 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -22,7 +22,7 @@ defineTest(qtConfAddWarning) { defineTest(qtConfAddError) { QT_CONFIGURE_ERRORS += "ERROR: $$join(1, $$escape_expand(\\n))" export(QT_CONFIGURE_ERRORS) - equals(2, log) { + equals(2, log):qt_conf_tests_allowed { CONFIG += mention_config_log export(CONFIG) } -- cgit v1.2.3 From 591d9588f7e755c2b6eef22d572f5f51d7bc23d0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 21:05:53 +0100 Subject: fix use of $$QMAKE_QMAKE the variable is converted to a format suitable for makefiles only after the project was read. to access it, one needs to use the exported makefile variable $(QMAKE). amends 2b6bcd5ff. Change-Id: I5eddff4bebbbcf461b565d5033d17a8daff1e6f4 Reviewed-by: Lars Knoll Reviewed-by: Joerg Bornemann --- mkspecs/features/moc.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 59ed81b49e..bdb4eb49ec 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -32,7 +32,7 @@ if(gcc|intel_icl|msvc):!rim_qcc:!uikit { gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} else:msvc { - moc_predefs.commands += $$QMAKE_CXX -Bx$$QMAKE_QMAKE $$QMAKE_CXXFLAGS -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} + moc_predefs.commands += $$QMAKE_CXX -Bx$(QMAKE) $$QMAKE_CXXFLAGS -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} } else: error("Oops, I messed up") moc_predefs.output = $$MOC_DIR/moc_predefs.h moc_predefs.input = MOC_PREDEF_FILE -- cgit v1.2.3 From 6d2f7e9efe1f2e5156014dfa0af42a84d115d00c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 18:35:00 +0100 Subject: fix handling of -optimized-tools, take 2 amends dfbfc4915. Change-Id: I5516f322fceee0d71c2e09b4314f38207b4ac630 Reviewed-by: Lars Knoll Reviewed-by: Joerg Bornemann --- configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.json b/configure.json index 3480aed20f..f774291d22 100644 --- a/configure.json +++ b/configure.json @@ -515,7 +515,7 @@ }, "release_tools": { "label": "Compile tools in release mode", - "autoDetect": "!features.debug", + "autoDetect": "features.debug", "output": [ "privateFeature", "publicQtConfig" ] }, "simulator_and_device": { -- cgit v1.2.3 From 798b09ffe61b6b7f490b7d530f0e89501bbc89fd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 17 Nov 2016 19:24:49 +0100 Subject: configure: don't read QMAKESPEC from the environment it was rather unexpected that this was done, entirely inconsistently with how the rest of the configure parameters are handled. Task-number: QTBUG-52266 Change-Id: I6e1d7a4fe1c85d6d64d465517b6be3f3cdda3359 Reviewed-by: Lars Knoll --- configure | 2 +- tools/configure/configureapp.cpp | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 938831df09..612ed4bf53 100755 --- a/configure +++ b/configure @@ -479,7 +479,7 @@ XPLATFORM_TVOS=no # Whether target platform is tvOS XPLATFORM_WATCHOS=no # Whether target platform is watchOS XPLATFORM_ANDROID=no XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) -PLATFORM=$QMAKESPEC +PLATFORM= OPT_CONFIRM_LICENSE=no OPT_SHADOW=maybe OPT_VERBOSE=no diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 8716fa88f7..d9d247dbae 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -107,12 +107,9 @@ Configure::Configure(int& argc, char** argv) dictionary[ "QT_INSTALL_PREFIX" ] = installPath; - dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC"); if (dictionary[ "QMAKESPEC" ].size() == 0) { dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec(); dictionary[ "QMAKESPEC_FROM" ] = "detected"; - } else { - dictionary[ "QMAKESPEC_FROM" ] = "env"; } dictionary[ "SYNCQT" ] = "auto"; @@ -481,12 +478,9 @@ void Configure::parseCmdLine() dictionary[ "DONE" ] = "error"; if (dictionary ["QMAKESPEC_FROM"] == "commandline") { cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl; - } else if (dictionary ["QMAKESPEC_FROM"] == "env") { - cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"] - << "\" which is not a supported platform" << endl; } else { // was autodetected from environment cout << "Unable to detect the platform from environment. Use -platform command line" << endl - << "argument or set the QMAKESPEC environment variable and run configure again." << endl; + << "argument and run configure again." << endl; } cout << "See the README file for a list of supported operating systems and compilers." << endl; } else { -- cgit v1.2.3 From 4ce0beee1b69a8695fc24a244a8a3053711906ac Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 18:11:41 +0100 Subject: configure: delete some dead code and outdated comments Change-Id: I764a9b383176e1fe9573790547ce0e12d1f88261 Reviewed-by: Lars Knoll --- configure | 41 +++------------------------------------- qmake/Makefile.unix | 2 +- qmake/Makefile.win32 | 14 +------------- qmake/qmake.pro | 1 - tools/configure/configureapp.cpp | 17 ----------------- tools/configure/configureapp.h | 2 -- tools/configure/environment.cpp | 4 ---- tools/configure/environment.h | 1 - 8 files changed, 5 insertions(+), 77 deletions(-) diff --git a/configure b/configure index 612ed4bf53..5a5f564abb 100755 --- a/configure +++ b/configure @@ -399,7 +399,6 @@ HostVar() UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # detect the "echo without newline" style. usage: echo $ECHO_N "$ECHO_C" if echo '\c' | grep '\c' >/dev/null; then @@ -512,8 +511,6 @@ QT_HOST_LIBS= QT_HOST_DATA= QT_EXT_PREFIX= -# default qpa platform - # Android vars CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT @@ -529,7 +526,6 @@ CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST # parse the arguments, setting things to "yes" or "no" while [ "$#" -gt 0 ]; do CURRENT_OPT="$1" - UNKNOWN_ARG=no case "$1" in #Autoconf style options --enable-*) @@ -658,10 +654,6 @@ while [ "$#" -gt 0 ]; do extprefix) QT_EXT_PREFIX="$VAL" ;; - pkg-config) - ;; - force-pkg-config) - ;; docdir) QT_INSTALL_DOCS="$VAL" ;; @@ -1314,8 +1306,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." fi -# if the source tree is different from the build tree, -# symlink or copy part of the sources if [ "$OPT_SHADOW" = "yes" ]; then echo "Preparing build tree..." @@ -1628,35 +1618,21 @@ setBootstrapVariable() } # build qmake -if true; then ###[ '!' -f "$outpath/bin/qmake" ]; echo "Creating qmake..." - mkdir -p "$outpath/qmake" || exit - # fix makefiles - for mkfile in GNUmakefile Makefile; do - EXTRA_LFLAGS= - EXTRA_CFLAGS= - in_mkfile="${mkfile}.in" - if [ "$mkfile" = "Makefile" ]; then -# if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then -# (cd qmake && qmake) >/dev/null 2>&1 && continue -# fi - in_mkfile="${mkfile}.unix" - fi - in_mkfile="$relpath/qmake/$in_mkfile" - mkfile="$outpath/qmake/$mkfile" + + in_mkfile=$relpath/qmake/Makefile.unix + mkfile=$outpath/qmake/Makefile if [ -f "$mkfile" ]; then [ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile" rm -f "$mkfile" fi - [ -f "$in_mkfile" ] || continue echo "########################################################################" > "$mkfile" echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile" echo "########################################################################" >> "$mkfile" EXTRA_OBJS= EXTRA_SRCS= - EXTRA_CFLAGS="\$(QMAKE_CFLAGS) \$(QMAKE_CFLAGS_SPLIT_SECTIONS)" EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX11) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)" EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)" @@ -1667,8 +1643,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; [ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM= setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM" setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM" - setBootstrapVariable QMAKE_CFLAGS - setBootstrapVariable QMAKE_CFLAGS_SPLIT_SECTIONS setBootstrapVariable QMAKE_CXXFLAGS setBootstrapVariable QMAKE_CXXFLAGS_CXX11 setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS @@ -1676,20 +1650,15 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS if [ "$CFG_DEBUG" = "no" ] || [ "$CFG_RELEASE_TOOLS" = "yes" ]; then - setBootstrapVariable QMAKE_CFLAGS_RELEASE setBootstrapVariable QMAKE_CXXFLAGS_RELEASE - EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)" EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)" else - setBootstrapVariable QMAKE_CFLAGS_DEBUG setBootstrapVariable QMAKE_CXXFLAGS_DEBUG - EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)" EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)" fi case `basename "$PLATFORM"` in win32-g++*) - EXTRA_CFLAGS="$EXTRA_CFLAGS -DUNICODE" EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DUNICODE" EXTRA_OBJS="qfilesystemengine_win.o \ qfilesystemiterator_win.o \ @@ -1726,7 +1695,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile" EXTRA_LFLAGS="$EXTRA_LFLAGS \$(COCOA_LFLAGS)" EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)" - EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)" EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)" EXTRA_OBJS="$EXTRA_OBJS \ qsettings_mac.o \ @@ -1757,7 +1725,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; echo "QT_MAJOR_VERSION = $QT_MAJOR_VERSION" >> "$mkfile" echo "QT_MINOR_VERSION = $QT_MINOR_VERSION" >> "$mkfile" echo "QT_PATCH_VERSION = $QT_PATCH_VERSION" >> "$mkfile" - echo "EXTRA_CFLAGS = $EXTRA_CFLAGS" >> "$mkfile" echo "EXTRA_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile" echo "QTOBJS =" $EXTRA_OBJS >> "$mkfile" echo "QTSRCS =" $EXTRA_SRCS >> "$mkfile" @@ -1779,7 +1746,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; rm "$mkfile.tmp" fi fi - done if [ "$OPT_VERBOSE" = yes ]; then # Show the output of make @@ -1797,7 +1763,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; fi echo "Done." fi -fi # Build qmake #------------------------------------------------------------------------------- # create a qt.conf for the Qt build tree itself diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 320979150f..0ab2a1b3c6 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -96,7 +96,7 @@ DEPEND_SRC = \ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \ -I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 \ - -I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \ + -I$(QMKSRC)/generators/mac \ -I$(INC_PATH) -I$(INC_PATH)/QtCore \ -I$(INC_PATH)/QtCore/$(QT_VERSION) -I$(INC_PATH)/QtCore/$(QT_VERSION)/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 3e67632939..0a1f5529af 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -38,7 +38,7 @@ PCH_OBJECT = qmake_pch.obj CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -W3 -nologo -O1 \ $(CFLAGS_EXTRA) \ - -I$(QMKSRC) -I$(QMKSRC)\library -I$(QMKSRC)\generators -I$(QMKSRC)\generators\unix -I$(QMKSRC)\generators\win32 -I$(QMKSRC)\generators\mac -I$(QMKSRC)\generators\integrity \ + -I$(QMKSRC) -I$(QMKSRC)\library -I$(QMKSRC)\generators -I$(QMKSRC)\generators\unix -I$(QMKSRC)\generators\win32 -I$(QMKSRC)\generators\mac \ -I$(INC_PATH) -I$(INC_PATH)\QtCore -I$(INC_PATH)\QtCore\$(QT_VERSION) -I$(INC_PATH)\QtCore\$(QT_VERSION)\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ @@ -147,18 +147,9 @@ distclean:: clean -del $(BUILD_PATH)\bin\qmake.exe -del Makefile -.c.obj: - $(CXX) $(CFLAGS) $< - .cpp.obj: $(CXX) $(CXXFLAGS) $< -.cc.obj: - $(CXX) $(CXXFLAGS) $< - -.cxx.obj: - $(CXX) $(CXXFLAGS) $< - $(OBJS): $(PCH_OBJECT) $(QTOBJS): $(PCH_OBJECT) @@ -174,9 +165,6 @@ qmake_pch.obj: {$(SOURCE_PATH)\qmake\generators\mac}.cpp{}.obj:: $(CXX) $(CXXFLAGS) $< -{$(SOURCE_PATH)\qmake\generators\integrity}.cpp{}.obj:: - $(CXX) $(CXXFLAGS) $< - {$(SOURCE_PATH)\qmake\generators\unix}.cpp{}.obj:: $(CXX) $(CXXFLAGS) $< diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 74cefb07aa..1472aef3e4 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -27,7 +27,6 @@ INCLUDEPATH += . \ generators/unix \ generators/win32 \ generators/mac \ - generators/integrity \ ../tools/shared include(qmake.pri) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d9d247dbae..870bf3d368 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -173,12 +173,6 @@ QString Configure::formatPath(const QString &path) return ret; } -// #### somehow I get a compiler error about vc++ reaching the nesting limit without -// undefining the ansi for scoping. -#ifdef for -#undef for -#endif - void Configure::parseCmdLine() { sourcePathMangled = sourcePath; @@ -599,16 +593,6 @@ void Configure::generateQDevicePri() dictionary[ "DONE" ] = "error"; } -QString Configure::formatConfigPath(const char *var) -{ - QString val = dictionary[var]; - if (QFileInfo(val).isRelative()) { - QString pfx = dictionary["QT_INSTALL_PREFIX"]; - val = (val == ".") ? pfx : QDir(pfx).absoluteFilePath(val); - } - return QDir::toNativeSeparators(val); -} - void Configure::generateHeaders() { if (dictionary["SYNCQT"] == "auto") @@ -882,7 +866,6 @@ void Configure::buildQmake() << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; if (dictionary[ "QMAKESPEC" ].startsWith("win32-g++")) { stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\" << dictionary[ "QMAKESPEC" ] << endl - << "EXTRA_CFLAGS = -DUNICODE -ffunction-sections" << endl << "EXTRA_CXXFLAGS = -std=c++11 -DUNICODE -ffunction-sections" << endl << "EXTRA_LFLAGS = -Wl,--gc-sections" << endl << "QTOBJS = qfilesystemengine_win.o \\" << endl diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index b1c6ea9181..c8d4d3df53 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -88,8 +88,6 @@ private: void saveCmdLine(); void applySpecSpecifics(); - - QString formatConfigPath(const char *var); }; class FileWriter : public QTextStream diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 6cc350acc5..17f44c12f7 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -62,7 +62,6 @@ struct CompilerInfo{ const char *executable; } compiler_info[] = { // The compilers here are sorted in a reversed-preferred order - {CC_BORLAND, "Borland C++", 0, "bcc32.exe"}, {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"}, {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe {CC_MSVC2012, "Microsoft (R) Visual Studio 2012 C/C++ Compiler (11.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\11.0", "cl.exe"}, // link.exe, lib.exe @@ -109,9 +108,6 @@ QString Environment::detectQMakeSpec() case CC_MINGW: spec = "win32-g++"; break; - case CC_BORLAND: - spec = "win32-borland"; - break; default: break; } diff --git a/tools/configure/environment.h b/tools/configure/environment.h index d14961b5ac..2ab5b00d1c 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -33,7 +33,6 @@ QT_BEGIN_NAMESPACE enum Compiler { CC_UNKNOWN = 0, - CC_BORLAND = 0x01, CC_MINGW = 0x02, CC_INTEL = 0x03, CC_MSVC2005 = 0x80, -- cgit v1.2.3 From 9bdb5b5ffea50b2e8d3deb9fd370c2fb5805e076 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 16:27:15 +0100 Subject: configure: put more of the makefile contents into template files ... instead of having (duplicated) code in the configures to create it. Change-Id: Ia86b44021a024a969f5a49b7fb18d3d414869f93 Reviewed-by: Lars Knoll --- configure | 74 ++++++++-------------------------------- qmake/Makefile.unix | 7 ++-- qmake/Makefile.unix.macos | 17 +++++++++ qmake/Makefile.unix.mingw | 27 +++++++++++++++ qmake/Makefile.unix.unix | 11 ++++++ qmake/Makefile.unix.win32 | 19 +++++++++++ tools/configure/configureapp.cpp | 57 +++++-------------------------- 7 files changed, 102 insertions(+), 110 deletions(-) create mode 100644 qmake/Makefile.unix.macos create mode 100644 qmake/Makefile.unix.mingw create mode 100644 qmake/Makefile.unix.unix create mode 100644 qmake/Makefile.unix.win32 diff --git a/configure b/configure index 5a5f564abb..bc18e614d2 100755 --- a/configure +++ b/configure @@ -1631,8 +1631,6 @@ setBootstrapVariable() echo "########################################################################" > "$mkfile" echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile" echo "########################################################################" >> "$mkfile" - EXTRA_OBJS= - EXTRA_SRCS= EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX11) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)" EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)" @@ -1657,58 +1655,6 @@ setBootstrapVariable() EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)" fi - case `basename "$PLATFORM"` in - win32-g++*) - EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DUNICODE" - EXTRA_OBJS="qfilesystemengine_win.o \ - qfilesystemiterator_win.o \ - qfsfileengine_win.o \ - qlocale_win.o \ - qsettings_win.o \ - qsystemlibrary.o \ - registry.o" - EXTRA_SRCS="\"\$(SOURCE_PATH)/src/corelib/corelib/io/qfilesystemengine_win.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \ - \"\$(SOURCE_PATH)/tools/shared/windows/registry.cpp\"" - EXTRA_LFLAGS="$EXTRA_LFLAGS -static -s -lole32 -luuid -ladvapi32 -lkernel32" - EXEEXT=".exe" - ;; - *) - EXTRA_OBJS="qfilesystemengine_unix.o \ - qfilesystemiterator_unix.o \ - qfsfileengine_unix.o \ - qlocale_unix.o" - EXTRA_SRCS="\"\$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp\"" - EXEEXT= - ;; - esac - if [ "$BUILD_ON_MAC" = "yes" ]; then - echo "COCOA_LFLAGS =-framework Foundation -framework CoreServices" >>"$mkfile" - echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile" - echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile" - EXTRA_LFLAGS="$EXTRA_LFLAGS \$(COCOA_LFLAGS)" - EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)" - EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)" - EXTRA_OBJS="$EXTRA_OBJS \ - qsettings_mac.o \ - qcore_mac.o \ - qcore_mac_objc.o \ - qcore_foundation.o" - EXTRA_SRCS="$EXTRA_SRCS \ - \"\$(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp\" \ - \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm\" \ - \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm\"" - fi - - echo >>"$mkfile" adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'` adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'` adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'` @@ -1725,14 +1671,24 @@ setBootstrapVariable() echo "QT_MAJOR_VERSION = $QT_MAJOR_VERSION" >> "$mkfile" echo "QT_MINOR_VERSION = $QT_MINOR_VERSION" >> "$mkfile" echo "QT_PATCH_VERSION = $QT_PATCH_VERSION" >> "$mkfile" - echo "EXTRA_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile" - echo "QTOBJS =" $EXTRA_OBJS >> "$mkfile" - echo "QTSRCS =" $EXTRA_SRCS >> "$mkfile" - echo "LFLAGS = $EXTRA_LFLAGS" >> "$mkfile" - echo "EXEEXT = $EXEEXT" >> "$mkfile" + echo "CONFIG_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile" + echo "CONFIG_LFLAGS = $EXTRA_LFLAGS" >> "$mkfile" echo "RM_F = rm -f" >> "$mkfile" echo "RM_RF = rm -rf" >> "$mkfile" + case `basename "$PLATFORM"` in + win32-g++*) + cat "$in_mkfile.win32" >> "$mkfile" + ;; + *) + cat "$in_mkfile.unix" >> "$mkfile" + if [ "$BUILD_ON_MAC" = "yes" ]; then + cat "$in_mkfile.macos" >> "$mkfile" + fi + ;; + esac + echo >>"$mkfile" + if [ "$BUILD_ON_MAC" = "yes" ]; then echo "EXTRA_CXXFLAGS += -MMD" >> "$mkfile" cat "$in_mkfile" >> "$mkfile" diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 0ab2a1b3c6..808a6d8233 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -20,7 +20,7 @@ QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtext qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.o qnumeric.o \ qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o \ qjson.o qjsondocument.o qjsonparser.o qjsonarray.o qjsonobject.o qjsonvalue.o \ - $(QTOBJS) + $(QTOBJS) $(QTOBJS2) #all sources, used for the depend target @@ -92,7 +92,7 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/json/qjsonarray.cpp \ $(SOURCE_PATH)/src/corelib/json/qjsonobject.cpp \ $(SOURCE_PATH)/src/corelib/json/qjsonvalue.cpp \ - $(QTSRCS) + $(QTSRCS) $(QTSRCS2) CPPFLAGS = -g $(EXTRA_CPPFLAGS) \ -I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 \ @@ -106,7 +106,8 @@ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \ -DQT_NO_FOREACH -CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS) +CXXFLAGS = $(EXTRA_CXXFLAGS) $(CONFIG_CXXFLAGS) $(CPPFLAGS) +LFLAGS = $(EXTRA_LFLAGS) $(CONFIG_LFLAGS) first all: $(BUILD_PATH)/bin/qmake$(EXEEXT) qmake: $(BUILD_PATH)/bin/qmake$(EXEEXT) diff --git a/qmake/Makefile.unix.macos b/qmake/Makefile.unix.macos new file mode 100644 index 0000000000..06b875a84a --- /dev/null +++ b/qmake/Makefile.unix.macos @@ -0,0 +1,17 @@ +COCOA_LFLAGS = -framework Foundation -framework CoreServices +CARBON_LFLAGS = -framework ApplicationServices +CARBON_CFLAGS = -fconstant-cfstrings + +EXTRA_CXXFLAGS = $(CARBON_CFLAGS) +EXTRA_LFLAGS = $(COCOA_LFLAGS) $(CARBON_LFLAGS) + +QTOBJS2 = \ + qsettings_mac.o \ + qcore_mac.o \ + qcore_mac_objc.o \ + qcore_foundation.o +QTSRCS2 = \ + $(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp \ + $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp \ + $(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm \ + $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm diff --git a/qmake/Makefile.unix.mingw b/qmake/Makefile.unix.mingw new file mode 100644 index 0000000000..2c52c07dca --- /dev/null +++ b/qmake/Makefile.unix.mingw @@ -0,0 +1,27 @@ +# SHELL is the full path of sh.exe, unless +# 1) it is found in the current directory +# 2) it is not found at all +# 3) it is overridden on the command line with an existing file +# ... otherwise it is always sh.exe. Specifically, SHELL from the +# environment has no effect. +# +# This check will fail if SHELL is explicitly set to a not +# sh-compatible shell. This is not a problem, because configure.bat +# will not do that. +ifeq ($(SHELL), sh.exe) + ifeq ($(wildcard $(CURDIR)/sh.exe), ) + SH = 0 + else + SH = 1 + endif +else + SH = 1 +endif + +ifeq ($(SH), 1) + RM_F = rm -f + RM_RF = rm -rf +else + RM_F = del /f + RM_RF = rmdir /s /q +endif diff --git a/qmake/Makefile.unix.unix b/qmake/Makefile.unix.unix new file mode 100644 index 0000000000..63eba4f5a5 --- /dev/null +++ b/qmake/Makefile.unix.unix @@ -0,0 +1,11 @@ +EXEEXT = +QTOBJS = \ + qfilesystemengine_unix.o \ + qfilesystemiterator_unix.o \ + qfsfileengine_unix.o \ + qlocale_unix.o +QTSRCS = \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp diff --git a/qmake/Makefile.unix.win32 b/qmake/Makefile.unix.win32 new file mode 100644 index 0000000000..be7245a370 --- /dev/null +++ b/qmake/Makefile.unix.win32 @@ -0,0 +1,19 @@ +EXEEXT = .exe +EXTRA_CXXFLAGS = -DUNICODE +EXTRA_LFLAGS = -static -s -lole32 -luuid -ladvapi32 -lkernel32 +QTOBJS = \ + qfilesystemengine_win.o \ + qfilesystemiterator_win.o \ + qfsfileengine_win.o \ + qlocale_win.o \ + qsettings_win.o \ + qsystemlibrary.o \ + registry.o +QTSRCS = \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp \ + $(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp \ + $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp \ + $(SOURCE_PATH)/tools/shared/windows/registry.cpp diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 870bf3d368..f7baf4086b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -866,54 +866,15 @@ void Configure::buildQmake() << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; if (dictionary[ "QMAKESPEC" ].startsWith("win32-g++")) { stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\" << dictionary[ "QMAKESPEC" ] << endl - << "EXTRA_CXXFLAGS = -std=c++11 -DUNICODE -ffunction-sections" << endl - << "EXTRA_LFLAGS = -Wl,--gc-sections" << endl - << "QTOBJS = qfilesystemengine_win.o \\" << endl - << " qfilesystemiterator_win.o \\" << endl - << " qfsfileengine_win.o \\" << endl - << " qlocale_win.o \\" << endl - << " qsettings_win.o \\" << endl - << " qsystemlibrary.o \\" << endl - << " registry.o" << endl - << "QTSRCS=\"$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp\" \\" << endl - << " \"$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp\" \\" << endl - << " \"$(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp\" \\" << endl - << " \"$(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp\" \\" << endl - << " \"$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp\" \\" << endl\ - << " \"$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \\" << endl - << " \"$(SOURCE_PATH)/tools/shared/windows/registry.cpp\"" << endl - << "EXEEXT=.exe" << endl - << "LFLAGS=-static -s -lole32 -luuid -ladvapi32 -lkernel32" << endl; - /* - ** SHELL is the full path of sh.exe, unless - ** 1) it is found in the current directory - ** 2) it is not found at all - ** 3) it is overridden on the command line with an existing file - ** ... otherwise it is always sh.exe. Specifically, SHELL from the - ** environment has no effect. - ** - ** This check will fail if SHELL is explicitly set to a not - ** sh-compatible shell. This is not a problem, because configure.bat - ** will not do that. - */ - stream << "ifeq ($(SHELL), sh.exe)" << endl - << " ifeq ($(wildcard $(CURDIR)/sh.exe), )" << endl - << " SH = 0" << endl - << " else" << endl - << " SH = 1" << endl - << " endif" << endl - << "else" << endl - << " SH = 1" << endl - << "endif" << endl - << "\n" - << "ifeq ($(SH), 1)" << endl - << " RM_F = rm -f" << endl - << " RM_RF = rm -rf" << endl - << "else" << endl - << " RM_F = del /f" << endl - << " RM_RF = rmdir /s /q" << endl - << "endif" << endl; - stream << "\n\n"; + << "CONFIG_CXXFLAGS = -std=c++11 -ffunction-sections" << endl + << "CONFIG_LFLAGS = -Wl,--gc-sections" << endl; + + QFile in(sourcePath + "/qmake/Makefile.unix.win32"); + if (in.open(QFile::ReadOnly | QFile::Text)) + stream << in.readAll(); + QFile in2(sourcePath + "/qmake/Makefile.unix.mingw"); + if (in2.open(QFile::ReadOnly | QFile::Text)) + stream << in2.readAll(); } else { stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl; } -- cgit v1.2.3 From 53686bf86db1c2695ee16b903e4b86cc3ee74006 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 16 Nov 2016 15:57:36 +0100 Subject: configure: simplify version string setup this basically finishes the job of 2d2cb6434. Change-Id: I47a5e29ca0df7f521242790be64a09b3514be464 Reviewed-by: Lars Knoll --- tools/configure/configureapp.cpp | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f7baf4086b..2e6ee2a681 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -117,34 +117,6 @@ Configure::Configure(int& argc, char** argv) //Only used when cross compiling. dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg"; - QString version; - QFile qmake_conf(sourcePath + "/.qmake.conf"); - if (qmake_conf.open(QFile::ReadOnly)) { - while (!qmake_conf.atEnd()) { - static const char beginning[] = "MODULE_VERSION = "; - QByteArray line = qmake_conf.readLine(); - if (!line.startsWith(beginning)) - continue; - - version = qMove(line).mid(int(strlen(beginning))).trimmed(); - break; - } - qmake_conf.close(); - } - - if (version.isEmpty()) - version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff); - - dictionary[ "VERSION" ] = version; - { - QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)"); - if (version_re.exactMatch(version)) { - dictionary[ "VERSION_MAJOR" ] = version_re.cap(1); - dictionary[ "VERSION_MINOR" ] = version_re.cap(2); - dictionary[ "VERSION_PATCH" ] = version_re.cap(3); - } - } - dictionary[ "REDO" ] = "no"; dictionary[ "BUILDTYPE" ] = "none"; @@ -604,7 +576,7 @@ void Configure::generateHeaders() QStringList args; args << "perl" << "-w"; args += sourcePath + "/bin/syncqt.pl"; - args << "-version" << dictionary["VERSION"] << "-minimal" << "-module" << "QtCore"; + args << "-version" << QT_VERSION_STR << "-minimal" << "-module" << "QtCore"; args += sourcePath; int retc = Environment::execute(args, QStringList(), QStringList()); if (retc) { @@ -860,10 +832,10 @@ void Configure::buildQmake() << "INC_PATH = " << QDir::toNativeSeparators( (QFile::exists(sourcePath + "/.git") ? ".." : sourcePath) + "/include") << endl; - stream << "QT_VERSION = " << dictionary["VERSION"] << endl - << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl - << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl - << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; + stream << "QT_VERSION = " QT_VERSION_STR << endl + << "QT_MAJOR_VERSION = " QT_STRINGIFY(QT_VERSION_MAJOR) << endl + << "QT_MINOR_VERSION = " QT_STRINGIFY(QT_VERSION_MINOR) << endl + << "QT_PATCH_VERSION = " QT_STRINGIFY(QT_VERSION_PATCH) << endl; if (dictionary[ "QMAKESPEC" ].startsWith("win32-g++")) { stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\" << dictionary[ "QMAKESPEC" ] << endl << "CONFIG_CXXFLAGS = -std=c++11 -ffunction-sections" << endl -- cgit v1.2.3 From 9204b8c31ea1b5f0c05870c5b5d74c33b1a4f622 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 7 Nov 2016 14:37:58 +0100 Subject: Register fonts with preferred names on Windows Looks up the canonical names of enumerated fonts and register them under their preferred names if present. Also changes the logic handling registration of english aliases, so it is always done, even if it might in rare cases cause a double registration since that is safe. Task-number: QTBUG-53458 Change-Id: Ia010774b26072192b55697b717cc37442c852881 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontdatabases/windows/qwindowsfontdatabase.cpp | 217 +++++++++++---------- .../windows/qwindowsfontdatabase_ft.cpp | 105 +++++----- .../fontdatabases/windows/qwindowsfontdatabase_p.h | 25 ++- .../fontdatabases/windows/qwindowsfontengine.cpp | 16 +- .../direct2d/qwindowsdirect2dpaintengine.cpp | 2 +- .../gui/text/qfontdatabase/tst_qfontdatabase.cpp | 4 + 6 files changed, 194 insertions(+), 175 deletions(-) diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index b8d997bc35..1c615e06ed 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -759,7 +759,7 @@ static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSe ((quint32)(ch1)) \ ) -bool localizedName(const QString &name) +bool qt_localizedName(const QString &name) { const QChar *c = name.unicode(); for (int i = 0; i < name.length(); ++i) { @@ -769,24 +769,8 @@ bool localizedName(const QString &name) return false; } -static inline quint16 getUShort(const unsigned char *p) -{ - quint16 val; - val = *p++ << 8; - val |= *p; - - return val; -} - namespace { -struct FontNames { - QString name; // e.g. "DejaVu Sans Condensed" - QString style; // e.g. "Italic" - QString preferredName; // e.g. "DejaVu Sans" - QString preferredStyle; // e.g. "Condensed Italic" -}; - static QString readName(bool unicode, const uchar *string, int length) { QString out; @@ -797,7 +781,7 @@ static QString readName(bool unicode, const uchar *string, int length) out.resize(length); QChar *uc = out.data(); for (int i = 0; i < length; ++i) - uc[i] = getUShort(string + 2*i); + uc[i] = qt_getUShort(string + 2*i); } else { // Apple Roman @@ -822,7 +806,7 @@ enum PlatformFieldValue { PlatformId_Microsoft = 3 }; -static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) +FontNames qt_getCanonicalFontNames(const uchar *table, quint32 bytes) { FontNames out; const int NameRecordSize = 12; @@ -836,11 +820,11 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) if (bytes < 8) return out; - if (getUShort(table) != 0) + if (qt_getUShort(table) != 0) return out; - count = getUShort(table+2); - string_offset = getUShort(table+4); + count = qt_getUShort(table + 2); + string_offset = qt_getUShort(table + 4); names = table + 6; if (string_offset >= bytes || 6 + count*NameRecordSize > string_offset) @@ -859,10 +843,10 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) for (int i = 0; i < count; ++i) { // search for the correct name entries - quint16 platform_id = getUShort(names + i*NameRecordSize); - quint16 encoding_id = getUShort(names + 2 + i*NameRecordSize); - quint16 language_id = getUShort(names + 4 + i*NameRecordSize); - quint16 name_id = getUShort(names + 6 + i*NameRecordSize); + quint16 platform_id = qt_getUShort(names + i*NameRecordSize); + quint16 encoding_id = qt_getUShort(names + 2 + i*NameRecordSize); + quint16 language_id = qt_getUShort(names + 4 + i*NameRecordSize); + quint16 name_id = qt_getUShort(names + 6 + i*NameRecordSize); PlatformIdType *idType = nullptr; int *id = nullptr; @@ -888,8 +872,8 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) continue; } - quint16 length = getUShort(names + 8 + i*NameRecordSize); - quint16 offset = getUShort(names + 10 + i*NameRecordSize); + quint16 length = qt_getUShort(names + 8 + i*NameRecordSize); + quint16 offset = qt_getUShort(names + 10 + i*NameRecordSize); if (DWORD(string_offset + offset + length) > bytes) continue; @@ -916,8 +900,8 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) if (idStatus[i] == NotFound) continue; int id = ids[i]; - quint16 length = getUShort(names + 8 + id * NameRecordSize); - quint16 offset = getUShort(names + 10 + id * NameRecordSize); + quint16 length = qt_getUShort(names + 8 + id * NameRecordSize); + quint16 offset = qt_getUShort(names + 10 + id * NameRecordSize); const unsigned char *string = table + string_offset + offset; strings[i] = readName(idStatus[i] != Apple, string, length); } @@ -931,7 +915,7 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) } // namespace -QString getEnglishName(const QString &familyName, bool includeStyle = false) +QString qt_getEnglishName(const QString &familyName, bool includeStyle) { QString i18n_name; QString faceName = familyName; @@ -970,7 +954,7 @@ QString getEnglishName(const QString &familyName, bool includeStyle = false) goto error; { - const FontNames names = getCanonicalFontNames(table, bytes); + const FontNames names = qt_getCanonicalFontNames(table, bytes); i18n_name = names.name; if (includeStyle) i18n_name += QLatin1Char(' ') + names.style; @@ -985,16 +969,63 @@ error: return i18n_name; } -static bool addFontToDatabase(const QString &familyName, const QString &styleName, uchar charSet, +// Note this duplicates parts of qt_getEnglishName, we should try to unify the two functions. +FontNames qt_getCanonicalFontNames(const LOGFONT &lf) +{ + FontNames fontNames; + HDC hdc = GetDC(0); + HFONT hfont = CreateFontIndirect(&lf); + + if (!hfont) { + ReleaseDC(0, hdc); + return fontNames; + } + + HGDIOBJ oldobj = SelectObject(hdc, hfont); + + // get the name table + QByteArray table; + const DWORD name_tag = MAKE_TAG('n', 'a', 'm', 'e'); + DWORD bytes = GetFontData(hdc, name_tag, 0, 0, 0); + if (bytes != GDI_ERROR) { + table.resize(bytes); + + if (GetFontData(hdc, name_tag, 0, table.data(), bytes) != GDI_ERROR) + fontNames = qt_getCanonicalFontNames(reinterpret_cast(table.constData()), bytes); + } + + SelectObject(hdc, oldobj); + DeleteObject(hfont); + ReleaseDC(0, hdc); + + return fontNames; +} + +static QChar *createFontFile(const QString &faceName) +{ + QChar *faceNamePtr = nullptr; + if (!faceName.isEmpty()) { + const int nameLength = qMin(faceName.length(), LF_FACESIZE - 1); + faceNamePtr = new QChar[nameLength + 1]; + memcpy(faceNamePtr, faceName.utf16(), sizeof(wchar_t) * nameLength); + faceNamePtr[nameLength] = 0; + } + return faceNamePtr; +} + +static bool addFontToDatabase(QString familyName, + QString styleName, + const LOGFONT &logFont, const TEXTMETRIC *textmetric, const FONTSIGNATURE *signature, - int type, - bool registerAlias) + int type) { // the "@family" fonts are just the same as "family". Ignore them. if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QLatin1String("WST_"))) return false; + uchar charSet = logFont.lfCharSet; + static const int SMOOTH_SCALABLE = 0xffff; const QString foundryName; // No such concept. const bool fixed = !(textmetric->tmPitchAndFamily & TMPF_FIXED_PITCH); @@ -1023,10 +1054,24 @@ static bool addFontToDatabase(const QString &familyName, const QString &styleNam qCDebug(lcQpaFonts) << message; } #endif - QString englishName; - if (registerAlias && ttf && localizedName(familyName)) - englishName = getEnglishName(familyName); + QString faceName; + + QString subFamilyName; + QString subFamilyStyle; + if (ttf) { + // Look-up names registered in the font + FontNames canonicalNames = qt_getCanonicalFontNames(logFont); + if (qt_localizedName(familyName) && !canonicalNames.name.isEmpty()) + englishName = canonicalNames.name; + if (!canonicalNames.preferredName.isEmpty()) { + subFamilyName = familyName; + subFamilyStyle = styleName; + faceName = familyName; // Remember the original name for later lookups + familyName = canonicalNames.preferredName; + styleName = canonicalNames.preferredStyle; + } + } QSupportedWritingSystems writingSystems; if (type & TRUETYPE_FONTTYPE) { @@ -1054,32 +1099,36 @@ static bool addFontToDatabase(const QString &familyName, const QString &styleNam } QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight, - style, stretch, antialias, scalable, size, fixed, writingSystems, 0); + style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName)); + // add fonts windows can generate for us: if (weight <= QFont::DemiBold && styleName.isEmpty()) QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, - style, stretch, antialias, scalable, size, fixed, writingSystems, 0); + style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName)); if (style != QFont::StyleItalic && styleName.isEmpty()) QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, - QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0); + QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName)); if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty()) QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, - QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0); + QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName)); - if (!englishName.isEmpty()) + if (!subFamilyName.isEmpty() && familyName != subFamilyName) { + QPlatformFontDatabase::registerFont(subFamilyName, subFamilyStyle, foundryName, weight, + style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(faceName)); + } + + if (!englishName.isEmpty() && englishName != familyName) QPlatformFontDatabase::registerAliasToFontFamily(familyName, englishName); return true; } static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *textmetric, - DWORD type, LPARAM lParam) + DWORD type, LPARAM) { const ENUMLOGFONTEX *f = reinterpret_cast(logFont); const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const QString styleName = QString::fromWCharArray(f->elfStyle); - const uchar charSet = f->elfLogFont.lfCharSet; - const bool registerAlias = bool(lParam); // NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according // to the documentation is identical to a TEXTMETRIC except for the last four @@ -1087,13 +1136,13 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t const FONTSIGNATURE *signature = Q_NULLPTR; if (type & TRUETYPE_FONTTYPE) signature = &reinterpret_cast(textmetric)->ntmFontSig; - addFontToDatabase(familyName, styleName, charSet, textmetric, signature, type, registerAlias); + addFontToDatabase(familyName, styleName, *logFont, textmetric, signature, type); // keep on enumerating return 1; } -void QWindowsFontDatabase::populateFamily(const QString &familyName, bool registerAlias) +void QWindowsFontDatabase::populateFamily(const QString &familyName) { qCDebug(lcQpaFonts) << familyName; if (familyName.size() >= LF_FACESIZE) { @@ -1106,29 +1155,12 @@ void QWindowsFontDatabase::populateFamily(const QString &familyName, bool regist familyName.toWCharArray(lf.lfFaceName); lf.lfFaceName[familyName.size()] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, storeFont, LPARAM(registerAlias), 0); + EnumFontFamiliesEx(dummy, &lf, storeFont, 0, 0); ReleaseDC(0, dummy); } -void QWindowsFontDatabase::populateFamily(const QString &familyName) -{ - populateFamily(familyName, false); -} - -namespace { -// Context for enumerating system fonts, records whether the default font has been encountered, -// which is normally not enumerated by EnumFontFamiliesEx(). -struct PopulateFamiliesContext -{ - PopulateFamiliesContext(const QString &f) : systemDefaultFont(f), seenSystemDefaultFont(false) {} - - QString systemDefaultFont; - bool seenSystemDefaultFont; -}; -} // namespace - -static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric, - DWORD, LPARAM lparam) +static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *, + DWORD, LPARAM) { // the "@family" fonts are just the same as "family". Ignore them. const ENUMLOGFONTEX *f = reinterpret_cast(logFont); @@ -1136,22 +1168,6 @@ static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TE if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) { const QString faceName = QString::fromWCharArray(faceNameW); QPlatformFontDatabase::registerFontFamily(faceName); - PopulateFamiliesContext *context = reinterpret_cast(lparam); - if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) - context->seenSystemDefaultFont = true; - - // Register current font's english name as alias - const bool ttf = textmetric->tmPitchAndFamily & TMPF_TRUETYPE; - if (ttf && localizedName(faceName)) { - const QString englishName = getEnglishName(faceName); - if (!englishName.isEmpty()) { - QPlatformFontDatabase::registerAliasToFontFamily(faceName, englishName); - // Check whether the system default font name is an alias of the current font family name, - // as on Chinese Windows, where the system font "SimSun" is an alias to a font registered under a local name - if (!context->seenSystemDefaultFont && englishName == context->systemDefaultFont) - context->seenSystemDefaultFont = true; - } - } } return 1; // continue } @@ -1164,12 +1180,10 @@ void QWindowsFontDatabase::populateFontDatabase() lf.lfCharSet = DEFAULT_CHARSET; lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family()); - EnumFontFamiliesEx(dummy, &lf, populateFontFamilies, reinterpret_cast(&context), 0); + EnumFontFamiliesEx(dummy, &lf, populateFontFamilies, 0, 0); ReleaseDC(0, dummy); // Work around EnumFontFamiliesEx() not listing the system font. - if (!context.seenSystemDefaultFont) - QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont); + QPlatformFontDatabase::registerFontFamily(QWindowsFontDatabase::systemDefaultFont().family()); } typedef QSharedPointer QWindowsFontEngineDataPtr; @@ -1228,7 +1242,8 @@ QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) { - QFontEngine *fe = QWindowsFontDatabase::createEngine(fontDef, + const QString faceName(static_cast(handle)); + QFontEngine *fe = QWindowsFontDatabase::createEngine(fontDef, faceName, defaultVerticalDPI(), sharedFontData()); qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << fe << handle; @@ -1282,7 +1297,7 @@ QT_WARNING_POP request.hintingPreference = hintingPreference; request.stretch = QFont::Unstretched; - fontEngine = QWindowsFontDatabase::createEngine(request, + fontEngine = QWindowsFontDatabase::createEngine(request, QString(), defaultVerticalDPI(), sharedFontData()); @@ -1461,7 +1476,7 @@ static void getFamiliesAndSignatures(const QByteArray &fontData, getFontTable(data, font, MAKE_TAG('n', 'a', 'm', 'e'), &table, &length); if (!table) continue; - FontNames names = getCanonicalFontNames(table, length); + FontNames names = qt_getCanonicalFontNames(table, length); if (names.name.isEmpty()) continue; @@ -1523,8 +1538,8 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, TEXTMETRIC textMetrics; GetTextMetrics(hdc, &textMetrics); - addFontToDatabase(familyName, styleName, lf.lfCharSet, &textMetrics, &signatures.at(j), - TRUETYPE_FONTTYPE, true); + addFontToDatabase(familyName, styleName, lf, &textMetrics, &signatures.at(j), + TRUETYPE_FONTTYPE); SelectObject(hdc, oldobj); DeleteObject(hfont); @@ -1550,7 +1565,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, for (int j = 0; j < families.count(); ++j) { const QString familyName = families.at(j).name; familyNames << familyName; - populateFamily(familyName, true); + populateFamily(familyName); } } @@ -1571,8 +1586,10 @@ void QWindowsFontDatabase::removeApplicationFonts() m_applicationFonts.clear(); } -void QWindowsFontDatabase::releaseHandle(void * /* handle */) +void QWindowsFontDatabase::releaseHandle(void *handle) { + const QChar *faceName = reinterpret_cast(handle); + delete[] faceName; } QString QWindowsFontDatabase::fontDir() const @@ -1663,7 +1680,7 @@ static const char *kr_tryFonts[] = { static const char **tryFonts = 0; -LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) +LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request, const QString &faceName) { LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); @@ -1738,7 +1755,9 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) lf.lfPitchAndFamily = DEFAULT_PITCH | hint; - QString fam = request.family; + QString fam = faceName; + if (fam.isEmpty()) + fam = request.family; if (Q_UNLIKELY(fam.size() >= LF_FACESIZE)) { qCritical("%s: Family name '%s' is too long.", __FUNCTION__, qPrintable(fam)); fam.truncate(LF_FACESIZE - 1); @@ -1837,13 +1856,13 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon } -QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, +QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const QString &faceName, int dpi, const QSharedPointer &data) { QFontEngine *fe = 0; - LOGFONT lf = fontDefToLOGFONT(request); + LOGFONT lf = fontDefToLOGFONT(request, faceName); const bool preferClearTypeAA = lf.lfQuality == CLEARTYPE_QUALITY; if (request.stretch != 100) { diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp index 4d973bbf17..df84198862 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp @@ -100,9 +100,6 @@ static FontFile * createFontFile(const QString &fileName, int index) return fontFile; } -extern bool localizedName(const QString &name); -extern QString getEnglishName(const QString &familyName, bool includeStyle = false); - namespace { struct FontKey { @@ -162,19 +159,20 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR) return Q_NULLPTR; } -static bool addFontToDatabase(const QString &faceName, - const QString &styleName, +static bool addFontToDatabase(QString familyName, + QString styleName, const QString &fullName, - uchar charSet, + const LOGFONT &logFont, const TEXTMETRIC *textmetric, const FONTSIGNATURE *signature, - int type, - bool registerAlias) + int type) { // the "@family" fonts are just the same as "family". Ignore them. - if (faceName.isEmpty() || faceName.at(0) == QLatin1Char('@') || faceName.startsWith(QLatin1String("WST_"))) + if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QLatin1String("WST_"))) return false; + uchar charSet = logFont.lfCharSet; + static const int SMOOTH_SCALABLE = 0xffff; const QString foundryName; // No such concept. const bool fixed = !(textmetric->tmPitchAndFamily & TMPF_FIXED_PITCH); @@ -190,7 +188,7 @@ static bool addFontToDatabase(const QString &faceName, if (lcQpaFonts().isDebugEnabled()) { QString message; QTextStream str(&message); - str << __FUNCTION__ << ' ' << faceName << "::" << fullName << ' ' << charSet << " TTF=" << ttf; + str << __FUNCTION__ << ' ' << familyName << "::" << fullName << ' ' << charSet << " TTF=" << ttf; if (type & DEVICE_FONTTYPE) str << " DEVICE"; if (type & RASTER_FONTTYPE) @@ -205,8 +203,22 @@ static bool addFontToDatabase(const QString &faceName, #endif QString englishName; - if (registerAlias & ttf && localizedName(faceName)) - englishName = getEnglishName(faceName); + QString faceName = familyName; + + QString subFamilyName; + QString subFamilyStyle; + if (ttf) { + // Look-up names registered in the font + FontNames canonicalNames = qt_getCanonicalFontNames(logFont); + if (qt_localizedName(familyName) && !canonicalNames.name.isEmpty()) + englishName = canonicalNames.name; + if (!canonicalNames.preferredName.isEmpty()) { + subFamilyName = familyName; + subFamilyStyle = styleName; + familyName = canonicalNames.preferredName; + styleName = canonicalNames.preferredStyle; + } + } QSupportedWritingSystems writingSystems; if (type & TRUETYPE_FONTTYPE) { @@ -243,12 +255,10 @@ static bool addFontToDatabase(const QString &faceName, && systemLocale.language() != QLocale::English && styleName != QLatin1String("Italic") && styleName != QLatin1String("Bold")) { - key = findFontKey(getEnglishName(fullName, true), &index); + key = findFontKey(qt_getEnglishName(fullName, true), &index); } if (!key) key = findFontKey(faceName, &index); - if (!key && !registerAlias && englishName.isEmpty() && localizedName(faceName)) - englishName = getEnglishName(faceName); if (!key && !englishName.isEmpty()) key = findFontKey(englishName, &index); if (!key) @@ -261,24 +271,29 @@ static bool addFontToDatabase(const QString &faceName, if (!QDir::isAbsolutePath(value)) value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\")); - QPlatformFontDatabase::registerFont(faceName, styleName, foundryName, weight, style, stretch, + QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); // add fonts windows can generate for us: if (weight <= QFont::DemiBold && styleName.isEmpty()) - QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, style, stretch, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (style != QFont::StyleItalic && styleName.isEmpty()) - QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, QFont::StyleItalic, stretch, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty()) - QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); - if (!englishName.isEmpty()) - QPlatformFontDatabase::registerAliasToFontFamily(faceName, englishName); + if (!subFamilyName.isEmpty() && familyName != subFamilyName) { + QPlatformFontDatabase::registerFont(subFamilyName, subFamilyStyle, foundryName, weight, + style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); + } + + if (!englishName.isEmpty() && englishName != familyName) + QPlatformFontDatabase::registerAliasToFontFamily(familyName, englishName); return true; } @@ -290,7 +305,6 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const QString styleName = QString::fromWCharArray(f->elfStyle); const QString fullName = QString::fromWCharArray(f->elfFullName); - const uchar charSet = f->elfLogFont.lfCharSet; // NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according // to the documentation is identical to a TEXTMETRIC except for the last four @@ -298,7 +312,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t const FONTSIGNATURE *signature = Q_NULLPTR; if (type & TRUETYPE_FONTTYPE) signature = &reinterpret_cast(textmetric)->ntmFontSig; - addFontToDatabase(faceName, styleName, fullName, charSet, textmetric, signature, type, false); + addFontToDatabase(faceName, styleName, fullName, *logFont, textmetric, signature, type); // keep on enumerating return 1; @@ -321,30 +335,19 @@ void QWindowsFontDatabaseFT::populateFamily(const QString &familyName) } HDC dummy = GetDC(0); LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; + memset(&lf, 0, sizeof(LOGFONT)); familyName.toWCharArray(lf.lfFaceName); lf.lfFaceName[familyName.size()] = 0; + lf.lfCharSet = DEFAULT_CHARSET; lf.lfPitchAndFamily = 0; EnumFontFamiliesEx(dummy, &lf, storeFont, 0, 0); ReleaseDC(0, dummy); } -namespace { -// Context for enumerating system fonts, records whether the default font has been -// encountered, which is normally not enumerated. -struct PopulateFamiliesContext -{ - PopulateFamiliesContext(const QString &f) : systemDefaultFont(f), seenSystemDefaultFont(false) {} - - QString systemDefaultFont; - bool seenSystemDefaultFont; -}; -} // namespace - // Delayed population of font families static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric, - DWORD, LPARAM lparam) + DWORD, LPARAM) { const ENUMLOGFONTEX *f = reinterpret_cast(logFont); // the "@family" fonts are just the same as "family". Ignore them. @@ -356,27 +359,11 @@ static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TE const FontKey *key = findFontKey(faceName); if (!key) { key = findFontKey(QString::fromWCharArray(f->elfFullName)); - if (!key && ttf && localizedName(faceName)) - key = findFontKey(getEnglishName(faceName)); + if (!key && ttf && qt_localizedName(faceName)) + key = findFontKey(qt_getEnglishName(faceName)); } - if (key) { + if (key) QPlatformFontDatabase::registerFontFamily(faceName); - PopulateFamiliesContext *context = reinterpret_cast(lparam); - if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) - context->seenSystemDefaultFont = true; - - // Register current font's english name as alias - if (ttf && localizedName(faceName)) { - const QString englishName = getEnglishName(faceName); - if (!englishName.isEmpty()) { - QPlatformFontDatabase::registerAliasToFontFamily(faceName, englishName); - // Check whether the system default font name is an alias of the current font family name, - // as on Chinese Windows, where the system font "SimSun" is an alias to a font registered under a local name - if (!context->seenSystemDefaultFont && englishName == context->systemDefaultFont) - context->seenSystemDefaultFont = true; - } - } - } } return 1; // continue } @@ -388,12 +375,10 @@ void QWindowsFontDatabaseFT::populateFontDatabase() lf.lfCharSet = DEFAULT_CHARSET; lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family()); - EnumFontFamiliesEx(dummy, &lf, populateFontFamilies, reinterpret_cast(&context), 0); + EnumFontFamiliesEx(dummy, &lf, populateFontFamilies, 0, 0); ReleaseDC(0, dummy); // Work around EnumFontFamiliesEx() not listing the system font - if (!context.seenSystemDefaultFont) - QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont); + QPlatformFontDatabase::registerFontFamily(QWindowsFontDatabase::systemDefaultFont().family()); } QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, void *handle) diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h index b7ebfc033f..325f522335 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h @@ -112,7 +112,7 @@ public: static QFont systemDefaultFont(); - static QFontEngine *createEngine(const QFontDef &request, + static QFontEngine *createEngine(const QFontDef &request, const QString &faceName, int dpi, const QSharedPointer &data); @@ -120,7 +120,7 @@ public: static QFont LOGFONT_to_QFont(const LOGFONT& lf, int verticalDPI = 0); static qreal fontSmoothingGamma(); - static LOGFONT fontDefToLOGFONT(const QFontDef &fontDef); + static LOGFONT fontDefToLOGFONT(const QFontDef &fontDef, const QString &faceName); static QStringList extraTryFontsForFamily(const QString &family); static QString familyForStyleHint(QFont::StyleHint styleHint); @@ -133,7 +133,6 @@ public: static QString readRegistryString(HKEY parentHandle, const wchar_t *keyPath, const wchar_t *keyName); private: - void populateFamily(const QString &familyName, bool registerAlias); void removeApplicationFonts(); struct WinApplicationFont { @@ -157,6 +156,26 @@ private: QDebug operator<<(QDebug, const QFontDef &def); #endif +inline quint16 qt_getUShort(const unsigned char *p) +{ + quint16 val; + val = *p++ << 8; + val |= *p; + + return val; +} + +struct FontNames { + QString name; // e.g. "DejaVu Sans Condensed" + QString style; // e.g. "Italic" + QString preferredName; // e.g. "DejaVu Sans" + QString preferredStyle; // e.g. "Condensed Italic" +}; + +bool qt_localizedName(const QString &name); +QString qt_getEnglishName(const QString &familyName, bool includeStyle = false); +FontNames qt_getCanonicalFontNames(const LOGFONT &lf); + QT_END_NAMESPACE #endif // QWINDOWSFONTDATABASE_H diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp index 9fc6fec915..0cd473e020 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp @@ -97,15 +97,6 @@ static void resolveGetCharWidthI() ptrGetCharWidthI = (PtrGetCharWidthI)QSystemLibrary::resolve(QStringLiteral("gdi32"), "GetCharWidthI"); } -static inline quint16 getUShort(unsigned char *p) -{ - quint16 val; - val = *p++ << 8; - val |= *p; - - return val; -} - // general font engine QFixed QWindowsFontEngine::lineThickness() const @@ -912,7 +903,7 @@ int QWindowsFontEngine::synthesized() const SelectObject(hdc, hfont); uchar data[4]; GetFontData(hdc, HEAD, 44, &data, 4); - USHORT macStyle = getUShort(data); + USHORT macStyle = qt_getUShort(data); if (tm.tmItalic && !(macStyle & 2)) synthesized_flags = SynthesizedItalic; if (fontDef.stretch != 100 && ttf) @@ -1192,9 +1183,10 @@ QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const if (!uniqueFamilyName.isEmpty()) request.family = uniqueFamilyName; request.pixelSize = pixelSize; + const QString faceName = QString::fromWCharArray(m_logfont.lfFaceName); QFontEngine *fontEngine = - QWindowsFontDatabase::createEngine(request, + QWindowsFontDatabase::createEngine(request, faceName, QWindowsFontDatabase::defaultVerticalDPI(), m_fontEngineData); if (fontEngine) { @@ -1257,7 +1249,7 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at) #ifndef QT_NO_DIRECTWRITE if (fontEngine->type() == QFontEngine::DirectWrite) { QWindowsFontEngineDirectWrite *fe = static_cast(fontEngine); - lf = QWindowsFontDatabase::fontDefToLOGFONT(fe->fontDef); + lf = QWindowsFontDatabase::fontDefToLOGFONT(fe->fontDef, QString()); data = fe->fontEngineData(); } else diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp index 69d2e12778..c4ff937a0b 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp @@ -1037,7 +1037,7 @@ public: if (fontFace) return fontFace; - LOGFONT lf = QWindowsFontDatabase::fontDefToLOGFONT(fontDef); + LOGFONT lf = QWindowsFontDatabase::fontDefToLOGFONT(fontDef, QString()); // Get substitute name static const char keyC[] = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes"; diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 8c26f8a91f..e8244a0e5d 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -326,6 +326,10 @@ void tst_QFontDatabase::condensedFontMatching() QFont tfcByStyleName("QtBidiTestFont"); tfcByStyleName.setStyleName("Condensed"); +#ifdef Q_OS_WIN + QEXPECT_FAIL("","No matching of sub-family by stretch on Windows", Continue); +#endif + QCOMPARE(QFontMetrics(tfcByStretch).width(testString()), QFontMetrics(tfcByStyleName).width(testString())); -- cgit v1.2.3 From 7e9aca683abf1360e3d20dfebdd937b2594c94b2 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 09:50:22 +0100 Subject: De-duplicate the systemsemaphore entry Change-Id: Id015cfe60956d899bbb58597b88204738578b7fe Reviewed-by: Oswald Buddenhagen --- src/corelib/configure.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/corelib/configure.json b/src/corelib/configure.json index e7eb5fe482..76b6612a5d 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -372,11 +372,6 @@ "condition": "tests.syslog", "output": [ "privateConfig" ] }, - "systemsemaphore": { - "label": "Enable QSystemSemaphore", - "condition": "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix", - "output": [ { "type": "define", "negative": true, "name": "QT_NO_SYSTEMSEMAPHORE" } ] - }, "threadsafe-cloexec": { "label": "Threadsafe pipe creation", "condition": "tests.cloexec", @@ -407,6 +402,7 @@ "label": "QSystemSemaphore", "purpose": "Provides a general counting system semaphore.", "section": "Kernel", + "condition": "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix", "output": [ "publicFeature", "feature" ] }, "xmlstream": { -- cgit v1.2.3 From fd9e5d90333c385ad191a289b2e95e918c58b242 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 22 Nov 2016 10:13:41 +0100 Subject: Clean up iconv configuration Turn iconv off if ICU is being used (in line with codecs.pri) and get rid of the DEFINES += GNU_LIBICONV in the pri file. Change-Id: I6fbca975498adbb3e67f913ae9b1dd5cc53ee8da Reviewed-by: Oswald Buddenhagen --- src/corelib/codecs/codecs.pri | 6 +----- src/corelib/codecs/qiconvcodec.cpp | 14 +++++++------- src/corelib/codecs/qiconvcodec_p.h | 4 +--- src/corelib/codecs/qtextcodec.cpp | 6 +++--- src/corelib/configure.json | 8 ++++---- src/corelib/global/qconfig-bootstrapped.h | 1 + 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index 4fa778d042..dc8974d13f 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -43,12 +43,8 @@ qtConfig(icu) { qtConfig(iconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp - qtConfig(gnu-libiconv) { - DEFINES += GNU_LIBICONV + qtConfig(gnu-libiconv): \ QMAKE_USE_PRIVATE += iconv - } else: qtConfig(sun-libiconv) { - DEFINES += GNU_LIBICONV - } } win32 { diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 845155dce0..8961d01eee 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -37,7 +37,9 @@ ** ****************************************************************************/ -#ifndef QT_NO_ICONV +#include + +QT_REQUIRE_CONFIG(iconv); #include "qiconvcodec_p.h" #include "qtextcodec_p.h" @@ -221,7 +223,7 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState IconvState *state = *pstate; size_t inBytesLeft = len; // best case assumption, each byte is converted into one UTF-16 character, plus 2 bytes for the BOM -#ifdef GNU_LIBICONV +#if !QT_CONFIG(posix_libiconv) // GNU doesn't disagree with POSIX :/ const char *inBytes = chars; #else @@ -320,7 +322,7 @@ static bool setByteOrder(iconv_t cd) size_t outBytesLeft = sizeof buf; size_t inBytesLeft = sizeof bom; -#if defined(GNU_LIBICONV) +#if !QT_CONFIG(posix_libiconv) const char **inBytesPtr = const_cast(&inBytes); #else char **inBytesPtr = &inBytes; @@ -342,7 +344,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt char *outBytes; size_t inBytesLeft; -#if defined(GNU_LIBICONV) +#if !QT_CONFIG(posix_libiconv) const char **inBytesPtr = const_cast(&inBytes); #else char **inBytesPtr = &inBytes; @@ -472,7 +474,7 @@ iconv_t QIconvCodec::createIconv_t(const char *to, const char *from) const init(); iconv_t cd = (iconv_t) -1; -#if defined(__GLIBC__) || defined(GNU_LIBICONV) || defined(Q_OS_QNX) +#if defined(__GLIBC__) || !QT_CONFIG(posix_libiconv) || defined(Q_OS_QNX) #if defined(Q_OS_QNX) // on QNX the default locale is UTF-8, and an empty string will cause iconv_open to fail static const char empty_codeset[] = "UTF-8"; @@ -562,5 +564,3 @@ iconv_t QIconvCodec::createIconv_t(const char *to, const char *from) const } QT_END_NAMESPACE - -#endif /* #ifndef QT_NO_ICONV */ diff --git a/src/corelib/codecs/qiconvcodec_p.h b/src/corelib/codecs/qiconvcodec_p.h index 238351bc81..d99e72f635 100644 --- a/src/corelib/codecs/qiconvcodec_p.h +++ b/src/corelib/codecs/qiconvcodec_p.h @@ -54,7 +54,7 @@ #include #include "qtextcodec.h" -#if defined(Q_OS_UNIX) && !defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) +QT_REQUIRE_CONFIG(iconv); #ifdef Q_OS_MAC typedef void * iconv_t; @@ -100,6 +100,4 @@ public: QT_END_NAMESPACE -#endif // Q_OS_UNIX && !QT_NO_ICONV && !QT_BOOTSTRAPPED - #endif // QICONVCODEC_P_H diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 5098ac4242..0c9036aadf 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -61,7 +61,7 @@ #if defined(QT_USE_ICU) #include "qicucodec_p.h" #else -#if !defined(QT_NO_ICONV) +#if QT_CONFIG(iconv) # include "qiconvcodec_p.h" #endif #ifdef Q_OS_WIN @@ -184,7 +184,7 @@ static QTextCodec *setupLocaleMapper() if (charset) locale = QTextCodec::codecForName(charset); #endif -#if !defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) +#if QT_CONFIG(iconv) if (!locale) { // no builtin codec for the locale found, let's try using iconv (void) new QIconvCodec(); @@ -286,7 +286,7 @@ static void setup() (void)new QBig5Codec; (void)new QBig5hkscsCodec; # endif // !QT_NO_BIG_CODECS && !Q_OS_INTEGRITY -#if !defined(QT_NO_ICONV) +#if QT_CONFIG(iconv) (void) new QIconvCodec; #endif #if defined(Q_OS_WIN32) diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 76b6612a5d..5017f4652a 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -245,21 +245,21 @@ "label": "iconv", "purpose": "Provides internationalization on Unix.", "section": "Internationalization", - "condition": "features.posix-libiconv || features.sun-libiconv || features.gnu-libiconv", + "condition": "!features.icu && (features.posix-libiconv || features.sun-libiconv || features.gnu-libiconv)", "output": [ "privateFeature", "feature" ] }, "posix-libiconv": { "label": "POSIX iconv", "enable": "input.iconv == 'posix'", "disable": "input.iconv == 'sun' || input.iconv == 'gnu' || input.iconv == 'no'", - "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && tests.posix-iconv" + "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && tests.posix-iconv", + "output": [ "privateFeature" ] }, "sun-libiconv": { "label": "SUN iconv", "enable": "input.iconv == 'sun'", "disable": "input.iconv == 'posix' || input.iconv == 'gnu' || input.iconv == 'no'", - "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && !features.posix-libiconv && tests.sun-iconv", - "output": [ "privateFeature", "publicQtConfig" ] + "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && !features.posix-libiconv && tests.sun-iconv" }, "gnu-libiconv": { "label": "GNU iconv", diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 3b86e94cdd..4629a57485 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -68,6 +68,7 @@ #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_NO_DATASTREAM +#define QT_FEATURE_iconv -1 #define QT_NO_LIBRARY #define QT_FEATURE_library -1 #define QT_NO_QOBJECT -- cgit v1.2.3 From 5d9413ab3574dd65fb9380bed88caa22d3e5dc92 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 22 Nov 2016 10:14:07 +0100 Subject: Remove Mac specific code paths from qiconvcodec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code is dead, as the codec is never used on macOS. Change-Id: I86138f1c95e5564256b4d592f0044e83658def93 Reviewed-by: Morten Johan Sørvig Reviewed-by: Oswald Buddenhagen --- src/corelib/codecs/qiconvcodec.cpp | 42 +------------------------------------- src/corelib/codecs/qiconvcodec_p.h | 4 ---- 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 8961d01eee..e4fb359f2c 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -64,7 +64,7 @@ QT_REQUIRE_CONFIG(iconv); #elif defined(Q_OS_AIX) # define NO_BOM # define UTF16 "UCS-2" -#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) +#elif defined(Q_OS_FREEBSD) # define NO_BOM # if Q_BYTE_ORDER == Q_BIG_ENDIAN # define UTF16 "UTF-16BE" @@ -75,19 +75,6 @@ QT_REQUIRE_CONFIG(iconv); # define UTF16 "UTF-16" #endif -#if defined(Q_OS_MAC) -#ifndef GNU_LIBICONV -#define GNU_LIBICONV -#endif -typedef iconv_t (*Ptr_iconv_open) (const char*, const char*); -typedef size_t (*Ptr_iconv) (iconv_t, const char **, size_t *, char **, size_t *); -typedef int (*Ptr_iconv_close) (iconv_t); - -static Ptr_iconv_open ptr_iconv_open = 0; -static Ptr_iconv ptr_iconv = 0; -static Ptr_iconv_close ptr_iconv_close = 0; -#endif - QT_BEGIN_NAMESPACE QIconvCodec::QIconvCodec() @@ -105,33 +92,6 @@ void QIconvCodec::init() const fprintf(stderr, "QIconvCodec::convertToUnicode: internal error, UTF-16 codec not found\n"); utf16Codec = reinterpret_cast(~0); } -#if defined(Q_OS_MAC) - if (ptr_iconv_open == 0) { - QLibrary libiconv(QLatin1String("/usr/lib/libiconv")); - libiconv.setLoadHints(QLibrary::ExportExternalSymbolsHint); - - ptr_iconv_open = reinterpret_cast(libiconv.resolve("libiconv_open")); - if (!ptr_iconv_open) - ptr_iconv_open = reinterpret_cast(libiconv.resolve("iconv_open")); - ptr_iconv = reinterpret_cast(libiconv.resolve("libiconv")); - if (!ptr_iconv) - ptr_iconv = reinterpret_cast(libiconv.resolve("iconv")); - ptr_iconv_close = reinterpret_cast(libiconv.resolve("libiconv_close")); - if (!ptr_iconv_close) - ptr_iconv_close = reinterpret_cast(libiconv.resolve("iconv_close")); - - Q_ASSERT_X(ptr_iconv_open && ptr_iconv && ptr_iconv_close, - "QIconvCodec::QIconvCodec()", - "internal error, could not resolve the iconv functions"); - -# undef iconv_open -# define iconv_open ptr_iconv_open -# undef iconv -# define iconv ptr_iconv -# undef iconv_close -# define iconv_close ptr_iconv_close - } -#endif } QIconvCodec::~QIconvCodec() diff --git a/src/corelib/codecs/qiconvcodec_p.h b/src/corelib/codecs/qiconvcodec_p.h index d99e72f635..9b8500538b 100644 --- a/src/corelib/codecs/qiconvcodec_p.h +++ b/src/corelib/codecs/qiconvcodec_p.h @@ -56,11 +56,7 @@ QT_REQUIRE_CONFIG(iconv); -#ifdef Q_OS_MAC -typedef void * iconv_t; -#else #include -#endif QT_BEGIN_NAMESPACE -- cgit v1.2.3 From f17605777b06fb451935e8cbd38b23842dff68d1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 14 Nov 2016 10:12:37 +0000 Subject: Revert "Revert "Deduplication fetchTransformed"" qdrawhelper.cpp is now compiled without PCH, and changes blocked by the ICE can be reinstated. This reverts commit cd9de59177ccbeb7fdfacf8716af7bb20112c880. Task-number: QTBUG-56817 Change-Id: I8d674768d16b3705598bfe5d08ed98376c97a478 Reviewed-by: Simon Hausmann --- src/gui/painting/qdrawhelper.cpp | 185 ++++++++++----------------------------- 1 file changed, 48 insertions(+), 137 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index fe1ff6603d..656b04fdf3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -836,7 +836,10 @@ static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const } template static -uint QT_FASTCALL fetchPixel(const uchar *src, int index); +uint QT_FASTCALL fetchPixel(const uchar *, int) +{ + Q_UNREACHABLE(); +} template <> inline uint QT_FASTCALL fetchPixel(const uchar *src, int index) @@ -1554,92 +1557,11 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op } } -// blendType is either BlendTransformed or BlendTransformedTiled -template -static const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data, - int y, int x, int length) -{ - int image_width = data->texture.width; - int image_height = data->texture.height; - - const qreal cx = x + qreal(0.5); - const qreal cy = y + qreal(0.5); - - const uint *end = buffer + length; - uint *b = buffer; - if (data->fast_matrix) { - // The increment pr x in the scanline - int fdx = (int)(data->m11 * fixed_scale); - int fdy = (int)(data->m12 * fixed_scale); - - int fx = int((data->m21 * cy - + data->m11 * cx + data->dx) * fixed_scale); - int fy = int((data->m22 * cy - + data->m12 * cx + data->dy) * fixed_scale); - - while (b < end) { - int px = fx >> 16; - int py = fy >> 16; - - if (blendType == BlendTransformedTiled) { - px %= image_width; - py %= image_height; - if (px < 0) px += image_width; - if (py < 0) py += image_height; - } else { - px = qBound(0, px, image_width - 1); - py = qBound(0, py, image_height - 1); - } - *b = reinterpret_cast(data->texture.scanLine(py))[px]; - - fx += fdx; - fy += fdy; - ++b; - } - } else { - const qreal fdx = data->m11; - const qreal fdy = data->m12; - const qreal fdw = data->m13; - - qreal fx = data->m21 * cy + data->m11 * cx + data->dx; - qreal fy = data->m22 * cy + data->m12 * cx + data->dy; - qreal fw = data->m23 * cy + data->m13 * cx + data->m33; - - while (b < end) { - const qreal iw = fw == 0 ? 1 : 1 / fw; - const qreal tx = fx * iw; - const qreal ty = fy * iw; - int px = int(tx) - (tx < 0); - int py = int(ty) - (ty < 0); - - if (blendType == BlendTransformedTiled) { - px %= image_width; - py %= image_height; - if (px < 0) px += image_width; - if (py < 0) py += image_height; - } else { - px = qBound(0, px, image_width - 1); - py = qBound(0, py, image_height - 1); - } - *b = reinterpret_cast(data->texture.scanLine(py))[px]; - - fx += fdx; - fy += fdy; - fw += fdw; - //force increment to avoid /0 - if (!fw) { - fw += fdw; - } - ++b; - } - } - return buffer; -} - -template /* either BlendTransformed or BlendTransformedTiled */ +template static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { + Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled); int image_width = data->texture.width; int image_height = data->texture.height; @@ -1647,9 +1569,12 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const qreal cy = y + qreal(0.5); const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; - FetchPixelFunc fetch = qFetchPixel[layout->bpp]; + if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1 + Q_ASSERT(layout->bpp == bpp); + // When templated 'fetch' should be inlined at compile time: + const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel; - const uint *end = buffer + length; + uint *const end = buffer + length; uint *b = buffer; if (data->fast_matrix) { // The increment pr x in the scanline @@ -2585,12 +2510,17 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c } // blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled -template +template static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { const QPixelLayout *layout = &qPixelLayouts[data->texture.format]; const QVector *clut = data->texture.colorTable; + if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1 + Q_ASSERT(layout->bpp == bpp); + // When templated 'fetch' should be inlined at compile time: + const FetchPixelsFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixels[layout->bpp] : fetchPixels; + const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel; int image_width = data->texture.width; int image_height = data->texture.height; @@ -2628,7 +2558,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper // The idea is first to do the interpolation between the row s1 and the row s2 // into an intermediate buffer, then we interpolate between two pixel of this buffer. - FetchPixelsFunc fetch = qFetchPixels[layout->bpp]; // +1 for the last pixel to interpolate with, and +1 for rounding errors. uint buf1[buffer_size + 2]; uint buf2[buffer_size + 2]; @@ -2717,7 +2646,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper fx += fdx; } } else { - FetchPixelFunc fetch = qFetchPixel[layout->bpp]; uint buf1[buffer_size]; uint buf2[buffer_size]; uint *b = buffer; @@ -2728,19 +2656,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper int x1 = (fx >> 16); int x2; fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); - - if (layout->bpp == QPixelLayout::BPP32) { - buf1[i * 2 + 0] = ((const uint*)s1)[x1]; - buf1[i * 2 + 1] = ((const uint*)s1)[x2]; - buf2[i * 2 + 0] = ((const uint*)s2)[x1]; - buf2[i * 2 + 1] = ((const uint*)s2)[x2]; - } else { - buf1[i * 2 + 0] = fetch(s1, x1); - buf1[i * 2 + 1] = fetch(s1, x2); - buf2[i * 2 + 0] = fetch(s2, x1); - buf2[i * 2 + 1] = fetch(s2, x2); - } - + buf1[i * 2 + 0] = fetch1(s1, x1); + buf1[i * 2 + 1] = fetch1(s1, x2); + buf2[i * 2 + 0] = fetch1(s2, x1); + buf2[i * 2 + 1] = fetch1(s2, x2); fx += fdx; } layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0); @@ -2770,7 +2689,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper } } } else { //rotation - FetchPixelFunc fetch = qFetchPixel[layout->bpp]; uint buf1[buffer_size]; uint buf2[buffer_size]; uint *b = buffer; @@ -2789,19 +2707,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper const uchar *s1 = data->texture.scanLine(y1); const uchar *s2 = data->texture.scanLine(y2); - - if (layout->bpp == QPixelLayout::BPP32) { - buf1[i * 2 + 0] = ((const uint*)s1)[x1]; - buf1[i * 2 + 1] = ((const uint*)s1)[x2]; - buf2[i * 2 + 0] = ((const uint*)s2)[x1]; - buf2[i * 2 + 1] = ((const uint*)s2)[x2]; - } else { - buf1[i * 2 + 0] = fetch(s1, x1); - buf1[i * 2 + 1] = fetch(s1, x2); - buf2[i * 2 + 0] = fetch(s2, x1); - buf2[i * 2 + 1] = fetch(s2, x2); - } - + buf1[i * 2 + 0] = fetch1(s1, x1); + buf1[i * 2 + 1] = fetch1(s1, x2); + buf2[i * 2 + 0] = fetch1(s2, x1); + buf2[i * 2 + 1] = fetch1(s2, x2); fx += fdx; fy += fdy; } @@ -2848,7 +2757,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper qreal fy = data->m22 * cy + data->m12 * cx + data->dy; qreal fw = data->m23 * cy + data->m13 * cx + data->m33; - FetchPixelFunc fetch = qFetchPixel[layout->bpp]; uint buf1[buffer_size]; uint buf2[buffer_size]; uint *b = buffer; @@ -2876,18 +2784,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper const uchar *s1 = data->texture.scanLine(y1); const uchar *s2 = data->texture.scanLine(y2); - - if (layout->bpp == QPixelLayout::BPP32) { - buf1[i * 2 + 0] = ((const uint*)s1)[x1]; - buf1[i * 2 + 1] = ((const uint*)s1)[x2]; - buf2[i * 2 + 0] = ((const uint*)s2)[x1]; - buf2[i * 2 + 1] = ((const uint*)s2)[x2]; - } else { - buf1[i * 2 + 0] = fetch(s1, x1); - buf1[i * 2 + 1] = fetch(s1, x2); - buf2[i * 2 + 0] = fetch(s2, x1); - buf2[i * 2 + 1] = fetch(s2, x2); - } + buf1[i * 2 + 0] = fetch1(s1, x1); + buf1[i * 2 + 1] = fetch1(s1, x2); + buf2[i * 2 + 0] = fetch1(s2, x1); + buf2[i * 2 + 1] = fetch1(s2, x2); fx += fdx; fy += fdy; @@ -3293,23 +3193,32 @@ static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = { }; static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = { - fetchUntransformed, // Untransformed - fetchUntransformed, // Tiled - fetchTransformed, // Transformed - fetchTransformed, // TransformedTiled - fetchTransformedBilinear, // Bilinear - fetchTransformedBilinear // BilinearTiled + fetchUntransformed, // Untransformed + fetchUntransformed, // Tiled + fetchTransformed, // Transformed + fetchTransformed, // TransformedTiled + fetchTransformedBilinear, // TransformedBilinear + fetchTransformedBilinear // TransformedBilinearTiled }; static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = { fetchUntransformedARGB32PM, // Untransformed fetchUntransformedARGB32PM, // Tiled - fetchTransformedARGB32PM, // Transformed - fetchTransformedARGB32PM, // TransformedTiled + fetchTransformed, // Transformed + fetchTransformed, // TransformedTiled fetchTransformedBilinearARGB32PM, // Bilinear fetchTransformedBilinearARGB32PM // BilinearTiled }; +static SourceFetchProc sourceFetchAny32[NBlendTypes] = { + fetchUntransformed, // Untransformed + fetchUntransformed, // Tiled + fetchTransformed, // Transformed + fetchTransformed, // TransformedTiled + fetchTransformedBilinear, // TransformedBilinear + fetchTransformedBilinear // TransformedBilinearTiled +}; + static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = { fetchUntransformed64, // Untransformed fetchUntransformed64, // Tiled @@ -3325,6 +3234,8 @@ static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage: return sourceFetchARGB32PM[blendType]; if (blendType == BlendUntransformed || blendType == BlendTiled) return sourceFetchUntransformed[format]; + if (qPixelLayouts[format].bpp == QPixelLayout::BPP32) + return sourceFetchAny32[blendType]; return sourceFetchGeneric[blendType]; } -- cgit v1.2.3 From 04b276b0f5dd265b27dd6ca54fda15a4a64a40df Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 13:02:59 +0100 Subject: Remove last traces of MeeGo Change-Id: I5242f1dfcfccf9811398e717b90196e6228d1dc5 Reviewed-by: Laszlo Agocs Reviewed-by: Oswald Buddenhagen --- src/gui/opengl/opengl.pri | 1 - src/gui/opengl/qopenglshadercache_meego_p.h | 450 --------------------- src/gui/opengl/qopenglshadercache_p.h | 5 - src/network/ssl/qsslsocket.cpp | 2 +- .../gl2paintengineex/qglshadercache_meego_p.h | 450 --------------------- src/opengl/gl2paintengineex/qglshadercache_p.h | 5 - src/opengl/opengl.pro | 3 +- src/tools/uic/qclass_lib_map.h | 6 - 8 files changed, 2 insertions(+), 920 deletions(-) delete mode 100644 src/gui/opengl/qopenglshadercache_meego_p.h delete mode 100644 src/opengl/gl2paintengineex/qglshadercache_meego_p.h diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri index 712cf144e0..1a1022b3a7 100644 --- a/src/gui/opengl/opengl.pri +++ b/src/gui/opengl/opengl.pri @@ -24,7 +24,6 @@ qtConfig(opengl) { opengl/qopenglcustomshaderstage_p.h \ opengl/qopengltextureglyphcache_p.h \ opengl/qopenglshadercache_p.h \ - opengl/qopenglshadercache_meego_p.h \ opengl/qopenglversionfunctions.h \ opengl/qopenglversionfunctionsfactory_p.h \ opengl/qopenglvertexarrayobject.h \ diff --git a/src/gui/opengl/qopenglshadercache_meego_p.h b/src/gui/opengl/qopenglshadercache_meego_p.h deleted file mode 100644 index 0892e1a2a1..0000000000 --- a/src/gui/opengl/qopenglshadercache_meego_p.h +++ /dev/null @@ -1,450 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QOPENGLSHADERCACHE_MEEGO_P_H -#define QOPENGLSHADERCACHE_MEEGO_P_H - -#include - -#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) - -#include -#include -#include - -#ifndef QT_BOOTSTRAPPED -# include -#endif -#if defined(QT_DEBUG) || defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) -# include -#endif - -/* - This cache stores internal Qt shader programs in shared memory. - - This header file is ugly on purpose and can only be included once. It is only to be used - for the internal shader cache, not as a generic cache for anyone's shaders. - - The cache stores either ShaderCacheMaxEntries shader programs or ShaderCacheDataSize kilobytes - of shader programs, whatever limit is reached first. - - The layout of the cache is as outlined in the CachedShaders struct. After some - integers, an array of headers is reserved, then comes the space for the actual binaries. - - Shader Programs are identified by the md5sum of their frag and vertex shader source code. - - Shader Programs are never removed. The cache never shrinks or re-shuffles. This is done - on purpose to ensure minimum amount of locking, no alignment problems and very few write - operations. - - Note: Locking the shader cache could be expensive, because the entire system might hang. - That's why the cache is immutable to minimize the time we need to keep it locked. - - Why is it Meego specific? - - First, the size is chosen so that it fits to generic meego usage. Second, on Meego, there's - always at least one Qt application active (the launcher), so the cache will never be destroyed. - Only when the last Qt app exits, the cache dies, which should only be when someone kills the - X11 server. And last but not least it was only tested with Meego's SGX driver. - - There's a small tool in src/opengl/util/meego that dumps the contents of the cache. - */ - -// anonymous namespace, prevent exporting of the private symbols -namespace -{ - -struct CachedShaderHeader -{ - /* the index in the data[] member of CachedShaders */ - int index; - /* the size of the binary shader */ - GLsizei size; - /* the format of the binary shader */ - GLenum format; - /* the md5sum of the frag+vertex shaders */ - char md5Sum[16]; -}; - -enum -{ - /* The maximum amount of shader programs the cache can hold */ - ShaderCacheMaxEntries = 20 -}; - -typedef CachedShaderHeader CachedShaderHeaders[ShaderCacheMaxEntries]; - -enum -{ - // ShaderCacheDataSize is 20k minus the other data members of CachedShaders - ShaderCacheDataSize = 1024 * ShaderCacheMaxEntries - sizeof(CachedShaderHeaders) - 2 * sizeof(int) -}; - -struct CachedShaders -{ - /* How much space is still available in the cache */ - inline int availableSize() const { return ShaderCacheDataSize - dataSize; } - - /* The current amount of cached shaders */ - int shaderCount; - - /* The current amount (in bytes) of cached data */ - int dataSize; - - /* The headers describing the shaders */ - CachedShaderHeaders headers; - - /* The actual binary data of the shader programs */ - char data[ShaderCacheDataSize]; -}; - -//#define QT_DEBUG_SHADER_CACHE -#ifdef QT_DEBUG_SHADER_CACHE -static QDebug shaderCacheDebug() -{ - return QDebug(QtDebugMsg); -} -#else -static inline QNoDebug shaderCacheDebug() { return QNoDebug(); } -#endif - -class ShaderCacheSharedMemory -{ -public: - ShaderCacheSharedMemory() - : shm(QLatin1String("qt_gles2_shadercache_" QT_VERSION_STR)) - { - // we need a system semaphore here, since cache creation and initialization must be atomic - QSystemSemaphore attachSemaphore(QLatin1String("qt_gles2_shadercache_mutex_" QT_VERSION_STR), 1); - - if (!attachSemaphore.acquire()) { - shaderCacheDebug() << "Unable to require shader cache semaphore:" << attachSemaphore.errorString(); - return; - } - - if (shm.attach()) { - // success! - shaderCacheDebug() << "Attached to shader cache"; - } else { - - // no cache exists - create and initialize it - if (shm.create(sizeof(CachedShaders))) { - shaderCacheDebug() << "Created new shader cache"; - initializeCache(); - } else { - shaderCacheDebug() << "Unable to create shader cache:" << shm.errorString(); - } - } - - attachSemaphore.release(); - } - - inline bool isAttached() const { return shm.isAttached(); } - - inline bool lock() { return shm.lock(); } - inline bool unlock() { return shm.unlock(); } - inline void *data() { return shm.data(); } - inline QString errorString() { return shm.errorString(); } - - ~ShaderCacheSharedMemory() - { - if (!shm.detach()) - shaderCacheDebug() << "Unable to detach shader cache" << shm.errorString(); - } - -private: - void initializeCache() - { - // no need to lock the shared memory since we're already protected by the - // attach system semaphore. - - void *data = shm.data(); - Q_ASSERT(data); - - memset(data, 0, sizeof(CachedShaders)); - } - - QSharedMemory shm; -}; - -class ShaderCacheLocker -{ -public: - inline ShaderCacheLocker(ShaderCacheSharedMemory *cache) - : shm(cache->lock() ? cache : (ShaderCacheSharedMemory *)0) - { - if (!shm) - shaderCacheDebug() << "Unable to lock shader cache" << cache->errorString(); - } - - inline bool isLocked() const { return shm; } - - inline ~ShaderCacheLocker() - { - if (!shm) - return; - if (!shm->unlock()) - shaderCacheDebug() << "Unable to unlock shader cache" << shm->errorString(); - } - -private: - ShaderCacheSharedMemory *shm; -}; - -#ifdef QT_BOOTSTRAPPED -} // end namespace -#else - -static void traceCacheOverflow(const char *message) -{ -#if defined(QT_DEBUG) || defined (QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) - openlog(qPrintable(QCoreApplication::applicationName()), LOG_PID | LOG_ODELAY, LOG_USER); - syslog(LOG_DEBUG, message); - closelog(); -#endif - shaderCacheDebug() << message; -} - -Q_GLOBAL_STATIC(ShaderCacheSharedMemory, shaderCacheSharedMemory) - -/* - Finds the index of the shader program identified by md5Sum in the cache. - Note: Does NOT lock the cache for reading, the cache must already be locked! - - Returns -1 when no shader was found. - */ -static int qt_cache_index_unlocked(const QByteArray &md5Sum, CachedShaders *cache) -{ - for (int i = 0; i < cache->shaderCount; ++i) { - if (qstrncmp(md5Sum.constData(), cache->headers[i].md5Sum, 16) == 0) { - return i; - } - } - return -1; -} - -/* Returns the index of the shader identified by md5Sum */ -static int qt_cache_index(const QByteArray &md5Sum) -{ - ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); - if (!shm || !shm->isAttached()) - return false; - - Q_ASSERT(md5Sum.length() == 16); - - ShaderCacheLocker locker(shm); - if (!locker.isLocked()) - return false; - - void *data = shm->data(); - Q_ASSERT(data); - - CachedShaders *cache = reinterpret_cast(data); - - return qt_cache_index_unlocked(md5Sum, cache); -} - -/* Loads the cached shader at index \a shaderIndex into \a program - * Note: Since the cache is immutable, this operation doesn't lock the shared memory. - */ -static bool qt_cached_shader(QOpenGLShaderProgram *program, QOpenGLContext *ctx, int shaderIndex) -{ - Q_ASSERT(shaderIndex >= 0 && shaderIndex <= ShaderCacheMaxEntries); - Q_ASSERT(program); - - ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); - if (!shm || !shm->isAttached()) - return false; - - void *data = shm->data(); - Q_ASSERT(data); - - CachedShaders *cache = reinterpret_cast(data); - - shaderCacheDebug() << "fetching cached shader at index" << shaderIndex - << "dataIndex" << cache->headers[shaderIndex].index - << "size" << cache->headers[shaderIndex].size - << "format" << cache->headers[shaderIndex].format; - - // call program->programId first, since that resolves the glProgramBinaryOES symbol - GLuint programId = program->programId(); - glProgramBinaryOES(programId, cache->headers[shaderIndex].format, - cache->data + cache->headers[shaderIndex].index, - cache->headers[shaderIndex].size); - - return true; -} - -/* Stores the shader program in the cache. Returns false if there's an error with the cache, or - if the cache is too small to hold the shader. */ -static bool qt_cache_shader(const QOpenGLShaderProgram *shader, QOpenGLContext *ctx, const QByteArray &md5Sum) -{ - ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); - if (!shm || !shm->isAttached()) - return false; - - void *data = shm->data(); - Q_ASSERT(data); - - CachedShaders *cache = reinterpret_cast(data); - - ShaderCacheLocker locker(shm); - if (!locker.isLocked()) - return false; - - int cacheIdx = cache->shaderCount; - if (cacheIdx >= ShaderCacheMaxEntries) { - traceCacheOverflow("Qt OpenGL shader cache index overflow!"); - return false; - } - - // now that we have the lock on the shared memory, make sure no one - // inserted the shader already while we were unlocked - if (qt_cache_index_unlocked(md5Sum, cache) != -1) - return true; // already cached - - shaderCacheDebug() << "Caching shader at index" << cacheIdx; - - GLint binaryLength = 0; - glGetProgramiv(shader->programId(), GL_PROGRAM_BINARY_LENGTH_OES, &binaryLength); - - if (!binaryLength) { - shaderCacheDebug() << "Unable to determine binary shader size!"; - return false; - } - - if (binaryLength > cache->availableSize()) { - traceCacheOverflow("Qt OpenGL shader cache data overflow!"); - return false; - } - - GLsizei size = 0; - GLenum format = 0; - glGetProgramBinaryOES(shader->programId(), binaryLength, &size, &format, - cache->data + cache->dataSize); - - if (!size) { - shaderCacheDebug() << "Unable to get binary shader!"; - return false; - } - - cache->headers[cacheIdx].index = cache->dataSize; - cache->dataSize += binaryLength; - ++cache->shaderCount; - cache->headers[cacheIdx].size = binaryLength; - cache->headers[cacheIdx].format = format; - - memcpy(cache->headers[cacheIdx].md5Sum, md5Sum.constData(), 16); - - shaderCacheDebug() << "cached shader size" << size - << "format" << format - << "binarySize" << binaryLength - << "cache index" << cacheIdx - << "data index" << cache->headers[cacheIdx].index; - - return true; -} - -} // namespace - -QT_BEGIN_NAMESPACE - - -class CachedShader -{ -public: - CachedShader(const QByteArray &fragSource, const QByteArray &vertexSource) - : cacheIdx(-1) - { - QCryptographicHash md5Hash(QCryptographicHash::Md5); - - md5Hash.addData(fragSource); - md5Hash.addData(vertexSource); - - md5Sum = md5Hash.result(); - } - - bool isCached() - { - return cacheIndex() != -1; - } - - int cacheIndex() - { - if (cacheIdx != -1) - return cacheIdx; - cacheIdx = qt_cache_index(md5Sum); - return cacheIdx; - } - - bool load(QOpenGLShaderProgram *program, QOpenGLContext *ctx) - { - if (cacheIndex() == -1) - return false; - return qt_cached_shader(program, ctx, cacheIdx); - } - - bool store(QOpenGLShaderProgram *program, QOpenGLContext *ctx) - { - return qt_cache_shader(program, ctx, md5Sum); - } - -private: - QByteArray md5Sum; - int cacheIdx; -}; - - -QT_END_NAMESPACE - -#endif - -#endif -#endif diff --git a/src/gui/opengl/qopenglshadercache_p.h b/src/gui/opengl/qopenglshadercache_p.h index b4d1d64721..0f730602b0 100644 --- a/src/gui/opengl/qopenglshadercache_p.h +++ b/src/gui/opengl/qopenglshadercache_p.h @@ -53,10 +53,6 @@ #include -#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) -# include "qopenglshadercache_meego_p.h" -#else - QT_BEGIN_NAMESPACE @@ -88,4 +84,3 @@ public: QT_END_NAMESPACE #endif -#endif diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 29e1f32815..2fc779b257 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -2643,7 +2643,7 @@ bool QSslSocketPrivate::rootCertOnDemandLoadingSupported() */ QList QSslSocketPrivate::unixRootCertDirectories() { - return QList() << "/etc/ssl/certs/" // (K)ubuntu, OpenSUSE, Mandriva, MeeGo ... + return QList() << "/etc/ssl/certs/" // (K)ubuntu, OpenSUSE, Mandriva ... << "/usr/lib/ssl/certs/" // Gentoo, Mandrake << "/usr/share/ssl/" // Centos, Redhat, SuSE << "/usr/local/ssl/" // Normal OpenSSL Tarball diff --git a/src/opengl/gl2paintengineex/qglshadercache_meego_p.h b/src/opengl/gl2paintengineex/qglshadercache_meego_p.h deleted file mode 100644 index de75d5ae8c..0000000000 --- a/src/opengl/gl2paintengineex/qglshadercache_meego_p.h +++ /dev/null @@ -1,450 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QGLSHADERCACHE_MEEGO_P_H -#define QGLSHADERCACHE_MEEGO_P_H - -#include - -#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) - -#include -#include -#include - -#ifndef QT_BOOTSTRAPPED -# include -#endif -#if defined(QT_DEBUG) || defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) -# include -#endif - -/* - This cache stores internal Qt shader programs in shared memory. - - This header file is ugly on purpose and can only be included once. It is only to be used - for the internal shader cache, not as a generic cache for anyone's shaders. - - The cache stores either ShaderCacheMaxEntries shader programs or ShaderCacheDataSize kilobytes - of shader programs, whatever limit is reached first. - - The layout of the cache is as outlined in the CachedShaders struct. After some - integers, an array of headers is reserved, then comes the space for the actual binaries. - - Shader Programs are identified by the md5sum of their frag and vertex shader source code. - - Shader Programs are never removed. The cache never shrinks or re-shuffles. This is done - on purpose to ensure minimum amount of locking, no alignment problems and very few write - operations. - - Note: Locking the shader cache could be expensive, because the entire system might hang. - That's why the cache is immutable to minimize the time we need to keep it locked. - - Why is it Meego specific? - - First, the size is chosen so that it fits to generic meego usage. Second, on Meego, there's - always at least one Qt application active (the launcher), so the cache will never be destroyed. - Only when the last Qt app exits, the cache dies, which should only be when someone kills the - X11 server. And last but not least it was only tested with Meego's SGX driver. - - There's a small tool in src/opengl/util/meego that dumps the contents of the cache. - */ - -// anonymous namespace, prevent exporting of the private symbols -namespace -{ - -struct CachedShaderHeader -{ - /* the index in the data[] member of CachedShaders */ - int index; - /* the size of the binary shader */ - GLsizei size; - /* the format of the binary shader */ - GLenum format; - /* the md5sum of the frag+vertex shaders */ - char md5Sum[16]; -}; - -enum -{ - /* The maximum amount of shader programs the cache can hold */ - ShaderCacheMaxEntries = 20 -}; - -typedef CachedShaderHeader CachedShaderHeaders[ShaderCacheMaxEntries]; - -enum -{ - // ShaderCacheDataSize is 20k minus the other data members of CachedShaders - ShaderCacheDataSize = 1024 * ShaderCacheMaxEntries - sizeof(CachedShaderHeaders) - 2 * sizeof(int) -}; - -struct CachedShaders -{ - /* How much space is still available in the cache */ - inline int availableSize() const { return ShaderCacheDataSize - dataSize; } - - /* The current amount of cached shaders */ - int shaderCount; - - /* The current amount (in bytes) of cached data */ - int dataSize; - - /* The headers describing the shaders */ - CachedShaderHeaders headers; - - /* The actual binary data of the shader programs */ - char data[ShaderCacheDataSize]; -}; - -//#define QT_DEBUG_SHADER_CACHE -#ifdef QT_DEBUG_SHADER_CACHE -static QDebug shaderCacheDebug() -{ - return QDebug(QtDebugMsg); -} -#else -static inline QNoDebug shaderCacheDebug() { return QNoDebug(); } -#endif - -class ShaderCacheSharedMemory -{ -public: - ShaderCacheSharedMemory() - : shm(QLatin1String("qt_gles2_shadercache_" QT_VERSION_STR)) - { - // we need a system semaphore here, since cache creation and initialization must be atomic - QSystemSemaphore attachSemaphore(QLatin1String("qt_gles2_shadercache_mutex_" QT_VERSION_STR), 1); - - if (!attachSemaphore.acquire()) { - shaderCacheDebug() << "Unable to require shader cache semaphore:" << attachSemaphore.errorString(); - return; - } - - if (shm.attach()) { - // success! - shaderCacheDebug() << "Attached to shader cache"; - } else { - - // no cache exists - create and initialize it - if (shm.create(sizeof(CachedShaders))) { - shaderCacheDebug() << "Created new shader cache"; - initializeCache(); - } else { - shaderCacheDebug() << "Unable to create shader cache:" << shm.errorString(); - } - } - - attachSemaphore.release(); - } - - inline bool isAttached() const { return shm.isAttached(); } - - inline bool lock() { return shm.lock(); } - inline bool unlock() { return shm.unlock(); } - inline void *data() { return shm.data(); } - inline QString errorString() { return shm.errorString(); } - - ~ShaderCacheSharedMemory() - { - if (!shm.detach()) - shaderCacheDebug() << "Unable to detach shader cache" << shm.errorString(); - } - -private: - void initializeCache() - { - // no need to lock the shared memory since we're already protected by the - // attach system semaphore. - - void *data = shm.data(); - Q_ASSERT(data); - - memset(data, 0, sizeof(CachedShaders)); - } - - QSharedMemory shm; -}; - -class ShaderCacheLocker -{ -public: - inline ShaderCacheLocker(ShaderCacheSharedMemory *cache) - : shm(cache->lock() ? cache : (ShaderCacheSharedMemory *)0) - { - if (!shm) - shaderCacheDebug() << "Unable to lock shader cache" << cache->errorString(); - } - - inline bool isLocked() const { return shm; } - - inline ~ShaderCacheLocker() - { - if (!shm) - return; - if (!shm->unlock()) - shaderCacheDebug() << "Unable to unlock shader cache" << shm->errorString(); - } - -private: - ShaderCacheSharedMemory *shm; -}; - -#ifdef QT_BOOTSTRAPPED -} // end namespace -#else - -static void traceCacheOverflow(const char *message) -{ -#if defined(QT_DEBUG) || defined (QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) - openlog(qPrintable(QCoreApplication::applicationName()), LOG_PID | LOG_ODELAY, LOG_USER); - syslog(LOG_DEBUG, message); - closelog(); -#endif - shaderCacheDebug() << message; -} - -Q_GLOBAL_STATIC(ShaderCacheSharedMemory, shaderCacheSharedMemory) - -/* - Finds the index of the shader program identified by md5Sum in the cache. - Note: Does NOT lock the cache for reading, the cache must already be locked! - - Returns -1 when no shader was found. - */ -static int qt_cache_index_unlocked(const QByteArray &md5Sum, CachedShaders *cache) -{ - for (int i = 0; i < cache->shaderCount; ++i) { - if (qstrncmp(md5Sum.constData(), cache->headers[i].md5Sum, 16) == 0) { - return i; - } - } - return -1; -} - -/* Returns the index of the shader identified by md5Sum */ -static int qt_cache_index(const QByteArray &md5Sum) -{ - ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); - if (!shm || !shm->isAttached()) - return false; - - Q_ASSERT(md5Sum.length() == 16); - - ShaderCacheLocker locker(shm); - if (!locker.isLocked()) - return false; - - void *data = shm->data(); - Q_ASSERT(data); - - CachedShaders *cache = reinterpret_cast(data); - - return qt_cache_index_unlocked(md5Sum, cache); -} - -/* Loads the cached shader at index \a shaderIndex into \a program - * Note: Since the cache is immutable, this operation doesn't lock the shared memory. - */ -static bool qt_cached_shader(QGLShaderProgram *program, const QGLContext *ctx, int shaderIndex) -{ - Q_ASSERT(shaderIndex >= 0 && shaderIndex <= ShaderCacheMaxEntries); - Q_ASSERT(program); - - ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); - if (!shm || !shm->isAttached()) - return false; - - void *data = shm->data(); - Q_ASSERT(data); - - CachedShaders *cache = reinterpret_cast(data); - - shaderCacheDebug() << "fetching cached shader at index" << shaderIndex - << "dataIndex" << cache->headers[shaderIndex].index - << "size" << cache->headers[shaderIndex].size - << "format" << cache->headers[shaderIndex].format; - - // call program->programId first, since that resolves the glProgramBinaryOES symbol - GLuint programId = program->programId(); - glProgramBinaryOES(programId, cache->headers[shaderIndex].format, - cache->data + cache->headers[shaderIndex].index, - cache->headers[shaderIndex].size); - - return true; -} - -/* Stores the shader program in the cache. Returns false if there's an error with the cache, or - if the cache is too small to hold the shader. */ -static bool qt_cache_shader(const QGLShaderProgram *shader, const QGLContext *ctx, const QByteArray &md5Sum) -{ - ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); - if (!shm || !shm->isAttached()) - return false; - - void *data = shm->data(); - Q_ASSERT(data); - - CachedShaders *cache = reinterpret_cast(data); - - ShaderCacheLocker locker(shm); - if (!locker.isLocked()) - return false; - - int cacheIdx = cache->shaderCount; - if (cacheIdx >= ShaderCacheMaxEntries) { - traceCacheOverflow("Qt OpenGL shader cache index overflow!"); - return false; - } - - // now that we have the lock on the shared memory, make sure no one - // inserted the shader already while we were unlocked - if (qt_cache_index_unlocked(md5Sum, cache) != -1) - return true; // already cached - - shaderCacheDebug() << "Caching shader at index" << cacheIdx; - - GLint binaryLength = 0; - glGetProgramiv(shader->programId(), GL_PROGRAM_BINARY_LENGTH_OES, &binaryLength); - - if (!binaryLength) { - shaderCacheDebug() << "Unable to determine binary shader size!"; - return false; - } - - if (binaryLength > cache->availableSize()) { - traceCacheOverflow("Qt OpenGL shader cache data overflow!"); - return false; - } - - GLsizei size = 0; - GLenum format = 0; - glGetProgramBinaryOES(shader->programId(), binaryLength, &size, &format, - cache->data + cache->dataSize); - - if (!size) { - shaderCacheDebug() << "Unable to get binary shader!"; - return false; - } - - cache->headers[cacheIdx].index = cache->dataSize; - cache->dataSize += binaryLength; - ++cache->shaderCount; - cache->headers[cacheIdx].size = binaryLength; - cache->headers[cacheIdx].format = format; - - memcpy(cache->headers[cacheIdx].md5Sum, md5Sum.constData(), 16); - - shaderCacheDebug() << "cached shader size" << size - << "format" << format - << "binarySize" << binaryLength - << "cache index" << cacheIdx - << "data index" << cache->headers[cacheIdx].index; - - return true; -} - -} // namespace - -QT_BEGIN_NAMESPACE - - -class CachedShader -{ -public: - CachedShader(const QByteArray &fragSource, const QByteArray &vertexSource) - : cacheIdx(-1) - { - QCryptographicHash md5Hash(QCryptographicHash::Md5); - - md5Hash.addData(fragSource); - md5Hash.addData(vertexSource); - - md5Sum = md5Hash.result(); - } - - bool isCached() - { - return cacheIndex() != -1; - } - - int cacheIndex() - { - if (cacheIdx != -1) - return cacheIdx; - cacheIdx = qt_cache_index(md5Sum); - return cacheIdx; - } - - bool load(QGLShaderProgram *program, const QGLContext *ctx) - { - if (cacheIndex() == -1) - return false; - return qt_cached_shader(program, ctx, cacheIdx); - } - - bool store(QGLShaderProgram *program, const QGLContext *ctx) - { - return qt_cache_shader(program, ctx, md5Sum); - } - -private: - QByteArray md5Sum; - int cacheIdx; -}; - - -QT_END_NAMESPACE - -#endif - -#endif -#endif diff --git a/src/opengl/gl2paintengineex/qglshadercache_p.h b/src/opengl/gl2paintengineex/qglshadercache_p.h index e2ac3f85d7..4204e3e256 100644 --- a/src/opengl/gl2paintengineex/qglshadercache_p.h +++ b/src/opengl/gl2paintengineex/qglshadercache_p.h @@ -53,10 +53,6 @@ #include -#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) -# include "qglshadercache_meego_p.h" -#else - QT_BEGIN_NAMESPACE @@ -88,4 +84,3 @@ public: QT_END_NAMESPACE #endif -#endif diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 25de6ad670..718a886809 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -41,8 +41,7 @@ HEADERS += qglshaderprogram.h \ gl2paintengineex/qglengineshadersource_p.h \ gl2paintengineex/qglcustomshaderstage_p.h \ gl2paintengineex/qtextureglyphcache_gl_p.h \ - gl2paintengineex/qglshadercache_p.h \ - gl2paintengineex/qglshadercache_meego_p.h + gl2paintengineex/qglshadercache_p.h SOURCES += qglshaderprogram.cpp \ qgraphicsshadereffect.cpp \ diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h index 930a648d57..810b326b30 100644 --- a/src/tools/uic/qclass_lib_map.h +++ b/src/tools/uic/qclass_lib_map.h @@ -440,12 +440,6 @@ QT_CLASS_LIB(QXmlResultItems, QtXmlPatterns, qxmlresultitems.h) QT_CLASS_LIB(QXmlSchema, QtXmlPatterns, qxmlschema.h) QT_CLASS_LIB(QXmlSchemaValidator, QtXmlPatterns, qxmlschemavalidator.h) QT_CLASS_LIB(QXmlSerializer, QtXmlPatterns, qxmlserializer.h) -QT_CLASS_LIB(QMeeGoFenceSync, QtMeeGoGraphicsSystemHelper, qmeegofencesync.h) -QT_CLASS_LIB(QMeeGoGraphicsSystemHelper, QtMeeGoGraphicsSystemHelper, qmeegographicssystemhelper.h) -QT_CLASS_LIB(QMeeGoLivePixmap, QtMeeGoGraphicsSystemHelper, qmeegolivepixmap.h) -QT_CLASS_LIB(QMeeGoOverlayWidget, QtMeeGoGraphicsSystemHelper, qmeegooverlaywidget.h) -QT_CLASS_LIB(QMeeGoRuntime, QtMeeGoGraphicsSystemHelper, qmeegoruntime.h) -QT_CLASS_LIB(QMeeGoSwitchEvent, QtMeeGoGraphicsSystemHelper, qmeegoswitchevent.h) QT_CLASS_LIB(QAxBase, ActiveQt, qaxbase.h) QT_CLASS_LIB(QAxObject, ActiveQt, qaxobject.h) QT_CLASS_LIB(QAxScriptEngine, ActiveQt, qaxscript.h) -- cgit v1.2.3 From 389b4ec28b6bb402d3575ff9c648ef878257ea84 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 22 Nov 2016 15:45:36 +0100 Subject: Windows QPA: Do not send key events for mouse-synthesized app commands Sending key events in addition causes applications to respond twice to for example the back / forward extra mouse buttons. Suppress the keypress by checking on the device. This is in line with the other platforms, which do not send keypresses either. Native event filters will still be able to listen for WM_APPCOMMAND. Task-number: QTBUG-48117 Task-number: QTBUG-57198 Change-Id: I219e17244087663f06ab2c5a8cf4b880c3655700 Reviewed-by: Andy Shaw --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 60361e436d..a52ae7c2a9 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -861,6 +861,9 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd, bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, const MSG &msg) { #if defined(WM_APPCOMMAND) + // QTBUG-57198, do not send mouse-synthesized commands as key events in addition + if (GET_DEVICE_LPARAM(msg.lParam) == FAPPCOMMAND_MOUSE) + return false; const int cmd = GET_APPCOMMAND_LPARAM(msg.lParam); const int dwKeys = GET_KEYSTATE_LPARAM(msg.lParam); int state = 0; -- cgit v1.2.3 From 60054b5940b19f4dd9780e63da1e2dce45baf131 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 2 Nov 2016 13:58:54 +0100 Subject: QSettings: Replace deprecated Win32 SHGetSpecialFolderPath MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SHGetSpecialFolderPath is declared 'unsupported' by Microsoft, and has problems with non-ASCII characters. Replace it by the newer SHGetKnownFolderPath. Task-number: QTBUG-50570 Change-Id: I8b2dfa10fa5dc30e6c3be094a2ba8d7c3504f2ca GPush-Base: 4d181bd93234a3747b520d10417825a0147bfeb1 Reviewed-by: Jan Arve Sæther --- src/corelib/io/qsettings.cpp | 71 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 47108d057b..480a777457 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -97,14 +97,6 @@ using namespace ABI::Windows::Foundation; using namespace ABI::Windows::Storage; #endif -#ifndef CSIDL_COMMON_APPDATA -#define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data -#endif - -#ifndef CSIDL_APPDATA -#define CSIDL_APPDATA 0x001a // \Application Data -#endif - #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID) #define Q_XDG_PLATFORM #endif @@ -959,31 +951,34 @@ void QConfFileSettingsPrivate::initAccess() } #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -static QString windowsConfigPath(int type) +static QString windowsConfigPath(const KNOWNFOLDERID &type) { QString result; - wchar_t path[MAX_PATH]; - if (SHGetSpecialFolderPath(0, path, type, false)) + PWSTR path = nullptr; + if (SHGetKnownFolderPath(type, KF_FLAG_DONT_VERIFY, NULL, &path) == S_OK) { result = QString::fromWCharArray(path); + CoTaskMemFree(path); + } if (result.isEmpty()) { - switch (type) { - case CSIDL_COMMON_APPDATA: + if (type == FOLDERID_ProgramData) { result = QLatin1String("C:\\temp\\qt-common"); - break; - case CSIDL_APPDATA: + } else if (type == FOLDERID_RoamingAppData) { result = QLatin1String("C:\\temp\\qt-user"); - break; - default: - ; } } return result; } #elif defined(Q_OS_WINRT) // Q_OS_WIN && !Q_OS_WINRT -static QString windowsConfigPath(int type) + +enum ConfigPathType { + ConfigPath_CommonAppData, + ConfigPath_UserAppData +}; + +static QString windowsConfigPath(ConfigPathType type) { static QString result; while (result.isEmpty()) { @@ -1006,12 +1001,10 @@ static QString windowsConfigPath(int type) } switch (type) { - case CSIDL_COMMON_APPDATA: + case ConfigPath_CommonAppData: return result + QLatin1String("\\qt-common"); - case CSIDL_APPDATA: + case ConfigPath_UserAppData: return result + QLatin1String("\\qt-user"); - default: - break; } return result; } @@ -1068,10 +1061,18 @@ static void initDefaultPaths(QMutexLocker *locker) Windows registry and the Mac CFPreferences.) */ #ifdef Q_OS_WIN + +# ifdef Q_OS_WINRT + const QString roamingAppDataFolder = windowsConfigPath(ConfigPath_UserAppData); + const QString programDataFolder = windowsConfigPath(ConfigPath_CommonAppData); +# else + const QString roamingAppDataFolder = windowsConfigPath(FOLDERID_RoamingAppData); + const QString programDataFolder = windowsConfigPath(FOLDERID_ProgramData); +# endif pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), - windowsConfigPath(CSIDL_APPDATA) + QDir::separator()); + roamingAppDataFolder + QDir::separator()); pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope), - windowsConfigPath(CSIDL_COMMON_APPDATA) + QDir::separator()); + programDataFolder + QDir::separator()); #else const QString userPath = make_user_path(); pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), userPath); @@ -2231,20 +2232,20 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, On Windows, the following files are used: \list 1 - \li \c{CSIDL_APPDATA\MySoft\Star Runner.ini} - \li \c{CSIDL_APPDATA\MySoft.ini} - \li \c{CSIDL_COMMON_APPDATA\MySoft\Star Runner.ini} - \li \c{CSIDL_COMMON_APPDATA\MySoft.ini} + \li \c{FOLDERID_RoamingAppData\MySoft\Star Runner.ini} + \li \c{FOLDERID_RoamingAppData\MySoft.ini} + \li \c{FOLDERID_ProgramData\MySoft\Star Runner.ini} + \li \c{FOLDERID_ProgramData\MySoft.ini} \endlist - The identifiers prefixed by \c{CSIDL_} are special item ID lists to be passed - to the Win32 API function \c{SHGetSpecialFolderPath()} to obtain the + The identifiers prefixed by \c{FOLDERID_} are special item ID lists to be passed + to the Win32 API function \c{SHGetKnownFolderPath()} to obtain the corresponding path. - \c{CSIDL_APPDATA} usually points to \tt{C:\\Users\\\e{User Name}\\AppData\\Roaming}, + \c{FOLDERID_RoamingAppData} usually points to \tt{C:\\Users\\\e{User Name}\\AppData\\Roaming}, also shown by the environment variable \c{%APPDATA%}. - \c{CSIDL_COMMON_APPDATA} usually points to \tt{C:\\ProgramData}. + \c{FOLDERID_ProgramData} usually points to \tt{C:\\ProgramData}. If the file format is IniFormat, this is "Settings/MySoft/Star Runner.ini" in the application's home directory. @@ -3348,8 +3349,8 @@ void QSettings::setUserIniPath(const QString &dir) \table \header \li Platform \li Format \li Scope \li Path - \row \li{1,2} Windows \li{1,2} IniFormat \li UserScope \li \c CSIDL_APPDATA - \row \li SystemScope \li \c CSIDL_COMMON_APPDATA + \row \li{1,2} Windows \li{1,2} IniFormat \li UserScope \li \c FOLDERID_RoamingAppData + \row \li SystemScope \li \c FOLDERID_ProgramData \row \li{1,2} Unix \li{1,2} NativeFormat, IniFormat \li UserScope \li \c $HOME/.config \row \li SystemScope \li \c /etc/xdg \row \li{1,2} Qt for Embedded Linux \li{1,2} NativeFormat, IniFormat \li UserScope \li \c $HOME/Settings -- cgit v1.2.3 From 5b05c37845887c275c8b076505f536bc42edf099 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 19:40:33 +0100 Subject: qmake: fix up dist targets for mingw & nmake somewhat actually pack the extra compilers' input files, not the variable names. unlike on unix, we don't create an actual distdir, so the package is still going to be rather broken. Change-Id: If0a15bbe9db95aebd88c2a21ca3c0f787ce5c7e1 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/winmakefile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index ccf6457048..26e1901f8b 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -608,8 +608,10 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { const ProStringList &inputs = project->values(ProKey(*it + ".input")); - for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) - t << escapeFilePath(*input) << ' '; + for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) { + const ProStringList &val = project->values((*input).toKey()); + t << escapeFilePaths(val).join(' ') << ' '; + } } } t << endl << endl; -- cgit v1.2.3 From 0810d48bc4cb820c0cba982a2ec392058eccd466 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 19:05:54 +0100 Subject: unbreak "aux" template for mingw & msvc, take 2 of course, we should stub out everything related to TARGET - only the generic "all" and "first" targets including their deps should be emitted. amends af2847260. Change-Id: I8ed7a550b8022c69328d2e16dbd078928d176964 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/mingw_make.cpp | 9 +++++++-- qmake/generators/win32/msvc_nmake.cpp | 9 +++++++-- qmake/generators/win32/winmakefile.cpp | 18 ++++++++++-------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 8c315e0696..92c6f35817 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -313,7 +313,12 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + << ' ' << depVar("ALL_DEPS"); + if (project->first("TEMPLATE") == "aux") { + t << "\n\n"; + return; + } + t << " $(DESTDIR_TARGET)\n\n"; t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <first("TEMPLATE") != "aux") { + } else { t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)"; } if(!project->isEmpty("QMAKE_POST_LINK")) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 41bec4c36d..8f70be4665 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -552,7 +552,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + << ' ' << depVar("ALL_DEPS"); + if (templateName == "aux") { + t << "\n\n"; + return; + } + t << " $(DESTDIR_TARGET)\n\n"; t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) @@ -561,7 +566,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "\n\t$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<\n\t " << "$(OBJECTS)" << "\n<<"; - } else if (templateName != "aux") { + } else { const bool embedManifest = ((templateName == "app" && project->isActiveConfig("embed_manifest_exe")) || (templateName == "lib" && project->isActiveConfig("embed_manifest_dll") && !(project->isActiveConfig("plugin") && project->isActiveConfig("no_plugin_manifest")) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 26e1901f8b..ec66efd1cb 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -575,16 +575,18 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) t << "####### Build rules\n\n"; writeBuildRulesPart(t); - if(project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { - const ProStringList &dlldirs = project->values("DLLDESTDIR"); - for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { - t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " - << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; + if (project->first("TEMPLATE") != "aux") { + if (project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { + const ProStringList &dlldirs = project->values("DLLDESTDIR"); + for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { + t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " + << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; + } } - } - t << endl; + t << endl; - writeRcFilePart(t); + writeRcFilePart(t); + } writeMakeQmake(t); -- cgit v1.2.3 From 435e7b17a35f4aa2cc2a7cb3ac935cf56ee27d62 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 15 Nov 2016 17:28:44 +0100 Subject: Fix qmldir copying in debug and release builds on Windows This is a backport of 6cc02ce6c85d3dbd49a55060bd21a8359884786f from 5.7. In a parallel build we may end up copying the qmldir file at the same time, which doesn't work on Windows due to file locking. Apply the same guard for the copying condition as in commit 770a0c91f3fadcdb132d9eb96d085aafbe1bacd0. Task-number: QTBUG-57153 Change-Id: Ibac759b16cebaf04f5d2f785211b62071aa656a8 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qml_module.prf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index b09d42a0a4..47ebe78400 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -28,4 +28,8 @@ qmldir.files = $$fq_qml_files qmldir.path = $$instbase/$$TARGETPATH INSTALLS += qmldir -!prefix_build: COPIES += qmldir +!debug_and_release|!build_all|CONFIG(release, debug|release) { + !prefix_build { + COPIES += qmldir + } +} -- cgit v1.2.3 From d3ab4a1ce7cd0fe6539d592138a8119dd51d818f Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 16 Nov 2016 13:11:43 +0100 Subject: _q_networkSessionClosed - disconnect the correct object We have: ... auto networkSession = getNetworkSession(); ... getNetworkSession() can return non-null pointer even if networkSessionStrongRef is null: ... if (networkSessionStrongRef) return networkSessionStrongRef; return networkSessionWeakRef.toStrongRef(); .... We check the result: if (networkSession) { // here we disconnect signals } But we should use the same networkSession when disconnecting, not start using networkSessionStrongRef suddenly, since it can be null. Task-number: QTBUG-57110 Change-Id: I96babb42c2182e741e6eabaf7d1abb88869861f4 Reviewed-by: Jesus Fernandez Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkaccessmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b649aba4a8..57d110ed94 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1599,7 +1599,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed() QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)), q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); - QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)), + QObject::disconnect(networkSession.data(), SIGNAL(error(QNetworkSession::SessionError)), q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError))); networkSessionStrongRef.clear(); -- cgit v1.2.3 From a4bd635b33d08a4b58fb4db8cefd1e0535fb95eb Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 21 Nov 2016 17:05:49 +0100 Subject: Typo fix in QDateTime::toString() documentation Text that should simply have been naming days of the week used Qt::Sunday rather than the simple day name. Change-Id: I64a3cdacd854c1c9c0fbf2d11826555086d674f4 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 3e29b55666..5f5023e8b5 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3611,7 +3611,7 @@ QString QDateTime::toString(Qt::DateFormat format) const \li the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses the system locale to localize the name, i.e. QLocale::system(). \row \li dddd - \li the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). + \li the long localized day name (e.g. 'Monday' to 'Sunday'). Uses the system locale to localize the name, i.e. QLocale::system(). \row \li M \li the month as number without a leading zero (1-12) \row \li MM \li the month as number with a leading zero (01-12) -- cgit v1.2.3 From 0aa3de46cacacdb83efe1d5e5b2506560c93c9ff Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 7 Nov 2016 10:09:06 +0100 Subject: Fix two leaky uses of realloc() If it fails, we get NULL back but haven't free()d the old pointer; saving the NULL return over the old pointer forgets it, leaking the memory it pointed to. This is particularly severe in the JSON parser's grow(), where reading a very large JSON document can lead to the last successful realloc() in a doubling pattern being very large indeed; the subsequent failure will leak this very last allocation. Only worth checking for, however, when the subsequent code takes care to handle failure: in most cases, if realloc() fails, we're about to crash anyway. Change-Id: Icd3a503f169be224f0a058c58e8b7c82a3241ae7 Reviewed-by: Marc Mutz Reviewed-by: Anton Kudryavtsev --- src/corelib/json/qjsonparser.cpp | 5 +++-- src/corelib/json/qjsonparser_p.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index c7b16d5ec9..a23741a85c 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -491,9 +491,10 @@ namespace { memcpy(newValues, data, size*sizeof(QJsonPrivate::Value)); data = newValues; } else { - data = static_cast(realloc(data, alloc*sizeof(QJsonPrivate::Value))); - if (!data) + void *newValues = realloc(data, alloc * sizeof(QJsonPrivate::Value)); + if (!newValues) return false; + data = static_cast(newValues); } return true; } diff --git a/src/corelib/json/qjsonparser_p.h b/src/corelib/json/qjsonparser_p.h index 82a7899a51..b17d75fb3a 100644 --- a/src/corelib/json/qjsonparser_p.h +++ b/src/corelib/json/qjsonparser_p.h @@ -101,11 +101,12 @@ private: inline int reserveSpace(int space) { if (current + space >= dataLength) { dataLength = 2*dataLength + space; - data = (char *)realloc(data, dataLength); - if (!data) { + char *newData = (char *)realloc(data, dataLength); + if (!newData) { lastError = QJsonParseError::DocumentTooLarge; return -1; } + data = newData; } int pos = current; current += space; -- cgit v1.2.3 From 7c41ced98c3cb5484069c14c45733d3129e7945a Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 2 Feb 2016 17:35:09 +0100 Subject: QDateTimeParser: introduce at least some encapsulation Shuffled its parts to make clear which bits are public, private and protected. QDateTimeEditPrivate makes rather heavy use of the last. Change-Id: Ic5f9d0c5cc85f02e57d3f31e9ac31a17428c5311 Reviewed-by: Timur Pocheptsov --- src/corelib/tools/qdatetimeparser_p.h | 81 ++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index 90c6a8acba..0ac7532aed 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -97,14 +97,6 @@ public: none.zeroesAdded = 0; } virtual ~QDateTimeParser() {} - enum AmPmFinder { - Neither = -1, - AM = 0, - PM = 1, - PossibleAM = 2, - PossiblePM = 3, - PossibleBoth = 4 - }; enum Section { NoSection = 0x00000, @@ -180,62 +172,75 @@ public: #ifndef QT_NO_DATESTRING StateNode parse(QString &input, int &cursorPosition, const QDateTime ¤tValue, bool fixup) const; #endif - int sectionMaxSize(int index) const; - int sectionSize(int index) const; - int sectionMaxSize(Section s, int count) const; - int sectionPos(int index) const; - int sectionPos(const SectionNode &sn) const; - - const SectionNode §ionNode(int index) const; - Section sectionType(int index) const; - QString sectionText(int sectionIndex) const; - QString sectionText(const QString &text, int sectionIndex, int index) const; - int getDigit(const QDateTime &dt, int index) const; - bool setDigit(QDateTime &t, int index, int newval) const; - int parseSection(const QDateTime ¤tValue, int sectionIndex, QString &txt, int &cursorPosition, - int index, QDateTimeParser::State &state, int *used = 0) const; - int absoluteMax(int index, const QDateTime &value = QDateTime()) const; - int absoluteMin(int index) const; bool parseFormat(const QString &format); #ifndef QT_NO_DATESTRING bool fromString(const QString &text, QDate *date, QTime *time) const; #endif + enum FieldInfoFlag { + Numeric = 0x01, + FixedWidth = 0x02, + AllowPartial = 0x04, + Fraction = 0x08 + }; + Q_DECLARE_FLAGS(FieldInfo, FieldInfoFlag) + + FieldInfo fieldInfo(int index) const; + + void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; } + virtual QString displayText() const { return text; } + +private: + int sectionMaxSize(Section s, int count) const; + QString sectionText(const QString &text, int sectionIndex, int index) const; + int parseSection(const QDateTime ¤tValue, int sectionIndex, QString &txt, int &cursorPosition, + int index, QDateTimeParser::State &state, int *used = 0) const; #ifndef QT_NO_TEXTDATE int findMonth(const QString &str1, int monthstart, int sectionIndex, QString *monthName = 0, int *used = 0) const; int findDay(const QString &str1, int intDaystart, int sectionIndex, QString *dayName = 0, int *used = 0) const; #endif + + enum AmPmFinder { + Neither = -1, + AM = 0, + PM = 1, + PossibleAM = 2, + PossiblePM = 3, + PossibleBoth = 4 + }; AmPmFinder findAmPm(QString &str, int index, int *used = 0) const; bool potentialValue(const QString &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const; - bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const; - QString stateName(State s) const; +protected: // for the benefit of QDateTimeEditPrivate + int sectionSize(int index) const; + int sectionMaxSize(int index) const; + int sectionPos(int index) const; + int sectionPos(const SectionNode &sn) const; - enum FieldInfoFlag { - Numeric = 0x01, - FixedWidth = 0x02, - AllowPartial = 0x04, - Fraction = 0x08 - }; - Q_DECLARE_FLAGS(FieldInfo, FieldInfoFlag) + const SectionNode §ionNode(int index) const; + Section sectionType(int index) const; + QString sectionText(int sectionIndex) const; + int getDigit(const QDateTime &dt, int index) const; + bool setDigit(QDateTime &t, int index, int newval) const; - FieldInfo fieldInfo(int index) const; + int absoluteMax(int index, const QDateTime &value = QDateTime()) const; + int absoluteMin(int index) const; - void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; } + bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const; + QString stateName(State s) const; virtual QDateTime getMinimum() const; virtual QDateTime getMaximum() const; virtual int cursorPosition() const { return -1; } - virtual QString displayText() const { return text; } virtual QString getAmPmText(AmPm ap, Case cs) const; virtual QLocale locale() const { return defaultLocale; } mutable int currentSectionIndex; Sections display; /* - This stores the stores the most recently selected day. + This stores the most recently selected day. It is useful when considering the following scenario: 1. Date is: 31/01/2000 @@ -255,9 +260,7 @@ public: QString displayFormat; QLocale defaultLocale; QVariant::Type parserType; - bool fixday; - Qt::TimeSpec spec; // spec if used by QDateTimeEdit Context context; }; -- cgit v1.2.3 From dc4c647137257fc7d3081db5d52f722c754e7dcb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 21 Nov 2016 15:44:36 +0100 Subject: Clean up the resource reading code Instead of doing the conversion from the big-endian data by hand, let's use the convenience functions from qendian.h. Change-Id: If3966ca94428afabb1f5c922967fb9970f976622 Reviewed-by: hjk --- src/corelib/io/qresource.cpp | 69 +++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 72042e1600..febf22639c 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -49,6 +49,7 @@ #include "qdatetime.h" #include "qbytearray.h" #include "qstringlist.h" +#include "qendian.h" #include #include #include "private/qabstractfileengine_p.h" @@ -606,11 +607,9 @@ inline uint QResourceRoot::hash(int node) const if(!node) //root return 0; const int offset = findOffset(node); - int name_offset = (tree[offset+0] << 24) + (tree[offset+1] << 16) + - (tree[offset+2] << 8) + (tree[offset+3] << 0); + qint32 name_offset = qFromBigEndian(tree + offset); name_offset += 2; //jump past name length - return (names[name_offset+0] << 24) + (names[name_offset+1] << 16) + - (names[name_offset+2] << 8) + (names[name_offset+3] << 0); + return qFromBigEndian(names + name_offset); } inline QString QResourceRoot::name(int node) const { @@ -619,10 +618,8 @@ inline QString QResourceRoot::name(int node) const const int offset = findOffset(node); QString ret; - int name_offset = (tree[offset+0] << 24) + (tree[offset+1] << 16) + - (tree[offset+2] << 8) + (tree[offset+3] << 0); - const short name_length = (names[name_offset+0] << 8) + - (names[name_offset+1] << 0); + qint32 name_offset = qFromBigEndian(tree + offset); + const qint16 name_length = qFromBigEndian(names + name_offset); name_offset += 2; name_offset += 4; //jump past hash @@ -662,10 +659,8 @@ int QResourceRoot::findNode(const QString &_path, const QLocale &locale) const return 0; //the root node is always first - int child_count = (tree[6] << 24) + (tree[7] << 16) + - (tree[8] << 8) + (tree[9] << 0); - int child = (tree[10] << 24) + (tree[11] << 16) + - (tree[12] << 8) + (tree[13] << 0); + qint32 child_count = qFromBigEndian(tree + 6); + qint32 child = qFromBigEndian(tree + 10); //now iterate up the tree int node = -1; @@ -711,18 +706,15 @@ int QResourceRoot::findNode(const QString &_path, const QLocale &locale) const #endif offset += 4; //jump past name - const short flags = (tree[offset+0] << 8) + - (tree[offset+1] << 0); + const qint16 flags = qFromBigEndian(tree + offset); offset += 2; if(!splitter.hasNext()) { if(!(flags & Directory)) { - const short country = (tree[offset+0] << 8) + - (tree[offset+1] << 0); + const qint16 country = qFromBigEndian(tree + offset); offset += 2; - const short language = (tree[offset+0] << 8) + - (tree[offset+1] << 0); + const qint16 language = qFromBigEndian(tree + offset); offset += 2; #ifdef DEBUG_RESOURCE_MATCH qDebug() << " " << "LOCALE" << country << language; @@ -749,11 +741,9 @@ int QResourceRoot::findNode(const QString &_path, const QLocale &locale) const if(!(flags & Directory)) return -1; - child_count = (tree[offset+0] << 24) + (tree[offset+1] << 16) + - (tree[offset+2] << 8) + (tree[offset+3] << 0); + child_count = qFromBigEndian(tree + offset); offset += 4; - child = (tree[offset+0] << 24) + (tree[offset+1] << 16) + - (tree[offset+2] << 8) + (tree[offset+3] << 0); + child = qFromBigEndian(tree + offset); break; } } @@ -771,7 +761,7 @@ short QResourceRoot::flags(int node) const if(node == -1) return 0; const int offset = findOffset(node) + 4; //jump past name - return (tree[offset+0] << 8) + (tree[offset+1] << 0); + return qFromBigEndian(tree + offset); } const uchar *QResourceRoot::data(int node, qint64 *size) const { @@ -781,16 +771,14 @@ const uchar *QResourceRoot::data(int node, qint64 *size) const } int offset = findOffset(node) + 4; //jump past name - const short flags = (tree[offset+0] << 8) + (tree[offset+1] << 0); + const qint16 flags = qFromBigEndian(tree + offset); offset += 2; offset += 4; //jump past locale if(!(flags & Directory)) { - const int data_offset = (tree[offset+0] << 24) + (tree[offset+1] << 16) + - (tree[offset+2] << 8) + (tree[offset+3] << 0); - const uint data_length = (payloads[data_offset+0] << 24) + (payloads[data_offset+1] << 16) + - (payloads[data_offset+2] << 8) + (payloads[data_offset+3] << 0); + const qint32 data_offset = qFromBigEndian(tree + offset); + const quint32 data_length = qFromBigEndian(payloads + data_offset); const uchar *ret = payloads+data_offset+4; *size = data_length; return ret; @@ -806,10 +794,7 @@ QDateTime QResourceRoot::lastModified(int node) const const int offset = findOffset(node) + 14; - const quint64 timeStamp = (quint64(tree[offset+0]) << 56) + (quint64(tree[offset+1]) << 48) + - (quint64(tree[offset+2]) << 40) + (quint64(tree[offset+3]) << 32) + - (quint64(tree[offset+4]) << 24) + (quint64(tree[offset+5]) << 16) + - (quint64(tree[offset+6]) << 8) + (quint64(tree[offset+7])); + const quint64 timeStamp = qFromBigEndian(tree + offset); if (timeStamp == 0) return QDateTime(); @@ -822,16 +807,14 @@ QStringList QResourceRoot::children(int node) const return QStringList(); int offset = findOffset(node) + 4; //jump past name - const short flags = (tree[offset+0] << 8) + (tree[offset+1] << 0); + const qint16 flags = qFromBigEndian(tree + offset); offset += 2; QStringList ret; if(flags & Directory) { - const int child_count = (tree[offset+0] << 24) + (tree[offset+1] << 16) + - (tree[offset+2] << 8) + (tree[offset+3] << 0); + const qint32 child_count = qFromBigEndian(tree + offset); offset += 4; - const int child_off = (tree[offset+0] << 24) + (tree[offset+1] << 16) + - (tree[offset+2] << 8) + (tree[offset+3] << 0); + const qint32 child_off = qFromBigEndian(tree + offset); ret.reserve(child_count); for(int i = child_off; i < child_off+child_count; ++i) ret << name(i); @@ -935,20 +918,16 @@ public: } offset += 4; - const int version = (b[offset+0] << 24) + (b[offset+1] << 16) + - (b[offset+2] << 8) + (b[offset+3] << 0); + const int version = qFromBigEndian(b + offset); offset += 4; - const int tree_offset = (b[offset+0] << 24) + (b[offset+1] << 16) + - (b[offset+2] << 8) + (b[offset+3] << 0); + const int tree_offset = qFromBigEndian(b + offset); offset += 4; - const int data_offset = (b[offset+0] << 24) + (b[offset+1] << 16) + - (b[offset+2] << 8) + (b[offset+3] << 0); + const int data_offset = qFromBigEndian(b + offset); offset += 4; - const int name_offset = (b[offset+0] << 24) + (b[offset+1] << 16) + - (b[offset+2] << 8) + (b[offset+3] << 0); + const int name_offset = qFromBigEndian(b + offset); offset += 4; // Some sanity checking for sizes. This is _not_ a security measure. -- cgit v1.2.3 From 34be7dc9d09c45a5e47a13716ee4db70f95dabcf Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 23 Nov 2016 11:50:35 +0100 Subject: Optimize fontdatabase fallbacksForFamily Short-cut the case-insensitive string comparison when lengths doesn't match. This reduces the time spend in ucstricmp from 8% during start-up of the textedit example, to under 1%. Change-Id: Ib3a92900b330453289ec9eff4830dfac6a9a5da2 Reviewed-by: Thiago Macieira --- src/gui/text/qfontdatabase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index d2da24ca94..5145385fdc 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -406,9 +406,14 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) return foundries[count++]; } +static inline bool equalsCaseInsensitive(const QString &a, const QString &b) +{ + return a.size() == b.size() && a.compare(b, Qt::CaseInsensitive) == 0; +} + bool QtFontFamily::matchesFamilyName(const QString &familyName) const { - return name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive); + return equalsCaseInsensitive(name, familyName) || aliases.contains(familyName, Qt::CaseInsensitive); } void QtFontFamily::ensurePopulated() -- cgit v1.2.3 From 4f896ba34e0f56e492da19c6d1353ac4ba4c7b2e Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Wed, 23 Nov 2016 11:39:31 +0100 Subject: ICC: Fix MySQL driver build In function `QMYSQLDriver::formatValue(QSqlField const&, bool) const': qsql_mysql.cpp:1569: undefined reference to `QString::operator=( QLatin1String) Change-Id: I56104cdd53fdc083670510f24b735cf05948f156 Reviewed-by: Samuel Gaist Reviewed-by: Milian Wolff Reviewed-by: Thiago Macieira --- src/sql/drivers/mysql/qsql_mysql.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index c26c03ad07..4e86a0bd4e 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -1566,7 +1566,7 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons Q_D(const QMYSQLDriver); QString r; if (field.isNull()) { - r = QLatin1String("NULL"); + r = QStringLiteral("NULL"); } else { switch(field.type()) { case QVariant::Double: -- cgit v1.2.3 From 72ed34b792f5acca5e0ada3b3d753b7a16274ff6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 17 Nov 2016 13:23:47 +0100 Subject: Don't set platform specific QT_NO_FOO defines in qglobal.h They should be enabled/disabled through the configuration system. Remove some unused defines, and move one define from qglobal.h to a proper feature definition in Qt Gui. Change-Id: Ie8d5bff9712ba745af60b42ceca3f0440bed2706 Reviewed-by: Thiago Macieira --- src/corelib/configure.json | 8 ++++++- src/corelib/global/qglobal.h | 26 ---------------------- src/gui/configure.json | 7 ++++++ src/network/configure.json | 2 ++ .../services/genericunix/qgenericunixservices.cpp | 3 ++- 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 5017f4652a..0d1954c3a8 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -396,13 +396,17 @@ "label": "QSharedMemory", "purpose": "Provides access to a shared memory segment.", "section": "Kernel", + "condition": "!config.vxworks", "output": [ "publicFeature", "feature" ] }, "systemsemaphore": { "label": "QSystemSemaphore", "purpose": "Provides a general counting system semaphore.", "section": "Kernel", - "condition": "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix", + "condition": [ + "!config.integrity && !config.vxworks", + "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix" + ], "output": [ "publicFeature", "feature" ] }, "xmlstream": { @@ -442,6 +446,7 @@ "label": "QProcess", "purpose": "Supports external process invocation.", "section": "File I/O", + "condition": "!config.winrt && !config.uikit && !config.integrity && !config.vxworks", "output": [ "publicFeature", "feature" ] }, "temporaryfile": { @@ -466,6 +471,7 @@ "label": "QFileSystemWatcher", "purpose": "Provides an interface for monitoring files and directories for modifications.", "section": "File I/O", + "condition": "!config.winrt", "output": [ "publicFeature", "feature" ] }, "filesystemiterator": { diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 99be82f8c3..1737f58c87 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -619,32 +619,6 @@ private: class QDataStream; -#if defined(Q_OS_VXWORKS) -# define QT_NO_CRASHHANDLER // no popen -# define QT_NO_PROCESS // no exec*, no fork -# define QT_NO_SHAREDMEMORY // only POSIX, no SysV and in the end... -# define QT_NO_SYSTEMSEMAPHORE // not needed at all in a flat address space -#endif - -#if defined(Q_OS_WINRT) -# define QT_NO_FILESYSTEMWATCHER -# define QT_NO_NETWORKPROXY -# define QT_NO_PROCESS -# define QT_NO_SOCKETNOTIFIER -# define QT_NO_SOCKS5 -#endif - -#if defined(QT_PLATFORM_UIKIT) -# define QT_NO_PROCESS -#endif - -#if defined(Q_OS_INTEGRITY) -# define QT_NO_CRASHHANDLER // no popen -# define QT_NO_PROCESS // no exec*, no fork -# define QT_NO_SYSTEMSEMAPHORE // not needed at all in a single AddressSpace -# define QT_NO_MULTIPROCESS // no system -#endif - inline void qt_noop(void) {} /* These wrap try/catch so we can switch off exceptions later. diff --git a/src/gui/configure.json b/src/gui/configure.json index 6fba8173b4..1f5011617c 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -964,6 +964,13 @@ "section": "Utilities", "condition": "features.properties", "output": [ "publicFeature", "feature" ] + }, + "multiprocess": { + "label": "Multi process", + "description": "Provides support for detecting the desktop environment, launching external processes and opening URLs.", + "section": "Utilities", + "condition": "!config.integrity", + "output": [ "privateFeature" ] } }, diff --git a/src/network/configure.json b/src/network/configure.json index 30a1c39c0c..1e08aa7c49 100644 --- a/src/network/configure.json +++ b/src/network/configure.json @@ -207,12 +207,14 @@ "label": "QNetworkProxy", "purpose": "Provides network proxy support.", "section": "Networking", + "condition": "!config.winrt", "output": [ "publicFeature", "feature" ] }, "socks5": { "label": "SOCKS5", "purpose": "Provides SOCKS5 support in QNetworkProxy.", "section": "Networking", + "condition": "!config.winrt", "output": [ "publicFeature", "feature" ] }, "networkinterface": { diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp index 5242f00193..a24ab82057 100644 --- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp +++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qgenericunixservices_p.h" +#include #include #include @@ -48,7 +49,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_MULTIPROCESS +#if QT_CONFIG(multiprocess) enum { debug = 0 }; -- cgit v1.2.3 From 0861c2176c6dc1c69b733c1a843c2db5ec8ea786 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 13:39:32 +0100 Subject: Use harfbuzz feature to check for HarfBuzz instead of defining a special macro for it. Change-Id: I715380717f7d871571f663be30b73f7d95d83d71 Reviewed-by: Konstantin Ritt --- src/gui/text/qfontengine.cpp | 10 +++++----- src/gui/text/qharfbuzzng_p.h | 3 +++ src/gui/text/qtextengine.cpp | 19 ++++++++++--------- src/gui/text/qtextengine_p.h | 2 +- src/gui/text/text.pri | 4 +--- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 74ea8d15b7..a7d7185a7e 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -53,7 +53,7 @@ #include #include -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) # include "qharfbuzzng_p.h" # include #endif @@ -93,7 +93,7 @@ static inline bool qSafeFromBigEndian(const uchar *source, const uchar *end, T * // Harfbuzz helper functions -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) Q_GLOBAL_STATIC_WITH_ARGS(bool, useHarfbuzzNG,(qgetenv("QT_HARFBUZZ") != "old")) bool qt_useHarfbuzzNG() @@ -296,7 +296,7 @@ QFixed QFontEngine::underlinePosition() const void *QFontEngine::harfbuzzFont() const { Q_ASSERT(type() != QFontEngine::Multi); -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) if (qt_useHarfbuzzNG()) return hb_qt_font_get_for_engine(const_cast(this)); #endif @@ -331,7 +331,7 @@ void *QFontEngine::harfbuzzFont() const void *QFontEngine::harfbuzzFace() const { Q_ASSERT(type() != QFontEngine::Multi); -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) if (qt_useHarfbuzzNG()) return hb_qt_face_get_for_engine(const_cast(this)); #endif @@ -363,7 +363,7 @@ bool QFontEngine::supportsScript(QChar::Script script) const return true; } -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) if (qt_useHarfbuzzNG()) { #if defined(Q_OS_DARWIN) // in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table diff --git a/src/gui/text/qharfbuzzng_p.h b/src/gui/text/qharfbuzzng_p.h index 95a21eedb6..fabf222bae 100644 --- a/src/gui/text/qharfbuzzng_p.h +++ b/src/gui/text/qharfbuzzng_p.h @@ -53,6 +53,9 @@ // #include + +QT_REQUIRE_CONFIG(harfbuzz); + #include #include diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 742b01dd1f..67cafa53fe 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include #include "qdebug.h" #include "qtextformat.h" #include "qtextformat_p.h" @@ -837,7 +838,7 @@ enum JustificationClass { Justification_Arabic_Kashida = 13 // User-inserted Kashida(U+0640) }; -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) /* Adds an inter character justification opportunity after the number or letter @@ -916,7 +917,7 @@ static inline void qt_getJustificationOpportunities(const ushort *string, int le qt_getDefaultJustificationOpportunities(string, length, g, log_clusters, spaceAs); } -#endif // QT_ENABLE_HARFBUZZ_NG +#endif // harfbuzz // shape all the items that intersect with the line, taking tab widths into account to find out what text actually fits in the line. @@ -950,7 +951,7 @@ void QTextEngine::shapeLine(const QScriptLine &line) } } -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp #endif @@ -1063,7 +1064,7 @@ void QTextEngine::shapeText(int item) const letterSpacing *= font.d->dpi / qt_defaultDpiY(); } -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) if (Q_LIKELY(qt_useHarfbuzzNG())) si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled, letterSpacing != 0); else @@ -1079,7 +1080,7 @@ void QTextEngine::shapeText(int item) const QGlyphLayout glyphs = shapedGlyphs(&si); -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) if (Q_LIKELY(qt_useHarfbuzzNG())) qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si)); #endif @@ -1119,7 +1120,7 @@ void QTextEngine::shapeText(int item) const si.width += glyphs.advances[i] * !glyphs.attributes[i].dontPrint; } -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) QT_BEGIN_INCLUDE_NAMESPACE @@ -1313,7 +1314,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, return glyphs_shaped; } -#endif // QT_ENABLE_HARFBUZZ_NG +#endif // harfbuzz QT_BEGIN_INCLUDE_NAMESPACE @@ -1669,7 +1670,7 @@ void QTextEngine::itemize() const analysis->flags = QScriptAnalysis::None; break; } -#ifndef QT_ENABLE_HARFBUZZ_NG +#if !QT_CONFIG(harfbuzz) analysis->script = hbscript_to_script(script_to_hbscript(analysis->script)); #endif ++uc; @@ -1678,7 +1679,7 @@ void QTextEngine::itemize() const if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) { (analysis-1)->flags = QScriptAnalysis::LineOrParagraphSeparator; // to exclude it from width } -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) analysis = scriptAnalysis.data(); if (qt_useHarfbuzzNG()) { // ### pretend HB-old behavior for now diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 160e9ce490..f49e2638f5 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -649,7 +649,7 @@ private: void setBoundary(int strPos) const; void addRequiredBoundaries() const; void shapeText(int item) const; -#ifdef QT_ENABLE_HARFBUZZ_NG +#if QT_CONFIG(harfbuzz) int shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *string, int itemLength, diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index a15793ec2f..efd041a5af 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -78,9 +78,7 @@ SOURCES += \ HEADERS += \ text/qplatformfontdatabase.h -qtConfig(harfbuzz)|qtConfig(system-harfbuzz) { - DEFINES += QT_ENABLE_HARFBUZZ_NG - +qtConfig(harfbuzz) { QMAKE_USE_PRIVATE += harfbuzz SOURCES += text/qharfbuzzng.cpp -- cgit v1.2.3 From 5bd2d6afec935a9eb4cf39af830f450f89f7202a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 24 Nov 2016 10:54:03 +0200 Subject: Remove nokia reference in example mimetype Change-Id: I45c01fd57171f4ba6ea195d7ad3ae988a1797acb Reviewed-by: Oswald Buddenhagen Reviewed-by: David Faure --- src/corelib/mimetypes/qmimedatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index 5c272d420b..91b50494d0 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -257,7 +257,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent) \code - + Qt qmake Profile -- cgit v1.2.3 From 17d72c783747dd8d9ce767002988d5d5a54a790e Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sat, 19 Nov 2016 08:55:33 +0200 Subject: Android: All gcc flags should be set for clang too gcc-base-unix.conf must be included before clang.conf because clang.conf doesn't set all the needed flags. Change-Id: I71f95732d0d245096b575c91610800d91c6aa5d7 Reviewed-by: Vyacheslav Koscheev Reviewed-by: Oswald Buddenhagen --- mkspecs/android-clang/qmake.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf index c33bbe7eed..3e621c7d77 100644 --- a/mkspecs/android-clang/qmake.conf +++ b/mkspecs/android-clang/qmake.conf @@ -6,6 +6,7 @@ QMAKE_COMPILER = gcc clang llvm CONFIG += android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings include(../common/linux.conf) +include(../common/gcc-base-unix.conf) include(../common/clang.conf) include(../common/android-base-head.conf) -- cgit v1.2.3 From 600c5a7e1bb59f97205e0a50ccc05937a31b9480 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 15 Nov 2016 14:43:45 +0100 Subject: Document third-party code in Cocoa QPA plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2c30f5da25c83d6129403cb9b745a2f17fd6fd9e Reviewed-by: Topi Reiniö --- src/plugins/platforms/cocoa/COCOA_LICENSE.txt | 29 +++++++++++++++++++++++++ src/plugins/platforms/cocoa/qt_attribution.json | 13 +++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/plugins/platforms/cocoa/COCOA_LICENSE.txt create mode 100644 src/plugins/platforms/cocoa/qt_attribution.json diff --git a/src/plugins/platforms/cocoa/COCOA_LICENSE.txt b/src/plugins/platforms/cocoa/COCOA_LICENSE.txt new file mode 100644 index 0000000000..8c08f48528 --- /dev/null +++ b/src/plugins/platforms/cocoa/COCOA_LICENSE.txt @@ -0,0 +1,29 @@ +Copyright (c) 2007-2008, Apple, Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Apple, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/plugins/platforms/cocoa/qt_attribution.json b/src/plugins/platforms/cocoa/qt_attribution.json new file mode 100644 index 0000000000..37c0937f29 --- /dev/null +++ b/src/plugins/platforms/cocoa/qt_attribution.json @@ -0,0 +1,13 @@ +{ + "Id": "cocoa-platform-plugin", + "Name": "Cocoa Platform Plugin", + "QDocModule": "qtgui", + "QtUsage": "Code used in the Qt Platform Abstraction (QPA) for macOS.", + "Files": "qcocoaapplication.h qcocoaapplication.mm qcocoaapplicationdelegate.h qcocoaapplicationdelegate.mm qcocoaeventdispatcher.h qcocoaeventdispatcher.mm qcocoaintrospection.h qcocoaintrospection.mm qcocoasystemtrayicon.mm qmacdefines_mac.h", + + "Description": "Allows Qt to integrate into Apple's Cocoa API.", + "LicenseId": "BSD-3-Clause", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseFile": "COCOA_LICENSE.txt", + "Copyright": "Copyright (c) 2007-2008, Apple, Inc." +} -- cgit v1.2.3 From 8a2f5445231fc871a9fd88dec5569deb3104983d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Nov 2016 10:49:44 +0100 Subject: tst_qsql.cpp: Remove deprecated module include Fix warning: include/QtSql/qsql.h:4:4: warning: #warning Header is deprecated. Please include instead. [-Wcpp] Change-Id: I254c6ac9ddb0f49a7f4dc8b3de44fd1010f6243e Reviewed-by: Andy Shaw --- tests/auto/sql/kernel/qsql/tst_qsql.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/sql/kernel/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp index 282fed2584..2ce43b85a7 100644 --- a/tests/auto/sql/kernel/qsql/tst_qsql.cpp +++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From 5cd4001bf2a7f0894c6ac269860e833b02df6cde Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Fri, 25 Nov 2016 13:12:54 +0300 Subject: Use separate Qt5Config.cmake inside build directory Qt5Config restricts search paths of Qt components to ${_qt5_install_prefix} to prevent accidentally using system Qt modules in case of restricted Qt configuration. However this does not work properly when Qt is used without installation, in particular when building cmake-based QtWebKit as a Qt submodule, because ${_qt5_install_prefix} resolves to QtBase and does not contain components from other modules. This patch changes search path from ${_qt5_install_prefix} to all qt5 subdirectories. Change-Id: Icf01a256097710889573ad69d847b9c3bffa1449 Reviewed-by: Kevin Funk Reviewed-by: Oswald Buddenhagen --- src/corelib/Qt5Config.cmake.in | 12 +++++++++--- src/corelib/Qt5ModuleLocation.cmake.in | 15 +++++++++++++++ src/corelib/Qt5ModuleLocationForInstall.cmake.in | 4 ++++ src/corelib/corelib.pro | 21 +++++++++++++++++++-- 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 src/corelib/Qt5ModuleLocation.cmake.in create mode 100644 src/corelib/Qt5ModuleLocationForInstall.cmake.in diff --git a/src/corelib/Qt5Config.cmake.in b/src/corelib/Qt5Config.cmake.in index a872d0e917..75b53485b7 100644 --- a/src/corelib/Qt5Config.cmake.in +++ b/src/corelib/Qt5Config.cmake.in @@ -22,18 +22,24 @@ get_filename_component(_qt5_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/..\" ABSO set(_Qt5_NOTFOUND_MESSAGE) +include(${CMAKE_CURRENT_LIST_DIR}/Qt5ModuleLocation.cmake) + foreach(module ${Qt5_FIND_COMPONENTS}) find_package(Qt5${module} ${_Qt5_FIND_PARTS_QUIET} ${_Qt5_FIND_PARTS_REQUIRED} - PATHS \"${_qt5_install_prefix}\" NO_DEFAULT_PATH + PATHS ${_qt5_module_paths} NO_DEFAULT_PATH ) if (NOT Qt5${module}_FOUND) + string(CONFIGURE ${_qt5_module_location_template} _expected_module_location @ONLY) + if (Qt5_FIND_REQUIRED_${module}) - set(_Qt5_NOTFOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/Qt5${module}/Qt5${module}Config.cmake\\\"\\n\") + set(_Qt5_NOTFOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_expected_module_location}\\\"\\n\") elseif(NOT Qt5_FIND_QUIETLY) - message(WARNING \"Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/Qt5${module}/Qt5${module}Config.cmake\\\"\") + message(WARNING \"Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_expected_module_location}\\\"\") endif() + + unset(_expected_module_location) endif() endforeach() diff --git a/src/corelib/Qt5ModuleLocation.cmake.in b/src/corelib/Qt5ModuleLocation.cmake.in new file mode 100644 index 0000000000..5065ada56e --- /dev/null +++ b/src/corelib/Qt5ModuleLocation.cmake.in @@ -0,0 +1,15 @@ +!!IF !isEmpty(_QMAKE_SUPER_CACHE_) +get_filename_component(_qt5_root_dir \"${CMAKE_CURRENT_LIST_DIR}/../../../..\" ABSOLUTE) + +file(GLOB qtmodules ${_qt5_root_dir} "${_qt5_root_dir}/*") +foreach(qtmodule ${qtmodules}) + if(IS_DIRECTORY ${qtmodule}) + list(APPEND _qt5_module_paths ${qtmodule}) + endif() +endforeach() +!!ELSE +set(_qt5_root_dir ${_qt5_install_prefix}) +set(_qt5_module_paths ${_qt5_install_prefix}) +!!ENDIF + +set(_qt5_module_location_template ${_qt5_root_dir}) diff --git a/src/corelib/Qt5ModuleLocationForInstall.cmake.in b/src/corelib/Qt5ModuleLocationForInstall.cmake.in new file mode 100644 index 0000000000..e401b1fe34 --- /dev/null +++ b/src/corelib/Qt5ModuleLocationForInstall.cmake.in @@ -0,0 +1,4 @@ +set(_qt5_root_dir ${_qt5_install_prefix}) +set(_qt5_module_paths ${_qt5_install_prefix}) + +set(_qt5_module_location_template ${_qt5_install_prefix}/Qt5@module@/Qt5@module@Config.cmake) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 616a9641a1..0bd7c9b99d 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -93,6 +93,12 @@ ctest_macros_file.CONFIG = verbatim cmake_umbrella_config_file.input = $$PWD/Qt5Config.cmake.in cmake_umbrella_config_file.output = $$DESTDIR/cmake/Qt5/Qt5Config.cmake +cmake_umbrella_config_module_location.input = $$PWD/Qt5ModuleLocation.cmake.in +cmake_umbrella_config_module_location.output = $$DESTDIR/cmake/Qt5/Qt5ModuleLocation.cmake + +cmake_umbrella_config_module_location_for_install.input = $$PWD/Qt5ModuleLocationForInstall.cmake.in +cmake_umbrella_config_module_location_for_install.output = $$DESTDIR/cmake/install/Qt5/Qt5ModuleLocation.cmake + cmake_umbrella_config_version_file.input = $$PWD/../../mkspecs/features/data/cmake/Qt5ConfigVersion.cmake.in cmake_umbrella_config_version_file.output = $$DESTDIR/cmake/Qt5/Qt5ConfigVersion.cmake @@ -119,10 +125,21 @@ contains(CMAKE_INSTALL_DATA_DIR, "^\\.\\./.*"):!isEmpty(CMAKE_INSTALL_DATA_DIR) cmake_extras_mkspec_dir_for_install.input = $$PWD/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in cmake_extras_mkspec_dir_for_install.output = $$DESTDIR/cmake/install/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake -cmake_qt5_umbrella_module_files.files = $$cmake_umbrella_config_file.output $$cmake_umbrella_config_version_file.output +cmake_qt5_umbrella_module_files.files = \ + $$cmake_umbrella_config_file.output \ + $$cmake_umbrella_config_version_file.output \ + $$cmake_umbrella_config_module_location_for_install.output + cmake_qt5_umbrella_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5 -QMAKE_SUBSTITUTES += ctest_macros_file cmake_umbrella_config_file cmake_umbrella_config_version_file cmake_extras_mkspec_dir cmake_extras_mkspec_dir_for_install +QMAKE_SUBSTITUTES += \ + ctest_macros_file \ + cmake_umbrella_config_file \ + cmake_umbrella_config_module_location \ + cmake_umbrella_config_module_location_for_install \ + cmake_umbrella_config_version_file \ + cmake_extras_mkspec_dir \ + cmake_extras_mkspec_dir_for_install ctest_qt5_module_files.files += $$ctest_macros_file.output $$cmake_extras_mkspec_dir_for_install.output -- cgit v1.2.3 From 032971af2f15de231658eebdb12e5f821132238e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Nov 2016 12:56:07 +0100 Subject: tests/manual,auto/qstorageinfo: Use function pointer in print helper Fix warning about unused variable printer in auto-test and redirects output to qInfo() as intended. Amends change a26435d65ceac5d714d5cc7d5af2326e162d7a41. Change-Id: Ia72a93267a54b9c4f9ef37fa058b95ef586ecc75 Reviewed-by: Simon Hausmann --- tests/manual/qstorageinfo/printvolumes.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/manual/qstorageinfo/printvolumes.cpp b/tests/manual/qstorageinfo/printvolumes.cpp index 1b1660b433..6089d5120a 100644 --- a/tests/manual/qstorageinfo/printvolumes.cpp +++ b/tests/manual/qstorageinfo/printvolumes.cpp @@ -42,17 +42,17 @@ void printVolumes(const QList &volumes, int (*printer)(const char // 214958080 39088272 4096 / // /dev/disk1s2 (hfs) RW 488050672 419909696 4096 Macintosh HD2 /Volumes/Macintosh HD2 - printf("Filesystem (Type) Size Available BSize Label Mounted on\n"); + printer("Filesystem (Type) Size Available BSize Label Mounted on\n"); foreach (const QStorageInfo &info, volumes) { QByteArray fsAndType = info.device(); if (info.fileSystemType() != fsAndType) fsAndType += " (" + info.fileSystemType() + ')'; - printf("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W'); + printer("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W'); if (fsAndType.size() > 19) - printf("\n%23s", ""); + printer("\n%23s", ""); - printf("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize()); - printf("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath())); + printer("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize()); + printer("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath())); } } -- cgit v1.2.3 From 38259594e2cbb371a34942e98ab4fca1028fd497 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Nov 2016 14:19:12 +0100 Subject: fix use of $$QMAKE_QMAKE, take 2 we can't use $(QMAKE) after all, as this breaks with the visual studio generator. so massage $$QMAKE_QMAKE into the final form manually instead. supersedes 591d9588f in amending 2b6bcd5ff. Change-Id: I8c7a6c43f9668d88c1cc968dbf5614240f16239a Reviewed-by: Joerg Bornemann --- mkspecs/features/moc.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index bdb4eb49ec..dc14d71db7 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -32,7 +32,8 @@ if(gcc|intel_icl|msvc):!rim_qcc:!uikit { gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} else:msvc { - moc_predefs.commands += $$QMAKE_CXX -Bx$(QMAKE) $$QMAKE_CXXFLAGS -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} + moc_predefs.commands += $$QMAKE_CXX -Bx$$shell_quote($$shell_path($$QMAKE_QMAKE)) $$QMAKE_CXXFLAGS \ + -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} } else: error("Oops, I messed up") moc_predefs.output = $$MOC_DIR/moc_predefs.h moc_predefs.input = MOC_PREDEF_FILE -- cgit v1.2.3 From f91bbd243890511c99a084a478e7abe96d334860 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Nov 2016 17:01:24 +0100 Subject: make handling of qml module search path saner excise knowledge of QTREPOS from qt.prf - this is a private variable of the qt build system which the public functions should not know anything about. instead, move this handling to a function in qt_build_config.prf (where QTREPOS comes from in the first place), and call it from qt_app.prf and qt_example_installs.prf (which should be the only consumers within qt). qt.prf now also checks that the qml install dir actually exists, which is not the case during a modular prefix build of qtdeclarative. not really incidentally, this fixes modular static builds of qtdeclarative. Task-number: QTBUG-57308 Change-Id: I31465b9cd400483264fc236934c6f9f26a5fdd73 Reviewed-by: Simon Hausmann --- mkspecs/features/qt.prf | 9 ++------- mkspecs/features/qt_app.prf | 2 ++ mkspecs/features/qt_build_config.prf | 16 ++++++++++++++++ mkspecs/features/qt_example_installs.prf | 3 +++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 9bf0d2fad3..98f794c485 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -194,13 +194,8 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.") # static builds: link qml import plugins into the app. contains(qt_module_deps, qml): \ qtConfig(static):contains(TEMPLATE, .*app):!host_build:!no_import_scan { - !isEmpty(QTREPOS) { - for (qrep, QTREPOS): \ - exists($$qrep/qml): \ - QMLPATHS += $$qrep/qml - } else { - QMLPATHS += $$[QT_INSTALL_QML/get] - } + exists($$[QT_INSTALL_QML/get]): \ + QMLPATHS *= $$[QT_INSTALL_QML/get] # run qmlimportscanner qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, , system) diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf index 87e32d6d42..cb84ae0da8 100644 --- a/mkspecs/features/qt_app.prf +++ b/mkspecs/features/qt_app.prf @@ -37,6 +37,8 @@ INSTALLS += target load(qt_targets) load(qt_common) +qtSetQmlPath() + no_launch_target: return() load(resolve_target) diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index 95e63ecae0..3762c14f98 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -52,6 +52,22 @@ QMAKE_DIR_REPLACE_SANE = PRECOMPILED_DIR OBJECTS_DIR MOC_DIR RCC_DIR UI_DIR unset(modpath) } +defineTest(qtSetQmlPath) { + !qtConfig(static)|host_build|no_import_scan: \ + return() + deps = $$replace(QT, -private$, _private) + deps = $$resolve_depends(deps, "QT.") + !contains(deps, qml): \ + return() + + isEmpty(QTREPOS): \ + QTREPOS = $$shadowed($$dirname(_QMAKE_CONF_)) + for (qrep, QTREPOS): \ + exists($$qrep/qml): \ + QMLPATHS += $$qrep/qml + export(QMLPATHS) +} + # Apply extra compiler flags passed via configure last. CONFIG = qt_build_extra $$CONFIG diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf index 4c68cfd72f..0a008374e5 100644 --- a/mkspecs/features/qt_example_installs.prf +++ b/mkspecs/features/qt_example_installs.prf @@ -9,6 +9,9 @@ # We mean it. # +contains(TEMPLATE, .*app): \ + qtSetQmlPath() + contains(TEMPLATE, "vc.*"): return() defineTest(addInstallFiles) { -- cgit v1.2.3 From 011aeb131ed904d948b69d6444ff58cdbfd4990c Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 23 Nov 2016 02:02:53 +0300 Subject: Examples: Remove a redundant virtual specifier for overriders It's a good practice to use override without virtual: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override Change-Id: I5c2d73600e6c706424589c0487133c03a4ef3629 Reviewed-by: Friedemann Kleint --- examples/widgets/animation/appchooser/main.cpp | 6 ++-- examples/widgets/animation/moveblocks/main.cpp | 10 +++---- examples/widgets/animation/states/main.cpp | 2 +- examples/widgets/animation/stickman/graphicsview.h | 2 +- examples/widgets/animation/stickman/lifecycle.cpp | 4 +-- examples/widgets/animation/stickman/rectbutton.h | 6 ++-- examples/widgets/animation/stickman/stickman.h | 4 +-- examples/widgets/animation/sub-attaq/boat.h | 2 +- examples/widgets/animation/sub-attaq/boat_p.h | 6 ++-- examples/widgets/animation/sub-attaq/states.h | 6 ++-- examples/widgets/animation/sub-attaq/submarine.h | 2 +- examples/widgets/graphicsview/boxes/glbuffers.h | 12 ++++---- examples/widgets/graphicsview/boxes/qtbox.h | 32 +++++++++++----------- examples/widgets/graphicsview/boxes/scene.h | 22 +++++++-------- .../widgets/graphicsview/dragdroprobot/main.cpp | 2 +- .../graphicsview/weatheranchorlayout/main.cpp | 2 +- .../itemviews/frozencolumn/freezetablewidget.h | 4 +-- examples/widgets/richtext/textedit/textedit.h | 2 +- examples/widgets/statemachine/factorial/main.cpp | 8 +++--- examples/widgets/statemachine/pingpong/main.cpp | 6 ++-- .../widgets/statemachine/trafficlight/main.cpp | 2 +- 21 files changed, 71 insertions(+), 71 deletions(-) diff --git a/examples/widgets/animation/appchooser/main.cpp b/examples/widgets/animation/appchooser/main.cpp index c9821450c9..71c869f6a2 100644 --- a/examples/widgets/animation/appchooser/main.cpp +++ b/examples/widgets/animation/appchooser/main.cpp @@ -67,12 +67,12 @@ public: painter->drawPixmap(QPointF(), p); } - virtual void mousePressEvent(QGraphicsSceneMouseEvent *) override + void mousePressEvent(QGraphicsSceneMouseEvent *) override { emit clicked(); } - virtual void setGeometry(const QRectF &rect) override + void setGeometry(const QRectF &rect) override { QGraphicsWidget::setGeometry(rect); @@ -98,7 +98,7 @@ public: { } - virtual void resizeEvent(QResizeEvent *) override + void resizeEvent(QResizeEvent *) override { fitInView(sceneRect(), Qt::KeepAspectRatio); } diff --git a/examples/widgets/animation/moveblocks/main.cpp b/examples/widgets/animation/moveblocks/main.cpp index f85211ef88..a9b95808a5 100644 --- a/examples/widgets/animation/moveblocks/main.cpp +++ b/examples/widgets/animation/moveblocks/main.cpp @@ -98,14 +98,14 @@ public: protected: //![14] - virtual bool eventTest(QEvent *event) override + bool eventTest(QEvent *event) override { return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType)) && (static_cast(event)->rand() == m_rand); } //![14] - virtual void onTransition(QEvent *) override {} + void onTransition(QEvent *) override {} private: int m_rand; @@ -122,7 +122,7 @@ public: //![10] //![11] - virtual void onEntry(QEvent *) override + void onEntry(QEvent *) override { int n; while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex) @@ -130,7 +130,7 @@ public: m_lastIndex = n; machine()->postEvent(new StateSwitchEvent(n)); } - virtual void onExit(QEvent *) override {} + void onExit(QEvent *) override {} //![11] //![12] @@ -174,7 +174,7 @@ public: } protected: - virtual void resizeEvent(QResizeEvent *event) override + void resizeEvent(QResizeEvent *event) override { fitInView(scene()->sceneRect()); QGraphicsView::resizeEvent(event); diff --git a/examples/widgets/animation/states/main.cpp b/examples/widgets/animation/states/main.cpp index a3c7256933..14d193c301 100644 --- a/examples/widgets/animation/states/main.cpp +++ b/examples/widgets/animation/states/main.cpp @@ -79,7 +79,7 @@ public: { } - virtual void resizeEvent(QResizeEvent *) override + void resizeEvent(QResizeEvent *) override { fitInView(sceneRect(), Qt::KeepAspectRatio); } diff --git a/examples/widgets/animation/stickman/graphicsview.h b/examples/widgets/animation/stickman/graphicsview.h index 4b9b8fc028..56396bb780 100644 --- a/examples/widgets/animation/stickman/graphicsview.h +++ b/examples/widgets/animation/stickman/graphicsview.h @@ -61,7 +61,7 @@ public: GraphicsView(QWidget *parent = 0); protected: - virtual void resizeEvent(QResizeEvent *event) override; + void resizeEvent(QResizeEvent *event) override; void keyPressEvent(QKeyEvent *) override; signals: diff --git a/examples/widgets/animation/stickman/lifecycle.cpp b/examples/widgets/animation/stickman/lifecycle.cpp index 0ece4f3932..253af22b2d 100644 --- a/examples/widgets/animation/stickman/lifecycle.cpp +++ b/examples/widgets/animation/stickman/lifecycle.cpp @@ -70,7 +70,7 @@ public: setTargetState(target); } - virtual bool eventTest(QEvent *e) override + bool eventTest(QEvent *e) override { if (QSignalTransition::eventTest(e)) { QVariant key = static_cast(e)->arguments().at(0); @@ -95,7 +95,7 @@ public: startTimer(1000); } - virtual bool eventTest(QEvent *e) override + bool eventTest(QEvent *e) override { return QEventTransition::eventTest(e) && ((qrand() % 50) == 0); } diff --git a/examples/widgets/animation/stickman/rectbutton.h b/examples/widgets/animation/stickman/rectbutton.h index 864a2c179e..ab47bad0f7 100644 --- a/examples/widgets/animation/stickman/rectbutton.h +++ b/examples/widgets/animation/stickman/rectbutton.h @@ -60,13 +60,13 @@ public: RectButton(QString buttonText); ~RectButton(); - virtual QRectF boundingRect() const override; - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + QRectF boundingRect() const override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; protected: QString m_ButtonText; - virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) override; + void mousePressEvent (QGraphicsSceneMouseEvent *event) override; signals: void clicked(); diff --git a/examples/widgets/animation/stickman/stickman.h b/examples/widgets/animation/stickman/stickman.h index b5fbd14872..f2311a0358 100644 --- a/examples/widgets/animation/stickman/stickman.h +++ b/examples/widgets/animation/stickman/stickman.h @@ -69,8 +69,8 @@ public: StickMan(); ~StickMan(); - virtual QRectF boundingRect() const override; - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + QRectF boundingRect() const override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; int nodeCount() const; Node *node(int idx) const; diff --git a/examples/widgets/animation/sub-attaq/boat.h b/examples/widgets/animation/sub-attaq/boat.h index 24b004a108..a75e2b1474 100644 --- a/examples/widgets/animation/sub-attaq/boat.h +++ b/examples/widgets/animation/sub-attaq/boat.h @@ -86,7 +86,7 @@ public: void updateBoatMovement(); - virtual int type() const override; + int type() const override; signals: void boatDestroyed(); diff --git a/examples/widgets/animation/sub-attaq/boat_p.h b/examples/widgets/animation/sub-attaq/boat_p.h index 5cad6bde96..de11ff9555 100644 --- a/examples/widgets/animation/sub-attaq/boat_p.h +++ b/examples/widgets/animation/sub-attaq/boat_p.h @@ -81,7 +81,7 @@ public: { } protected: - virtual bool eventTest(QEvent *event) override + bool eventTest(QEvent *event) override { if (!QKeyEventTransition::eventTest(event)) return false; @@ -100,7 +100,7 @@ public: { } protected: - virtual bool eventTest(QEvent *event) override + bool eventTest(QEvent *event) override { if (!QKeyEventTransition::eventTest(event)) return false; @@ -131,7 +131,7 @@ public: { } protected: - virtual bool eventTest(QEvent *event) override + bool eventTest(QEvent *event) override { if (!QKeyEventTransition::eventTest(event)) return false; diff --git a/examples/widgets/animation/sub-attaq/states.h b/examples/widgets/animation/sub-attaq/states.h index 1d50abbf02..cd68e319c2 100644 --- a/examples/widgets/animation/sub-attaq/states.h +++ b/examples/widgets/animation/sub-attaq/states.h @@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition public: UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); protected: - virtual bool eventTest(QEvent *event) override; + bool eventTest(QEvent *event) override; private: PlayState * game; GraphicsScene *scene; @@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition public: WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); protected: - virtual bool eventTest(QEvent *event) override; + bool eventTest(QEvent *event) override; private: PlayState * game; GraphicsScene *scene; @@ -176,7 +176,7 @@ private: public: CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key); protected: - virtual bool eventTest(QEvent *event) override; + bool eventTest(QEvent *event) override; private: PlayState *game; }; diff --git a/examples/widgets/animation/sub-attaq/submarine.h b/examples/widgets/animation/sub-attaq/submarine.h index abfdca6195..d145c9cbee 100644 --- a/examples/widgets/animation/sub-attaq/submarine.h +++ b/examples/widgets/animation/sub-attaq/submarine.h @@ -81,7 +81,7 @@ public: void launchTorpedo(int speed); void destroy(); - virtual int type() const override; + int type() const override; QGraphicsRotation *rotation() const { return graphicsRotation; } diff --git a/examples/widgets/graphicsview/boxes/glbuffers.h b/examples/widgets/graphicsview/boxes/glbuffers.h index 0c2ff43c7e..0b80c8c4ae 100644 --- a/examples/widgets/graphicsview/boxes/glbuffers.h +++ b/examples/widgets/graphicsview/boxes/glbuffers.h @@ -110,8 +110,8 @@ public: GLTexture2D(int width, int height); explicit GLTexture2D(const QString& fileName, int width = 0, int height = 0); void load(int width, int height, QRgb *data); - virtual void bind() override; - virtual void unbind() override; + void bind() override; + void unbind() override; }; class GLTexture3D : public GLTexture @@ -121,8 +121,8 @@ public: // TODO: Implement function below //GLTexture3D(const QString& fileName, int width = 0, int height = 0); void load(int width, int height, int depth, QRgb *data); - virtual void bind() override; - virtual void unbind() override; + void bind() override; + void unbind() override; }; class GLTextureCube : public GLTexture @@ -131,8 +131,8 @@ public: GLTextureCube(int size); explicit GLTextureCube(const QStringList& fileNames, int size = 0); void load(int size, int face, QRgb *data); - virtual void bind() override; - virtual void unbind() override; + void bind() override; + void unbind() override; }; // TODO: Define and implement class below diff --git a/examples/widgets/graphicsview/boxes/qtbox.h b/examples/widgets/graphicsview/boxes/qtbox.h index e283dccfb4..f8ee9bdb0a 100644 --- a/examples/widgets/graphicsview/boxes/qtbox.h +++ b/examples/widgets/graphicsview/boxes/qtbox.h @@ -63,18 +63,18 @@ public: ItemBase(int size, int x, int y); virtual ~ItemBase(); - virtual QRectF boundingRect() const override; - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + QRectF boundingRect() const override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; protected: virtual ItemBase *createNew(int size, int x, int y) = 0; - virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; - virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override; - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override; - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; - virtual void keyPressEvent(QKeyEvent *event) override; - virtual void wheelEvent(QGraphicsSceneWheelEvent *event) override; - virtual int type() const override; + void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; + void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; + void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override; + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + void keyPressEvent(QKeyEvent *event) override; + void wheelEvent(QGraphicsSceneWheelEvent *event) override; + int type() const override; bool isInResizeArea(const QPointF &pos); static void duplicateSelectedItems(QGraphicsScene *scene); @@ -92,9 +92,9 @@ class QtBox : public ItemBase public: QtBox(int size, int x, int y); virtual ~QtBox(); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; protected: - virtual ItemBase *createNew(int size, int x, int y) override; + ItemBase *createNew(int size, int x, int y) override; private: QVector3D m_vertices[8]; QVector3D m_texCoords[4]; @@ -106,9 +106,9 @@ class CircleItem : public ItemBase { public: CircleItem(int size, int x, int y); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; protected: - virtual ItemBase *createNew(int size, int x, int y) override; + ItemBase *createNew(int size, int x, int y) override; QColor m_color; }; @@ -117,9 +117,9 @@ class SquareItem : public ItemBase { public: SquareItem(int size, int x, int y); - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; protected: - virtual ItemBase *createNew(int size, int x, int y) override; + ItemBase *createNew(int size, int x, int y) override; QPixmap m_image; }; diff --git a/examples/widgets/graphicsview/boxes/scene.h b/examples/widgets/graphicsview/boxes/scene.h index b76fb1057c..3f367a8dce 100644 --- a/examples/widgets/graphicsview/boxes/scene.h +++ b/examples/widgets/graphicsview/boxes/scene.h @@ -87,7 +87,7 @@ public slots: signals: void colorChanged(QRgb color, int id); protected: - virtual void mousePressEvent(QMouseEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; void setColor(QRgb color); // also emits colorChanged() private: QGraphicsScene *m_dialogParentScene; @@ -120,9 +120,9 @@ class GraphicsWidget : public QGraphicsProxyWidget public: GraphicsWidget() : QGraphicsProxyWidget(0, Qt::Window) {} protected: - virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; - virtual void resizeEvent(QGraphicsSceneResizeEvent *event) override; - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; + void resizeEvent(QGraphicsSceneResizeEvent *event) override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; }; class TwoSidedGraphicsWidget : public QObject @@ -162,7 +162,7 @@ signals: void shaderChanged(int); void doubleClicked(); protected: - virtual void mouseDoubleClickEvent(QMouseEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; QVector m_parameterNames; QComboBox *m_textureCombo; @@ -189,7 +189,7 @@ signals: void doubleClicked(); void newItemTriggered(ItemDialog::ItemType type); protected: - virtual void mouseDoubleClickEvent(QMouseEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; }; class Scene : public QGraphicsScene @@ -198,7 +198,7 @@ class Scene : public QGraphicsScene public: Scene(int width, int height, int maxTextureSize); ~Scene(); - virtual void drawBackground(QPainter *painter, const QRectF &rect) override; + void drawBackground(QPainter *painter, const QRectF &rect) override; public slots: void setShader(int index); @@ -214,10 +214,10 @@ protected: void defaultStates(); void renderCubemaps(); - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override; - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; - virtual void wheelEvent(QGraphicsSceneWheelEvent * event) override; + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; + void wheelEvent(QGraphicsSceneWheelEvent * event) override; private: void initGL(); QPointF pixelPosToViewPos(const QPointF& p); diff --git a/examples/widgets/graphicsview/dragdroprobot/main.cpp b/examples/widgets/graphicsview/dragdroprobot/main.cpp index ff3758ac60..20cec92d26 100644 --- a/examples/widgets/graphicsview/dragdroprobot/main.cpp +++ b/examples/widgets/graphicsview/dragdroprobot/main.cpp @@ -63,7 +63,7 @@ public: } protected: - virtual void resizeEvent(QResizeEvent *) override + void resizeEvent(QResizeEvent *) override { } }; diff --git a/examples/widgets/graphicsview/weatheranchorlayout/main.cpp b/examples/widgets/graphicsview/weatheranchorlayout/main.cpp index ec1f73bf9c..81db2780b4 100644 --- a/examples/widgets/graphicsview/weatheranchorlayout/main.cpp +++ b/examples/widgets/graphicsview/weatheranchorlayout/main.cpp @@ -69,7 +69,7 @@ public: { } - virtual void resizeEvent(QResizeEvent *event) override + void resizeEvent(QResizeEvent *event) override { w->setGeometry(0, 0, event->size().width(), event->size().height()); } diff --git a/examples/widgets/itemviews/frozencolumn/freezetablewidget.h b/examples/widgets/itemviews/frozencolumn/freezetablewidget.h index 51c46fb7e7..69a90dab54 100644 --- a/examples/widgets/itemviews/frozencolumn/freezetablewidget.h +++ b/examples/widgets/itemviews/frozencolumn/freezetablewidget.h @@ -63,8 +63,8 @@ public: protected: - virtual void resizeEvent(QResizeEvent *event) override; - virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override; + void resizeEvent(QResizeEvent *event) override; + QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override; void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible) override; private: diff --git a/examples/widgets/richtext/textedit/textedit.h b/examples/widgets/richtext/textedit/textedit.h index e5f04e706c..ae0b13a4cc 100644 --- a/examples/widgets/richtext/textedit/textedit.h +++ b/examples/widgets/richtext/textedit/textedit.h @@ -78,7 +78,7 @@ public slots: void fileNew(); protected: - virtual void closeEvent(QCloseEvent *e) override; + void closeEvent(QCloseEvent *e) override; private slots: void fileOpen(); diff --git a/examples/widgets/statemachine/factorial/main.cpp b/examples/widgets/statemachine/factorial/main.cpp index d0d61cb7df..919988051f 100644 --- a/examples/widgets/statemachine/factorial/main.cpp +++ b/examples/widgets/statemachine/factorial/main.cpp @@ -103,7 +103,7 @@ public: : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact) {} - virtual bool eventTest(QEvent *e) override + bool eventTest(QEvent *e) override { if (!QSignalTransition::eventTest(e)) return false; @@ -111,7 +111,7 @@ public: return se->arguments().at(0).toInt() > 1; } - virtual void onTransition(QEvent *e) override + void onTransition(QEvent *e) override { QStateMachine::SignalEvent *se = static_cast(e); int x = se->arguments().at(0).toInt(); @@ -133,7 +133,7 @@ public: : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact) {} - virtual bool eventTest(QEvent *e) override + bool eventTest(QEvent *e) override { if (!QSignalTransition::eventTest(e)) return false; @@ -141,7 +141,7 @@ public: return se->arguments().at(0).toInt() <= 1; } - virtual void onTransition(QEvent *) override + void onTransition(QEvent *) override { fprintf(stdout, "%d\n", m_fact->property("fac").toInt()); } diff --git a/examples/widgets/statemachine/pingpong/main.cpp b/examples/widgets/statemachine/pingpong/main.cpp index 8c3b9f674b..354f1d245b 100644 --- a/examples/widgets/statemachine/pingpong/main.cpp +++ b/examples/widgets/statemachine/pingpong/main.cpp @@ -75,7 +75,7 @@ public: : QState(parent) {} protected: - virtual void onEntry(QEvent *) override + void onEntry(QEvent *) override { machine()->postEvent(new PingEvent()); fprintf(stdout, "ping?\n"); @@ -93,7 +93,7 @@ protected: virtual bool eventTest(QEvent *e) override { return (e->type() == QEvent::User+3); } - virtual void onTransition(QEvent *) override + void onTransition(QEvent *) override { machine()->postDelayedEvent(new PingEvent(), 500); fprintf(stdout, "ping?\n"); @@ -111,7 +111,7 @@ protected: virtual bool eventTest(QEvent *e) override { return (e->type() == QEvent::User+2); } - virtual void onTransition(QEvent *) override + void onTransition(QEvent *) override { machine()->postDelayedEvent(new PongEvent(), 500); fprintf(stdout, "pong!\n"); diff --git a/examples/widgets/statemachine/trafficlight/main.cpp b/examples/widgets/statemachine/trafficlight/main.cpp index 143f2a9324..21df91d8b0 100644 --- a/examples/widgets/statemachine/trafficlight/main.cpp +++ b/examples/widgets/statemachine/trafficlight/main.cpp @@ -74,7 +74,7 @@ public slots: void turnOn() { setOn(true); } protected: - virtual void paintEvent(QPaintEvent *) override + void paintEvent(QPaintEvent *) override { if (!m_on) return; -- cgit v1.2.3 From 40c9e9dc5f31a4063a71e90208b5bf976977b054 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Nov 2016 15:39:57 -0800 Subject: Add a macros for disabling deprecated declaration warnings This is the only warning we disable in a lot of places in Qt 5.8 source code. If other warnings become common, we can add macros for them too. Change-Id: Iaeecaffe26af4535b416fffd1489d1968e29c52a Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 6 ++++++ src/corelib/tools/qalgorithms.h | 3 +-- src/gui/image/qimage.h | 3 +-- src/testlib/qxctestlogger.mm | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index d1d5373146..d978c141a4 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1273,6 +1273,7 @@ # define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1786) #elif defined(Q_CC_INTEL) /* icc: Intel compiler on Linux or OS X */ # define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) @@ -1281,6 +1282,7 @@ # define QT_WARNING_DISABLE_MSVC(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1786) #elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 && !defined(Q_CC_CLANG) # undef QT_DO_PRAGMA /* not needed */ # define QT_WARNING_PUSH __pragma(warning(push)) @@ -1289,6 +1291,7 @@ # define QT_WARNING_DISABLE_INTEL(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_MSVC(4996) #elif defined(Q_CC_CLANG) # define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) # define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) @@ -1296,6 +1299,7 @@ # define QT_WARNING_DISABLE_GCC(text) # define QT_WARNING_DISABLE_INTEL(number) # define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") #elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) # define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) # define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) @@ -1303,6 +1307,7 @@ # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_INTEL(number) # define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") #else // All other compilers, GCC < 4.6 and MSVC < 2008 # define QT_WARNING_DISABLE_GCC(text) # define QT_WARNING_PUSH @@ -1311,6 +1316,7 @@ # define QT_WARNING_DISABLE_MSVC(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED #endif /* diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 38753a6726..303374b06d 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -48,8 +48,7 @@ QT_BEGIN_NAMESPACE QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") -QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") +QT_WARNING_DISABLE_DEPRECATED /* Warning: The contents of QAlgorithmsPrivate is not a part of the public Qt API diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 91aaf673d0..fd2298561e 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -381,8 +381,7 @@ inline void QImage::setPixelColor(const QPoint &pt, const QColor &c) { setPixelC #if QT_DEPRECATED_SINCE(5, 0) QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") -QT_WARNING_DISABLE_MSVC(4996) +QT_WARNING_DISABLE_DEPRECATED inline QString QImage::text(const char* key, const char* lang) const { diff --git a/src/testlib/qxctestlogger.mm b/src/testlib/qxctestlogger.mm index ffabe88db2..62fd73070f 100644 --- a/src/testlib/qxctestlogger.mm +++ b/src/testlib/qxctestlogger.mm @@ -66,7 +66,7 @@ QT_WARNING_PUSH // Ignore XCTestProbe deprecation -QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") +QT_WARNING_DISABLE_DEPRECATED // --------------------------------------------------------- -- cgit v1.2.3 From 277208c169e94ebb8eb1a1c9bd46a844f50aa5f9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Nov 2016 15:41:18 -0800 Subject: moc: disable deprecated warnings in generated code Code generated by moc very often calls deprecated functions, like deprecated slots, signals and property getters and setters. There's no way around that unless the class in question is willing to break binary compatibility, so those warnings are actually harmless. Change-Id: Iaeecaffe26af4535b416fffd1489d1a98ef8b34a Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/tools/moc/moc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 3bd87e1f01..89bf2bd6a1 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1002,12 +1002,17 @@ void Moc::generate(FILE *out) fprintf(out, "#endif\n\n"); fprintf(out, "QT_BEGIN_MOC_NAMESPACE\n"); + fprintf(out, "QT_WARNING_PUSH\n"); + fprintf(out, "QT_WARNING_DISABLE_DEPRECATED\n"); + fputs("", out); for (i = 0; i < classList.size(); ++i) { Generator generator(&classList[i], metaTypes, knownQObjectClasses, knownGadgets, out); generator.generateCode(); } + fputs("", out); + fprintf(out, "QT_WARNING_POP\n"); fprintf(out, "QT_END_MOC_NAMESPACE\n"); } -- cgit v1.2.3 From 49cdf51ac97d12749e770d792124b7f06d5fd9ca Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Nov 2016 11:58:12 +0100 Subject: Fix some warnings in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../tst_qfile.cpp: In member function 'void tst_QFile::handle()': ../tst_qfile.cpp:2661:38: warning: ignoring return value of 'ssize_t read(int, void*, size_t)', declared with attribute warn_unused_result [-Wunused-result] tst_qstatictext.cpp:862:58: warning: unused parameter 'textItem' [-Wunused-parameter] ../tst_qtcpsocket.cpp: In member function 'void tst_QTcpSocket::abortiveClose()': ../tst_qtcpsocket.cpp:2254:90: warning: suggest parentheses around assignment used as truth value [-Wparentheses] Test.cpp: In member function 'void My4Socket::read()': Test.cpp:66:20: warning: 'reply' may be used uninitialized in this function [-Wmaybe-uninitialized] ../tst_qlocalsocket.cpp: In lambda function: ../tst_qlocalsocket.cpp:701:51: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ../tst_qtcpserver.cpp: In member function 'void tst_QTcpServer::linkLocal()': ../tst_qtcpserver.cpp:935:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses] ../tst_qtcpserver.cpp:940:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses] Change-Id: Ic315069768bcb63a6b333c28ac65b0b992b0d43f Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 3 ++- tests/auto/gui/text/qstatictext/tst_qstatictext.cpp | 2 +- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 2 +- tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp | 7 ++++--- tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp | 3 ++- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 3 ++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index eeba882c70..287b8aebd8 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2658,7 +2658,8 @@ void tst_QFile::handle() QVERIFY(fd > 2); QCOMPARE(int(file.handle()), fd); char c = '\0'; - QT_READ(int(file.handle()), &c, 1); + const auto readResult = QT_READ(int(file.handle()), &c, 1); + QCOMPARE(readResult, static_cast(1)); QCOMPARE(c, '/'); // test if the QFile and the handle remain in sync diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index b3d1b75a42..9f84f64ee9 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -859,7 +859,7 @@ void tst_QStaticText::textDocumentColor() class TestPaintEngine: public QPaintEngine { public: - void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE + void drawTextItem(const QPointF &p, const QTextItem &) Q_DECL_OVERRIDE { differentVerticalPositions.insert(qRound(p.y())); } diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 8cc06a77ba..74bffef4f4 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -698,7 +698,7 @@ void tst_QLocalSocket::simpleCommandProtocol2() QObject::connect(localSocketRead, &QLocalSocket::readyRead, [&] { forever { - if (localSocketRead->bytesAvailable() < sizeof(qint64)) + if (localSocketRead->bytesAvailable() < qint64(sizeof(qint64))) return; if (blockSize == 0) { diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 5a0baf73b5..4bbd0662e4 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -929,15 +929,16 @@ void tst_QTcpServer::linkLocal() //each server should have two connections foreach (QTcpServer* server, servers) { - QTcpSocket* remote; //qDebug() << "checking for connections" << server->serverAddress() << ":" << server->serverPort(); QVERIFY(server->waitForNewConnection(5000)); - QVERIFY(remote = server->nextPendingConnection()); + QTcpSocket* remote = server->nextPendingConnection(); + QVERIFY(remote != nullptr); remote->close(); delete remote; if (!server->hasPendingConnections()) QVERIFY(server->waitForNewConnection(5000)); - QVERIFY(remote = server->nextPendingConnection()); + remote = server->nextPendingConnection(); + QVERIFY(remote != nullptr); remote->close(); delete remote; QVERIFY(!server->hasPendingConnections()); diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp b/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp index 407d244f15..ed61db1a13 100644 --- a/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp +++ b/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp @@ -47,7 +47,8 @@ void My4Socket::read(void) { QDataStream in(this); - quint32 num, reply; + quint32 num = 0; + quint32 reply = 0; while (bytesAvailable()) { in >> num; diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index fb6b0c6e32..fe1057bdde 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -2251,7 +2251,8 @@ void tst_QTcpSocket::abortiveClose() enterLoop(10); QVERIFY(server.hasPendingConnections()); - QVERIFY(tmpSocket = server.nextPendingConnection()); + tmpSocket = server.nextPendingConnection(); + QVERIFY(tmpSocket != nullptr); qRegisterMetaType("QAbstractSocket::SocketError"); QSignalSpy readyReadSpy(clientSocket, SIGNAL(readyRead())); -- cgit v1.2.3 From 7eb4be9db89d40ea2cc090e7a562bdd588708607 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Sun, 13 Nov 2016 16:19:55 +0300 Subject: QStringRef: de-duplicate lastIndexOf code Change-Id: Id6d804b2ab4c9c763d7ec9cb66c255ed0b4f785d Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.cpp | 77 ++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 4262899e02..eef375fe72 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3260,6 +3260,23 @@ static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *nee return -1; } +static inline int lastIndexOfHelper( + const QStringRef &haystack, int from, const QStringRef &needle, Qt::CaseSensitivity cs) +{ + return lastIndexOfHelper(reinterpret_cast(haystack.unicode()), from, + reinterpret_cast(needle.unicode()), needle.size(), cs); +} + +static inline int lastIndexOfHelper( + const QStringRef &haystack, int from, QLatin1String needle, Qt::CaseSensitivity cs) +{ + const int size = needle.size(); + QVarLengthArray s(size); + qt_from_latin1(s.data(), needle.latin1(), size); + return lastIndexOfHelper(reinterpret_cast(haystack.unicode()), from, + s.data(), size, cs); +} + /*! Returns the index position of the last occurrence of the string \a str in this string, searching backward from index position \a @@ -9816,6 +9833,27 @@ int QStringRef::lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const return qt_last_index_of(unicode(), size(), ch, from, cs); } +template +static int last_index_of_impl(const QStringRef &haystack, int from, const T &needle, Qt::CaseSensitivity cs) +{ + const int sl = needle.size(); + if (sl == 1) + return haystack.lastIndexOf(needle.at(0), from, cs); + + const int l = haystack.size(); + if (from < 0) + from += l; + int delta = l - sl; + if (from == l && sl == 0) + return from; + if (uint(from) >= uint(l) || delta < 0) + return -1; + if (from > delta) + from = delta; + + return lastIndexOfHelper(haystack, from, needle, cs); +} + /*! \since 4.8 \overload lastIndexOf() @@ -9833,25 +9871,7 @@ int QStringRef::lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const */ int QStringRef::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const { - const int sl = str.size(); - if (sl == 1) - return lastIndexOf(str.at(0), from, cs); - - const int l = size(); - if (from < 0) - from += l; - int delta = l - sl; - if (from == l && sl == 0) - return from; - if (uint(from) >= uint(l) || delta < 0) - return -1; - if (from > delta) - from = delta; - - QVarLengthArray s(sl); - qt_from_latin1(s.data(), str.latin1(), sl); - - return lastIndexOfHelper(reinterpret_cast(unicode()), from, s.data(), sl, cs); + return last_index_of_impl(*this, from, str, cs); } /*! @@ -9871,24 +9891,7 @@ int QStringRef::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) */ int QStringRef::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const { - const int sl = str.size(); - if (sl == 1) - return lastIndexOf(str.at(0), from, cs); - - const int l = size(); - if (from < 0) - from += l; - int delta = l - sl; - if (from == l && sl == 0) - return from; - if (uint(from) >= uint(l) || delta < 0) - return -1; - if (from > delta) - from = delta; - - return lastIndexOfHelper(reinterpret_cast(unicode()), from, - reinterpret_cast(str.unicode()), - str.size(), cs); + return last_index_of_impl(*this, from, str, cs); } /*! -- cgit v1.2.3 From a103992f49045323a3aaa4970eb1ee5f65a378dd Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 24 Nov 2016 12:17:55 +0100 Subject: Fixed build using Visual Studio 2017 As _BitScanForward and friends are not marked constexpr in Visual Studio, functions using these may not be marked either. Task-number: QTBUG-57086 Change-Id: I29cfa4459580b5740f1011e7f39309844518ce03 Reviewed-by: Thiago Macieira Reviewed-by: Erik Verbruggen --- src/corelib/tools/qalgorithms.h | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 303374b06d..7e846956f5 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -589,15 +589,16 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NO return __builtin_popcountll(v); } #elif defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM) +#define QT_POPCOUNT_CONSTEXPR #define QT_HAS_BUILTIN_CTZ -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctz(quint32 val) +Q_ALWAYS_INLINE unsigned long qt_builtin_ctz(quint32 val) { unsigned long result; _BitScanForward(&result, val); return result; } #define QT_HAS_BUILTIN_CLZ -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val) +Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val) { unsigned long result; _BitScanReverse(&result, val); @@ -610,7 +611,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val) #if Q_PROCESSOR_WORDSIZE == 8 // These are only defined for 64bit builds. #define QT_HAS_BUILTIN_CTZLL -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val) +Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val) { unsigned long result; _BitScanForward64(&result, val); @@ -618,7 +619,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val) } // MSVC calls it _BitScanReverse and returns the carry flag, which we don't need #define QT_HAS_BUILTIN_CLZLL -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val) +Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val) { unsigned long result; _BitScanReverse64(&result, val); @@ -628,31 +629,31 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val) } #endif // MSVC 64bit # define QT_HAS_BUILTIN_CTZS -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW { return qt_builtin_ctz(v); } #define QT_HAS_BUILTIN_CLZS -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW { return qt_builtin_clz(v) - 16U; } #define QALGORITHMS_USE_BUILTIN_POPCOUNT -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW { return __popcnt(v); } -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW { return __popcnt16(v); } -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW { return __popcnt16(v); } #if Q_PROCESSOR_WORDSIZE == 8 #define QALGORITHMS_USE_BUILTIN_POPCOUNTLL -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW { return __popcnt64(v); } @@ -660,9 +661,13 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NO #endif // MSVC #endif // QT_HAS_CONSTEXPR_BUILTINS +#ifndef QT_POPCOUNT_CONSTEXPR +#define QT_POPCOUNT_CONSTEXPR Q_DECL_CONSTEXPR +#endif + } //namespace QAlgorithmsPrivate -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT return QAlgorithmsPrivate::qt_builtin_popcount(v); @@ -675,7 +680,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint32 v) Q #endif } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT return QAlgorithmsPrivate::qt_builtin_popcount(v); @@ -685,7 +690,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_ #endif } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT return QAlgorithmsPrivate::qt_builtin_popcount(v); @@ -696,7 +701,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint16 v) Q #endif } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNTLL return QAlgorithmsPrivate::qt_builtin_popcountll(v); @@ -711,7 +716,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint64 v) Q #endif } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW { return qPopulationCount(static_cast(v)); } @@ -719,6 +724,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(long unsigne #if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) #undef QALGORITHMS_USE_BUILTIN_POPCOUNT #endif +#undef QT_POPCOUNT_CONSTEXPR Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NOTHROW { -- cgit v1.2.3 From c050a1bdea993df5634fec9ed05f682cf5a81691 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Sun, 27 Nov 2016 12:45:37 +0300 Subject: Examples: Remove more redundant virtual specifiers for overriders Change-Id: I3e378c656a2651fb7031b6cf6a6939dfc5576519 Reviewed-by: Friedemann Kleint --- examples/widgets/graphicsview/boxes/glbuffers.h | 2 +- examples/widgets/graphicsview/boxes/scene.h | 4 ++-- examples/widgets/statemachine/pingpong/main.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/widgets/graphicsview/boxes/glbuffers.h b/examples/widgets/graphicsview/boxes/glbuffers.h index 0b80c8c4ae..03c24a91d3 100644 --- a/examples/widgets/graphicsview/boxes/glbuffers.h +++ b/examples/widgets/graphicsview/boxes/glbuffers.h @@ -146,7 +146,7 @@ public: void begin(int face); // end rendering void end(); - virtual bool failed() const override {return m_failed || m_fbo.failed();} + bool failed() const override { return m_failed || m_fbo.failed(); } static void getViewMatrix(QMatrix4x4& mat, int face); static void getProjectionMatrix(QMatrix4x4& mat, float nearZ, float farZ); diff --git a/examples/widgets/graphicsview/boxes/scene.h b/examples/widgets/graphicsview/boxes/scene.h index 3f367a8dce..a2ba1d0b5a 100644 --- a/examples/widgets/graphicsview/boxes/scene.h +++ b/examples/widgets/graphicsview/boxes/scene.h @@ -81,7 +81,7 @@ class ColorEdit : public ParameterEdit public: ColorEdit(QRgb initialColor, int id); QRgb color() const {return m_color;} - virtual void emitChange() override { emit colorChanged(m_color, m_id); } + void emitChange() override { emit colorChanged(m_color, m_id); } public slots: void editDone(); signals: @@ -103,7 +103,7 @@ class FloatEdit : public ParameterEdit public: FloatEdit(float initialValue, int id); float value() const {return m_value;} - virtual void emitChange() override { emit valueChanged(m_value, m_id); } + void emitChange() override { emit valueChanged(m_value, m_id); } public slots: void editDone(); signals: diff --git a/examples/widgets/statemachine/pingpong/main.cpp b/examples/widgets/statemachine/pingpong/main.cpp index 354f1d245b..c09060c502 100644 --- a/examples/widgets/statemachine/pingpong/main.cpp +++ b/examples/widgets/statemachine/pingpong/main.cpp @@ -90,7 +90,7 @@ public: PongTransition() {} protected: - virtual bool eventTest(QEvent *e) override { + bool eventTest(QEvent *e) override { return (e->type() == QEvent::User+3); } void onTransition(QEvent *) override @@ -108,7 +108,7 @@ public: PingTransition() {} protected: - virtual bool eventTest(QEvent *e) override { + bool eventTest(QEvent *e) override { return (e->type() == QEvent::User+2); } void onTransition(QEvent *) override -- cgit v1.2.3 From 7adbdddbb6b6977e8b86ea0bf6262721d0c6ef6e Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 24 Nov 2016 02:28:39 +0300 Subject: QtWidgets: Add missing override Change-Id: I991659db5510acbbb44d0f5987edc213acf62a74 Reviewed-by: Marc Mutz --- src/widgets/dialogs/qdialog.h | 18 +++--- src/widgets/graphicsview/qgraphicsproxywidget_p.h | 2 +- src/widgets/itemviews/qabstractitemview_p.h | 14 ++--- src/widgets/itemviews/qheaderview_p.h | 2 +- src/widgets/itemviews/qitemeditorfactory.h | 4 +- src/widgets/itemviews/qlistview_p.h | 72 +++++++++++------------ src/widgets/itemviews/qlistwidget_p.h | 26 ++++---- src/widgets/itemviews/qtablewidget_p.h | 38 ++++++------ src/widgets/itemviews/qtreeview_p.h | 14 ++--- src/widgets/kernel/qlayoutitem.h | 48 +++++++-------- src/widgets/util/qflickgesture_p.h | 6 +- src/widgets/widgets/qabstractspinbox.h | 40 ++++++------- src/widgets/widgets/qabstractspinbox_p.h | 4 +- src/widgets/widgets/qcombobox_p.h | 46 +++++++-------- src/widgets/widgets/qdatetimeedit.h | 26 ++++---- src/widgets/widgets/qdatetimeedit_p.h | 8 +-- src/widgets/widgets/qmacnativewidget_mac.h | 4 +- src/widgets/widgets/qmdisubwindow_p.h | 2 +- src/widgets/widgets/qmenubar.h | 36 ++++++------ src/widgets/widgets/qspinbox.h | 10 ++-- 20 files changed, 210 insertions(+), 210 deletions(-) diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index 265790b0e5..d88ff4a841 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -65,7 +65,7 @@ public: int result() const; - void setVisible(bool visible); + void setVisible(bool visible) override; void setOrientation(Qt::Orientation orientation); Qt::Orientation orientation() const; @@ -73,8 +73,8 @@ public: void setExtension(QWidget* extension); QWidget* extension() const; - QSize sizeHint() const; - QSize minimumSizeHint() const; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; void setSizeGripEnabled(bool); bool isSizeGripEnabled() const; @@ -99,14 +99,14 @@ public Q_SLOTS: protected: QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags()); - void keyPressEvent(QKeyEvent *); - void closeEvent(QCloseEvent *); - void showEvent(QShowEvent *); - void resizeEvent(QResizeEvent *); + void keyPressEvent(QKeyEvent *) override; + void closeEvent(QCloseEvent *) override; + void showEvent(QShowEvent *) override; + void resizeEvent(QResizeEvent *) override; #ifndef QT_NO_CONTEXTMENU - void contextMenuEvent(QContextMenuEvent *); + void contextMenuEvent(QContextMenuEvent *) override; #endif - bool eventFilter(QObject *, QEvent *); + bool eventFilter(QObject *, QEvent *) override; void adjustPosition(QWidget*); private: Q_DECLARE_PRIVATE(QDialog) diff --git a/src/widgets/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h index 0797ba7066..4624772993 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget_p.h +++ b/src/widgets/graphicsview/qgraphicsproxywidget_p.h @@ -80,7 +80,7 @@ public: void embedSubWindow(QWidget *); void unembedSubWindow(QWidget *); - bool isProxyWidget() const; + bool isProxyWidget() const override; QPointer widget; QPointer lastWidgetUnderMouse; diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h index f8ada6df08..d21ae573cd 100644 --- a/src/widgets/itemviews/qabstractitemview_p.h +++ b/src/widgets/itemviews/qabstractitemview_p.h @@ -93,12 +93,12 @@ class QEmptyModel : public QAbstractItemModel { public: explicit QEmptyModel(QObject *parent = 0) : QAbstractItemModel(parent) {} - QModelIndex index(int, int, const QModelIndex &) const { return QModelIndex(); } - QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } - int rowCount(const QModelIndex &) const { return 0; } - int columnCount(const QModelIndex &) const { return 0; } - bool hasChildren(const QModelIndex &) const { return false; } - QVariant data(const QModelIndex &, int) const { return QVariant(); } + QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); } + QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); } + int rowCount(const QModelIndex &) const override { return 0; } + int columnCount(const QModelIndex &) const override { return 0; } + bool hasChildren(const QModelIndex &) const override { return false; } + QVariant data(const QModelIndex &, int) const override { return QVariant(); } }; class Q_AUTOTEST_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate @@ -323,7 +323,7 @@ public: } // reimplemented from QAbstractScrollAreaPrivate - virtual QPoint contentsOffset() const { + QPoint contentsOffset() const override { Q_Q(const QAbstractItemView); return QPoint(q->horizontalOffset(), q->verticalOffset()); } diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index 0356d79ff7..6affe7af95 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -117,7 +117,7 @@ public: void resizeSections(QHeaderView::ResizeMode globalMode, bool useGlobalMode = false); void _q_sectionsRemoved(const QModelIndex &,int,int); void _q_layoutAboutToBeChanged(); - void _q_layoutChanged(); + void _q_layoutChanged() override; bool isSectionSelected(int section) const; bool isFirstVisibleSection(int section) const; diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h index 785d4d84ea..dea9bce794 100644 --- a/src/widgets/itemviews/qitemeditorfactory.h +++ b/src/widgets/itemviews/qitemeditorfactory.h @@ -81,8 +81,8 @@ public: inline QStandardItemEditorCreator() : propertyName(T::staticMetaObject.userProperty().name()) {} - inline QWidget *createWidget(QWidget *parent) const { return new T(parent); } - inline QByteArray valuePropertyName() const { return propertyName; } + inline QWidget *createWidget(QWidget *parent) const override { return new T(parent); } + inline QByteArray valuePropertyName() const override { return propertyName; } private: QByteArray propertyName; diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 42cb6b4eef..07cbd4036c 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -209,24 +209,24 @@ public: int batchSavedPosition; //reimplementations - int itemIndex(const QListViewItem &item) const { return item.indexHint; } - QListViewItem indexToListViewItem(const QModelIndex &index) const; - bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); - void clear(); - void setRowCount(int rowCount) { flowPositions.resize(rowCount); } - QVector intersectingSet(const QRect &area) const; - void dataChanged(const QModelIndex &, const QModelIndex &); + int itemIndex(const QListViewItem &item) const override { return item.indexHint; } + QListViewItem indexToListViewItem(const QModelIndex &index) const override; + bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override; + void clear() override; + void setRowCount(int rowCount) override { flowPositions.resize(rowCount); } + QVector intersectingSet(const QRect &area) const override; + void dataChanged(const QModelIndex &, const QModelIndex &) override; int horizontalScrollToValue(int index, QListView::ScrollHint hint, - bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const; + bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const override; int verticalScrollToValue(int index, QListView::ScrollHint hint, - bool above, bool below, const QRect &area, const QRect &rect) const; - void scrollContentsBy(int dx, int dy, bool scrollElasticBand); - QRect mapToViewport(const QRect &rect) const; - int horizontalOffset() const; - int verticalOffset() const; - void updateHorizontalScrollBar(const QSize &step); - void updateVerticalScrollBar(const QSize &step); + bool above, bool below, const QRect &area, const QRect &rect) const override; + void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override; + QRect mapToViewport(const QRect &rect) const override; + int horizontalOffset() const override; + int verticalOffset() const override; + void updateHorizontalScrollBar(const QSize &step) override; + void updateVerticalScrollBar(const QSize &step) override; #ifndef QT_NO_DRAGANDDROP // The next two methods are to be used on LefToRight flow only. @@ -261,24 +261,24 @@ public: QVector *interSectingVector; //used from within intersectingSet //reimplementations - int itemIndex(const QListViewItem &item) const; - QListViewItem indexToListViewItem(const QModelIndex &index) const; - bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); - void clear(); - void setRowCount(int rowCount); - QVector intersectingSet(const QRect &area) const; - - void scrollContentsBy(int dx, int dy, bool scrollElasticBand); - void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - void appendHiddenRow(int row); - void removeHiddenRow(int row); - void setPositionForIndex(const QPoint &position, const QModelIndex &index); + int itemIndex(const QListViewItem &item) const override; + QListViewItem indexToListViewItem(const QModelIndex &index) const override; + bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override; + void clear() override; + void setRowCount(int rowCount) override; + QVector intersectingSet(const QRect &area) const override; + + void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override; + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override; + void appendHiddenRow(int row) override; + void removeHiddenRow(int row) override; + void setPositionForIndex(const QPoint &position, const QModelIndex &index) override; #ifndef QT_NO_DRAGANDDROP - bool filterDragMoveEvent(QDragMoveEvent *); - bool filterDragLeaveEvent(QDragLeaveEvent *); - bool filterDropEvent(QDropEvent *e); - bool filterStartDrag(Qt::DropActions); + bool filterDragMoveEvent(QDragMoveEvent *) override; + bool filterDragLeaveEvent(QDragLeaveEvent *) override; + bool filterDropEvent(QDropEvent *e) override; + bool filterStartDrag(Qt::DropActions) override; #endif private: @@ -349,18 +349,18 @@ public: QModelIndex closestIndex(const QRect &target, const QVector &candidates) const; QSize itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const; - bool selectionAllowed(const QModelIndex &index) const + bool selectionAllowed(const QModelIndex &index) const override { if (viewMode == QListView::ListMode && !showElasticBand) return index.isValid(); return true; } int horizontalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const; int verticalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const; QItemSelection selection(const QRect &rect) const; - void selectAll(QItemSelectionModel::SelectionFlags command); + void selectAll(QItemSelectionModel::SelectionFlags command) override; #ifndef QT_NO_DRAGANDDROP - virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; - bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index); + QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const override; + bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index) override; #endif inline void setGridSize(const QSize &size) { grid = size; } @@ -383,7 +383,7 @@ public: void scrollElasticBandBy(int dx, int dy); - QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override; void emitIndexesMoved(const QModelIndexList &indexes) { emit q_func()->indexesMoved(indexes); } diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h index eaddfc6e6e..0594fd511e 100644 --- a/src/widgets/itemviews/qlistwidget_p.h +++ b/src/widgets/itemviews/qlistwidget_p.h @@ -93,22 +93,22 @@ public: QListWidgetItem *take(int row); void move(int srcRow, int dstRow); - int rowCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; QModelIndex index(QListWidgetItem *item) const; - QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; + QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role) override; - QMap itemData(const QModelIndex &index) const; + QMap itemData(const QModelIndex &index) const override; - bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); - bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); + bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; - Qt::ItemFlags flags(const QModelIndex &index) const; + Qt::ItemFlags flags(const QModelIndex &index) const override; - void sort(int column, Qt::SortOrder order); + void sort(int column, Qt::SortOrder order) override; void ensureSorted(int column, Qt::SortOrder order, int start, int end); static bool itemLessThan(const QPair &left, const QPair &right); @@ -122,12 +122,12 @@ public: void itemChanged(QListWidgetItem *item); // dnd - QStringList mimeTypes() const; - QMimeData *mimeData(const QModelIndexList &indexes) const; + QStringList mimeTypes() const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; #ifndef QT_NO_DRAGANDDROP bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); - Qt::DropActions supportedDropActions() const; + int row, int column, const QModelIndex &parent) override; + Qt::DropActions supportedDropActions() const override; #endif QMimeData *internalMimeData() const; diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h index 313577befe..2db7337cd6 100644 --- a/src/widgets/itemviews/qtablewidget_p.h +++ b/src/widgets/itemviews/qtablewidget_p.h @@ -99,11 +99,11 @@ public: QTableModel(int rows, int columns, QTableWidget *parent); ~QTableModel(); - bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); - bool insertColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()); + bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; + bool insertColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()) override; - bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()); - bool removeColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()); + bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override; + bool removeColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()) override; void setItem(int row, int column, QTableWidgetItem *item); QTableWidgetItem *takeItem(int row, int column); @@ -118,7 +118,7 @@ public: QTableWidgetItem *horizontalHeaderItem(int section); QTableWidgetItem *verticalHeaderItem(int section); - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override { return QAbstractTableModel::index(row, column, parent); } QModelIndex index(const QTableWidgetItem *item) const; @@ -126,21 +126,21 @@ public: void setRowCount(int rows); void setColumnCount(int columns); - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); - bool setItemData(const QModelIndex &index, const QMap &roles); + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role) override; + bool setItemData(const QModelIndex &index, const QMap &roles) override; - QMap itemData(const QModelIndex &index) const; + QMap itemData(const QModelIndex &index) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role); + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override; - Qt::ItemFlags flags(const QModelIndex &index) const; + Qt::ItemFlags flags(const QModelIndex &index) const override; - void sort(int column, Qt::SortOrder order); + void sort(int column, Qt::SortOrder order) override; static bool itemLessThan(const QPair &left, const QPair &right); static bool itemGreaterThan(const QPair &left, @@ -167,11 +167,11 @@ public: void setItemPrototype(const QTableWidgetItem *item); // dnd - QStringList mimeTypes() const; - QMimeData *mimeData(const QModelIndexList &indexes) const; + QStringList mimeTypes() const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); - Qt::DropActions supportedDropActions() const; + int row, int column, const QModelIndex &parent) override; + Qt::DropActions supportedDropActions() const override; QMimeData *internalMimeData() const; diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h index 56f3340966..63af41292b 100644 --- a/src/widgets/itemviews/qtreeview_p.h +++ b/src/widgets/itemviews/qtreeview_p.h @@ -102,8 +102,8 @@ public: return logicalIndex == logicalIndexForTree(); } - QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; - void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex ¤t) const; + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override; + void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex ¤t) const override; #ifndef QT_NO_ANIMATION struct AnimatedOperation : public QVariantAnimation @@ -115,8 +115,8 @@ public: AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); } int top() const { return startValue().toInt(); } QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; } - void updateCurrentValue(const QVariant &) { viewport->update(rect()); } - void updateState(State state, State) { if (state == Stopped) before = after = QPixmap(); } + void updateCurrentValue(const QVariant &) override { viewport->update(rect()); } + void updateState(State state, State) override { if (state == Stopped) before = after = QPixmap(); } } animatedOperation; void prepareAnimatedOperation(int item, QVariantAnimation::Direction d); void beginAnimatedOperation(); @@ -128,11 +128,11 @@ public: void expand(int item, bool emitSignal); void collapse(int item, bool emitSignal); - void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int); - void _q_columnsRemoved(const QModelIndex &, int, int); + void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int) override; + void _q_columnsRemoved(const QModelIndex &, int, int) override; void _q_modelAboutToBeReset(); void _q_sortIndicatorChanged(int column, Qt::SortOrder order); - void _q_modelDestroyed(); + void _q_modelDestroyed() override; void layout(int item, bool recusiveExpanding = false, bool afterIsUninitialized = false); diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h index 6f701b9f82..059ff2d470 100644 --- a/src/widgets/kernel/qlayoutitem.h +++ b/src/widgets/kernel/qlayoutitem.h @@ -101,14 +101,14 @@ public: void changeSize(int w, int h, QSizePolicy::Policy hData = QSizePolicy::Minimum, QSizePolicy::Policy vData = QSizePolicy::Minimum); - QSize sizeHint() const; - QSize minimumSize() const; - QSize maximumSize() const; - Qt::Orientations expandingDirections() const; - bool isEmpty() const; - void setGeometry(const QRect&); - QRect geometry() const; - QSpacerItem *spacerItem(); + QSize sizeHint() const override; + QSize minimumSize() const override; + QSize maximumSize() const override; + Qt::Orientations expandingDirections() const override; + bool isEmpty() const override; + void setGeometry(const QRect&) override; + QRect geometry() const override; + QSpacerItem *spacerItem() override; QSizePolicy sizePolicy() const { return sizeP; } private: @@ -126,18 +126,18 @@ public: explicit QWidgetItem(QWidget *w) : wid(w) { } ~QWidgetItem(); - QSize sizeHint() const; - QSize minimumSize() const; - QSize maximumSize() const; - Qt::Orientations expandingDirections() const; - bool isEmpty() const; - void setGeometry(const QRect&); - QRect geometry() const; - virtual QWidget *widget(); - - bool hasHeightForWidth() const; - int heightForWidth(int) const; - QSizePolicy::ControlTypes controlTypes() const; + QSize sizeHint() const override; + QSize minimumSize() const override; + QSize maximumSize() const override; + Qt::Orientations expandingDirections() const override; + bool isEmpty() const override; + void setGeometry(const QRect&) override; + QRect geometry() const override; + QWidget *widget() override; + + bool hasHeightForWidth() const override; + int heightForWidth(int) const override; + QSizePolicy::ControlTypes controlTypes() const override; protected: QWidget *wid; }; @@ -148,10 +148,10 @@ public: explicit QWidgetItemV2(QWidget *widget); ~QWidgetItemV2(); - QSize sizeHint() const; - QSize minimumSize() const; - QSize maximumSize() const; - int heightForWidth(int width) const; + QSize sizeHint() const override; + QSize minimumSize() const override; + QSize maximumSize() const override; + int heightForWidth(int width) const override; private: enum { Dirty = -123, HfwCacheMaxSize = 3 }; diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h index fa70806ef7..74a0f2a0f3 100644 --- a/src/widgets/util/qflickgesture_p.h +++ b/src/widgets/util/qflickgesture_p.h @@ -97,9 +97,9 @@ class QFlickGestureRecognizer : public QGestureRecognizer public: QFlickGestureRecognizer(Qt::MouseButton button); - QGesture *create(QObject *target); - QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); - void reset(QGesture *state); + QGesture *create(QObject *target) override; + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override; + void reset(QGesture *state) override; private: Qt::MouseButton button; // NoButton == Touch diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h index d93489e663..ac46894a27 100644 --- a/src/widgets/widgets/qabstractspinbox.h +++ b/src/widgets/widgets/qabstractspinbox.h @@ -117,12 +117,12 @@ public: void setGroupSeparatorShown(bool shown); bool isGroupSeparatorShown() const; - QSize sizeHint() const; - QSize minimumSizeHint() const; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; void interpretText(); - bool event(QEvent *event); + bool event(QEvent *event) override; - QVariant inputMethodQuery(Qt::InputMethodQuery) const; + QVariant inputMethodQuery(Qt::InputMethodQuery) const override; virtual QValidator::State validate(QString &input, int &pos) const; virtual void fixup(QString &input) const; @@ -134,24 +134,24 @@ public Q_SLOTS: void selectAll(); virtual void clear(); protected: - void resizeEvent(QResizeEvent *event); - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *event); + void resizeEvent(QResizeEvent *event) override; + void keyPressEvent(QKeyEvent *event) override; + void keyReleaseEvent(QKeyEvent *event) override; #ifndef QT_NO_WHEELEVENT - void wheelEvent(QWheelEvent *event); + void wheelEvent(QWheelEvent *event) override; #endif - void focusInEvent(QFocusEvent *event); - void focusOutEvent(QFocusEvent *event); - void contextMenuEvent(QContextMenuEvent *event); - void changeEvent(QEvent *event); - void closeEvent(QCloseEvent *event); - void hideEvent(QHideEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void timerEvent(QTimerEvent *event); - void paintEvent(QPaintEvent *event); - void showEvent(QShowEvent *event); + void focusInEvent(QFocusEvent *event) override; + void focusOutEvent(QFocusEvent *event) override; + void contextMenuEvent(QContextMenuEvent *event) override; + void changeEvent(QEvent *event) override; + void closeEvent(QCloseEvent *event) override; + void hideEvent(QHideEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void timerEvent(QTimerEvent *event) override; + void paintEvent(QPaintEvent *event) override; + void showEvent(QShowEvent *event) override; void initStyleOption(QStyleOptionSpinBox *option) const; QLineEdit *lineEdit() const; diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h index 47ca10a183..5ec59d899b 100644 --- a/src/widgets/widgets/qabstractspinbox_p.h +++ b/src/widgets/widgets/qabstractspinbox_p.h @@ -156,8 +156,8 @@ class QSpinBoxValidator : public QValidator { public: QSpinBoxValidator(QAbstractSpinBox *qptr, QAbstractSpinBoxPrivate *dptr); - QValidator::State validate(QString &input, int &) const; - void fixup(QString &) const; + QValidator::State validate(QString &input, int &) const override; + void fixup(QString &) const override; private: QAbstractSpinBox *qptr; QAbstractSpinBoxPrivate *dptr; diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 7ca077abf9..6c36359f81 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -86,13 +86,13 @@ public: QComboBoxListView(QComboBox *cmb = 0) : combo(cmb) {} protected: - void resizeEvent(QResizeEvent *event) + void resizeEvent(QResizeEvent *event) override { resizeContents(viewport()->width(), contentsSize().height()); QListView::resizeEvent(event); } - QStyleOptionViewItem viewOptions() const + QStyleOptionViewItem viewOptions() const override { QStyleOptionViewItem option = QListView::viewOptions(); option.showDecorationSelected = true; @@ -101,7 +101,7 @@ protected: return option; } - void paintEvent(QPaintEvent *e) + void paintEvent(QPaintEvent *e) override { if (combo) { QStyleOptionComboBox opt; @@ -142,7 +142,7 @@ public: setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); setAttribute(Qt::WA_NoMousePropagation); } - QSize sizeHint() const { + QSize sizeHint() const override { return QSize(20, style()->pixelMetric(QStyle::PM_MenuScrollerHeight)); } @@ -156,14 +156,14 @@ protected: fast = false; } - void enterEvent(QEvent *) { + void enterEvent(QEvent *) override { startTimer(); } - void leaveEvent(QEvent *) { + void leaveEvent(QEvent *) override { stopTimer(); } - void timerEvent(QTimerEvent *e) { + void timerEvent(QTimerEvent *e) override { if (e->timerId() == timer.timerId()) { emit doScroll(sliderAction); if (fast) { @@ -172,11 +172,11 @@ protected: } } } - void hideEvent(QHideEvent *) { + void hideEvent(QHideEvent *) override { stopTimer(); } - void mouseMoveEvent(QMouseEvent *e) + void mouseMoveEvent(QMouseEvent *e) override { // Enable fast scrolling if the cursor is directly above or below the popup. const int mouseX = e->pos().x(); @@ -188,7 +188,7 @@ protected: fast = horizontallyInside && verticallyOutside; } - void paintEvent(QPaintEvent *) { + void paintEvent(QPaintEvent *) override { QPainter p(this); QStyleOptionMenuItem menuOpt; menuOpt.init(this); @@ -235,15 +235,15 @@ public Q_SLOTS: void viewDestroyed(); protected: - void changeEvent(QEvent *e); - bool eventFilter(QObject *o, QEvent *e); - void mousePressEvent(QMouseEvent *e); - void mouseReleaseEvent(QMouseEvent *e); - void showEvent(QShowEvent *e); - void hideEvent(QHideEvent *e); - void timerEvent(QTimerEvent *timerEvent); - void leaveEvent(QEvent *e); - void resizeEvent(QResizeEvent *e); + void changeEvent(QEvent *e) override; + bool eventFilter(QObject *o, QEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *e) override; + void showEvent(QShowEvent *e) override; + void hideEvent(QHideEvent *e) override; + void timerEvent(QTimerEvent *timerEvent) override; + void leaveEvent(QEvent *e) override; + void resizeEvent(QResizeEvent *e) override; QStyleOptionComboBox comboStyleOption() const; Q_SIGNALS: @@ -270,13 +270,13 @@ public: protected: void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const { + const QModelIndex &index) const override { QStyleOptionMenuItem opt = getStyleOption(option, index); painter->fillRect(option.rect, opt.palette.background()); mCombo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, mCombo); } QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const { + const QModelIndex &index) const override { QStyleOptionMenuItem opt = getStyleOption(option, index); return mCombo->style()->sizeFromContents( QStyle::CT_MenuItem, &opt, option.rect.size(), mCombo); @@ -309,7 +309,7 @@ public: protected: void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const { + const QModelIndex &index) const override { if (isSeparator(index)) { QRect rect = option.rect; if (const QAbstractItemView *view = qobject_cast(option.widget)) @@ -323,7 +323,7 @@ protected: } QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const { + const QModelIndex &index) const override { if (isSeparator(index)) { int pm = mCombo->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, mCombo); return QSize(pm, pm); diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index c261ce369b..5c9f4e0f9d 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -159,12 +159,12 @@ public: Qt::TimeSpec timeSpec() const; void setTimeSpec(Qt::TimeSpec spec); - QSize sizeHint() const; + QSize sizeHint() const override; - virtual void clear(); - virtual void stepBy(int steps); + void clear() override; + void stepBy(int steps) override; - bool event(QEvent *event); + bool event(QEvent *event) override; Q_SIGNALS: void dateTimeChanged(const QDateTime &dateTime); void timeChanged(const QTime &time); @@ -176,20 +176,20 @@ public Q_SLOTS: void setTime(const QTime &time); protected: - virtual void keyPressEvent(QKeyEvent *event); + void keyPressEvent(QKeyEvent *event) override; #ifndef QT_NO_WHEELEVENT - virtual void wheelEvent(QWheelEvent *event); + void wheelEvent(QWheelEvent *event) override; #endif - virtual void focusInEvent(QFocusEvent *event); - virtual bool focusNextPrevChild(bool next); - virtual QValidator::State validate(QString &input, int &pos) const; - virtual void fixup(QString &input) const; + void focusInEvent(QFocusEvent *event) override; + bool focusNextPrevChild(bool next) override; + QValidator::State validate(QString &input, int &pos) const override; + void fixup(QString &input) const override; virtual QDateTime dateTimeFromText(const QString &text) const; virtual QString textFromDateTime(const QDateTime &dt) const; - virtual StepEnabled stepEnabled() const; - virtual void mousePressEvent(QMouseEvent *event); - virtual void paintEvent(QPaintEvent *event); + StepEnabled stepEnabled() const override; + void mousePressEvent(QMouseEvent *event) override; + void paintEvent(QPaintEvent *event) override; void initStyleOption(QStyleOptionSpinBox *option) const; QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = Q_NULLPTR); diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index 6889bda041..730aa0f0b2 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -167,10 +167,10 @@ private Q_SLOTS: void dateSelectionChanged(); protected: - void hideEvent(QHideEvent *); - void mousePressEvent(QMouseEvent *e); - void mouseReleaseEvent(QMouseEvent *); - bool event(QEvent *e); + void hideEvent(QHideEvent *) override; + void mousePressEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *) override; + bool event(QEvent *e) override; private: QCalendarWidget *verifyCalendarInstance(); diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h index 84389f16df..a8faffd6be 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.h +++ b/src/widgets/widgets/qmacnativewidget_mac.h @@ -54,11 +54,11 @@ public: QMacNativeWidget(NSView *parentView = Q_NULLPTR); ~QMacNativeWidget(); - QSize sizeHint() const; + QSize sizeHint() const override; NSView *nativeView() const; protected: - bool event(QEvent *ev); + bool event(QEvent *ev) override; }; QT_END_NAMESPACE diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h index 650d3b0bfb..33fa73eb0d 100644 --- a/src/widgets/widgets/qmdisubwindow_p.h +++ b/src/widgets/widgets/qmdisubwindow_p.h @@ -80,7 +80,7 @@ public: mdiChild = child; } - void *qt_metacast(const char *classname) + void *qt_metacast(const char *classname) override { if (classname && strcmp(classname, "ControlElement") == 0) return this; diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h index ec15155710..7ad205b77a 100644 --- a/src/widgets/widgets/qmenubar.h +++ b/src/widgets/widgets/qmenubar.h @@ -86,9 +86,9 @@ public: void setDefaultUp(bool); bool isDefaultUp() const; - QSize sizeHint() const; - QSize minimumSizeHint() const; - int heightForWidth(int) const; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; + int heightForWidth(int) const override; QRect actionGeometry(QAction *) const; QAction *actionAt(const QPoint &) const; @@ -104,27 +104,27 @@ public: void setNativeMenuBar(bool nativeMenuBar); QPlatformMenuBar *platformMenuBar(); public Q_SLOTS: - virtual void setVisible(bool visible); + void setVisible(bool visible) override; Q_SIGNALS: void triggered(QAction *action); void hovered(QAction *action); protected: - void changeEvent(QEvent *); - void keyPressEvent(QKeyEvent *); - void mouseReleaseEvent(QMouseEvent *); - void mousePressEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); - void leaveEvent(QEvent *); - void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *); - void actionEvent(QActionEvent *); - void focusOutEvent(QFocusEvent *); - void focusInEvent(QFocusEvent *); - void timerEvent(QTimerEvent *); - bool eventFilter(QObject *, QEvent *); - bool event(QEvent *); + void changeEvent(QEvent *) override; + void keyPressEvent(QKeyEvent *) override; + void mouseReleaseEvent(QMouseEvent *) override; + void mousePressEvent(QMouseEvent *) override; + void mouseMoveEvent(QMouseEvent *) override; + void leaveEvent(QEvent *) override; + void paintEvent(QPaintEvent *) override; + void resizeEvent(QResizeEvent *) override; + void actionEvent(QActionEvent *) override; + void focusOutEvent(QFocusEvent *) override; + void focusInEvent(QFocusEvent *) override; + void timerEvent(QTimerEvent *) override; + bool eventFilter(QObject *, QEvent *) override; + bool event(QEvent *) override; void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; private: diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h index 2e77f0be7a..2eb12fd90d 100644 --- a/src/widgets/widgets/qspinbox.h +++ b/src/widgets/widgets/qspinbox.h @@ -91,11 +91,11 @@ public: void setDisplayIntegerBase(int base); protected: - bool event(QEvent *event); - virtual QValidator::State validate(QString &input, int &pos) const; + bool event(QEvent *event) override; + QValidator::State validate(QString &input, int &pos) const override; virtual int valueFromText(const QString &text) const; virtual QString textFromValue(int val) const; - virtual void fixup(QString &str) const; + void fixup(QString &str) const override; public Q_SLOTS: @@ -151,10 +151,10 @@ public: int decimals() const; void setDecimals(int prec); - virtual QValidator::State validate(QString &input, int &pos) const; + QValidator::State validate(QString &input, int &pos) const override; virtual double valueFromText(const QString &text) const; virtual QString textFromValue(double val) const; - virtual void fixup(QString &str) const; + void fixup(QString &str) const override; public Q_SLOTS: void setValue(double val); -- cgit v1.2.3 From 33c50e910c6f8ed68994e4968389603ddb8bc6f7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Nov 2016 13:21:43 +0100 Subject: Fix tst_QString::sprintf() Compare to QLatin1String and use reinterpret_cast to fix MSVC warning: tst_qstring.cpp(1271): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size Change-Id: I4f26d72f0fad59e09636fe609a2772309a688e5c Reviewed-by: Marc Mutz --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index a0a872710c..414ba2d8cf 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -1255,6 +1255,11 @@ void tst_QString::fill() QCOMPARE(f, QLatin1String("FFF")); } +static inline const void *ptrValue(quintptr v) +{ + return reinterpret_cast(v); +} + void tst_QString::sprintf() { QString a; @@ -1266,21 +1271,21 @@ void tst_QString::sprintf() QCOMPARE(a.sprintf("X%9iY", 50000 ), QLatin1String("X 50000Y")); QCOMPARE(a.sprintf("X%-9sY","hello"), QLatin1String("Xhello Y")); QCOMPARE(a.sprintf("X%-9iY", 50000 ), QLatin1String("X50000 Y")); - QCOMPARE(a.sprintf("%lf", 1.23), QString("1.230000")); - QCOMPARE(a.sprintf("%lf", 1.23456789), QString("1.234568")); - QCOMPARE(a.sprintf("%p", (void *)0xbfffd350), QString("0xbfffd350")); - QCOMPARE(a.sprintf("%p", (void *)0), QString("0x0")); + QCOMPARE(a.sprintf("%lf", 1.23), QLatin1String("1.230000")); + QCOMPARE(a.sprintf("%lf", 1.23456789), QLatin1String("1.234568")); + QCOMPARE(a.sprintf("%p", ptrValue(0xbfffd350)), QLatin1String("0xbfffd350")); + QCOMPARE(a.sprintf("%p", ptrValue(0)), QLatin1String("0x0")); int i = 6; long l = -2; float f = 4.023f; QString S1; S1.sprintf("%d %ld %f",i,l,f); - QCOMPARE(S1,QString("6 -2 4.023000")); + QCOMPARE(S1, QLatin1String("6 -2 4.023000")); double d = -514.25683; S1.sprintf("%f",d); - QCOMPARE(S1, QString("-514.256830")); + QCOMPARE(S1, QLatin1String("-514.256830")); } void tst_QString::sprintfS() -- cgit v1.2.3 From c2446cb7df1466e9252f691567133295e4101c44 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Nov 2016 13:08:51 +0100 Subject: qdbusxml2cpp: Add application name and input file to warnings Make it possible to identify its warnings in log files, like: qdbusxml2cpp: Got unknown type `(s)' processing '../org.qtproject.QtDBus.Pinger.xml' You should add to the XML description qdbusxml2cpp: Got unknown type `(s)' processing '../org.qtproject.QtDBus.Pinger.xml' You should add to the XML description Change-Id: I242d9316b317de0164af2725b7836551f2f69037 Reviewed-by: Rolf Eike Beer Reviewed-by: Thiago Macieira --- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 37 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index bd94017821..2f9721b175 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -98,7 +98,8 @@ static QDBusIntrospection::Interfaces readInput() // already XML return QDBusIntrospection::parseInterfaces(QString::fromUtf8(data)); - fprintf(stderr, "Cannot process input: '%s'. Stop.\n", qPrintable(inputFile)); + fprintf(stderr, "%s: Cannot process input: '%s'. Stop.\n", + PROGRAMNAME, qPrintable(inputFile)); exit(1); } @@ -225,7 +226,8 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection: if (qttype.isEmpty()) { if (!isSignal || qstrcmp(direction, "Out") == 0) { - fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature)); + fprintf(stderr, "%s: Got unknown type `%s' processing '%s'\n", + PROGRAMNAME, qPrintable(signature), qPrintable(inputFile)); fprintf(stderr, "You should add \"/> to the XML description\n", qPrintable(annotationName)); } @@ -236,8 +238,10 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection: exit(1); } - fprintf(stderr, "Warning: deprecated annotation '%s' found; suggest updating to '%s'\n", - qPrintable(oldAnnotationName), qPrintable(annotationName)); + fprintf(stderr, "%s: Warning: deprecated annotation '%s' found while processing '%s'; " + "suggest updating to '%s'\n", + PROGRAMNAME, qPrintable(oldAnnotationName), qPrintable(inputFile), + qPrintable(annotationName)); return qttype.toLatin1(); } @@ -357,8 +361,10 @@ static QString propertyGetter(const QDBusIntrospection::Property &property) getter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertyGetter")); if (!getter.isEmpty()) { - fprintf(stderr, "Warning: deprecated annotation 'com.trolltech.QtDBus.propertyGetter' found;" - " suggest updating to 'org.qtproject.QtDBus.PropertyGetter'\n"); + fprintf(stderr, "%s: Warning: deprecated annotation 'com.trolltech.QtDBus.propertyGetter' found" + " while processing '%s';" + " suggest updating to 'org.qtproject.QtDBus.PropertyGetter'\n", + PROGRAMNAME, qPrintable(inputFile)); return getter; } @@ -375,8 +381,10 @@ static QString propertySetter(const QDBusIntrospection::Property &property) setter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertySetter")); if (!setter.isEmpty()) { - fprintf(stderr, "Warning: deprecated annotation 'com.trolltech.QtDBus.propertySetter' found;" - " suggest updating to 'org.qtproject.QtDBus.PropertySetter'\n"); + fprintf(stderr, "%s: Warning: deprecated annotation 'com.trolltech.QtDBus.propertySetter' found" + " while processing '%s';" + " suggest updating to 'org.qtproject.QtDBus.PropertySetter'\n", + PROGRAMNAME, qPrintable(inputFile)); return setter; } @@ -426,8 +434,8 @@ static bool openFile(const QString &fileName, QFile &file) } if (!isOk) - fprintf(stderr, "Unable to open '%s': %s\n", qPrintable(fileName), - qPrintable(file.errorString())); + fprintf(stderr, "%s: Unable to open '%s': %s\n", + PROGRAMNAME, qPrintable(fileName), qPrintable(file.errorString())); return isOk; } @@ -566,8 +574,9 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf bool isNoReply = method.annotations.value(QLatin1String(ANNOTATION_NO_WAIT)) == QLatin1String("true"); if (isNoReply && !method.outputArgs.isEmpty()) { - fprintf(stderr, "warning: method %s in interface %s is marked 'no-reply' but has output arguments.\n", - qPrintable(method.name), qPrintable(interface->name)); + fprintf(stderr, "%s: warning while processing '%s': method %s in interface %s is marked 'no-reply' but has output arguments.\n", + PROGRAMNAME, qPrintable(inputFile), qPrintable(method.name), + qPrintable(interface->name)); continue; } @@ -893,8 +902,8 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte bool isNoReply = method.annotations.value(QLatin1String(ANNOTATION_NO_WAIT)) == QLatin1String("true"); if (isNoReply && !method.outputArgs.isEmpty()) { - fprintf(stderr, "warning: method %s in interface %s is marked 'no-reply' but has output arguments.\n", - qPrintable(method.name), qPrintable(interface->name)); + fprintf(stderr, "%s: warning while processing '%s': method %s in interface %s is marked 'no-reply' but has output arguments.\n", + PROGRAMNAME, qPrintable(inputFile), qPrintable(method.name), qPrintable(interface->name)); continue; } -- cgit v1.2.3 From e3ad43843a6ddb20c901b6fba85c12fb0e6c5651 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Sun, 27 Nov 2016 11:00:50 +0300 Subject: Android: Add missing override Change-Id: I70b802517d8f7d129ffb71dc3e92cb2458a55acc Reviewed-by: BogDan Vatra --- .../platforms/android/androidplatformplugin.cpp | 2 +- .../android/qandroidassetsfileenginehandler.cpp | 34 +++++++++++----------- .../android/qandroidassetsfileenginehandler.h | 2 +- .../platforms/android/qandroideventdispatcher.h | 2 +- .../platforms/android/qandroidinputcontext.h | 24 +++++++-------- .../android/qandroidplatformaccessibility.h | 2 +- .../android/qandroidplatformbackingstore.h | 8 ++--- .../platforms/android/qandroidplatformclipboard.h | 6 ++-- .../android/qandroidplatformdialoghelpers.h | 8 ++--- .../android/qandroidplatformfontdatabase.h | 10 +++---- .../android/qandroidplatformintegration.h | 34 +++++++++++----------- .../platforms/android/qandroidplatformmenu.h | 28 +++++++++--------- .../platforms/android/qandroidplatformmenubar.h | 10 +++---- .../platforms/android/qandroidplatformmenuitem.h | 28 +++++++++--------- .../android/qandroidplatformopenglcontext.h | 6 ++-- .../android/qandroidplatformopenglwindow.h | 8 ++--- .../platforms/android/qandroidplatformscreen.h | 22 +++++++------- .../platforms/android/qandroidplatformservices.h | 6 ++-- .../platforms/android/qandroidplatformtheme.h | 18 ++++++------ .../platforms/android/qandroidplatformwindow.h | 22 +++++++------- .../platforms/android/qandroidsystemlocale.h | 4 +-- 21 files changed, 142 insertions(+), 142 deletions(-) diff --git a/src/plugins/platforms/android/androidplatformplugin.cpp b/src/plugins/platforms/android/androidplatformplugin.cpp index 8e365e9a59..297e167f47 100644 --- a/src/plugins/platforms/android/androidplatformplugin.cpp +++ b/src/plugins/platforms/android/androidplatformplugin.cpp @@ -47,7 +47,7 @@ class QAndroidPlatformIntegrationPlugin: public QPlatformIntegrationPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "android.json") public: - QPlatformIntegration *create(const QString &key, const QStringList ¶mList); + QPlatformIntegration *create(const QString &key, const QStringList ¶mList) override; }; diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp index 7e8e1ba9c5..e1dcebfa4c 100644 --- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp +++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp @@ -75,12 +75,12 @@ public: m_path = path; } - virtual QFileInfo currentFileInfo() const + QFileInfo currentFileInfo() const override { return QFileInfo(currentFilePath()); } - virtual QString currentFileName() const + QString currentFileName() const override { if (m_index < 0 || m_index >= m_items.size()) return QString(); @@ -95,12 +95,12 @@ public: return m_path + currentFileName(); } - virtual bool hasNext() const + bool hasNext() const override { return m_items.size() && (m_index < m_items.size() - 1); } - virtual QString next() + QString next() override { if (!hasNext()) return QString(); @@ -137,12 +137,12 @@ public: close(); } - virtual bool open(QIODevice::OpenMode openMode) + bool open(QIODevice::OpenMode openMode) override { return m_assetFile != 0 && (openMode & QIODevice::WriteOnly) == 0; } - virtual bool close() + bool close() override { if (m_assetFile) { AAsset_close(m_assetFile); @@ -152,50 +152,50 @@ public: return false; } - virtual qint64 size() const + qint64 size() const override { if (m_assetFile) return AAsset_getLength(m_assetFile); return -1; } - virtual qint64 pos() const + qint64 pos() const override { if (m_assetFile) return AAsset_seek(m_assetFile, 0, SEEK_CUR); return -1; } - virtual bool seek(qint64 pos) + bool seek(qint64 pos) override { if (m_assetFile) return pos == AAsset_seek(m_assetFile, pos, SEEK_SET); return false; } - virtual qint64 read(char *data, qint64 maxlen) + qint64 read(char *data, qint64 maxlen) override { if (m_assetFile) return AAsset_read(m_assetFile, data, maxlen); return -1; } - virtual bool isSequential() const + bool isSequential() const override { return false; } - virtual bool caseSensitive() const + bool caseSensitive() const override { return true; } - virtual bool isRelativePath() const + bool isRelativePath() const override { return false; } - virtual FileFlags fileFlags(FileFlags type = FileInfoAll) const + FileFlags fileFlags(FileFlags type = FileInfoAll) const override { FileFlags flags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag); if (m_assetFile) @@ -206,7 +206,7 @@ public: return type & flags; } - virtual QString fileName(FileName file = DefaultName) const + QString fileName(FileName file = DefaultName) const override { int pos; switch (file) { @@ -231,7 +231,7 @@ public: } } - virtual void setFileName(const QString &file) + void setFileName(const QString &file) override { if (file == m_fileName) return; @@ -243,7 +243,7 @@ public: close(); } - virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) + Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override { if (!m_assetDir.isNull()) return new AndroidAbstractFileEngineIterator(filters, filterNames, m_assetDir, m_fileName); diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.h b/src/plugins/platforms/android/qandroidassetsfileenginehandler.h index b09d8090a4..f99dc9a11a 100644 --- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.h +++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.h @@ -55,7 +55,7 @@ class AndroidAssetsFileEngineHandler: public QAbstractFileEngineHandler public: AndroidAssetsFileEngineHandler(); virtual ~AndroidAssetsFileEngineHandler(); - QAbstractFileEngine *create(const QString &fileName) const; + QAbstractFileEngine *create(const QString &fileName) const override; private: void prepopulateCache() const; diff --git a/src/plugins/platforms/android/qandroideventdispatcher.h b/src/plugins/platforms/android/qandroideventdispatcher.h index 86a7e460b3..057a1660c9 100644 --- a/src/plugins/platforms/android/qandroideventdispatcher.h +++ b/src/plugins/platforms/android/qandroideventdispatcher.h @@ -56,7 +56,7 @@ public: void goingToStop(bool stop); protected: - bool processEvents(QEventLoop::ProcessEventsFlags flags); + bool processEvents(QEventLoop::ProcessEventsFlags flags) override; private: QAtomicInt m_stopRequest; diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index 8a33ff71cc..ce0ec8724c 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -80,21 +80,21 @@ public: QAndroidInputContext(); ~QAndroidInputContext(); static QAndroidInputContext * androidInputContext(); - bool isValid() const { return true; } - - void reset(); - void commit(); - void update(Qt::InputMethodQueries queries); - void invokeAction(QInputMethod::Action action, int cursorPosition); - QRectF keyboardRect() const; - bool isAnimating() const; - void showInputPanel(); - void hideInputPanel(); - bool isInputPanelVisible() const; + bool isValid() const override { return true; } + + void reset() override; + void commit() override; + void update(Qt::InputMethodQueries queries) override; + void invokeAction(QInputMethod::Action action, int cursorPosition) override; + QRectF keyboardRect() const override; + bool isAnimating() const override; + void showInputPanel() override; + void hideInputPanel() override; + bool isInputPanelVisible() const override; bool isComposing() const; void clear(); - void setFocusObject(QObject *object); + void setFocusObject(QObject *object) override; void sendShortcut(const QKeySequence &); //---------------// diff --git a/src/plugins/platforms/android/qandroidplatformaccessibility.h b/src/plugins/platforms/android/qandroidplatformaccessibility.h index 3a428ca1ad..8216c05fa6 100644 --- a/src/plugins/platforms/android/qandroidplatformaccessibility.h +++ b/src/plugins/platforms/android/qandroidplatformaccessibility.h @@ -51,7 +51,7 @@ public: QAndroidPlatformAccessibility(); ~QAndroidPlatformAccessibility(); - virtual void notifyAccessibilityUpdate(QAccessibleEvent *event); + void notifyAccessibilityUpdate(QAccessibleEvent *event) override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformbackingstore.h b/src/plugins/platforms/android/qandroidplatformbackingstore.h index e4a161d608..a3a65aa30e 100644 --- a/src/plugins/platforms/android/qandroidplatformbackingstore.h +++ b/src/plugins/platforms/android/qandroidplatformbackingstore.h @@ -50,10 +50,10 @@ class QAndroidPlatformBackingStore : public QPlatformBackingStore { public: explicit QAndroidPlatformBackingStore(QWindow *window); - virtual QPaintDevice *paintDevice(); - virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - virtual void resize(const QSize &size, const QRegion &staticContents); - QImage toImage() const { return m_image; } + QPaintDevice *paintDevice() override; + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; + void resize(const QSize &size, const QRegion &staticContents) override; + QImage toImage() const override { return m_image; } void setBackingStore(QWindow *window); protected: QImage m_image; diff --git a/src/plugins/platforms/android/qandroidplatformclipboard.h b/src/plugins/platforms/android/qandroidplatformclipboard.h index 47976c1693..dfc3629c10 100644 --- a/src/plugins/platforms/android/qandroidplatformclipboard.h +++ b/src/plugins/platforms/android/qandroidplatformclipboard.h @@ -51,9 +51,9 @@ class QAndroidPlatformClipboard: public QPlatformClipboard public: QAndroidPlatformClipboard(); - virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); - virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); - virtual bool supportsMode(QClipboard::Mode mode) const; + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override; + bool supportsMode(QClipboard::Mode mode) const override; private: QMimeData m_mimeData; diff --git a/src/plugins/platforms/android/qandroidplatformdialoghelpers.h b/src/plugins/platforms/android/qandroidplatformdialoghelpers.h index 5c3aef2bc1..694b4c7580 100644 --- a/src/plugins/platforms/android/qandroidplatformdialoghelpers.h +++ b/src/plugins/platforms/android/qandroidplatformdialoghelpers.h @@ -53,11 +53,11 @@ class QAndroidPlatformMessageDialogHelper: public QPlatformMessageDialogHelper Q_OBJECT public: QAndroidPlatformMessageDialogHelper(); - void exec(); + void exec() override; bool show(Qt::WindowFlags windowFlags, - Qt::WindowModality windowModality, - QWindow *parent); - void hide(); + Qt::WindowModality windowModality, + QWindow *parent) override; + void hide() override; public slots: void dialogResult(int buttonID); diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.h b/src/plugins/platforms/android/qandroidplatformfontdatabase.h index b20fd75cb2..533d6e50a9 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.h +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.h @@ -47,12 +47,12 @@ QT_BEGIN_NAMESPACE class QAndroidPlatformFontDatabase: public QBasicFontDatabase { public: - QString fontDir() const; - void populateFontDatabase(); + QString fontDir() const override; + void populateFontDatabase() override; QStringList fallbacksForFamily(const QString &family, - QFont::Style style, - QFont::StyleHint styleHint, - QChar::Script script) const; + QFont::Style style, + QFont::StyleHint styleHint, + QChar::Script script) const override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h index bda0bee9ad..2337801250 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/qandroidplatformintegration.h @@ -63,7 +63,7 @@ struct AndroidStyle; class QAndroidPlatformNativeInterface: public QPlatformNativeInterface { public: - void *nativeResourceForIntegration(const QByteArray &resource); + void *nativeResourceForIntegration(const QByteArray &resource) override; std::shared_ptr m_androidStyle; }; @@ -75,39 +75,39 @@ public: QAndroidPlatformIntegration(const QStringList ¶mList); ~QAndroidPlatformIntegration(); - bool hasCapability(QPlatformIntegration::Capability cap) const; + bool hasCapability(QPlatformIntegration::Capability cap) const override; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; - QAbstractEventDispatcher *createEventDispatcher() const; + QPlatformWindow *createPlatformWindow(QWindow *window) const override; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; + QAbstractEventDispatcher *createEventDispatcher() const override; QAndroidPlatformScreen *screen() { return m_primaryScreen; } - QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const; + QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; virtual void setDesktopSize(int width, int height); virtual void setDisplayMetrics(int width, int height); void setScreenSize(int width, int height); bool isVirtualDesktop() { return true; } - QPlatformFontDatabase *fontDatabase() const; + QPlatformFontDatabase *fontDatabase() const override; #ifndef QT_NO_CLIPBOARD - QPlatformClipboard *clipboard() const; + QPlatformClipboard *clipboard() const override; #endif - QPlatformInputContext *inputContext() const; - QPlatformNativeInterface *nativeInterface() const; - QPlatformServices *services() const; + QPlatformInputContext *inputContext() const override; + QPlatformNativeInterface *nativeInterface() const override; + QPlatformServices *services() const override; #ifndef QT_NO_ACCESSIBILITY - virtual QPlatformAccessibility *accessibility() const; + virtual QPlatformAccessibility *accessibility() const override; #endif - QVariant styleHint(StyleHint hint) const; - Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const; + QVariant styleHint(StyleHint hint) const override; + Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override; - QStringList themeNames() const; - QPlatformTheme *createPlatformTheme(const QString &name) const; + QStringList themeNames() const override; + QPlatformTheme *createPlatformTheme(const QString &name) const override; static void setDefaultDisplayMetrics(int gw, int gh, int sw, int sh, int width, int height); static void setDefaultDesktopSize(int gw, int gh); diff --git a/src/plugins/platforms/android/qandroidplatformmenu.h b/src/plugins/platforms/android/qandroidplatformmenu.h index cb1b431d31..00968672c5 100644 --- a/src/plugins/platforms/android/qandroidplatformmenu.h +++ b/src/plugins/platforms/android/qandroidplatformmenu.h @@ -56,25 +56,25 @@ public: QAndroidPlatformMenu(); ~QAndroidPlatformMenu(); - void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before); - void removeMenuItem(QPlatformMenuItem *menuItem); - void syncMenuItem(QPlatformMenuItem *menuItem); - void syncSeparatorsCollapsible(bool enable); + void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override; + void removeMenuItem(QPlatformMenuItem *menuItem) override; + void syncMenuItem(QPlatformMenuItem *menuItem) override; + void syncSeparatorsCollapsible(bool enable) override; - void setTag(quintptr tag); - quintptr tag() const; - void setText(const QString &text); + void setTag(quintptr tag) override; + quintptr tag() const override; + void setText(const QString &text) override; QString text() const; - void setIcon(const QIcon &icon); + void setIcon(const QIcon &icon) override; QIcon icon() const; - void setEnabled(bool enabled); - bool isEnabled() const; - void setVisible(bool visible); + void setEnabled(bool enabled) override; + bool isEnabled() const override; + void setVisible(bool visible) override; bool isVisible() const; - void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item); + void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override; - QPlatformMenuItem *menuItemAt(int position) const; - QPlatformMenuItem *menuItemForTag(quintptr tag) const; + QPlatformMenuItem *menuItemAt(int position) const override; + QPlatformMenuItem *menuItemForTag(quintptr tag) const override; PlatformMenuItemsType menuItems() const; QMutex *menuItemsMutex(); diff --git a/src/plugins/platforms/android/qandroidplatformmenubar.h b/src/plugins/platforms/android/qandroidplatformmenubar.h index d98d02d5de..0316ea9362 100644 --- a/src/plugins/platforms/android/qandroidplatformmenubar.h +++ b/src/plugins/platforms/android/qandroidplatformmenubar.h @@ -55,11 +55,11 @@ public: QAndroidPlatformMenuBar(); ~QAndroidPlatformMenuBar(); - void insertMenu(QPlatformMenu *menu, QPlatformMenu *before); - void removeMenu(QPlatformMenu *menu); - void syncMenu(QPlatformMenu *menu); - void handleReparent(QWindow *newParentWindow); - QPlatformMenu *menuForTag(quintptr tag) const; + void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) override; + void removeMenu(QPlatformMenu *menu) override; + void syncMenu(QPlatformMenu *menu) override; + void handleReparent(QWindow *newParentWindow) override; + QPlatformMenu *menuForTag(quintptr tag) const override; QWindow *parentWindow() const; PlatformMenusType menus() const; diff --git a/src/plugins/platforms/android/qandroidplatformmenuitem.h b/src/plugins/platforms/android/qandroidplatformmenuitem.h index e843c9eedc..be5240cfa6 100644 --- a/src/plugins/platforms/android/qandroidplatformmenuitem.h +++ b/src/plugins/platforms/android/qandroidplatformmenuitem.h @@ -49,41 +49,41 @@ class QAndroidPlatformMenuItem: public QPlatformMenuItem { public: QAndroidPlatformMenuItem(); - void setTag(quintptr tag); - quintptr tag() const; + void setTag(quintptr tag) override; + quintptr tag() const override; - void setText(const QString &text); + void setText(const QString &text) override; QString text() const; - void setIcon(const QIcon &icon); + void setIcon(const QIcon &icon) override; QIcon icon() const; - void setMenu(QPlatformMenu *menu); + void setMenu(QPlatformMenu *menu) override; QAndroidPlatformMenu *menu() const; - void setVisible(bool isVisible); + void setVisible(bool isVisible) override; bool isVisible() const; - void setIsSeparator(bool isSeparator); + void setIsSeparator(bool isSeparator) override; bool isSeparator() const; - void setFont(const QFont &font); + void setFont(const QFont &font) override; - void setRole(MenuRole role); + void setRole(MenuRole role) override; MenuRole role() const; - void setCheckable(bool checkable); + void setCheckable(bool checkable) override; bool isCheckable() const; - void setChecked(bool isChecked); + void setChecked(bool isChecked) override; bool isChecked() const; - void setShortcut(const QKeySequence &shortcut); + void setShortcut(const QKeySequence &shortcut) override; - void setEnabled(bool enabled); + void setEnabled(bool enabled) override; bool isEnabled() const; - void setIconSize(int size); + void setIconSize(int size) override; private: quintptr m_tag; diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h index d3f6cf13a4..87a0829655 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h @@ -49,11 +49,11 @@ class QAndroidPlatformOpenGLContext : public QEGLPlatformContext { public: QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); - void swapBuffers(QPlatformSurface *surface); - bool makeCurrent(QPlatformSurface *surface); + void swapBuffers(QPlatformSurface *surface) override; + bool makeCurrent(QPlatformSurface *surface) override; private: - virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; static bool needsFBOReadBackWorkaround(); }; diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h index c7cb881973..12e86b3db4 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h @@ -56,18 +56,18 @@ public: explicit QAndroidPlatformOpenGLWindow(QWindow *window, EGLDisplay display); ~QAndroidPlatformOpenGLWindow(); - void setGeometry(const QRect &rect); + void setGeometry(const QRect &rect) override; EGLSurface eglSurface(EGLConfig config); - QSurfaceFormat format() const; + QSurfaceFormat format() const override; bool checkNativeSurface(EGLConfig config); - void applicationStateChanged(Qt::ApplicationState); + void applicationStateChanged(Qt::ApplicationState) override; void repaint(const QRegion ®ion) Q_DECL_OVERRIDE; protected: - virtual void surfaceChanged(JNIEnv *jniEnv, jobject surface, int w, int h); + void surfaceChanged(JNIEnv *jniEnv, jobject surface, int w, int h) override; void createEgl(EGLConfig config); void clearEgl(); diff --git a/src/plugins/platforms/android/qandroidplatformscreen.h b/src/plugins/platforms/android/qandroidplatformscreen.h index 6e601d5f87..923c9e8832 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.h +++ b/src/plugins/platforms/android/qandroidplatformscreen.h @@ -63,14 +63,14 @@ public: QAndroidPlatformScreen(); ~QAndroidPlatformScreen(); - QRect geometry() const { return QRect(QPoint(), m_size); } - QRect availableGeometry() const { return m_availableGeometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - QSizeF physicalSize() const { return m_physicalSize; } + QRect geometry() const override { return QRect(QPoint(), m_size); } + QRect availableGeometry() const override { return m_availableGeometry; } + int depth() const override { return m_depth; } + QImage::Format format() const override { return m_format; } + QSizeF physicalSize() const override { return m_physicalSize; } inline QWindow *topWindow() const; - QWindow *topLevelAt(const QPoint & p) const; + QWindow *topLevelAt(const QPoint & p) const override; // compositor api void addWindow(QAndroidPlatformWindow *window); @@ -100,11 +100,11 @@ protected: QSizeF m_physicalSize; private: - QDpi logicalDpi() const; - qreal pixelDensity() const; - Qt::ScreenOrientation orientation() const; - Qt::ScreenOrientation nativeOrientation() const; - void surfaceChanged(JNIEnv *env, jobject surface, int w, int h); + QDpi logicalDpi() const override; + qreal pixelDensity() const override; + Qt::ScreenOrientation orientation() const override; + Qt::ScreenOrientation nativeOrientation() const override; + void surfaceChanged(JNIEnv *env, jobject surface, int w, int h) override; void releaseSurface(); void applicationStateChanged(Qt::ApplicationState); diff --git a/src/plugins/platforms/android/qandroidplatformservices.h b/src/plugins/platforms/android/qandroidplatformservices.h index 5cdc3e95b2..6f2f0a394f 100644 --- a/src/plugins/platforms/android/qandroidplatformservices.h +++ b/src/plugins/platforms/android/qandroidplatformservices.h @@ -49,9 +49,9 @@ class QAndroidPlatformServices: public QPlatformServices { public: QAndroidPlatformServices(); - bool openUrl(const QUrl &url); - bool openDocument(const QUrl &url); - QByteArray desktopEnvironment() const; + bool openUrl(const QUrl &url) override; + bool openDocument(const QUrl &url) override; + QByteArray desktopEnvironment() const override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformtheme.h b/src/plugins/platforms/android/qandroidplatformtheme.h index b4d8fa35b1..7405c3cdbd 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.h +++ b/src/plugins/platforms/android/qandroidplatformtheme.h @@ -65,16 +65,16 @@ class QAndroidPlatformTheme: public QPlatformTheme { public: QAndroidPlatformTheme(QAndroidPlatformNativeInterface * androidPlatformNativeInterface); - virtual QPlatformMenuBar *createPlatformMenuBar() const; - virtual QPlatformMenu *createPlatformMenu() const; - virtual QPlatformMenuItem *createPlatformMenuItem() const; - virtual void showPlatformMenuBar(); - virtual const QPalette *palette(Palette type = SystemPalette) const; - virtual const QFont *font(Font type = SystemFont) const; - virtual QVariant themeHint(ThemeHint hint) const; + QPlatformMenuBar *createPlatformMenuBar() const override; + QPlatformMenu *createPlatformMenu() const override; + QPlatformMenuItem *createPlatformMenuItem() const override; + void showPlatformMenuBar() override; + const QPalette *palette(Palette type = SystemPalette) const override; + const QFont *font(Font type = SystemFont) const override; + QVariant themeHint(ThemeHint hint) const override; QString standardButtonText(int button) const Q_DECL_OVERRIDE; - virtual bool usePlatformNativeDialog(DialogType type) const; - virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; + bool usePlatformNativeDialog(DialogType type) const override; + QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override; private: diff --git a/src/plugins/platforms/android/qandroidplatformwindow.h b/src/plugins/platforms/android/qandroidplatformwindow.h index 8d69532d08..87e5cbaa4f 100644 --- a/src/plugins/platforms/android/qandroidplatformwindow.h +++ b/src/plugins/platforms/android/qandroidplatformwindow.h @@ -54,21 +54,21 @@ class QAndroidPlatformWindow: public QPlatformWindow public: explicit QAndroidPlatformWindow(QWindow *window); - void lower(); - void raise(); + void lower() override; + void raise() override; - void setVisible(bool visible); + void setVisible(bool visible) override; - void setWindowState(Qt::WindowState state); - void setWindowFlags(Qt::WindowFlags flags); + void setWindowState(Qt::WindowState state) override; + void setWindowFlags(Qt::WindowFlags flags) override; Qt::WindowFlags windowFlags() const; - void setParent(const QPlatformWindow *window); - WId winId() const { return m_windowId; } + void setParent(const QPlatformWindow *window) override; + WId winId() const override { return m_windowId; } QAndroidPlatformScreen *platformScreen() const; - void propagateSizeHints(); - void requestActivateWindow(); + void propagateSizeHints() override; + void requestActivateWindow() override; void updateStatusBarVisibility(); inline bool isRaster() const { if ((window()->flags() & Qt::ForeignWindow) == Qt::ForeignWindow) @@ -77,7 +77,7 @@ public: return window()->surfaceType() == QSurface::RasterSurface || window()->surfaceType() == QSurface::RasterGLSurface; } - bool isExposed() const; + bool isExposed() const override; virtual void applicationStateChanged(Qt::ApplicationState); @@ -87,7 +87,7 @@ public: virtual void repaint(const QRegion &) { } protected: - void setGeometry(const QRect &rect); + void setGeometry(const QRect &rect) override; protected: Qt::WindowFlags m_windowFlags; diff --git a/src/plugins/platforms/android/qandroidsystemlocale.h b/src/plugins/platforms/android/qandroidsystemlocale.h index 26af1ee51d..bc96d2e8f6 100644 --- a/src/plugins/platforms/android/qandroidsystemlocale.h +++ b/src/plugins/platforms/android/qandroidsystemlocale.h @@ -50,8 +50,8 @@ class QAndroidSystemLocale : public QSystemLocale public: QAndroidSystemLocale(); - virtual QVariant query(QueryType type, QVariant in) const; - virtual QLocale fallbackUiLocale() const; + QVariant query(QueryType type, QVariant in) const override; + QLocale fallbackUiLocale() const override; private: void getLocaleFromJava() const; -- cgit v1.2.3 From 4c375f75e0ed38d297dc44746e2e00f34f98269b Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 29 Nov 2016 14:23:34 +0300 Subject: Android: Use override instead of Q_DECL_OVERRIDE ... for consistency. Change-Id: I37afaff6f7512a1cd09f0f31996b9bedc6cb3bab Reviewed-by: BogDan Vatra --- .../platforms/android/qandroidplatformforeignwindow.h | 12 ++++++------ src/plugins/platforms/android/qandroidplatformopenglwindow.h | 2 +- src/plugins/platforms/android/qandroidplatformtheme.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/android/qandroidplatformforeignwindow.h b/src/plugins/platforms/android/qandroidplatformforeignwindow.h index 100e0adcdf..d42c36dcee 100644 --- a/src/plugins/platforms/android/qandroidplatformforeignwindow.h +++ b/src/plugins/platforms/android/qandroidplatformforeignwindow.h @@ -51,12 +51,12 @@ class QAndroidPlatformForeignWindow : public QAndroidPlatformWindow public: explicit QAndroidPlatformForeignWindow(QWindow *window); ~QAndroidPlatformForeignWindow(); - void lower() Q_DECL_OVERRIDE; - void raise() Q_DECL_OVERRIDE; - void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; - void setVisible(bool visible) Q_DECL_OVERRIDE; - void applicationStateChanged(Qt::ApplicationState state) Q_DECL_OVERRIDE; - void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE; + void lower() override; + void raise() override; + void setGeometry(const QRect &rect) override; + void setVisible(bool visible) override; + void applicationStateChanged(Qt::ApplicationState state) override; + void setParent(const QPlatformWindow *window) override; private: int m_surfaceId; diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h index 12e86b3db4..d3072f766d 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h @@ -64,7 +64,7 @@ public: void applicationStateChanged(Qt::ApplicationState) override; - void repaint(const QRegion ®ion) Q_DECL_OVERRIDE; + void repaint(const QRegion ®ion) override; protected: void surfaceChanged(JNIEnv *jniEnv, jobject surface, int w, int h) override; diff --git a/src/plugins/platforms/android/qandroidplatformtheme.h b/src/plugins/platforms/android/qandroidplatformtheme.h index 7405c3cdbd..b49d2516f1 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.h +++ b/src/plugins/platforms/android/qandroidplatformtheme.h @@ -72,7 +72,7 @@ public: const QPalette *palette(Palette type = SystemPalette) const override; const QFont *font(Font type = SystemFont) const override; QVariant themeHint(ThemeHint hint) const override; - QString standardButtonText(int button) const Q_DECL_OVERRIDE; + QString standardButtonText(int button) const override; bool usePlatformNativeDialog(DialogType type) const override; QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override; -- cgit v1.2.3 From 1155ca10f8e329d253f7dd58dad396321116798c Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 23 Nov 2016 11:13:48 +0100 Subject: QSettings: Avoid unneeded sync() on destruction ... if sync() has already been called manually. Change-Id: I11bd6810aa3c1065a72ffaa2001d1bdbf8bf9c89 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qsettings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 480a777457..8c67d97afa 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2705,6 +2705,7 @@ void QSettings::sync() { Q_D(QSettings); d->sync(); + d->pendingChanges = false; } /*! -- cgit v1.2.3 From 94b83ae14201e9c28b9f4817ee020814300860aa Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 25 Nov 2016 18:29:49 +0100 Subject: Fix bilinear sampling of more than 8x rotated transforms The check for 8x zoom was inverted and checked for 1/8x zoom. Change-Id: I45156db709bab6b702769c2a70d4d2af51b5533a Reviewed-by: Eirik Aavitsland Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qdrawhelper.cpp | 4 ++-- tests/auto/other/lancelot/scripts/pixmap_rotation.qps | 5 +++-- tests/auto/other/lancelot/scripts/pixmap_rotation2.qps | 8 ++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tests/auto/other/lancelot/scripts/pixmap_rotation2.qps diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 656b04fdf3..724af095ad 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2231,7 +2231,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c } } } else { //rotation - if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) { + if (std::abs(data->m11) < (1./8.) || std::abs(data->m22) < (1./8.)) { //if we are zooming more than 8 times, we use 8bit precision for the position. while (b < end) { int x1 = (fx >> 16); @@ -2717,7 +2717,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0); layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0); - if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) { + if (std::abs(data->m11) < (1./8.) || std::abs(data->m22) < (1./8.)) { //if we are zooming more than 8 times, we use 8bit precision for the position. for (int i = 0; i < len; ++i) { int distx = (fracX & 0x0000ffff) >> 8; diff --git a/tests/auto/other/lancelot/scripts/pixmap_rotation.qps b/tests/auto/other/lancelot/scripts/pixmap_rotation.qps index 2f1ffb53e6..8427af85af 100644 --- a/tests/auto/other/lancelot/scripts/pixmap_rotation.qps +++ b/tests/auto/other/lancelot/scripts/pixmap_rotation.qps @@ -22,9 +22,10 @@ end_block resetMatrix translate 340 120 +setRenderHint SmoothPixmapTransformation repeat_block drawing resetMatrix -drawText 50 240 "Normal X form" -drawText 270 240 "Smooth xform" \ No newline at end of file +drawText 50 240 "Normal Xform" +drawText 270 240 "Smooth Xform" diff --git a/tests/auto/other/lancelot/scripts/pixmap_rotation2.qps b/tests/auto/other/lancelot/scripts/pixmap_rotation2.qps new file mode 100644 index 0000000000..dfb93fe09c --- /dev/null +++ b/tests/auto/other/lancelot/scripts/pixmap_rotation2.qps @@ -0,0 +1,8 @@ +# Version: 1 +# CheckVsReference: 1% + +setRenderHint SmoothPixmapTransformation +translate 400 -120 +rotate 45 +scale 400 400 +drawImage solid2x2.png 0 0 -- cgit v1.2.3 From c1093e2d2adc0963a6853b84dc8c34c3333c6f6e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 29 Nov 2016 15:17:57 +0100 Subject: Tweak wording of QNetworkProxy doc for SOCKS5 It was phrased for an out-of-date version of Qt. Adapt phrasing to be future-proof. Reflow text. Change-Id: Ic026a7719ba6fb1de2830358a75cd6f30c5f8897 Reviewed-by: Timur Pocheptsov Reviewed-by: Thiago Macieira --- src/network/kernel/qnetworkproxy.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 94719e9c2d..ce491e0fcb 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -82,7 +82,9 @@ \section1 SOCKS5 - The SOCKS5 support in Qt 4 is based on \l{http://www.rfc-editor.org/rfc/rfc1928.txt}{RFC 1928} and \l{http://www.rfc-editor.org/rfc/rfc1929.txt}{RFC 1929}. + The SOCKS5 support since Qt 4 is based on + \l{http://www.rfc-editor.org/rfc/rfc1928.txt}{RFC 1928} and + \l{http://www.rfc-editor.org/rfc/rfc1929.txt}{RFC 1929}. The supported authentication methods are no authentication and username/password authentication. Both IPv4 and IPv6 are supported. Domain names are resolved through the SOCKS5 server if -- cgit v1.2.3 From 6aa2d49d5f98d8e23a32555a45c58dc4c7c4bb69 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Nov 2016 09:50:13 +0100 Subject: tst_qchar: Silence deprecation warning Change-Id: I248d815862a4172ceae6ba45391cba0a30b8e1ae Reviewed-by: Marc Mutz --- tests/auto/corelib/tools/qchar/tst_qchar.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 92585fd471..fb436b67d6 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -72,6 +72,9 @@ private slots: void unicodeVersion(); }; +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + void tst_QChar::operator_eqeq_int() { { @@ -96,6 +99,8 @@ void tst_QChar::operator_eqeq_int() } } +QT_WARNING_POP + void tst_QChar::operators_data() { QTest::addColumn("lhs"); -- cgit v1.2.3 From 1e303601a7355fb8282f0fcc3a8c4e86de944448 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Nov 2016 12:38:51 +0100 Subject: Fix warnings in tests (MinGW/MSCV) tst_qtcpsocket.cpp:606:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] tst_qtcpsocket.cpp:670:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] tst_qfile.cpp(2661): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) tst_qarraydata.cpp(760): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) main.cpp:40:33: warning: ignoring return value of 'char* fgets(char*, int, FILE*)', declared with attribute warn_unused_result [-Wunused-result] Change-Id: I80ccef29b71af6a2c3d45a79aedaeb37f49bba72 Reviewed-by: Marc Mutz Reviewed-by: Frederik Gladhorn --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 5 +++-- tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp | 4 ++-- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 4 ++-- tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp | 4 +++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 287b8aebd8..2ef4c2c6a1 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2618,9 +2618,10 @@ void tst_QFile::appendAndRead() // Write blocks and read them back for (int j = 0; j < 18; ++j) { - writeFile.write(QByteArray(1 << j, '@')); + const int size = 1 << j; + writeFile.write(QByteArray(size, '@')); writeFile.flush(); - QCOMPARE(readFile.read(1 << j).size(), 1 << j); + QCOMPARE(readFile.read(size).size(), size); } readFile.close(); diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index 0c41f66357..3be8379d29 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -751,8 +751,8 @@ void tst_QArrayData::alignment_data() { QTest::addColumn("alignment"); - for (int i = 1; i < 10; ++i) { - size_t alignment = 1u << i; + for (size_t i = 1; i < 10; ++i) { + size_t alignment = size_t(1u) << i; QTest::newRow(qPrintable(QString::number(alignment))) << alignment; } } diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index fe1057bdde..9fd5620cec 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -603,7 +603,7 @@ void tst_QTcpSocket::bind() if (port) QCOMPARE(int(boundPort), port); fd = socket->socketDescriptor(); - QVERIFY(fd != INVALID_SOCKET); + QVERIFY(fd != qintptr(INVALID_SOCKET)); } else { QVERIFY(!socket->bind(addr, port)); QCOMPARE(socket->localPort(), quint16(0)); @@ -667,7 +667,7 @@ void tst_QTcpSocket::bindThenResolveHost() QCOMPARE(socket->state(), QAbstractSocket::BoundState); quint16 boundPort = socket->localPort(); qintptr fd = socket->socketDescriptor(); - QVERIFY(fd != INVALID_SOCKET); + QVERIFY(fd != quint16(INVALID_SOCKET)); dummySocket.close(); diff --git a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp index 46002dd326..5e75f7db3c 100644 --- a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp @@ -37,7 +37,9 @@ int main(int, char **argv) fflush(stdout); // wait for a newline - fgets(buf, sizeof buf, stdin); + const char *result = fgets(buf, sizeof buf, stdin); + if (result != buf) + return -1; puts(msg); fflush(stdout); -- cgit v1.2.3 From 0c8f3229de8ec4a8e70d4b41672074b94a45b1fe Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 12:57:53 +0100 Subject: Clean up config handling of logging backends Turn them into proper private features, and remove setting of defines in the pri file. Change-Id: Iafc11e93d4a9349bf15971dc1adac9a828ea03f6 Reviewed-by: Oswald Buddenhagen --- src/corelib/configure.json | 7 +++---- src/corelib/global/global.pri | 12 ++---------- src/corelib/global/qconfig-bootstrapped.h | 3 +++ src/corelib/global/qlogging.cpp | 23 ++++++++++++----------- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 0d1954c3a8..89f824d880 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -289,7 +289,7 @@ "label": "journald", "autoDetect": false, "condition": "libs.journald", - "output": [ "privateConfig" ] + "output": [ "privateFeature" ] }, "std-atomic64": { "label": "64 bit atomic operations", @@ -363,14 +363,13 @@ "slog2": { "label": "slog2", "condition": "libs.slog2", - "emitIf": "config.qnx", - "output": [ "privateConfig" ] + "output": [ "privateFeature" ] }, "syslog": { "label": "syslog", "autoDetect": false, "condition": "tests.syslog", - "output": [ "privateConfig" ] + "output": [ "privateFeature" ] }, "threadsafe-cloexec": { "label": "Threadsafe pipe creation", diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index f74662b464..36655ca1dd 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -47,19 +47,11 @@ if(linux*|hurd*):!cross_compile:!static:!*-armcc* { DEFINES += ELF_INTERPRETER=\\\"$$system(LC_ALL=C readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" } -slog2 { +qtConfig(slog2): \ LIBS_PRIVATE += -lslog2 - DEFINES += QT_USE_SLOG2 -} -journald { +qtConfig(journald): \ QMAKE_USE_PRIVATE += journald - DEFINES += QT_USE_JOURNALD -} - -syslog { - DEFINES += QT_USE_SYSLOG -} gcc:ltcg { versiontagging_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) $(INCPATH) diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 4629a57485..0cbd52c205 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -69,10 +69,13 @@ #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_NO_DATASTREAM #define QT_FEATURE_iconv -1 +#define QT_FEATURE_journald -1 #define QT_NO_LIBRARY #define QT_FEATURE_library -1 #define QT_NO_QOBJECT #define QT_NO_SYSTEMLOCALE +#define QT_FEATURE_slog2 -1 +#define QT_FEATURE_syslog -1 #define QT_NO_THREAD #define QT_FEATURE_timezone -1 #define QT_FEATURE_topleveldomain -1 diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index f344873276..0506d372b6 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "qglobal_p.h" #include "qlogging.h" #include "qlist.h" #include "qbytearray.h" @@ -59,7 +60,7 @@ #ifdef Q_OS_WIN #include #endif -#ifdef QT_USE_SLOG2 +#if QT_CONFIG(slog2) #include #endif @@ -67,12 +68,12 @@ #include #endif -#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) +#if QT_CONFIG(journald) # define SD_JOURNAL_SUPPRESS_LOCATION # include # include #endif -#if defined(QT_USE_SYSLOG) && !defined(QT_BOOTSTRAPPED) +#if QT_CONFIG(syslog) # include #endif #ifdef Q_OS_UNIX @@ -93,7 +94,7 @@ # endif #endif -#if defined(QT_USE_SLOG2) +#if QT_CONFIG(slog2) extern char *__progname; #endif @@ -1281,7 +1282,7 @@ static QString formatBacktraceForLogMessage(const QMessagePattern::BacktracePara } #endif // QLOGGING_HAVE_BACKTRACE && !QT_BOOTSTRAPPED -#if defined(QT_USE_SLOG2) +#if QT_CONFIG(slog2) #ifndef QT_LOG_CODE #define QT_LOG_CODE 9000 #endif @@ -1330,7 +1331,7 @@ static void slog2_default_handler(QtMsgType msgType, const char *message) //writes to the slog2 buffer slog2c(NULL, QT_LOG_CODE, severity, message); } -#endif // QT_USE_SLOG2 +#endif // slog2 Q_GLOBAL_STATIC(QMessagePattern, qMessagePattern) @@ -1479,7 +1480,7 @@ static QBasicAtomicPointer msgHandler = Q_BASIC_A // pointer to QtMessageHandler debug handler (with context) static QBasicAtomicPointer messageHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMessageHandler); -#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) +#if QT_CONFIG(journald) static void systemd_default_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &message) @@ -1513,7 +1514,7 @@ static void systemd_default_message_handler(QtMsgType type, } #endif -#ifdef QT_USE_SYSLOG +#if QT_CONFIG(syslog) static void syslog_default_message_handler(QtMsgType type, const char *message) { int priority = LOG_INFO; // Informational @@ -1577,14 +1578,14 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con logMessage.append(QLatin1Char('\n')); OutputDebugString(reinterpret_cast(logMessage.utf16())); return; -#elif defined(QT_USE_SLOG2) +#elif QT_CONFIG(slog2) logMessage.append(QLatin1Char('\n')); slog2_default_handler(type, logMessage.toLocal8Bit().constData()); return; -#elif defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED) +#elif QT_CONFIG(journald) systemd_default_message_handler(type, context, logMessage); return; -#elif defined(QT_USE_SYSLOG) && !defined(QT_BOOTSTRAPPED) +#elif QT_CONFIG(syslog) syslog_default_message_handler(type, logMessage.toUtf8().constData()); return; #elif defined(Q_OS_ANDROID) -- cgit v1.2.3 From e3555fe9705a44072a05b95cca36579745e14125 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 13:32:19 +0100 Subject: Properly use QT_CONFIG macro to check for ICU And remove the QT_USE_ICU define. Change-Id: I8134ee18af7c90ed7070926ca31b3a57b3ec37dd Reviewed-by: Oswald Buddenhagen --- src/corelib/codecs/qtextcodec.cpp | 18 +++++++++--------- src/corelib/global/qconfig-bootstrapped.h | 1 + src/corelib/tools/qcollator_p.h | 6 +++--- src/corelib/tools/qlocale.cpp | 4 ++-- src/corelib/tools/qlocale_p.h | 2 +- src/corelib/tools/qstring.cpp | 4 ++-- src/corelib/tools/qtimezone.cpp | 12 ++++++------ src/corelib/tools/qtimezoneprivate.cpp | 2 +- src/corelib/tools/qtimezoneprivate_p.h | 12 ++++++------ src/corelib/tools/qtimezoneprivate_tz.cpp | 20 ++++++++++---------- src/corelib/tools/tools.pri | 1 - 11 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 0c9036aadf..aed3532024 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -58,7 +58,7 @@ #if !defined(QT_BOOTSTRAPPED) # include "qtsciicodec_p.h" # include "qisciicodec_p.h" -#if defined(QT_USE_ICU) +#if QT_CONFIG(icu) #include "qicucodec_p.h" #else #if QT_CONFIG(iconv) @@ -79,7 +79,7 @@ # endif // !Q_OS_INTEGRITY #endif // !QT_NO_BIG_CODECS -#endif // QT_USE_ICU +#endif // icu #endif // QT_BOOTSTRAPPED #include "qmutex.h" @@ -99,7 +99,7 @@ typedef QList::ConstIterator ByteArrayListConstIt; Q_GLOBAL_STATIC_WITH_ARGS(QMutex, textCodecsMutex, (QMutex::Recursive)); QMutex *qTextCodecsMutex() { return textCodecsMutex(); } -#if !defined(QT_USE_ICU) +#if !QT_CONFIG(icu) static char qtolower(char c) { if (c >= 'A' && c <= 'Z') return c + 0x20; return c; } static bool qisalnum(char c) @@ -306,7 +306,7 @@ static void setup() } #else static void setup() {} -#endif // QT_USE_ICU +#endif // icu /*! \enum QTextCodec::ConversionFlag @@ -519,7 +519,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) return 0; setup(); -#ifndef QT_USE_ICU +#if !QT_CONFIG(icu) QTextCodecCache *cache = &globalData->codecCache; QTextCodec *codec; if (cache) { @@ -586,7 +586,7 @@ QTextCodec* QTextCodec::codecForMib(int mib) } } -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) return QIcuCodec::codecForMibUnlocked(mib); #else return 0; @@ -618,7 +618,7 @@ QList QTextCodec::availableCodecs() codecs += (*it)->aliases(); } -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) codecs += QIcuCodec::availableCodecs(); #endif @@ -634,7 +634,7 @@ QList QTextCodec::availableCodecs() */ QList QTextCodec::availableMibs() { -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) return QIcuCodec::availableMibs(); #else QMutexLocker locker(textCodecsMutex()); @@ -688,7 +688,7 @@ QTextCodec* QTextCodec::codecForLocale() QTextCodec *codec = globalData->codecForLocale.loadAcquire(); if (!codec) { -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) textCodecsMutex()->lock(); codec = QIcuCodec::defaultCodecUnlocked(); textCodecsMutex()->unlock(); diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 0cbd52c205..d0e45478cc 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -69,6 +69,7 @@ #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_NO_DATASTREAM #define QT_FEATURE_iconv -1 +#define QT_FEATURE_icu -1 #define QT_FEATURE_journald -1 #define QT_NO_LIBRARY #define QT_FEATURE_library -1 diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h index fbbce00676..423ba0325a 100644 --- a/src/corelib/tools/qcollator_p.h +++ b/src/corelib/tools/qcollator_p.h @@ -55,7 +55,7 @@ #include #include "qcollator.h" #include -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) #include #elif defined(Q_OS_OSX) #include @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) typedef UCollator *CollatorType; typedef QByteArray CollatorKeyType; @@ -90,7 +90,7 @@ class Q_CORE_EXPORT QCollatorPrivate public: QAtomicInt ref; QLocale locale; -#if defined(Q_OS_WIN) && !defined(QT_USE_ICU) +#if defined(Q_OS_WIN) && !QT_CONFIG(icu) #ifdef USE_COMPARESTRINGEX QString localeName; #else diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 847fc2d55e..f499681ca9 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2431,7 +2431,7 @@ Qt::LayoutDirection QLocale::textDirection() const */ QString QLocale::toUpper(const QString &str) const { -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) bool ok = true; QString result = QIcu::toUpper(d->bcp47Name('_'), str, &ok); if (ok) @@ -2455,7 +2455,7 @@ QString QLocale::toUpper(const QString &str) const */ QString QLocale::toLower(const QString &str) const { -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) bool ok = true; const QString result = QIcu::toLower(d->bcp47Name('_'), str, &ok); if (ok) diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index c83c9d3333..20eff8fd64 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -134,7 +134,7 @@ Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_MOVABLE_TYPE); #endif -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) namespace QIcu { QString toUpper(const QByteArray &localeId, const QString &str, bool *ok); QString toLower(const QByteArray &localeId, const QString &str, bool *ok); diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index eef375fe72..8888eced87 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -5575,7 +5575,7 @@ int QString::localeAwareCompare(const QString &other) const return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); } -#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN) +#if QT_CONFIG(icu) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN) Q_GLOBAL_STATIC(QThreadStorage, defaultCollator) #endif @@ -5621,7 +5621,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, CFRelease(thisString); CFRelease(otherString); return result; -#elif defined(QT_USE_ICU) +#elif QT_CONFIG(icu) if (!defaultCollator()->hasLocalData()) defaultCollator()->setLocalData(QCollator()); return defaultCollator()->localData().compare(data1, length1, data2, length2); diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index e423d9af0c..359c2d0bdb 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -54,11 +54,11 @@ QT_BEGIN_NAMESPACE static QTimeZonePrivate *newBackendTimeZone() { #ifdef QT_NO_SYSTEMLOCALE -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) return new QIcuTimeZonePrivate(); #else return new QUtcTimeZonePrivate(); -#endif // QT_USE_ICU +#endif #else #if defined Q_OS_MAC return new QMacTimeZonePrivate(); @@ -69,7 +69,7 @@ static QTimeZonePrivate *newBackendTimeZone() // Registry based timezone backend not available on WinRT #elif defined Q_OS_WIN return new QWinTimeZonePrivate(); -#elif defined QT_USE_ICU +#elif QT_CONFIG(icu) return new QIcuTimeZonePrivate(); #else return new QUtcTimeZonePrivate(); @@ -81,11 +81,11 @@ static QTimeZonePrivate *newBackendTimeZone() static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId) { #ifdef QT_NO_SYSTEMLOCALE -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) return new QIcuTimeZonePrivate(ianaId); #else return new QUtcTimeZonePrivate(ianaId); -#endif // QT_USE_ICU +#endif #else #if defined Q_OS_MAC return new QMacTimeZonePrivate(ianaId); @@ -96,7 +96,7 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId) // Registry based timezone backend not available on WinRT #elif defined Q_OS_WIN return new QWinTimeZonePrivate(ianaId); -#elif defined QT_USE_ICU +#elif QT_CONFIG(icu) return new QIcuTimeZonePrivate(ianaId); #else return new QUtcTimeZonePrivate(ianaId); diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index 56da197542..2ff03eddec 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -590,7 +590,7 @@ template<> QTimeZonePrivate *QSharedDataPointer::clone() } /* - UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and QT_USE_ICU not set, + UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and ICU is not being used, or for QDateTimes with a Qt:Spec of Qt::OffsetFromUtc. */ diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index d7fbb12344..d06784b0f9 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -56,9 +56,9 @@ #include "qlocale_p.h" #include "qvector.h" -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) #include -#endif // QT_USE_ICU +#endif #ifdef Q_OS_MAC #ifdef __OBJC__ @@ -227,7 +227,7 @@ private: int m_offsetFromUtc; }; -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate { public: @@ -268,7 +268,7 @@ private: UCalendar *m_ucal; }; -#endif // QT_USE_ICU +#endif #if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID struct QTzTransitionTime @@ -337,9 +337,9 @@ private: QVector m_tranTimes; QVector m_tranRules; QList m_abbreviations; -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) mutable QSharedDataPointer m_icu; -#endif // QT_USE_ICU +#endif QByteArray m_posixRule; }; #endif // Q_OS_UNIX diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index 96d04df0e2..10b61c3a40 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -598,18 +598,18 @@ static QVector calculatePosixTransitions(const QByteArra // Create the system default time zone QTzTimeZonePrivate::QTzTimeZonePrivate() -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) : m_icu(0) -#endif // QT_USE_ICU +#endif { init(systemTimeZoneId()); } // Create a named time zone QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId) -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) : m_icu(0) -#endif // QT_USE_ICU +#endif { init(ianaId); } @@ -617,9 +617,9 @@ QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId) QTzTimeZonePrivate::QTzTimeZonePrivate(const QTzTimeZonePrivate &other) : QTimeZonePrivate(other), m_tranTimes(other.m_tranTimes), m_tranRules(other.m_tranRules), m_abbreviations(other.m_abbreviations), -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) m_icu(other.m_icu), -#endif // QT_USE_ICU +#endif m_posixRule(other.m_posixRule) { } @@ -778,7 +778,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch, QTimeZone::NameType nameType, const QLocale &locale) const { -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) if (!m_icu) m_icu = new QIcuTimeZonePrivate(m_id); // TODO small risk may not match if tran times differ due to outdated files @@ -788,7 +788,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch, #else Q_UNUSED(nameType) Q_UNUSED(locale) -#endif // QT_USE_ICU +#endif return abbreviation(atMSecsSinceEpoch); } @@ -796,7 +796,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType, const QLocale &locale) const { -#ifdef QT_USE_ICU +#if QT_CONFIG(icu) if (!m_icu) m_icu = new QIcuTimeZonePrivate(m_id); // TODO small risk may not match if tran times differ due to outdated files @@ -807,7 +807,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType, Q_UNUSED(timeType) Q_UNUSED(nameType) Q_UNUSED(locale) -#endif // QT_USE_ICU +#endif // If no ICU available then have to use abbreviations instead // Abbreviations don't have GenericTime if (timeType == QTimeZone::GenericTime) diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index fb80bbd6b8..fa8e07abbc 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -144,7 +144,6 @@ qtConfig(icu) { SOURCES += tools/qlocale_icu.cpp \ tools/qcollator_icu.cpp - DEFINES += QT_USE_ICU } else: win32 { SOURCES += tools/qcollator_win.cpp } else: macx { -- cgit v1.2.3 From 7d12ef183ee6b7909c451a3042ecf8b1fc20f87f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 14:10:35 +0100 Subject: Clean up style selection code Turn styles into proper features and test for them using qtConfig/QT_CONFIG. Change-Id: I7e28785a46723364b90d8aa286f4d6e5ab085651 Reviewed-by: Oswald Buddenhagen --- src/widgets/configure.json | 12 +++--- src/widgets/dialogs/qwizard.cpp | 55 +++++++++++++------------- src/widgets/dialogs/qwizard_win.cpp | 7 +++- src/widgets/dialogs/qwizard_win_p.h | 4 +- src/widgets/graphicsview/qgraphicswidget_p.cpp | 2 +- src/widgets/itemviews/qtreeview.cpp | 2 +- src/widgets/styles/qandroidstyle.cpp | 4 +- src/widgets/styles/qandroidstyle_p.h | 4 +- src/widgets/styles/qfusionstyle.cpp | 4 +- src/widgets/styles/qfusionstyle_p.h | 4 +- src/widgets/styles/qfusionstyle_p_p.h | 4 +- src/widgets/styles/qmacstyle_mac_p.h | 2 +- src/widgets/styles/qstylefactory.cpp | 34 ++++++++-------- src/widgets/styles/qstyleoption.cpp | 5 ++- src/widgets/styles/qwindowsstyle.cpp | 4 +- src/widgets/styles/qwindowsstyle_p.h | 4 +- src/widgets/styles/qwindowsstyle_p_p.h | 4 +- src/widgets/styles/qwindowsvistastyle.cpp | 2 +- src/widgets/styles/qwindowsvistastyle_p.h | 4 +- src/widgets/styles/qwindowsvistastyle_p_p.h | 4 +- src/widgets/styles/qwindowsxpstyle.cpp | 2 +- src/widgets/styles/qwindowsxpstyle_p.h | 4 +- src/widgets/styles/qwindowsxpstyle_p_p.h | 4 +- src/widgets/styles/styles.pri | 38 ++++++------------ src/widgets/widgets/qcombobox.cpp | 2 +- src/widgets/widgets/qmdiarea.cpp | 2 +- src/widgets/widgets/qmdisubwindow.cpp | 24 +++++------ 27 files changed, 115 insertions(+), 126 deletions(-) diff --git a/src/widgets/configure.json b/src/widgets/configure.json index b241fcdf11..1e72b61886 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -44,31 +44,31 @@ }, "style-fusion": { "label": "Fusion", - "output": [ "styles" ] + "output": [ "privateFeature", "styles" ] }, "style-mac": { "label": "macOS", "condition": "config.osx", - "output": [ "styles" ] + "output": [ "privateFeature", "styles" ] }, "style-windows": { "label": "Windows", - "output": [ "styles" ] + "output": [ "privateFeature", "styles" ] }, "style-windowsxp": { "label": "WindowsXP", "condition": "features.style-windows && config.win32 && !config.winrt && tests.uxtheme", - "output": [ "styles" ] + "output": [ "privateFeature", "styles" ] }, "style-windowsvista": { "label": "WindowsVista", "condition": "features.style-windowsxp", - "output": [ "styles" ] + "output": [ "privateFeature", "styles" ] }, "style-android": { "label": "Android", "autoDetect": "config.android", - "output": [ "styles" ] + "output": [ "privateFeature", "styles" ] }, "style-stylesheet": { "label": "QStyleSheetStyle", diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index bcad069b50..9153d7ea41 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qwizard.h" +#include #ifndef QT_NO_WIZARD @@ -61,7 +62,7 @@ #include #include #include -#elif !defined(QT_NO_STYLE_WINDOWSVISTA) +#elif QT_CONFIG(style_windowsvista) #include "qwizard_win_p.h" #include "qtimer.h" #endif @@ -295,7 +296,7 @@ public: protected: void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) private: bool vistaDisabled() const; #endif @@ -342,7 +343,7 @@ QWizardHeader::QWizardHeader(QWidget *parent) layout->addWidget(logoLabel, 1, 5, 5, 1); } -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) bool QWizardHeader::vistaDisabled() const { bool styleDisabled = false; @@ -362,7 +363,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title, Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat) { bool modern = ((info.wizStyle == QWizard::ModernStyle) -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) || ((info.wizStyle == QWizard::AeroStyle && QVistaHelper::vistaState() == QVistaHelper::Classic) || vistaDisabled()) #endif @@ -525,7 +526,7 @@ void QWizardPagePrivate::_q_updateCachedCompleteState() class QWizardAntiFlickerWidget : public QWidget { public: -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) QWizardPrivate *wizardPrivate; QWizardAntiFlickerWidget(QWizard *wizard, QWizardPrivate *wizardPrivate) : QWidget(wizard) @@ -572,7 +573,7 @@ public: , titleLabel(0) , subTitleLabel(0) , bottomRuler(0) -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) , vistaHelper(0) , vistaInitPending(false) , vistaState(QVistaHelper::Dirty) @@ -586,7 +587,7 @@ public: { std::fill(btns, btns + QWizard::NButtons, static_cast(0)); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) vistaInitPending = true; @@ -611,7 +612,7 @@ public: void setButtonLayout(const QWizard::WizardButton *array, int size); bool buttonLayoutContains(QWizard::WizardButton which); void updatePixmap(QWizard::WizardPixmap which); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) bool vistaDisabled() const; bool isVistaThemeEnabled(QVistaHelper::VistaState state) const; bool handleAeroStyleChange(); @@ -677,7 +678,7 @@ public: QHBoxLayout *buttonLayout; QGridLayout *mainLayout; -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) QVistaHelper *vistaHelper; bool vistaInitPending; QVistaHelper::VistaState vistaState; @@ -692,7 +693,7 @@ public: static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate) { -#if defined(QT_NO_STYLE_WINDOWSVISTA) +#if !QT_CONFIG(style_windowsvista) Q_UNUSED(wizardPrivate); #endif const bool macStyle = (wstyle == QWizard::MacStyle); @@ -730,7 +731,7 @@ void QWizardPrivate::init() opts = QWizard::HelpButtonOnRight; } -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) vistaHelper = new QVistaHelper(q); #endif @@ -959,7 +960,7 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage() info.wizStyle = wizStyle; if (info.wizStyle == QWizard::AeroStyle -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) && (QVistaHelper::vistaState() == QVistaHelper::Classic || vistaDisabled()) #endif ) @@ -1337,7 +1338,7 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info) Q_Q(QWizard); int extraHeight = 0; -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) if (isVistaThemeEnabled()) extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset(); #endif @@ -1560,7 +1561,7 @@ void QWizardPrivate::updatePixmap(QWizard::WizardPixmap which) } } -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) bool QWizardPrivate::vistaDisabled() const { Q_Q(const QWizard); @@ -1642,7 +1643,7 @@ bool QWizardPrivate::handleAeroStyleChange() bool QWizardPrivate::isVistaThemeEnabled() const { -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) return isVistaThemeEnabled(QVistaHelper::VistaAero) || isVistaThemeEnabled(QVistaHelper::VistaBasic); #else @@ -1720,7 +1721,7 @@ void QWizardPrivate::_q_updateButtonStates() if (QPushButton *finishPush = qobject_cast(btn.finish)) finishPush->setDefault(!canContinue && useDefault); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) if (isVistaThemeEnabled()) { vistaHelper->backButton()->setEnabled(btn.back->isEnabled()); vistaHelper->backButton()->setVisible(backButtonVisible); @@ -1788,7 +1789,7 @@ QPixmap QWizardPrivate::findDefaultBackgroundPixmap() #endif -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) { if (wizardPrivate->isVistaThemeEnabled()) { @@ -2556,7 +2557,7 @@ void QWizard::setWizardStyle(WizardStyle style) const bool styleChange = style != d->wizStyle; -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) const bool aeroStyleChange = d->vistaInitPending || d->vistaStateChanged || (styleChange && (style == AeroStyle || d->wizStyle == AeroStyle)); d->vistaStateChanged = false; @@ -2564,14 +2565,14 @@ void QWizard::setWizardStyle(WizardStyle style) #endif if (styleChange -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) || aeroStyleChange #endif ) { d->disableUpdates(); d->wizStyle = style; d->updateButtonTexts(); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) if (aeroStyleChange) { //Send a resizeevent since the antiflicker widget probably needs a new size //because of the backbutton in the window title @@ -2582,7 +2583,7 @@ void QWizard::setWizardStyle(WizardStyle style) d->updateLayout(); updateGeometry(); d->enableUpdates(); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) // Delay initialization when activating Aero style fails due to missing native window. if (aeroStyleChange && !d->handleAeroStyleChange() && d->wizStyle == AeroStyle) d->vistaInitPending = true; @@ -2816,7 +2817,7 @@ void QWizard::setButton(WizardButton which, QAbstractButton *button) QAbstractButton *QWizard::button(WizardButton which) const { Q_D(const QWizard); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) if (d->wizStyle == AeroStyle && which == BackButton) return d->vistaHelper->backButton(); #endif @@ -3176,7 +3177,7 @@ bool QWizard::event(QEvent *event) d->setStyle(style()); d->updateLayout(); } -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) else if (event->type() == QEvent::Show && d->vistaInitPending) { d->vistaInitPending = false; // Do not force AeroStyle when in Classic theme. @@ -3211,7 +3212,7 @@ void QWizard::resizeEvent(QResizeEvent *event) { Q_D(QWizard); int heightOffset = 0; -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) if (d->isVistaThemeEnabled()) { heightOffset = d->vistaHelper->topOffset(); if (d->isVistaThemeEnabled(QVistaHelper::VistaAero)) @@ -3219,7 +3220,7 @@ void QWizard::resizeEvent(QResizeEvent *event) } #endif d->antiFlickerWidget->resize(event->size().width(), event->size().height() - heightOffset); -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) if (d->isVistaThemeEnabled()) d->vistaHelper->resizeEvent(event); #endif @@ -3240,7 +3241,7 @@ void QWizard::paintEvent(QPaintEvent * event) QPainter painter(this); painter.drawPixmap(0, (height() - backgroundPixmap.height()) / 2, backgroundPixmap); } -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) else if (d->isVistaThemeEnabled()) { if (d->isVistaThemeEnabled(QVistaHelper::VistaBasic)) { QPainter painter(this); @@ -3260,7 +3261,7 @@ void QWizard::paintEvent(QPaintEvent * event) */ bool QWizard::nativeEvent(const QByteArray &eventType, void *message, long *result) { -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) Q_D(QWizard); if (d->isVistaThemeEnabled() && eventType == "windows_generic_MSG") { MSG *windowsMessage = static_cast(message); diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 9d8e7c4b66..80e37dab25 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -38,7 +38,10 @@ ****************************************************************************/ #ifndef QT_NO_WIZARD -#ifndef QT_NO_STYLE_WINDOWSVISTA + +#include + +#if QT_CONFIG(style_windowsvista) #include "qwizard_win_p.h" #include @@ -722,6 +725,6 @@ int QVistaHelper::topOffset() QT_END_NAMESPACE -#endif // QT_NO_STYLE_WINDOWSVISTA +#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 288e7adaf5..bbba53b879 100644 --- a/src/widgets/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -54,7 +54,7 @@ #include #ifndef QT_NO_WIZARD -#ifndef QT_NO_STYLE_WINDOWSVISTA +#if QT_CONFIG(style_windowsvista) #include #include @@ -156,6 +156,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_STYLE_WINDOWSVISTA +#endif // style_windowsvista #endif // QT_NO_WIZARD #endif // QWIZARD_WIN_P_H diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index 46d2a4c1aa..660620a5d9 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -52,7 +52,7 @@ #include #include #include -#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(style_mac) # include #endif diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 2d1d1f43d0..9583dd9657 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2194,7 +2194,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie return QModelIndex(); } int vi = -1; -#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(style_mac) // Selection behavior is slightly different on the Mac. if (d->selectionMode == QAbstractItemView::ExtendedSelection && d->selectionModel diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp index 743166549b..b37dffbe80 100644 --- a/src/widgets/styles/qandroidstyle.cpp +++ b/src/widgets/styles/qandroidstyle.cpp @@ -39,7 +39,7 @@ #include "qandroidstyle_p.h" -#if !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN) +#if QT_CONFIG(style_android) || defined(QT_PLUGIN) #include #include @@ -1807,4 +1807,4 @@ QRect QAndroidStyle::AndroidSpinnerControl::subControlRect(const QStyleOptionCom QT_END_NAMESPACE -#endif // !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN) +#endif // QT_CONFIG(style_android) || defined(QT_PLUGIN) diff --git a/src/widgets/styles/qandroidstyle_p.h b/src/widgets/styles/qandroidstyle_p.h index 4649d90852..caff0afada 100644 --- a/src/widgets/styles/qandroidstyle_p.h +++ b/src/widgets/styles/qandroidstyle_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_STYLE_ANDROID) +#if QT_CONFIG(style_android) class Q_WIDGETS_EXPORT QAndroidStyle : public QFusionStyle { @@ -388,7 +388,7 @@ private: AndroidCompoundButtonControl *checkBoxControl; }; -#endif // QT_NO_STYLE_ANDROID +#endif // style_android QT_END_NAMESPACE diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 3473ec7fb0..74e4d53dca 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -40,7 +40,7 @@ #include "qfusionstyle_p.h" #include "qfusionstyle_p_p.h" -#if !defined(QT_NO_STYLE_FUSION) || defined(QT_PLUGIN) +#if QT_CONFIG(style_fusion) || defined(QT_PLUGIN) #include "qcommonstyle_p.h" #include #include @@ -3746,4 +3746,4 @@ QT_END_NAMESPACE #include "moc_qfusionstyle_p.cpp" -#endif // QT_NO_STYLE_FUSION || QT_PLUGIN +#endif // style_fusion|| QT_PLUGIN diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h index 126fb96e78..aac27e51ab 100644 --- a/src/widgets/styles/qfusionstyle_p.h +++ b/src/widgets/styles/qfusionstyle_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_STYLE_FUSION) +#if QT_CONFIG(style_fusion) class QFusionStylePrivate; class QFusionStyle : public QCommonStyle @@ -110,7 +110,7 @@ protected: }; -#endif // QT_NO_STYLE_FUSION +#endif // style_fusion QT_END_NAMESPACE diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h index 8d1d27d244..169fd9a407 100644 --- a/src/widgets/styles/qfusionstyle_p_p.h +++ b/src/widgets/styles/qfusionstyle_p_p.h @@ -57,7 +57,7 @@ #include #include "private/qguiapplication_p.h" -#ifndef QT_NO_STYLE_FUSION +#if QT_CONFIG(style_fusion) QT_BEGIN_NAMESPACE @@ -147,6 +147,6 @@ public: QT_END_NAMESPACE -#endif // QT_NO_STYLE_FUSION +#endif // style_fusion #endif //QFUSIONSTYLE_P_P_H diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h index 459784c538..3642424a14 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) class QPalette; diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index 09cccff4e8..8dc603f8e6 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -44,20 +44,20 @@ #include "qapplication.h" #include "qwindowsstyle_p.h" -#ifndef QT_NO_STYLE_FUSION +#if QT_CONFIG(style_fusion) #include "qfusionstyle_p.h" -#ifndef QT_NO_STYLE_ANDROID +#if QT_CONFIG(style_android) #include "qandroidstyle_p.h" #endif #endif -#ifndef QT_NO_STYLE_WINDOWSXP +#if QT_CONFIG(style_windowsxp) #include "qwindowsxpstyle_p.h" #endif -#ifndef QT_NO_STYLE_WINDOWSVISTA +#if QT_CONFIG(style_windowsvista) #include "qwindowsvistastyle_p.h" #endif -#if !defined(QT_NO_STYLE_MAC) && defined(Q_OS_MAC) +#if QT_CONFIG(style_mac) # include "qmacstyle_mac_p.h" #endif @@ -103,32 +103,32 @@ QStyle *QStyleFactory::create(const QString& key) { QStyle *ret = 0; QString style = key.toLower(); -#ifndef QT_NO_STYLE_WINDOWS +#if QT_CONFIG(style_windows) if (style == QLatin1String("windows")) ret = new QWindowsStyle; else #endif -#ifndef QT_NO_STYLE_WINDOWSXP +#if QT_CONFIG(style_windowsxp) if (style == QLatin1String("windowsxp")) ret = new QWindowsXPStyle; else #endif -#ifndef QT_NO_STYLE_WINDOWSVISTA +#if QT_CONFIG(style_windowsvista) if (style == QLatin1String("windowsvista")) ret = new QWindowsVistaStyle; else #endif -#ifndef QT_NO_STYLE_FUSION +#if QT_CONFIG(style_fusion) if (style == QLatin1String("fusion")) ret = new QFusionStyle; else #endif -#ifndef QT_NO_STYLE_ANDROID +#if QT_CONFIG(style_android) if (style == QLatin1String("android")) ret = new QAndroidStyle; else #endif -#ifndef QT_NO_STYLE_MAC +#if QT_CONFIG(style_mac) if (style.startsWith(QLatin1String("macintosh"))) { ret = new QMacStyle; # if 0 // Used to be included in Qt4 for Q_WS_MAC @@ -160,29 +160,29 @@ QStringList QStyleFactory::keys() const PluginKeyMap::const_iterator cend = keyMap.constEnd(); for (PluginKeyMap::const_iterator it = keyMap.constBegin(); it != cend; ++it) list.append(it.value()); -#ifndef QT_NO_STYLE_WINDOWS +#if QT_CONFIG(style_windows) if (!list.contains(QLatin1String("Windows"))) list << QLatin1String("Windows"); #endif -#ifndef QT_NO_STYLE_WINDOWSXP +#if QT_CONFIG(style_windowsxp) if (!list.contains(QLatin1String("WindowsXP")) && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) list << QLatin1String("WindowsXP"); #endif -#ifndef QT_NO_STYLE_WINDOWSVISTA +#if QT_CONFIG(style_windowsvista) if (!list.contains(QLatin1String("WindowsVista")) && (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) list << QLatin1String("WindowsVista"); #endif -#ifndef QT_NO_STYLE_ANDROID +#if QT_CONFIG(style_android) if (!list.contains(QLatin1String("Android"))) list << QLatin1String("Android"); #endif -#ifndef QT_NO_STYLE_FUSION +#if QT_CONFIG(style_fusion) if (!list.contains(QLatin1String("Fusion"))) list << QLatin1String("Fusion"); #endif -#ifndef QT_NO_STYLE_MAC +#if QT_CONFIG(style_mac) QString mstyle = QLatin1String("Macintosh"); # if 0 // Used to be included in Qt4 for Q_WS_MAC mstyle += QLatin1String(" (aqua)"); diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 83739655af..c12b3285f1 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -37,9 +37,10 @@ ** ****************************************************************************/ +#include #include "qstyleoption.h" #include "qapplication.h" -#ifdef Q_OS_MAC +#if QT_CONFIG(style_mac) # include "qmacstyle_mac_p.h" #endif #include @@ -204,7 +205,7 @@ void QStyleOption::init(const QWidget *widget) if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget)) state &= ~QStyle::State_Enabled; #endif -#if defined(Q_OS_OSX) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) switch (QMacStyle::widgetSizePolicy(widget)) { case QMacStyle::SizeSmall: state |= QStyle::State_Small; diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index e3bf28608c..a8ee881a30 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -40,7 +40,7 @@ #include "qwindowsstyle_p.h" #include "qwindowsstyle_p_p.h" -#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) +#if QT_CONFIG(style_windows) || defined(QT_PLUGIN) #include "qapplication.h" #include "qbitmap.h" @@ -2407,4 +2407,4 @@ QT_END_NAMESPACE #include "moc_qwindowsstyle_p.cpp" -#endif // QT_NO_STYLE_WINDOWS +#endif // style_windows diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h index 5d68bfeba0..a1d65610ff 100644 --- a/src/widgets/styles/qwindowsstyle_p.h +++ b/src/widgets/styles/qwindowsstyle_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_STYLE_WINDOWS) +#if QT_CONFIG(style_windows) class QWindowsStylePrivate; @@ -106,7 +106,7 @@ private: Q_DECLARE_PRIVATE(QWindowsStyle) }; -#endif // QT_NO_STYLE_WINDOWS +#endif // style_windows QT_END_NAMESPACE diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h index 0c23f4b4a8..5023fd1042 100644 --- a/src/widgets/styles/qwindowsstyle_p_p.h +++ b/src/widgets/styles/qwindowsstyle_p_p.h @@ -55,7 +55,7 @@ #include "qwindowsstyle_p.h" #include "qcommonstyle_p.h" -#ifndef QT_NO_STYLE_WINDOWS +#if QT_CONFIG(style_windows) #include QT_BEGIN_NAMESPACE @@ -103,7 +103,7 @@ private: QT_END_NAMESPACE -#endif // QT_NO_STYLE_WINDOWS +#endif // style_windows #endif //QWINDOWSSTYLE_P_P_H ; diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index bf5aad0187..7759df9959 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -46,7 +46,7 @@ #include #include -#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN) +#if QT_CONFIG(style_windowsvista) || defined(QT_PLUGIN) QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h index 0289f404dd..8fbd1dc380 100644 --- a/src/widgets/styles/qwindowsvistastyle_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) class QWindowsVistaStylePrivate; class QWindowsVistaStyle : public QWindowsXPStyle @@ -103,7 +103,7 @@ private: Q_DECLARE_PRIVATE(QWindowsVistaStyle) friend class QStyleFactory; }; -#endif //QT_NO_STYLE_WINDOWSVISTA +#endif // style_windowsvista QT_END_NAMESPACE diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h index 4ca47fec2c..18b6f9c3f7 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p_p.h @@ -54,7 +54,7 @@ #include #include "qwindowsvistastyle_p.h" -#if !defined(QT_NO_STYLE_WINDOWSVISTA) +#if QT_CONFIG(style_windowsvista) #include #include #include @@ -177,6 +177,6 @@ public: QT_END_NAMESPACE -#endif // QT_NO_STYLE_WINDOWSVISTA +#endif // style_windowsvista #endif // QWINDOWSVISTASTYLE_P_P_H diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 4ce359a7c4..f999d823e0 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -39,7 +39,7 @@ #include "qwindowsxpstyle_p.h" #include "qwindowsxpstyle_p_p.h" -#if !defined(QT_NO_STYLE_WINDOWSXP) || defined(QT_PLUGIN) +#if QT_CONFIG(style_windowsxp) || defined(QT_PLUGIN) #include #include diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h index 088178cb5a..62e3af927c 100644 --- a/src/widgets/styles/qwindowsxpstyle_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_STYLE_WINDOWSXP) +#if QT_CONFIG(style_windowsxp) class QWindowsXPStylePrivate; class QWindowsXPStyle : public QWindowsStyle @@ -102,7 +102,7 @@ private: friend class QStyleFactory; }; -#endif // QT_NO_STYLE_WINDOWSXP +#endif // style_windowsxp QT_END_NAMESPACE diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index d6702c8803..fb5210cb07 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE // Uncomment define below to build debug assisting code, and output // #define DEBUG_XP_STYLE -#if !defined(QT_NO_STYLE_WINDOWSXP) +#if QT_CONFIG(style_windowsxp) // Declarations ----------------------------------------------------------------------------------- class XPThemeData @@ -338,7 +338,7 @@ inline QMarginsF XPThemeData::themeMargins(const QWidget *w, QPainter *p, int th return theme.margins(propId); } -#endif // QT_NO_STYLE_WINDOWS +#endif // style_windows QT_END_NAMESPACE diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 69e13fb6ec..481123f0d4 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -37,51 +37,35 @@ RESOURCES += styles/qstyle.qrc include($$OUT_PWD/qtwidgets-config.pri) -contains( styles, mac ) { +qtConfig(style-mac) { HEADERS += \ styles/qmacstyle_mac_p.h \ styles/qmacstyle_mac_p_p.h OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm LIBS_PRIVATE += -framework Carbon -} else { - DEFINES += QT_NO_STYLE_MAC } -contains( styles, windowsvista ) { - HEADERS += styles/qwindowsvistastyle_p.h - HEADERS += styles/qwindowsvistastyle_p_p.h +qtConfig(style-windowsvista) { + HEADERS += styles/qwindowsvistastyle_p.h styles/qwindowsvistastyle_p_p.h SOURCES += styles/qwindowsvistastyle.cpp -} else { - DEFINES += QT_NO_STYLE_WINDOWSVISTA } -contains( styles, windowsxp ) { - HEADERS += styles/qwindowsxpstyle_p.h - HEADERS += styles/qwindowsxpstyle_p_p.h +qtConfig(style-windowsxp) { + HEADERS += styles/qwindowsxpstyle_p.h styles/qwindowsxpstyle_p_p.h SOURCES += styles/qwindowsxpstyle.cpp -} else { - DEFINES += QT_NO_STYLE_WINDOWSXP } -contains( styles, windows ) { - HEADERS += styles/qwindowsstyle_p.h - HEADERS += styles/qwindowsstyle_p_p.h +qtConfig(style-windows) { + HEADERS += styles/qwindowsstyle_p.h styles/qwindowsstyle_p_p.h SOURCES += styles/qwindowsstyle.cpp -} else { - DEFINES += QT_NO_STYLE_WINDOWS } -contains( styles, fusion ) { - HEADERS += styles/qfusionstyle_p.h - HEADERS += styles/qfusionstyle_p_p.h - SOURCES += styles/qfusionstyle.cpp -} else { - DEFINES += QT_NO_STYLE_FUSION +qtConfig(style-fusion) { + HEADERS += styles/qfusionstyle_p.h styles/qfusionstyle_p_p.h + SOURCES += styles/qfusionstyle.cpp } -contains( styles, android ) { +qtConfig(style-android) { HEADERS += styles/qandroidstyle_p.h SOURCES += styles/qandroidstyle.cpp -} else { - DEFINES += QT_NO_STYLE_ANDROID } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 4358e568bf..abb24a7f1e 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -66,7 +66,7 @@ #include #include #include -#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) && QT_CONFIG(style_mac) #include #include #include diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 183f1c2848..9b39743281 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -160,7 +160,7 @@ #include #include -#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(style_mac) #include #endif #include diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 2fff2fc729..a627c86871 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -158,7 +158,7 @@ #include #include #include -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) #include #endif #include @@ -295,7 +295,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti Q_ASSERT(helpEvent->type() == QEvent::ToolTip); Q_ASSERT(widget); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) // Native Mac windows don't show tool tip. if (qobject_cast(widget->style())) return; @@ -1076,7 +1076,7 @@ void QMdiSubWindowPrivate::updateCursor() { #ifndef QT_NO_CURSOR Q_Q(QMdiSubWindow); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) return; #endif @@ -1504,7 +1504,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMinButton: -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) { if (q->isMinimized()) q->showNormal(); @@ -1521,7 +1521,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMaxButton: -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) { if (q->isMaximized()) q->showNormal(); @@ -1568,7 +1568,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const } QRegion region; -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) return region; #endif @@ -1775,7 +1775,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; -#if defined(Q_OS_DARWIN) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) Q_UNUSED(isChildOfQMdiSubWindow); return true; #else @@ -2191,7 +2191,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip) return; newSizeGrip->setFixedSize(newSizeGrip->sizeHint()); bool putSizeGripInLayout = layout ? true : false; -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) putSizeGripInLayout = false; #endif @@ -2843,7 +2843,7 @@ bool QMdiSubWindow::event(QEvent *event) d->isMaximizeMode = false; d->isWidgetHiddenByUs = false; if (!parent()) { -#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac) if (qobject_cast(style())) delete d->sizeGrip; #endif @@ -2938,7 +2938,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) return; } -#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac) if (qobject_cast(style()) && !d->sizeGrip && !(windowFlags() & Qt::FramelessWindowHint)) { d->setSizeGrip(new QSizeGrip(this)); @@ -3333,7 +3333,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent) hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, d->hoveredSubControl, this); } -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(style()) && !hoverRegion.isEmpty()) hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options)); #endif @@ -3543,7 +3543,7 @@ QSize QMdiSubWindow::minimumSizeHint() const int sizeGripHeight = 0; if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast(this))) sizeGripHeight = d->sizeGrip->height(); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) else if (parent() && qobject_cast(style()) && !d->sizeGrip) sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this); #endif -- cgit v1.2.3 From 7d6d70afe7ee7045e866a0507dc3986666b16e8f Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Sun, 27 Nov 2016 14:35:53 +0300 Subject: QtConcurrent: Add missing override Change-Id: Ib8064a3c7bae68885b1adb78a55c69f7697e10db Reviewed-by: Marc Mutz --- src/concurrent/qtconcurrentfilterkernel.h | 28 ++--- src/concurrent/qtconcurrentiteratekernel.h | 6 +- src/concurrent/qtconcurrentmapkernel.h | 22 ++-- src/concurrent/qtconcurrentreducekernel.h | 2 +- src/concurrent/qtconcurrentrunbase.h | 6 +- src/concurrent/qtconcurrentstoredfunctioncall.h | 148 ++++++++++++------------ 6 files changed, 106 insertions(+), 106 deletions(-) diff --git a/src/concurrent/qtconcurrentfilterkernel.h b/src/concurrent/qtconcurrentfilterkernel.h index 1e875e3d38..bd474fc0c9 100644 --- a/src/concurrent/qtconcurrentfilterkernel.h +++ b/src/concurrent/qtconcurrentfilterkernel.h @@ -96,7 +96,7 @@ public: reducer(OrderedReduce) { } - bool runIteration(typename Sequence::const_iterator it, int index, T *) + bool runIteration(typename Sequence::const_iterator it, int index, T *) override { IntermediateResults results; results.begin = index; @@ -109,7 +109,7 @@ public: return false; } - bool runIterations(typename Sequence::const_iterator sequenceBeginIterator, int begin, int end, T *) + bool runIterations(typename Sequence::const_iterator sequenceBeginIterator, int begin, int end, T *) override { IntermediateResults results; results.begin = begin; @@ -129,18 +129,18 @@ public: return false; } - void finish() + void finish() override { reducer.finish(reduce, reducedResult); sequence = reducedResult; } - inline bool shouldThrottleThread() + inline bool shouldThrottleThread() override { return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle(); } - inline bool shouldStartThread() + inline bool shouldStartThread() override { return IterateKernelType::shouldStartThread() && reducer.shouldStartThread(); } @@ -183,7 +183,7 @@ public: { } #endif - bool runIteration(Iterator it, int index, ReducedResultType *) + bool runIteration(Iterator it, int index, ReducedResultType *) override { IntermediateResults::value_type> results; results.begin = index; @@ -196,7 +196,7 @@ public: return false; } - bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) override { IntermediateResults::value_type> results; results.begin = begin; @@ -215,24 +215,24 @@ public: return false; } - void finish() + void finish() override { reducer.finish(reduce, reducedResult); } - inline bool shouldThrottleThread() + inline bool shouldThrottleThread() override { return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle(); } - inline bool shouldStartThread() + inline bool shouldStartThread() override { return IterateKernelType::shouldStartThread() && reducer.shouldStartThread(); } typedef ReducedResultType ReturnType; typedef ReducedResultType ResultType; - ReducedResultType *result() + ReducedResultType *result() override { return &reducedResult; } @@ -255,14 +255,14 @@ public: : IterateKernelType(begin, end), keep(_keep) { } - void start() + void start() override { if (this->futureInterface) this->futureInterface->setFilterMode(true); IterateKernelType::start(); } - bool runIteration(Iterator it, int index, T *) + bool runIteration(Iterator it, int index, T *) override { if (keep(*it)) this->reportResult(&(*it), index); @@ -271,7 +271,7 @@ public: return false; } - bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *) + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *) override { const int count = end - begin; IntermediateResults::value_type> results; diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h index b4360abd26..dbd000e8ba 100644 --- a/src/concurrent/qtconcurrentiteratekernel.h +++ b/src/concurrent/qtconcurrentiteratekernel.h @@ -197,14 +197,14 @@ public: virtual bool runIterations(Iterator _begin, int beginIndex, int endIndex, T *results) { Q_UNUSED(_begin); Q_UNUSED(beginIndex); Q_UNUSED(endIndex); Q_UNUSED(results); return false; } - void start() + void start() override { progressReportingEnabled = this->isProgressReportingEnabled(); if (progressReportingEnabled && iterationCount > 0) this->setProgressRange(0, iterationCount); } - bool shouldStartThread() + bool shouldStartThread() override { if (forIteration) return (currentIndex.load() < iterationCount) && !this->shouldThrottleThread(); @@ -212,7 +212,7 @@ public: return (iteratorThreads.load() == 0); } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { if (forIteration) return this->forThreadFunction(); diff --git a/src/concurrent/qtconcurrentmapkernel.h b/src/concurrent/qtconcurrentmapkernel.h index ad5ef93684..fa162f7c34 100644 --- a/src/concurrent/qtconcurrentmapkernel.h +++ b/src/concurrent/qtconcurrentmapkernel.h @@ -64,13 +64,13 @@ public: : IterateKernel(begin, end), map(_map) { } - bool runIteration(Iterator it, int, void *) + bool runIteration(Iterator it, int, void *) override { map(*it); return false; } - bool runIterations(Iterator sequenceBeginIterator, int beginIndex, int endIndex, void *) + bool runIterations(Iterator sequenceBeginIterator, int beginIndex, int endIndex, void *) override { Iterator it = sequenceBeginIterator; std::advance(it, beginIndex); @@ -108,7 +108,7 @@ public: : reducedResult(initialValue), map(_map), reduce(_reduce) { } - bool runIteration(Iterator it, int index, ReducedResultType *) + bool runIteration(Iterator it, int index, ReducedResultType *) override { IntermediateResults results; results.begin = index; @@ -119,7 +119,7 @@ public: return false; } - bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) override { IntermediateResults results; results.begin = begin; @@ -137,23 +137,23 @@ public: return false; } - void finish() + void finish() override { reducer.finish(reduce, reducedResult); } - bool shouldThrottleThread() + bool shouldThrottleThread() override { return IterateKernel::shouldThrottleThread() || reducer.shouldThrottle(); } - bool shouldStartThread() + bool shouldStartThread() override { return IterateKernel::shouldStartThread() && reducer.shouldStartThread(); } typedef ReducedResultType ResultType; - ReducedResultType *result() + ReducedResultType *result() override { return &reducedResult; } @@ -171,13 +171,13 @@ public: MappedEachKernel(Iterator begin, Iterator end, MapFunctor _map) : IterateKernel(begin, end), map(_map) { } - bool runIteration(Iterator it, int, T *result) + bool runIteration(Iterator it, int, T *result) override { *result = map(*it); return true; } - bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *results) + bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *results) override { Iterator it = sequenceBeginIterator; @@ -216,7 +216,7 @@ struct SequenceHolder1 : public Base Sequence sequence; - void finish() + void finish() override { Base::finish(); // Clear the sequence to make sure all temporaries are destroyed diff --git a/src/concurrent/qtconcurrentreducekernel.h b/src/concurrent/qtconcurrentreducekernel.h index 2cbf30dffb..c5003a2a0e 100644 --- a/src/concurrent/qtconcurrentreducekernel.h +++ b/src/concurrent/qtconcurrentreducekernel.h @@ -230,7 +230,7 @@ struct SequenceHolder2 : public Base Sequence sequence; - void finish() + void finish() override { Base::finish(); // Clear the sequence to make sure all temporaries are destroyed diff --git a/src/concurrent/qtconcurrentrunbase.h b/src/concurrent/qtconcurrentrunbase.h index 734fd54f70..303838b73e 100644 --- a/src/concurrent/qtconcurrentrunbase.h +++ b/src/concurrent/qtconcurrentrunbase.h @@ -88,7 +88,7 @@ public: return theFuture; } - void run() {} + void run() override {} virtual void runFunctor() = 0; }; @@ -96,7 +96,7 @@ template class RunFunctionTask : public RunFunctionTaskBase { public: - void run() + void run() override { if (this->isCanceled()) { this->reportFinished(); @@ -124,7 +124,7 @@ template <> class RunFunctionTask : public RunFunctionTaskBase { public: - void run() + void run() override { if (this->isCanceled()) { this->reportFinished(); diff --git a/src/concurrent/qtconcurrentstoredfunctioncall.h b/src/concurrent/qtconcurrentstoredfunctioncall.h index 0afce17f74..750ece1ef1 100644 --- a/src/concurrent/qtconcurrentstoredfunctioncall.h +++ b/src/concurrent/qtconcurrentstoredfunctioncall.h @@ -57,7 +57,7 @@ struct StoredFunctorCall0: public RunFunctionTask { inline StoredFunctorCall0(FunctionPointer _function) : function(_function) {} - void runFunctor() { this->result = function(); } + void runFunctor() override { this->result = function(); } FunctionPointer function; }; @@ -67,7 +67,7 @@ struct StoredFunctorCall0: public RunFunctionTask { inline StoredFunctorCall0(FunctionPointer _function) : function(_function) {} - void runFunctor() { function(); } + void runFunctor() override { function(); } FunctionPointer function; }; @@ -77,7 +77,7 @@ struct StoredFunctorPointerCall0: public RunFunctionTask { inline StoredFunctorPointerCall0(FunctionPointer * _function) : function(_function) {} - void runFunctor() { this->result =(*function)(); } + void runFunctor() override { this->result =(*function)(); } FunctionPointer * function; }; @@ -87,7 +87,7 @@ struct VoidStoredFunctorPointerCall0: public RunFunctionTask { inline VoidStoredFunctorPointerCall0(FunctionPointer * _function) : function(_function) {} - void runFunctor() {(*function)(); } + void runFunctor() override { (*function)(); } FunctionPointer * function; }; @@ -106,7 +106,7 @@ public: StoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(); } @@ -122,7 +122,7 @@ public: VoidStoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { (object.*fn)(); } @@ -145,7 +145,7 @@ public: StoredConstMemberFunctionCall0(T (Class::*_fn)() const, const Class &_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(); } @@ -161,7 +161,7 @@ public: VoidStoredConstMemberFunctionCall0(T (Class::*_fn)() const, const Class &_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { (object.*fn)(); } @@ -184,7 +184,7 @@ public: StoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(); } @@ -200,7 +200,7 @@ public: VoidStoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { (object->*fn)(); } @@ -223,7 +223,7 @@ public: StoredConstMemberFunctionPointerCall0(T (Class::*_fn)() const, Class const *_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(); } @@ -239,7 +239,7 @@ public: VoidStoredConstMemberFunctionPointerCall0(T (Class::*_fn)() const, Class const *_object) : fn(_fn), object(_object){ } - void runFunctor() + void runFunctor() override { (object->*fn)(); } @@ -260,7 +260,7 @@ struct StoredFunctorCall1: public RunFunctionTask { inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1) : function(_function), arg1(_arg1) {} - void runFunctor() { this->result = function(arg1); } + void runFunctor() override { this->result = function(arg1); } FunctionPointer function; Arg1 arg1; }; @@ -270,7 +270,7 @@ struct StoredFunctorCall1: public RunFunctionTask { inline StoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1) : function(_function), arg1(_arg1) {} - void runFunctor() { this->result =(*function)(arg1); } + void runFunctor() override { this->result =(*function)(arg1); } FunctionPointer * function; Arg1 arg1; }; @@ -290,7 +290,7 @@ struct VoidStoredFunctorPointerCall1: public RunFunctionTask { inline VoidStoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1) : function(_function), arg1(_arg1) {} - void runFunctor() {(*function)(arg1); } + void runFunctor() override { (*function)(arg1); } FunctionPointer * function; Arg1 arg1; }; @@ -309,7 +309,7 @@ public: StoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1); } @@ -325,7 +325,7 @@ public: VoidStoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1); } @@ -348,7 +348,7 @@ public: StoredConstMemberFunctionCall1(T (Class::*_fn)(Param1) const, const Class &_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1); } @@ -364,7 +364,7 @@ public: VoidStoredConstMemberFunctionCall1(T (Class::*_fn)(Param1) const, const Class &_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1); } @@ -387,7 +387,7 @@ public: StoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1); } @@ -403,7 +403,7 @@ public: VoidStoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1); } @@ -426,7 +426,7 @@ public: StoredConstMemberFunctionPointerCall1(T (Class::*_fn)(Param1) const, Class const *_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1); } @@ -442,7 +442,7 @@ public: VoidStoredConstMemberFunctionPointerCall1(T (Class::*_fn)(Param1) const, Class const *_object, const Arg1 &_arg1) : fn(_fn), object(_object), arg1(_arg1){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1); } @@ -463,7 +463,7 @@ struct StoredFunctorCall2: public RunFunctionTask { inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) : function(_function), arg1(_arg1), arg2(_arg2) {} - void runFunctor() { this->result = function(arg1, arg2); } + void runFunctor() override { this->result = function(arg1, arg2); } FunctionPointer function; Arg1 arg1; Arg2 arg2; }; @@ -473,7 +473,7 @@ struct StoredFunctorCall2: public RunFunction { inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) : function(_function), arg1(_arg1), arg2(_arg2) {} - void runFunctor() { function(arg1, arg2); } + void runFunctor() override { function(arg1, arg2); } FunctionPointer function; Arg1 arg1; Arg2 arg2; }; @@ -483,7 +483,7 @@ struct StoredFunctorPointerCall2: public RunFunctionTask { inline StoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2) : function(_function), arg1(_arg1), arg2(_arg2) {} - void runFunctor() { this->result =(*function)(arg1, arg2); } + void runFunctor() override { this->result =(*function)(arg1, arg2); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; }; @@ -493,7 +493,7 @@ struct VoidStoredFunctorPointerCall2: public RunFunctionTask { inline VoidStoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2) : function(_function), arg1(_arg1), arg2(_arg2) {} - void runFunctor() {(*function)(arg1, arg2); } + void runFunctor() override { (*function)(arg1, arg2); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; }; @@ -512,7 +512,7 @@ public: StoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2); } @@ -528,7 +528,7 @@ public: VoidStoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2); } @@ -551,7 +551,7 @@ public: StoredConstMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2); } @@ -567,7 +567,7 @@ public: VoidStoredConstMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2); } @@ -590,7 +590,7 @@ public: StoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2); } @@ -606,7 +606,7 @@ public: VoidStoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2); } @@ -629,7 +629,7 @@ public: StoredConstMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2); } @@ -645,7 +645,7 @@ public: VoidStoredConstMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2); } @@ -666,7 +666,7 @@ struct StoredFunctorCall3: public RunFunctionTask { inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} - void runFunctor() { this->result = function(arg1, arg2, arg3); } + void runFunctor() override { this->result = function(arg1, arg2, arg3); } FunctionPointer function; Arg1 arg1; Arg2 arg2; Arg3 arg3; }; @@ -676,7 +676,7 @@ struct StoredFunctorCall3: public RunFu { inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} - void runFunctor() { function(arg1, arg2, arg3); } + void runFunctor() override { function(arg1, arg2, arg3); } FunctionPointer function; Arg1 arg1; Arg2 arg2; Arg3 arg3; }; @@ -686,7 +686,7 @@ struct StoredFunctorPointerCall3: public RunFunctionTask { inline StoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} - void runFunctor() { this->result =(*function)(arg1, arg2, arg3); } + void runFunctor() override { this->result =(*function)(arg1, arg2, arg3); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; Arg3 arg3; }; @@ -696,7 +696,7 @@ struct VoidStoredFunctorPointerCall3: public RunFunctionTask { inline VoidStoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} - void runFunctor() {(*function)(arg1, arg2, arg3); } + void runFunctor() override { (*function)(arg1, arg2, arg3); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; Arg3 arg3; }; @@ -715,7 +715,7 @@ public: StoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2, arg3); } @@ -731,7 +731,7 @@ public: VoidStoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2, arg3); } @@ -754,7 +754,7 @@ public: StoredConstMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2, arg3); } @@ -770,7 +770,7 @@ public: VoidStoredConstMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2, arg3); } @@ -793,7 +793,7 @@ public: StoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2, arg3); } @@ -809,7 +809,7 @@ public: VoidStoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2, arg3); } @@ -832,7 +832,7 @@ public: StoredConstMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2, arg3); } @@ -848,7 +848,7 @@ public: VoidStoredConstMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2, arg3); } @@ -869,7 +869,7 @@ struct StoredFunctorCall4: public RunFunctionTask { inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} - void runFunctor() { this->result = function(arg1, arg2, arg3, arg4); } + void runFunctor() override { this->result = function(arg1, arg2, arg3, arg4); } FunctionPointer function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; }; @@ -879,7 +879,7 @@ struct StoredFunctorCall4: public { inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} - void runFunctor() { function(arg1, arg2, arg3, arg4); } + void runFunctor() override { function(arg1, arg2, arg3, arg4); } FunctionPointer function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; }; @@ -889,7 +889,7 @@ struct StoredFunctorPointerCall4: public RunFunctionTask { inline StoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} - void runFunctor() { this->result =(*function)(arg1, arg2, arg3, arg4); } + void runFunctor() override { this->result =(*function)(arg1, arg2, arg3, arg4); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; }; @@ -899,7 +899,7 @@ struct VoidStoredFunctorPointerCall4: public RunFunctionTask { inline VoidStoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} - void runFunctor() {(*function)(arg1, arg2, arg3, arg4); } + void runFunctor() override { (*function)(arg1, arg2, arg3, arg4); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; }; @@ -918,7 +918,7 @@ public: StoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2, arg3, arg4); } @@ -934,7 +934,7 @@ public: VoidStoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2, arg3, arg4); } @@ -957,7 +957,7 @@ public: StoredConstMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2, arg3, arg4); } @@ -973,7 +973,7 @@ public: VoidStoredConstMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2, arg3, arg4); } @@ -996,7 +996,7 @@ public: StoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2, arg3, arg4); } @@ -1012,7 +1012,7 @@ public: VoidStoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2, arg3, arg4); } @@ -1035,7 +1035,7 @@ public: StoredConstMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2, arg3, arg4); } @@ -1051,7 +1051,7 @@ public: VoidStoredConstMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2, arg3, arg4); } @@ -1072,7 +1072,7 @@ struct StoredFunctorCall5: public RunFunctionTask { inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} - void runFunctor() { this->result = function(arg1, arg2, arg3, arg4, arg5); } + void runFunctor() override { this->result = function(arg1, arg2, arg3, arg4, arg5); } FunctionPointer function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; }; @@ -1082,7 +1082,7 @@ struct StoredFunctorCall5: { inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} - void runFunctor() { function(arg1, arg2, arg3, arg4, arg5); } + void runFunctor() override { function(arg1, arg2, arg3, arg4, arg5); } FunctionPointer function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; }; @@ -1092,7 +1092,7 @@ struct StoredFunctorPointerCall5: public RunFunctionTask { inline StoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} - void runFunctor() { this->result =(*function)(arg1, arg2, arg3, arg4, arg5); } + void runFunctor() override { this->result =(*function)(arg1, arg2, arg3, arg4, arg5); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; }; @@ -1102,7 +1102,7 @@ struct VoidStoredFunctorPointerCall5: public RunFunctionTask { inline VoidStoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} - void runFunctor() {(*function)(arg1, arg2, arg3, arg4, arg5); } + void runFunctor() override {(*function)(arg1, arg2, arg3, arg4, arg5); } FunctionPointer * function; Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; }; @@ -1121,7 +1121,7 @@ public: StoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1137,7 +1137,7 @@ public: VoidStoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1160,7 +1160,7 @@ public: StoredConstMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { this->result = (object.*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1176,7 +1176,7 @@ public: VoidStoredConstMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { (object.*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1199,7 +1199,7 @@ public: StoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1215,7 +1215,7 @@ public: VoidStoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1238,7 +1238,7 @@ public: StoredConstMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { this->result = (object->*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1254,7 +1254,7 @@ public: VoidStoredConstMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ } - void runFunctor() + void runFunctor() override { (object->*fn)(arg1, arg2, arg3, arg4, arg5); } @@ -1276,7 +1276,7 @@ class StoredFunctorCall : public RunFunctionTask { public: StoredFunctorCall(const Functor &f) : functor(f) { } - void runFunctor() + void runFunctor() override { this->result = functor(); } @@ -1288,7 +1288,7 @@ class StoredFunctorCall : public RunFunctionTask { public: StoredFunctorCall(const Functor &f) : functor(f) { } - void runFunctor() + void runFunctor() override { functor(); } -- cgit v1.2.3 From 5a1ff374858879eeb10d62ddfd353b0e66ca49b4 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Sun, 27 Nov 2016 11:30:47 +0300 Subject: QNX: Add missing override Change-Id: Idb6216a645f7c9791674d16665331a63da46b132 Reviewed-by: Edward Welbourne Reviewed-by: James McDonnell --- src/plugins/platforms/qnx/main.h | 2 +- src/plugins/platforms/qnx/qqnxclipboard.cpp | 6 +++--- src/plugins/platforms/qnx/qqnxclipboard.h | 4 ++-- src/plugins/platforms/qnx/qqnxcursor.h | 6 +++--- src/plugins/platforms/qnx/qqnxeglwindow.h | 6 +++--- src/plugins/platforms/qnx/qqnxglcontext.h | 12 +++++------ src/plugins/platforms/qnx/qqnxinputcontext_imf.h | 24 +++++++++++----------- src/plugins/platforms/qnx/qqnxinputcontext_noimf.h | 18 ++++++++-------- src/plugins/platforms/qnx/qqnxintegration.h | 24 +++++++++++----------- src/plugins/platforms/qnx/qqnxnativeinterface.h | 12 +++++------ src/plugins/platforms/qnx/qqnxnavigatorpps.h | 2 +- src/plugins/platforms/qnx/qqnxrasterbackingstore.h | 12 +++++------ src/plugins/platforms/qnx/qqnxrasterwindow.h | 6 +++--- src/plugins/platforms/qnx/qqnxscreen.h | 24 +++++++++++----------- src/plugins/platforms/qnx/qqnxscreeneventhandler.h | 2 +- src/plugins/platforms/qnx/qqnxscreeneventthread.h | 2 +- src/plugins/platforms/qnx/qqnxservices.h | 4 ++-- src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h | 6 +++--- src/plugins/platforms/qnx/qqnxwindow.h | 22 ++++++++++---------- 19 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/plugins/platforms/qnx/main.h b/src/plugins/platforms/qnx/main.h index 8d99d2432e..5d5bf95686 100644 --- a/src/plugins/platforms/qnx/main.h +++ b/src/plugins/platforms/qnx/main.h @@ -46,7 +46,7 @@ class QQnxIntegrationPlugin : public QPlatformIntegrationPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qnx.json") public: - QPlatformIntegration *create(const QString&, const QStringList&); + QPlatformIntegration *create(const QString&, const QStringList&) override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp index 0d2cc45c30..78174549b1 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.cpp +++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp @@ -103,14 +103,14 @@ public: qClipboardDebug() << "formats=" << m_formatsToCheck; } - bool hasFormat(const QString &mimetype) const + bool hasFormat(const QString &mimetype) const override { const bool result = is_clipboard_format_present(mimetype.toUtf8().constData()) == 0; qClipboardDebug() << "mimetype=" << mimetype << "result=" << result; return result; } - QStringList formats() const + QStringList formats() const override { QStringList result; @@ -141,7 +141,7 @@ public: } protected: - QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const + QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const override { qClipboardDebug() << "mimetype=" << mimetype << "preferredType=" << preferredType; if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0) diff --git a/src/plugins/platforms/qnx/qqnxclipboard.h b/src/plugins/platforms/qnx/qqnxclipboard.h index 5113742087..b9466214f8 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.h +++ b/src/plugins/platforms/qnx/qqnxclipboard.h @@ -52,8 +52,8 @@ class QQnxClipboard : public QPlatformClipboard public: QQnxClipboard(); ~QQnxClipboard(); - QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); - void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override; private: class MimeData; diff --git a/src/plugins/platforms/qnx/qqnxcursor.h b/src/plugins/platforms/qnx/qqnxcursor.h index 5c0d582107..9559bfb4ce 100644 --- a/src/plugins/platforms/qnx/qqnxcursor.h +++ b/src/plugins/platforms/qnx/qqnxcursor.h @@ -50,11 +50,11 @@ public: QQnxCursor(); #if !defined(QT_NO_CURSOR) - void changeCursor(QCursor *windowCursor, QWindow *window); + void changeCursor(QCursor *windowCursor, QWindow *window) override; #endif - void setPos(const QPoint &pos); + void setPos(const QPoint &pos) override; - QPoint pos() const; + QPoint pos() const override; private: QPoint m_pos; diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.h b/src/plugins/platforms/qnx/qqnxeglwindow.h index 943ae44bd9..183be11ddc 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.h +++ b/src/plugins/platforms/qnx/qqnxeglwindow.h @@ -61,11 +61,11 @@ public: void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext); QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; } - void setGeometry(const QRect &rect); + void setGeometry(const QRect &rect) override; protected: - int pixelFormat() const; - void resetBuffers(); + int pixelFormat() const override; + void resetBuffers() override; private: QSize m_requestedBufferSize; diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index 74cd3b4c48..6e5408e8bf 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -64,13 +64,13 @@ public: void requestSurfaceChange(); - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - void swapBuffers(QPlatformSurface *surface); - QFunctionPointer getProcAddress(const char *procName); + bool makeCurrent(QPlatformSurface *surface) override; + void doneCurrent() override; + void swapBuffers(QPlatformSurface *surface) override; + QFunctionPointer getProcAddress(const char *procName) override; - virtual QSurfaceFormat format() const { return m_windowFormat; } - bool isSharing() const; + virtual QSurfaceFormat format() const override { return m_windowFormat; } + bool isSharing() const override; static EGLDisplay getEglDisplay(); EGLConfig getEglConfig() const { return m_eglConfig;} diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h index c4c2057059..e758ae5bf3 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h @@ -71,22 +71,22 @@ public: Reverted, }; - bool isValid() const; + bool isValid() const override; - bool filterEvent(const QEvent *event); - QRectF keyboardRect() const; - void reset(); - void commit(); - void update(Qt::InputMethodQueries); - bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId); + bool filterEvent(const QEvent *event) override; + QRectF keyboardRect() const override; + void reset() override; + void commit() override; + void update(Qt::InputMethodQueries) override; + bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId) override; - void showInputPanel(); - void hideInputPanel(); - bool isInputPanelVisible() const; + void showInputPanel() override; + void hideInputPanel() override; + bool isInputPanelVisible() const override; - QLocale locale() const; - void setFocusObject(QObject *object); + QLocale locale() const override; + void setFocusObject(QObject *object) override; static void setHighlightColor(int index, const QColor &color); diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h index aab8dabedf..8d6104af80 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h @@ -56,19 +56,19 @@ public: explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard); ~QQnxInputContext(); - bool isValid() const; + bool isValid() const override; - void reset(); - bool filterEvent( const QEvent *event ); - QRectF keyboardRect() const; + void reset() override; + bool filterEvent(const QEvent *event) override; + QRectF keyboardRect() const override; bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); - void showInputPanel(); - void hideInputPanel(); - bool isInputPanelVisible() const; + void showInputPanel() override; + void hideInputPanel() override; + bool isInputPanelVisible() const override; - QLocale locale() const; - void setFocusObject(QObject *object); + QLocale locale() const override; + void setFocusObject(QObject *object) override; private Q_SLOTS: void keyboardHeightChanged(); diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index f543b0d102..6f2af82100 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -89,38 +89,38 @@ public: explicit QQnxIntegration(const QStringList ¶mList); ~QQnxIntegration(); - bool hasCapability(QPlatformIntegration::Capability cap) const; + bool hasCapability(QPlatformIntegration::Capability cap) const override; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const override; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; #if !defined(QT_NO_OPENGL) - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; #endif #if defined(QQNX_PPS) - QPlatformInputContext *inputContext() const; + QPlatformInputContext *inputContext() const override; #endif void moveToScreen(QWindow *window, int screen); bool supportsNavigatorEvents() const; - QAbstractEventDispatcher *createEventDispatcher() const; + QAbstractEventDispatcher *createEventDispatcher() const override; - QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; } + QPlatformFontDatabase *fontDatabase() const override { return m_fontDatabase; } - QPlatformNativeInterface *nativeInterface() const; + QPlatformNativeInterface *nativeInterface() const override; #if !defined(QT_NO_CLIPBOARD) - QPlatformClipboard *clipboard() const; + QPlatformClipboard *clipboard() const override; #endif #if !defined(QT_NO_DRAGANDDROP) - QPlatformDrag *drag() const; + QPlatformDrag *drag() const override; #endif - QVariant styleHint(StyleHint hint) const; + QVariant styleHint(StyleHint hint) const override; - QPlatformServices *services() const; + QPlatformServices *services() const override; static QWindow *window(screen_window_t qnxWindow); diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h index 26e34b9d54..25f1c29b02 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.h +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h @@ -50,16 +50,16 @@ class QQnxNativeInterface : public QPlatformNativeInterface { public: QQnxNativeInterface(QQnxIntegration *integration); - void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); - void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen); - void *nativeResourceForIntegration(const QByteArray &resource); + void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; + void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; + void *nativeResourceForIntegration(const QByteArray &resource) override; #if !defined(QT_NO_OPENGL) - void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); + void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; #endif - void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); - NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource); + void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) override; + NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) override; private: QQnxIntegration *m_integration; diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.h b/src/plugins/platforms/qnx/qqnxnavigatorpps.h index 08315f166f..3c818f51a6 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.h +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.h @@ -54,7 +54,7 @@ public: ~QQnxNavigatorPps(); protected: - bool requestInvokeUrl(const QByteArray &encodedUrl); + bool requestInvokeUrl(const QByteArray &encodedUrl) override; private: bool openPpsConnection(); diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h index e4ac8f02b1..96ac193dda 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h @@ -54,12 +54,12 @@ public: QQnxRasterBackingStore(QWindow *window); ~QQnxRasterBackingStore(); - QPaintDevice *paintDevice(); - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size, const QRegion &staticContents); - bool scroll(const QRegion &area, int dx, int dy); - void beginPaint(const QRegion ®ion); - void endPaint(); + QPaintDevice *paintDevice() override; + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; + void resize(const QSize &size, const QRegion &staticContents) override; + bool scroll(const QRegion &area, int dx, int dy) override; + void beginPaint(const QRegion ®ion) override; + void endPaint() override; private: QQnxRasterWindow *platformWindow() const; diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.h b/src/plugins/platforms/qnx/qqnxrasterwindow.h index 53ab29e443..99396efd57 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.h +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.h @@ -58,13 +58,13 @@ public: bool hasBuffers() const { return !bufferSize().isEmpty(); } - void setParent(const QPlatformWindow *window); + void setParent(const QPlatformWindow *window) override; void adjustBufferSize(); protected: - int pixelFormat() const; - void resetBuffers(); + int pixelFormat() const override; + void resetBuffers() override; // Copies content from the previous buffer (back buffer) to the current buffer (front buffer) void blitPreviousToCurrent(const QRegion ®ion, int dx, int dy, bool flush=false); diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index b7264d0973..8a498434aa 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -71,26 +71,26 @@ public: QQnxScreen(screen_context_t context, screen_display_t display, bool primaryScreen); ~QQnxScreen(); - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + QPixmap grabWindow(WId window, int x, int y, int width, int height) const override; - QRect geometry() const { return m_currentGeometry; } - QRect availableGeometry() const; - int depth() const; - QImage::Format format() const { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; } - QSizeF physicalSize() const { return m_currentPhysicalSize; } + QRect geometry() const override { return m_currentGeometry; } + QRect availableGeometry() const override; + int depth() const override; + QImage::Format format() const override { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; } + QSizeF physicalSize() const override { return m_currentPhysicalSize; } - qreal refreshRate() const; + qreal refreshRate() const override; - Qt::ScreenOrientation nativeOrientation() const; - Qt::ScreenOrientation orientation() const; + Qt::ScreenOrientation nativeOrientation() const override; + Qt::ScreenOrientation orientation() const override; - QWindow *topLevelAt(const QPoint &point) const; + QWindow *topLevelAt(const QPoint &point) const override; bool isPrimaryScreen() const { return m_primaryScreen; } int rotation() const { return m_currentRotation; } - QString name() const { return m_name; } + QString name() const override { return m_name; } int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; } screen_display_t nativeDisplay() const { return m_display; } @@ -111,7 +111,7 @@ public: QQnxWindow *rootWindow() const; void setRootWindow(QQnxWindow*); - QPlatformCursor *cursor() const; + QPlatformCursor *cursor() const override; Q_SIGNALS: void foreignWindowCreated(void *window); diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h index 6b234e8d8f..80798a8a2d 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h @@ -75,7 +75,7 @@ Q_SIGNALS: void windowClosed(void *window); protected: - void timerEvent(QTimerEvent *event); + void timerEvent(QTimerEvent *event) override; #if defined(QQNX_SCREENEVENTTHREAD) private Q_SLOTS: diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.h b/src/plugins/platforms/qnx/qqnxscreeneventthread.h index b672fcf991..140f53aa50 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventthread.h +++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.h @@ -65,7 +65,7 @@ public: void unlock(); protected: - void run(); + void run() override; Q_SIGNALS: void eventPending(); diff --git a/src/plugins/platforms/qnx/qqnxservices.h b/src/plugins/platforms/qnx/qqnxservices.h index 94dd5dc0b4..cbf029fdb9 100644 --- a/src/plugins/platforms/qnx/qqnxservices.h +++ b/src/plugins/platforms/qnx/qqnxservices.h @@ -52,8 +52,8 @@ public: explicit QQnxServices(QQnxAbstractNavigator *navigator); ~QQnxServices(); - bool openUrl(const QUrl &url); - bool openDocument(const QUrl &url); + bool openUrl(const QUrl &url) override; + bool openDocument(const QUrl &url) override; private: bool navigatorInvoke(const QUrl &url); diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h index 8580ee151b..51d55a2036 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h @@ -56,14 +56,14 @@ public: QQnxVirtualKeyboardPps(); ~QQnxVirtualKeyboardPps(); - bool showKeyboard(); - bool hideKeyboard(); + bool showKeyboard() override; + bool hideKeyboard() override; public Q_SLOTS: void start(); protected: - void applyKeyboardOptions(); + void applyKeyboardOptions() override; private Q_SLOTS: void ppsDataReady(); diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 2e636c7e3e..e248e04462 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -67,13 +67,13 @@ public: QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow); virtual ~QQnxWindow(); - void setGeometry(const QRect &rect); - void setVisible(bool visible); - void setOpacity(qreal level); + void setGeometry(const QRect &rect) override; + void setVisible(bool visible) override; + void setOpacity(qreal level) override; - bool isExposed() const; + bool isExposed() const override; - WId winId() const { return window()->type() == Qt::Desktop ? -1 : (WId)m_window; } + WId winId() const override { return window()->type() == Qt::Desktop ? -1 : (WId)m_window; } screen_window_t nativeHandle() const { return m_window; } void setBufferSize(const QSize &size); @@ -81,14 +81,14 @@ public: void setScreen(QQnxScreen *platformScreen); - void setParent(const QPlatformWindow *window); - void raise(); - void lower(); - void requestActivateWindow(); - void setWindowState(Qt::WindowState state); + void setParent(const QPlatformWindow *window) override; + void raise() override; + void lower() override; + void requestActivateWindow() override; + void setWindowState(Qt::WindowState state) override; void setExposed(bool exposed); - void propagateSizeHints(); + void propagateSizeHints() override; void setMMRendererWindowName(const QString &name); void setMMRendererWindow(screen_window_t handle); -- cgit v1.2.3 From 97b8fdab7d3604294476bf566b024ecbd5b412b0 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 25 Nov 2016 10:55:46 +0100 Subject: Fix clipping of fetchTransformed Bound x and y to the clipping rect instead of the texture rect. This has minor effects on lancelot, but all within the 5% fuzz. Change-Id: Ia6141e4f7649dad53211bd959af1bce48372e26d Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qdrawhelper.cpp | 60 ++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 724af095ad..64956d342d 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1562,8 +1562,12 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, int y, int x, int length) { Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled); - int image_width = data->texture.width; - int image_height = data->texture.height; + const int image_width = data->texture.width; + const int image_height = data->texture.height; + const int image_x1 = data->texture.x1; + const int image_y1 = data->texture.y1; + const int image_x2 = data->texture.x2 - 1; + const int image_y2 = data->texture.y2 - 1; const qreal cx = x + qreal(0.5); const qreal cy = y + qreal(0.5); @@ -1596,8 +1600,8 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, if (px < 0) px += image_width; if (py < 0) py += image_height; } else { - px = qBound(0, px, image_width - 1); - py = qBound(0, py, image_height - 1); + px = qBound(image_x1, px, image_x2); + py = qBound(image_y1, py, image_y2); } *b = fetch(data->texture.scanLine(py), px); @@ -1627,8 +1631,8 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, if (px < 0) px += image_width; if (py < 0) py += image_height; } else { - px = qBound(0, px, image_width - 1); - py = qBound(0, py, image_height - 1); + px = qBound(image_x1, px, image_x2); + py = qBound(image_y1, py, image_y2); } *b = fetch(data->texture.scanLine(py), px); @@ -1649,8 +1653,12 @@ template /* either BlendTransformed or BlendTransfo static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - int image_width = data->texture.width; - int image_height = data->texture.height; + const int image_width = data->texture.width; + const int image_height = data->texture.height; + const int image_x1 = data->texture.x1; + const int image_y1 = data->texture.y1; + const int image_x2 = data->texture.x2 - 1; + const int image_y2 = data->texture.y2 - 1; const qreal cx = x + qreal(0.5); const qreal cy = y + qreal(0.5); @@ -1687,8 +1695,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper if (px < 0) px += image_width; if (py < 0) py += image_height; } else { - px = qBound(0, px, image_width - 1); - py = qBound(0, py, image_height - 1); + px = qBound(image_x1, px, image_x2); + py = qBound(image_y1, py, image_y2); } buffer32[j] = fetch(data->texture.scanLine(py), px); @@ -1728,8 +1736,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper if (px < 0) px += image_width; if (py < 0) py += image_height; } else { - px = qBound(0, px, image_width - 1); - py = qBound(0, py, image_height - 1); + px = qBound(image_x1, px, image_x2); + py = qBound(image_y1, py, image_y2); } buffer32[j] = fetch(data->texture.scanLine(py), px); @@ -4628,8 +4636,10 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; uint buffer[buffer_size]; - int image_width = data->texture.width; - int image_height = data->texture.height; + const int image_x1 = data->texture.x1; + const int image_y1 = data->texture.y1; + const int image_x2 = data->texture.x2 - 1; + const int image_y2 = data->texture.y2 - 1; if (data->fast_matrix) { // The increment pr x in the scanline @@ -4656,8 +4666,8 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData const uint *end = buffer + l; uint *b = buffer; while (b < end) { - int px = qBound(0, x >> 16, image_width - 1); - int py = qBound(0, y >> 16, image_height - 1); + int px = qBound(image_x1, x >> 16, image_x2); + int py = qBound(image_y1, y >> 16, image_y2); *b = reinterpret_cast(data->texture.scanLine(py))[px]; x += fdx; @@ -4696,8 +4706,8 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData const qreal iw = w == 0 ? 1 : 1 / w; const qreal tx = x * iw; const qreal ty = y * iw; - const int px = qBound(0, int(tx) - (tx < 0), image_width - 1); - const int py = qBound(0, int(ty) - (ty < 0), image_height - 1); + const int px = qBound(image_x1, int(tx) - (tx < 0), image_x2); + const int py = qBound(image_y1, int(ty) - (ty < 0), image_y2); *b = reinterpret_cast(data->texture.scanLine(py))[px]; x += fdx; @@ -4729,8 +4739,10 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa } quint16 buffer[buffer_size]; - const int image_width = data->texture.width; - const int image_height = data->texture.height; + const int image_x1 = data->texture.x1; + const int image_y1 = data->texture.y1; + const int image_x2 = data->texture.x2 - 1; + const int image_y2 = data->texture.y2 - 1; if (data->fast_matrix) { // The increment pr x in the scanline @@ -4768,8 +4780,8 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa const quint16 *end = b + l; while (b < end) { - const int px = qBound(0, x >> 16, image_width - 1); - const int py = qBound(0, y >> 16, image_height - 1); + const int px = qBound(image_x1, x >> 16, image_x2); + const int py = qBound(image_y1, y >> 16, image_y2); *b = ((const quint16 *)data->texture.scanLine(py))[px]; ++b; @@ -4827,8 +4839,8 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa const qreal tx = x * iw; const qreal ty = y * iw; - const int px = qBound(0, int(tx) - (tx < 0), image_width - 1); - const int py = qBound(0, int(ty) - (ty < 0), image_height - 1); + const int px = qBound(image_x1, int(tx) - (tx < 0), image_x2); + const int py = qBound(image_y1, int(ty) - (ty < 0), image_y2); *b = ((const quint16 *)data->texture.scanLine(py))[px]; ++b; -- cgit v1.2.3 From 2fd3d8ea9e3e1829653942431070a83569bab6eb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 30 Sep 2016 15:16:55 +0200 Subject: tests/auto/widgets: use QCOMPARE(., nullptr) .. instead of manually casted 0s. QCOMPARE(., nullptr) was added for Qt 5.8. Make use of the new API. In tst_qwidget.cpp, as a drive-by, change qApp->focusWidget() -> QApplication::focusWidget() Change-Id: I1331b8916b026d48e01534d1ed0b3d72f3f3d50c Reviewed-by: Friedemann Kleint --- .../dialogs/qfiledialog/tst_qfiledialog.cpp | 6 +- .../qfilesystemmodel/tst_qfilesystemmodel.cpp | 2 +- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 2 +- .../tst_qgraphicsgridlayout.cpp | 4 +- .../qgraphicsitem/tst_qgraphicsitem.cpp | 214 ++++++++++----------- .../tst_qgraphicsitemanimation.cpp | 6 +- .../qgraphicslayout/tst_qgraphicslayout.cpp | 6 +- .../tst_qgraphicslayoutitem.cpp | 2 +- .../tst_qgraphicslinearlayout.cpp | 2 +- .../tst_qgraphicsproxywidget.cpp | 4 +- .../qgraphicsscene/tst_qgraphicsscene.cpp | 24 +-- .../qgraphicsview/tst_qgraphicsview.cpp | 8 +- .../qgraphicswidget/tst_qgraphicswidget.cpp | 34 ++-- .../qabstractitemview/tst_qabstractitemview.cpp | 2 +- .../itemviews/qcolumnview/tst_qcolumnview.cpp | 6 +- .../qdatawidgetmapper/tst_qdatawidgetmapper.cpp | 10 +- .../itemviews/qlistwidget/tst_qlistwidget.cpp | 12 +- .../itemviews/qtablewidget/tst_qtablewidget.cpp | 4 +- .../widgets/itemviews/qtreeview/tst_qtreeview.cpp | 14 +- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 18 +- .../tst_qtreewidgetitemiterator.cpp | 4 +- tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 2 +- .../kernel/qstackedlayout/tst_qstackedlayout.cpp | 6 +- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 56 +++--- .../qwindowcontainer/tst_qwindowcontainer.cpp | 2 +- .../styles/qstyleoption/tst_qstyleoption.cpp | 2 +- .../widgets/util/qundogroup/tst_qundogroup.cpp | 14 +- .../widgets/widgets/qcombobox/tst_qcombobox.cpp | 6 +- .../widgets/qdockwidget/tst_qdockwidget.cpp | 4 +- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 4 +- 30 files changed, 240 insertions(+), 240 deletions(-) diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 741b5e8aae..c9aef497af 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -1026,17 +1026,17 @@ void tst_QFiledialog::viewMode() void tst_QFiledialog::proxymodel() { QFileDialog fd; - QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0); + QCOMPARE(fd.proxyModel(), nullptr); fd.setProxyModel(0); - QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0); + QCOMPARE(fd.proxyModel(), nullptr); QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(&fd); fd.setProxyModel(proxyModel); QCOMPARE(fd.proxyModel(), (QAbstractProxyModel *)proxyModel); fd.setProxyModel(0); - QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0); + QCOMPARE(fd.proxyModel(), nullptr); } void tst_QFiledialog::setEmptyNameFilter() diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 0bb2c50b9d..31df66e312 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -135,7 +135,7 @@ tst_QFileSystemModel::tst_QFileSystemModel() : model(0) void tst_QFileSystemModel::init() { cleanup(); - QCOMPARE(model, (QFileSystemModel*)0); + QCOMPARE(model, nullptr); model = new QFileSystemModel; } diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 2a629c3ff0..db86fba59c 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -2400,7 +2400,7 @@ void tst_QWizard::removePage() QCOMPARE(arguments.at(0).toInt(), 3); QVERIFY(wizard.visitedPages().empty()); QVERIFY(wizard.pageIds().empty()); - QCOMPARE(wizard.currentPage(), static_cast(0)); + QCOMPARE(wizard.currentPage(), nullptr); } void tst_QWizard::sideWidget() diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index f5b2269297..9d4b640272 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -1073,7 +1073,7 @@ void tst_QGraphicsGridLayout::itemAt() } else { const QByteArray message = "QGraphicsGridLayout::itemAt: invalid index " + QByteArray::number(i); QTest::ignoreMessage(QtWarningMsg, message.constData()); - QCOMPARE(layout->itemAt(i), static_cast(0)); + QCOMPARE(layout->itemAt(i), nullptr); } } delete widget; @@ -1102,7 +1102,7 @@ void tst_QGraphicsGridLayout::removeAt() QGraphicsLayoutItem *item0 = layout->itemAt(0); QCOMPARE(item0->parentLayoutItem(), static_cast(layout)); layout->removeAt(0); - QCOMPARE(item0->parentLayoutItem(), static_cast(0)); + QCOMPARE(item0->parentLayoutItem(), nullptr); QCOMPARE(layout->count(), 0); QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::removeAt: invalid index 0").toLatin1().constData()); layout->removeAt(0); diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 96a76d885d..96827022a8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -486,7 +486,7 @@ void tst_QGraphicsItem::construction() ((QGraphicsEllipseItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsEllipseItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsEllipseItem *)item); - QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(qgraphicsitem_cast(item), nullptr); QCOMPARE(item->flags(), 0); break; case 1: @@ -494,7 +494,7 @@ void tst_QGraphicsItem::construction() ((QGraphicsLineItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsLineItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsLineItem *)item); - QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(qgraphicsitem_cast(item), nullptr); QCOMPARE(item->flags(), 0); break; case 2: @@ -502,14 +502,14 @@ void tst_QGraphicsItem::construction() ((QGraphicsPathItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsPathItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsPathItem *)item); - QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(qgraphicsitem_cast(item), nullptr); QCOMPARE(item->flags(), 0); break; case 3: item = new QGraphicsPixmapItem; QCOMPARE(int(item->type()), int(QGraphicsPixmapItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsPixmapItem *)item); - QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(qgraphicsitem_cast(item), nullptr); QCOMPARE(item->flags(), 0); break; case 4: @@ -517,7 +517,7 @@ void tst_QGraphicsItem::construction() ((QGraphicsPolygonItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsPolygonItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsPolygonItem *)item); - QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(qgraphicsitem_cast(item), nullptr); QCOMPARE(item->flags(), 0); break; case 5: @@ -525,14 +525,14 @@ void tst_QGraphicsItem::construction() ((QGraphicsRectItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsRectItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)item); - QCOMPARE(qgraphicsitem_cast(item), (QGraphicsLineItem *)0); + QCOMPARE(qgraphicsitem_cast(item), nullptr); QCOMPARE(item->flags(), 0); break; case 6: item = new QGraphicsTextItem; QCOMPARE(int(item->type()), int(QGraphicsTextItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsTextItem *)item); - QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(qgraphicsitem_cast(item), nullptr); // This is the only item that uses an extended style option. QCOMPARE(item->flags(), QGraphicsItem::GraphicsItemFlags(QGraphicsItem::ItemUsesExtendedStyleOption)); break; @@ -541,8 +541,8 @@ void tst_QGraphicsItem::construction() break; } - QCOMPARE(item->scene(), (QGraphicsScene *)0); - QCOMPARE(item->parentItem(), (QGraphicsItem *)0); + QCOMPARE(item->scene(), nullptr); + QCOMPARE(item->parentItem(), nullptr); QVERIFY(item->childItems().isEmpty()); QVERIFY(item->isVisible()); QVERIFY(item->isEnabled()); @@ -640,7 +640,7 @@ void tst_QGraphicsItem::destruction() QGraphicsScene scene; QGraphicsItem *parent = new QGraphicsRectItem; Item *child = new Item; - QCOMPARE(child->parentItem(), (QGraphicsItem *)0); + QCOMPARE(child->parentItem(), nullptr); child->setParentItem(parent); QCOMPARE(child->parentItem(), parent); scene.addItem(parent); @@ -669,7 +669,7 @@ void tst_QGraphicsItem::destruction() scene.addItem(parent); QCOMPARE(child->scene(), &scene); scene.removeItem(parent); - QCOMPARE(child->scene(), (QGraphicsScene *)0); + QCOMPARE(child->scene(), nullptr); delete parent; QCOMPARE(itemDeleted, 5); } @@ -678,14 +678,14 @@ void tst_QGraphicsItem::destruction() QGraphicsItem *parent = new QGraphicsRectItem; Item *child = new Item; child->setParentItem(parent); - QCOMPARE(child->scene(), (QGraphicsScene *)0); - QCOMPARE(parent->scene(), (QGraphicsScene *)0); + QCOMPARE(child->scene(), nullptr); + QCOMPARE(parent->scene(), nullptr); scene.addItem(parent); QCOMPARE(child->scene(), &scene); scene.removeItem(child); - QCOMPARE(child->scene(), (QGraphicsScene *)0); + QCOMPARE(child->scene(), nullptr); QCOMPARE(parent->scene(), &scene); - QCOMPARE(child->parentItem(), (QGraphicsItem *)0); + QCOMPARE(child->parentItem(), nullptr); QVERIFY(parent->childItems().isEmpty()); delete parent; QCOMPARE(itemDeleted, 5); @@ -799,7 +799,7 @@ void tst_QGraphicsItem::deleteChildItem() void tst_QGraphicsItem::scene() { QGraphicsRectItem *item = new QGraphicsRectItem; - QCOMPARE(item->scene(), (QGraphicsScene *)0); + QCOMPARE(item->scene(), nullptr); QGraphicsScene scene; scene.addItem(item); @@ -810,7 +810,7 @@ void tst_QGraphicsItem::scene() QCOMPARE(item->scene(), (QGraphicsScene *)&scene2); scene2.removeItem(item); - QCOMPARE(item->scene(), (QGraphicsScene *)0); + QCOMPARE(item->scene(), nullptr); delete item; } @@ -818,14 +818,14 @@ void tst_QGraphicsItem::scene() void tst_QGraphicsItem::parentItem() { QGraphicsRectItem item; - QCOMPARE(item.parentItem(), (QGraphicsItem *)0); + QCOMPARE(item.parentItem(), nullptr); QGraphicsRectItem *item2 = new QGraphicsRectItem(QRectF(), &item); QCOMPARE(item2->parentItem(), (QGraphicsItem *)&item); item2->setParentItem(&item); QCOMPARE(item2->parentItem(), (QGraphicsItem *)&item); item2->setParentItem(0); - QCOMPARE(item2->parentItem(), (QGraphicsItem *)0); + QCOMPARE(item2->parentItem(), nullptr); delete item2; } @@ -837,7 +837,7 @@ void tst_QGraphicsItem::setParentItem() QCOMPARE(item->scene(), &scene); const QScopedPointer child(new QGraphicsRectItem); - QCOMPARE(child->scene(), (QGraphicsScene *)0); + QCOMPARE(child->scene(), nullptr); // This implicitly adds the item to the parent's scene child->setParentItem(item.data()); @@ -850,7 +850,7 @@ void tst_QGraphicsItem::setParentItem() // Add the child back to the parent, then remove the parent from the scene child->setParentItem(item.data()); scene.removeItem(item.data()); - QCOMPARE(child->scene(), (QGraphicsScene *)0); + QCOMPARE(child->scene(), nullptr); } void tst_QGraphicsItem::children() @@ -917,7 +917,7 @@ void tst_QGraphicsItem::flags() event.setButton(Qt::LeftButton); event.setButtons(Qt::LeftButton); QApplication::sendEvent(&scene, &event); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); // mouse grabber is reset + QCOMPARE(scene.mouseGrabberItem(), nullptr); // mouse grabber is reset QGraphicsSceneMouseEvent event2(QEvent::GraphicsSceneMouseMove); event2.setScenePos(QPointF(10, 10)); @@ -930,7 +930,7 @@ void tst_QGraphicsItem::flags() event3.setScenePos(QPointF(10, 10)); event3.setButtons(0); QApplication::sendEvent(&scene, &event3); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); item->setFlag(QGraphicsItem::ItemIsMovable, true); QGraphicsSceneMouseEvent event4(QEvent::GraphicsSceneMousePress); @@ -1122,9 +1122,9 @@ void tst_QGraphicsItem::visible() QApplication::sendEvent(&scene, &event); QCOMPARE(scene.mouseGrabberItem(), item); item->setVisible(false); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); item->setVisible(true); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); item->setFlag(QGraphicsItem::ItemIsFocusable); item->setFocus(); @@ -1378,12 +1378,12 @@ void tst_QGraphicsItem::enabled() event.setButton(Qt::LeftButton); event.setScenePos(QPointF(0, 0)); QApplication::sendEvent(&scene, &event); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); item->setEnabled(true); QApplication::sendEvent(&scene, &event); QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item); item->setEnabled(false); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); } void tst_QGraphicsItem::explicitlyEnabled() @@ -1888,7 +1888,7 @@ void tst_QGraphicsItem::acceptedMouseButtons() QApplication::sendEvent(&scene, &event); QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item2); item2->setAcceptedMouseButtons(0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QApplication::sendEvent(&scene, &event); QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item1); } @@ -2069,8 +2069,8 @@ void tst_QGraphicsItem::hasFocus() scene2.addItem(line); QVERIFY(!line->hasFocus()); - QCOMPARE(scene.focusItem(), (QGraphicsItem *)0); - QCOMPARE(scene2.focusItem(), (QGraphicsItem *)0); + QCOMPARE(scene.focusItem(), nullptr); + QCOMPARE(scene2.focusItem(), nullptr); line->setFocus(); QVERIFY(line->hasFocus()); @@ -3137,7 +3137,7 @@ void tst_QGraphicsItem::commonAncestorItem() grandPa->setParentItem(ancestor); QCOMPARE(grandMa->commonAncestorItem(grandMa), grandMa); - QCOMPARE(grandMa->commonAncestorItem(0), (QGraphicsItem *)0); + QCOMPARE(grandMa->commonAncestorItem(0), nullptr); QCOMPARE(grandMa->commonAncestorItem(grandPa), ancestor); QCOMPARE(grandPa->commonAncestorItem(grandMa), ancestor); QCOMPARE(grandPa->commonAncestorItem(husband), grandPa); @@ -3556,9 +3556,9 @@ void tst_QGraphicsItem::group() parent->setPos(25, 25); child->setPos(25, 25); - QCOMPARE(parent->group(), (QGraphicsItemGroup *)0); - QCOMPARE(parent2->group(), (QGraphicsItemGroup *)0); - QCOMPARE(child->group(), (QGraphicsItemGroup *)0); + QCOMPARE(parent->group(), nullptr); + QCOMPARE(parent2->group(), nullptr); + QCOMPARE(child->group(), nullptr); QGraphicsView view(&scene); view.show(); @@ -3620,8 +3620,8 @@ void tst_QGraphicsItem::setGroup() QGraphicsItemGroup group2; const QScopedPointer rect(new QGraphicsRectItem); - QCOMPARE(rect->group(), (QGraphicsItemGroup *)0); - QCOMPARE(rect->parentItem(), (QGraphicsItem *)0); + QCOMPARE(rect->group(), nullptr); + QCOMPARE(rect->parentItem(), nullptr); rect->setGroup(&group1); QCOMPARE(rect->group(), &group1); QCOMPARE(rect->parentItem(), (QGraphicsItem *)&group1); @@ -3629,8 +3629,8 @@ void tst_QGraphicsItem::setGroup() QCOMPARE(rect->group(), &group2); QCOMPARE(rect->parentItem(), (QGraphicsItem *)&group2); rect->setGroup(0); - QCOMPARE(rect->group(), (QGraphicsItemGroup *)0); - QCOMPARE(rect->parentItem(), (QGraphicsItem *)0); + QCOMPARE(rect->group(), nullptr); + QCOMPARE(rect->parentItem(), nullptr); } void tst_QGraphicsItem::setGroup2() @@ -3679,14 +3679,14 @@ void tst_QGraphicsItem::nestedGroups() QCOMPARE(rect->group(), group1); QCOMPARE(rect2->group(), group1); QCOMPARE(group1->group(), group2); - QCOMPARE(group2->group(), (QGraphicsItemGroup *)0); + QCOMPARE(group2->group(), nullptr); QGraphicsScene scene; scene.addItem(group1); QCOMPARE(rect->group(), group1); QCOMPARE(rect2->group(), group1); - QCOMPARE(group1->group(), (QGraphicsItemGroup *)0); + QCOMPARE(group1->group(), nullptr); QVERIFY(group2->childItems().isEmpty()); delete group2; @@ -4769,8 +4769,8 @@ void tst_QGraphicsItem::itemChange() QCOMPARE(tester.changes.size(), ++changeCount); QCOMPARE(tester.changes.last(), QGraphicsItem::ItemParentChange); QCOMPARE(qvariant_cast(tester.values.last()), (QGraphicsItem *)&testerHelper); - QCOMPARE(qvariant_cast(tester.oldValues.last()), (QGraphicsItem *)0); - QCOMPARE(tester.parentItem(), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast(tester.oldValues.last()), nullptr); + QCOMPARE(tester.parentItem(), nullptr); } { // ItemOpacityChange @@ -4866,7 +4866,7 @@ void tst_QGraphicsItem::itemChange() QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemSceneHasChanged); // Item's old value was 0 // Item's current value is scene - QCOMPARE(qvariant_cast(tester.oldValues.last()), (QGraphicsScene *)0); + QCOMPARE(qvariant_cast(tester.oldValues.last()), nullptr); QCOMPARE(qvariant_cast(tester.values.last()), (QGraphicsScene *)&scene); scene2.addItem(&tester); ++changeCount; // ItemSceneChange (0) was: (scene) @@ -4884,14 +4884,14 @@ void tst_QGraphicsItem::itemChange() // Item's last current value is 0 QCOMPARE(qvariant_cast(tester.oldValues.at(tester.oldValues.size() - 2)), (QGraphicsScene *)&scene); - QCOMPARE(qvariant_cast(tester.oldValues.at(tester.oldValues.size() - 1)), (QGraphicsScene *)0); - QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 4)), (QGraphicsScene *)0); - QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 3)), (QGraphicsScene *)0); + QCOMPARE(qvariant_cast(tester.oldValues.at(tester.oldValues.size() - 1)), nullptr); + QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 4)), nullptr); + QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 3)), nullptr); QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)&scene2); QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)&scene2); // Item's last old value was 0 // Item's last current value is scene2 - QCOMPARE(qvariant_cast(tester.oldValues.last()), (QGraphicsScene *)0); + QCOMPARE(qvariant_cast(tester.oldValues.last()), nullptr); QCOMPARE(qvariant_cast(tester.values.last()), (QGraphicsScene *)&scene2); scene2.removeItem(&tester); @@ -4899,14 +4899,14 @@ void tst_QGraphicsItem::itemChange() ++changeCount; // ItemSceneHasChanged (0) QCOMPARE(tester.changes.size(), changeCount); - QCOMPARE(tester.scene(), (QGraphicsScene *)0); + QCOMPARE(tester.scene(), nullptr); QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemSceneChange); QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemSceneHasChanged); // Item's last old value was scene2 // Item's last current value is 0 QCOMPARE(qvariant_cast(tester.oldValues.last()), (QGraphicsScene *)&scene2); - QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)0); - QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)0); + QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 2)), nullptr); + QCOMPARE(qvariant_cast(tester.values.at(tester.values.size() - 1)), nullptr); tester.itemSceneChangeTargetScene = &scene; scene2.addItem(&tester); @@ -4925,7 +4925,7 @@ void tst_QGraphicsItem::itemChange() scene.removeItem(&tester); ++changeCount; // ItemSceneChange ++changeCount; // ItemSceneHasChanged - QCOMPARE(tester.scene(), (QGraphicsScene *)0); + QCOMPARE(tester.scene(), nullptr); } { // ItemToolTipChange/ItemToolTipHasChanged @@ -6505,7 +6505,7 @@ void tst_QGraphicsItem::task240400_clickOnTextItem() if (flags || textFlags) QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item); else - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease); event.setScenePos(item->sceneBoundingRect().topLeft() + QPointF(0.1, 0.1)); @@ -6532,7 +6532,7 @@ void tst_QGraphicsItem::task240400_clickOnTextItem() if (flags || textFlags) QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item); else - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease); event.setScenePos(item->sceneBoundingRect().center()); @@ -8454,17 +8454,17 @@ void tst_QGraphicsItem::focusProxy() QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); item2->setFocusProxy(item); // fails QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2); - QCOMPARE(item2->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(item2->focusProxy(), nullptr); // Try to assign self as focus proxy QTest::ignoreMessage(QtWarningMsg, "QGraphicsItem::setFocusProxy: cannot assign self as focus proxy"); item->setFocusProxy(item); // fails QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2); - QCOMPARE(item2->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(item2->focusProxy(), nullptr); // Reset the focus proxy item->setFocusProxy(0); - QCOMPARE(item->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(item->focusProxy(), nullptr); QVERIFY(!item->hasFocus()); QVERIFY(item2->hasFocus()); @@ -8472,7 +8472,7 @@ void tst_QGraphicsItem::focusProxy() item->setFocusProxy(item2); QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2); delete item2; - QCOMPARE(item->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(item->focusProxy(), nullptr); // Test event delivery item2 = scene.addRect(0, 0, 10, 10); @@ -8502,11 +8502,11 @@ void tst_QGraphicsItem::focusProxy() item3->setFocusProxy(item2); // item and item3 use item2 as proxy QCOMPARE(item->focusProxy(), item2); - QCOMPARE(item2->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(item2->focusProxy(), nullptr); QCOMPARE(item3->focusProxy(), item2); delete item2; - QCOMPARE(item->focusProxy(), (QGraphicsItem *)0); - QCOMPARE(item3->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(item->focusProxy(), nullptr); + QCOMPARE(item3->focusProxy(), nullptr); } void tst_QGraphicsItem::subFocus() @@ -8557,8 +8557,8 @@ void tst_QGraphicsItem::subFocus() // readd them. Now the subfocus should kick in and give // text2 focus. scene.removeItem(text); - QCOMPARE(text->focusItem(), (QGraphicsItem *)0); - QCOMPARE(text2->focusItem(), (QGraphicsItem *)0); + QCOMPARE(text->focusItem(), nullptr); + QCOMPARE(text2->focusItem(), nullptr); text2->setFocus(); QCOMPARE(text->focusItem(), (QGraphicsItem *)text2); QCOMPARE(text2->focusItem(), (QGraphicsItem *)text2); @@ -8596,9 +8596,9 @@ void tst_QGraphicsItem::subFocus() QVERIFY(rect3->hasFocus()); delete rect2; - QCOMPARE(text->focusItem(), (QGraphicsItem *)0); - QCOMPARE(text2->focusItem(), (QGraphicsItem *)0); - QCOMPARE(rect->focusItem(), (QGraphicsItem *)0); + QCOMPARE(text->focusItem(), nullptr); + QCOMPARE(text2->focusItem(), nullptr); + QCOMPARE(rect->focusItem(), nullptr); } void tst_QGraphicsItem::focusProxyDeletion() @@ -8609,7 +8609,7 @@ void tst_QGraphicsItem::focusProxyDeletion() QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2); delete rect2; - QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(rect->focusProxy(), nullptr); rect2 = new QGraphicsRectItem; rect->setFocusProxy(rect2); @@ -8623,12 +8623,12 @@ void tst_QGraphicsItem::focusProxyDeletion() scene->addItem(rect); scene->addItem(rect2); delete rect2; - QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(rect->focusProxy(), nullptr); rect2 = new QGraphicsRectItem; QTest::ignoreMessage(QtWarningMsg, "QGraphicsItem::setFocusProxy: focus proxy must be in same scene"); rect->setFocusProxy(rect2); - QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0); + QCOMPARE(rect->focusProxy(), nullptr); scene->addItem(rect2); rect->setFocusProxy(rect2); QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2); @@ -9003,7 +9003,7 @@ void tst_QGraphicsItem::activate() QVERIFY(rect3->isActive()); scene.removeItem(rect3); QVERIFY(!rect3->isActive()); // no panel is active anymore - QCOMPARE(scene.activePanel(), (QGraphicsItem *)0); + QCOMPARE(scene.activePanel(), nullptr); scene.addItem(rect3); QVERIFY(rect3->isActive()); // second panel item is activated @@ -9043,7 +9043,7 @@ void tst_QGraphicsItem::activate() QVERIFY(!rect4->isActive()); QVERIFY(!rect5->isActive()); QVERIFY(!rect6->isActive()); - QCOMPARE(scene.activePanel(), (QGraphicsItem *)0); + QCOMPARE(scene.activePanel(), nullptr); // Controlling auto-activation when the scene changes activation. rect4->setActive(true); @@ -9071,7 +9071,7 @@ void tst_QGraphicsItem::setActivePanelOnInactiveScene() EventSpy sceneActivationChangeSpy(&scene, QEvent::ActivationChange); scene.setActivePanel(panel); - QCOMPARE(scene.activePanel(), (QGraphicsItem *)0); + QCOMPARE(scene.activePanel(), nullptr); QCOMPARE(itemActivateSpy.count(), 0); QCOMPARE(itemDeactivateSpy.count(), 0); QCOMPARE(panelActivateSpy.count(), 0); @@ -9350,7 +9350,7 @@ void tst_QGraphicsItem::focusScope() QCOMPARE(scope3->focusItem(), (QGraphicsItem *)scope3); QCOMPARE(scope1->focusScopeItem(), (QGraphicsItem *)scope2); QCOMPARE(scope2->focusScopeItem(), (QGraphicsItem *)scope3); - QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(scope3->focusScopeItem(), nullptr); scene.addItem(scope1); @@ -9363,7 +9363,7 @@ void tst_QGraphicsItem::focusScope() QCOMPARE(scope3->focusItem(), (QGraphicsItem *)scope3); QCOMPARE(scope1->focusScopeItem(), (QGraphicsItem *)scope2); QCOMPARE(scope2->focusScopeItem(), (QGraphicsItem *)scope3); - QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(scope3->focusScopeItem(), nullptr); QVERIFY(scope3->hasFocus()); @@ -9445,8 +9445,8 @@ void tst_QGraphicsItem::focusScope() rect4->setParentItem(0); QVERIFY(rect5->hasFocus()); - QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); - QCOMPARE(scope3->focusItem(), (QGraphicsItem *)0); + QCOMPARE(scope3->focusScopeItem(), nullptr); + QCOMPARE(scope3->focusItem(), nullptr); QVERIFY(!scope3->hasFocus()); QGraphicsRectItem *rectA = new QGraphicsRectItem; @@ -9501,7 +9501,7 @@ void tst_QGraphicsItem::focusScope2() siblingChild2->setParentItem(siblingFocusScope); QCOMPARE(siblingFocusScope->focusScopeItem(), (QGraphicsItem *)siblingChild1); - QCOMPARE(siblingFocusScope->focusItem(), (QGraphicsItem *)0); + QCOMPARE(siblingFocusScope->focusItem(), nullptr); QGraphicsItem *root = new QGraphicsRectItem; rootFocusScope->setParentItem(root); @@ -9526,7 +9526,7 @@ void tst_QGraphicsItem::focusScope2() QVERIFY(!siblingChild2->hasFocus()); QVERIFY(!siblingChild2->focusItem()); QCOMPARE(siblingFocusScope->focusScopeItem(), (QGraphicsItem *)siblingChild2); - QCOMPARE(siblingFocusScope->focusItem(), (QGraphicsItem *)0); + QCOMPARE(siblingFocusScope->focusItem(), nullptr); // Set focus on the scope; focus is forwarded to the focus scope item. siblingFocusScope->setFocus(); @@ -9571,7 +9571,7 @@ void tst_QGraphicsItem::focusScopeItemChangedWhileScopeDoesntHaveFocus() FocusScopeItem *child1 = new FocusScopeItem(&rect); FocusScopeItem *child2 = new FocusScopeItem(&rect); - QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(rect.focusScopeItem(), nullptr); QCOMPARE(child1->focusScopeChanged, 0); QCOMPARE(child2->focusScopeChanged, 0); child1->setFocus(); @@ -9587,7 +9587,7 @@ void tst_QGraphicsItem::focusScopeItemChangedWhileScopeDoesntHaveFocus() QCOMPARE(child1->focusScopeChanged, 3); QCOMPARE(child2->focusScopeChanged, 2); child1->clearFocus(); - QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(rect.focusScopeItem(), nullptr); QCOMPARE(child1->focusScopeChanged, 4); QCOMPARE(child2->focusScopeChanged, 2); } @@ -10245,7 +10245,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // releasing goes nowhere sendMouseRelease(&scene, QPoint(-25, -25)); @@ -10255,7 +10255,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0); QCOMPARE(rect2Spy.counts[QEvent::GraphicsSceneMouseRelease], 0); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // pressing mouse on rect1 starts implicit grab on rect2 (since it is modal) sendMouseClick(&scene, QPoint(-25, -25)); @@ -10285,7 +10285,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // rect1 does *not* re-grab when rect2 is no longer modal rect2->setPanelModality(QGraphicsItem::NonModal); @@ -10293,7 +10293,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // release goes nowhere sendMouseRelease(&scene, QPoint(-25, -25)); @@ -10302,7 +10302,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); } { // repeat the test using PanelModal @@ -10325,7 +10325,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // releasing goes nowhere sendMouseRelease(&scene, QPoint(-25, -25)); @@ -10335,7 +10335,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0); QCOMPARE(rect2Spy.counts[QEvent::GraphicsSceneMouseRelease], 0); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // pressing mouse on rect1 starts implicit grab on rect2 (since it is modal) sendMouseClick(&scene, QPoint(-25, -25)); @@ -10365,7 +10365,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // rect1 does *not* re-grab when rect2 is no longer modal rect2->setPanelModality(QGraphicsItem::NonModal); @@ -10373,7 +10373,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // release goes nowhere sendMouseRelease(&scene, QPoint(-25, -25)); @@ -10382,7 +10382,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2); QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1); QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); } { @@ -10430,7 +10430,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect3Spy.counts[QEvent::GrabMouse], 1); QCOMPARE(rect3Spy.counts[QEvent::GraphicsSceneMouseRelease], 1); QCOMPARE(rect3Spy.counts[QEvent::UngrabMouse], 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); rect2->setPanelModality(QGraphicsItem::NonModal); @@ -10472,7 +10472,7 @@ void tst_QGraphicsItem::modality_mouseGrabber() QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0); QCOMPARE(rect3Spy.counts[QEvent::GrabMouse], 2); QCOMPARE(rect3Spy.counts[QEvent::UngrabMouse], 2); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); } } @@ -10512,7 +10512,7 @@ void tst_QGraphicsItem::modality_clickFocus() // clicking on rect1 should not set it's focus item rect1->clearFocus(); sendMouseClick(&scene, QPointF(-25, -25)); - QCOMPARE(rect1->focusItem(), (QGraphicsItem *) 0); + QCOMPARE(rect1->focusItem(), nullptr); QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 1); QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 1); QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 0); @@ -10531,7 +10531,7 @@ void tst_QGraphicsItem::modality_clickFocus() rect1->setActive(true); rect1->clearFocus(); sendMouseClick(&scene, QPointF(-25, -25)); - QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.focusItem(), nullptr); QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 2); QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 2); QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1); @@ -10539,7 +10539,7 @@ void tst_QGraphicsItem::modality_clickFocus() // focus doesn't change when leaving modality either rect2->setPanelModality(QGraphicsItem::NonModal); - QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0); + QCOMPARE(scene.focusItem(), nullptr); QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 2); QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 2); QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1); @@ -10938,7 +10938,7 @@ void tst_QGraphicsItem::focusHandling() switch (expectedFocusItem) { case 0: - QCOMPARE(scene.focusItem(), static_cast(0)); + QCOMPARE(scene.focusItem(), nullptr); break; case 1: QCOMPARE(scene.focusItem(), focusableUnder); @@ -11304,7 +11304,7 @@ void tst_QGraphicsItem::QT_2649_focusScope() scope->setFocus(); subFocusItem->setParentItem(scope); QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(subFocusItem->focusScopeItem(), nullptr); QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem); QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); @@ -11312,9 +11312,9 @@ void tst_QGraphicsItem::QT_2649_focusScope() rootItem->setFlags(QGraphicsItem::ItemIsFocusable); scope->setParentItem(rootItem); QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(rootItem->focusScopeItem(), nullptr); QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(subFocusItem->focusScopeItem(), nullptr); QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem); QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); @@ -11327,19 +11327,19 @@ void tst_QGraphicsItem::QT_2649_focusScope() QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem); QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem); QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(rootItem->focusScopeItem(), nullptr); QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(subFocusItem->focusScopeItem(), nullptr); QVERIFY(subFocusItem->hasFocus()); scope->hide(); - QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)0); - QCOMPARE(scope->focusItem(), (QGraphicsItem *)0); - QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)0); - QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(rootItem->focusItem(), nullptr); + QCOMPARE(scope->focusItem(), nullptr); + QCOMPARE(subFocusItem->focusItem(), nullptr); + QCOMPARE(rootItem->focusScopeItem(), nullptr); QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(subFocusItem->focusScopeItem(), nullptr); QVERIFY(!subFocusItem->hasFocus()); scope->show(); @@ -11347,9 +11347,9 @@ void tst_QGraphicsItem::QT_2649_focusScope() QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem); QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem); QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(rootItem->focusScopeItem(), nullptr); QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); + QCOMPARE(subFocusItem->focusScopeItem(), nullptr); QVERIFY(subFocusItem->hasFocus()); // This should not crash diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp index acdd3cff81..dfb2752ee0 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp @@ -151,7 +151,7 @@ void tst_QGraphicsItemAnimation::overwriteValueForStep() void tst_QGraphicsItemAnimation::setTimeLine() { QGraphicsItemAnimation animation; - QCOMPARE(animation.timeLine(), (QTimeLine *)0); + QCOMPARE(animation.timeLine(), nullptr); QPointer line1 = new QTimeLine; animation.setTimeLine(line1); @@ -161,7 +161,7 @@ void tst_QGraphicsItemAnimation::setTimeLine() QCOMPARE(animation.timeLine(), (QTimeLine *)line1); animation.setTimeLine(0); - QCOMPARE(animation.timeLine(), (QTimeLine *)0); + QCOMPARE(animation.timeLine(), nullptr); QVERIFY(!line1); QTimeLine *line2 = new QTimeLine; @@ -169,7 +169,7 @@ void tst_QGraphicsItemAnimation::setTimeLine() QCOMPARE(animation.timeLine(), (QTimeLine *)line2); delete line2; - QCOMPARE(animation.timeLine(), (QTimeLine *)0); + QCOMPARE(animation.timeLine(), nullptr); } QTEST_MAIN(tst_QGraphicsItemAnimation) diff --git a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp index 87cd032ad0..cfc18c6e32 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp @@ -186,10 +186,10 @@ void tst_QGraphicsLayout::automaticReparenting() l1->addItem(w1); QGraphicsWidget *w2 = new QGraphicsWidget(); l1->addItem(w2); - QCOMPARE(w1->parentItem(), static_cast(0)); - QCOMPARE(w2->parentItem(), static_cast(0)); + QCOMPARE(w1->parentItem(), nullptr); + QCOMPARE(w2->parentItem(), nullptr); scene.addItem(w1); - QCOMPARE(w1->parentItem(), static_cast(0)); + QCOMPARE(w1->parentItem(), nullptr); window->setLayout(l1); QCOMPARE(w1->parentItem(), static_cast(window)); QCOMPARE(w2->parentItem(), static_cast(window)); diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp index 9b52366855..5b0ceabe62 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp @@ -94,7 +94,7 @@ void tst_QGraphicsLayoutItem::qgraphicslayoutitem() QCOMPARE(layoutItem.isLayout(), false); layoutItem.maximumSize(); layoutItem.minimumSize(); - QCOMPARE(layoutItem.parentLayoutItem(), (QGraphicsLayoutItem*)0); + QCOMPARE(layoutItem.parentLayoutItem(), nullptr); layoutItem.preferredSize(); layoutItem.sizePolicy(); layoutItem.sizeHint(Qt::MinimumSize); diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 5794c32803..322af7c236 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -800,7 +800,7 @@ void tst_QGraphicsLinearLayout::removeAt() QCOMPARE(wParent, static_cast(&layout)); layout.removeAt(removeItemAt); wParent = w->parentLayoutItem(); - QCOMPARE(wParent, static_cast(0)); + QCOMPARE(wParent, nullptr); delete w; } QCOMPARE(layout.count(), itemCount + layoutCount - (w ? 1 : 0)); diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index d99c056abe..65c9938f89 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -482,7 +482,7 @@ void tst_QGraphicsProxyWidget::setWidget() QCOMPARE((qreal)bottom, rbottom); } else { // proxy shouldn't mess with the widget if it can't insert it. - QCOMPARE(proxy->widget(), (QWidget*)0); + QCOMPARE(proxy->widget(), nullptr); QCOMPARE(proxy->acceptHoverEvents(), false); if (subWidget) { QVERIFY(!subWidget->testAttribute(Qt::WA_DontShowOnScreen)); @@ -493,7 +493,7 @@ void tst_QGraphicsProxyWidget::setWidget() } if (widgetExists) { - QCOMPARE(existingSubWidget->parent(), static_cast(0)); + QCOMPARE(existingSubWidget->parent(), nullptr); QVERIFY(!existingSubWidget->testAttribute(Qt::WA_DontShowOnScreen)); QVERIFY(!existingSubWidget->testAttribute(Qt::WA_QuitOnClose)); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index d95f6e408e..7615c5e821 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1539,22 +1539,22 @@ void tst_QGraphicsScene::mouseGrabberItem() QApplication::sendEvent(&scene, &moveEvent); QCOMPARE(scene.mouseGrabberItem(), item); item->setVisible(false); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QApplication::sendEvent(&scene, &pressEvent); QCOMPARE(scene.mouseGrabberItem(), item2); item2->setVisible(false); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QApplication::sendEvent(&scene, &moveEvent); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); item2->setVisible(true); QApplication::sendEvent(&scene, &moveEvent); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QApplication::sendEvent(&scene, &pressEvent); QApplication::sendEvent(&scene, &moveEvent); QCOMPARE(scene.mouseGrabberItem(), item2); scene.removeItem(item2); delete item2; - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); } void tst_QGraphicsScene::hoverEvents_siblings() @@ -1757,7 +1757,7 @@ void tst_QGraphicsScene::createItemGroup() // These share no common parent group = scene.createItemGroup(children3); - QCOMPARE(group->parentItem(), (QGraphicsItem *)0); + QCOMPARE(group->parentItem(), nullptr); scene.destroyItemGroup(group); // Make children3 children of parent3 @@ -1886,7 +1886,7 @@ void tst_QGraphicsScene::mouseEventPropagation() QCOMPARE(c->eventTypes.size(), 0); QCOMPARE(b->eventTypes.size(), 0); QCOMPARE(a->eventTypes.size(), 0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); d->setAcceptedMouseButtons(Qt::RightButton); @@ -1927,7 +1927,7 @@ void tst_QGraphicsScene::mouseEventPropagation() QCOMPARE(c->eventTypes.at(5), QEvent::UngrabMouse); QCOMPARE(b->eventTypes.size(), 0); QCOMPARE(a->eventTypes.size(), 0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // Disabled items eat events. c should not get this. d->setEnabled(false); @@ -1939,7 +1939,7 @@ void tst_QGraphicsScene::mouseEventPropagation() QCOMPARE(c->eventTypes.size(), 6); QCOMPARE(b->eventTypes.size(), 0); QCOMPARE(a->eventTypes.size(), 0); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // Send a left press. This goes to c. pressEvent.setButton(Qt::LeftButton); @@ -4609,7 +4609,7 @@ void tst_QGraphicsScene::focusItemChangedSignal() QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qvariant_cast(arguments.at(1)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast(arguments.at(1)), nullptr); QCOMPARE(qvariant_cast(arguments.at(2)), Qt::OtherFocusReason); QVERIFY(topLevelItem2->hasFocus()); @@ -4617,7 +4617,7 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qvariant_cast(arguments.at(0)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast(arguments.at(0)), nullptr); QCOMPARE(qvariant_cast(arguments.at(1)), (QGraphicsItem *)topLevelItem2); QCOMPARE(qvariant_cast(arguments.at(2)), Qt::OtherFocusReason); @@ -4626,7 +4626,7 @@ void tst_QGraphicsScene::focusItemChangedSignal() arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qvariant_cast(arguments.at(1)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast(arguments.at(1)), nullptr); QCOMPARE(qvariant_cast(arguments.at(2)), Qt::MenuBarFocusReason); for (int i = 0; i < 3; ++i) { diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 2e76ea3bb3..c8bdcbde09 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -489,7 +489,7 @@ void tst_QGraphicsView::scene() QCOMPARE(view.scene(), &scene); } - QCOMPARE(view.scene(), (QGraphicsScene *)0); + QCOMPARE(view.scene(), nullptr); } void tst_QGraphicsView::setScene() @@ -529,9 +529,9 @@ void tst_QGraphicsView::deleteScene() QGraphicsView view3(scene); view3.show(); delete scene; - QCOMPARE(view1.scene(), (QGraphicsScene *)0); - QCOMPARE(view2.scene(), (QGraphicsScene *)0); - QCOMPARE(view3.scene(), (QGraphicsScene *)0); + QCOMPARE(view1.scene(), nullptr); + QCOMPARE(view2.scene(), nullptr); + QCOMPARE(view3.scene(), nullptr); } void tst_QGraphicsView::sceneRect() diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index 9e390e45a6..1be17b552e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -287,14 +287,14 @@ void tst_QGraphicsWidget::qgraphicswidget() QVERIFY(!widget.isWindow()); QCOMPARE(widget.boundingRect(), QRectF(0, 0, 0, 0)); - QCOMPARE(widget.focusWidget(), (QGraphicsWidget*)0); + QCOMPARE(widget.focusWidget(), nullptr); QCOMPARE(widget.focusPolicy(), Qt::NoFocus); QCOMPARE(widget.font(), QFont()); QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size())); - QCOMPARE(widget.layout(), (QGraphicsLayout*)0); + QCOMPARE(widget.layout(), nullptr); QCOMPARE(widget.layoutDirection(), Qt::LeftToRight); QCOMPARE(widget.palette(), QPalette()); - QCOMPARE(widget.parentWidget(), (QGraphicsWidget*)0); + QCOMPARE(widget.parentWidget(), nullptr); QCOMPARE(widget.rect(), QRectF(QPointF(), widget.size())); QCOMPARE(widget.size(), QSizeF(0, 0)); QVERIFY(widget.style() != (QStyle*)0); @@ -415,7 +415,7 @@ void tst_QGraphicsWidget::focusWidget_data() void tst_QGraphicsWidget::focusWidget() { SubQGraphicsWidget *parent = new SubQGraphicsWidget; - QCOMPARE(parent->focusWidget(), (QGraphicsWidget *)0); + QCOMPARE(parent->focusWidget(), nullptr); QGraphicsScene scene; QEvent windowActivate(QEvent::WindowActivate); qApp->sendEvent(&scene, &windowActivate); @@ -1131,7 +1131,7 @@ void tst_QGraphicsWidget::layout() { SubQGraphicsWidget widget; widget.setContentsMargins(10, 5, 50, 100); - QCOMPARE(widget.layout(), (QGraphicsLayout *)0); + QCOMPARE(widget.layout(), nullptr); QFETCH(int, childCount); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout; @@ -1292,9 +1292,9 @@ void tst_QGraphicsWidget::parentWidget() SubQGraphicsWidget widgetChild(&standAlongWidget); SubQGraphicsWidget itemChild(&standAlongItem); - QCOMPARE(standAlongWidget.parentWidget(), (QGraphicsWidget*)0); + QCOMPARE(standAlongWidget.parentWidget(), nullptr); QCOMPARE(widgetChild.parentWidget(), static_cast(&standAlongWidget)); - QCOMPARE(itemChild.parentWidget(), (QGraphicsWidget*)0); + QCOMPARE(itemChild.parentWidget(), nullptr); for (int i = 0; i < childrenCount; ++i) { SubQGraphicsWidget *item = new SubQGraphicsWidget(&standAlongWidget); @@ -1497,7 +1497,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent() w[2]->setFocus(); QVERIFY2(compareFocusChain(&view, w + 2, w + 3, &errorMessage), errorMessage.constData()); w[2]->setParentItem(p); - QCOMPARE(scene.focusItem(), static_cast(0)); + QCOMPARE(scene.focusItem(), nullptr); scene.addItem(p); p->setFocus(); @@ -2117,7 +2117,7 @@ void tst_QGraphicsWidget::explicitMouseGrabber() QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)widget); QCOMPARE(widgetGrabEventSpy.count(), 1); widget->ungrabMouse(); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QCOMPARE(widgetUngrabEventSpy.count(), 1); // Grab while grabbing @@ -2165,7 +2165,7 @@ void tst_QGraphicsWidget::explicitMouseGrabber() QCOMPARE(widgetGrabEventSpy.count(), 4); QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)widget); widget->ungrabMouse(); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // Out of order ungrab widget->grabMouse(); @@ -2210,7 +2210,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber() event.setScenePos(QPointF(50, 50)); qApp->sendEvent(&scene, &event); } - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QCOMPARE(widgetGrabEventSpy.count(), 1); QCOMPARE(widgetUngrabEventSpy.count(), 1); @@ -2238,7 +2238,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber() QCOMPARE(widgetUngrabEventSpy.count(), 1); widget->ungrabMouse(); QCOMPARE(widgetUngrabEventSpy.count(), 2); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // Implicit mouse grabber tries to explicitly grab the mouse { @@ -2263,7 +2263,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber() QCOMPARE(widgetGrabEventSpy.count(), 3); QCOMPARE(widgetUngrabEventSpy.count(), 2); widget->ungrabMouse(); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QCOMPARE(widgetGrabEventSpy.count(), 3); QCOMPARE(widgetUngrabEventSpy.count(), 3); @@ -2293,7 +2293,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber() scene.removeItem(widget); QCOMPARE(widgetUngrabEventSpy.count(), 4); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); } class GrabOnPressItem : public QGraphicsRectItem @@ -2367,7 +2367,7 @@ void tst_QGraphicsWidget::doubleClickAfterExplicitMouseGrab() event.setScenePos(QPointF(50, 50)); qApp->sendEvent(&scene, &event); } - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QCOMPARE(item->nrelease, 1); QCOMPARE(item->nungrab, 1); { @@ -2389,7 +2389,7 @@ void tst_QGraphicsWidget::doubleClickAfterExplicitMouseGrab() event.setScenePos(QPointF(50, 50)); qApp->sendEvent(&scene, &event); } - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); QCOMPARE(item->nrelease, 2); QCOMPARE(item->nungrab, 2); } @@ -2411,7 +2411,7 @@ void tst_QGraphicsWidget::popupMouseGrabber() // Hiding it loses the grab again. widget->hide(); QCOMPARE(widgetUngrabEventSpy.count(), 1); - QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(scene.mouseGrabberItem(), nullptr); // Showing it grabs the mouse again widget->show(); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 5567641dde..bd6733e2d0 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -558,7 +558,7 @@ void tst_QAbstractItemView::noModel() view.setModel(0); // Due to the model is removed, this will generate a valueChanged signal on both scrollbars. (value to 0) QApplication::processEvents(); - QCOMPARE(view.model(), (QAbstractItemModel*)0); + QCOMPARE(view.model(), nullptr); } void tst_QAbstractItemView::dragSelect() diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index e6c4ab44f8..62acf49f4a 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -770,15 +770,15 @@ void tst_QColumnView::gripMoved() void tst_QColumnView::preview() { QColumnView view; - QCOMPARE(view.previewWidget(), (QWidget*)0); + QCOMPARE(view.previewWidget(), nullptr); TreeModel model; view.setModel(&model); - QCOMPARE(view.previewWidget(), (QWidget*)0); + QCOMPARE(view.previewWidget(), nullptr); QModelIndex home = model.index(0, 0); QVERIFY(home.isValid()); QVERIFY(model.hasChildren(home)); view.setCurrentIndex(home); - QCOMPARE(view.previewWidget(), (QWidget*)0); + QCOMPARE(view.previewWidget(), nullptr); QModelIndex file; QVERIFY(model.rowCount(home) > 0); diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index ea88020a56..5ab0a226b7 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -79,7 +79,7 @@ void tst_QDataWidgetMapper::setModel() { QDataWidgetMapper mapper; - QCOMPARE(mapper.model(), (QAbstractItemModel *)0); + QCOMPARE(mapper.model(), nullptr); { // let the model go out of scope firstma QStandardItemModel model; @@ -87,7 +87,7 @@ void tst_QDataWidgetMapper::setModel() QCOMPARE(mapper.model(), static_cast(&model)); } - QCOMPARE(mapper.model(), (QAbstractItemModel *)0); + QCOMPARE(mapper.model(), nullptr); { // let the mapper go out of scope first QStandardItemModel model2; @@ -263,7 +263,7 @@ void tst_QDataWidgetMapper::addMapping() QCOMPARE(edit2.text(), QString("item 0 2")); } // let the edit go out of scope - QCOMPARE(mapper.mappedWidgetAt(2), (QWidget *)0); + QCOMPARE(mapper.mappedWidgetAt(2), nullptr); mapper.toLast(); } @@ -400,7 +400,7 @@ void tst_QDataWidgetMapper::mappedWidgetAt() QLineEdit lineEdit1; QLineEdit lineEdit2; - QCOMPARE(mapper.mappedWidgetAt(432312), (QWidget*)0); + QCOMPARE(mapper.mappedWidgetAt(432312), nullptr); mapper.addMapping(&lineEdit1, 1); mapper.addMapping(&lineEdit2, 2); @@ -410,7 +410,7 @@ void tst_QDataWidgetMapper::mappedWidgetAt() mapper.addMapping(&lineEdit2, 4242); - QCOMPARE(mapper.mappedWidgetAt(2), (QWidget*)0); + QCOMPARE(mapper.mappedWidgetAt(2), nullptr); QCOMPARE(mapper.mappedWidgetAt(4242), static_cast(&lineEdit2)); } diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index f8ab64e4d6..eb93e4c167 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -193,7 +193,7 @@ void tst_QListWidget::init() void tst_QListWidget::checkDefaultValues() { - QCOMPARE(testWidget->currentItem(), (QListWidgetItem *)0); + QCOMPARE(testWidget->currentItem(), nullptr); QCOMPARE(testWidget->currentRow(), -1); QCOMPARE(testWidget->count(), 0); } @@ -413,7 +413,7 @@ void tst_QListWidget::currentItem() if (currentIndex.isValid()) QCOMPARE(testWidget->currentItem(), testWidget->item(currentIndex.row())); else - QCOMPARE(testWidget->currentItem(), (QListWidgetItem*)0); + QCOMPARE(testWidget->currentItem(), nullptr); } void tst_QListWidget::currentRow() @@ -631,7 +631,7 @@ void tst_QListWidget::item() QListWidgetItem *item = testWidget->item(row); if (outOfBounds) { - QCOMPARE(item, static_cast(0)); + QCOMPARE(item, nullptr); QCOMPARE(testWidget->count(), 3); } else { QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row)); @@ -664,7 +664,7 @@ void tst_QListWidget::takeItem() QListWidgetItem *item = testWidget->takeItem(row); if (outOfBounds) { - QCOMPARE(item, static_cast(0)); + QCOMPARE(item, nullptr); QCOMPARE(testWidget->count(), 3); } else { QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row)); @@ -1445,11 +1445,11 @@ void tst_QListWidget::itemWidget() QListWidgetItem *item = new QListWidgetItem(&list); - QCOMPARE(list.itemWidget(item), static_cast(0)); + QCOMPARE(list.itemWidget(item), nullptr); list.setItemWidget(item, &widget); QCOMPARE(list.itemWidget(item), &widget); list.removeItemWidget(item); - QCOMPARE(list.itemWidget(item), static_cast(0)); + QCOMPARE(list.itemWidget(item), nullptr); } #ifndef Q_OS_MAC diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index a86ffbc30d..4d4a95b3f5 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -809,13 +809,13 @@ void tst_QTableWidget::itemOwnership() headerItem = new QObjectTableItem(); testWidget->setVerticalHeaderItem(0, headerItem); delete headerItem; - QCOMPARE(testWidget->verticalHeaderItem(0), (QTableWidgetItem *)0); + QCOMPARE(testWidget->verticalHeaderItem(0), nullptr); //delete horizontal headeritem from outside headerItem = new QObjectTableItem(); testWidget->setHorizontalHeaderItem(0, headerItem); delete headerItem; - QCOMPARE(testWidget->horizontalHeaderItem(0), (QTableWidgetItem *)0); + QCOMPARE(testWidget->horizontalHeaderItem(0), nullptr); //setItem item = new QObjectTableItem(); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index c7b7ffaf95..80ef0879cc 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -1107,10 +1107,10 @@ void tst_QTreeView::setModel() { QTreeView view; view.show(); - QCOMPARE(view.model(), (QAbstractItemModel*)0); - QCOMPARE(view.selectionModel(), (QItemSelectionModel*)0); - QCOMPARE(view.header()->model(), (QAbstractItemModel*)0); - QCOMPARE(view.header()->selectionModel(), (QItemSelectionModel*)0); + QCOMPARE(view.model(), nullptr); + QCOMPARE(view.selectionModel(), nullptr); + QCOMPARE(view.header()->model(), nullptr); + QCOMPARE(view.header()->selectionModel(), nullptr); for (int x = 0; x < 2; ++x) { QtTestModel *model = new QtTestModel(10, 8); @@ -1131,9 +1131,9 @@ void tst_QTreeView::setModel() QTRY_COMPARE(modelDestroyedSpy.count(), 0); view.setModel(0); - QCOMPARE(view.model(), (QAbstractItemModel*)0); + QCOMPARE(view.model(), nullptr); // ### shouldn't selectionModel also be 0 now? -// QCOMPARE(view.selectionModel(), (QItemSelectionModel*)0); +// QCOMPARE(view.selectionModel(), nullptr); delete model; } } @@ -1283,7 +1283,7 @@ void tst_QTreeView::noDelegate() QTreeView view; view.setModel(&model); view.setItemDelegate(0); - QCOMPARE(view.itemDelegate(), (QAbstractItemDelegate *)0); + QCOMPARE(view.itemDelegate(), nullptr); } void tst_QTreeView::noModel() diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index f1e8c7c814..fcffaa0eb9 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -194,7 +194,7 @@ void tst_QTreeWidget::getSetCheck() QCOMPARE(obj1.headerItem(), var2); obj1.setHeaderItem((QTreeWidgetItem *)0); -// QCOMPARE(obj1.headerItem(), (QTreeWidgetItem *)0); +// QCOMPARE(obj1.headerItem(), nullptr); // QTreeWidgetItem * QTreeWidget::currentItem() // void QTreeWidget::setCurrentItem(QTreeWidgetItem *) @@ -203,7 +203,7 @@ void tst_QTreeWidget::getSetCheck() QCOMPARE(obj1.currentItem(), var3); obj1.setCurrentItem((QTreeWidgetItem *)0); - QCOMPARE(obj1.currentItem(), (QTreeWidgetItem *)0); + QCOMPARE(obj1.currentItem(), nullptr); } typedef QList IntList; @@ -285,9 +285,9 @@ void tst_QTreeWidget::addTopLevelItem() tree.addTopLevelItem(ti); QCOMPARE(tree.topLevelItemCount(), i+1); QCOMPARE(tree.topLevelItem(i), ti); - QCOMPARE(tree.topLevelItem(-1), static_cast(0)); + QCOMPARE(tree.topLevelItem(-1), nullptr); QCOMPARE(tree.indexOfTopLevelItem(ti), i); - QCOMPARE(ti->parent(), static_cast(0)); + QCOMPARE(ti->parent(), nullptr); tree.addTopLevelItem(ti); QCOMPARE(tree.topLevelItemCount(), i+1); tops.append(ti); @@ -419,7 +419,7 @@ void tst_QTreeWidget::currentItem() // can't set the headerItem to be the current item tree.setCurrentItem(tree.headerItem()); - QCOMPARE(tree.currentItem(), static_cast(0)); + QCOMPARE(tree.currentItem(), nullptr); } void tst_QTreeWidget::editItem_data() @@ -520,7 +520,7 @@ void tst_QTreeWidget::takeItem() int count = testWidget->topLevelItemCount(); QTreeWidgetItem *item = testWidget->takeTopLevelItem(index); if (outOfBounds) { - QCOMPARE(item, (QTreeWidgetItem *)0); + QCOMPARE(item, nullptr); QCOMPARE(count, testWidget->topLevelItemCount()); } else { QCOMPARE(item->text(0), QStringLiteral("top") + QString::number(index)); @@ -531,7 +531,7 @@ void tst_QTreeWidget::takeItem() int count = testWidget->topLevelItem(0)->childCount(); QTreeWidgetItem *item = testWidget->topLevelItem(0)->takeChild(index); if (outOfBounds) { - QCOMPARE(item, (QTreeWidgetItem *)0); + QCOMPARE(item, nullptr); QCOMPARE(count, testWidget->topLevelItem(0)->childCount()); } else { QCOMPARE(item->text(0), QStringLiteral("child") + QString::number(index)); @@ -1664,8 +1664,8 @@ void tst_QTreeWidget::addChild() QCOMPARE(taken, children); QCOMPARE(item->childCount(), 0); for (int i = 0; i < taken.count(); ++i) { - QCOMPARE(taken.at(i)->parent(), static_cast(0)); - QCOMPARE(taken.at(i)->treeWidget(), static_cast(0)); + QCOMPARE(taken.at(i)->parent(), nullptr); + QCOMPARE(taken.at(i)->treeWidget(), nullptr); item->addChild(taken.at(i)); // re-add } diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp index f08e57c84b..c2c02f3766 100644 --- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp +++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp @@ -1160,7 +1160,7 @@ void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIte delete item; it+=iterator_advance_after_removal; if (iterator_new_value.isNull()) { - QCOMPARE((*it), (QTreeWidgetItem*)0); + QCOMPARE((*it), nullptr); } else { QCOMPARE((*it)->text(0), iterator_new_value); } @@ -1202,7 +1202,7 @@ void tst_QTreeWidgetItemIterator::initializeIterator() QTreeWidget tw; QTreeWidgetItemIterator it(&tw); - QCOMPARE((*it), static_cast(0)); + QCOMPARE((*it), nullptr); } void tst_QTreeWidgetItemIterator::sortingEnabled() diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index 47fc002196..829d0ea098 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -297,7 +297,7 @@ void tst_QLayout::warnIfWrongParent() QHBoxLayout lay; lay.setParent(&root); QTest::ignoreMessage(QtWarningMsg, "QLayout::parentWidget: A layout can only have another layout as a parent."); - QCOMPARE(lay.parentWidget(), static_cast(0)); + QCOMPARE(lay.parentWidget(), nullptr); } void tst_QLayout::controlTypes() diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp index badeca69bb..835b6ca799 100644 --- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp @@ -122,7 +122,7 @@ void tst_QStackedLayout::testCase() // Nothing in layout QCOMPARE(testLayout->currentIndex(), -1); - QCOMPARE(testLayout->currentWidget(), static_cast(0)); + QCOMPARE(testLayout->currentWidget(), nullptr); QCOMPARE(testLayout->count(), 0); // One widget added to layout @@ -163,7 +163,7 @@ void tst_QStackedLayout::testCase() QCOMPARE(spy.at(0).at(0).toInt(), -1); spy.clear(); QCOMPARE(testLayout->currentIndex(), -1); - QCOMPARE(testLayout->currentWidget(), static_cast(0)); + QCOMPARE(testLayout->currentWidget(), nullptr); QCOMPARE(testLayout->count(), 0); // Another widget inserted at current index. @@ -217,7 +217,7 @@ void tst_QStackedLayout::testCase() QVERIFY(w3->isVisible()); testLayout->removeWidget(w3); QCOMPARE(testLayout->currentIndex(), -1); - QCOMPARE(testLayout->currentWidget(), static_cast(0)); + QCOMPARE(testLayout->currentWidget(), nullptr); } void tst_QStackedLayout::deleteCurrent() diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 0c25a01ba0..731a8c5d91 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -2188,8 +2188,8 @@ void tst_QWidget::showMinimizedKeepsFocus() QTRY_COMPARE(qApp->focusWidget(), child); delete child; - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(qApp->focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); } //testing reparenting the focus widget @@ -2207,8 +2207,8 @@ void tst_QWidget::showMinimizedKeepsFocus() child->setParent(0); QScopedPointer childGuard(child); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(qApp->focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); } //testing setEnabled(false) @@ -2225,8 +2225,8 @@ void tst_QWidget::showMinimizedKeepsFocus() QTRY_COMPARE(qApp->focusWidget(), child); child->setEnabled(false); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(qApp->focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); } //testing clearFocus @@ -2245,14 +2245,14 @@ void tst_QWidget::showMinimizedKeepsFocus() QTRY_COMPARE(qApp->focusWidget(), child); child->clearFocus(); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(qApp->focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); window.showMinimized(); QTest::qWait(30); QTRY_VERIFY(window.isMinimized()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QTRY_COMPARE(qApp->focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QTRY_COMPARE(QApplication::focusWidget(), nullptr); window.showNormal(); qApp->setActiveWindow(&window); @@ -5260,12 +5260,12 @@ void tst_QWidget::setFocus() child1.setFocus(); QVERIFY(!child1.hasFocus()); QCOMPARE(window.focusWidget(), &child1); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(QApplication::focusWidget(), nullptr); child2.setFocus(); QVERIFY(!child2.hasFocus()); QCOMPARE(window.focusWidget(), &child2); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(QApplication::focusWidget(), nullptr); } { @@ -5294,12 +5294,12 @@ void tst_QWidget::setFocus() child1.setFocus(); QVERIFY(!child1.hasFocus()); QCOMPARE(window.focusWidget(), &child1); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(QApplication::focusWidget(), nullptr); child2.setFocus(); QVERIFY(!child2.hasFocus()); QCOMPARE(window.focusWidget(), &child2); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(QApplication::focusWidget(), nullptr); } { @@ -5355,8 +5355,8 @@ void tst_QWidget::setFocus() child1.setFocus(); QVERIFY(!child1.hasFocus()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); child1.show(); QApplication::processEvents(); @@ -5396,33 +5396,33 @@ void tst_QWidget::setFocus() child1.setFocus(); QVERIFY(!child1.hasFocus()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); child1.hide(); QVERIFY(!child1.hasFocus()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); child1.show(); QVERIFY(!child1.hasFocus()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); child2.setFocus(); QVERIFY(!child2.hasFocus()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); child2.hide(); QVERIFY(!child2.hasFocus()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); child2.show(); QVERIFY(!child2.hasFocus()); - QCOMPARE(window.focusWidget(), static_cast(0)); - QCOMPARE(QApplication::focusWidget(), static_cast(0)); + QCOMPARE(window.focusWidget(), nullptr); + QCOMPARE(QApplication::focusWidget(), nullptr); } } diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index 406b21ccf6..5e3868ea8f 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp @@ -161,7 +161,7 @@ void tst_QWindowContainer::testOwnership() delete container; - QCOMPARE(window.data(), (QWindow *) 0); + QCOMPARE(window.data(), nullptr); } diff --git a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp index 883336b28f..1d46886d1c 100644 --- a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp +++ b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp @@ -121,7 +121,7 @@ void tst_QStyleOption::qstyleoptioncast() // Cast a null pointer castOption = qstyleoption_cast((QStyleOption*)0); - QCOMPARE(castOption,(QStyleOption*)0); + QCOMPARE(castOption, nullptr); // Deallocate delete testOption; diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp index 99d067b7d7..f5cf9d7750 100644 --- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp @@ -215,7 +215,7 @@ void tst_QUndoGroup::setActive() QUndoGroup group; QUndoStack stack1(&group), stack2(&group); - QCOMPARE(group.activeStack(), (QUndoStack*)0); + QCOMPARE(group.activeStack(), nullptr); QCOMPARE(stack1.isActive(), false); QCOMPARE(stack2.isActive(), false); @@ -238,13 +238,13 @@ void tst_QUndoGroup::setActive() QCOMPARE(stack3.isActive(), false); group.removeStack(&stack2); - QCOMPARE(group.activeStack(), (QUndoStack*)0); + QCOMPARE(group.activeStack(), nullptr); QCOMPARE(stack1.isActive(), false); QCOMPARE(stack2.isActive(), true); QCOMPARE(stack3.isActive(), false); group.removeStack(&stack2); - QCOMPARE(group.activeStack(), (QUndoStack*)0); + QCOMPARE(group.activeStack(), nullptr); QCOMPARE(stack1.isActive(), false); QCOMPARE(stack2.isActive(), true); QCOMPARE(stack3.isActive(), false); @@ -280,7 +280,7 @@ void tst_QUndoGroup::deleteStack() QUndoStack *stack1 = new QUndoStack(&group); QCOMPARE(group.stacks(), QList() << stack1); - QCOMPARE(group.activeStack(), (QUndoStack*)0); + QCOMPARE(group.activeStack(), nullptr); stack1->setActive(); QCOMPARE(group.activeStack(), stack1); @@ -299,17 +299,17 @@ void tst_QUndoGroup::deleteStack() delete stack1; QCOMPARE(group.stacks(), QList() << stack3); - QCOMPARE(group.activeStack(), (QUndoStack*)0); + QCOMPARE(group.activeStack(), nullptr); stack3->setActive(false); - QCOMPARE(group.activeStack(), (QUndoStack*)0); + QCOMPARE(group.activeStack(), nullptr); stack3->setActive(true); QCOMPARE(group.activeStack(), stack3); group.removeStack(stack3); QCOMPARE(group.stacks(), QList()); - QCOMPARE(group.activeStack(), (QUndoStack*)0); + QCOMPARE(group.activeStack(), nullptr); delete stack3; } diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index edaf033678..122d320d18 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -305,17 +305,17 @@ void tst_QComboBox::getSetCheck() obj1.setValidator(var9); QCOMPARE(obj1.validator(), (const QValidator *)var9); obj1.setValidator((QValidator *)0); - QCOMPARE(obj1.validator(), (const QValidator *)0); + QCOMPARE(obj1.validator(), nullptr); delete var9; // QAbstractItemDelegate * QComboBox::itemDelegate() // void QComboBox::setItemDelegate(QAbstractItemDelegate *) MyAbstractItemDelegate *var10 = new MyAbstractItemDelegate; obj1.setItemDelegate(var10); - QCOMPARE(obj1.itemDelegate(), (QAbstractItemDelegate *)var10); + QCOMPARE(obj1.itemDelegate(), nullptr); QTest::ignoreMessage(QtWarningMsg, "QComboBox::setItemDelegate: cannot set a 0 delegate"); obj1.setItemDelegate((QAbstractItemDelegate *)0); - QCOMPARE(obj1.itemDelegate(), (QAbstractItemDelegate *)var10); + QCOMPARE(obj1.itemDelegate(), nullptr); // delete var10; // No delete, since QComboBox takes ownership // QAbstractItemModel * QComboBox::model() diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index cb55bd32b0..1a1023208a 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -857,8 +857,8 @@ void tst_QDockWidget::task165177_deleteFocusWidget() qApp->processEvents(); dw->setFloating(true); delete ledit; - QCOMPARE(mw.focusWidget(), (QWidget *)0); - QCOMPARE(dw->focusWidget(), (QWidget *)0); + QCOMPARE(mw.focusWidget(), nullptr); + QCOMPARE(dw->focusWidget(), nullptr); } void tst_QDockWidget::task169808_setFloating() diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index cb7643d1ac..3218b8ac68 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -388,7 +388,7 @@ void tst_QMenu::keyboardNavigation() #ifndef Q_OS_MAC QEXPECT_FAIL("shortcut0", "QTBUG-22449: QMenu doesn't remove highlight if a menu item is activated by a shortcut", Abort); #endif - QCOMPARE(menus[expected_menu]->activeAction(), (QAction *)0); + QCOMPARE(menus[expected_menu]->activeAction(), nullptr); } else { QCOMPARE(menus[expected_menu]->activeAction(), builtins[expected_action]); } @@ -396,7 +396,7 @@ void tst_QMenu::keyboardNavigation() if (expected_highlighted) QCOMPARE(menus[expected_menu]->activeAction(), highlighted); else - QCOMPARE(highlighted, (QAction *)0); + QCOMPARE(highlighted, nullptr); } #ifdef Q_OS_MAC -- cgit v1.2.3 From 0cdae477e32a312a02eb6be4d82ed1731f617170 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 23 Jul 2016 22:25:26 +0300 Subject: QListViewItem: add constexpr This class is just a record with a bit of functionality on it. To prevent pessimizing it compared to a C struct with the same contents, mark all operations constexpr and remove the point- less copy ctor (the generated one is just fine). Converge on passing QRect, QSize, QPoint by value. Was mixed cref and value passing before. Saves ~1KiB each in text and data size on an UBSan build, somewhat less, of course, on a normal one. Change-Id: Ibae16792d822ff183a0c542380501978f2108d93 Reviewed-by: Thiago Macieira --- src/widgets/itemviews/qlistview_p.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 07cbd4036c..47effcdfd9 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -69,28 +69,28 @@ class QListViewItem friend class QListModeViewBase; friend class QIconModeViewBase; public: - inline QListViewItem() + Q_DECL_CONSTEXPR QListViewItem() : x(-1), y(-1), w(0), h(0), indexHint(-1), visited(0xffff) {} - inline QListViewItem(QRect r, int i) + Q_DECL_CONSTEXPR QListViewItem(QRect r, int i) : x(r.x()), y(r.y()), w(qMin(r.width(), SHRT_MAX)), h(qMin(r.height(), SHRT_MAX)), indexHint(i), visited(0xffff) {} - inline bool operator==(const QListViewItem &other) const { + Q_DECL_CONSTEXPR bool operator==(const QListViewItem &other) const { return (x == other.x && y == other.y && w == other.w && h == other.h && indexHint == other.indexHint); } - inline bool operator!=(const QListViewItem &other) const + Q_DECL_CONSTEXPR bool operator!=(const QListViewItem &other) const { return !(*this == other); } - inline bool isValid() const + Q_DECL_CONSTEXPR bool isValid() const { return rect().isValid() && (indexHint > -1); } - inline void invalidate() + Q_DECL_RELAXED_CONSTEXPR void invalidate() { x = -1; y = -1; w = 0; h = 0; } - inline void resize(const QSize &size) + Q_DECL_RELAXED_CONSTEXPR void resize(QSize size) { w = qMin(size.width(), SHRT_MAX); h = qMin(size.height(), SHRT_MAX); } - inline void move(const QPoint &position) + Q_DECL_RELAXED_CONSTEXPR void move(QPoint position) { x = position.x(); y = position.y(); } - inline int width() const { return w; } - inline int height() const { return h; } + Q_DECL_CONSTEXPR int width() const { return w; } + Q_DECL_CONSTEXPR int height() const { return h; } private: - inline QRect rect() const + Q_DECL_CONSTEXPR QRect rect() const { return QRect(x, y, w, h); } int x, y; short w, h; -- cgit v1.2.3 From 8f2088db171a6941feb1903a2912a8b7fdf3a9ec Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 24 Nov 2016 15:44:57 +0100 Subject: winrt: Check for removed timers after sending events After all the check makes sense here. If a timer was removed as a result of sendEvent and it was not at the end of the list the list is not shrunk but the timer info's id is just set to INVALID_TIMER_ID. Additionally the timer's object should be fetched before we unlock the locker as timerIdToObject is changed in removeTimer and we might access a nullptr if the timer has been removed. Reverts c83ba01f7bc542368973f3f24dfb59c6052dd78a Task-number: QTBUG-56756 Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e Reviewed-by: Maurice Kalinowski --- src/corelib/kernel/qeventdispatcher_winrt.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_winrt.cpp b/src/corelib/kernel/qeventdispatcher_winrt.cpp index ff397fc750..33753ed507 100644 --- a/src/corelib/kernel/qeventdispatcher_winrt.cpp +++ b/src/corelib/kernel/qeventdispatcher_winrt.cpp @@ -166,7 +166,7 @@ private: timerIdToHandle.insert(id, handle); timerIdToCancelHandle.insert(id, cancelHandle); } - timerIdToObject.insert(id, obj); + const quint64 targetTime = qt_msectime() + interval; const WinRTTimerInfo info(id, interval, type, obj, targetTime); QMutexLocker locker(&timerInfoLock); @@ -587,15 +587,18 @@ bool QEventDispatcherWinRT::event(QEvent *e) break; info.inEvent = true; + QObject *timerObj = d->timerIdToObject.value(id); locker.unlock(); QTimerEvent te(id); - QCoreApplication::sendEvent(d->timerIdToObject.value(id), &te); + QCoreApplication::sendEvent(timerObj, &te); locker.relock(); - // The timer might have been removed in the meanwhile - if (id >= d->timerInfos.size()) + // The timer might have been removed in the meanwhile. If the timer was + // the last one in the list, id is bigger than the list's size. + // Otherwise, the id will just be set to INVALID_TIMER_ID. + if (id >= d->timerInfos.size() || info.timerId == INVALID_TIMER_ID) break; if (info.interval == 0 && info.inEvent) { -- cgit v1.2.3 From b82650891ee594628fb1bd150408a23a37217e72 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 13:22:25 +0100 Subject: Use poll related features properly And get rid of related DEFINES in the pri file Change-Id: I54cf25b7cb447af22b410213759044e8018939a6 Reviewed-by: Oswald Buddenhagen --- src/corelib/kernel/kernel.pri | 3 --- src/corelib/kernel/qcore_unix.cpp | 14 +++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 7799113d30..61d0f2bdf1 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -151,9 +151,6 @@ unix|integrity { kernel/qtimerinfo_unix_p.h qtConfig(poll_select): SOURCES += kernel/qpoll.cpp - qtConfig(poll_poll): DEFINES += QT_HAVE_POLL - qtConfig(poll_ppoll): DEFINES += QT_HAVE_POLL QT_HAVE_PPOLL - qtConfig(poll_pollts): DEFINES += QT_HAVE_POLL QT_HAVE_POLLTS qtConfig(glib) { SOURCES += \ diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 2042964427..686143f8c7 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -38,6 +38,7 @@ ** ****************************************************************************/ +#include #include "qcore_unix_p.h" #include "qelapsedtimer.h" @@ -49,9 +50,8 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLLTS) -# define ppoll pollts -# define QT_HAVE_PPOLL +#if QT_CONFIG(poll_pollts) +# define ppoll pollts #endif static inline bool time_update(struct timespec *tv, const struct timespec &start, @@ -64,7 +64,7 @@ static inline bool time_update(struct timespec *tv, const struct timespec &start return tv->tv_sec >= 0; } -#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLL) +#if QT_CONFIG(poll_poll) static inline int timespecToMillisecs(const struct timespec *ts) { return (ts == NULL) ? -1 : @@ -77,9 +77,9 @@ int qt_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts); static inline int qt_ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts) { -#if defined(QT_HAVE_PPOLL) - return ::ppoll(fds, nfds, timeout_ts, Q_NULLPTR); -#elif defined(QT_HAVE_POLL) +#if QT_CONFIG(poll_ppoll) || QT_CONFIG(poll_pollts) + return ::ppoll(fds, nfds, timeout_ts, nullptr); +#elif QT_CONFIG(poll_poll) return ::poll(fds, nfds, timespecToMillisecs(timeout_ts)); #else return qt_poll(fds, nfds, timeout_ts); -- cgit v1.2.3 From 5ac33fff0f38ee8a363f8e2dc5a8306c05af0db6 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 29 Nov 2016 13:58:56 +0100 Subject: QCommandLineOption: Remove excess close parenthesis from a warning Change-Id: Iff197a2a00b686ad2d29a1e156389bec4639f3c0 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/corelib/tools/qcommandlineoption.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h index 4dcae03ad9..276be042de 100644 --- a/src/corelib/tools/qcommandlineoption.h +++ b/src/corelib/tools/qcommandlineoption.h @@ -94,7 +94,7 @@ public: void setFlags(Flags aflags); #if QT_DEPRECATED_SINCE(5, 8) - QT_DEPRECATED_X("Use setFlags() with HiddenFromHelp)") + QT_DEPRECATED_X("Use setFlags() with HiddenFromHelp") void setHidden(bool hidden); QT_DEPRECATED_X("Use flags() and HiddenFromHelp") bool isHidden() const; -- cgit v1.2.3 From 0a2759e8f8c0fa295eff1a5bb5aefd074851d5d6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 30 Nov 2016 11:16:38 +0100 Subject: tst_QTextStream: Use casts instead of Q_UINT64_C for negative values cast to quint64 Q_UINT64_C appends a literal, which causes warnings: tst_qtextstream.cpp(2026): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2030): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2031): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2032): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2289): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2309): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2329): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2355): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2381): warning C4146: unary minus operator applied to unsigned type, result still unsigned tst_qtextstream.cpp(2411): warning C4146: unary minus operator applied to unsigned type, result still unsigned Change-Id: I69ac87c224b75aff059477362d8a317c7e766ec2 Reviewed-by: Maurice Kalinowski --- .../auto/corelib/io/qtextstream/tst_qtextstream.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 9533989b9d..7f29e2a7d7 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -2023,13 +2023,13 @@ void tst_QTextStream::generateNaturalNumbersData(bool for_QString) QTest::newRow("2147483648") << QByteArray("2147483648") << Q_UINT64_C(2147483648); QTest::newRow("-2147483646") << QByteArray("-2147483646") << qulonglong(-2147483646); QTest::newRow("-2147483647") << QByteArray("-2147483647") << qulonglong(-2147483647); - QTest::newRow("-2147483648") << QByteArray("-2147483648") << Q_UINT64_C(-2147483648); + QTest::newRow("-2147483648") << QByteArray("-2147483648") << quint64(-2147483648LL); QTest::newRow("4294967296") << QByteArray("4294967296") << Q_UINT64_C(4294967296); QTest::newRow("4294967297") << QByteArray("4294967297") << Q_UINT64_C(4294967297); QTest::newRow("4294967298") << QByteArray("4294967298") << Q_UINT64_C(4294967298); - QTest::newRow("-4294967296") << QByteArray("-4294967296") << Q_UINT64_C(-4294967296); - QTest::newRow("-4294967297") << QByteArray("-4294967297") << Q_UINT64_C(-4294967297); - QTest::newRow("-4294967298") << QByteArray("-4294967298") << Q_UINT64_C(-4294967298); + QTest::newRow("-4294967296") << QByteArray("-4294967296") << quint64(-4294967296); + QTest::newRow("-4294967297") << QByteArray("-4294967297") << quint64(-4294967297); + QTest::newRow("-4294967298") << QByteArray("-4294967298") << quint64(-4294967298); QTest::newRow("9223372036854775807") << QByteArray("9223372036854775807") << Q_UINT64_C(9223372036854775807); QTest::newRow("9223372036854775808") << QByteArray("9223372036854775808") << Q_UINT64_C(9223372036854775808); QTest::newRow("9223372036854775809") << QByteArray("9223372036854775809") << Q_UINT64_C(9223372036854775809); @@ -2286,7 +2286,7 @@ void tst_QTextStream::signedShort_write_operator_ToDevice_data() QTest::newRow("0") << Q_UINT64_C(0) << QByteArray("0") << QByteArray("0"); QTest::newRow("1") << Q_UINT64_C(1) << QByteArray("1") << QByteArray("1"); - QTest::newRow("-1") << Q_UINT64_C(-1) << QByteArray("-1") << QByteArray("-1"); + QTest::newRow("-1") << quint64(-1) << QByteArray("-1") << QByteArray("-1"); QTest::newRow("32767") << Q_UINT64_C(32767) << QByteArray("32767") << QByteArray("32,767"); QTest::newRow("32768") << Q_UINT64_C(32768) << QByteArray("-32768") << QByteArray("-32,768"); QTest::newRow("32769") << Q_UINT64_C(32769) << QByteArray("-32767") << QByteArray("-32,767"); @@ -2306,7 +2306,7 @@ void tst_QTextStream::unsignedShort_write_operator_ToDevice_data() QTest::newRow("0") << Q_UINT64_C(0) << QByteArray("0") << QByteArray("0"); QTest::newRow("1") << Q_UINT64_C(1) << QByteArray("1") << QByteArray("1"); - QTest::newRow("-1") << Q_UINT64_C(-1) << QByteArray("65535") << QByteArray("65,535"); + QTest::newRow("-1") << quint64(-1) << QByteArray("65535") << QByteArray("65,535"); QTest::newRow("32767") << Q_UINT64_C(32767) << QByteArray("32767") << QByteArray("32,767"); QTest::newRow("32768") << Q_UINT64_C(32768) << QByteArray("32768") << QByteArray("32,768"); QTest::newRow("32769") << Q_UINT64_C(32769) << QByteArray("32769") << QByteArray("32,769"); @@ -2326,7 +2326,7 @@ void tst_QTextStream::signedInt_write_operator_ToDevice_data() QTest::newRow("0") << Q_UINT64_C(0) << QByteArray("0") << QByteArray("0"); QTest::newRow("1") << Q_UINT64_C(1) << QByteArray("1") << QByteArray("1"); - QTest::newRow("-1") << Q_UINT64_C(-1) << QByteArray("-1") << QByteArray("-1"); + QTest::newRow("-1") << quint64(-1) << QByteArray("-1") << QByteArray("-1"); QTest::newRow("32767") << Q_UINT64_C(32767) << QByteArray("32767") << QByteArray("32,767"); QTest::newRow("32768") << Q_UINT64_C(32768) << QByteArray("32768") << QByteArray("32,768"); QTest::newRow("32769") << Q_UINT64_C(32769) << QByteArray("32769") << QByteArray("32,769"); @@ -2352,7 +2352,7 @@ void tst_QTextStream::unsignedInt_write_operator_ToDevice_data() QTest::newRow("0") << Q_UINT64_C(0) << QByteArray("0") << QByteArray("0"); QTest::newRow("1") << Q_UINT64_C(1) << QByteArray("1") << QByteArray("1"); - QTest::newRow("-1") << Q_UINT64_C(-1) << QByteArray("4294967295") << QByteArray("4,294,967,295"); + QTest::newRow("-1") << quint64(-1) << QByteArray("4294967295") << QByteArray("4,294,967,295"); QTest::newRow("32767") << Q_UINT64_C(32767) << QByteArray("32767") << QByteArray("32,767"); QTest::newRow("32768") << Q_UINT64_C(32768) << QByteArray("32768") << QByteArray("32,768"); QTest::newRow("32769") << Q_UINT64_C(32769) << QByteArray("32769") << QByteArray("32,769"); @@ -2378,7 +2378,7 @@ void tst_QTextStream::qlonglong_write_operator_ToDevice_data() QTest::newRow("0") << Q_UINT64_C(0) << QByteArray("0") << QByteArray("0"); QTest::newRow("1") << Q_UINT64_C(1) << QByteArray("1") << QByteArray("1"); - QTest::newRow("-1") << Q_UINT64_C(-1) << QByteArray("-1") << QByteArray("-1"); + QTest::newRow("-1") << quint64(-1) << QByteArray("-1") << QByteArray("-1"); QTest::newRow("32767") << Q_UINT64_C(32767) << QByteArray("32767") << QByteArray("32,767"); QTest::newRow("32768") << Q_UINT64_C(32768) << QByteArray("32768") << QByteArray("32,768"); QTest::newRow("32769") << Q_UINT64_C(32769) << QByteArray("32769") << QByteArray("32,769"); @@ -2408,7 +2408,7 @@ void tst_QTextStream::qulonglong_write_operator_ToDevice_data() QTest::newRow("0") << Q_UINT64_C(0) << QByteArray("0") << QByteArray("0"); QTest::newRow("1") << Q_UINT64_C(1) << QByteArray("1") << QByteArray("1"); - QTest::newRow("-1") << Q_UINT64_C(-1) << QByteArray("18446744073709551615") << QByteArray("18,446,744,073,709,551,615"); + QTest::newRow("-1") << quint64(-1) << QByteArray("18446744073709551615") << QByteArray("18,446,744,073,709,551,615"); QTest::newRow("32767") << Q_UINT64_C(32767) << QByteArray("32767") << QByteArray("32,767"); QTest::newRow("32768") << Q_UINT64_C(32768) << QByteArray("32768") << QByteArray("32,768"); QTest::newRow("32769") << Q_UINT64_C(32769) << QByteArray("32769") << QByteArray("32,769"); -- cgit v1.2.3 From aac3a4c032d3aa96c8c25402bbc72c78348401d0 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 30 Nov 2016 12:47:22 +0300 Subject: winrt: Replace Q_DECL_OVERRIDE by override We can use 'override' keyword directly since Qt 5.7. Change-Id: I31127478a0a96798a4e018d9996842204e307552 Reviewed-by: Maurice Kalinowski --- .../fontdatabases/winrt/qwinrtfontdatabase_p.h | 14 ++++----- src/plugins/platforms/winrt/qwinrtbackingstore.h | 2 +- src/plugins/platforms/winrt/qwinrtclipboard.h | 6 ++-- src/plugins/platforms/winrt/qwinrtdrag.h | 10 +++---- src/plugins/platforms/winrt/qwinrteglcontext.h | 12 ++++---- .../platforms/winrt/qwinrtfiledialoghelper.h | 20 ++++++------- src/plugins/platforms/winrt/qwinrtfileengine.h | 34 +++++++++++----------- src/plugins/platforms/winrt/qwinrtintegration.h | 34 +++++++++++----------- src/plugins/platforms/winrt/qwinrtscreen.h | 20 ++++++------- src/plugins/platforms/winrt/qwinrttheme.h | 2 +- src/plugins/platforms/winrt/qwinrtwindow.h | 6 ++-- 11 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h index 9559bac0a8..e0971c4e95 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h @@ -72,14 +72,14 @@ class QWinRTFontDatabase : public QBasicFontDatabase public: QString fontDir() const; ~QWinRTFontDatabase(); - QFont defaultFont() const Q_DECL_OVERRIDE; - bool fontsAlwaysScalable() const Q_DECL_OVERRIDE; - void populateFontDatabase() Q_DECL_OVERRIDE; - void populateFamily(const QString &familyName) Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; + QFont defaultFont() const override; + bool fontsAlwaysScalable() const override; + void populateFontDatabase() override; + void populateFamily(const QString &familyName) override; + QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override; QStringList fallbacksForFamily(const QString &family, QFont::Style style, - QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE; - void releaseHandle(void *handle) Q_DECL_OVERRIDE; + QFont::StyleHint styleHint, QChar::Script script) const override; + void releaseHandle(void *handle) override; private: QHash m_fonts; QHash m_fontFamilies; diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.h b/src/plugins/platforms/winrt/qwinrtbackingstore.h index 41b27debcc..bfd0e34b9b 100644 --- a/src/plugins/platforms/winrt/qwinrtbackingstore.h +++ b/src/plugins/platforms/winrt/qwinrtbackingstore.h @@ -63,7 +63,7 @@ public: void endPaint(); void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); void resize(const QSize &size, const QRegion &staticContents); - QImage toImage() const Q_DECL_OVERRIDE; + QImage toImage() const override; private: bool initialize(); diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.h b/src/plugins/platforms/winrt/qwinrtclipboard.h index 3e6ee109fd..2e3e2b834d 100644 --- a/src/plugins/platforms/winrt/qwinrtclipboard.h +++ b/src/plugins/platforms/winrt/qwinrtclipboard.h @@ -64,9 +64,9 @@ class QWinRTClipboard: public QPlatformClipboard public: QWinRTClipboard(); - QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; - void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; - bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override; + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override; + bool supportsMode(QClipboard::Mode mode) const override; HRESULT onContentChanged(IInspectable *, IInspectable *); private: diff --git a/src/plugins/platforms/winrt/qwinrtdrag.h b/src/plugins/platforms/winrt/qwinrtdrag.h index 97079d831b..dad3e9892d 100644 --- a/src/plugins/platforms/winrt/qwinrtdrag.h +++ b/src/plugins/platforms/winrt/qwinrtdrag.h @@ -75,9 +75,9 @@ public: QWinRTInternalMimeData(); virtual ~QWinRTInternalMimeData(); - bool hasFormat_sys(const QString &mimetype) const Q_DECL_OVERRIDE; - QStringList formats_sys() const Q_DECL_OVERRIDE; - QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const Q_DECL_OVERRIDE; + bool hasFormat_sys(const QString &mimetype) const override; + QStringList formats_sys() const override; + QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const override; void setDataView(const Microsoft::WRL::ComPtr &d); private: @@ -91,8 +91,8 @@ public: virtual ~QWinRTDrag(); static QWinRTDrag *instance(); - QMimeData *platformDropData(void) Q_DECL_OVERRIDE; - Qt::DropAction drag(QDrag *) Q_DECL_OVERRIDE; + QMimeData *platformDropData(void) override; + Qt::DropAction drag(QDrag *) override; void setDropTarget(QWindow *target); diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.h b/src/plugins/platforms/winrt/qwinrteglcontext.h index 12b6238cb1..5c75aa90d0 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.h +++ b/src/plugins/platforms/winrt/qwinrteglcontext.h @@ -52,14 +52,14 @@ public: explicit QWinRTEGLContext(QOpenGLContext *context); ~QWinRTEGLContext(); - void initialize() Q_DECL_OVERRIDE; + void initialize() override; - bool makeCurrent(QPlatformSurface *windowSurface) Q_DECL_OVERRIDE; - void doneCurrent() Q_DECL_OVERRIDE; - void swapBuffers(QPlatformSurface *windowSurface) Q_DECL_OVERRIDE; + bool makeCurrent(QPlatformSurface *windowSurface) override; + void doneCurrent() override; + void swapBuffers(QPlatformSurface *windowSurface) override; - QSurfaceFormat format() const Q_DECL_OVERRIDE; - QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE; + QSurfaceFormat format() const override; + QFunctionPointer getProcAddress(const char *procName) override; static EGLDisplay display(); private: diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h index f88bed76ae..1ff2249bcb 100644 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h +++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h @@ -72,20 +72,20 @@ public: explicit QWinRTFileDialogHelper(); ~QWinRTFileDialogHelper(); - void exec() Q_DECL_OVERRIDE; - bool show(Qt::WindowFlags, Qt::WindowModality, QWindow *) Q_DECL_OVERRIDE; - void hide() Q_DECL_OVERRIDE; + void exec() override; + bool show(Qt::WindowFlags, Qt::WindowModality, QWindow *) override; + void hide() override; #ifdef Q_OS_WINPHONE - bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE; + bool eventFilter(QObject *o, QEvent *e) override; #endif - bool defaultNameFilterDisables() const Q_DECL_OVERRIDE { return false; } - void setDirectory(const QUrl &directory) Q_DECL_OVERRIDE; - QUrl directory() const Q_DECL_OVERRIDE; + bool defaultNameFilterDisables() const override { return false; } + void setDirectory(const QUrl &directory) override; + QUrl directory() const override; void selectFile(const QUrl &saveFileName); - QList selectedFiles() const Q_DECL_OVERRIDE; - void setFilter() Q_DECL_OVERRIDE { } - void selectNameFilter(const QString &selectedNameFilter) Q_DECL_OVERRIDE; + QList selectedFiles() const override; + void setFilter() override { } + void selectNameFilter(const QString &selectedNameFilter) override; QString selectedNameFilter() const; #ifndef Q_OS_WINPHONE diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.h b/src/plugins/platforms/winrt/qwinrtfileengine.h index 70d5aea30d..73ff54b0c8 100644 --- a/src/plugins/platforms/winrt/qwinrtfileengine.h +++ b/src/plugins/platforms/winrt/qwinrtfileengine.h @@ -58,7 +58,7 @@ class QWinRTFileEngineHandler : public QAbstractFileEngineHandler public: QWinRTFileEngineHandler(); ~QWinRTFileEngineHandler(); - QAbstractFileEngine *create(const QString &fileName) const Q_DECL_OVERRIDE; + QAbstractFileEngine *create(const QString &fileName) const override; static void registerFile(const QString &fileName, ABI::Windows::Storage::IStorageItem *file); static ABI::Windows::Storage::IStorageItem *registeredFile(const QString &fileName); @@ -75,23 +75,23 @@ public: QWinRTFileEngine(const QString &fileName, ABI::Windows::Storage::IStorageItem *file); ~QWinRTFileEngine(); - bool open(QIODevice::OpenMode openMode) Q_DECL_OVERRIDE; - bool close() Q_DECL_OVERRIDE; - bool flush() Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; - qint64 pos() const Q_DECL_OVERRIDE; - bool seek(qint64 pos) Q_DECL_OVERRIDE; - bool remove() Q_DECL_OVERRIDE; - bool copy(const QString &newName) Q_DECL_OVERRIDE; - bool rename(const QString &newName) Q_DECL_OVERRIDE; - bool renameOverwrite(const QString &newName) Q_DECL_OVERRIDE; - FileFlags fileFlags(FileFlags type=FileInfoAll) const Q_DECL_OVERRIDE; - bool setPermissions(uint perms) Q_DECL_OVERRIDE; - QString fileName(FileName type=DefaultName) const Q_DECL_OVERRIDE; - QDateTime fileTime(FileTime type) const Q_DECL_OVERRIDE; + bool open(QIODevice::OpenMode openMode) override; + bool close() override; + bool flush() override; + qint64 size() const override; + qint64 pos() const override; + bool seek(qint64 pos) override; + bool remove() override; + bool copy(const QString &newName) override; + bool rename(const QString &newName) override; + bool renameOverwrite(const QString &newName) override; + FileFlags fileFlags(FileFlags type=FileInfoAll) const override; + bool setPermissions(uint perms) override; + QString fileName(FileName type=DefaultName) const override; + QDateTime fileTime(FileTime type) const override; - qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE; + qint64 read(char *data, qint64 maxlen) override; + qint64 write(const char *data, qint64 len) override; private: QScopedPointer d_ptr; diff --git a/src/plugins/platforms/winrt/qwinrtintegration.h b/src/plugins/platforms/winrt/qwinrtintegration.h index 7b4d5531fc..e22532a266 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.h +++ b/src/plugins/platforms/winrt/qwinrtintegration.h @@ -85,28 +85,28 @@ public: bool succeeded() const; - bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; - QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; - - QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; - QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; - void initialize() Q_DECL_OVERRIDE; - QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; - QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; - QPlatformServices *services() const Q_DECL_OVERRIDE; - QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; + bool hasCapability(QPlatformIntegration::Capability cap) const override; + QVariant styleHint(StyleHint hint) const override; + + QPlatformWindow *createPlatformWindow(QWindow *window) const override; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; + QAbstractEventDispatcher *createEventDispatcher() const override; + void initialize() override; + QPlatformFontDatabase *fontDatabase() const override; + QPlatformInputContext *inputContext() const override; + QPlatformServices *services() const override; + QPlatformClipboard *clipboard() const override; #ifndef QT_NO_DRAGANDDROP - QPlatformDrag *drag() const Q_DECL_OVERRIDE; + QPlatformDrag *drag() const override; #endif - Qt::KeyboardModifiers queryKeyboardModifiers() const Q_DECL_OVERRIDE; + Qt::KeyboardModifiers queryKeyboardModifiers() const override; - QStringList themeNames() const Q_DECL_OVERRIDE; - QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; + QStringList themeNames() const override; + QPlatformTheme *createPlatformTheme(const QString &name) const override; - QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; + QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; private: #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) HRESULT onBackButtonPressed(IInspectable *, ABI::Windows::Phone::UI::Input::IBackPressedEventArgs *args); diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h index e489e208d5..2f1112472c 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.h +++ b/src/plugins/platforms/winrt/qwinrtscreen.h @@ -89,19 +89,19 @@ public: explicit QWinRTScreen(); ~QWinRTScreen(); - QRect geometry() const Q_DECL_OVERRIDE; - QRect availableGeometry() const Q_DECL_OVERRIDE; - int depth() const Q_DECL_OVERRIDE; - QImage::Format format() const Q_DECL_OVERRIDE; - QSizeF physicalSize() const Q_DECL_OVERRIDE; - QDpi logicalDpi() const Q_DECL_OVERRIDE; - qreal pixelDensity() const Q_DECL_OVERRIDE; + QRect geometry() const override; + QRect availableGeometry() const override; + int depth() const override; + QImage::Format format() const override; + QSizeF physicalSize() const override; + QDpi logicalDpi() const override; + qreal pixelDensity() const override; qreal scaleFactor() const; - QPlatformCursor *cursor() const Q_DECL_OVERRIDE; + QPlatformCursor *cursor() const override; Qt::KeyboardModifiers keyboardModifiers() const; - Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE; - Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE; + Qt::ScreenOrientation nativeOrientation() const override; + Qt::ScreenOrientation orientation() const override; QWindow *topWindow() const; QWindow *windowAt(const QPoint &pos); diff --git a/src/plugins/platforms/winrt/qwinrttheme.h b/src/plugins/platforms/winrt/qwinrttheme.h index bd244f9fdb..6ad22a4188 100644 --- a/src/plugins/platforms/winrt/qwinrttheme.h +++ b/src/plugins/platforms/winrt/qwinrttheme.h @@ -57,7 +57,7 @@ public: bool usePlatformNativeDialog(DialogType type) const; QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; - const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; + const QPalette *palette(Palette type = SystemPalette) const override; static QVariant styleHint(QPlatformIntegration::StyleHint hint); QVariant themeHint(ThemeHint hint) const override; diff --git a/src/plugins/platforms/winrt/qwinrtwindow.h b/src/plugins/platforms/winrt/qwinrtwindow.h index 48e092d455..95caf66c3d 100644 --- a/src/plugins/platforms/winrt/qwinrtwindow.h +++ b/src/plugins/platforms/winrt/qwinrtwindow.h @@ -65,10 +65,10 @@ public: void raise(); void lower(); - WId winId() const Q_DECL_OVERRIDE; + WId winId() const override; - qreal devicePixelRatio() const Q_DECL_OVERRIDE; - void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + qreal devicePixelRatio() const override; + void setWindowState(Qt::WindowState state) override; EGLSurface eglSurface() const; void createEglSurface(EGLDisplay display, EGLConfig config); -- cgit v1.2.3 From 1a0e690d50ff3b99a8a2e785c711b43f71de8459 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Sun, 27 Nov 2016 11:22:44 +0300 Subject: winrt: Add missing override Change-Id: I2f257756bc606f8eb5cad2afe67b90810a2e394c Reviewed-by: Maurice Kalinowski --- .../fontdatabases/winrt/qwinrtfontdatabase.cpp | 22 +++++++++++----------- .../fontdatabases/winrt/qwinrtfontdatabase_p.h | 2 +- src/plugins/platforms/winrt/main.cpp | 2 +- src/plugins/platforms/winrt/qwinrtbackingstore.h | 10 +++++----- src/plugins/platforms/winrt/qwinrtcursor.h | 4 ++-- .../platforms/winrt/qwinrteventdispatcher.h | 4 ++-- .../platforms/winrt/qwinrtfiledialoghelper.h | 4 ++-- src/plugins/platforms/winrt/qwinrtinputcontext.h | 8 ++++---- .../platforms/winrt/qwinrtmessagedialoghelper.h | 6 +++--- src/plugins/platforms/winrt/qwinrtservices.h | 4 ++-- src/plugins/platforms/winrt/qwinrttheme.h | 4 ++-- src/plugins/platforms/winrt/qwinrtwindow.h | 16 ++++++++-------- 12 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp index f214184c36..9f4b182ece 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp @@ -129,6 +129,17 @@ static QFontDatabase::WritingSystem writingSystemFromUnicodeRange(const DWRITE_U return QFontDatabase::Other; } +QWinRTFontDatabase::~QWinRTFontDatabase() +{ + qCDebug(lcQpaFonts) << __FUNCTION__; + + foreach (IDWriteFontFile *fontFile, m_fonts.keys()) + fontFile->Release(); + + foreach (IDWriteFontFamily *fontFamily, m_fontFamilies) + fontFamily->Release(); +} + QString QWinRTFontDatabase::fontDir() const { qCDebug(lcQpaFonts) << __FUNCTION__; @@ -146,17 +157,6 @@ QString QWinRTFontDatabase::fontDir() const return fontDirectory; } -QWinRTFontDatabase::~QWinRTFontDatabase() -{ - qCDebug(lcQpaFonts) << __FUNCTION__; - - foreach (IDWriteFontFile *fontFile, m_fonts.keys()) - fontFile->Release(); - - foreach (IDWriteFontFamily *fontFamily, m_fontFamilies) - fontFamily->Release(); -} - QFont QWinRTFontDatabase::defaultFont() const { return QFont(QStringLiteral("Segoe UI")); diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h index e0971c4e95..3b803d7613 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h @@ -70,8 +70,8 @@ struct FontDescription class QWinRTFontDatabase : public QBasicFontDatabase { public: - QString fontDir() const; ~QWinRTFontDatabase(); + QString fontDir() const override; QFont defaultFont() const override; bool fontsAlwaysScalable() const override; void populateFontDatabase() override; diff --git a/src/plugins/platforms/winrt/main.cpp b/src/plugins/platforms/winrt/main.cpp index a0b31e0e25..5d0d9e94eb 100644 --- a/src/plugins/platforms/winrt/main.cpp +++ b/src/plugins/platforms/winrt/main.cpp @@ -50,7 +50,7 @@ class QWinRTIntegrationPlugin : public QPlatformIntegrationPlugin public: QStringList keys() const; - QPlatformIntegration *create(const QString&, const QStringList&); + QPlatformIntegration *create(const QString&, const QStringList&) override; }; QStringList QWinRTIntegrationPlugin::keys() const diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.h b/src/plugins/platforms/winrt/qwinrtbackingstore.h index bfd0e34b9b..cd05faa63e 100644 --- a/src/plugins/platforms/winrt/qwinrtbackingstore.h +++ b/src/plugins/platforms/winrt/qwinrtbackingstore.h @@ -58,11 +58,11 @@ class QWinRTBackingStore : public QPlatformBackingStore public: explicit QWinRTBackingStore(QWindow *window); ~QWinRTBackingStore(); - QPaintDevice *paintDevice(); - void beginPaint(const QRegion &); - void endPaint(); - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size, const QRegion &staticContents); + QPaintDevice *paintDevice() override; + void beginPaint(const QRegion &) override; + void endPaint() override; + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; + void resize(const QSize &size, const QRegion &staticContents) override; QImage toImage() const override; private: diff --git a/src/plugins/platforms/winrt/qwinrtcursor.h b/src/plugins/platforms/winrt/qwinrtcursor.h index baf902c7af..7f579f1531 100644 --- a/src/plugins/platforms/winrt/qwinrtcursor.h +++ b/src/plugins/platforms/winrt/qwinrtcursor.h @@ -51,9 +51,9 @@ public: explicit QWinRTCursor(); ~QWinRTCursor(); #ifndef QT_NO_CURSOR - void changeCursor(QCursor * windowCursor, QWindow *window); + void changeCursor(QCursor * windowCursor, QWindow *window) override; #endif - QPoint pos() const; + QPoint pos() const override; private: QScopedPointer d_ptr; diff --git a/src/plugins/platforms/winrt/qwinrteventdispatcher.h b/src/plugins/platforms/winrt/qwinrteventdispatcher.h index c04e9fca12..4c5c19c6b0 100644 --- a/src/plugins/platforms/winrt/qwinrteventdispatcher.h +++ b/src/plugins/platforms/winrt/qwinrteventdispatcher.h @@ -51,8 +51,8 @@ public: explicit QWinRTEventDispatcher(QObject *parent = 0); protected: - bool hasPendingEvents(); - bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags); + bool hasPendingEvents() override; + bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags) override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h index 1ff2249bcb..413dee7459 100644 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h +++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h @@ -82,11 +82,11 @@ public: bool defaultNameFilterDisables() const override { return false; } void setDirectory(const QUrl &directory) override; QUrl directory() const override; - void selectFile(const QUrl &saveFileName); + void selectFile(const QUrl &saveFileName) override; QList selectedFiles() const override; void setFilter() override { } void selectNameFilter(const QString &selectedNameFilter) override; - QString selectedNameFilter() const; + QString selectedNameFilter() const override; #ifndef Q_OS_WINPHONE HRESULT onSingleFilePicked(ABI::Windows::Foundation::IAsyncOperation *, diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.h b/src/plugins/platforms/winrt/qwinrtinputcontext.h index 9d5c4187e2..13a0088ddc 100644 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.h +++ b/src/plugins/platforms/winrt/qwinrtinputcontext.h @@ -70,13 +70,13 @@ class QWinRTInputContext : public QPlatformInputContext public: explicit QWinRTInputContext(QWinRTScreen *); - QRectF keyboardRect() const; + QRectF keyboardRect() const override; - bool isInputPanelVisible() const; + bool isInputPanelVisible() const override; #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) - void showInputPanel(); - void hideInputPanel(); + void showInputPanel() override; + void hideInputPanel() override; #endif private slots: diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h index 439e8f592f..14b6d4b715 100644 --- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h +++ b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h @@ -69,11 +69,11 @@ public: explicit QWinRTMessageDialogHelper(const QWinRTTheme *theme); ~QWinRTMessageDialogHelper(); - void exec(); + void exec() override; bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, - QWindow *parent); - void hide(); + QWindow *parent) override; + void hide() override; private: HRESULT onCompleted(ABI::Windows::Foundation::IAsyncOperation *asyncInfo, diff --git a/src/plugins/platforms/winrt/qwinrtservices.h b/src/plugins/platforms/winrt/qwinrtservices.h index 1adc6c381c..80b9a6c92a 100644 --- a/src/plugins/platforms/winrt/qwinrtservices.h +++ b/src/plugins/platforms/winrt/qwinrtservices.h @@ -52,8 +52,8 @@ public: explicit QWinRTServices(); ~QWinRTServices(); - bool openUrl(const QUrl &url); - bool openDocument(const QUrl &url); + bool openUrl(const QUrl &url) override; + bool openDocument(const QUrl &url) override; private: QScopedPointer d_ptr; diff --git a/src/plugins/platforms/winrt/qwinrttheme.h b/src/plugins/platforms/winrt/qwinrttheme.h index 6ad22a4188..cc5fc851e7 100644 --- a/src/plugins/platforms/winrt/qwinrttheme.h +++ b/src/plugins/platforms/winrt/qwinrttheme.h @@ -54,8 +54,8 @@ class QWinRTTheme : public QPlatformTheme public: QWinRTTheme(); - bool usePlatformNativeDialog(DialogType type) const; - QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; + bool usePlatformNativeDialog(DialogType type) const override; + QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override; const QPalette *palette(Palette type = SystemPalette) const override; diff --git a/src/plugins/platforms/winrt/qwinrtwindow.h b/src/plugins/platforms/winrt/qwinrtwindow.h index 95caf66c3d..968edcfa85 100644 --- a/src/plugins/platforms/winrt/qwinrtwindow.h +++ b/src/plugins/platforms/winrt/qwinrtwindow.h @@ -56,14 +56,14 @@ public: QWinRTWindow(QWindow *window); ~QWinRTWindow(); - QSurfaceFormat format() const; - bool isActive() const; - bool isExposed() const; - void setGeometry(const QRect &rect); - void setVisible(bool visible); - void setWindowTitle(const QString &title); - void raise(); - void lower(); + QSurfaceFormat format() const override; + bool isActive() const override; + bool isExposed() const override; + void setGeometry(const QRect &rect) override; + void setVisible(bool visible) override; + void setWindowTitle(const QString &title) override; + void raise() override; + void lower() override; WId winId() const override; -- cgit v1.2.3 From 5b65698248325576faa03a2bb78d17349a33a194 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 29 Nov 2016 16:43:42 +0100 Subject: Close popups when blocked by modal dialog Don't block the event that Qt depends on to close popups. Task-number: QTBUG-57292 Change-Id: Ida1f928b81868f68a7b1e19cd0b83485d2a7232e Reviewed-by: Lars Knoll --- src/gui/kernel/qguiapplication.cpp | 2 +- src/gui/kernel/qguiapplication_p.h | 1 + src/widgets/kernel/qapplication_p.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 7beab72ab0..c189c5b068 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1914,7 +1914,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers, e->source); ev.setTimestamp(e->timestamp); - if (window->d_func()->blockedByModalWindow) { + if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) { // a modal window is blocking this window, don't allow mouse events through return; } diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index e1a35e048c..0d62490c75 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -199,6 +199,7 @@ public: static void hideModalWindow(QWindow *window); static void updateBlockedStatus(QWindow *window); virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const; + virtual bool popupActive() { return false; } static Qt::MouseButtons buttons; static ulong mousePressTime; diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 3bef773187..73c75bbc14 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -164,6 +164,7 @@ public: #endif static bool inPopupMode(); + bool popupActive() Q_DECL_OVERRIDE { return inPopupMode(); } void closePopup(QWidget *popup); void openPopup(QWidget *popup); static void setFocusWidget(QWidget *focus, Qt::FocusReason reason); -- cgit v1.2.3 From 4a7f3c327b851f0b118b7d84ce00b53f3f1df712 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Thu, 24 Nov 2016 20:35:19 +0100 Subject: Doc: Fix QVariant::Type QVariant::QString does not exist Task-number: QTBUG-56586 Change-Id: Ic5fe81fc4fc3553f9b755e067ed73c4d1bba9add Reviewed-by: Venugopal Shivashankar Reviewed-by: Timur Pocheptsov --- src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp b/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp index fdcbdc603c..a4513a55a9 100644 --- a/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp +++ b/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp @@ -69,7 +69,7 @@ myCustomObject->doSomething(); // trigger emission of the signal QList arguments = spy.takeFirst(); QVERIFY(arguments.at(0).type() == QVariant::Int); -QVERIFY(arguments.at(1).type() == QVariant::QString); +QVERIFY(arguments.at(1).type() == QVariant::String); QVERIFY(arguments.at(2).type() == QVariant::double); //! [1] -- cgit v1.2.3 From 1e4054ce2f4f7b488b5d4963f32d4025e20cf537 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Fri, 18 Nov 2016 14:05:34 +0100 Subject: Add -Wdouble-promotion to headersclean Fixes: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion] Task-number: QTBUG-57068 Change-Id: I897a341aca83873bc6abd256a82a3b9f09409833 Reviewed-by: Thiago Macieira --- mkspecs/features/qt_module_headers.prf | 11 +++++++++ src/gui/math3d/qmatrix4x4.h | 42 ++++++++++++++++++---------------- src/gui/math3d/qquaternion.h | 5 ++-- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index 790a4ee29e..a0be15c4a0 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -204,9 +204,20 @@ headersclean:!internal_module { !contains(QT_ARCH, arm):!contains(QT_ARCH, mips): \ hcleanFLAGS += -Wcast-align + greaterThan(QT_CLANG_MAJOR_VERSION, 3) { + hcleanFLAGS += -Wdouble-promotion + } greaterThan(QT_CLANG_MAJOR_VERSION, 2):greaterThan(QT_CLANG_MINOR_VERSION, 7) { + hcleanFLAGS += -Wdouble-promotion + } + !clang { # options accepted only by GCC + greaterThan(QT_GCC_MAJOR_VERSION, 4) { + hcleanFLAGS += -Wdouble-promotion + } greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 4) { + hcleanFLAGS += -Wdouble-promotion + } c++11 { # only enabled for actual c++11 builds due to # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52806 diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 19540308a1..e143884f9d 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -867,9 +867,9 @@ inline QPointF operator*(const QPointF& point, const QMatrix4x4& matrix) yin * matrix.m[3][1] + matrix.m[3][3]; if (w == 1.0f) { - return QPointF(float(x), float(y)); + return QPointF(qreal(x), qreal(y)); } else { - return QPointF(float(x / w), float(y / w)); + return QPointF(qreal(x / w), qreal(y / w)); } } @@ -907,33 +907,35 @@ inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point) inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point) { - float xin, yin; - float x, y, w; + qreal xin, yin; + qreal x, y, w; xin = point.x(); yin = point.y(); if (matrix.flagBits == QMatrix4x4::Identity) { return point; } else if (matrix.flagBits < QMatrix4x4::Rotation2D) { // Translation | Scale - return QPointF(xin * matrix.m[0][0] + matrix.m[3][0], - yin * matrix.m[1][1] + matrix.m[3][1]); + return QPointF(xin * qreal(matrix.m[0][0]) + qreal(matrix.m[3][0]), + yin * qreal(matrix.m[1][1]) + qreal(matrix.m[3][1])); } else if (matrix.flagBits < QMatrix4x4::Perspective) { - return QPointF(xin * matrix.m[0][0] + yin * matrix.m[1][0] + matrix.m[3][0], - xin * matrix.m[0][1] + yin * matrix.m[1][1] + matrix.m[3][1]); + return QPointF(xin * qreal(matrix.m[0][0]) + yin * qreal(matrix.m[1][0]) + + qreal(matrix.m[3][0]), + xin * qreal(matrix.m[0][1]) + yin * qreal(matrix.m[1][1]) + + qreal(matrix.m[3][1])); } else { - x = xin * matrix.m[0][0] + - yin * matrix.m[1][0] + - matrix.m[3][0]; - y = xin * matrix.m[0][1] + - yin * matrix.m[1][1] + - matrix.m[3][1]; - w = xin * matrix.m[0][3] + - yin * matrix.m[1][3] + - matrix.m[3][3]; - if (w == 1.0f) { - return QPointF(float(x), float(y)); + x = xin * qreal(matrix.m[0][0]) + + yin * qreal(matrix.m[1][0]) + + qreal(matrix.m[3][0]); + y = xin * qreal(matrix.m[0][1]) + + yin * qreal(matrix.m[1][1]) + + qreal(matrix.m[3][1]); + w = xin * qreal(matrix.m[0][3]) + + yin * qreal(matrix.m[1][3]) + + qreal(matrix.m[3][3]); + if (w == 1.0) { + return QPointF(qreal(x), qreal(y)); } else { - return QPointF(float(x / w), float(y / w)); + return QPointF(qreal(x / w), qreal(y / w)); } } } diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 21b051e08e..808e0ee6d7 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -202,7 +202,8 @@ inline QQuaternion QQuaternion::inverted() const double(yp) * double(yp) + double(zp) * double(zp); if (!qFuzzyIsNull(len)) - return QQuaternion(wp / len, -xp / len, -yp / len, -zp / len); + return QQuaternion(double(wp) / len, double(-xp) / len, + double(-yp) / len, double(-zp) / len); return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f); } @@ -251,7 +252,7 @@ inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2) float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp); float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp); float xx = ww + yy + zz; - float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp)); + float qq = 0.5f * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp)); float w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp); float x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp); -- cgit v1.2.3 From e3ca4287d99a8b1a5769c19b97679cd95b4e83e4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 28 Nov 2016 14:26:40 +0100 Subject: qmake: fix execution of depend_command in directories with funny names it's wrong to use the escape function for makefiles, as the command goes directly to a popen() call. Task-number: QTBUG-57343 Change-Id: I34a8e4d8fb406303c593e7c1e24019e0f756e7f8 Reviewed-by: Jake Petroules --- qmake/generators/makefile.cpp | 2 +- qmake/generators/win32/msvc_objectmodel.cpp | 7 ++++++- qmake/generators/win32/msvc_vcproj.cpp | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4450e619b9..1ba2587bd0 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1839,7 +1839,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QString dep_cd_cmd; if (!tmp_dep_cmd.isEmpty()) { dep_cd_cmd = QLatin1String("cd ") - + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && "); } const ProStringList &vars = project->values(ProKey(*it + ".variables")); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index fb9c4f354d..2c57fcc2f5 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -29,10 +29,15 @@ #include "msvc_objectmodel.h" #include "msvc_vcproj.h" #include "msvc_vcxproj.h" + +#include + #include #include #include +using namespace QMakeInternal; + QT_BEGIN_NAMESPACE // XML Tags --------------------------------------------------------- @@ -2318,7 +2323,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) tmp_dep_cmd, inFile, out, MakefileGenerator::LocalShell); if(Project->canExecute(dep_cmd)) { dep_cmd.prepend(QLatin1String("cd ") - + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && ")); if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QString indeps; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 7b3d7fd160..018c70089d 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -29,16 +29,22 @@ #include "msvc_vcproj.h" #include "option.h" #include "xmloutput.h" + +#include + #include #include #include #include #include #include + #include //#define DEBUG_SOLUTION_GEN +using namespace QMakeInternal; + QT_BEGIN_NAMESPACE // Filter GUIDs (Do NOT change these!) ------------------------------ const char _GUIDSourceFiles[] = "{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"; @@ -1550,7 +1556,7 @@ void VcprojGenerator::initResourceFiles() dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(canExecute(dep_cmd)) { dep_cmd.prepend(QLatin1String("cd ") - + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && ")); if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QString indeps; -- cgit v1.2.3 From f88f405401cc5dcb98cce37f3237bf37b51f77af Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Tue, 15 Nov 2016 17:04:36 +0300 Subject: Add a test case for removing a submenu from the menubar If 5ca9631d3a0717afb066471ed5eb3b3ed9a9c08a is reverted, this test segfaults on Unity most of the times. Task-number: QTBUG-55966 Change-Id: Ice59842e0a1a7930e3cd10c4c7319ef033fe6a58 Reviewed-by: Shawn Rutledge --- tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 3a4c4545df..a5b33ed8e7 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -133,6 +133,7 @@ private slots: #ifdef Q_OS_MACOS void taskQTBUG56275_reinsertMenuInParentlessQMenuBar(); #endif + void taskQTBUG55966_subMenuRemoved(); void platformMenu(); @@ -1541,5 +1542,22 @@ void tst_QMenuBar::taskQTBUG56275_reinsertMenuInParentlessQMenuBar() } #endif // Q_OS_MACOS +void tst_QMenuBar::taskQTBUG55966_subMenuRemoved() +{ + QMainWindow window; + QMenuBar *menubar = window.menuBar(); + QMenu *parentMenu = menubar->addMenu("Parent menu"); + + QAction *action = parentMenu->addAction("Action in parent menu"); + QMenu *subMenu = new QMenu("Submenu"); + action->setMenu(subMenu); + delete subMenu; + + window.show(); + QApplication::setActiveWindow(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); + QTest::qWait(500); +} + QTEST_MAIN(tst_QMenuBar) #include "tst_qmenubar.moc" -- cgit v1.2.3 From ed6f1290262af7a5e64c732d91df52e5968e1067 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 25 Nov 2016 13:52:55 +0300 Subject: QtTest: Add missing override Change-Id: Ibb924f11b82577fb67aa7a1a30b81f4d8d7d36fc Reviewed-by: hjk --- src/testlib/qbenchmarkevent_p.h | 18 +++++++++--------- src/testlib/qbenchmarktimemeasurers_p.h | 32 ++++++++++++++++---------------- src/testlib/qbenchmarkvalgrind_p.h | 16 ++++++++-------- src/testlib/qplaintestlogger_p.h | 14 +++++++------- src/testlib/qteamcitylogger_p.h | 14 +++++++------- src/testlib/qtestcase.cpp | 2 +- src/testlib/qtestevent.h | 16 ++++++++-------- src/testlib/qtesteventloop.h | 2 +- src/testlib/qxmltestlogger_p.h | 14 +++++++------- src/testlib/qxunittestlogger_p.h | 14 +++++++------- 10 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/testlib/qbenchmarkevent_p.h b/src/testlib/qbenchmarkevent_p.h index 8231b57127..af42a17141 100644 --- a/src/testlib/qbenchmarkevent_p.h +++ b/src/testlib/qbenchmarkevent_p.h @@ -63,15 +63,15 @@ class QBenchmarkEvent : public QBenchmarkMeasurerBase, public QAbstractNativeEve public: QBenchmarkEvent(); ~QBenchmarkEvent(); - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int suggestion); - int adjustMedianCount(int suggestion); - bool repeatCount() { return 1; } - QTest::QBenchmarkMetric metricType(); - virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int suggestion) override; + int adjustMedianCount(int suggestion) override; + bool repeatCount() override { return 1; } + QTest::QBenchmarkMetric metricType() override; + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; qint64 eventCounter; }; diff --git a/src/testlib/qbenchmarktimemeasurers_p.h b/src/testlib/qbenchmarktimemeasurers_p.h index e5ffb1157d..f268669e2f 100644 --- a/src/testlib/qbenchmarktimemeasurers_p.h +++ b/src/testlib/qbenchmarktimemeasurers_p.h @@ -60,14 +60,14 @@ QT_BEGIN_NAMESPACE class QBenchmarkTimeMeasurer : public QBenchmarkMeasurerBase { public: - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int sugestion); - int adjustMedianCount(int suggestion); - bool needsWarmupIteration(); - QTest::QBenchmarkMetric metricType(); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int sugestion) override; + int adjustMedianCount(int suggestion) override; + bool needsWarmupIteration() override; + QTest::QBenchmarkMetric metricType() override; private: QElapsedTimer time; }; @@ -77,14 +77,14 @@ private: class QBenchmarkTickMeasurer : public QBenchmarkMeasurerBase { public: - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int); - int adjustMedianCount(int suggestion); - bool needsWarmupIteration(); - QTest::QBenchmarkMetric metricType(); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int) override; + int adjustMedianCount(int suggestion) override; + bool needsWarmupIteration() override; + QTest::QBenchmarkMetric metricType() override; private: CycleCounterTicks startTicks; }; diff --git a/src/testlib/qbenchmarkvalgrind_p.h b/src/testlib/qbenchmarkvalgrind_p.h index dd7e7381c1..69219b9a65 100644 --- a/src/testlib/qbenchmarkvalgrind_p.h +++ b/src/testlib/qbenchmarkvalgrind_p.h @@ -76,14 +76,14 @@ public: class QBenchmarkCallgrindMeasurer : public QBenchmarkMeasurerBase { public: - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int); - int adjustMedianCount(int); - bool needsWarmupIteration(); - QTest::QBenchmarkMetric metricType(); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int) override; + int adjustMedianCount(int) override; + bool needsWarmupIteration() override; + QTest::QBenchmarkMetric metricType() override; }; QT_END_NAMESPACE diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h index efa79e550d..93d3c7143a 100644 --- a/src/testlib/qplaintestlogger_p.h +++ b/src/testlib/qplaintestlogger_p.h @@ -61,18 +61,18 @@ public: QPlainTestLogger(const char *filename); ~QPlainTestLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; private: void printMessage(const char *type, const char *msg, const char *file = 0, int line = 0); diff --git a/src/testlib/qteamcitylogger_p.h b/src/testlib/qteamcitylogger_p.h index b8fad3ae34..219aeb5ceb 100644 --- a/src/testlib/qteamcitylogger_p.h +++ b/src/testlib/qteamcitylogger_p.h @@ -63,18 +63,18 @@ public: QTeamCityLogger(const char *filename); ~QTeamCityLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; private: QString currTestFuncName; diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 1c13f8edc2..f2a962408e 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -925,7 +925,7 @@ public: waitCondition.wakeAll(); } - void run() { + void run() override { QMutexLocker locker(&mutex); waitCondition.wakeAll(); while (1) { diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h index 63b7401e6f..159e3e01ff 100644 --- a/src/testlib/qtestevent.h +++ b/src/testlib/qtestevent.h @@ -79,10 +79,10 @@ public: inline QTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay) : _action(action), _delay(delay), _modifiers(modifiers), _ascii(ascii), _key(Qt::Key_unknown) {} - inline QTestEvent *clone() const { return new QTestKeyEvent(*this); } + inline QTestEvent *clone() const override { return new QTestKeyEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget *w) + inline void simulate(QWidget *w) override { if (_ascii == 0) QTest::keyEvent(_action, w, _key, _modifiers, _delay); @@ -104,10 +104,10 @@ class QTestKeyClicksEvent: public QTestEvent public: inline QTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay) : _keys(keys), _modifiers(modifiers), _delay(delay) {} - inline QTestEvent *clone() const { return new QTestKeyClicksEvent(*this); } + inline QTestEvent *clone() const override { return new QTestKeyClicksEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget *w) + inline void simulate(QWidget *w) override { QTest::keyClicks(w, _keys, _modifiers, _delay); } @@ -125,10 +125,10 @@ public: inline QTestMouseEvent(QTest::MouseAction action, Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QPoint position, int delay) : _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay) {} - inline QTestEvent *clone() const { return new QTestMouseEvent(*this); } + inline QTestEvent *clone() const override { return new QTestMouseEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget *w) + inline void simulate(QWidget *w) override { QTest::mouseEvent(_action, w, _button, _modifiers, _pos, _delay); } @@ -148,10 +148,10 @@ class QTestDelayEvent: public QTestEvent { public: inline QTestDelayEvent(int msecs): _delay(msecs) {} - inline QTestEvent *clone() const { return new QTestDelayEvent(*this); } + inline QTestEvent *clone() const override { return new QTestDelayEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); } + inline void simulate(QWidget * /*w*/) override { QTest::qWait(_delay); } #endif private: diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h index 032c95d692..bcf4a4be2d 100644 --- a/src/testlib/qtesteventloop.h +++ b/src/testlib/qtesteventloop.h @@ -80,7 +80,7 @@ public Q_SLOTS: inline void exitLoop(); protected: - inline void timerEvent(QTimerEvent *e); + inline void timerEvent(QTimerEvent *e) override; private: bool inLoop; diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h index c6461387b2..b85742f939 100644 --- a/src/testlib/qxmltestlogger_p.h +++ b/src/testlib/qxmltestlogger_p.h @@ -64,18 +64,18 @@ public: QXmlTestLogger(XmlMode mode, const char *filename); ~QXmlTestLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; static int xmlCdata(QTestCharBuffer *dest, char const* src); static int xmlQuote(QTestCharBuffer *dest, char const* src); diff --git a/src/testlib/qxunittestlogger_p.h b/src/testlib/qxunittestlogger_p.h index 50f26c317b..8fb01fbe61 100644 --- a/src/testlib/qxunittestlogger_p.h +++ b/src/testlib/qxunittestlogger_p.h @@ -64,19 +64,19 @@ class QXunitTestLogger : public QAbstractTestLogger QXunitTestLogger(const char *filename); ~QXunitTestLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addTag(QTestElement* element); void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; private: QTestElement *listOfTestcases; -- cgit v1.2.3 From 7183fc8f0d2d1e16c52fe78d029ee9fa13868b79 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Sat, 26 Nov 2016 12:40:58 +0300 Subject: Add missing override into Qt modules Change-Id: I014ac8c7b590c77b054fbb01f0ab5601c44ca88e Reviewed-by: hjk --- src/network/socket/qabstractsocket_p.h | 12 +++++----- src/network/socket/qlocalsocket_p.h | 4 ++-- src/network/socket/qnativesocketengine.cpp | 6 ++--- src/opengl/gl2paintengineex/qglgradientcache_p.h | 4 ++-- src/opengl/qglpixelbuffer_p.h | 10 ++++---- src/printsupport/dialogs/qabstractprintdialog.h | 2 +- src/printsupport/kernel/qpaintengine_alpha_p.h | 16 ++++++------- src/printsupport/kernel/qpaintengine_preview_p.h | 30 ++++++++++++------------ src/sql/models/qsqlrelationaldelegate.h | 4 ++-- 9 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index 1578d7bb35..8a96cb9d48 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -72,13 +72,13 @@ public: virtual ~QAbstractSocketPrivate(); // from QAbstractSocketEngineReceiver - inline void readNotification() { canReadNotification(); } - inline void writeNotification() { canWriteNotification(); } - inline void exceptionNotification() {} - inline void closeNotification() { canCloseNotification(); } - void connectionNotification(); + inline void readNotification() override { canReadNotification(); } + inline void writeNotification() override { canWriteNotification(); } + inline void exceptionNotification() override {} + inline void closeNotification() override { canCloseNotification(); } + void connectionNotification() override; #ifndef QT_NO_NETWORKPROXY - inline void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) { + inline void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) override { Q_Q(QAbstractSocket); q->proxyAuthenticationRequired(proxy, authenticator); } diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h index 560d74328e..9da37d2af3 100644 --- a/src/network/socket/qlocalsocket_p.h +++ b/src/network/socket/qlocalsocket_p.h @@ -99,12 +99,12 @@ public: QTcpSocket::setSocketError(error); } - inline qint64 readData(char *data, qint64 maxSize) + inline qint64 readData(char *data, qint64 maxSize) override { return QTcpSocket::readData(data, maxSize); } - inline qint64 writeData(const char *data, qint64 maxSize) + inline qint64 writeData(const char *data, qint64 maxSize) override { return QTcpSocket::writeData(data, maxSize); } diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 11d19682d8..928c7fc68f 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -1230,7 +1230,7 @@ public: { engine = parent; } protected: - bool event(QEvent *); + bool event(QEvent *) override; QNativeSocketEngine *engine; }; @@ -1262,7 +1262,7 @@ public: : QSocketNotifier(fd, QSocketNotifier::Write, parent) { engine = parent; } protected: - bool event(QEvent *); + bool event(QEvent *) override; QNativeSocketEngine *engine; }; @@ -1286,7 +1286,7 @@ public: : QSocketNotifier(fd, QSocketNotifier::Exception, parent) { engine = parent; } protected: - bool event(QEvent *); + bool event(QEvent *) override; QNativeSocketEngine *engine; }; diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h index 1333df316b..3c9da982e9 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache_p.h +++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h @@ -83,8 +83,8 @@ public: GLuint getBuffer(const QGradient &gradient, qreal opacity); inline int paletteSize() const { return 1024; } - void invalidateResource(); - void freeResource(QOpenGLContext *ctx); + void invalidateResource() override; + void freeResource(QOpenGLContext *ctx) override; private: inline int maxCacheSize() const { return 60; } diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index 6416e41773..9125fcfb4b 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -63,11 +63,11 @@ class QOpenGLFramebufferObject; class QGLPBufferGLPaintDevice : public QGLPaintDevice { public: - virtual QPaintEngine* paintEngine() const {return pbuf->paintEngine();} - virtual QSize size() const {return pbuf->size();} - virtual QGLContext* context() const; - virtual void beginPaint(); - virtual void endPaint(); + QPaintEngine* paintEngine() const override {return pbuf->paintEngine();} + QSize size() const override {return pbuf->size();} + QGLContext* context() const override; + void beginPaint() override; + void endPaint() override; void setPBuffer(QGLPixelBuffer* pb); void setFbo(GLuint fbo); private: diff --git a/src/printsupport/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h index e8eee2ca9c..f18406af4b 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.h +++ b/src/printsupport/dialogs/qabstractprintdialog.h @@ -83,7 +83,7 @@ public: explicit QAbstractPrintDialog(QPrinter *printer, QWidget *parent = Q_NULLPTR); ~QAbstractPrintDialog(); - virtual int exec() = 0; + int exec() override = 0; // obsolete void addEnabledOption(PrintDialogOption option); diff --git a/src/printsupport/kernel/qpaintengine_alpha_p.h b/src/printsupport/kernel/qpaintengine_alpha_p.h index b5ba98bf88..efae442690 100644 --- a/src/printsupport/kernel/qpaintengine_alpha_p.h +++ b/src/printsupport/kernel/qpaintengine_alpha_p.h @@ -67,18 +67,18 @@ class Q_PRINTSUPPORT_EXPORT QAlphaPaintEngine : public QPaintEngine public: ~QAlphaPaintEngine(); - virtual bool begin(QPaintDevice *pdev); - virtual bool end(); + bool begin(QPaintDevice *pdev) override; + bool end() override; - virtual void updateState(const QPaintEngineState &state); + void updateState(const QPaintEngineState &state) override; - virtual void drawPath(const QPainterPath &path); + void drawPath(const QPainterPath &path) override; - virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; - virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); - virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); + void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; + void drawTextItem(const QPointF &p, const QTextItem &textItem) override; + void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override; protected: QAlphaPaintEngine(QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps = 0); diff --git a/src/printsupport/kernel/qpaintengine_preview_p.h b/src/printsupport/kernel/qpaintengine_preview_p.h index 6277451bfa..31b3142cb6 100644 --- a/src/printsupport/kernel/qpaintengine_preview_p.h +++ b/src/printsupport/kernel/qpaintengine_preview_p.h @@ -69,33 +69,33 @@ public: QPreviewPaintEngine(); ~QPreviewPaintEngine(); - bool begin(QPaintDevice *dev); - bool end(); + bool begin(QPaintDevice *dev) override; + bool end() override; - void updateState(const QPaintEngineState &state); + void updateState(const QPaintEngineState &state) override; - void drawPath(const QPainterPath &path); - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - void drawTextItem(const QPointF &p, const QTextItem &textItem); + void drawPath(const QPainterPath &path) override; + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; + void drawTextItem(const QPointF &p, const QTextItem &textItem) override; - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p); + void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; + void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p) override; QList pages(); - QPaintEngine::Type type() const { return Picture; } + QPaintEngine::Type type() const override { return Picture; } void setProxyEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine); - void setProperty(PrintEnginePropertyKey key, const QVariant &value); - QVariant property(PrintEnginePropertyKey key) const; + void setProperty(PrintEnginePropertyKey key, const QVariant &value) override; + QVariant property(PrintEnginePropertyKey key) const override; - bool newPage(); - bool abort(); + bool newPage() override; + bool abort() override; - int metric(QPaintDevice::PaintDeviceMetric) const; + int metric(QPaintDevice::PaintDeviceMetric) const override; - QPrinter::PrinterState printerState() const; + QPrinter::PrinterState printerState() const override; }; QT_END_NAMESPACE diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h index e98bf28d3b..f295de7396 100644 --- a/src/sql/models/qsqlrelationaldelegate.h +++ b/src/sql/models/qsqlrelationaldelegate.h @@ -65,7 +65,7 @@ explicit QSqlRelationalDelegate(QObject *aParent = 0) QWidget *createEditor(QWidget *aParent, const QStyleOptionViewItem &option, - const QModelIndex &index) const + const QModelIndex &index) const override { const QSqlRelationalTableModel *sqlModel = qobject_cast(index.model()); QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0; @@ -80,7 +80,7 @@ QWidget *createEditor(QWidget *aParent, return combo; } -void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const +void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override { if (!index.isValid()) return; -- cgit v1.2.3 From 15b0b3db29636a94f98f5c7cd6d7a33c15bd6421 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 30 Nov 2016 13:15:38 +0300 Subject: xcb: Replace Q_DECL_OVERRIDE by override We can use 'override' directly since Qt 5.7. Also remove redundant 'virtual' keywords. Change-Id: Ia40be0e1e60e51f9d043ab575fd6b9305ea620b0 Reviewed-by: Shawn Rutledge --- .../gl_integrations/xcb_egl/qxcbeglintegration.h | 10 +-- .../xcb_egl/qxcbeglnativeinterfacehandler.h | 6 +- .../xcb/gl_integrations/xcb_egl/qxcbeglwindow.h | 6 +- .../xcb/gl_integrations/xcb_glx/qglxintegration.h | 18 ++--- .../gl_integrations/xcb_glx/qxcbglxintegration.h | 14 ++-- .../xcb_glx/qxcbglxnativeinterfacehandler.h | 2 +- .../xcb/gl_integrations/xcb_glx/qxcbglxwindow.h | 2 +- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 12 +-- src/plugins/platforms/xcb/qxcbbackingstore.h | 18 ++--- src/plugins/platforms/xcb/qxcbclipboard.cpp | 8 +- src/plugins/platforms/xcb/qxcbclipboard.h | 8 +- src/plugins/platforms/xcb/qxcbconnection.h | 4 +- src/plugins/platforms/xcb/qxcbcursor.h | 6 +- src/plugins/platforms/xcb/qxcbdrag.cpp | 6 +- src/plugins/platforms/xcb/qxcbdrag.h | 18 ++--- src/plugins/platforms/xcb/qxcbintegration.h | 44 +++++------ src/plugins/platforms/xcb/qxcbmain.cpp | 2 +- src/plugins/platforms/xcb/qxcbnativeinterface.h | 24 +++--- src/plugins/platforms/xcb/qxcbscreen.h | 28 +++---- src/plugins/platforms/xcb/qxcbsessionmanager.h | 16 ++-- src/plugins/platforms/xcb/qxcbsystemtraytracker.h | 2 +- src/plugins/platforms/xcb/qxcbwindow.h | 90 +++++++++++----------- src/plugins/platforms/xcb/qxcbxsettings.h | 2 +- 23 files changed, 173 insertions(+), 173 deletions(-) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h index 0cb4a878a1..54a9f5cd83 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h @@ -62,13 +62,13 @@ public: QXcbEglIntegration(); ~QXcbEglIntegration(); - bool initialize(QXcbConnection *connection) Q_DECL_OVERRIDE; + bool initialize(QXcbConnection *connection) override; - QXcbWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; - QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; + QXcbWindow *createWindow(QWindow *window) const override; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; + QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; - bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE { return true; } + bool supportsThreadedOpenGL() const override { return true; } EGLDisplay eglDisplay() const { return m_egl_display; } void *xlib_display() const; diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h index 6e717e4491..7c83d0e240 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h @@ -55,9 +55,9 @@ public: QXcbEglNativeInterfaceHandler(QXcbNativeInterface *nativeInterface); - QPlatformNativeInterface::NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) const Q_DECL_OVERRIDE; - QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const Q_DECL_OVERRIDE; - QPlatformNativeInterface::NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) const Q_DECL_OVERRIDE; + QPlatformNativeInterface::NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) const override; + QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const override; + QPlatformNativeInterface::NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) const override; private: static void *eglDisplay(); static void *eglDisplayForWindow(QWindow *window); 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 48fc6dce70..3090cef735 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h @@ -59,11 +59,11 @@ public: QXcbEglIntegration *glIntegration() const { return m_glIntegration; } protected: - void create() Q_DECL_OVERRIDE; - void resolveFormat(const QSurfaceFormat &format) Q_DECL_OVERRIDE; + void create() override; + void resolveFormat(const QSurfaceFormat &format) override; #ifdef XCB_USE_XLIB - const xcb_visualtype_t *createVisual() Q_DECL_OVERRIDE; + const xcb_visualtype_t *createVisual() override; #endif private: diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h index bf1f1b324b..3dfe0ac618 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h @@ -60,14 +60,14 @@ public: const QVariant &nativeHandle); ~QGLXContext(); - bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE; - void doneCurrent() Q_DECL_OVERRIDE; - void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; - QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE; + bool makeCurrent(QPlatformSurface *surface) override; + void doneCurrent() override; + void swapBuffers(QPlatformSurface *surface) override; + QFunctionPointer getProcAddress(const char *procName) override; - QSurfaceFormat format() const Q_DECL_OVERRIDE; - bool isSharing() const Q_DECL_OVERRIDE; - bool isValid() const Q_DECL_OVERRIDE; + QSurfaceFormat format() const override; + bool isSharing() const override; + bool isValid() const override; GLXContext glxContext() const { return m_context; } GLXFBConfig glxConfig() const { return m_config; } @@ -100,8 +100,8 @@ public: explicit QGLXPbuffer(QOffscreenSurface *offscreenSurface); ~QGLXPbuffer(); - QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; } - bool isValid() const Q_DECL_OVERRIDE { return m_pbuffer != 0; } + QSurfaceFormat format() const override { return m_format; } + bool isValid() const override { return m_pbuffer != 0; } GLXPbuffer pbuffer() const { return m_pbuffer; } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h index 8f04db31b2..26cb233a59 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h @@ -52,15 +52,15 @@ public: QXcbGlxIntegration(); ~QXcbGlxIntegration(); - bool initialize(QXcbConnection *connection) Q_DECL_OVERRIDE; - bool handleXcbEvent(xcb_generic_event_t *event, uint responseType) Q_DECL_OVERRIDE; + bool initialize(QXcbConnection *connection) override; + bool handleXcbEvent(xcb_generic_event_t *event, uint responseType) override; - QXcbWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; - QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; + QXcbWindow *createWindow(QWindow *window) const override; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; + QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; - virtual bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE; - virtual bool supportsSwitchableWidgetComposition() const Q_DECL_OVERRIDE; + bool supportsThreadedOpenGL() const override; + bool supportsSwitchableWidgetComposition() const override; private: QXcbConnection *m_connection; diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h index 1748f2298c..d877732725 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h @@ -53,7 +53,7 @@ public: }; QXcbGlxNativeInterfaceHandler(QXcbNativeInterface *nativeInterface); - QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const Q_DECL_OVERRIDE; + QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const override; private: static void *glxContextForContext(QOpenGLContext *context); diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h index 9519245130..14b2d5e6eb 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h @@ -52,7 +52,7 @@ public: ~QXcbGlxWindow(); protected: - const xcb_visualtype_t *createVisual() Q_DECL_OVERRIDE; + const xcb_visualtype_t *createVisual() override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 3d09b1c139..f095288221 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -122,7 +122,7 @@ public: , m_image(image) { } - bool doLock(AccessTypes access, const QRect &rect) Q_DECL_OVERRIDE + bool doLock(AccessTypes access, const QRect &rect) override { Q_UNUSED(rect); if (access & ~(QPlatformGraphicsBuffer::SWReadAccess | QPlatformGraphicsBuffer::SWWriteAccess)) @@ -131,13 +131,13 @@ public: m_access_lock |= access; return true; } - void doUnlock() Q_DECL_OVERRIDE { m_access_lock = None; } + void doUnlock() override { m_access_lock = None; } - const uchar *data() const Q_DECL_OVERRIDE { return m_image->bits(); } - uchar *data() Q_DECL_OVERRIDE { return m_image->bits(); } - int bytesPerLine() const Q_DECL_OVERRIDE { return m_image->bytesPerLine(); } + const uchar *data() const override { return m_image->bits(); } + uchar *data() override { return m_image->bits(); } + int bytesPerLine() const override { return m_image->bytesPerLine(); } - Origin origin() const Q_DECL_OVERRIDE { return QPlatformGraphicsBuffer::OriginTopLeft; } + Origin origin() const override { return QPlatformGraphicsBuffer::OriginTopLeft; } private: AccessTypes m_access_lock; QImage *m_image; diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 6af679d28a..2985432b7f 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -57,22 +57,22 @@ public: QXcbBackingStore(QWindow *widget); ~QXcbBackingStore(); - QPaintDevice *paintDevice() Q_DECL_OVERRIDE; - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; + QPaintDevice *paintDevice() override; + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; #ifndef QT_NO_OPENGL void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, QOpenGLContext *context, - bool translucentBackground) Q_DECL_OVERRIDE; + bool translucentBackground) override; #endif - QImage toImage() const Q_DECL_OVERRIDE; + QImage toImage() const override; - QPlatformGraphicsBuffer *graphicsBuffer() const Q_DECL_OVERRIDE; + QPlatformGraphicsBuffer *graphicsBuffer() const override; - void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; - bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE; + void resize(const QSize &size, const QRegion &staticContents) override; + bool scroll(const QRegion &area, int dx, int dy) override; - void beginPaint(const QRegion &) Q_DECL_OVERRIDE; - void endPaint() Q_DECL_OVERRIDE; + void beginPaint(const QRegion &) override; + void endPaint() override; private: QXcbShmImage *m_image; diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index 38e91cc9f6..cee011bbdf 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -90,7 +90,7 @@ public: } protected: - QStringList formats_sys() const Q_DECL_OVERRIDE + QStringList formats_sys() const override { if (isEmpty()) return QStringList(); @@ -120,13 +120,13 @@ protected: return formatList; } - bool hasFormat_sys(const QString &format) const Q_DECL_OVERRIDE + bool hasFormat_sys(const QString &format) const override { QStringList list = formats(); return list.contains(format); } - QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const Q_DECL_OVERRIDE + QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const override { if (fmt.isEmpty() || isEmpty()) return QByteArray(); @@ -238,7 +238,7 @@ public: } protected: - void timerEvent(QTimerEvent *ev) Q_DECL_OVERRIDE + void timerEvent(QTimerEvent *ev) override { if (ev->timerId() == abort_timer) { // this can happen when the X client we are sending data diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h index ffd565c56f..a0a4f4e5a1 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.h +++ b/src/plugins/platforms/xcb/qxcbclipboard.h @@ -59,11 +59,11 @@ public: QXcbClipboard(QXcbConnection *connection); ~QXcbClipboard(); - QMimeData *mimeData(QClipboard::Mode mode) Q_DECL_OVERRIDE; - void setMimeData(QMimeData *data, QClipboard::Mode mode) Q_DECL_OVERRIDE; + QMimeData *mimeData(QClipboard::Mode mode) override; + void setMimeData(QMimeData *data, QClipboard::Mode mode) override; - bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; - bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + bool supportsMode(QClipboard::Mode mode) const override; + bool ownsMode(QClipboard::Mode mode) const override; QXcbScreen *screen() const; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index f6ba828a15..cb337ea0da 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -315,7 +315,7 @@ class QXcbEventReader : public QThread public: QXcbEventReader(QXcbConnection *connection); - void run() Q_DECL_OVERRIDE; + void run() override; QXcbEventArray *lock(); void unlock(); @@ -519,7 +519,7 @@ public: #endif protected: - bool event(QEvent *e) Q_DECL_OVERRIDE; + bool event(QEvent *e) override; public slots: void flush() { xcb_flush(m_connection); } diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index 3284a9e3e1..c15225f6d2 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -76,10 +76,10 @@ public: QXcbCursor(QXcbConnection *conn, QXcbScreen *screen); ~QXcbCursor(); #ifndef QT_NO_CURSOR - void changeCursor(QCursor *cursor, QWindow *widget) Q_DECL_OVERRIDE; + void changeCursor(QCursor *cursor, QWindow *widget) override; #endif - QPoint pos() const Q_DECL_OVERRIDE; - void setPos(const QPoint &pos) Q_DECL_OVERRIDE; + QPoint pos() const override; + void setPos(const QPoint &pos) override; static void queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask = 0); diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 4915bb1b11..494cecb3d1 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -130,9 +130,9 @@ public: ~QXcbDropData(); protected: - bool hasFormat_sys(const QString &mimeType) const Q_DECL_OVERRIDE; - QStringList formats_sys() const Q_DECL_OVERRIDE; - QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE; + bool hasFormat_sys(const QString &mimeType) const override; + QStringList formats_sys() const override; + QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override; QVariant xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const; diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index cb6e95cc9a..2d152edf76 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -74,14 +74,14 @@ public: QXcbDrag(QXcbConnection *c); ~QXcbDrag(); - virtual QMimeData *platformDropData() Q_DECL_OVERRIDE; - bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE; + QMimeData *platformDropData() override; + bool eventFilter(QObject *o, QEvent *e) override; - void startDrag() Q_DECL_OVERRIDE; - void cancel() Q_DECL_OVERRIDE; - void move(const QPoint &globalPos) Q_DECL_OVERRIDE; - void drop(const QPoint &globalPos) Q_DECL_OVERRIDE; - void endDrag() Q_DECL_OVERRIDE; + void startDrag() override; + void cancel() override; + void move(const QPoint &globalPos) override; + void drop(const QPoint &globalPos) override; + void endDrag() override; void handleEnter(QPlatformWindow *window, const xcb_client_message_event_t *event, xcb_window_t proxy = 0); void handlePosition(QPlatformWindow *w, const xcb_client_message_event_t *event); @@ -93,13 +93,13 @@ public: void handleFinished(const xcb_client_message_event_t *event); bool dndEnable(QXcbWindow *win, bool on); - bool ownsDragObject() const Q_DECL_OVERRIDE; + bool ownsDragObject() const override; void updatePixmap(); xcb_timestamp_t targetTime() { return target_time; } protected: - void timerEvent(QTimerEvent* e) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent* e) override; private: friend class QXcbDropData; diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 34dd44d491..f8034f436f 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -60,57 +60,57 @@ public: QXcbIntegration(const QStringList ¶meters, int &argc, char **argv); ~QXcbIntegration(); - QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformWindow *createPlatformWindow(QWindow *window) const override; #ifndef QT_NO_OPENGL - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; #endif - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; - QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; + QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; - bool hasCapability(Capability cap) const Q_DECL_OVERRIDE; - QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; - void initialize() Q_DECL_OVERRIDE; + bool hasCapability(Capability cap) const override; + QAbstractEventDispatcher *createEventDispatcher() const override; + void initialize() override; void moveToScreen(QWindow *window, int screen); - QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QPlatformFontDatabase *fontDatabase() const override; - QPlatformNativeInterface *nativeInterface()const Q_DECL_OVERRIDE; + QPlatformNativeInterface *nativeInterface()const override; #ifndef QT_NO_CLIPBOARD - QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; + QPlatformClipboard *clipboard() const override; #endif #ifndef QT_NO_DRAGANDDROP - QPlatformDrag *drag() const Q_DECL_OVERRIDE; + QPlatformDrag *drag() const override; #endif - QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; + QPlatformInputContext *inputContext() const override; #ifndef QT_NO_ACCESSIBILITY - QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; + QPlatformAccessibility *accessibility() const override; #endif - QPlatformServices *services() const Q_DECL_OVERRIDE; + QPlatformServices *services() const override; - Qt::KeyboardModifiers queryKeyboardModifiers() const Q_DECL_OVERRIDE; - QList possibleKeys(const QKeyEvent *e) const Q_DECL_OVERRIDE; + Qt::KeyboardModifiers queryKeyboardModifiers() const override; + QList possibleKeys(const QKeyEvent *e) const override; - QStringList themeNames() const Q_DECL_OVERRIDE; - QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; - QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; + QStringList themeNames() const override; + QPlatformTheme *createPlatformTheme(const QString &name) const override; + QVariant styleHint(StyleHint hint) const override; QXcbConnection *defaultConnection() const { return m_connections.first(); } QByteArray wmClass() const; #if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM) - QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE; + QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override; #endif - void sync() Q_DECL_OVERRIDE; + void sync() override; - void beep() const Q_DECL_OVERRIDE; + void beep() const override; static QXcbIntegration *instance() { return m_instance; } diff --git a/src/plugins/platforms/xcb/qxcbmain.cpp b/src/plugins/platforms/xcb/qxcbmain.cpp index ab55bb7691..f8cb9a9269 100644 --- a/src/plugins/platforms/xcb/qxcbmain.cpp +++ b/src/plugins/platforms/xcb/qxcbmain.cpp @@ -47,7 +47,7 @@ class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "xcb.json") public: - QPlatformIntegration *create(const QString&, const QStringList&, int &, char **) Q_DECL_OVERRIDE; + QPlatformIntegration *create(const QString&, const QStringList&, int &, char **) override; }; QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv) diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index acecbf4116..a830829311 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -78,22 +78,22 @@ public: QXcbNativeInterface(); - void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; - void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) Q_DECL_OVERRIDE; - void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE; - void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) Q_DECL_OVERRIDE; - void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) Q_DECL_OVERRIDE; + void *nativeResourceForIntegration(const QByteArray &resource) override; + void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) override; + void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; + void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) override; + void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) override; #ifndef QT_NO_CURSOR - void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) Q_DECL_OVERRIDE; + void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override; #endif - NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; - NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE; - NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) Q_DECL_OVERRIDE; - NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) Q_DECL_OVERRIDE; - NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) Q_DECL_OVERRIDE; + NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) override; + NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override; + NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) override; + NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) override; + NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) override; - QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE; + QFunctionPointer platformFunction(const QByteArray &function) const override; inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; } diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 0d32c3d624..627397fcaf 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -115,24 +115,24 @@ public: QString getOutputName(xcb_randr_get_output_info_reply_t *outputInfo); - QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE; + QPixmap grabWindow(WId window, int x, int y, int width, int height) const override; - QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE; + QWindow *topLevelAt(const QPoint &point) const override; - QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; } - QRect availableGeometry() const Q_DECL_OVERRIDE {return m_availableGeometry;} - int depth() const Q_DECL_OVERRIDE { return screen()->root_depth; } - QImage::Format format() const Q_DECL_OVERRIDE; - QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_sizeMillimeters; } + QRect geometry() const override { return m_geometry; } + QRect availableGeometry() const override {return m_availableGeometry;} + int depth() const override { return screen()->root_depth; } + QImage::Format format() const override; + QSizeF physicalSize() const override { return m_sizeMillimeters; } QSize virtualSize() const { return m_virtualSize; } QSizeF physicalVirtualSize() const { return m_virtualSizeMillimeters; } QDpi virtualDpi() const; - QDpi logicalDpi() const Q_DECL_OVERRIDE; - qreal pixelDensity() const Q_DECL_OVERRIDE; - QPlatformCursor *cursor() const Q_DECL_OVERRIDE; - qreal refreshRate() const Q_DECL_OVERRIDE { return m_refreshRate; } - Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE { return m_orientation; } - QList virtualSiblings() const Q_DECL_OVERRIDE { return m_virtualDesktop->screens(); } + QDpi logicalDpi() const override; + qreal pixelDensity() const override; + QPlatformCursor *cursor() const override; + qreal refreshRate() const override { return m_refreshRate; } + Qt::ScreenOrientation orientation() const override { return m_orientation; } + QList virtualSiblings() const override { return m_virtualDesktop->screens(); } QXcbVirtualDesktop *virtualDesktop() const { return m_virtualDesktop; } void setPrimary(bool primary) { m_primary = primary; } @@ -161,7 +161,7 @@ public: const xcb_visualtype_t *visualForId(xcb_visualid_t) const; quint8 depthOfVisual(xcb_visualid_t) const; - QString name() const Q_DECL_OVERRIDE { return m_outputName; } + QString name() const override { return m_outputName; } void handleScreenChange(xcb_randr_screen_change_notify_event_t *change_event); void updateGeometry(const QRect &geom, uint8_t rotation); diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.h b/src/plugins/platforms/xcb/qxcbsessionmanager.h index a184282034..0ad9445361 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.h +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.h @@ -69,17 +69,17 @@ public: void setSessionId(const QString &id) { m_sessionId = id; } void setSessionKey(const QString &key) { m_sessionKey = key; } - bool allowsInteraction() Q_DECL_OVERRIDE; - bool allowsErrorInteraction() Q_DECL_OVERRIDE; - void release() Q_DECL_OVERRIDE; + bool allowsInteraction() override; + bool allowsErrorInteraction() override; + void release() override; - void cancel() Q_DECL_OVERRIDE; + void cancel() override; - void setManagerProperty(const QString &name, const QString &value) Q_DECL_OVERRIDE; - void setManagerProperty(const QString &name, const QStringList &value) Q_DECL_OVERRIDE; + void setManagerProperty(const QString &name, const QString &value) override; + void setManagerProperty(const QString &name, const QStringList &value) override; - bool isPhase2() const Q_DECL_OVERRIDE; - void requestPhase2() Q_DECL_OVERRIDE; + bool isPhase2() const override; + void requestPhase2() override; void exitEventLoop(); diff --git a/src/plugins/platforms/xcb/qxcbsystemtraytracker.h b/src/plugins/platforms/xcb/qxcbsystemtraytracker.h index 5cca4782aa..a6131e6d0e 100644 --- a/src/plugins/platforms/xcb/qxcbsystemtraytracker.h +++ b/src/plugins/platforms/xcb/qxcbsystemtraytracker.h @@ -61,7 +61,7 @@ public: void notifyManagerClientMessageEvent(const xcb_client_message_event_t *); - void handleDestroyNotifyEvent(const xcb_destroy_notify_event_t *) Q_DECL_OVERRIDE; + void handleDestroyNotifyEvent(const xcb_destroy_notify_event_t *) override; bool visualHasAlphaChannel(); signals: diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 92f3f7a67c..3d8d21be6b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -76,75 +76,75 @@ public: QXcbWindow(QWindow *window); ~QXcbWindow(); - void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; + void setGeometry(const QRect &rect) override; - QMargins frameMargins() const Q_DECL_OVERRIDE; + QMargins frameMargins() const override; - void setVisible(bool visible) Q_DECL_OVERRIDE; - void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; - void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; - WId winId() const Q_DECL_OVERRIDE; - void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE; + void setVisible(bool visible) override; + void setWindowFlags(Qt::WindowFlags flags) override; + void setWindowState(Qt::WindowState state) override; + WId winId() const override; + void setParent(const QPlatformWindow *window) override; - bool isExposed() const Q_DECL_OVERRIDE; - bool isEmbedded(const QPlatformWindow *parentWindow = 0) const Q_DECL_OVERRIDE; - QPoint mapToGlobal(const QPoint &pos) const Q_DECL_OVERRIDE; - QPoint mapFromGlobal(const QPoint &pos) const Q_DECL_OVERRIDE; + bool isExposed() const override; + bool isEmbedded(const QPlatformWindow *parentWindow = 0) const override; + QPoint mapToGlobal(const QPoint &pos) const override; + QPoint mapFromGlobal(const QPoint &pos) const override; - void setWindowTitle(const QString &title) Q_DECL_OVERRIDE; + void setWindowTitle(const QString &title) override; void setWindowIconText(const QString &title); - void setWindowIcon(const QIcon &icon) Q_DECL_OVERRIDE; - void raise() Q_DECL_OVERRIDE; - void lower() Q_DECL_OVERRIDE; - void propagateSizeHints() Q_DECL_OVERRIDE; + void setWindowIcon(const QIcon &icon) override; + void raise() override; + void lower() override; + void propagateSizeHints() override; - void requestActivateWindow() Q_DECL_OVERRIDE; + void requestActivateWindow() override; - bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE; - bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE; + bool setKeyboardGrabEnabled(bool grab) override; + bool setMouseGrabEnabled(bool grab) override; void setCursor(xcb_cursor_t cursor, bool isBitmapCursor); - QSurfaceFormat format() const Q_DECL_OVERRIDE; + QSurfaceFormat format() const override; - void windowEvent(QEvent *event) Q_DECL_OVERRIDE; + void windowEvent(QEvent *event) override; - bool startSystemResize(const QPoint &pos, Qt::Corner corner) Q_DECL_OVERRIDE; + bool startSystemResize(const QPoint &pos, Qt::Corner corner) override; - void setOpacity(qreal level) Q_DECL_OVERRIDE; - void setMask(const QRegion ®ion) Q_DECL_OVERRIDE; + void setOpacity(qreal level) override; + void setMask(const QRegion ®ion) override; - void setAlertState(bool enabled) Q_DECL_OVERRIDE; - bool isAlertState() const Q_DECL_OVERRIDE { return m_alertState; } + void setAlertState(bool enabled) override; + bool isAlertState() const override { return m_alertState; } xcb_window_t xcb_window() const { return m_window; } uint depth() const { return m_depth; } QImage::Format imageFormat() const { return m_imageFormat; } bool imageNeedsRgbSwap() const { return m_imageRgbSwap; } - bool handleGenericEvent(xcb_generic_event_t *event, long *result) Q_DECL_OVERRIDE; - - void handleExposeEvent(const xcb_expose_event_t *event) Q_DECL_OVERRIDE; - void handleClientMessageEvent(const xcb_client_message_event_t *event) Q_DECL_OVERRIDE; - void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) Q_DECL_OVERRIDE; - void handleMapNotifyEvent(const xcb_map_notify_event_t *event) Q_DECL_OVERRIDE; - void handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) Q_DECL_OVERRIDE; - void handleButtonPressEvent(const xcb_button_press_event_t *event) Q_DECL_OVERRIDE; - void handleButtonReleaseEvent(const xcb_button_release_event_t *event) Q_DECL_OVERRIDE; - void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) Q_DECL_OVERRIDE; - - void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) Q_DECL_OVERRIDE; - void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) Q_DECL_OVERRIDE; - void handleFocusInEvent(const xcb_focus_in_event_t *event) Q_DECL_OVERRIDE; - void handleFocusOutEvent(const xcb_focus_out_event_t *event) Q_DECL_OVERRIDE; - void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE; + bool handleGenericEvent(xcb_generic_event_t *event, long *result) override; + + void handleExposeEvent(const xcb_expose_event_t *event) override; + void handleClientMessageEvent(const xcb_client_message_event_t *event) override; + void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) override; + void handleMapNotifyEvent(const xcb_map_notify_event_t *event) override; + void handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) override; + void handleButtonPressEvent(const xcb_button_press_event_t *event) override; + void handleButtonReleaseEvent(const xcb_button_release_event_t *event) override; + void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) override; + + void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) override; + void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) override; + void handleFocusInEvent(const xcb_focus_in_event_t *event) override; + void handleFocusOutEvent(const xcb_focus_out_event_t *event) override; + void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) override; #ifdef XCB_USE_XINPUT22 void handleXIMouseButtonState(const xcb_ge_event_t *); - void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) Q_DECL_OVERRIDE; - void handleXIEnterLeave(xcb_ge_event_t *) Q_DECL_OVERRIDE; + void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) override; + void handleXIEnterLeave(xcb_ge_event_t *) override; #endif - QXcbWindow *toWindow() Q_DECL_OVERRIDE; + QXcbWindow *toWindow() override; void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source); diff --git a/src/plugins/platforms/xcb/qxcbxsettings.h b/src/plugins/platforms/xcb/qxcbxsettings.h index ff1932734a..ab1f784274 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.h +++ b/src/plugins/platforms/xcb/qxcbxsettings.h @@ -61,7 +61,7 @@ public: void removeCallbackForHandle(const QByteArray &property, void *handle); void removeCallbackForHandle(void *handle); - void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE; + void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) override; private: QXcbXSettingsPrivate *d_ptr; }; -- cgit v1.2.3 From 65d48808775d4c32b4be05798207f728d165bbfa Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 28 Nov 2016 14:47:29 +0300 Subject: xcb: Remove unused QXcbGlIntegrationFactory::keys() This static method was introduced in 8758f532ae6209bcf9447e27edc4fd412c0f173d and was unused even then. Change-Id: Id0d409b7fade977bbbabfcdee0c432b7058f8ace Reviewed-by: Shawn Rutledge --- .../gl_integrations/qxcbglintegrationfactory.cpp | 23 ---------------------- .../xcb/gl_integrations/qxcbglintegrationfactory.h | 1 - 2 files changed, 24 deletions(-) diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp index 8e1688dbe8..6650ca44ae 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp @@ -55,29 +55,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QXcbGlIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) #endif // !QT_NO_LIBRARY -QStringList QXcbGlIntegrationFactory::keys(const QString &pluginPath) -{ - QStringList list; -#ifndef QT_NO_LIBRARY - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - list = directLoader()->keyMap().values(); - if (!list.isEmpty()) { - const QString postFix = QStringLiteral(" (from ") - + QDir::toNativeSeparators(pluginPath) - + QLatin1Char(')'); - const QStringList::iterator end = list.end(); - for (QStringList::iterator it = list.begin(); it != end; ++it) - (*it).append(postFix); - } - } -#else - Q_UNUSED(pluginPath); -#endif - list.append(loader()->keyMap().values()); - return list; -} - QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform, const QString &pluginPath) { #ifndef QT_NO_LIBRARY diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h index 633b11a505..c4aa0a3d8d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h @@ -49,7 +49,6 @@ class QXcbGlIntegration; class QXcbGlIntegrationFactory { public: - static QStringList keys(const QString &pluginPath = QString()); static QXcbGlIntegration *create(const QString &name, const QString &platformPluginPath = QString()); }; -- cgit v1.2.3 From fec08545ff0b4fb2ce68a7d7502273a599472141 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Tue, 18 Oct 2016 17:44:54 +0300 Subject: QVariant: optimize convert() for bool case Do not create QByteArray from const char* to compare with other QByteArray, because there is an overloaded operator==. So avoid needless allocations. Reorder condition, because isEmpty() method is cheaper than string compare. Change-Id: I8d2c8a0fb247528d9ce485007431167372d62bff Reviewed-by: Edward Welbourne --- src/corelib/kernel/qvariant.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index ccfa7d0d38..0ffc22d810 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -319,7 +319,7 @@ template inline bool qt_convertToBool(const QVariant::Private *const d) { TInput str = v_cast(d)->toLower(); - return !(str == LiteralWrapper("0") || str == LiteralWrapper("false") || str.isEmpty()); + return !(str.isEmpty() || str == LiteralWrapper("0") || str == LiteralWrapper("false")); } /*! @@ -700,7 +700,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) bool *b = static_cast(result); switch(d->type) { case QVariant::ByteArray: - *b = qt_convertToBool(d); + *b = qt_convertToBool(d); break; case QVariant::String: *b = qt_convertToBool(d); -- cgit v1.2.3 From 2503a1e9e7a33c9a69eb134ba59711078255ca4c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 1 Dec 2016 12:51:02 +0100 Subject: Fix tst_QComboBox::getSetCheck() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change 2fd3d8ea9e3e1829653942431070a83569bab6eb broke the QCOMPARE() in there, partially revert. Change-Id: I8f572b9d82ad1c6b5448504eda7cc2fa53fa3d3d Reviewed-by: Jędrzej Nowacki --- tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 122d320d18..3afdc0a12a 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -312,10 +312,10 @@ void tst_QComboBox::getSetCheck() // void QComboBox::setItemDelegate(QAbstractItemDelegate *) MyAbstractItemDelegate *var10 = new MyAbstractItemDelegate; obj1.setItemDelegate(var10); - QCOMPARE(obj1.itemDelegate(), nullptr); + QCOMPARE(obj1.itemDelegate(), var10); QTest::ignoreMessage(QtWarningMsg, "QComboBox::setItemDelegate: cannot set a 0 delegate"); obj1.setItemDelegate((QAbstractItemDelegate *)0); - QCOMPARE(obj1.itemDelegate(), nullptr); + QCOMPARE(obj1.itemDelegate(), var10); // delete var10; // No delete, since QComboBox takes ownership // QAbstractItemModel * QComboBox::model() -- cgit v1.2.3 From 1670bc751e7f7f3fddf92870b9a4da5f38ab93a9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Dec 2016 10:51:13 +0100 Subject: eglfs: make it possible to configure the EGLStream FIFO length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Setting QT_QPA_EGLFS_STREAM_FIFO_LENGTH to a >= 1 value changes from mailbox to FIFO mode, with the specified length. [ChangeLog][Platform Specific Changes][Linux] Added an option to switch from mailbox to FIFO mode in eglfs' EGLStream backend. This is done by setting the environment variable QT_QPA_EGLFS_STREAM_FIFO_LENGTH to a >= 1 value, the desired length of the FIFO queue. Change-Id: Ib98e2ff805f8c00ca2e224d1db5b9c1b2c9a04f0 Done-with: Pasi Petajajarvi Reviewed-by: Pasi Petäjäjärvi --- .../qeglfskmsegldeviceintegration.cpp | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index d0c9c9565e..977b318ad9 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -129,10 +129,16 @@ void QEglJetsonTK1Window::resetSurface() qCDebug(qLcEglfsKmsDebug, "Creating stream"); EGLDisplay display = screen()->display(); - EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; - EGLint count; + EGLint streamAttribs[3]; + int streamAttribCount = 0; + int fifoLength = qEnvironmentVariableIntValue("QT_QPA_EGLFS_STREAM_FIFO_LENGTH"); + if (fifoLength > 0) { + streamAttribs[streamAttribCount++] = EGL_STREAM_FIFO_LENGTH_KHR; + streamAttribs[streamAttribCount++] = fifoLength; + } + streamAttribs[streamAttribCount++] = EGL_NONE; - m_egl_stream = m_integration->m_funcs->create_stream(display, Q_NULLPTR); + m_egl_stream = m_integration->m_funcs->create_stream(display, streamAttribs); if (m_egl_stream == EGL_NO_STREAM_KHR) { qWarning("resetSurface: Couldn't create EGLStream for native window"); return; @@ -140,6 +146,16 @@ void QEglJetsonTK1Window::resetSurface() qCDebug(qLcEglfsKmsDebug, "Created stream %p on display %p", m_egl_stream, display); + EGLint count; + if (m_integration->m_funcs->query_stream(display, m_egl_stream, EGL_STREAM_FIFO_LENGTH_KHR, &count)) { + if (count > 0) + qCDebug(qLcEglfsKmsDebug, "Using EGLStream FIFO mode with %d frames", count); + else + qCDebug(qLcEglfsKmsDebug, "Using EGLStream mailbox mode"); + } else { + qCDebug(qLcEglfsKmsDebug, "Could not query number of EGLStream FIFO frames"); + } + if (!m_integration->m_funcs->get_output_layers(display, Q_NULLPTR, Q_NULLPTR, 0, &count) || count == 0) { qWarning("No output layers found"); return; @@ -159,6 +175,7 @@ void QEglJetsonTK1Window::resetSurface() Q_ASSERT(cur_screen); qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", cur_screen->output().crtc_id); + EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; for (int i = 0; i < actualCount; ++i) { EGLAttrib id; if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_CRTC_EXT, &id)) { -- cgit v1.2.3 From b4c7d4f4b382f10c91152acb43b349bc3a5ecc90 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 28 Nov 2016 11:44:22 +0100 Subject: Remove unused VCFilterFile::additionalFile Change-Id: I67716404d38f41ee4f558dc5d82c9ae80a6956f1 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_objectmodel.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index e97996120f..4055bb625e 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -912,24 +912,20 @@ struct VCFilterFile { excludeFromBuild = false; } VCFilterFile(const QString &filename, bool exclude = false ) { file = filename; excludeFromBuild = exclude; } - VCFilterFile(const QString &filename, const QString &additional, bool exclude = false ) - { file = filename; excludeFromBuild = exclude; additionalFile = additional; } + bool operator==(const VCFilterFile &other){ return file == other.file - && additionalFile == other.additionalFile && excludeFromBuild == other.excludeFromBuild; } bool excludeFromBuild; QString file; - QString additionalFile; // For tools like MOC }; #ifndef QT_NO_DEBUG_OUTPUT inline QDebug operator<<(QDebug dbg, const VCFilterFile &p) { dbg.nospace() << "VCFilterFile(file(" << p.file - << ") additionalFile(" << p.additionalFile << ") excludeFromBuild(" << p.excludeFromBuild << "))" << endl; return dbg.space(); } -- cgit v1.2.3 From b83884a4e67d7f0e8a6bc9bc5b48ebc34daf6bfd Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 28 Nov 2016 11:51:27 +0100 Subject: Remove superfluous VCFilterFile::operator== The default-generated operator is fine. Change-Id: I9acb310aaf551d8da3c0fd9aea65d77ee62a45b4 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_objectmodel.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 4055bb625e..b07898562e 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -913,11 +913,6 @@ struct VCFilterFile VCFilterFile(const QString &filename, bool exclude = false ) { file = filename; excludeFromBuild = exclude; } - bool operator==(const VCFilterFile &other){ - return file == other.file - && excludeFromBuild == other.excludeFromBuild; - } - bool excludeFromBuild; QString file; }; -- cgit v1.2.3 From 5f6800c220d0c0e24e0cd4ac3e4a6bb78d45cb6d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 28 Nov 2016 15:03:50 +0100 Subject: Do not write empty custom build tool on VCConfiguration level This is superfluous. Change-Id: Iac96938c6a7e899244534747a2f8a60bdbbdeb62 Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msvc_objectmodel.cpp | 2 -- qmake/generators/win32/msvc_objectmodel.h | 1 - 2 files changed, 3 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 2c57fcc2f5..2d8d1fed0a 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2149,7 +2149,6 @@ VCConfiguration::VCConfiguration() compiler.config = this; linker.config = this; idl.config = this; - custom.config = this; } // VCFilter --------------------------------------------------------- @@ -2872,7 +2871,6 @@ void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) << attrE(_UseOfMfc, tool.UseOfMfc) << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization); write(xml, tool.compiler); - write(xml, tool.custom); if (tool.ConfigurationType == typeStaticLibrary) write(xml, tool.librarian); else diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index b07898562e..f9734e8e1b 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -896,7 +896,6 @@ public: VCLinkerTool linker; VCLibrarianTool librarian; VCManifestTool manifestTool; - VCCustomBuildTool custom; VCMIDLTool idl; VCPostBuildEventTool postBuild; VCPreBuildEventTool preBuild; -- cgit v1.2.3 From 9067a7f59c54a3dfab914b842b009b8346ae384c Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sat, 5 Nov 2016 20:44:36 +0300 Subject: dbustray: Handle StatusNotifierWatcher appearing and disappearing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the StatusNotifierWatcher disappears and then appears again, we need to register our tray icon again with it. To do this, split the “register with watcher” part into a separate method, and call it when m_dbusWatcher emits its serviceRegistered() signal. Change-Id: Id5fc8ac81b5038a61b678514dabd3eb9c8f1c106 Reviewed-by: Thiago Macieira Reviewed-by: Shawn Rutledge --- .../themes/genericunix/dbusmenu/qdbusmenuconnection.cpp | 9 ++++++--- .../themes/genericunix/dbusmenu/qdbusmenuconnection_p.h | 2 ++ .../themes/genericunix/dbustray/qdbustrayicon.cpp | 11 +++++++++++ .../themes/genericunix/dbustray/qdbustrayicon_p.h | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp index a9d758209a..352e4dfd56 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp @@ -119,13 +119,16 @@ bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item) if (item->menu()) registerTrayIconMenu(item); + return registerTrayIconWithWatcher(item); +} + +bool QDBusMenuConnection::registerTrayIconWithWatcher(QDBusTrayIcon *item) +{ QDBusMessage registerMethod = QDBusMessage::createMethodCall( StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService, QLatin1String("RegisterStatusNotifierItem")); registerMethod.setArguments(QVariantList() << item->instanceId()); - success = m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError))); - - return success; + return m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError))); } bool QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item) diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h index ae0595ae3b..c7c3f4bc5b 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h @@ -69,11 +69,13 @@ class QDBusMenuConnection : public QObject public: QDBusMenuConnection(QObject *parent = 0, const QString &serviceName = QString()); QDBusConnection connection() const { return m_connection; } + QDBusServiceWatcher *dbusWatcher() const { return m_dbusWatcher; } bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; } #ifndef QT_NO_SYSTEMTRAYICON bool registerTrayIconMenu(QDBusTrayIcon *item); void unregisterTrayIconMenu(QDBusTrayIcon *item); bool registerTrayIcon(QDBusTrayIcon *item); + bool registerTrayIconWithWatcher(QDBusTrayIcon *item); bool unregisterTrayIcon(QDBusTrayIcon *item); #endif // QT_NO_SYSTEMTRAYICON diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp index a686a33464..5c4157c206 100644 --- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp +++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp @@ -116,6 +116,8 @@ void QDBusTrayIcon::init() { qCDebug(qLcTray) << "registering" << m_instanceId; m_registered = dBusConnection()->registerTrayIcon(this); + QObject::connect(dBusConnection()->dbusWatcher(), &QDBusServiceWatcher::serviceRegistered, + this, &QDBusTrayIcon::watcherServiceRegistered); } void QDBusTrayIcon::cleanup() @@ -130,6 +132,15 @@ void QDBusTrayIcon::cleanup() m_registered = false; } +void QDBusTrayIcon::watcherServiceRegistered(const QString &serviceName) +{ + Q_UNUSED(serviceName); + // We have the icon registered, but the watcher has restarted or + // changed, so we need to tell it about our icon again + if (m_registered) + dBusConnection()->registerTrayIconWithWatcher(this); +} + void QDBusTrayIcon::attentionTimerExpired() { m_messageTitle = QString(); diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h index 234ff60584..ff1a7ae532 100644 --- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h +++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h @@ -133,6 +133,7 @@ private Q_SLOTS: void attentionTimerExpired(); void actionInvoked(uint id, const QString &action); void notificationClosed(uint id, uint reason); + void watcherServiceRegistered(const QString &serviceName); private: void setStatus(const QString &status); -- cgit v1.2.3 From b1789d8c0086537afbe0ecc605bcc7a8170c08dc Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Dec 2016 13:40:38 +0100 Subject: Add EGL_STREAM_FIFO_LENGTH to the helper header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parent patch introducing usage of this attribute did not add it to the EGLStream support header. This is likely not fatal, but follow the practice of defining the constants ourselves, in case they are not present. Change-Id: Ib16f9809f9c6a212570c49472bb840183232e68a Reviewed-by: Pasi Petäjäjärvi --- src/platformsupport/eglconvenience/qeglstreamconvenience_p.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h index 6c84f29613..8c802a0ca1 100644 --- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h +++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h @@ -105,6 +105,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLS typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); #endif +#ifndef EGL_KHR_stream_fifo +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#endif + #ifndef EGL_KHR_stream_producer_eglsurface #define EGL_STREAM_BIT_KHR 0x0800 typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); -- cgit v1.2.3 From 09d481987bc94b28252923f9ab7c5b9183d7bf74 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Dec 2016 13:59:15 +0100 Subject: eglfs: improve EGLStream logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to identify from the logs that QT_QPA_EGLFS_LAYER_INDEX was set, in order to help troubleshooting. Change-Id: Ic22825e5df9f0eeb31f817f398b9f6c000c3a00f Reviewed-by: Pasi Petäjäjärvi --- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 977b318ad9..b443a724ec 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -193,8 +193,10 @@ void QEglJetsonTK1Window::resetSurface() QByteArray reqLayerIndex = qgetenv("QT_QPA_EGLFS_LAYER_INDEX"); if (!reqLayerIndex.isEmpty()) { int idx = reqLayerIndex.toInt(); - if (idx >= 0 && idx < layers.count()) + if (idx >= 0 && idx < layers.count()) { + qCDebug(qLcEglfsKmsDebug, "EGLOutput layer index override = %d", idx); layer = layers[idx]; + } } if (layer == EGL_NO_OUTPUT_LAYER_EXT) { -- cgit v1.2.3 From 8d0854c2bd7cf371883726cacb3f8c8549a11eac Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Dec 2016 15:51:47 +0100 Subject: eglfs: allow forcing an explicit connector index on DRM/KMS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a QT_QPA_EGLFS_KMS_CONNECTOR_INDEX environment variable that applies both to the GBM and EGLDevice backends. Instead of specifying all uninteresting outputs as "off" in the config file in QT_QPA_EGLFS_KMS_CONFIG, this variable provides a shortcut to force one single connector and ignore all others in embedded systems with a fixed connector configuration. The index must be between 0 and DRM connector count - 1. Task-number: QTBUG-57386 Change-Id: I3f9562f48bf6b2ffaf9a0cc232e09a7e0c15645b Reviewed-by: Pasi Petäjäjärvi --- .../deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index f6b58d1ba6..b3c1fbb1bd 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -399,7 +399,20 @@ void QEglFSKmsDevice::createScreens() QVector screens; + int wantedConnectorIndex = -1; + bool ok; + int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_CONNECTOR_INDEX", &ok); + if (ok) { + if (idx >= 0 && idx < resources->count_connectors) + wantedConnectorIndex = idx; + else + qWarning("Invalid connector index %d", idx); + } + for (int i = 0; i < resources->count_connectors; i++) { + if (wantedConnectorIndex >= 0 && i != wantedConnectorIndex) + continue; + drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]); if (!connector) continue; -- cgit v1.2.3 From f30b88846566bc1254e5e6d61077092cdaeba409 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 2 Dec 2016 10:39:35 +0100 Subject: eglfs: allow forcing an overlay plane MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a QT_QPA_EGLFS_KMS_PLANE_INDEX environment variable that applies both to the GBM and EGLDevice backends. When set to a value between 0 and the number of planes on the connector - 1, the chosen overlay plane will be used for output, meaning there will be a drmModeSetPlane to configure, and, in case of EGLDevice, the plane's corresponding EGL layer will get chosen instead of the CRTC's. Task-number: QTBUG-57386 Change-Id: I12c89472ea5730987052f39211fadc597d1302ef Reviewed-by: Pasi Petäjäjärvi --- .../eglfs_kms/qeglfskmsgbmscreen.cpp | 37 ++++++++++++++++------ .../qeglfskmsegldeviceintegration.cpp | 15 +++++---- .../qeglfskmsegldevicescreen.cpp | 35 ++++++++++++++------ .../eglfs_kms_support/qeglfskmsdevice.cpp | 27 ++++++++++++++-- .../eglfs_kms_support/qeglfskmsscreen.h | 3 ++ 5 files changed, 89 insertions(+), 28 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index bed775ff81..d4df0dc66e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -181,24 +181,41 @@ void QEglFSKmsGbmScreen::flip() FrameBuffer *fb = framebufferForBufferObject(m_gbm_bo_next); - if (!output().mode_set) { - int ret = drmModeSetCrtc(device()->fd(), - output().crtc_id, + QEglFSKmsOutput &op(output()); + const int fd = device()->fd(); + const uint32_t w = op.modes[op.mode].hdisplay; + const uint32_t h = op.modes[op.mode].vdisplay; + + if (!op.mode_set) { + int ret = drmModeSetCrtc(fd, + op.crtc_id, fb->fb, 0, 0, - &output().connector_id, 1, - &output().modes[output().mode]); + &op.connector_id, 1, + &op.modes[op.mode]); - if (ret) { - qErrnoWarning("Could not set DRM mode!"); + if (ret == -1) { + qErrnoWarning(errno, "Could not set DRM mode!"); } else { - output().mode_set = true; + op.mode_set = true; setPowerState(PowerStateOn); + + if (!op.plane_set) { + op.plane_set = true; + if (op.wants_plane) { + int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id, + uint32_t(-1), 0, + 0, 0, w, h, + 0 << 16, 0 << 16, w << 16, h << 16); + if (ret == -1) + qErrnoWarning(errno, "drmModeSetPlane failed"); + } + } } } - int ret = drmModePageFlip(device()->fd(), - output().crtc_id, + int ret = drmModePageFlip(fd, + op.crtc_id, fb->fb, DRM_MODE_PAGE_FLIP_EVENT, this); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index b443a724ec..cf1de71831 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -39,11 +39,11 @@ ****************************************************************************/ #include "qeglfskmsegldeviceintegration.h" +#include "qeglfskmsegldevice.h" +#include "qeglfskmsegldevicescreen.h" #include #include "private/qeglfswindow_p.h" #include "private/qeglfscursor_p.h" -#include "qeglfskmsegldevice.h" -#include "qeglfskmsscreen.h" #include #include @@ -171,20 +171,23 @@ void QEglJetsonTK1Window::resetSurface() return; } - QEglFSKmsScreen *cur_screen = static_cast(screen()); + QEglFSKmsEglDeviceScreen *cur_screen = static_cast(screen()); Q_ASSERT(cur_screen); - qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", cur_screen->output().crtc_id); + QEglFSKmsOutput &output(cur_screen->output()); + const uint32_t wantedId = !output.wants_plane ? output.crtc_id : output.plane_id; + qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", wantedId); EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; for (int i = 0; i < actualCount; ++i) { EGLAttrib id; if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_CRTC_EXT, &id)) { qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - crtc %d", i, layers[i], (int) id); - if (id == EGLAttrib(cur_screen->output().crtc_id)) + if (id == EGLAttrib(wantedId)) layer = layers[i]; } else if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_PLANE_EXT, &id)) { - // Not used yet, just for debugging. qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - plane %d", i, layers[i], (int) id); + if (id == EGLAttrib(wantedId)) + layer = layers[i]; } else { qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - unknown", i, layers[i]); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp index 1f672afeb4..3935c99b9e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -67,13 +67,16 @@ QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const void QEglFSKmsEglDeviceScreen::waitForFlip() { - if (!output().mode_set) { - output().mode_set = true; + QEglFSKmsOutput &op(output()); + const int fd = device()->fd(); + const uint32_t w = op.modes[op.mode].hdisplay; + const uint32_t h = op.modes[op.mode].vdisplay; - drmModeCrtcPtr currentMode = drmModeGetCrtc(device()->fd(), output().crtc_id); - const bool alreadySet = currentMode - && currentMode->width == output().modes[output().mode].hdisplay - && currentMode->height == output().modes[output().mode].vdisplay; + if (!op.mode_set) { + op.mode_set = true; + + drmModeCrtcPtr currentMode = drmModeGetCrtc(fd, op.crtc_id); + const bool alreadySet = currentMode && currentMode->width == w && currentMode->height == h; if (currentMode) drmModeFreeCrtc(currentMode); if (alreadySet) { @@ -87,14 +90,26 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() } qCDebug(qLcEglfsKmsDebug, "Setting mode"); - int ret = drmModeSetCrtc(device()->fd(), output().crtc_id, + int ret = drmModeSetCrtc(fd, op.crtc_id, uint32_t(-1), 0, 0, - &output().connector_id, 1, - &output().modes[output().mode]); + &op.connector_id, 1, + &op.modes[op.mode]); if (ret) - qFatal("drmModeSetCrtc failed"); + qErrnoWarning(errno, "drmModeSetCrtc failed"); } + if (!op.plane_set) { + op.plane_set = true; + + if (op.wants_plane) { + qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.plane_id); + int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id, uint32_t(-1), 0, + 0, 0, w, h, + 0 << 16, 0 << 16, w << 16, h << 16); + if (ret == -1) + qErrnoWarning(errno, "drmModeSetPlane failed"); + } + } } QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index b3c1fbb1bd..75dd083750 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -329,9 +329,32 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc drmModeGetCrtc(m_dri_fd, crtc_id), modes, connector->subpixel, - connectorProperty(connector, QByteArrayLiteral("DPMS")) + connectorProperty(connector, QByteArrayLiteral("DPMS")), + false, + 0, + false }; + bool ok; + int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_PLANE_INDEX", &ok); + if (ok) { + drmModePlaneRes *planeResources = drmModeGetPlaneResources(m_dri_fd); + if (planeResources) { + if (idx >= 0 && idx < int(planeResources->count_planes)) { + drmModePlane *plane = drmModeGetPlane(m_dri_fd, planeResources->planes[idx]); + if (plane) { + output.wants_plane = true; + output.plane_id = plane->plane_id; + qCDebug(qLcEglfsKmsDebug, "Forcing plane index %d, plane id %u (belongs to crtc id %u)", + idx, plane->plane_id, plane->crtc_id); + drmModeFreePlane(plane); + } + } else { + qWarning("Invalid plane index %d, must be between 0 and %u", idx, planeResources->count_planes - 1); + } + } + } + m_crtc_allocator |= (1 << output.crtc_id); m_connector_allocator |= (1 << output.connector_id); @@ -406,7 +429,7 @@ void QEglFSKmsDevice::createScreens() if (idx >= 0 && idx < resources->count_connectors) wantedConnectorIndex = idx; else - qWarning("Invalid connector index %d", idx); + qWarning("Invalid connector index %d, must be between 0 and %u", idx, resources->count_connectors - 1); } for (int i = 0; i < resources->count_connectors; i++) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h index 2b6a0ffe6c..fa331f0931 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h @@ -67,6 +67,9 @@ struct QEglFSKmsOutput QList modes; int subpixel; drmModePropertyPtr dpms_prop; + bool wants_plane; + uint32_t plane_id; + bool plane_set; }; class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen -- cgit v1.2.3 From 5cc1265c340656b02f3bd2fccbadd29a21aa8704 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 1 Dec 2016 12:49:02 +0200 Subject: Add ASTC compression Change-Id: I7ae3b02579eb844f109c25a0dd5467748813a558 Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopengltexture.cpp | 170 ++++++++++++++++++++++++++++++++++++++ src/gui/opengl/qopengltexture.h | 28 +++++++ 2 files changed, 198 insertions(+) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 0a46eea85d..c9b08f60b1 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -410,6 +410,34 @@ static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat) case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: case QOpenGLTexture::RGBA8_ETC2_EAC: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: + case QOpenGLTexture::RGBA_ASTC_4x4: + case QOpenGLTexture::RGBA_ASTC_5x4: + case QOpenGLTexture::RGBA_ASTC_5x5: + case QOpenGLTexture::RGBA_ASTC_6x5: + case QOpenGLTexture::RGBA_ASTC_6x6: + case QOpenGLTexture::RGBA_ASTC_8x5: + case QOpenGLTexture::RGBA_ASTC_8x6: + case QOpenGLTexture::RGBA_ASTC_8x8: + case QOpenGLTexture::RGBA_ASTC_10x5: + case QOpenGLTexture::RGBA_ASTC_10x6: + case QOpenGLTexture::RGBA_ASTC_10x8: + case QOpenGLTexture::RGBA_ASTC_10x10: + case QOpenGLTexture::RGBA_ASTC_12x10: + case QOpenGLTexture::RGBA_ASTC_12x12: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12: return true; case QOpenGLTexture::RGB8_ETC1: @@ -703,6 +731,36 @@ static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpen case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: return QOpenGLTexture::RGBA; + case QOpenGLTexture::RGBA_ASTC_4x4: + case QOpenGLTexture::RGBA_ASTC_5x4: + case QOpenGLTexture::RGBA_ASTC_5x5: + case QOpenGLTexture::RGBA_ASTC_6x5: + case QOpenGLTexture::RGBA_ASTC_6x6: + case QOpenGLTexture::RGBA_ASTC_8x5: + case QOpenGLTexture::RGBA_ASTC_8x6: + case QOpenGLTexture::RGBA_ASTC_8x8: + case QOpenGLTexture::RGBA_ASTC_10x5: + case QOpenGLTexture::RGBA_ASTC_10x6: + case QOpenGLTexture::RGBA_ASTC_10x8: + case QOpenGLTexture::RGBA_ASTC_10x10: + case QOpenGLTexture::RGBA_ASTC_12x10: + case QOpenGLTexture::RGBA_ASTC_12x12: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12: + return QOpenGLTexture::RGBA; + case QOpenGLTexture::DepthFormat: return QOpenGLTexture::Depth; @@ -859,6 +917,34 @@ static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTe case QOpenGLTexture::RGBA8_ETC2_EAC: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: case QOpenGLTexture::RGB8_ETC1: + case QOpenGLTexture::RGBA_ASTC_4x4: + case QOpenGLTexture::RGBA_ASTC_5x4: + case QOpenGLTexture::RGBA_ASTC_5x5: + case QOpenGLTexture::RGBA_ASTC_6x5: + case QOpenGLTexture::RGBA_ASTC_6x6: + case QOpenGLTexture::RGBA_ASTC_8x5: + case QOpenGLTexture::RGBA_ASTC_8x6: + case QOpenGLTexture::RGBA_ASTC_8x8: + case QOpenGLTexture::RGBA_ASTC_10x5: + case QOpenGLTexture::RGBA_ASTC_10x6: + case QOpenGLTexture::RGBA_ASTC_10x8: + case QOpenGLTexture::RGBA_ASTC_10x10: + case QOpenGLTexture::RGBA_ASTC_12x10: + case QOpenGLTexture::RGBA_ASTC_12x12: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12: return QOpenGLTexture::UInt8; case QOpenGLTexture::DepthFormat: @@ -977,6 +1063,34 @@ static bool isCompressedFormat(QOpenGLTexture::TextureFormat internalFormat) case QOpenGLTexture::RGBA8_ETC2_EAC: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: case QOpenGLTexture::RGB8_ETC1: + case QOpenGLTexture::RGBA_ASTC_4x4: + case QOpenGLTexture::RGBA_ASTC_5x4: + case QOpenGLTexture::RGBA_ASTC_5x5: + case QOpenGLTexture::RGBA_ASTC_6x5: + case QOpenGLTexture::RGBA_ASTC_6x6: + case QOpenGLTexture::RGBA_ASTC_8x5: + case QOpenGLTexture::RGBA_ASTC_8x6: + case QOpenGLTexture::RGBA_ASTC_8x8: + case QOpenGLTexture::RGBA_ASTC_10x5: + case QOpenGLTexture::RGBA_ASTC_10x6: + case QOpenGLTexture::RGBA_ASTC_10x8: + case QOpenGLTexture::RGBA_ASTC_10x10: + case QOpenGLTexture::RGBA_ASTC_12x10: + case QOpenGLTexture::RGBA_ASTC_12x12: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12: return true; case QOpenGLTexture::DepthFormat: @@ -2037,6 +2151,34 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value RGBA8_ETC2_EAC Equivalent to GL_COMPRESSED_RGBA8_ETC2_EAC \value SRGB8_Alpha8_ETC2_EAC Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC \value RGB8_ETC1 Equivalent to GL_ETC1_RGB8_OES + \value RGBA_ASTC_4x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_4x4_KHR + \value RGBA_ASTC_5x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x4_KHR + \value RGBA_ASTC_5x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x5_KHR + \value RGBA_ASTC_6x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x5_KHR + \value RGBA_ASTC_6x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x6_KHR + \value RGBA_ASTC_8x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x5_KHR + \value RGBA_ASTC_8x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x6_KHR + \value RGBA_ASTC_8x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x8_KHR + \value RGBA_ASTC_10x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x5_KHR + \value RGBA_ASTC_10x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x6_KHR + \value RGBA_ASTC_10x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x8_KHR + \value RGBA_ASTC_10x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x10_KHR + \value RGBA_ASTC_12x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x10_KHR + \value RGBA_ASTC_12x12 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x12_KHR + \value SRGB8_Alpha8_ASTC_4x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR + \value SRGB8_Alpha8_ASTC_5x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR + \value SRGB8_Alpha8_ASTC_5x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR + \value SRGB8_Alpha8_ASTC_6x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR + \value SRGB8_Alpha8_ASTC_6x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR + \value SRGB8_Alpha8_ASTC_8x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR + \value SRGB8_Alpha8_ASTC_8x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR + \value SRGB8_Alpha8_ASTC_8x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR + \value SRGB8_Alpha8_ASTC_10x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR + \value SRGB8_Alpha8_ASTC_10x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR + \value SRGB8_Alpha8_ASTC_10x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR + \value SRGB8_Alpha8_ASTC_10x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR + \value SRGB8_Alpha8_ASTC_12x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR + \value SRGB8_Alpha8_ASTC_12x12 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR \value SRGB8 Equivalent to GL_SRGB8 \value SRGB8_Alpha8 Equivalent to GL_SRGB8_ALPHA8 @@ -2592,6 +2734,34 @@ void QOpenGLTexture::setFormat(TextureFormat format) case RGBAFormat: case LuminanceFormat: case LuminanceAlphaFormat: + case QOpenGLTexture::RGBA_ASTC_4x4: + case QOpenGLTexture::RGBA_ASTC_5x4: + case QOpenGLTexture::RGBA_ASTC_5x5: + case QOpenGLTexture::RGBA_ASTC_6x5: + case QOpenGLTexture::RGBA_ASTC_6x6: + case QOpenGLTexture::RGBA_ASTC_8x5: + case QOpenGLTexture::RGBA_ASTC_8x6: + case QOpenGLTexture::RGBA_ASTC_8x8: + case QOpenGLTexture::RGBA_ASTC_10x5: + case QOpenGLTexture::RGBA_ASTC_10x6: + case QOpenGLTexture::RGBA_ASTC_10x8: + case QOpenGLTexture::RGBA_ASTC_10x10: + case QOpenGLTexture::RGBA_ASTC_12x10: + case QOpenGLTexture::RGBA_ASTC_12x12: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10: + case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12: d->formatClass = FormatClass_Unique; break; } diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index 0a948488a6..d0a3bfec8b 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -208,6 +208,34 @@ public: RGBA8_ETC2_EAC = 0x9278, // GL_COMPRESSED_RGBA8_ETC2_EAC SRGB8_Alpha8_ETC2_EAC = 0x9279, // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC RGB8_ETC1 = 0x8D64, // GL_ETC1_RGB8_OES + RGBA_ASTC_4x4 = 0x93B0, // GL_COMPRESSED_RGBA_ASTC_4x4_KHR + RGBA_ASTC_5x4 = 0x93B1, // GL_COMPRESSED_RGBA_ASTC_5x4_KHR + RGBA_ASTC_5x5 = 0x93B2, // GL_COMPRESSED_RGBA_ASTC_5x5_KHR + RGBA_ASTC_6x5 = 0x93B3, // GL_COMPRESSED_RGBA_ASTC_6x5_KHR + RGBA_ASTC_6x6 = 0x93B4, // GL_COMPRESSED_RGBA_ASTC_6x6_KHR + RGBA_ASTC_8x5 = 0x93B5, // GL_COMPRESSED_RGBA_ASTC_8x5_KHR + RGBA_ASTC_8x6 = 0x93B6, // GL_COMPRESSED_RGBA_ASTC_8x6_KHR + RGBA_ASTC_8x8 = 0x93B7, // GL_COMPRESSED_RGBA_ASTC_8x8_KHR + RGBA_ASTC_10x5 = 0x93B8, // GL_COMPRESSED_RGBA_ASTC_10x5_KHR + RGBA_ASTC_10x6 = 0x93B9, // GL_COMPRESSED_RGBA_ASTC_10x6_KHR + RGBA_ASTC_10x8 = 0x93BA, // GL_COMPRESSED_RGBA_ASTC_10x8_KHR + RGBA_ASTC_10x10 = 0x93BB, // GL_COMPRESSED_RGBA_ASTC_10x10_KHR + RGBA_ASTC_12x10 = 0x93BC, // GL_COMPRESSED_RGBA_ASTC_12x10_KHR + RGBA_ASTC_12x12 = 0x93BD, // GL_COMPRESSED_RGBA_ASTC_12x12_KHR + SRGB8_Alpha8_ASTC_4x4 = 0x93D0, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR + SRGB8_Alpha8_ASTC_5x4 = 0x93D1, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR + SRGB8_Alpha8_ASTC_5x5 = 0x93D2, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR + SRGB8_Alpha8_ASTC_6x5 = 0x93D3, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR + SRGB8_Alpha8_ASTC_6x6 = 0x93D4, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR + SRGB8_Alpha8_ASTC_8x5 = 0x93D5, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR + SRGB8_Alpha8_ASTC_8x6 = 0x93D6, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR + SRGB8_Alpha8_ASTC_8x8 = 0x93D7, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR + SRGB8_Alpha8_ASTC_10x5 = 0x93D8, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR + SRGB8_Alpha8_ASTC_10x6 = 0x93D9, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR + SRGB8_Alpha8_ASTC_10x8 = 0x93DA, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR + SRGB8_Alpha8_ASTC_10x10 = 0x93DB, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR + SRGB8_Alpha8_ASTC_12x10 = 0x93DC, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR + SRGB8_Alpha8_ASTC_12x12 = 0x93DD, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR // sRGB formats SRGB8 = 0x8C41, // GL_SRGB8 -- cgit v1.2.3 From e3b6f6d16577c74433de1ca9e15402cdf285abca Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 18 Nov 2016 16:33:12 +0100 Subject: Fix blending of RGB32 on RGB32 with partial opacity The alpha channel of an RGB32 image was not properly ignored when doing blending with partial opacity. Now the alpha value is properly ignored, which is both more correct and faster. This also makes SSE2 and AVX2 implementations match NEON which was already doing the right thing (though had dead code for doing it wrong). Change-Id: I4613b8d70ed8c2e36ced10baaa7a4a55bd36a940 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qblendfunctions.cpp | 30 ++++++++++++++--------- src/gui/painting/qdrawhelper_avx2.cpp | 8 +++--- src/gui/painting/qdrawhelper_neon.cpp | 2 -- src/gui/painting/qdrawhelper_sse2.cpp | 11 +++------ tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 20 +++++++++++++++ 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 0a5d458532..a4a091a29f 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -385,19 +385,25 @@ void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl, destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); fflush(stdout); #endif - - if (const_alpha != 256) { - qt_blend_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); - return; - } - const uint *src = (const uint *) srcPixels; uint *dst = (uint *) destPixels; - int len = w * 4; - for (int y=0; y> 8; + int ialpha = 255 - const_alpha; + for (int y=0; y Date: Tue, 29 Nov 2016 16:56:42 +0100 Subject: tst_qsqlquery.cpp: Refactor runIntegralTypesMysqlTest() Change 3370ab9119df09ca14f7d4641c555e60c1b3f478 introduced warnings from MSVC: tst_qsqlquery.cpp(4005): warning C4805: '==': unsafe mix of type 'const bool' and type 'int' in operation tst_qsqlquery.cpp(4059): note: see reference to function template instantiation 'void runIntegralTypesMysqlTest(QSqlDatabase &,const QString &,const QString &,const bool,const T,const T)' being compiled with [ T=bool ] tst_qsqlquery.cpp(4006): warning C4805: '==': unsafe mix of type 'const bool' and type 'int' in operation tst_qsqlquery.cpp(4006): warning C4804: '/': unsafe use of type 'bool' in operation tst_qsqlquery.cpp(4026): warning C4804: '+=': unsafe use of type 'bool' in operation Extract an overload taking a QVector of values and use that for the bool case instead of looping over min/max to generate a sequence of values for bool. Change-Id: I72583774e788b8df899f22ed1a64278217e664f6 Reviewed-by: Milian Wolff --- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 44 ++++++++++++++--------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 84e9643e77..8deb5ddf8f 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -3995,35 +3995,29 @@ void tst_QSqlQuery::aggregateFunctionTypes() } template -void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const QString &type, const bool withPreparedStatement, - const T min = std::numeric_limits::min(), const T max = std::numeric_limits::max()) +void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, + const QString &type, bool withPreparedStatement, + const QVector &values) { + QVector variantValues; + variantValues.reserve(values.size()); + QSqlQuery q(db); QVERIFY_SQL(q, exec("DROP TABLE IF EXISTS " + tableName)); QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ')')); - const int steps = (max == min + 1) ? 2 : 20; - const T increment = (max == min + 1) ? 1 : (max / steps - min / steps); - - // insert some values - QVector values; - QVector variantValues; - values.resize(steps); - variantValues.resize(steps); - T v = min; if (withPreparedStatement) { QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (id) VALUES (?)")); } for (int i = 0; i < values.size(); ++i) { + const T v = values.at(i); if (withPreparedStatement) { q.bindValue(0, v); QVERIFY_SQL(q, exec()); } else { QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + QLatin1Char(')'))); } - values[i] = v; - variantValues[i] = QVariant::fromValue(v); - v += increment; + variantValues.append(QVariant::fromValue(v)); } // ensure we can read them back properly @@ -4048,16 +4042,34 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const QCOMPARE(actualVariantValues, variantValues); } +template +void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, + const QString &type, const bool withPreparedStatement, + const T min = std::numeric_limits::min(), + const T max = std::numeric_limits::max()) +{ + // insert some values + const int steps = 20; + const T increment = (max / steps - min / steps); + QVector values; + values.reserve(steps); + T v = min; + for (int i = 0; i < steps; ++i, v += increment) + values.append(v); + runIntegralTypesMysqlTest(db, tableName, type, withPreparedStatement, values); +} + void tst_QSqlQuery::integralTypesMysql() { QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QVector boolValues = QVector() << false << true; for (int i = 0; i < 2; ++i) { const bool withPreparedStatement = (i == 1); - runIntegralTypesMysqlTest(db, "tinyInt1Test", "TINYINT(1)", withPreparedStatement); - runIntegralTypesMysqlTest(db, "unsignedTinyInt1Test", "TINYINT(1) UNSIGNED", withPreparedStatement); + runIntegralTypesMysqlTest(db, "tinyInt1Test", "TINYINT(1)", withPreparedStatement, boolValues); + runIntegralTypesMysqlTest(db, "unsignedTinyInt1Test", "TINYINT(1) UNSIGNED", withPreparedStatement, boolValues); runIntegralTypesMysqlTest(db, "tinyIntTest", "TINYINT", withPreparedStatement); runIntegralTypesMysqlTest(db, "unsignedTinyIntTest", "TINYINT UNSIGNED", withPreparedStatement); runIntegralTypesMysqlTest(db, "smallIntTest", "SMALLINT", withPreparedStatement); -- cgit v1.2.3 From 6ff4d8c61afc2ede16d60195dc30ea6538e2d5c9 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 5 Dec 2016 13:18:57 +0100 Subject: QTest::addColumn: Use nullptr instead of 0 Fixes -Wzero-as-null-pointer-constant warning in user code Change-Id: I59492633d14947e90e91efa7c4fcd14c33fa413e Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/testlib/qtestcase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index c3ccfc3f8c..4c226830e9 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -309,7 +309,7 @@ namespace QTest Q_TESTLIB_EXPORT void addColumnInternal(int id, const char *name); template - inline void addColumn(const char *name, T * = 0) + inline void addColumn(const char *name, T * = nullptr) { typedef std::is_same QIsSameTConstChar; Q_STATIC_ASSERT_X(!QIsSameTConstChar::value, "const char* is not allowed as a test data format."); -- cgit v1.2.3 From 3c4febf5571e2a34846e6377688676dbd034556b Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Mon, 5 Dec 2016 13:50:53 +0100 Subject: Fix using 0 as null pointer Fixes: error: zero as null pointer constant. Change-Id: I850d51075263dac6dd135d3cadc136cbd08b40ab Reviewed-by: Thiago Macieira --- src/dbus/qdbuspendingreply.h | 4 ++-- src/dbus/qdbusreply.h | 2 +- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h index 786eab2120..da29894d15 100644 --- a/src/dbus/qdbuspendingreply.h +++ b/src/dbus/qdbuspendingreply.h @@ -77,7 +77,7 @@ namespace QDBusPendingReplyTypes { typedef T1 Type; }; - template inline int metaTypeFor(T1 * = 0) + template inline int metaTypeFor(T1 * = nullptr) { return qMetaTypeId(); } // specialize for QVariant, allowing it to be used in place of QDBusVariant template<> inline int metaTypeFor(QVariant *) @@ -91,7 +91,7 @@ namespace QDBusPendingReplyTypes { enum { Total = Next::Total + 1 }; static inline void fillMetaTypes(int *p) { - *p = metaTypeFor(0); + *p = metaTypeFor(nullptr); Next::fillMetaTypes(++p); } }; diff --git a/src/dbus/qdbusreply.h b/src/dbus/qdbusreply.h index b6a454d240..227615024a 100644 --- a/src/dbus/qdbusreply.h +++ b/src/dbus/qdbusreply.h @@ -66,7 +66,7 @@ public: } inline QDBusReply& operator=(const QDBusMessage &reply) { - QVariant data(qMetaTypeId(), reinterpret_cast(0)); + QVariant data(qMetaTypeId(), nullptr); qDBusReplyFill(reply, m_error, data); m_data = qvariant_cast(data); return *this; diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 2f9721b175..cdf3ad3310 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -514,7 +514,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf // constructors/destructors: hs << "public:" << endl - << " " << className << "(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);" << endl + << " " << className << "(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);" << endl << endl << " ~" << className << "();" << endl << endl; -- cgit v1.2.3 From 0382bb2ab830898fa14b6e42d5ca1b105f6693a7 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 5 Dec 2016 22:04:25 +0000 Subject: Fix crash when dragging a tab off QDockWidgetGroupWindow Crashes later in QMainWindowLayout::hover() Change-Id: Ibf1085ebfa7b0edcbd1662b0300550788b7f9c33 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qdockwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 1df7259aba..c9cb826213 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -797,8 +797,10 @@ void QDockWidgetPrivate::endDrag(bool abort) if (abort || !mwLayout->plug(state->widgetItem)) { if (hasFeature(this, QDockWidget::DockWidgetFloatable)) { // This QDockWidget will now stay in the floating state. - if (state->ownWidgetItem) + if (state->ownWidgetItem) { delete state->widgetItem; + state->widgetItem = nullptr; + } mwLayout->restore(); QDockWidgetLayout *dwLayout = qobject_cast(layout); if (!dwLayout->nativeWindowDeco()) { -- cgit v1.2.3 From 506aa694a9e466f04c392d814b02c2130611dce6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 16 Nov 2016 16:25:11 +0100 Subject: Cleanup convert_ARGB_to_ARGB_PM_inplace_sse2 Changes it to follow standard SIMD patterns so it can use ALIGNMENT_PROLOGUE_16BYTES and SIMD_EPILOGUE helpers. Should also improve performance by using aligned memory access. Change-Id: I14a48b82e3f3de83bd7572aa82bed07f28ad944c Reviewed-by: Erik Verbruggen --- src/gui/image/qimage_sse2.cpp | 59 +++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/src/gui/image/qimage_sse2.cpp b/src/gui/image/qimage_sse2.cpp index 0fb92e9d43..8f7195e0b5 100644 --- a/src/gui/image/qimage_sse2.cpp +++ b/src/gui/image/qimage_sse2.cpp @@ -51,51 +51,66 @@ bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionF { Q_ASSERT(data->format == QImage::Format_ARGB32 || data->format == QImage::Format_RGBA8888); - // extra pixels on each line - const int spare = data->width & 3; - // width in pixels of the pad at the end of each line - const int pad = (data->bytes_per_line >> 2) - data->width; - const int iter = data->width >> 2; - int height = data->height; + const int width = data->width; + const int height = data->height; + const int bpl = data->bytes_per_line; const __m128i alphaMask = _mm_set1_epi32(0xff000000); const __m128i nullVector = _mm_setzero_si128(); const __m128i half = _mm_set1_epi16(0x80); const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); - __m128i *d = reinterpret_cast<__m128i*>(data->data); - while (height--) { - const __m128i *end = d + iter; - - for (; d != end; ++d) { - const __m128i srcVector = _mm_loadu_si128(d); + uchar *d = data->data; + for (int y = 0; y < height; ++y) { + int i = 0; + quint32 *d32 = reinterpret_cast(d); + ALIGNMENT_PROLOGUE_16BYTES(d, i, width) { + const quint32 p = d32[i]; + if (p <= 0x00ffffff) + d32[i] = 0; + else if (p < 0xff000000) + d32[i] = qPremultiply(p); + } + __m128i *d128 = reinterpret_cast<__m128i *>(d32 + i); + for (; i < (width - 3); i += 4) { + const __m128i srcVector = _mm_load_si128(d128); +#ifdef __SSE4_1__ + if (_mm_testc_si128(srcVector, alphaMask)) { + // opaque, data is unchanged + } else if (_mm_testz_si128(srcVector, alphaMask)) { + // fully transparent + _mm_store_si128(d128, nullVector); + } else { + const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); +#else const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { // opaque, data is unchanged } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) == 0xffff) { // fully transparent - _mm_storeu_si128(d, nullVector); + _mm_store_si128(d128, nullVector); } else { +#endif __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); __m128i result; BYTE_MUL_SSE2(result, srcVector, alphaChannel, colorMask, half); result = _mm_or_si128(_mm_andnot_si128(alphaMask, result), srcVectorAlpha); - _mm_storeu_si128(d, result); + _mm_store_si128(d128, result); } + d128++; } - QRgb *p = reinterpret_cast(d); - QRgb *pe = p+spare; - for (; p != pe; ++p) { - if (*p < 0x00ffffff) - *p = 0; - else if (*p < 0xff000000) - *p = qPremultiply(*p); + SIMD_EPILOGUE(i, width, 3) { + const quint32 p = d32[i]; + if (p <= 0x00ffffff) + d32[i] = 0; + else if (p < 0xff000000) + d32[i] = qPremultiply(p); } - d = reinterpret_cast<__m128i*>(p+pad); + d += bpl; } if (data->format == QImage::Format_ARGB32) -- cgit v1.2.3 From 141be52f2f5a0029a7ee4ca3ab211fd2576c02b1 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 30 Nov 2016 15:31:00 +0100 Subject: Merge the two features for shared memory Change-Id: Ic7bd27b289b755c801e3c510c44b2afe9a253bd8 Reviewed-by: Oswald Buddenhagen --- src/corelib/configure.json | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 89f824d880..c170b38977 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -355,11 +355,6 @@ "condition": "features.statemachine", "output": [ "publicFeature" ] }, - "sharedmemory": { - "label": "Enable QSharedMemory", - "condition": "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix", - "output": [ { "type": "define", "negative": true, "name": "QT_NO_SHAREDMEMORY" } ] - }, "slog2": { "label": "slog2", "condition": "libs.slog2", @@ -395,7 +390,9 @@ "label": "QSharedMemory", "purpose": "Provides access to a shared memory segment.", "section": "Kernel", - "condition": "!config.vxworks", + "condition": [ + "config.android || config.win32 || (!config.vxworks && (tests.ipc_sysv || tests.ipc_posix))" + ], "output": [ "publicFeature", "feature" ] }, "systemsemaphore": { -- cgit v1.2.3 From 86ccc843574eb57c6bb6d68e96c56b7cbcbb66f0 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 6 Dec 2016 23:59:40 +0300 Subject: eglfs: Add missing override Change-Id: I257cfb29b919de5d4876d39e0512815c6ed24a88 Reviewed-by: Laszlo Agocs --- .../eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp index f9924fe5ce..0a547b832f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp @@ -55,7 +55,7 @@ public: EventReader(QEglFSX11Integration *integration) : m_integration(integration) { } - void run(); + void run() override; private: QEglFSX11Integration *m_integration; -- cgit v1.2.3 From 074b9f1eef6ec48ed66db14699dbc74141fa63b5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 5 Dec 2016 16:13:40 +0100 Subject: Make reported build type match old configure Adds platform and CPU features to the reported build type, matching the format of the old configure. Started-by: Allan Sandfeld Jensen Change-Id: I6d93ec7416b38684da51af5238a5cf537810b21d Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Thiago Macieira --- configure.pri | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/configure.pri b/configure.pri index 19719736a9..dc749cd6d4 100644 --- a/configure.pri +++ b/configure.pri @@ -510,12 +510,19 @@ defineTest(qtConfReport_buildParts) { qtConfReportPadded($${1}, $$qtConfEvaluate("tests.build_parts.value")) } +defineReplace(qtConfReportArch) { + arch = $$qtConfEvaluate('tests.$${1}.arch') + subarch = $$qtConfEvaluate('tests.$${1}.subarch') + isEmpty(subarch): subarch = + return("$$arch, CPU features: $$subarch") +} + defineTest(qtConfReport_buildTypeAndConfig) { !$$qtConfEvaluate("features.cross_compile") { - qtConfAddReport("Build type: $$qtConfEvaluate('tests.architecture.arch')") + qtConfAddReport("Build type: $$[QMAKE_SPEC] ($$qtConfReportArch(architecture))") } else { - qtConfAddReport("Building on: $$qtConfEvaluate('tests.host_architecture.arch')") - qtConfAddReport("Building for: $$qtConfEvaluate('tests.architecture.arch')") + qtConfAddReport("Building on: $$[QMAKE_SPEC] ($$qtConfReportArch(host_architecture))") + qtConfAddReport("Building for: $$[QMAKE_XSPEC] ($$qtConfReportArch(architecture))") } qtConfAddReport() qtConfAddReport("Configuration: $$eval($${currentConfig}.output.privatePro.append.CONFIG) $$eval($${currentConfig}.output.publicPro.append.QT_CONFIG)") -- cgit v1.2.3 From f882d2f443a8950a2f784fa91b3ff10a645577f7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 7 Dec 2016 13:03:44 +0100 Subject: Fix qdrawhelper function toRGB64 The function was incorrectly handling green and blue color channels causing them to be dropped. This affects drawing non 32-bit images onto 10-bit per color channels formats such as RGB30. Change-Id: I9211e253b1a9da0dada5c418d592a8f531265989 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qdrawhelper.cpp | 4 ++-- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 64956d342d..8700a0fce1 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -217,8 +217,8 @@ static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *sr uint green = (src[i] >> greenShift()) & greenMask; uint blue = (src[i] >> blueShift()) & blueMask; - red = ((red << redLeftShift) | (red >> redRightShift)) << 16; - green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8; + red = ((red << redLeftShift) | (red >> redRightShift)); + green = ((green << greenLeftShift) | (green >> greenRightShift)); blue = (blue << blueLeftShift) | (blue >> blueRightShift); buffer[i] = QRgba64::fromRgba(red, green, blue, 255); } diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index c729b2f94c..cf4979e291 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -301,6 +301,7 @@ private slots: void QTBUG56252(); void blendNullRGB32(); + void toRGB64(); private: void fillData(); @@ -5159,6 +5160,21 @@ void tst_QPainter::blendNullRGB32() QVERIFY(image.pixel(i,0) != 0xffffffff); } +void tst_QPainter::toRGB64() +{ + QImage dst(10, 1, QImage::Format_BGR30); + QImage src(10, 1, QImage::Format_RGB16); + src.fill(Qt::white); + + QPainter paint(&dst); + paint.drawImage(0, 0, src); + paint.end(); + + for (int i=0; i < dst.width(); ++i) { + QVERIFY(dst.pixelColor(i,0) == QColor(Qt::white)); + } +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v1.2.3 From e2978d6097be2313e49c57ec14618033cbfa7414 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 18:17:49 +0100 Subject: move license check to qmake-based configure system this also removes the need for passing pre-processed options via configure.cfg, so get rid of that. a somewhat unfortunate side effect is that the android-style-assets feature had to move back to the top level, as the licensing options depend on it. Started-by: Lars Knoll Change-Id: Id4d1e0ba18b3e3104400293b8f0c7f2f65e68dea Reviewed-by: Lars Knoll --- configure | 195 ++-------------------------------- configure.json | 12 +++ configure.pri | 166 ++++++++++++++++++++++++++++- mkspecs/features/qt_configure.prf | 14 ++- src/gui/configure.json | 6 -- tools/configure/Makefile.mingw | 4 +- tools/configure/Makefile.win32 | 4 +- tools/configure/configure.pro | 4 +- tools/configure/configureapp.cpp | 216 +++----------------------------------- tools/configure/configureapp.h | 6 -- tools/configure/environment.cpp | 25 ----- tools/configure/environment.h | 1 - tools/configure/main.cpp | 7 -- tools/configure/tools.cpp | 79 -------------- tools/configure/tools.h | 43 -------- 15 files changed, 213 insertions(+), 569 deletions(-) delete mode 100644 tools/configure/tools.cpp delete mode 100644 tools/configure/tools.h diff --git a/configure b/configure index bc18e614d2..48dea87fb7 100755 --- a/configure +++ b/configure @@ -400,13 +400,6 @@ UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -# detect the "echo without newline" style. usage: echo $ECHO_N "$ECHO_C" -if echo '\c' | grep '\c' >/dev/null; then - ECHO_N=-n -else - ECHO_C='\c' -fi - BUILD_ON_MAC=no if [ -d /System/Library/Frameworks/Carbon.framework ]; then BUILD_ON_MAC=yes @@ -469,7 +462,6 @@ unset QTDIR # initalize internal variables CFG_RELEASE_TOOLS=no -CFG_ANDROID_STYLE_ASSETS=yes XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" XPLATFORM_MAC=no # Whether target platform is macOS, iOS, tvOS, or watchOS @@ -790,12 +782,6 @@ while [ "$#" -gt 0 ]; do android-toolchain-version) CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL" ;; - android-style-assets) - # Required to be able to show the correct license text - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_ANDROID_STYLE_ASSETS="$VAL" - fi - ;; *) ;; esac @@ -1007,168 +993,6 @@ case "$XPLATFORM" in ;; esac -#------------------------------------------------------------------------------- -# check the license -#------------------------------------------------------------------------------- - -if [ "$COMMERCIAL_USER" = "ask" ]; then - while true; do - echo "Which edition of Qt do you want to use ?" - echo - echo "Type 'c' if you want to use the Commercial Edition." - echo "Type 'o' if you want to use the Open Source Edition." - echo - read commercial - echo - if [ "$commercial" = "c" ]; then - COMMERCIAL_USER="yes" - OPT_CMDLINE="$OPT_CMDLINE --commercial" - break - elif [ "$commercial" = "o" ]; then - COMMERCIAL_USER="no" - OPT_CMDLINE="$OPT_CMDLINE --opensource" - break - fi - done -fi - -if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then - # Commercial preview release - Licensee="Preview" - Edition="Preview" - EditionString="Technology Preview" -elif [ $COMMERCIAL_USER = "yes" ]; then - if [ $UNAME_SYSTEM = "Linux" ]; then - case "$PLATFORM" in - *-32) - Licheck=licheck32 - ;; - *-64) - Licheck=licheck64 - ;; - *) - if file -L /bin/sh | grep -q "64-bit" ; then - Licheck=licheck64 - else - Licheck=licheck32 - fi - ;; - esac - elif [ $UNAME_SYSTEM = "Darwin" ]; then - Licheck=licheck_mac - else - echo >&2 "Host operating system not supported by this edition of Qt." - exit 1 - fi - if [ -x "$relpath/bin/$Licheck" ]; then - LicheckOutput=`$relpath/bin/$Licheck $OPT_CONFIRM_LICENSE $relpath $outpath\ - $PLATFORM $XPLATFORM` - if [ $? -ne 0 ]; then - exit 1 - else - eval "$LicheckOutput" - fi - else - echo - echo "Error: This is the Open Source version of Qt." - echo "If you want to use Enterprise features of Qt," - echo "use the contact form at http://www.qt.io/contact-us" - echo "to purchase a license." - echo - exit 1 - fi -elif [ $COMMERCIAL_USER = "no" ]; then - # Open Source edition - may only be used under the terms of the LGPLv3 or GPLv2. - Licensee="Open Source" - Edition="OpenSource" - EditionString="Open Source" -fi - -if [ "$Edition" = "OpenSource" ] || [ "$Edition" = "Preview" ]; then - echo - echo "This is the Qt ${EditionString} Edition." - echo -fi - -if [ "$Edition" = "OpenSource" ]; then - while true; do - if [ "$CFG_ANDROID_STYLE_ASSETS" = "no" ] || [ "$XPLATFORM_ANDROID" = "no" ]; then - echo "You are licensed to use this software under the terms of" - echo "the GNU Lesser General Public License (LGPL) version 3." - echo "You are also licensed to use this software under the terms of" - echo "the GNU General Public License (GPL) version 2." - affix="either" - showGPL2="yes" - else - echo "You are licensed to use this software under the terms of" - echo "the GNU Lesser General Public License (LGPL) version 3." - showGPL2="no" - affix="the" - fi - - echo - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $EditionString license." - acceptance=yes - else - if [ -f "$relpath/LICENSE.LGPL3" ]; then - echo "Type 'L' to view the GNU Lesser General Public License version 3." - fi - if [ "$showGPL2" = "yes" ]; then - echo "Type 'G' to view the GNU General Public License version 2." - fi - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then - break - elif [ "$acceptance" = "no" ]; then - echo "You are not licensed to use this software." - echo - exit 1 - elif [ "$acceptance" = "L" ]; then - more "$relpath/LICENSE.LGPL3" - elif [ "$acceptance" = "G" ] && [ "$showGPL2" = "yes" ]; then - more "$relpath/LICENSE.GPL2" - fi - done -elif [ "$Edition" = "Preview" ]; then - TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"` - while true; do - - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $EditionString license." - acceptance=yes - else - echo "You are licensed to use this software under the terms of" - echo "the $TheLicense" - echo - echo "Type '?' to read the Preview License." - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of the license? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ]; then - break - elif [ "$acceptance" = "no" ] ;then - echo "You are not licensed to use this software." - echo - exit 0 - elif [ "$acceptance" = "?" ]; then - more "$relpath/LICENSE.PREVIEW.COMMERCIAL" - fi - done -fi - #------------------------------------------------------------------------------- # command line and environment validation #------------------------------------------------------------------------------- @@ -1805,16 +1629,6 @@ fi # run configure tests #------------------------------------------------------------------------------- -# copy some variables that are still being computed in the shell script into an input file for configure -# This should go away in the future - -cat > "$outpath/config.tests/configure.cfg" </dev/null 2>&1; then + OPT_CMDLINE="$OPT_CMDLINE +-opensource" + else + OPT_CMDLINE="$OPT_CMDLINE +-commercial" + fi + fi if [ "$OPT_CONFIRM_LICENSE" = "no" ]; then OPT_CMDLINE="$OPT_CMDLINE -confirm-license" diff --git a/configure.json b/configure.json index f774291d22..5a5536936a 100644 --- a/configure.json +++ b/configure.json @@ -56,6 +56,7 @@ "android-toolchain-version": "string", "accessibility": "boolean", + "android-style-assets": "boolean", "avx": "boolean", "avx2": "boolean", "avx512": { "type": "boolean", "name": "avx512f" }, @@ -417,6 +418,12 @@ }, "features": { + "android-style-assets": { + "label": "Android Style Assets", + "condition": "config.android", + "output": [ "privateFeature" ], + "comment": "This belongs into gui, but the license check needs it here already." + }, "shared": { "label": "Building shared libraries", "condition": "!config.uikit && !config.integrity", @@ -962,6 +969,11 @@ }, "earlyReport": [ + { + "type": "fatal", + "condition": "!call.licenseCheck", + "message": "You are not licensed to use this software." + }, { "type": "warning", "condition": "input.debug_and_release == 'yes' && !config.darwin && !config.win32", diff --git a/configure.pri b/configure.pri index dc749cd6d4..526b09e965 100644 --- a/configure.pri +++ b/configure.pri @@ -1,3 +1,7 @@ +# this must be done outside any function +QT_SOURCE_TREE = $$PWD +QT_BUILD_TREE = $$shadowed($$PWD) + # custom command line handling defineTest(qtConfCommandline_qmakeArgs) { @@ -63,6 +67,165 @@ defineReplace(qtConfFunc_crossCompile) { return(false) } +defineReplace(qtConfFunc_licenseCheck) { + exists($$QT_SOURCE_TREE/LICENSE.LGPL3)|exists($$QT_SOURCE_TREE/LICENSE.GPL2): \ + hasOpenSource = true + else: \ + hasOpenSource = false + exists($$QT_SOURCE_TREE/LICENSE.PREVIEW.COMMERCIAL)|exists($$QT_SOURCE_TREE/bin/licheck*): \ + hasCommercial = true + else: \ + hasCommercial = false + + commercial = $$config.input.commercial + isEmpty(commercial) { + $$hasOpenSource { + $$hasCommercial { + logn() + logn("Selecting Qt Edition.") + logn() + logn("Type 'c' if you want to use the Commercial Edition.") + logn("Type 'o' if you want to use the Open Source Edition.") + logn() + for(ever) { + val = $$lower($$prompt("Which edition of Qt do you want to use? ", false)) + equals(val, c) { + commercial = yes + } else: equals(val, o) { + commercial = no + } else { + next() + } + break() + } + } else { + commercial = no + } + } else { + !$$hasCommercial: \ + qtConfFatalError("No license files and no licheck executables found." \ + "Cannot proceed. Try re-installing Qt.") + commercial = yes + } + } + + equals(commercial, no) { + !$$hasOpenSource: \ + qtConfFatalError("This is the Qt Commercial Edition." \ + "Cannot proceed with -opensource.") + + logn() + logn("This is the Qt Open Source Edition.") + + EditionString = "Open Source" + config.input.qt_edition = OpenSource + export(config.input.qt_edition) + } else { + !$$hasCommercial: \ + qtConfFatalError("This is the Qt Open Source Edition." \ + "Cannot proceed with -commercial.") + + exists($$QT_SOURCE_TREE/LICENSE.PREVIEW.COMMERCIAL) { + logn() + logn("This is the Qt Technology Preview Edition.") + + EditionString = "Technology Preview" + config.input.qt_edition = Preview + export(config.input.qt_edition) + } else { + equals(QMAKE_HOST.os, Linux) { + equals(QMAKE_HOST.arch, x86): \ + Licheck = licheck32 + else: \ + Licheck = licheck64 + } else: equals(QMAKE_HOST.os, Darwin) { + Licheck = licheck_mac + } else: equals(QMAKE_HOST.os, Windows) { + Licheck = licheck.exe + } else { + qtConfFatalError("Host operating system not supported by this edition of Qt.") + } + + !qtRunLoggedCommand("$$system_quote($$QT_SOURCE_TREE/bin/$$Licheck) \ + $$eval(config.input.confirm-license) \ + $$system_quote($$QT_SOURCE_TREE) $$system_quote($$QT_BUILD_TREE) \ + $$[QMAKE_SPEC] $$[QMAKE_XSPEC]", \ + LicheckOutput): \ + return(false) + eval($$LicheckOutput) + config.input.qt_edition = $$Edition + config.input.qt_licheck = $$Licheck + config.input.qt_release_date = $$ReleaseDate + export(config.input.qt_edition) + export(config.input.qt_licheck) + export(config.input.qt_release_date) + return(true) + } + } + + !isEmpty(config.input.confirm-license) { + logn() + logn("You have already accepted the terms of the $$EditionString license.") + return(true) + } + + affix = the + equals(commercial, no) { + theLicense = "GNU Lesser General Public License (LGPL) version 3" + showWhat = "Type 'L' to view the GNU Lesser General Public License version 3 (LGPLv3)." + gpl2Ok = false + winrt { + notTheLicense = "Note: GPL version 2 is not available on WinRT." + } else: $$qtConfEvaluate("features.android-style-assets") { + notTheLicense = "Note: GPL version 2 is not available due to using Android style assets." + } else { + theLicense += "or the GNU General Public License (GPL) version 2" + showWhat += "Type 'G' to view the GNU General Public License version 2 (GPLv2)." + gpl2Ok = true + affix = either + } + } else { + theLicense = $$cat($$QT_SOURCE_TREE/LICENSE.PREVIEW.COMMERCIAL, lines) + theLicense = $$first(theLicense) + showWhat = "Type '?' to view the $${theLicense}." + } + msg = \ + " " \ + "You are licensed to use this software under the terms of" \ + "the "$$theLicense"." \ + $$notTheLicense \ + " " \ + $$showWhat \ + "Type 'y' to accept this license offer." \ + "Type 'n' to decline this license offer." \ + " " + + for(ever) { + logn($$join(msg, $$escape_expand(\\n))) + for(ever) { + val = $$lower($$prompt("Do you accept the terms of $$affix license? ", false)) + equals(val, y)|equals(val, yes) { + logn() + return(true) + } else: equals(val, n)|equals(val, no) { + return(false) + } else: equals(commercial, yes):equals(val, ?) { + licenseFile = $$QT_SOURCE_TREE/LICENSE.PREVIEW.COMMERCIAL + } else: equals(commercial, no):equals(val, l) { + licenseFile = $$QT_SOURCE_TREE/LICENSE.LGPL3 + } else: equals(commercial, no):equals(val, g):$$gpl2Ok { + licenseFile = $$QT_SOURCE_TREE/LICENSE.GPL2 + } else { + next() + } + break() + } + system("more $$system_quote($$system_path($$licenseFile))") + logn() + logn() + } +} + # custom tests defineTest(qtConfTest_architecture) { @@ -559,6 +722,3 @@ discard_from($$[QT_HOST_DATA/get]/mkspecs/qmodule.pri) QMAKE_POST_CONFIGURE += \ "include(\$\$[QT_HOST_DATA/get]/mkspecs/qconfig.pri)" \ "include(\$\$[QT_HOST_DATA/get]/mkspecs/qmodule.pri)" - -# load and process input from configure.sh/.exe -include($$shadowed($$PWD)/config.tests/configure.cfg) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index eaaa161270..74ad611ee5 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -28,6 +28,12 @@ defineTest(qtConfAddError) { } } +defineTest(qtConfFatalError) { + qtConfAddError($$1, $$2) + qtConfPrintReport() + error() +} + defineTest(qtConfCommandlineSetInput) { arg = $${1} val = $${2} @@ -778,9 +784,7 @@ defineTest(qtConfTest_compile) { defineTest(qtConfTest_verifySpec) { qtConfTest_compile($$1): return(true) - qtConfAddError("Cannot compile a minimal program. The toolchain or QMakeSpec is broken.", log) - qtConfPrintReport() - error() + qtConfFatalError("Cannot compile a minimal program. The toolchain or QMakeSpec is broken.", log) } defineTest(qtConfTest_files) { @@ -1310,6 +1314,10 @@ defineTest(qtConfReport_error) { qtConfAddError($${1}, log) } +defineTest(qtConfReport_fatal) { + qtConfFatalError($${1}) +} + defineTest(qtConfCreateReportRecurse) { equals(2, false) { indent = "" diff --git a/src/gui/configure.json b/src/gui/configure.json index 1f5011617c..f4171a8e9f 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -7,7 +7,6 @@ "commandline": { "options": { - "android-style-assets": "boolean", "angle": "boolean", "direct2d": "boolean", "directfb": "boolean", @@ -413,11 +412,6 @@ "condition": "features.accessibility && features.xcb && features.dbus", "output": [ "privateFeature", "feature" ] }, - "android-style-assets": { - "label": "Android Style Assets", - "condition": "config.android", - "output": [ "privateFeature" ] - }, "angle": { "label": "ANGLE", "autoDetect": "features.opengles2 || features.opengl-dynamic", diff --git a/tools/configure/Makefile.mingw b/tools/configure/Makefile.mingw index ff960115f9..b61dc38de4 100644 --- a/tools/configure/Makefile.mingw +++ b/tools/configure/Makefile.mingw @@ -18,7 +18,6 @@ OBJECTS = \ main.o \ configureapp.o \ environment.o \ - tools.o \ qarraydata.o \ qbytearray.o \ qbytearraymatcher.o \ @@ -116,9 +115,8 @@ $(PCH): $(CONFSRC)/configure_pch.h VPATH = $(CONFSRC):$(TOOLSRC)/shared/windows:$(CORESRC)/global:$(CORESRC)/kernel:$(CORESRC)/tools:$(CORESRC)/codecs:$(CORESRC)/io:$(CORESRC)/xml:$(CORESRC)/plugin main.o: $(CONFSRC)/configureapp.h -configureapp.o: $(CONFSRC)/configureapp.h $(CONFSRC)/environment.h $(CONFSRC)/tools.h +configureapp.o: $(CONFSRC)/configureapp.h $(CONFSRC)/environment.h environment.o: $(CONFSRC)/environment.h -tools.o: $(CONFSRC)/tools.h # Make sure qstring_compat.obj isn't compiled with PCH enabled qstring_compat.o: $(CORESRC)/tools/qstring_compat.cpp diff --git a/tools/configure/Makefile.win32 b/tools/configure/Makefile.win32 index 8ed2ffd23f..8864d6fc8f 100644 --- a/tools/configure/Makefile.win32 +++ b/tools/configure/Makefile.win32 @@ -23,7 +23,6 @@ OBJECTS = \ main.obj \ configureapp.obj \ environment.obj \ - tools.obj \ qarraydata.obj \ qbytearray.obj \ qbytearraymatcher.obj \ @@ -97,9 +96,8 @@ $(PCH): $(CONFSRC)\configure_pch.h $(OBJECTS): $(PCH) main.obj: $(CONFSRC)\main.cpp $(CONFSRC)\configureapp.h $(PCH) -configureapp.obj: $(CONFSRC)\configureapp.cpp $(CONFSRC)\configureapp.h $(CONFSRC)\environment.h $(CONFSRC)\tools.h $(PCH) +configureapp.obj: $(CONFSRC)\configureapp.cpp $(CONFSRC)\configureapp.h $(CONFSRC)\environment.h $(PCH) environment.obj: $(CONFSRC)\environment.cpp $(CONFSRC)\environment.h $(PCH) -tools.obj: $(CONFSRC)\tools.cpp $(CONFSRC)\tools.h $(PCH) registry.obj: $(TOOLSRC)\shared\windows\registry.cpp $(PCH) qarraydata.obj: $(CORESRC)\tools\qarraydata.cpp $(PCH) qbytearray.obj: $(CORESRC)\tools\qbytearray.cpp $(PCH) diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 9149a30e3e..93e6a197a2 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -31,7 +31,7 @@ INCLUDEPATH += \ $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION/QtCore \ $$QT_SOURCE_TREE/tools/shared -HEADERS = configureapp.h environment.h tools.h\ +HEADERS = configureapp.h environment.h \ $$QT_SOURCE_TREE/src/corelib/tools/qarraydata.h \ $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.h \ $$QT_SOURCE_TREE/src/corelib/tools/qarraydatapointer.h \ @@ -80,7 +80,7 @@ HEADERS = configureapp.h environment.h tools.h\ $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h -SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \ +SOURCES = main.cpp configureapp.cpp environment.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qarraydata.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qbytearraymatcher.cpp \ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 841aa66b8f..fc66220335 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -29,7 +29,6 @@ #include "configureapp.h" #include "environment.h" -#include "tools.h" #include #include @@ -46,7 +45,6 @@ #include #include #include -#include QT_BEGIN_NAMESPACE @@ -66,13 +64,6 @@ std::ostream &operator<<(std::ostream &s, const QString &val) { using namespace std; -static inline void promptKeyPress() -{ - cout << "(Press any key to continue...)"; - if (_getch() == 3) // _Any_ keypress w/no echo(eat for stdout) - exit(0); // Exit cleanly for Ctrl+C -} - Configure::Configure(int& argc, char** argv) { int i; @@ -183,7 +174,6 @@ void Configure::parseCmdLine() if (j == argCount) break; dictionary["XQMAKESPEC"] = configCmdLine.at(j); - applySpecSpecifics(); break; } } @@ -419,12 +409,6 @@ void Configure::parseCmdLine() break; dictionary[ "ANDROID_NDK_TOOLCHAIN_VERSION" ] = configCmdLine.at(i); } - - else if (configCmdLine.at(i) == "-no-android-style-assets") { - dictionary[ "ANDROID_STYLE_ASSETS" ] = "no"; - } else if (configCmdLine.at(i) == "-android-style-assets") { - dictionary[ "ANDROID_STYLE_ASSETS" ] = "yes"; - } } // Ensure that QMAKESPEC exists in the mkspecs folder @@ -495,16 +479,6 @@ void Configure::parseCmdLine() } } -/*! - Modifies the default configuration based on given -platform option. - Eg. switches to different default styles for Windows CE. -*/ -void Configure::applySpecSpecifics() -{ - if (platform() == ANDROID) - dictionary["ANDROID_STYLE_ASSETS"] = "yes"; -} - void Configure::prepareConfigTests() { // Generate an empty .qmake.cache file for config.tests @@ -914,16 +888,6 @@ void Configure::buildQmake() void Configure::configure() { - FileWriter ci(buildPath + "/config.tests/configure.cfg"); - ci << "# Feature defaults set by configure command line\n" - << "config.input.qt_edition = " << dictionary["EDITION"] << "\n" - << "config.input.qt_licheck = " << dictionary["LICHECK"] << "\n" - << "config.input.qt_release_date = " << dictionary["RELEASEDATE"]; - if (!ci.flush()) { - dictionary[ "DONE" ] = "error"; - return; - } - QStringList args; args << buildPath + "/bin/qmake" << sourcePathMangled @@ -941,155 +905,6 @@ void Configure::configure() saveCmdLine(); } -bool Configure::showLicense(QString orgLicenseFile) -{ - bool showGpl2 = true; - QString licenseFile = orgLicenseFile; - QString theLicense; - if (dictionary["EDITION"] == "OpenSource") { - if (platform() != WINDOWS_RT - && (platform() != ANDROID || dictionary["ANDROID_STYLE_ASSETS"] == "no")) { - theLicense = "GNU Lesser General Public License (LGPL) version 3\n" - "or the GNU General Public License (GPL) version 2"; - } else { - theLicense = "GNU Lesser General Public License (LGPL) version 3"; - showGpl2 = false; - } - } else { - // the first line of the license file tells us which license it is - QFile file(licenseFile); - if (!file.open(QFile::ReadOnly)) { - cout << "Failed to load LICENSE file" << endl; - return false; - } - theLicense = file.readLine().trimmed(); - } - - forever { - char accept = '?'; - cout << "You are licensed to use this software under the terms of" << endl - << "the " << theLicense << "." << endl - << endl; - if (dictionary["EDITION"] == "OpenSource") { - cout << "Type 'L' to view the GNU Lesser General Public License version 3 (LGPLv3)." << endl; - if (showGpl2) - cout << "Type 'G' to view the GNU General Public License version 2 (GPLv2)." << endl; - } else { - cout << "Type '?' to view the " << theLicense << "." << endl; - } - cout << "Type 'y' to accept this license offer." << endl - << "Type 'n' to decline this license offer." << endl - << endl - << "Do you accept the terms of the license?" << endl; - cin >> accept; - accept = tolower(accept); - - if (accept == 'y') { - configCmdLine << "-confirm-license"; - return true; - } else if (accept == 'n') { - return false; - } else { - if (dictionary["EDITION"] == "OpenSource") { - if (accept == 'l') - licenseFile = orgLicenseFile + "/LICENSE.LGPL3"; - else - licenseFile = orgLicenseFile + "/LICENSE.GPL2"; - } - // Get console line height, to fill the screen properly - int i = 0, screenHeight = 25; // default - CONSOLE_SCREEN_BUFFER_INFO consoleInfo; - HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE); - if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo)) - screenHeight = consoleInfo.srWindow.Bottom - - consoleInfo.srWindow.Top - - 1; // Some overlap for context - - // Prompt the license content to the user - QFile file(licenseFile); - if (!file.open(QFile::ReadOnly)) { - cout << "Failed to load LICENSE file" << licenseFile << endl; - return false; - } - QStringList licenseContent = QString(file.readAll()).split('\n'); - while (i < licenseContent.size()) { - cout << licenseContent.at(i) << endl; - if (++i % screenHeight == 0) { - promptKeyPress(); - cout << "\r"; // Overwrite text above - } - } - } - } -} - -void Configure::readLicense() -{ - dictionary["PLATFORM NAME"] = platformName(); - dictionary["LICENSE FILE"] = sourcePath; - - bool openSource = false; - bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL2"); - if (dictionary["BUILDTYPE"] == "commercial") { - openSource = false; - } else if (dictionary["BUILDTYPE"] == "opensource") { - openSource = true; - } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away - forever { - char accept = '?'; - cout << "Which edition of Qt do you want to use ?" << endl; - cout << "Type 'c' if you want to use the Commercial Edition." << endl; - cout << "Type 'o' if you want to use the Open Source Edition." << endl; - cin >> accept; - accept = tolower(accept); - - if (accept == 'c') { - openSource = false; - break; - } else if (accept == 'o') { - openSource = true; - break; - } - } - } - if (hasOpenSource && openSource) { - cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl << endl; - dictionary["LICENSEE"] = "Open Source"; - dictionary["EDITION"] = "OpenSource"; - } else if (openSource) { - cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl; - dictionary["DONE"] = "error"; - return; - } else { - QString tpLicense = sourcePath + "/LICENSE.PREVIEW.COMMERCIAL"; - if (QFile::exists(tpLicense)) { - cout << endl << "This is the Qt Preview Edition." << endl << endl; - - dictionary["EDITION"] = "Preview"; - dictionary["LICENSE FILE"] = tpLicense; - } else { - Tools::checkLicense(dictionary, sourcePath, buildPath); - } - } - - if (dictionary["LICENSE_CONFIRMED"] != "yes") { - if (!showLicense(dictionary["LICENSE FILE"])) { - cout << "Configuration aborted since license was not accepted" << endl; - dictionary["DONE"] = "error"; - return; - } - } else if (dictionary["LICHECK"].isEmpty()) { // licheck executable shows license - cout << "You have already accepted the terms of the license." << endl << endl; - } - - if (dictionary["BUILDTYPE"] == "none") { - if (openSource) - configCmdLine << "-opensource"; - else - configCmdLine << "-commercial"; - } -} - bool Configure::reloadCmdLine(int idx) { QFile inFile(buildPathMangled + "/config.opt"); @@ -1112,6 +927,20 @@ bool Configure::reloadCmdLine(int idx) void Configure::saveCmdLine() { if (dictionary[ "REDO" ] != "yes") { + if (dictionary["BUILDTYPE"] == "none") { + bool openSource = false; + QFile inFile(buildPath + "/mkspecs/qconfig.pri"); + if (inFile.open(QFile::ReadOnly | QFile::Text)) { + QTextStream inStream(&inFile); + while (!inStream.atEnd()) { + if (inStream.readLine() == "QT_EDITION = OpenSource") + openSource = true; + } + } + configCmdLine.append(openSource ? "-opensource" : "-commercial"); + } + if (dictionary["LICENSE_CONFIRMED"] != "yes") + configCmdLine.append("-confirm-license"); QFile outFile(buildPathMangled + "/config.opt"); if (outFile.open(QFile::WriteOnly | QFile::Text)) { QTextStream outStream(&outFile); @@ -1134,23 +963,6 @@ bool Configure::isOk() return (dictionary[ "DONE" ] != "error"); } -QString Configure::platformName() const -{ - switch (platform()) { - default: - case WINDOWS: - return QStringLiteral("Qt for Windows"); - case WINDOWS_RT: - return QStringLiteral("Qt for Windows Runtime"); - case QNX: - return QStringLiteral("Qt for QNX"); - case ANDROID: - return QStringLiteral("Qt for Android"); - case OTHER: - return QStringLiteral("Qt for ???"); - } -} - int Configure::platform() const { const QString xQMakeSpec = dictionary.value("XQMAKESPEC"); diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index c8d4d3df53..b007f3c487 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -54,14 +54,10 @@ public: void generateQDevicePri(); void prepareConfigTests(); - bool showLicense(QString licenseFile); - void readLicense(); - bool isDone(); bool isOk(); int platform() const; - QString platformName() const; private: int verbose; @@ -86,8 +82,6 @@ private: bool reloadCmdLine(int idx); void saveCmdLine(); - - void applySpecSpecifics(); }; class FileWriter : public QTextStream diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index e585b16ea7..260af276fa 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -378,29 +378,4 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv return exitCode; } -/*! - Executes \a command with _popen() and returns the stdout of the command. - - Taken from qmake's system() command. -*/ -QString Environment::execute(const QString &command, int *returnCode) -{ - QString output; - FILE *proc = _popen(command.toLatin1().constData(), "r"); - char buff[256]; - while (proc && !feof(proc)) { - int read_in = int(fread(buff, 1, 255, proc)); - if (!read_in) - break; - buff[read_in] = '\0'; - output += buff; - } - if (proc) { - int r = _pclose(proc); - if (returnCode) - *returnCode = r; - } - return output; -} - QT_END_NAMESPACE diff --git a/tools/configure/environment.h b/tools/configure/environment.h index aa8e7fd8bc..8415fa10a6 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -52,7 +52,6 @@ public: static QString detectQMakeSpec(); static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv); - static QString execute(const QString &command, int *returnCode = 0); private: static Compiler detectedCompiler; diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index 91a99c16c2..f6c2722529 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -45,13 +45,6 @@ int runConfigure( int argc, char** argv ) if (!app.isOk()) return 3; - // Read license now, and exit if it doesn't pass. - // This lets the user see the command-line options of configure - // without having to load and parse the license file. - app.readLicense(); - if (!app.isOk()) - return 3; - // Source file with path settings. Needed by qmake. app.generateQConfigCpp(); diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp deleted file mode 100644 index 5ba7125975..0000000000 --- a/tools/configure/tools.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tools.h" -#include "environment.h" - -#include -#include -#include -#include - -#include - -std::ostream &operator<<(std::ostream &s, const QString &val); -using namespace std; - -void Tools::checkLicense(QMap &dictionary, - const QString &sourcePath, const QString &buildPath) -{ - dictionary["LICHECK"] = "licheck.exe"; - - const QString licenseChecker = - QDir::toNativeSeparators(sourcePath + "/bin/licheck.exe"); - - if (QFile::exists(licenseChecker)) { - const QString qMakeSpec = - QDir::toNativeSeparators(dictionary.value("QMAKESPEC")); - const QString xQMakeSpec = - QDir::toNativeSeparators(dictionary.value("XQMAKESPEC")); - - QString command = QString("%1 %2 %3 %4 %5 %6") - .arg(licenseChecker, - dictionary.value("LICENSE_CONFIRMED", "no"), - QDir::toNativeSeparators(sourcePath), - QDir::toNativeSeparators(buildPath), - qMakeSpec, xQMakeSpec); - - int returnValue = 0; - QString licheckOutput = Environment::execute(command, &returnValue); - - if (returnValue) { - dictionary["DONE"] = "error"; - } else { - foreach (const QString &var, licheckOutput.split('\n')) - dictionary[var.section('=', 0, 0).toUpper()] = var.section('=', 1, 1); - dictionary["LICENSE_CONFIRMED"] = "yes"; - } - } else { - cout << endl << "Error: Could not find licheck.exe" << endl - << "Try re-installing." << endl << endl; - dictionary["DONE"] = "error"; - } -} - diff --git a/tools/configure/tools.h b/tools/configure/tools.h deleted file mode 100644 index 17dcc88518..0000000000 --- a/tools/configure/tools.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef _TOOLS_H_ -#define _TOOLS_H_ - -#include -#include - -class Tools -{ -public: - static void checkLicense(QMap &dictionary, - const QString &sourcePath, const QString &buildPath); -}; - -#endif // _TOOLS_H_ - -- cgit v1.2.3 From d829dd3f445afae8c74630c4c8b93347b4a7c7bd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 7 Dec 2016 13:08:44 +0100 Subject: Fix inconsistent alpha masking in qConvertARGB32PMToARGB64PM_sse2 The prolog and epilog did not force RGB32 to be converted to RGB64 with alpha fully defined like the middle optimized part. Change-Id: If7c4829f2239f9a3c524f78b9ce269e2b0b5b150 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qdrawhelper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 8700a0fce1..ff7c8dfc28 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -580,6 +580,8 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint * int i = 0; for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) { uint s = *src++; + if (maskAlpha) + s = s | 0xff000000; if (RGBA) s = RGBA2ARGB(s); *buffer++ = QRgba64::fromArgb32(s); @@ -605,6 +607,8 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint * SIMD_EPILOGUE(i, count, 3) { uint s = *src++; + if (maskAlpha) + s = s | 0xff000000; if (RGBA) s = RGBA2ARGB(s); *buffer++ = QRgba64::fromArgb32(s); -- cgit v1.2.3 From 2488f34ecfd68702b5508c50cca3fb8e967ac8ea Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 25 Feb 2016 14:39:51 +0300 Subject: xcb: Adapt QXcbWindow::startSystemResize() for touch events Window managers typically grab the pointer after receiving the _NET_WM_MOVERESIZE event. But they fail to do it for touch sequences which have a receiver. So we should reject the touch sequence before sending _NET_WM_MOVERESIZE event. QSizeGrip calls startSystemResize() on MouseButtonPress event which is synthesized by Qt on TouchBegin. We can find the id of the touch point by comparing coordinates of the synthesized MouseButtonPress event with coordinates of all TouchBegin events. Then we use this id to reject the touch sequence (it's possible only after receiving XI_TouchUpdate). Change-Id: I26519840cd221e28b0be7854e4617c9aba4b0817 Task-number: QTBUG-51385 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.h | 9 ++++++ src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 40 ++++++++++++++++++++++-- src/plugins/platforms/xcb/qxcbwindow.cpp | 12 ++++++- src/plugins/platforms/xcb/qxcbwindow.h | 2 ++ 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index cb337ea0da..60f0f487c5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -504,6 +504,7 @@ public: #endif #ifdef XCB_USE_XINPUT22 + bool startSystemResizeForTouchBegin(xcb_window_t window, const QPoint &point, Qt::Corner corner); bool xi2SetMouseGrabEnabled(xcb_window_t w, bool grab); #endif Qt::MouseButton xiToQtMouseButton(uint32_t b); @@ -639,6 +640,14 @@ private: QXcbEventReader *m_reader; #if defined(XCB_USE_XINPUT2) QHash m_touchDevices; +#ifdef XCB_USE_XINPUT22 + struct StartSystemResizeInfo { + xcb_window_t window; + uint16_t deviceid; + uint32_t pointid; + Qt::Corner corner; + } m_startSystemResizeInfo; +#endif #endif #ifdef Q_XCB_DEBUG struct CallInfo { diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 93f8db92bf..0ace79a4f5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -61,9 +61,9 @@ struct XInput2TouchDeviceData { XIDeviceInfo *xiDeviceInfo; QTouchDevice *qtTouchDevice; QHash touchPoints; + QHash pointPressedPosition; // in screen coordinates where each point was pressed // Stuff that is relevant only for touchpads - QHash pointPressedPosition; // in screen coordinates where each point was pressed QPointF firstPressedPosition; // in screen coordinates where the first point was pressed QPointF firstPressedNormalPosition; // device coordinates (0 to 1, 0 to 1) where the first point was pressed QSizeF size; // device size in mm @@ -93,6 +93,7 @@ void QXcbConnection::initializeXInput2() if (m_xi2Enabled) { #ifdef XCB_USE_XINPUT22 qCDebug(lcQpaXInputDevices, "XInput version %d.%d is available and Qt supports 2.2 or greater", xiMajor, m_xi2Minor); + m_startSystemResizeInfo.window = XCB_NONE; #else qCDebug(lcQpaXInputDevices, "XInput version %d.%d is available and Qt supports 2.0", xiMajor, m_xi2Minor); #endif @@ -714,7 +715,21 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo touchPoint.state = Qt::TouchPointMoved; } else if (touchPoint.area.center() != QPoint(x, y)) { touchPoint.state = Qt::TouchPointMoved; - dev->pointPressedPosition[touchPoint.id] = QPointF(x, y); + if (dev->qtTouchDevice->type() == QTouchDevice::TouchPad) + dev->pointPressedPosition[touchPoint.id] = QPointF(x, y); + } + + if (dev->qtTouchDevice->type() == QTouchDevice::TouchScreen && + xiDeviceEvent->event == m_startSystemResizeInfo.window && + xiDeviceEvent->sourceid == m_startSystemResizeInfo.deviceid && + xiDeviceEvent->detail == m_startSystemResizeInfo.pointid) { + QXcbWindow *window = platformWindowFromId(m_startSystemResizeInfo.window); + if (window) { + XIAllowTouchEvents(static_cast(m_xlib_display), xiDeviceEvent->deviceid, + xiDeviceEvent->detail, xiDeviceEvent->event, XIRejectTouch); + window->doStartSystemResize(QPoint(x, y), m_startSystemResizeInfo.corner); + m_startSystemResizeInfo.window = XCB_NONE; + } } break; case XI_TouchEnd: @@ -745,6 +760,27 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo touchPoint.state = Qt::TouchPointStationary; } +bool QXcbConnection::startSystemResizeForTouchBegin(xcb_window_t window, const QPoint &point, Qt::Corner corner) +{ + QHash::const_iterator devIt = m_touchDevices.constBegin(); + for (; devIt != m_touchDevices.constEnd(); ++devIt) { + XInput2TouchDeviceData *deviceData = devIt.value(); + if (deviceData->qtTouchDevice->type() == QTouchDevice::TouchScreen) { + QHash::const_iterator pointIt = deviceData->pointPressedPosition.constBegin(); + for (; pointIt != deviceData->pointPressedPosition.constEnd(); ++pointIt) { + if (pointIt.value().toPoint() == point) { + m_startSystemResizeInfo.window = window; + m_startSystemResizeInfo.deviceid = devIt.key(); + m_startSystemResizeInfo.pointid = pointIt.key(); + m_startSystemResizeInfo.corner = corner; + return true; + } + } + } + } + return false; +} + bool QXcbConnection::xi2SetMouseGrabEnabled(xcb_window_t w, bool grab) { if (grab && !canGrab()) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 0c8e78491e..5fa8541f26 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2738,13 +2738,23 @@ bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE); if (!connection()->wmSupport()->isSupportedByWM(moveResize)) return false; + const QPoint globalPos = window()->mapToGlobal(pos); +#ifdef XCB_USE_XINPUT22 + if (connection()->startSystemResizeForTouchBegin(m_window, globalPos, corner)) + return true; +#endif + return doStartSystemResize(globalPos, corner); +} + +bool QXcbWindow::doStartSystemResize(const QPoint &globalPos, Qt::Corner corner) +{ + const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE); xcb_client_message_event_t xev; xev.response_type = XCB_CLIENT_MESSAGE; xev.type = moveResize; xev.sequence = 0; xev.window = xcb_window(); xev.format = 32; - const QPoint globalPos = window()->mapToGlobal(pos); xev.data.data32[0] = globalPos.x(); xev.data.data32[1] = globalPos.y(); const bool bottom = corner == Qt::BottomRightCorner || corner == Qt::BottomLeftCorner; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 3d8d21be6b..089df8f3f6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -178,6 +178,8 @@ public: QXcbScreen *xcbScreen() const; + bool doStartSystemResize(const QPoint &globalPos, Qt::Corner corner); + virtual void create(); virtual void destroy(); -- cgit v1.2.3 From 50cb2687b2864acf66586fab9dd56716ebda4e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 2 Dec 2016 12:44:16 +0100 Subject: UIKit: Improve handling of private system fonts / fallback fonts Commit 2bc7a40048 taught the CoreText font database to populate the families lazily, and in the process added a guard to ensure that we didn't populate internal fonts (prefixed with a '.'), as these fonts would then show up in font selection dialogs. Commit 909d3f5c7 then added support for private fonts, by making it possible to filter out any private fonts from font selection daialogs. But the guard was not removed, so we were still not populating these fonts. This guard has been removed, and the filtering function has been updated to include the conditions of the guard. Next, commit e5e93345c5 used [UIFont fontNamesForFamilyName:] to verify that each family that we registered with the font database would also have matching fonts when finally populated. This is not the right approach, as [UIFont fontNamesForFamilyName:] does not handle internal fonts. Instead we trust what CTFontDescriptorCreateMatchingFontDescriptors() gives us, but make sure to register the resulting font descriptors with the original/originating font family, instead of the one we pull out of the font descriptor. Finally, as of iOS 10, we can use CTFontManagerCopyAvailableFontFamilyNames instead of [UIFont familyNames], which gives us all of the internal font families like on macOS, instead of just the user-visible families. For earlier iOS versions we manually add '.PhoneFallback', as we know it will be available even if not listed in [UIFont familyNames]. The end result is that we register and populate families like '.PhoneFallback', which is critical to supporting more esoteric writing systems. The check in tst_QFont that styles for a given family is not empty has been removed, as we can't guarantee that on all platforms, which is also documented for QFontDatabase::styles(). Task-number: QTBUG-45746 Task-number: QTBUG-50624 Change-Id: I04674dcb2bb36b4cdf5646d540c35727ff3daaad Reviewed-by: Jake Petroules --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 37 +++++++++++----------- .../fontdatabases/mac/qcoretextfontdatabase_p.h | 2 +- tests/auto/gui/text/qfont/tst_qfont.cpp | 1 - 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 78a0c4d0c9..1e29b12ec4 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -189,11 +189,16 @@ QCoreTextFontDatabase::~QCoreTextFontDatabase() static CFArrayRef availableFamilyNames() { -#if defined(Q_OS_OSX) - return CTFontManagerCopyAvailableFontFamilyNames(); -#elif defined(QT_PLATFORM_UIKIT) - return (CFArrayRef) [[UIFont familyNames] retain]; +#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(1060, 100000, 100000, 30000) + if (&CTFontManagerCopyAvailableFontFamilyNames) + return CTFontManagerCopyAvailableFontFamilyNames(); #endif +#if defined(QT_PLATFORM_UIKIT) + CFMutableArrayRef familyNames = CFArrayCreateMutableCopy(kCFAllocatorDefault, 0, (CFArrayRef)[UIFont familyNames]); + CFArrayAppendValue(familyNames, CFSTR(".PhoneFallback")); + return familyNames; +#endif + Q_UNREACHABLE(); } void QCoreTextFontDatabase::populateFontDatabase() @@ -207,17 +212,6 @@ void QCoreTextFontDatabase::populateFontDatabase() for (int i = 0; i < numberOfFamilies; ++i) { CFStringRef familyNameRef = (CFStringRef) CFArrayGetValueAtIndex(familyNames, i); QString familyName = QString::fromCFString(familyNameRef); - - // Don't populate internal fonts - if (familyName.startsWith(QLatin1Char('.')) || familyName == QLatin1String("LastResort")) - continue; - -#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) - // Skip font families with no corresponding fonts - if (![UIFont fontNamesForFamilyName:(NSString*)familyNameRef].count) - continue; -#endif - QPlatformFontDatabase::registerFontFamily(familyName); #if defined(Q_OS_OSX) @@ -250,7 +244,7 @@ void QCoreTextFontDatabase::populateFamily(const QString &familyName) const int numFonts = CFArrayGetCount(matchingFonts); for (int i = 0; i < numFonts; ++i) - populateFromDescriptor(CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingFonts, i))); + populateFromDescriptor(CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingFonts, i)), familyName); } struct FontDescription { @@ -352,13 +346,18 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) } } -void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) +void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName) { FontDescription fd; getFontDescription(font, &fd); + // Note: The familyName we are registering, and the family name of the font descriptor, may not + // match, as CTFontDescriptorCreateMatchingFontDescriptors will return descriptors for replacement + // fonts if a font family does not have any fonts available on the system. + QString family = !familyName.isNull() ? familyName : static_cast(fd.familyName); + CFRetain(font); - QPlatformFontDatabase::registerFont(fd.familyName, fd.styleName, fd.foundryName, fd.weight, fd.style, fd.stretch, + QPlatformFontDatabase::registerFont(family, fd.styleName, fd.foundryName, fd.weight, fd.style, fd.stretch, true /* antialiased */, true /* scalable */, fd.pixelSize, fd.fixedPitch, fd.writingSystems, (void *) font); } @@ -699,7 +698,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData bool QCoreTextFontDatabase::isPrivateFontFamily(const QString &family) const { - if (family.startsWith(QLatin1Char('.'))) + if (family.startsWith(QLatin1Char('.')) || family == QLatin1String("LastResort")) return true; return QPlatformFontDatabase::isPrivateFontFamily(family); diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 1bc3522bda..3b1be2e6a1 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -92,7 +92,7 @@ public: const QHash &themeFonts() const; private: - void populateFromDescriptor(CTFontDescriptorRef font); + void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString()); #ifndef QT_NO_FREETYPE bool m_useFreeType; diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index ca984a26a5..a6d8944656 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -130,7 +130,6 @@ void tst_QFont::italicOblique() QString family = *f_it; QStringList styles = fdb.styles(family); - QVERIFY(!styles.isEmpty()); QStringList::ConstIterator s_it, s_end = styles.end(); for (s_it = styles.begin(); s_it != s_end; ++s_it) { QString style = *s_it; -- cgit v1.2.3 From aec85a53df3dbe3047c6db0f6eb39cb161cd3e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 8 Dec 2016 14:07:25 +0100 Subject: Disable core dumps for selftests that are meant to be crashing Task-number: QTBUG-55155 Change-Id: I26a1461f35f916f3980fcb18cdddf3502e22fc90 Reviewed-by: Timur Pocheptsov --- src/testlib/qtestcase.cpp | 17 +++++++++++++++++ tests/auto/testlib/selftests/tst_selftests.cpp | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index f2a962408e..7b76f1f970 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -99,6 +99,7 @@ #include #include #include +#include #endif #if defined(Q_OS_MACX) @@ -143,6 +144,22 @@ static bool debuggerPresent() #endif } +static void disableCoreDump() +{ + bool ok = false; + const int disableCoreDump = qEnvironmentVariableIntValue("QTEST_DISABLE_CORE_DUMP", &ok); + if (ok && disableCoreDump == 1) { +#if defined(Q_OS_UNIX) + struct rlimit limit; + limit.rlim_cur = 0; + limit.rlim_max = 0; + if (setrlimit(RLIMIT_CORE, &limit) != 0) + qWarning("Failed to disable core dumps: %d", errno); +#endif + } +} +Q_CONSTRUCTOR_FUNCTION(disableCoreDump); + static void stackTrace() { bool ok = false; diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 0806077031..35b759bcc2 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -592,8 +592,10 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge QProcess proc; QProcessEnvironment environment = processEnvironment(); - if (crashes) + if (crashes) { + environment.insert("QTEST_DISABLE_CORE_DUMP", "1"); environment.insert("QTEST_DISABLE_STACK_DUMP", "1"); + } proc.setProcessEnvironment(environment); const QString path = subdir + QLatin1Char('/') + subdir; proc.start(path, arguments); -- cgit v1.2.3 From 2c9dc93696f32b798b872f931c102329d0ba7155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 2 Dec 2016 12:03:02 +0100 Subject: Cocoa: Unbreak app activation on macOS Sierra Previously, we would activate the application during QCocoaIntegration construction, which means at QApplication creation time. This now seems to interfere with application startup on macOS Sierra, where the application window ends up in an unfocused state. Move application activation to applicationDidFinishLaunching, at which point the Cocoa runtime should be completely initialized. Do this for 10.12+ only to avoid regressions/ test failures on previous versions. Change-Id: Ic5f150d53f06a302b53a3ba86a4a9b18bb2a1783 Task-number: QTBUG-57044 Reviewed-by: Timur Pocheptsov Reviewed-by: Qt CI Bot --- src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 14 +++++++++----- src/plugins/platforms/cocoa/qcocoaintegration.mm | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index da755aa189..7368aabf7d 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -282,14 +282,18 @@ QT_END_NAMESPACE { Q_UNUSED(aNotification); inLaunch = false; - // qt_release_apple_event_handler(); - - // Insert code here to initialize your application + if (qEnvironmentVariableIsEmpty("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM")) { + if (QSysInfo::macVersion() >= QSysInfo::MV_10_12) { + // Move the application window to front to avoid launching behind the terminal. + // Ignoring other apps is neccessary (we must ignore the terminal), but makes + // Qt apps play slightly less nice with other apps when lanching from Finder + // (See the activateIgnoringOtherApps docs.) + [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; + } + } } - - - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { Q_UNUSED(filenames); diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 92fffb4d15..18340f4ee1 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -312,11 +312,15 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList) // see the function implementation for exceptions.) qt_mac_transformProccessToForegroundApplication(); - // Move the application window to front to avoid launching behind the terminal. - // Ignoring other apps is neccessary (we must ignore the terminal), but makes - // Qt apps play slightly less nice with other apps when lanching from Finder - // (See the activateIgnoringOtherApps docs.) - [cocoaApplication activateIgnoringOtherApps : YES]; + // Move the application window to front to make it take focus, also when launching + // from the terminal. On 10.12+ this call has been moved to applicationDidFinishLauching + // to work around issues with loss of focus at startup. + if (QSysInfo::macVersion() < QSysInfo::MV_10_12) { + // Ignoring other apps is neccessary (we must ignore the terminal), but makes + // Qt apps play slightly less nice with other apps when lanching from Finder + // (See the activateIgnoringOtherApps docs.) + [cocoaApplication activateIgnoringOtherApps : YES]; + } } // ### For AA_MacPluginApplication we don't want to load the menu nib. -- cgit v1.2.3 From b0c321a8db7b75d740d968c6a583473600faf990 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 Nov 2016 14:52:18 -0800 Subject: Don't crash on QVLA construction from an empty std::initializer_list The C++ standard says in [support.initlist.access]/1: constexpr const E* begin() const noexcept; Returns: A pointer to the beginning of the array. If size() == 0 the values of begin() and end() are unspecified but they shall be identical. So we can't assume it's non-null. I didn't want to remove the Q_ASSERT, so passing a non-null pointer to append() remains required. This patch simply won't call append() if the initializer list is empty. This was already tested, but the failure is with a compiler that is not part of the Qt CI. Task-number: QTBUG-57277 Change-Id: Iaeecaffe26af4535b416fffd1489806872b412ee Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qvarlengtharray.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index c3ac104399..1530299303 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -76,7 +76,8 @@ public: QVarLengthArray(std::initializer_list args) : a(Prealloc), s(0), ptr(reinterpret_cast(array)) { - append(args.begin(), args.size()); + if (args.size()) + append(args.begin(), args.size()); } #endif -- cgit v1.2.3 From 8005e0652c367c5e8c780a298d9fee4ce18a370a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 6 Dec 2016 08:17:30 +0100 Subject: QAndroidPlatformOpenGLContext: fix adopting of existing native contexts Change-Id: I854bbc511d89578c6a893015b21358f08ed8f5a6 Reviewed-by: Laszlo Agocs Reviewed-by: J-P Nurmi Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidplatformintegration.cpp | 6 +++++- src/plugins/platforms/android/qandroidplatformopenglcontext.cpp | 5 +++-- src/plugins/platforms/android/qandroidplatformopenglcontext.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 6669ee3176..de9e27e595 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -66,6 +66,8 @@ #include "qandroidplatformtheme.h" #include "qandroidsystemlocale.h" +#include + QT_BEGIN_NAMESPACE int QAndroidPlatformIntegration::m_defaultGeometryWidth = 320; @@ -251,7 +253,9 @@ QPlatformOpenGLContext *QAndroidPlatformIntegration::createPlatformOpenGLContext format.setRedBufferSize(8); format.setGreenBufferSize(8); format.setBlueBufferSize(8); - return new QAndroidPlatformOpenGLContext(format, context->shareHandle(), m_eglDisplay); + auto ctx = new QAndroidPlatformOpenGLContext(format, context->shareHandle(), m_eglDisplay, context->nativeHandle()); + context->setNativeHandle(QVariant::fromValue(QEGLNativeContext(ctx->eglContext(), m_eglDisplay))); + return ctx; } QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index 2644fa27f6..eeec7a8106 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -49,8 +49,9 @@ QT_BEGIN_NAMESPACE -QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) - :QEGLPlatformContext(format, share, display) +QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, + const QVariant &nativeHandle) + :QEGLPlatformContext(format, share, display, nullptr, nativeHandle) { } diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h index 87a0829655..3897b3166b 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE class QAndroidPlatformOpenGLContext : public QEGLPlatformContext { public: - QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); + QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, const QVariant &nativeHandle); void swapBuffers(QPlatformSurface *surface) override; bool makeCurrent(QPlatformSurface *surface) override; -- cgit v1.2.3 From f7b44f879cdded7b2c6b604df873f7194e56a63a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Nov 2016 15:20:21 +0100 Subject: QDir::cleanPath(): Do not cd above root paths (UNC, WinRT) Calling QDir::cleanPath() on "//server/path/.." resulted in "/". Factor out a function to determine the root path part of an absolute path for later use, and handle some special cases: - Consider server name of "//server/path/.." as part of the prefix. - Check on the root path for WinRT. Task-number: QTBUG-53712 Change-Id: Ibddacf06212b6fc86fa74a5e4078df6cfd5b66f5 Reviewed-by: Oswald Buddenhagen Reviewed-by: Maurice Kalinowski Reviewed-by: Thiago Macieira --- src/corelib/io/qdir.cpp | 55 +++++++++++++++++++++------------ tests/auto/corelib/io/qdir/tst_qdir.cpp | 16 +++++++--- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 91953ebf26..8f43b77bd5 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -80,6 +80,40 @@ static QString driveSpec(const QString &path) } #endif +enum { +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) + OSSupportsUncPaths = true +#else + OSSupportsUncPaths = false +#endif +}; + +// Return the length of the root part of an absolute path, for use by cleanPath(), cd(). +static int rootLength(const QString &name, bool allowUncPaths) +{ + const int len = name.length(); + // starts with double slash + if (allowUncPaths && name.startsWith(QLatin1String("//"))) { + // Server name '//server/path' is part of the prefix. + const int nextSlash = name.indexOf(QLatin1Char('/'), 2); + return nextSlash >= 0 ? nextSlash + 1 : len; + } +#if defined(Q_OS_WINRT) + const QString rootPath = QDir::rootPath(); // rootPath contains the trailing slash + if (name.startsWith(rootPath, Qt::CaseInsensitive)) + return rootPath.size(); +#endif // Q_OS_WINRT +#if defined(Q_OS_WIN) + if (len >= 2 && name.at(1) == QLatin1Char(':')) { + // Handle a possible drive letter + return len > 2 && name.at(2) == QLatin1Char('/') ? 3 : 2; + } +#endif + if (name.at(0) == QLatin1Char('/')) + return 1; + return 0; +} + //************* QDirPrivate QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, QDir::SortFlags sort_, QDir::Filters filters_) : QSharedData() @@ -2066,19 +2100,7 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all const QChar *prefix = p; int up = 0; - int prefixLength = 0; - - if (allowUncPaths && len >= 2 && p[1].unicode() == '/' && p[0].unicode() == '/') { - // starts with double slash - prefixLength = 2; -#ifdef Q_OS_WIN - } else if (len >= 2 && p[1].unicode() == ':') { - // remember the drive letter - prefixLength = (len > 2 && p[2].unicode() == '/') ? 3 : 2; -#endif - } else if (p[0].unicode() == '/') { - prefixLength = 1; - } + const int prefixLength = rootLength(name, allowUncPaths); p += prefixLength; i -= prefixLength; @@ -2188,12 +2210,7 @@ QString QDir::cleanPath(const QString &path) if (dir_separator != QLatin1Char('/')) name.replace(dir_separator, QLatin1Char('/')); - bool allowUncPaths = false; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //allow unc paths - allowUncPaths = true; -#endif - - QString ret = qt_normalizePathSegments(name, allowUncPaths); + QString ret = qt_normalizePathSegments(name, OSSupportsUncPaths); // Strip away last slash except for root directories if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) { diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 294a53645e..fe12850476 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1149,6 +1149,8 @@ tst_QDir::cleanPath_data() QTest::newRow("data0") << "/Users/sam/troll/qt4.0//.." << "/Users/sam/troll"; QTest::newRow("data1") << "/Users/sam////troll/qt4.0//.." << "/Users/sam/troll"; QTest::newRow("data2") << "/" << "/"; + QTest::newRow("data2-up") << "/path/.." << "/"; + QTest::newRow("data2-above-root") << "/.." << "/.."; QTest::newRow("data3") << QDir::cleanPath("../.") << ".."; QTest::newRow("data4") << QDir::cleanPath("../..") << "../.."; #if defined(Q_OS_WIN) @@ -1178,13 +1180,19 @@ tst_QDir::cleanPath_data() QTest::newRow("data14") << "c://foo" << "c:/foo"; // Drive letters and unc path in one string -#ifndef Q_OS_WINRT -#ifdef Q_OS_WIN +#if defined(Q_OS_WINRT) + const QString root = QDir::rootPath(); // has trailing slash + QTest::newRow("root-up") << (root + "path/..") << root; + QTest::newRow("above-root") << (root + "..") << (root + ".."); +#elif defined(Q_OS_WIN) QTest::newRow("data15") << "//c:/foo" << "//c:/foo"; + QTest::newRow("drive-up") << "A:/path/.." << "A:/"; + QTest::newRow("drive-above-root") << "A:/.." << "A:/.."; + QTest::newRow("unc-server-up") << "//server/path/.." << "//server"; + QTest::newRow("unc-server-above-root") << "//server/.." << "//server/.."; #else QTest::newRow("data15") << "//c:/foo" << "/c:/foo"; -#endif -#endif // !Q_OS_WINRT +#endif // non-windows QTest::newRow("QTBUG-23892_0") << "foo/.." << "."; QTest::newRow("QTBUG-23892_1") << "foo/../" << "."; -- cgit v1.2.3 From 101449a4cfa9c0d216332c6dc8ba826e8109e09d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Jul 2016 15:30:45 +0200 Subject: QDir::cd(): Handle UNC server paths correctly Add a bool *ok out parameter to qt_normalizePathSegments() and return false when ".." are left over for an absolute path, indicating an attempt to change above root. Factor out static helper qt_cleanPath() to be able to pass the return value to QDir::cd() and return on failure from there. Amends change 63f634322b2c0f795bd424be9e51953a10c701de, which did not handle UNC paths. Task-number: QTBUG-53712 Change-Id: I3e63a5dd0259306a0b99145348d815899582f78e Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qdir.cpp | 73 +++++++++++++++++---------------- src/corelib/io/qurl.cpp | 3 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 7 +++- 3 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 8f43b77bd5..437f774547 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -893,6 +893,8 @@ QString QDir::fromNativeSeparators(const QString &pathName) return pathName; } +static QString qt_cleanPath(const QString &path, bool *ok = nullptr); + /*! Changes the QDir's directory to \a dirName. @@ -913,32 +915,18 @@ bool QDir::cd(const QString &dirName) return true; QString newPath; if (isAbsolutePath(dirName)) { - newPath = cleanPath(dirName); + newPath = qt_cleanPath(dirName); } else { - if (isRoot()) - newPath = d->dirEntry.filePath(); - else - newPath = d->dirEntry.filePath() % QLatin1Char('/'); + newPath = d->dirEntry.filePath(); + if (!newPath.endsWith(QLatin1Char('/'))) + newPath += QLatin1Char('/'); newPath += dirName; if (dirName.indexOf(QLatin1Char('/')) >= 0 || dirName == QLatin1String("..") || d->dirEntry.filePath() == QLatin1String(".")) { - newPath = cleanPath(newPath); -#if defined (Q_OS_UNIX) - //After cleanPath() if path is "/.." or starts with "/../" it means trying to cd above root. - if (newPath.startsWith(QLatin1String("/../")) || newPath == QLatin1String("/..")) -#elif defined (Q_OS_WINRT) - const QString rootPath = QDir::rootPath(); - if (newPath.size() < rootPath.size() && rootPath.startsWith(newPath)) -#else - /* - cleanPath() already took care of replacing '\' with '/'. - We can't use startsWith here because the letter of the drive is unknown. - After cleanPath() if path is "[A-Z]:/.." or starts with "[A-Z]:/../" it means trying to cd above root. - */ - - if (newPath.midRef(1, 4) == QLatin1String(":/..") && (newPath.length() == 5 || newPath.at(5) == QLatin1Char('/'))) -#endif + bool ok; + newPath = qt_cleanPath(newPath, &ok); + if (!ok) return false; /* If newPath starts with .., we convert it to absolute to @@ -2085,10 +2073,14 @@ bool QDir::match(const QString &filter, const QString &fileName) This method is shared with QUrl, so it doesn't deal with QDir::separator(), nor does it remove the trailing slash, if any. */ -Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool allowUncPaths) +Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool allowUncPaths, + bool *ok = nullptr) { const int len = name.length(); + if (ok) + *ok = false; + if (len == 0) return name; @@ -2153,6 +2145,10 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all --up; } + // Indicate failure when ".." are left over for an absolute path. + if (ok) + *ok = prefixLength == 0 || up == 0; + // add remaining '..' while (up) { if (used != len && out[used].unicode() != '/') // is not empty and there isn't already a '/' @@ -2190,27 +2186,16 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all return ret; } -/*! - Returns \a path with directory separators normalized (converted to "/") and - redundant ones removed, and "."s and ".."s resolved (as far as possible). - - Symbolic links are kept. This function does not return the - canonical path, but rather the simplest version of the input. - For example, "./local" becomes "local", "local/../bin" becomes - "bin" and "/local/usr/../bin" becomes "/local/bin". - - \sa absolutePath(), canonicalPath() -*/ -QString QDir::cleanPath(const QString &path) +static QString qt_cleanPath(const QString &path, bool *ok) { if (path.isEmpty()) return path; QString name = path; - QChar dir_separator = separator(); + QChar dir_separator = QDir::separator(); if (dir_separator != QLatin1Char('/')) name.replace(dir_separator, QLatin1Char('/')); - QString ret = qt_normalizePathSegments(name, OSSupportsUncPaths); + QString ret = qt_normalizePathSegments(name, OSSupportsUncPaths, ok); // Strip away last slash except for root directories if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) { @@ -2227,6 +2212,22 @@ QString QDir::cleanPath(const QString &path) return ret; } +/*! + Returns \a path with directory separators normalized (converted to "/") and + redundant ones removed, and "."s and ".."s resolved (as far as possible). + + Symbolic links are kept. This function does not return the + canonical path, but rather the simplest version of the input. + For example, "./local" becomes "local", "local/../bin" becomes + "bin" and "/local/usr/../bin" becomes "/local/bin". + + \sa absolutePath(), canonicalPath() +*/ +QString QDir::cleanPath(const QString &path) +{ + return qt_cleanPath(path); +} + /*! Returns \c true if \a path is relative; returns \c false if it is absolute. diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 60ce752eb6..066052ade9 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -417,7 +417,8 @@ #include "qurlquery.h" QT_BEGIN_NAMESPACE -extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths); // qdir.cpp +extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths, + bool *ok = nullptr); // qdir.cpp inline static bool isHex(char c) { diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index fe12850476..b86c6e4dfa 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -58,7 +58,8 @@ #ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE -extern Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &, bool); +extern Q_AUTOTEST_EXPORT QString + qt_normalizePathSegments(const QString &path, bool allowUncPaths, bool *ok = nullptr); QT_END_NAMESPACE #endif @@ -2246,6 +2247,10 @@ void tst_QDir::cdBelowRoot_data() const QString systemRoot = QString::fromLocal8Bit(qgetenv("SystemRoot")); QTest::newRow("windows-drive") << systemDrive << systemRoot.mid(3) << QDir::cleanPath(systemRoot); + const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName(); + const QString testDirectory = QStringLiteral("testshare"); + QTest::newRow("windows-share") + << uncRoot << testDirectory << QDir::cleanPath(uncRoot + QLatin1Char('/') + testDirectory); #endif // Windows } -- cgit v1.2.3 From 87fefbc08e80119dba24767bfc9b6ecc64be5fcd Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Wed, 19 Oct 2016 12:49:52 +0300 Subject: Plugins: use QStringBuilder more Change-Id: I6f026b81fdc403d99d37dfa22ea6a27a95ead347 Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- .../deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp | 10 +++------- .../platforms/windows/accessible/qwindowsmsaaaccessible.cpp | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 3 +-- src/plugins/platforms/xcb/qxcbintegration.cpp | 8 ++------ 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 75dd083750..f372b9d156 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -108,14 +108,10 @@ static const char * const connector_type_names[] = { // must match DRM_MODE_CONN static QByteArray nameForConnector(const drmModeConnectorPtr connector) { - QByteArray connectorName("UNKNOWN"); - + const QByteArray id = QByteArray::number(connector->connector_type_id); if (connector->connector_type < ARRAY_LENGTH(connector_type_names)) - connectorName = connector_type_names[connector->connector_type]; - - connectorName += QByteArray::number(connector->connector_type_id); - - return connectorName; + return connector_type_names[connector->connector_type] + id; + return "UNKNOWN" + id; } static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 9803dedb1e..85aab84c2c 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -890,7 +890,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST QString shortcut = accessible->text(QAccessible::Accelerator); if (!shortcut.isEmpty()) - name.append(QLatin1Char(' ') + shortcut); + name += QLatin1Char(' ') + shortcut; if (name.size()) { *pszName = QStringToBSTR(name); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7bd233f387..9e275efa25 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1996,8 +1996,7 @@ void QXcbConnection::initializeAllAtoms() { Q_ASSERT(i == QXcbAtom::NPredefinedAtoms); - QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += m_displayName; + const QByteArray settings_atom_name = "_QT_SETTINGS_TIMESTAMP_" + m_displayName; names[i++] = settings_atom_name; xcb_intern_atom_cookie_t cookies[QXcbAtom::NAtoms]; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index f4da7ba033..af9ffab8ae 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -447,12 +447,8 @@ QByteArray QXcbIntegration::wmClass() const className[0] = className.at(0).toUpper(); } - if (!name.isEmpty() && !className.isEmpty()) { - m_wmClass = name.toLocal8Bit(); - m_wmClass.append('\0'); - m_wmClass.append(className.toLocal8Bit()); - m_wmClass.append('\0'); - } + if (!name.isEmpty() && !className.isEmpty()) + m_wmClass = name.toLocal8Bit() + '\0' + className.toLocal8Bit() + '\0'; } return m_wmClass; } -- cgit v1.2.3 From 7896ae052ad2c0c6ae2ebfc64cc2f525185198a8 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Dec 2016 13:12:26 +0100 Subject: Accept ZWNJ, ZWJ and PUA characters in input widgets Private Use Area characters are quite valid input characters when used in combination with a custom font. Joiners also serve an important language purpose in semitic writing systems. Note that there is a hack where we disregard any character produced using CTRL or CTRL+SHIFT specifically because of German keyboards. I have chosen to keep the hack in this patch to limit the change (though I have made an exception for ZWJ and ZWNJ since both are produced using Ctrl+Shift on Windows), but it will probably have to be reverted. [ChangeLog][QtWidgets][Input] Accept characters in Private Use Area, as well as zero-width joiners and zero-width non-joiners in input in QLineEdit and QTextEdit. Task-number: QTBUG-42074 Task-number: QTBUG-57003 Change-Id: I73f3b7d587a8670de24e902dc52a51f7721dba5a Reviewed-by: Simon Hausmann --- src/gui/text/qinputcontrol.cpp | 82 +++++++++++++++++ src/gui/text/qinputcontrol_p.h | 76 ++++++++++++++++ src/gui/text/text.pri | 6 +- src/widgets/widgets/qwidgetlinecontrol.cpp | 18 ++-- src/widgets/widgets/qwidgetlinecontrol_p.h | 6 +- src/widgets/widgets/qwidgettextcontrol.cpp | 17 ++-- src/widgets/widgets/qwidgettextcontrol_p.h | 3 +- .../auto/gui/text/qinputcontrol/qinputcontrol.pro | 7 ++ .../gui/text/qinputcontrol/tst_qinputcontrol.cpp | 100 +++++++++++++++++++++ tests/auto/gui/text/text.pro | 3 +- 10 files changed, 289 insertions(+), 29 deletions(-) create mode 100644 src/gui/text/qinputcontrol.cpp create mode 100644 src/gui/text/qinputcontrol_p.h create mode 100644 tests/auto/gui/text/qinputcontrol/qinputcontrol.pro create mode 100644 tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp new file mode 100644 index 0000000000..c2c198866a --- /dev/null +++ b/src/gui/text/qinputcontrol.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qinputcontrol_p.h" +#include + +QT_BEGIN_NAMESPACE + +QInputControl::QInputControl(Type type, QObject *parent) + : QObject(parent) + , m_type(type) +{ +} + +QInputControl::QInputControl(Type type, QObjectPrivate &dd, QObject *parent) + : QObject(dd, parent) + , m_type(type) +{ +} + +bool QInputControl::isAcceptableInput(const QKeyEvent *event) const +{ + const QString text = event->text(); + if (text.isEmpty()) + return false; + + const QChar c = text.at(0); + + // ZWNJ and ZWJ. This needs to go before the next test, since CTRL+SHIFT is + // used to input it on Windows. + if (c == QChar(0x200C) || c == QChar(0x200D)) + return true; + + // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards + if (event->modifiers() == Qt::ControlModifier + || event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { + return false; + } + + if (c.isPrint()) + return true; + + if (c.category() == QChar::Other_PrivateUse) + return true; + + if (m_type == TextEdit && c == QLatin1Char('\t')) + return true; + + return false; +} + +QT_END_NAMESPACE diff --git a/src/gui/text/qinputcontrol_p.h b/src/gui/text/qinputcontrol_p.h new file mode 100644 index 0000000000..3b46067ba9 --- /dev/null +++ b/src/gui/text/qinputcontrol_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QINPUTCONTROL_P_H +#define QINPUTCONTROL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QKeyEvent; +class Q_GUI_EXPORT QInputControl : public QObject +{ + Q_OBJECT +public: + enum Type { + LineEdit, + TextEdit + }; + + explicit QInputControl(Type type, QObject *parent = nullptr); + + bool isAcceptableInput(const QKeyEvent *event) const; + +protected: + explicit QInputControl(Type type, QObjectPrivate &dd, QObject *parent = nullptr); + +private: + const Type m_type; +}; + +QT_END_NAMESPACE + +#endif // QINPUTCONTROL_P_H diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index efd041a5af..abe20abe02 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -39,7 +39,8 @@ HEADERS += \ text/qrawfont_p.h \ text/qglyphrun.h \ text/qglyphrun_p.h \ - text/qdistancefield_p.h + text/qdistancefield_p.h \ + text/qinputcontrol_p.h SOURCES += \ text/qfont.cpp \ @@ -69,7 +70,8 @@ SOURCES += \ text/qstatictext.cpp \ text/qrawfont.cpp \ text/qglyphrun.cpp \ - text/qdistancefield.cpp + text/qdistancefield.cpp \ + text/qinputcontrol.cpp SOURCES += \ text/qfontengine_qpf2.cpp \ diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 9b65dc43d1..a862274a3d 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1924,19 +1924,15 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) unknown = false; } - // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards - if (unknown && !isReadOnly() - && event->modifiers() != Qt::ControlModifier - && event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)) { - QString t = event->text(); - if (!t.isEmpty() && t.at(0).isPrint()) { - insert(t); + if (unknown + && !isReadOnly() + && isAcceptableInput(event)) { + insert(event->text()); #ifndef QT_NO_COMPLETER - complete(event->key()); + complete(event->key()); #endif - event->accept(); - return; - } + event->accept(); + return; } if (unknown) diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index d4a4534fb5..b9340c0aff 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -64,6 +64,7 @@ #include "QtCore/qpoint.h" #include "QtWidgets/qcompleter.h" #include "QtCore/qthread.h" +#include "QtGui/private/qinputcontrol_p.h" #include "qplatformdefs.h" @@ -76,13 +77,14 @@ QT_BEGIN_NAMESPACE -class Q_WIDGETS_EXPORT QWidgetLineControl : public QObject +class Q_WIDGETS_EXPORT QWidgetLineControl : public QInputControl { Q_OBJECT public: QWidgetLineControl(const QString &txt = QString()) - : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto), + : QInputControl(LineEdit) + , m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto), m_hideCursor(false), m_separator(0), m_readOnly(0), m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0), m_validInput(1), m_blinkStatus(0), m_blinkEnabled(false), m_blinkTimer(0), m_deleteAllTimer(0), diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 47806a194e..f5672bd87a 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -848,21 +848,21 @@ void QWidgetTextControl::redo() } QWidgetTextControl::QWidgetTextControl(QObject *parent) - : QObject(*new QWidgetTextControlPrivate, parent) + : QInputControl(QInputControl::TextEdit, *new QWidgetTextControlPrivate, parent) { Q_D(QWidgetTextControl); d->init(); } QWidgetTextControl::QWidgetTextControl(const QString &text, QObject *parent) - : QObject(*new QWidgetTextControlPrivate, parent) + : QInputControl(QInputControl::TextEdit, *new QWidgetTextControlPrivate, parent) { Q_D(QWidgetTextControl); d->init(Qt::RichText, text); } QWidgetTextControl::QWidgetTextControl(QTextDocument *doc, QObject *parent) - : QObject(*new QWidgetTextControlPrivate, parent) + : QInputControl(QInputControl::TextEdit, *new QWidgetTextControlPrivate, parent) { Q_D(QWidgetTextControl); d->init(Qt::RichText, QString(), doc); @@ -1361,14 +1361,7 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e) process: { - // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards - if (e->modifiers() == Qt::ControlModifier - || e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { - e->ignore(); - return; - } - QString text = e->text(); - if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { + if (q->isAcceptableInput(e)) { if (overwriteMode // no need to call deleteChar() if we have a selection, insertText // does it already @@ -1376,7 +1369,7 @@ process: && !cursor.atBlockEnd()) cursor.deleteChar(); - cursor.insertText(text); + cursor.insertText(e->text()); selectionChanged(); } else { e->ignore(); diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h index b45f4fff74..f540a3c9ad 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p.h @@ -63,6 +63,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -75,7 +76,7 @@ class QAbstractScrollArea; class QEvent; class QTimerEvent; -class Q_WIDGETS_EXPORT QWidgetTextControl : public QObject +class Q_WIDGETS_EXPORT QWidgetTextControl : public QInputControl { Q_OBJECT Q_DECLARE_PRIVATE(QWidgetTextControl) diff --git a/tests/auto/gui/text/qinputcontrol/qinputcontrol.pro b/tests/auto/gui/text/qinputcontrol/qinputcontrol.pro new file mode 100644 index 0000000000..811c9aab90 --- /dev/null +++ b/tests/auto/gui/text/qinputcontrol/qinputcontrol.pro @@ -0,0 +1,7 @@ +CONFIG += testcase +TARGET = tst_qinputcontrol + +QT = core gui gui-private testlib + +SOURCES += \ + tst_qinputcontrol.cpp diff --git a/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp new file mode 100644 index 0000000000..ad5ba6affb --- /dev/null +++ b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include + +class tst_QInputControl: public QObject +{ + Q_OBJECT +private slots: + void isAcceptableInput_data(); + void isAcceptableInput(); + void tabOnlyAcceptableInputForTextEdit(); +}; + +void tst_QInputControl::isAcceptableInput_data() +{ + QTest::addColumn("text"); + QTest::addColumn("modifiers"); + QTest::addColumn("acceptable"); + + QTest::newRow("empty-string") << QString() << Qt::KeyboardModifiers() << false; + QTest::newRow("zwnj") << QString(QChar(0x200C)) << Qt::KeyboardModifiers() << true; + QTest::newRow("zwnj-with-ctrl") << QString(QChar(0x200C)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("zwnj-with-ctrl-shift") << QString(QChar(0x200C)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("zwj") << QString(QChar(0x200D)) << Qt::KeyboardModifiers() << true; + QTest::newRow("zwj-with-ctrl") << QString(QChar(0x200D)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("zwj-with-ctrl-shift") << QString(QChar(0x200D)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("printable-latin") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers() << true; + QTest::newRow("printable-latin-with-ctrl") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers(Qt::ControlModifier) << false; + QTest::newRow("printable-latin-with-ctrl-shift") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << false; + QTest::newRow("printable-hebrew") << QString(QChar(0x2135)) << Qt::KeyboardModifiers() << true; + QTest::newRow("private-use-area") << QString(QChar(0xE832)) << Qt::KeyboardModifiers() << true; + QTest::newRow("multiple-printable") << QStringLiteral("foobar") << Qt::KeyboardModifiers() << true; +} + +void tst_QInputControl::isAcceptableInput() +{ + QFETCH(QString, text); + QFETCH(Qt::KeyboardModifiers, modifiers); + QFETCH(bool, acceptable); + + QKeyEvent keyEvent(QKeyEvent::KeyPress, Qt::Key_unknown, modifiers, text); + + { + QInputControl inputControl(QInputControl::TextEdit); + QCOMPARE(inputControl.isAcceptableInput(&keyEvent), acceptable); + } + + { + QInputControl inputControl(QInputControl::LineEdit); + QCOMPARE(inputControl.isAcceptableInput(&keyEvent), acceptable); + } +} + +void tst_QInputControl::tabOnlyAcceptableInputForTextEdit() +{ + QKeyEvent keyEvent(QKeyEvent::KeyPress, Qt::Key_unknown, Qt::KeyboardModifiers(), QLatin1String("\t")); + + { + QInputControl inputControl(QInputControl::TextEdit); + QCOMPARE(inputControl.isAcceptableInput(&keyEvent), true); + } + + { + QInputControl inputControl(QInputControl::LineEdit); + QCOMPARE(inputControl.isAcceptableInput(&keyEvent), false); + } +} + +QTEST_MAIN(tst_QInputControl) +#include "tst_qinputcontrol.moc" + diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro index bb4984767f..d1a3eda4fc 100644 --- a/tests/auto/gui/text/text.pro +++ b/tests/auto/gui/text/text.pro @@ -23,7 +23,8 @@ SUBDIRS=\ qtextscriptengine \ qtexttable \ qzip \ - qtextodfwriter + qtextodfwriter \ + qinputcontrol win32:SUBDIRS -= qtextpiecetable -- cgit v1.2.3 From 888b3f504529274ffb799bcbe88023c79e13e451 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Dec 2016 09:26:01 +0100 Subject: Fix compilation with -no-pch Q_UNUSED(cursor) was failing to compile when configured with -no-pch. Change-Id: I1da3c95c1636ca06f38a97052ee4360232520a8b Reviewed-by: Simon Hausmann --- src/gui/kernel/qplatformnativeinterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp index f48e470d1b..6614d45b12 100644 --- a/src/gui/kernel/qplatformnativeinterface.cpp +++ b/src/gui/kernel/qplatformnativeinterface.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qplatformnativeinterface.h" +#include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 1da70af724e16caa6ce175630f13434fcded512b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 1 Nov 2016 08:40:20 +0000 Subject: QMap: use std::less for defining an order between pointers Reinterpret_cast()ing a pointer to a suitably sized integer is not guaranteed to always give the same result for the same pointer (!). Therefore the resulting integers are not comparable in a meaningful way. std::less is supposed to be used to compare arbitrary pointers, so use it. (Hopefully and reasonably, under the hood std::less does exactly what we were doing, so this isn't BiC.) Change-Id: I9960b3d6e35657fe7a25b842054f5d338280e850 Reviewed-by: Thiago Macieira --- src/corelib/tools/qmap.cpp | 4 +++- src/corelib/tools/qmap.h | 11 ++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 406eb31923..94ed47f898 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -399,7 +399,9 @@ void QMapDataBase::freeData(QMapDataBase *d) With QMap, the items are always sorted by key. \li The key type of a QHash must provide operator==() and a global qHash(Key) function. The key type of a QMap must provide - operator<() specifying a total order. + operator<() specifying a total order. Since Qt 5.8.1 it is also safe + to use a pointer type as key, even if the underlying operator<() + does not provide a total order. \endlist Here's an example QMap with QString keys and \c int values: diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 96ce787446..3f4f034b4e 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -51,6 +51,7 @@ #include #include +#include #ifdef Q_COMPILER_INITIALIZER_LISTS #include @@ -61,11 +62,8 @@ QT_BEGIN_NAMESPACE /* QMap uses qMapLessThanKey() to compare keys. The default implementation uses operator<(). For pointer types, - qMapLessThanKey() casts the pointers to integers before it - compares them, because operator<() is undefined on pointers - that come from different memory blocks. (In practice, this - is only a problem when running a program such as - BoundsChecker.) + qMapLessThanKey() uses std::less (because operator<() on + pointers can be used only between pointers in the same array). */ template inline bool qMapLessThanKey(const Key &key1, const Key &key2) @@ -75,8 +73,7 @@ template inline bool qMapLessThanKey(const Key &key1, const Key &key template inline bool qMapLessThanKey(const Ptr *key1, const Ptr *key2) { - Q_STATIC_ASSERT(sizeof(quintptr) == sizeof(const Ptr *)); - return quintptr(key1) < quintptr(key2); + return std::less()(key1, key2); } struct QMapDataBase; -- cgit v1.2.3 From c131a83f420a3b24a0972efa351dc75df7ec739d Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 16 Nov 2016 17:33:12 +0100 Subject: Doc: update Qt Widgets examples - \image --> \borderedimage - update screenshot if required Change-Id: I0318b1df67154b70c061da7cbd509b8d5337b311 Reviewed-by: Venugopal Shivashankar --- doc/src/images/analogclock-example.png | Bin 14556 -> 6571 bytes doc/src/images/calculator-example.png | Bin 10742 -> 12653 bytes doc/src/images/calendarwidgetexample.png | Bin 38434 -> 20752 bytes doc/src/images/charactermap-example.png | Bin 27937 -> 16452 bytes doc/src/images/codeeditor-example.png | Bin 9202 -> 14994 bytes doc/src/images/digitalclock-example.png | Bin 6603 -> 1376 bytes doc/src/images/groupbox-example.png | Bin 18620 -> 9706 bytes doc/src/images/imageviewer-example.png | Bin 168586 -> 252124 bytes doc/src/images/lineedits-example.png | Bin 14584 -> 8237 bytes doc/src/images/movie-example.png | Bin 12361 -> 22648 bytes doc/src/images/scribble-example.png | Bin 19910 -> 5304 bytes doc/src/images/spinboxes-example.png | Bin 24842 -> 21874 bytes doc/src/images/styles-enabledwood.png | Bin 130767 -> 136903 bytes doc/src/images/tetrix-example.png | Bin 9980 -> 5396 bytes doc/src/images/wiggly-example.png | Bin 6546 -> 8456 bytes doc/src/images/windowflags-example.png | Bin 22945 -> 38998 bytes .../systray/doc/images/systemtray-editor.png | Bin 18147 -> 25407 bytes .../widgets/desktop/systray/doc/src/systray.qdoc | 5 +++-- examples/widgets/doc/images/systemtray-editor.png | Bin 18147 -> 25407 bytes examples/widgets/doc/src/analogclock.qdoc | 3 ++- examples/widgets/doc/src/calculator.qdoc | 6 ++++-- examples/widgets/doc/src/calendarwidget.qdoc | 2 +- examples/widgets/doc/src/charactermap.qdoc | 3 ++- examples/widgets/doc/src/codeeditor.qdoc | 2 +- examples/widgets/doc/src/digitalclock.qdoc | 3 ++- examples/widgets/doc/src/groupbox.qdoc | 2 +- examples/widgets/doc/src/imageviewer.qdoc | 3 ++- examples/widgets/doc/src/lineedits.qdoc | 2 +- examples/widgets/doc/src/movie.qdoc | 2 +- examples/widgets/doc/src/shapedclock.qdoc | 2 +- examples/widgets/doc/src/sliders.qdoc | 3 ++- examples/widgets/doc/src/spinboxes.qdoc | 2 +- examples/widgets/doc/src/styles.qdoc | 3 ++- examples/widgets/doc/src/stylesheet.qdoc | 3 ++- examples/widgets/doc/src/tetrix.qdoc | 2 +- examples/widgets/doc/src/wiggly.qdoc | 3 ++- examples/widgets/doc/src/windowflags.qdoc | 3 ++- 37 files changed, 33 insertions(+), 21 deletions(-) diff --git a/doc/src/images/analogclock-example.png b/doc/src/images/analogclock-example.png index b195f8bf24..2319c2891b 100644 Binary files a/doc/src/images/analogclock-example.png and b/doc/src/images/analogclock-example.png differ diff --git a/doc/src/images/calculator-example.png b/doc/src/images/calculator-example.png index 6f1158d733..9771c4132a 100644 Binary files a/doc/src/images/calculator-example.png and b/doc/src/images/calculator-example.png differ diff --git a/doc/src/images/calendarwidgetexample.png b/doc/src/images/calendarwidgetexample.png index 464be90999..407d9ed46c 100644 Binary files a/doc/src/images/calendarwidgetexample.png and b/doc/src/images/calendarwidgetexample.png differ diff --git a/doc/src/images/charactermap-example.png b/doc/src/images/charactermap-example.png index c1f25a5b83..cceb9a85d8 100644 Binary files a/doc/src/images/charactermap-example.png and b/doc/src/images/charactermap-example.png differ diff --git a/doc/src/images/codeeditor-example.png b/doc/src/images/codeeditor-example.png index b17640695d..32cf94779f 100644 Binary files a/doc/src/images/codeeditor-example.png and b/doc/src/images/codeeditor-example.png differ diff --git a/doc/src/images/digitalclock-example.png b/doc/src/images/digitalclock-example.png index 917035a0f0..21fa33b258 100644 Binary files a/doc/src/images/digitalclock-example.png and b/doc/src/images/digitalclock-example.png differ diff --git a/doc/src/images/groupbox-example.png b/doc/src/images/groupbox-example.png index 443f812340..56f95fa8b1 100644 Binary files a/doc/src/images/groupbox-example.png and b/doc/src/images/groupbox-example.png differ diff --git a/doc/src/images/imageviewer-example.png b/doc/src/images/imageviewer-example.png index 69b4f7ade7..922aa8b92c 100644 Binary files a/doc/src/images/imageviewer-example.png and b/doc/src/images/imageviewer-example.png differ diff --git a/doc/src/images/lineedits-example.png b/doc/src/images/lineedits-example.png index ff5e3184ad..6db951cd4a 100644 Binary files a/doc/src/images/lineedits-example.png and b/doc/src/images/lineedits-example.png differ diff --git a/doc/src/images/movie-example.png b/doc/src/images/movie-example.png index 713f56347e..81f2cdd6ef 100644 Binary files a/doc/src/images/movie-example.png and b/doc/src/images/movie-example.png differ diff --git a/doc/src/images/scribble-example.png b/doc/src/images/scribble-example.png index 54091baa6b..497865e44c 100644 Binary files a/doc/src/images/scribble-example.png and b/doc/src/images/scribble-example.png differ diff --git a/doc/src/images/spinboxes-example.png b/doc/src/images/spinboxes-example.png index 14c42d2404..432ff10a9b 100644 Binary files a/doc/src/images/spinboxes-example.png and b/doc/src/images/spinboxes-example.png differ diff --git a/doc/src/images/styles-enabledwood.png b/doc/src/images/styles-enabledwood.png index 168c1d2d2c..4f3a746ef9 100644 Binary files a/doc/src/images/styles-enabledwood.png and b/doc/src/images/styles-enabledwood.png differ diff --git a/doc/src/images/tetrix-example.png b/doc/src/images/tetrix-example.png index c9764dcccd..2c3dade394 100644 Binary files a/doc/src/images/tetrix-example.png and b/doc/src/images/tetrix-example.png differ diff --git a/doc/src/images/wiggly-example.png b/doc/src/images/wiggly-example.png index b20fbc445d..5ac0d856b3 100644 Binary files a/doc/src/images/wiggly-example.png and b/doc/src/images/wiggly-example.png differ diff --git a/doc/src/images/windowflags-example.png b/doc/src/images/windowflags-example.png index 9028b9b0d1..89730bcc7e 100644 Binary files a/doc/src/images/windowflags-example.png and b/doc/src/images/windowflags-example.png differ diff --git a/examples/widgets/desktop/systray/doc/images/systemtray-editor.png b/examples/widgets/desktop/systray/doc/images/systemtray-editor.png index fb15dea8cb..f7c23db28a 100644 Binary files a/examples/widgets/desktop/systray/doc/images/systemtray-editor.png and b/examples/widgets/desktop/systray/doc/images/systemtray-editor.png differ diff --git a/examples/widgets/desktop/systray/doc/src/systray.qdoc b/examples/widgets/desktop/systray/doc/src/systray.qdoc index b89fed72e0..fe397f83df 100644 --- a/examples/widgets/desktop/systray/doc/src/systray.qdoc +++ b/examples/widgets/desktop/systray/doc/src/systray.qdoc @@ -32,7 +32,8 @@ \brief The System Tray Icon example shows how to add an icon with a menu and popup messages to a desktop environment's system tray. - \image systemtray-example.png Screenshot of the System Tray Icon. + \borderedimage systemtray-example.png + \caption Screenshot of the System Tray Icon Modern operating systems usually provide a special area on the desktop, called the system tray or notification area, where @@ -42,7 +43,7 @@ the main application window (i.e., an editor for the system tray icon) and the associated icon. - \image systemtray-editor.png + \borderedimage systemtray-editor.png The editor allows the user to choose the preferred icon as well as set the balloon message's type and duration. The user can also diff --git a/examples/widgets/doc/images/systemtray-editor.png b/examples/widgets/doc/images/systemtray-editor.png index fb15dea8cb..f7c23db28a 100644 Binary files a/examples/widgets/doc/images/systemtray-editor.png and b/examples/widgets/doc/images/systemtray-editor.png differ diff --git a/examples/widgets/doc/src/analogclock.qdoc b/examples/widgets/doc/src/analogclock.qdoc index d59f9070c5..ff65f97730 100644 --- a/examples/widgets/doc/src/analogclock.qdoc +++ b/examples/widgets/doc/src/analogclock.qdoc @@ -32,7 +32,8 @@ \brief The Analog Clock example shows how to draw the contents of a custom widget. - \image analogclock-example.png Screenshot of the Analog Clock example + \borderedimage analogclock-example.png + \caption Screenshot of the Analog Clock example This example also demonstrates how the transformation and scaling features of QPainter can be used to make drawing custom widgets diff --git a/examples/widgets/doc/src/calculator.qdoc b/examples/widgets/doc/src/calculator.qdoc index 4ee1248e6c..83d85a7fe8 100644 --- a/examples/widgets/doc/src/calculator.qdoc +++ b/examples/widgets/doc/src/calculator.qdoc @@ -33,7 +33,8 @@ functionality of a calculator widget, and how to use QGridLayout to place child widgets in a grid. - \image calculator-example.png Screenshot of the Calculator example + \borderedimage calculator-example.png + \caption Screenshot of the Calculator example The example consists of two classes: @@ -370,6 +371,7 @@ QSizePolicy::Expanding in the constructor and if we didn't reimplement QWidget::sizeHint(). - \image calculator-ugly.png The Calculator example with default size policies and size hints + \borderedimage calculator-ugly.png + \caption The Calculator example with default size policies and size hints */ diff --git a/examples/widgets/doc/src/calendarwidget.qdoc b/examples/widgets/doc/src/calendarwidget.qdoc index 8ab73668cf..c2d86d830c 100644 --- a/examples/widgets/doc/src/calendarwidget.qdoc +++ b/examples/widgets/doc/src/calendarwidget.qdoc @@ -31,7 +31,7 @@ \ingroup examples-widgets \brief The Calendar Widget example shows use of QCalendarWidget. - \image calendarwidgetexample.png + \borderedimage calendarwidgetexample.png QCalendarWidget displays one calendar month at a time and lets the user select a date. diff --git a/examples/widgets/doc/src/charactermap.qdoc b/examples/widgets/doc/src/charactermap.qdoc index ec6a2c6fe3..3cf4a1210b 100644 --- a/examples/widgets/doc/src/charactermap.qdoc +++ b/examples/widgets/doc/src/charactermap.qdoc @@ -38,7 +38,8 @@ copied into the clipboard, and pasted into other applications. The purpose behind this sort of tool is to allow users to enter characters that may be unavailable or difficult to locate on their keyboards. -\image charactermap-example.png Screenshot of the Character Map example +\borderedimage charactermap-example.png +\caption Screenshot of the Character Map example The example consists of the following classes: diff --git a/examples/widgets/doc/src/codeeditor.qdoc b/examples/widgets/doc/src/codeeditor.qdoc index bcc3564eb9..7f09f4bba0 100644 --- a/examples/widgets/doc/src/codeeditor.qdoc +++ b/examples/widgets/doc/src/codeeditor.qdoc @@ -32,7 +32,7 @@ \brief The Code Editor example shows how to create a simple editor that has line numbers and that highlights the current line. - \image codeeditor-example.png + \borderedimage codeeditor-example.png As can be seen from the image, the editor displays the line numbers in an area to the left of the area for editing. The editor diff --git a/examples/widgets/doc/src/digitalclock.qdoc b/examples/widgets/doc/src/digitalclock.qdoc index aa0d898ec9..aff349adb8 100644 --- a/examples/widgets/doc/src/digitalclock.qdoc +++ b/examples/widgets/doc/src/digitalclock.qdoc @@ -32,7 +32,8 @@ \brief The Digital Clock example shows how to use QLCDNumber to display a number with LCD-like digits. - \image digitalclock-example.png Screenshot of the Digital Clock example + \borderedimage digitalclock-example.png + \caption Screenshot of the Digital Clock example This example also demonstrates how QTimer can be used to update a widget at regular intervals. diff --git a/examples/widgets/doc/src/groupbox.qdoc b/examples/widgets/doc/src/groupbox.qdoc index d567f57272..b9da2f05f4 100644 --- a/examples/widgets/doc/src/groupbox.qdoc +++ b/examples/widgets/doc/src/groupbox.qdoc @@ -40,7 +40,7 @@ Group boxes are usually used to organize check boxes and radio buttons into exclusive groups. - \image groupbox-example.png + \borderedimage groupbox-example.png The Group Boxes example consists of a single \c Window class that is used to show four group boxes: an exclusive radio button group, diff --git a/examples/widgets/doc/src/imageviewer.qdoc b/examples/widgets/doc/src/imageviewer.qdoc index 02fc4cd56f..91b6385356 100644 --- a/examples/widgets/doc/src/imageviewer.qdoc +++ b/examples/widgets/doc/src/imageviewer.qdoc @@ -44,7 +44,8 @@ can be used to implement zooming and scaling features. In addition the example shows how to use QPainter to print an image. - \image imageviewer-example.png Screenshot of the Image Viewer example + \borderedimage imageviewer-example.png + \caption Screenshot of the Image Viewer example With the Image Viewer application, the users can view an image of their choice. The \uicontrol File menu gives the user the possibility diff --git a/examples/widgets/doc/src/lineedits.qdoc b/examples/widgets/doc/src/lineedits.qdoc index 906ec76962..5cf321bbb1 100644 --- a/examples/widgets/doc/src/lineedits.qdoc +++ b/examples/widgets/doc/src/lineedits.qdoc @@ -34,7 +34,7 @@ on the input and output supplied by the user. - \image lineedits-example.png + \borderedimage lineedits-example.png The example consists of a single \c Window class, containing a selection of line edits with different input constraints and display properties that can be diff --git a/examples/widgets/doc/src/movie.qdoc b/examples/widgets/doc/src/movie.qdoc index a5c06ce93a..2363383ffe 100644 --- a/examples/widgets/doc/src/movie.qdoc +++ b/examples/widgets/doc/src/movie.qdoc @@ -36,5 +36,5 @@ a simple animation without the added complexity of a multimedia framework to install and deploy. - \image movie-example.png + \borderedimage movie-example.png */ diff --git a/examples/widgets/doc/src/shapedclock.qdoc b/examples/widgets/doc/src/shapedclock.qdoc index 9e21e519fe..2e5d8b1496 100644 --- a/examples/widgets/doc/src/shapedclock.qdoc +++ b/examples/widgets/doc/src/shapedclock.qdoc @@ -32,7 +32,7 @@ \brief The Shaped Clock example shows how to apply a widget mask to a top-level widget to produce a shaped window. - \image shapedclock-example.png + \borderedimage shapedclock-example.png Widget masks are used to customize the shapes of top-level widgets by restricting the available area for painting. On some window systems, setting certain window flags diff --git a/examples/widgets/doc/src/sliders.qdoc b/examples/widgets/doc/src/sliders.qdoc index b8ef2ace39..eb9a932c76 100644 --- a/examples/widgets/doc/src/sliders.qdoc +++ b/examples/widgets/doc/src/sliders.qdoc @@ -43,7 +43,8 @@ The example also demonstrates how signals and slots can be used to synchronize the behavior of two or more widgets. - \image sliders-example.png Screenshot of the Sliders example + \borderedimage sliders-example.png + \caption Screenshot of the Sliders example The Sliders example consists of two classes: diff --git a/examples/widgets/doc/src/spinboxes.qdoc b/examples/widgets/doc/src/spinboxes.qdoc index 2be6321782..4478ce12d2 100644 --- a/examples/widgets/doc/src/spinboxes.qdoc +++ b/examples/widgets/doc/src/spinboxes.qdoc @@ -33,7 +33,7 @@ spin boxes available in Qt, from a simple QSpinBox widget to more complex editors like the QDateTimeEdit widget. - \image spinboxes-example.png + \borderedimage spinboxes-example.png The example consists of a single \c Window class that is used to display the different spin box-based widgets available with Qt. diff --git a/examples/widgets/doc/src/styles.qdoc b/examples/widgets/doc/src/styles.qdoc index abab595434..4fea8f3bfc 100644 --- a/examples/widgets/doc/src/styles.qdoc +++ b/examples/widgets/doc/src/styles.qdoc @@ -32,7 +32,8 @@ \brief The Styles example illustrates how to create custom widget drawing styles using Qt, and demonstrates Qt's predefined styles. - \image styles-enabledwood.png Screenshot of the Styles example + \borderedimage styles-enabledwood.png + \caption Screenshot of the Styles example A style in Qt is a subclass of QStyle or of one of its subclasses. Styles perform drawing on behalf of widgets. Qt diff --git a/examples/widgets/doc/src/stylesheet.qdoc b/examples/widgets/doc/src/stylesheet.qdoc index de330ce131..0016836f0d 100644 --- a/examples/widgets/doc/src/stylesheet.qdoc +++ b/examples/widgets/doc/src/stylesheet.qdoc @@ -31,6 +31,7 @@ \ingroup examples-widgets \brief The Style Sheet Example shows how to use style sheets. - \image stylesheet-pagefold.png Screen Shot of the Pagefold style sheet + \borderedimage stylesheet-pagefold.png + \caption Screen Shot of the Pagefold style sheet */ diff --git a/examples/widgets/doc/src/tetrix.qdoc b/examples/widgets/doc/src/tetrix.qdoc index 12aa23606b..ddcf95013b 100644 --- a/examples/widgets/doc/src/tetrix.qdoc +++ b/examples/widgets/doc/src/tetrix.qdoc @@ -31,7 +31,7 @@ \ingroup examples-widgets \brief The Tetrix example is a Qt version of the classic Tetrix game. - \image tetrix-example.png + \borderedimage tetrix-example.png The object of the game is to stack pieces dropped from the top of the playing area so that they fill entire rows at the bottom of the playing area. diff --git a/examples/widgets/doc/src/wiggly.qdoc b/examples/widgets/doc/src/wiggly.qdoc index bf14f7ba0d..f330b016df 100644 --- a/examples/widgets/doc/src/wiggly.qdoc +++ b/examples/widgets/doc/src/wiggly.qdoc @@ -34,7 +34,8 @@ addition, the example demonstrates how to use QFontMetrics to determine the size of text on screen. - \image wiggly-example.png Screenshot of the Wiggly example + \borderedimage wiggly-example.png + \caption Screenshot of the Wiggly example QBasicTimer is a low-level class for timers. Unlike QTimer, QBasicTimer doesn't inherit from QObject; instead of emitting a diff --git a/examples/widgets/doc/src/windowflags.qdoc b/examples/widgets/doc/src/windowflags.qdoc index 636c605370..3fe00cd266 100644 --- a/examples/widgets/doc/src/windowflags.qdoc +++ b/examples/widgets/doc/src/windowflags.qdoc @@ -41,7 +41,8 @@ A widget's flags are stored in a Qt::WindowFlags type which stores an OR combination of the flags. - \image windowflags-example.png Screenshot of the Window Flags example + \borderedimage windowflags-example.png + \caption Screenshot of the Window Flags example The example consists of two classes: -- cgit v1.2.3 From ee7a5a94f9bb0e56053603c6727202af0e851aa4 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 8 Dec 2016 15:36:07 +0100 Subject: Doc: added spec about parameter enable Err: Undocumented parameter 'enable' in QNetworkProxyFactory::setUseSystemConfiguration() Err: no such parameter 'editable' in QComboBox::setCompleter() Change-Id: Ib27b93cf74e97efd656eda1265003f33c6802005 Reviewed-by: Venugopal Shivashankar --- src/network/kernel/qnetworkproxy.cpp | 4 ++-- src/widgets/widgets/qcombobox.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index ce491e0fcb..0be8a7f79e 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1517,8 +1517,8 @@ bool QNetworkProxyFactory::usesSystemConfiguration() Enables the use of the platform-specific proxy settings, and only those. See systemProxyForQuery() for more information. - Calling setUseSystemConfiguration(\c{true}) will reset any proxy or - QNetworkProxyFactory already set. + Calling this function with \a enable set to \c true resets any proxy + or QNetworkProxyFactory that is already set. \note See the systemProxyForQuery() documentation for a list of limitations related to the use of system proxies. diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index abb24a7f1e..4519265fb8 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1841,7 +1841,7 @@ QLineEdit *QComboBox::lineEdit() const Sets the \a validator to use instead of the current validator. - \note The validator is removed when the editable property becomes \c false. + \note The validator is removed when the \l editable property becomes \c false. */ void QComboBox::setValidator(const QValidator *v) @@ -1876,7 +1876,7 @@ const QValidator *QComboBox::validator() const By default, for an editable combo box, a QCompleter that performs case insensitive inline completion is automatically created. - \note The completer is removed when the \a editable property becomes \c false. + \note The completer is removed when the \l editable property becomes \c false. */ void QComboBox::setCompleter(QCompleter *c) { -- cgit v1.2.3 From 00c9ec63a552d040e851b561c11428fabf1a2b08 Mon Sep 17 00:00:00 2001 From: Lambert Duijst Date: Thu, 8 Dec 2016 11:07:07 +0100 Subject: Fix for horizontal scrollbars Horizontal scrollbars scroll in the wrong direction when the app has a stylesheet and the LayoutDirection is RightToLeft. Change-Id: I860cb733709e8d59a7b844f2b6ed1ee63410956e Reviewed-by: Friedemann Kleint --- src/widgets/styles/qstylesheetstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 8e77ae0e44..d63c96bf0e 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5542,9 +5542,9 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp } else { sliderlen = maxlen; } - + const int sliderPosition = sb->orientation == Qt::Horizontal && sb->direction == Qt::RightToLeft ? sb->maximum - sb->sliderPosition + sb->minimum : sb->sliderPosition; int sliderstart = (styleOptionSlider.orientation == Qt::Horizontal ? contentRect.left() : contentRect.top()) - + sliderPositionFromValue(sb->minimum, sb->maximum, sb->sliderPosition, + + sliderPositionFromValue(sb->minimum, sb->maximum, sliderPosition, maxlen - sliderlen, sb->upsideDown); QRect sr = (sb->orientation == Qt::Horizontal) -- cgit v1.2.3