diff options
-rw-r--r-- | config_help.txt | 4 | ||||
-rw-r--r-- | configure.json | 1 | ||||
-rw-r--r-- | configure.pri | 11 | ||||
-rw-r--r-- | mkspecs/android-clang/qmake.conf | 4 | ||||
-rw-r--r-- | mkspecs/features/qml_module.prf | 17 | ||||
-rw-r--r-- | src/corelib/thread/qreadwritelock.h | 28 | ||||
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 229 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 2 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.h | 6 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 15 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetrepaintmanager.cpp | 49 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetrepaintmanager_p.h | 5 |
13 files changed, 205 insertions, 168 deletions
diff --git a/config_help.txt b/config_help.txt index 19991becb6..614c395f90 100644 --- a/config_help.txt +++ b/config_help.txt @@ -203,8 +203,8 @@ Build environment: -android-ndk-platform Set Android platform -android-ndk-host .... Set Android NDK host (linux-x86, linux-x86_64, etc.) [$ANDROID_NDK_HOST] - -android-arch ........ Set Android architecture (armeabi, armeabi-v7a, - arm64-v8a, x86, x86_64) + -android-abis ....... Comma separated Android abis, default is: + armeabi-v7a,arm64-v8a,x86,x86_64 -android-toolchain-version ... Set Android toolchain version -android-style-assets Automatically extract style assets from the device at run time. This option makes the Android style behave diff --git a/configure.json b/configure.json index 6a7b5924cd..c6ea80b076 100644 --- a/configure.json +++ b/configure.json @@ -51,6 +51,7 @@ "translationdir": "string", "android-arch": "string", + "android-abis": "string", "android-ndk": "string", "android-ndk-host": "string", "android-ndk-platform": "string", diff --git a/configure.pri b/configure.pri index cbd11c2f67..d803dcf086 100644 --- a/configure.pri +++ b/configure.pri @@ -618,10 +618,11 @@ defineTest(qtConfOutput_prepareOptions) { qtConfFatalError("Specified Android NDK host is invalid.") } - target_arch = $$eval(config.input.android-arch) - isEmpty(target_arch): \ - target_arch = armeabi-v7a - + android_abis = $$eval(config.input.android-abis) + isEmpty(android_abis): \ + android_abis = $$eval(config.input.android-arch) + isEmpty(android_abis): \ + android_abis = armeabi-v7a,arm64-v8a,x86,x86_64 platform = $$eval(config.input.android-ndk-platform) isEmpty(platform): \ platform = android-21 @@ -631,7 +632,7 @@ defineTest(qtConfOutput_prepareOptions) { "DEFAULT_ANDROID_NDK_ROOT = $$val_escape(ndk_root)" \ "DEFAULT_ANDROID_PLATFORM = $$platform" \ "DEFAULT_ANDROID_NDK_HOST = $$ndk_host" \ - "DEFAULT_ANDROID_TARGET_ARCH = $$target_arch" \ + "DEFAULT_ANDROID_ABIS = $$split(android_abis, ',')" \ "DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION = $$ndk_tc_ver" } diff --git a/mkspecs/android-clang/qmake.conf b/mkspecs/android-clang/qmake.conf index 8252f400a1..21847cdc7c 100644 --- a/mkspecs/android-clang/qmake.conf +++ b/mkspecs/android-clang/qmake.conf @@ -37,7 +37,9 @@ isEmpty(ANDROID_SDK_BUILD_TOOLS_REVISION) { } } -ALL_ANDROID_ABIS = arm64-v8a armeabi-v7a x86_64 x86 +ALL_ANDROID_ABIS = $$(ALL_ANDROID_ABIS) +isEmpty(ALL_ANDROID_ABIS): ALL_ANDROID_ABIS = $$DEFAULT_ANDROID_ABIS +isEmpty(ALL_ANDROID_ABIS): ALL_ANDROID_ABIS = arm64-v8a armeabi-v7a x86_64 x86 CONFIG += $$ANDROID_PLATFORM diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index 57cfec78b3..c0b50416c9 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -52,15 +52,26 @@ builtin_resources { qmldir.base = $$qmldir_path qmldir.files = $$qmldir_file qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH -INSTALLS += qmldir qmlfiles.base = $$_PRO_FILE_PWD_ qmlfiles.files = $$fq_aux_qml_files install_qml_files: qmlfiles.files += $$fq_qml_files qmlfiles.path = $${qmldir.path} -INSTALLS += qmlfiles -!debug_and_release|!build_all|CONFIG(release, debug|release) { +INSTALL_QML_FILES = false + +android { + build_pass { + isEmpty(ANDROID_ABIS): ANDROID_ABIS = $$ALL_ANDROID_ABIS + ABI = $$first(ANDROID_ABIS) + equals(ABI, $$QT_ARCH): INSTALL_QML_FILES = true + } +} else: !debug_and_release|!build_all|CONFIG(release, debug|release): INSTALL_QML_FILES = true + +equals(INSTALL_QML_FILES, true) { + INSTALLS += qmldir + INSTALLS += qmlfiles + !prefix_build { COPIES += qmldir qmlfiles } else { diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h index 139fde9214..3c1ed91b94 100644 --- a/src/corelib/thread/qreadwritelock.h +++ b/src/corelib/thread/qreadwritelock.h @@ -183,15 +183,15 @@ public: inline explicit QReadWriteLock(RecursionMode = NonRecursive) noexcept { } inline ~QReadWriteLock() { } - static inline void lockForRead() noexcept { } - static inline bool tryLockForRead() noexcept { return true; } - static inline bool tryLockForRead(int timeout) noexcept { Q_UNUSED(timeout); return true; } + void lockForRead() noexcept { } + bool tryLockForRead() noexcept { return true; } + bool tryLockForRead(int timeout) noexcept { Q_UNUSED(timeout); return true; } - static inline void lockForWrite() noexcept { } - static inline bool tryLockForWrite() noexcept { return true; } - static inline bool tryLockForWrite(int timeout) noexcept { Q_UNUSED(timeout); return true; } + void lockForWrite() noexcept { } + bool tryLockForWrite() noexcept { return true; } + bool tryLockForWrite(int timeout) noexcept { Q_UNUSED(timeout); return true; } - static inline void unlock() noexcept { } + void unlock() noexcept { } private: Q_DISABLE_COPY(QReadWriteLock) @@ -200,12 +200,12 @@ private: class Q_CORE_EXPORT QReadLocker { public: - inline QReadLocker(QReadWriteLock *) noexcept { } + inline explicit QReadLocker(QReadWriteLock *) noexcept { } inline ~QReadLocker() noexcept { } - static inline void unlock() noexcept { } - static inline void relock() noexcept { } - static inline QReadWriteLock *readWriteLock() noexcept { return nullptr; } + void unlock() noexcept { } + void relock() noexcept { } + QReadWriteLock *readWriteLock() noexcept { return nullptr; } private: Q_DISABLE_COPY(QReadLocker) @@ -217,9 +217,9 @@ public: inline explicit QWriteLocker(QReadWriteLock *) noexcept { } inline ~QWriteLocker() noexcept { } - static inline void unlock() noexcept { } - static inline void relock() noexcept { } - static inline QReadWriteLock *readWriteLock() noexcept { return nullptr; } + void unlock() noexcept { } + void relock() noexcept { } + QReadWriteLock *readWriteLock() noexcept { return nullptr; } private: Q_DISABLE_COPY(QWriteLocker) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 4c7b8a6917..4cba67051b 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -259,7 +259,7 @@ static QString shellQuoteUnix(const QString &arg) }; // 0-32 \'"$`<>|;&(){}*?#!~[] if (!arg.length()) - return QString::fromLatin1("\"\""); + return QLatin1String("\"\""); QString ret(arg); if (hasSpecialChars(ret, iqm)) { @@ -282,7 +282,7 @@ static QString shellQuoteWin(const QString &arg) }; if (!arg.length()) - return QString::fromLatin1("\"\""); + return QLatin1String("\"\""); QString ret(arg); if (hasSpecialChars(ret, iqm)) { @@ -324,11 +324,11 @@ QString fileArchitecture(const Options &options, const QString &path) if (!arch.isEmpty()) return arch; - QString readElf = QStringLiteral("%1/toolchains/%2/prebuilt/%3/bin/llvm-readobj").arg(options.ndkPath, + QString readElf = QLatin1String("%1/toolchains/%2/prebuilt/%3/bin/llvm-readobj").arg(options.ndkPath, options.toolchainPrefix, options.ndkHost); #if defined(Q_OS_WIN32) - readElf += QStringLiteral(".exe"); + readElf += QLatin1String(".exe"); #endif if (!QFile::exists(readElf)) { @@ -336,7 +336,7 @@ QString fileArchitecture(const Options &options, const QString &path) return {}; } - readElf = QStringLiteral("%1 -needed-libs %2").arg(shellQuote(readElf), shellQuote(path)); + readElf = QLatin1String("%1 -needed-libs %2").arg(shellQuote(readElf), shellQuote(path)); FILE *readElfCommand = openProcess(readElf); if (!readElfCommand) { @@ -524,7 +524,7 @@ Options parseOptions() } if (options.inputFileName.isEmpty()) - options.inputFileName = QString::fromLatin1("android-lib%1.so-deployment-settings.json").arg(QDir::current().dirName()); + options.inputFileName = QLatin1String("android-lib%1.so-deployment-settings.json").arg(QDir::current().dirName()); options.timing = qEnvironmentVariableIsSet("ANDROIDDEPLOYQT_TIMING_OUTPUT"); @@ -717,7 +717,7 @@ QString cleanPackageName(QString packageName) } } if (keywords.contains(word)) { - packageName.insert(next, QStringLiteral("_")); + packageName.insert(next, QLatin1String("_")); index = next + 1; } else { index = next; @@ -729,7 +729,7 @@ QString cleanPackageName(QString packageName) QString detectLatestAndroidPlatform(const QString &sdkPath) { - QDir dir(sdkPath + QStringLiteral("/platforms")); + QDir dir(sdkPath + QLatin1String("/platforms")); if (!dir.exists()) { fprintf(stderr, "Directory %s does not exist\n", qPrintable(dir.absolutePath())); return QString(); @@ -759,7 +759,7 @@ QString packageNameFromAndroidManifest(const QString &androidManifestPath) reader.attributes().value(QLatin1String("package")).toString()); } } - return QString(); + return {}; } bool readInputFile(Options *options) @@ -801,13 +801,13 @@ bool readInputFile(Options *options) { - const QJsonValue value = jsonObject.value(QStringLiteral("sdkBuildToolsRevision")); + const QJsonValue value = jsonObject.value(QLatin1String("sdkBuildToolsRevision")); if (!value.isUndefined()) options->sdkBuildToolsVersion = value.toString(); } { - const QJsonValue qtInstallDirectory = jsonObject.value(QStringLiteral("qt")); + const QJsonValue qtInstallDirectory = jsonObject.value(QLatin1String("qt")); if (qtInstallDirectory.isUndefined()) { fprintf(stderr, "No Qt directory in json file %s\n", qPrintable(options->inputFileName)); return false; @@ -824,13 +824,13 @@ bool readInputFile(Options *options) } { - const QJsonValue androidSourcesDirectory = jsonObject.value(QStringLiteral("android-package-source-directory")); + const QJsonValue androidSourcesDirectory = jsonObject.value(QLatin1String("android-package-source-directory")); if (!androidSourcesDirectory.isUndefined()) options->androidSourceDirectory = androidSourcesDirectory.toString(); } { - const QJsonValue androidVersionName = jsonObject.value(QStringLiteral("android-version-name")); + const QJsonValue androidVersionName = jsonObject.value(QLatin1String("android-version-name")); if (!androidVersionName.isUndefined()) options->versionName = androidVersionName.toString(); else @@ -838,7 +838,7 @@ bool readInputFile(Options *options) } { - const QJsonValue androidVersionCode = jsonObject.value(QStringLiteral("android-version-code")); + const QJsonValue androidVersionCode = jsonObject.value(QLatin1String("android-version-code")); if (!androidVersionCode.isUndefined()) options->versionCode = androidVersionCode.toString(); else @@ -846,7 +846,7 @@ bool readInputFile(Options *options) } { - const QJsonObject targetArchitectures = jsonObject.value(QStringLiteral("architectures")).toObject(); + const QJsonObject targetArchitectures = jsonObject.value(QLatin1String("architectures")).toObject(); if (targetArchitectures.isEmpty()) { fprintf(stderr, "No target architecture defined in json file.\n"); return false; @@ -863,7 +863,7 @@ bool readInputFile(Options *options) } { - const QJsonValue ndk = jsonObject.value(QStringLiteral("ndk")); + const QJsonValue ndk = jsonObject.value(QLatin1String("ndk")); if (ndk.isUndefined()) { fprintf(stderr, "No NDK path defined in json file.\n"); return false; @@ -872,7 +872,7 @@ bool readInputFile(Options *options) } { - const QJsonValue toolchainPrefix = jsonObject.value(QStringLiteral("toolchain-prefix")); + const QJsonValue toolchainPrefix = jsonObject.value(QLatin1String("toolchain-prefix")); if (toolchainPrefix.isUndefined()) { fprintf(stderr, "No toolchain prefix defined in json file.\n"); return false; @@ -881,7 +881,7 @@ bool readInputFile(Options *options) } { - const QJsonValue ndkHost = jsonObject.value(QStringLiteral("ndk-host")); + const QJsonValue ndkHost = jsonObject.value(QLatin1String("ndk-host")); if (ndkHost.isUndefined()) { fprintf(stderr, "No NDK host defined in json file.\n"); return false; @@ -890,19 +890,19 @@ bool readInputFile(Options *options) } { - const QJsonValue extraLibs = jsonObject.value(QStringLiteral("android-extra-libs")); + const QJsonValue extraLibs = jsonObject.value(QLatin1String("android-extra-libs")); if (!extraLibs.isUndefined()) options->extraLibs = extraLibs.toString().split(QLatin1Char(','), QString::SkipEmptyParts); } { - const QJsonValue extraPlugins = jsonObject.value(QStringLiteral("android-extra-plugins")); + const QJsonValue extraPlugins = jsonObject.value(QLatin1String("android-extra-plugins")); if (!extraPlugins.isUndefined()) options->extraPlugins = extraPlugins.toString().split(QLatin1Char(',')); } { - const QJsonValue stdcppPath = jsonObject.value(QStringLiteral("stdcpp-path")); + const QJsonValue stdcppPath = jsonObject.value(QLatin1String("stdcpp-path")); if (stdcppPath.isUndefined()) { fprintf(stderr, "No stdcpp-path defined in json file.\n"); return false; @@ -911,19 +911,19 @@ bool readInputFile(Options *options) } { - const QJsonValue qmlRootPath = jsonObject.value(QStringLiteral("qml-root-path")); + const QJsonValue qmlRootPath = jsonObject.value(QLatin1String("qml-root-path")); if (!qmlRootPath.isUndefined()) options->rootPath = qmlRootPath.toString(); } { - const QJsonValue qmlImportPaths = jsonObject.value(QStringLiteral("qml-import-paths")); + const QJsonValue qmlImportPaths = jsonObject.value(QLatin1String("qml-import-paths")); if (!qmlImportPaths.isUndefined()) options->qmlImportPaths = qmlImportPaths.toString().split(QLatin1Char(',')); } { - const QJsonValue applicationBinary = jsonObject.value(QStringLiteral("application-binary")); + const QJsonValue applicationBinary = jsonObject.value(QLatin1String("application-binary")); if (applicationBinary.isUndefined()) { fprintf(stderr, "No application binary defined in json file.\n"); return false; @@ -931,7 +931,7 @@ bool readInputFile(Options *options) options->applicationBinary = applicationBinary.toString(); if (options->build) { for (auto it = options->architectures.constBegin(); it != options->architectures.constEnd(); ++it) { - if (!QFile::exists(QStringLiteral("%1/libs/%2/lib%3_%2.so").arg(options->outputDirectory, it.key(), options->applicationBinary))) { + if (!QFile::exists(QLatin1String("%1/libs/%2/lib%3_%2.so").arg(options->outputDirectory, it.key(), options->applicationBinary))) { fprintf(stderr, "Cannot find application binary %s.\n", qPrintable(options->applicationBinary)); return false; } @@ -940,7 +940,7 @@ bool readInputFile(Options *options) } { - const QJsonValue deploymentDependencies = jsonObject.value(QStringLiteral("deployment-dependencies")); + const QJsonValue deploymentDependencies = jsonObject.value(QLatin1String("deployment-dependencies")); if (!deploymentDependencies.isUndefined()) { QString deploymentDependenciesString = deploymentDependencies.toString(); const auto dependencies = deploymentDependenciesString.splitRef(QLatin1Char(',')); @@ -975,9 +975,9 @@ bool readInputFile(Options *options) } } - options->packageName = packageNameFromAndroidManifest(options->androidSourceDirectory + QStringLiteral("/AndroidManifest.xml")); + options->packageName = packageNameFromAndroidManifest(options->androidSourceDirectory + QLatin1String("/AndroidManifest.xml")); if (options->packageName.isEmpty()) - options->packageName = cleanPackageName(QStringLiteral("org.qtproject.example.%1").arg(options->applicationBinary)); + options->packageName = cleanPackageName(QLatin1String("org.qtproject.example.%1").arg(options->applicationBinary)); return true; } @@ -993,7 +993,7 @@ bool copyFiles(const QDir &sourceDirectory, const QDir &destinationDirectory, co return false; } - if (!copyFiles(dir, QDir(destinationDirectory.path() + QStringLiteral("/") + dir.dirName()), options, forceOverwrite)) + if (!copyFiles(dir, QDir(destinationDirectory.path() + QLatin1Char('/') + dir.dirName()), options, forceOverwrite)) return false; } else { QString destination = destinationDirectory.absoluteFilePath(entry.fileName()); @@ -1107,13 +1107,13 @@ bool copyAndroidExtraLibs(Options *options) fprintf(stdout, "Skipping \"%s\", architecture mismatch.\n", qPrintable(extraLib)); continue; } - if (!extraLibInfo.fileName().startsWith(QStringLiteral("lib")) || extraLibInfo.suffix() != QStringLiteral("so")) { + if (!extraLibInfo.fileName().startsWith(QLatin1String("lib")) || extraLibInfo.suffix() != QLatin1String("so")) { fprintf(stderr, "The file name of external library %s must begin with \"lib\" and end with the suffix \".so\".\n", qPrintable(extraLib)); return false; } QString destinationFile(options->outputDirectory - + QStringLiteral("/libs/") + + QLatin1String("/libs/") + options->currentArchitecture + QLatin1Char('/') + extraLibInfo.fileName()); @@ -1157,19 +1157,19 @@ bool copyAndroidExtraResources(Options *options) } QDir resourceDir(extraResource); - QString assetsDir = options->outputDirectory + QStringLiteral("/assets/") + resourceDir.dirName() + QLatin1Char('/'); - QString libsDir = options->outputDirectory + QStringLiteral("/libs/") + options->currentArchitecture + QLatin1Char('/'); + QString assetsDir = options->outputDirectory + QLatin1String("/assets/") + resourceDir.dirName() + QLatin1Char('/'); + QString libsDir = options->outputDirectory + QLatin1String("/libs/") + options->currentArchitecture + QLatin1Char('/'); const QStringList files = allFilesInside(resourceDir, resourceDir); for (const QString &resourceFile : files) { QString originFile(resourceDir.filePath(resourceFile)); QString destinationFile; - if (!resourceFile.endsWith(QStringLiteral(".so"))) { + if (!resourceFile.endsWith(QLatin1String(".so"))) { destinationFile = assetsDir + resourceFile; } else { if (!checkArchitecture(*options, originFile)) continue; - destinationFile = libsDir + QStringLiteral("/lib") + QString(resourceDir.dirName() + QLatin1Char('/') + resourceFile).replace(QLatin1Char('/'), QLatin1Char('_')); + destinationFile = libsDir + QLatin1String("/lib") + QString(resourceDir.dirName() + QLatin1Char('/') + resourceFile).replace(QLatin1Char('/'), QLatin1Char('_')); options->archExtraPlugins[options->currentArchitecture] += resourceFile; } if (!copyFileIfNewer(originFile, destinationFile, *options)) @@ -1229,7 +1229,7 @@ bool updateLibsXml(Options *options) if (options->verbose) fprintf(stdout, " -- res/values/libs.xml\n"); - QString fileName = options->outputDirectory + QStringLiteral("/res/values/libs.xml"); + QString fileName = options->outputDirectory + QLatin1String("/res/values/libs.xml"); if (!QFile::exists(fileName)) { fprintf(stderr, "Cannot find %s in prepared packaged. This file is required.\n", qPrintable(fileName)); return false; @@ -1242,22 +1242,22 @@ bool updateLibsXml(Options *options) QString extraLibs; for (auto it = options->architectures.constBegin(); it != options->architectures.constEnd(); ++it) { - QString libsPath = QStringLiteral("libs/") + it.key() + QLatin1Char('/'); + QString libsPath = QLatin1String("libs/") + it.key() + QLatin1Char('/'); - qtLibs += QStringLiteral(" <item>%1;%2</item>\n").arg(it.key(), options->stdCppName); + qtLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), options->stdCppName); for (const Options::BundledFile &bundledFile : options->bundledFiles[it.key()]) { - if (bundledFile.second.startsWith(QStringLiteral("lib/"))) { + if (bundledFile.second.startsWith(QLatin1String("lib/"))) { QString s = bundledFile.second.mid(sizeof("lib/lib") - 1); s.chop(sizeof(".so") - 1); - qtLibs += QStringLiteral(" <item>%1;%2</item>\n").arg(it.key(), s); + qtLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), s); } else if (bundledFile.first.startsWith(libsPath)) { QString s = bundledFile.first.mid(libsPath.length()); bundledInLibs += QString::fromLatin1(" <item>%1;%2:%3</item>\n") .arg(it.key(), s, bundledFile.second); - } else if (bundledFile.first.startsWith(QStringLiteral("assets/"))) { + } else if (bundledFile.first.startsWith(QLatin1String("assets/"))) { QString s = bundledFile.first.mid(sizeof("assets/") - 1); bundledInAssets += QString::fromLatin1(" <item>%1:%2</item>\n") - .arg(s).arg(bundledFile.second); + .arg(s, bundledFile.second); } } @@ -1267,11 +1267,11 @@ bool updateLibsXml(Options *options) const QStringList files = allFilesInside(resourceDir, resourceDir); for (const QString &file : files) { QString destinationPath = resourceDir.dirName() + QLatin1Char('/') + file; - if (!file.endsWith(QStringLiteral(".so"))) { - bundledInAssets += QStringLiteral(" <item>%1:%1</item>\n") + if (!file.endsWith(QLatin1String(".so"))) { + bundledInAssets += QLatin1String(" <item>%1:%1</item>\n") .arg(destinationPath); } else { - bundledInLibs += QStringLiteral(" <item>%1;lib%2:%3</item>\n") + bundledInLibs += QLatin1String(" <item>%1;lib%2:%3</item>\n") .arg(it.key(), QString(destinationPath).replace(QLatin1Char('/'), QLatin1Char('_')), destinationPath); @@ -1285,7 +1285,7 @@ bool updateLibsXml(Options *options) QFileInfo extraLibInfo(extraLib); QString name = extraLibInfo.fileName().mid(sizeof("lib") - 1); name.chop(sizeof(".so") - 1); - extraLibs += QStringLiteral(" <item>%1;%2").arg(it.key(), name); + extraLibs += QLatin1String(" <item>%1;%2").arg(it.key(), name); } } @@ -1295,8 +1295,8 @@ bool updateLibsXml(Options *options) if (localLibs.isEmpty()) { QString plugin; for (const QtDependency &qtDependency : options->qtDependencies[it.key()]) { - if (qtDependency.relativePath.endsWith(QStringLiteral("libqtforandroid.so")) - || qtDependency.relativePath.endsWith(QStringLiteral("libqtforandroidGL.so"))) { + if (qtDependency.relativePath.endsWith(QLatin1String("libqtforandroid.so")) + || qtDependency.relativePath.endsWith(QLatin1String("libqtforandroidGL.so"))) { if (!plugin.isEmpty() && plugin != qtDependency.relativePath) { fprintf(stderr, "Both platform plugins libqtforandroid.so and libqtforandroidGL.so included in package. Please include only one.\n"); return false; @@ -1304,8 +1304,8 @@ bool updateLibsXml(Options *options) plugin = qtDependency.relativePath; } - if (qtDependency.relativePath.contains(QStringLiteral("libQt5OpenGL")) - || qtDependency.relativePath.contains(QStringLiteral("libQt5Quick"))) { + if (qtDependency.relativePath.contains(QLatin1String("libQt5OpenGL")) + || qtDependency.relativePath.contains(QLatin1String("libQt5Quick"))) { options->usesOpenGL |= true; break; } @@ -1322,8 +1322,8 @@ bool updateLibsXml(Options *options) if (options->verbose) fprintf(stdout, " -- Using platform plugin %s\n", qPrintable(plugin)); } - allLocalLibs += QStringLiteral(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(QLatin1Char(':')) - .replace(QStringLiteral("lib/"), QString{}) + allLocalLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(QLatin1Char(':')) + .replace(QLatin1String("lib/"), QString{}) .replace(QLatin1Char('/'), QLatin1Char('_'))); } @@ -1351,7 +1351,7 @@ bool updateStringsXml(const Options &options) QHash<QString, QString> replacements; replacements[QStringLiteral("<!-- %%INSERT_APP_NAME%% -->")] = options.applicationBinary; - QString fileName = options.outputDirectory + QStringLiteral("/res/values/strings.xml"); + QString fileName = options.outputDirectory + QLatin1String("/res/values/strings.xml"); if (!QFile::exists(fileName)) { if (options.verbose) fprintf(stdout, " -- Create strings.xml since it's missing.\n"); @@ -1387,22 +1387,22 @@ bool updateAndroidManifest(Options &options) replacements[QStringLiteral("-- %%INSERT_INIT_CLASSES%% --")] = options.initClasses.join(QLatin1Char(':')); replacements[QStringLiteral("-- %%INSERT_VERSION_NAME%% --")] = options.versionName; replacements[QStringLiteral("-- %%INSERT_VERSION_CODE%% --")] = options.versionCode; - replacements[QStringLiteral("package=\"org.qtproject.example\"")] = QStringLiteral("package=\"%1\"").arg(options.packageName); + replacements[QStringLiteral("package=\"org.qtproject.example\"")] = QLatin1String("package=\"%1\"").arg(options.packageName); replacements[QStringLiteral("-- %%BUNDLE_LOCAL_QT_LIBS%% --")] - = (options.deploymentMechanism == Options::Bundled) ? QStringLiteral("1") : QStringLiteral("0"); + = (options.deploymentMechanism == Options::Bundled) ? QLatin1String("1") : QLatin1String("0"); replacements[QStringLiteral("-- %%USE_LOCAL_QT_LIBS%% --")] - = (options.deploymentMechanism != Options::Ministro) ? QStringLiteral("1") : QStringLiteral("0"); + = (options.deploymentMechanism != Options::Ministro) ? QLatin1String("1") : QLatin1String("0"); QString permissions; for (const QString &permission : qAsConst(options.permissions)) - permissions += QStringLiteral(" <uses-permission android:name=\"%1\" />\n").arg(permission); + permissions += QLatin1String(" <uses-permission android:name=\"%1\" />\n").arg(permission); replacements[QStringLiteral("<!-- %%INSERT_PERMISSIONS -->")] = permissions.trimmed(); QString features; for (const QString &feature : qAsConst(options.features)) - features += QStringLiteral(" <uses-feature android:name=\"%1\" android:required=\"false\" />\n").arg(feature); + features += QLatin1String(" <uses-feature android:name=\"%1\" android:required=\"false\" />\n").arg(feature); if (options.usesOpenGL) - features += QStringLiteral(" <uses-feature android:glEsVersion=\"0x00020000\" android:required=\"true\" />"); + features += QLatin1String(" <uses-feature android:glEsVersion=\"0x00020000\" android:required=\"true\" />"); replacements[QStringLiteral("<!-- %%INSERT_FEATURES -->")] = features.trimmed(); @@ -1522,7 +1522,7 @@ bool readAndroidDependencyXml(Options *options, QSet<QString> *usedDependencies, QSet<QString> *remainingDependencies) { - QString androidDependencyName = absoluteFilePath(options, QStringLiteral("/lib/%1-android-dependencies.xml").arg(moduleName)); + QString androidDependencyName = absoluteFilePath(options, QLatin1String("/lib/%1-android-dependencies.xml").arg(moduleName)); QFile androidDependencyFile(androidDependencyName); if (androidDependencyFile.exists()) { @@ -1593,7 +1593,7 @@ bool readAndroidDependencyXml(Options *options, } else if (!fileName.isEmpty()) { options->localLibs[options->currentArchitecture].append(fileName); } - if (fileName.endsWith(QStringLiteral(".so")) && checkArchitecture(*options, fileName)) { + if (fileName.endsWith(QLatin1String(".so")) && checkArchitecture(*options, fileName)) { remainingDependencies->insert(fileName); } } else if (reader.name() == QLatin1String("permission")) { @@ -1621,11 +1621,11 @@ bool readAndroidDependencyXml(Options *options, QStringList getQtLibsFromElf(const Options &options, const QString &fileName) { - QString readElf = QStringLiteral("%1/toolchains/%2/prebuilt/%3/bin/llvm-readobj").arg(options.ndkPath, + QString readElf = QLatin1String("%1/toolchains/%2/prebuilt/%3/bin/llvm-readobj").arg(options.ndkPath, options.toolchainPrefix, options.ndkHost); #if defined(Q_OS_WIN32) - readElf += QStringLiteral(".exe"); + readElf += QLatin1String(".exe"); #endif if (!QFile::exists(readElf)) { @@ -1633,7 +1633,7 @@ QStringList getQtLibsFromElf(const Options &options, const QString &fileName) return QStringList(); } - readElf = QStringLiteral("%1 -needed-libs %2").arg(shellQuote(readElf), shellQuote(fileName)); + readElf = QLatin1String("%1 -needed-libs %2").arg(shellQuote(readElf), shellQuote(fileName)); FILE *readElfCommand = openProcess(readElf); if (!readElfCommand) { @@ -1664,7 +1664,7 @@ QStringList getQtLibsFromElf(const Options &options, const QString &fileName) if (!line.startsWith("lib")) continue; library = QString::fromLatin1(line); - QString libraryName = QStringLiteral("lib/") + library; + QString libraryName = QLatin1String("lib/") + library; if (QFile::exists(absoluteFilePath(&options, libraryName))) ret += libraryName; } @@ -1751,9 +1751,8 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) for (const QString &qmlImportPath : qAsConst(options->qmlImportPaths)) importPaths += shellQuote(qmlImportPath); - qmlImportScanner += QString::fromLatin1(" -rootPath %1 -importPath %2") - .arg(shellQuote(rootPath)) - .arg(importPaths.join(QLatin1Char(' '))); + qmlImportScanner += QLatin1String(" -rootPath %1 -importPath %2") + .arg(shellQuote(rootPath), importPaths.join(QLatin1Char(' '))); if (options->verbose) { fprintf(stdout, "Running qmlimportscanner with the following command: %s\n", @@ -1846,10 +1845,10 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) fprintf(stdout, " -- Appending dependency found by qmlimportscanner: %s\n", qPrintable(fileName.absolutePath)); // Put all imports in default import path in assets - fileName.relativePath.prepend(QStringLiteral("qml/")); + fileName.relativePath.prepend(QLatin1String("qml/")); options->qtDependencies[options->currentArchitecture].append(fileName); - if (fileName.absolutePath.endsWith(QStringLiteral(".so")) && checkArchitecture(*options, fileName.absolutePath)) { + if (fileName.absolutePath.endsWith(QLatin1String(".so")) && checkArchitecture(*options, fileName.absolutePath)) { QSet<QString> remainingDependencies; if (!readDependenciesFromElf(options, fileName.absolutePath, usedDependencies, &remainingDependencies)) return false; @@ -1878,7 +1877,7 @@ bool readDependencies(Options *options) QSet<QString> remainingDependencies; // Add dependencies of application binary first - if (!readDependenciesFromElf(options, QStringLiteral("%1/libs/%2/lib%3_%2.so").arg(options->outputDirectory, options->currentArchitecture, options->applicationBinary), &usedDependencies, &remainingDependencies)) + if (!readDependenciesFromElf(options, QLatin1String("%1/libs/%2/lib%3_%2.so").arg(options->outputDirectory, options->currentArchitecture, options->applicationBinary), &usedDependencies, &remainingDependencies)) return false; while (!remainingDependencies.isEmpty()) { @@ -1926,10 +1925,10 @@ bool containsApplicationBinary(Options *options) fprintf(stdout, "Checking if application binary is in package.\n"); QFileInfo applicationBinary(options->applicationBinary); - QString applicationFileName = QStringLiteral("lib%1_%2.so").arg(options->applicationBinary, + QString applicationFileName = QLatin1String("lib%1_%2.so").arg(options->applicationBinary, options->currentArchitecture); - QString applicationPath = QStringLiteral("%1/libs/%2/%3").arg(options->outputDirectory, + QString applicationPath = QLatin1String("%1/libs/%2/%3").arg(options->outputDirectory, options->currentArchitecture, applicationFileName); if (!QFile::exists(applicationPath)) { @@ -1962,7 +1961,7 @@ FILE *runAdb(const Options &options, const QString &arguments) if (!options.installLocation.isEmpty()) installOption = QLatin1String(" -s ") + shellQuote(options.installLocation); - adb = QString::fromLatin1("%1%2 %3").arg(shellQuote(adb)).arg(installOption).arg(arguments); + adb = QLatin1String("%1%2 %3").arg(shellQuote(adb), installOption, arguments); if (options.verbose) fprintf(stdout, "Running command \"%s\"\n", adb.toLocal8Bit().constData()); @@ -2012,24 +2011,24 @@ bool copyQtFiles(Options *options) if (!options->build) return true; - QString libsDirectory = QLatin1String("libs/"); + QString libsDirectory = QLatin1String("libs/"); // Copy other Qt dependencies - QString assetsDestinationDirectory = QStringLiteral("assets/--Added-by-androiddeployqt--/"); + auto assetsDestinationDirectory = QLatin1String("assets/--Added-by-androiddeployqt--/"); for (const QtDependency &qtDependency : qAsConst(options->qtDependencies[options->currentArchitecture])) { QString sourceFileName = qtDependency.absolutePath; QString destinationFileName; - if (qtDependency.relativePath.endsWith(QStringLiteral(".so"))) { + if (qtDependency.relativePath.endsWith(QLatin1String(".so"))) { QString garbledFileName; - if (qtDependency.relativePath.startsWith(QStringLiteral("lib/"))) { + if (qtDependency.relativePath.startsWith(QLatin1String("lib/"))) { garbledFileName = qtDependency.relativePath.mid(sizeof("lib/") - 1); } else { garbledFileName = QString(qtDependency.relativePath).replace(QLatin1Char('/'), QLatin1Char('_')); } destinationFileName = libsDirectory + options->currentArchitecture + QLatin1Char('/') + garbledFileName; - } else if (qtDependency.relativePath.startsWith(QStringLiteral("jar/"))) { + } else if (qtDependency.relativePath.startsWith(QLatin1String("jar/"))) { destinationFileName = libsDirectory + qtDependency.relativePath.mid(sizeof("jar/") - 1); } else { destinationFileName = assetsDestinationDirectory + qtDependency.relativePath; @@ -2118,7 +2117,7 @@ bool createAndroidProject(const Options &options) return false; } - QString androidTool = QString::fromLatin1("%1 update project --path %2 --target %3 --name QtApp") + QString androidTool = QLatin1String("%1 update project --path %2 --target %3 --name QtApp") .arg(shellQuote(androidToolExecutable)) .arg(shellQuote(options.outputDirectory)) .arg(shellQuote(options.androidPlatform)); @@ -2140,7 +2139,7 @@ bool createAndroidProject(const Options &options) if (options.verbose) fprintf(stdout, "Updating subproject %s\n", qPrintable(libraryProject)); - androidTool = QString::fromLatin1("%1 update lib-project --path %2 --target %3") + androidTool = QLatin1String("%1 update lib-project --path %2 --target %3") .arg(shellQuote(androidToolExecutable)) .arg(shellQuote(libraryProject)) .arg(shellQuote(options.androidPlatform)); @@ -2272,7 +2271,7 @@ bool buildAndroidProject(const Options &options) return false; } - QString commandLine = QString::fromLatin1("%1 --no-daemon %2").arg(shellQuote(gradlePath)).arg(options.releasePackage ? QLatin1String(" assembleRelease") : QLatin1String(" assembleDebug")); + QString commandLine = QLatin1String("%1 --no-daemon %2").arg(shellQuote(gradlePath), options.releasePackage ? QLatin1String(" assembleRelease") : QLatin1String(" assembleDebug")); if (options.verbose) commandLine += QLatin1String(" --info"); @@ -2407,7 +2406,7 @@ bool copyStdCpp(Options *options) if (options->verbose) fprintf(stdout, "Copying STL library\n"); - QString stdCppPath = QStringLiteral("%1/%2/lib%3.so").arg(options->stdCppPath, options->architectures[options->currentArchitecture], options->stdCppName); + QString stdCppPath = QLatin1String("%1/%2/lib%3.so").arg(options->stdCppPath, options->architectures[options->currentArchitecture], options->stdCppName); if (!QFile::exists(stdCppPath)) { fprintf(stderr, "STL library does not exist at %s\n", qPrintable(stdCppPath)); fflush(stdout); @@ -2415,7 +2414,7 @@ bool copyStdCpp(Options *options) return false; } - const QString destinationFile = QStringLiteral("%1/libs/%2/lib%3.so").arg(options->outputDirectory, + const QString destinationFile = QLatin1String("%1/libs/%2/lib%3.so").arg(options->outputDirectory, options->currentArchitecture, options->stdCppName); return copyFileIfNewer(stdCppPath, destinationFile, *options); @@ -2432,9 +2431,9 @@ bool jarSignerSignPackage(const Options &options) jdkPath = QString::fromLocal8Bit(qgetenv("JAVA_HOME")); #if defined(Q_OS_WIN32) - QString jarSignerTool = QString::fromLatin1("jarsigner.exe"); + QString jarSignerTool = QLatin1String("jarsigner.exe"); #else - QString jarSignerTool = QString::fromLatin1("jarsigner"); + QString jarSignerTool = QLatin1String("jarsigner"); #endif if (jdkPath.isEmpty() || !QFile::exists(jdkPath + QLatin1String("/bin/") + jarSignerTool)) @@ -2447,29 +2446,29 @@ bool jarSignerSignPackage(const Options &options) return false; } - jarSignerTool = QString::fromLatin1("%1 -sigalg %2 -digestalg %3 -keystore %4") - .arg(shellQuote(jarSignerTool)).arg(shellQuote(options.sigAlg)).arg(shellQuote(options.digestAlg)).arg(shellQuote(options.keyStore)); + jarSignerTool = QLatin1String("%1 -sigalg %2 -digestalg %3 -keystore %4") + .arg(shellQuote(jarSignerTool), shellQuote(options.sigAlg), shellQuote(options.digestAlg), shellQuote(options.keyStore)); if (!options.keyStorePassword.isEmpty()) - jarSignerTool += QString::fromLatin1(" -storepass %1").arg(shellQuote(options.keyStorePassword)); + jarSignerTool += QLatin1String(" -storepass %1").arg(shellQuote(options.keyStorePassword)); if (!options.storeType.isEmpty()) - jarSignerTool += QString::fromLatin1(" -storetype %1").arg(shellQuote(options.storeType)); + jarSignerTool += QLatin1String(" -storetype %1").arg(shellQuote(options.storeType)); if (!options.keyPass.isEmpty()) - jarSignerTool += QString::fromLatin1(" -keypass %1").arg(shellQuote(options.keyPass)); + jarSignerTool += QLatin1String(" -keypass %1").arg(shellQuote(options.keyPass)); if (!options.sigFile.isEmpty()) - jarSignerTool += QString::fromLatin1(" -sigfile %1").arg(shellQuote(options.sigFile)); + jarSignerTool += QLatin1String(" -sigfile %1").arg(shellQuote(options.sigFile)); if (!options.signedJar.isEmpty()) - jarSignerTool += QString::fromLatin1(" -signedjar %1").arg(shellQuote(options.signedJar)); + jarSignerTool += QLatin1String(" -signedjar %1").arg(shellQuote(options.signedJar)); if (!options.tsaUrl.isEmpty()) - jarSignerTool += QString::fromLatin1(" -tsa %1").arg(shellQuote(options.tsaUrl)); + jarSignerTool += QLatin1String(" -tsa %1").arg(shellQuote(options.tsaUrl)); if (!options.tsaCert.isEmpty()) - jarSignerTool += QString::fromLatin1(" -tsacert %1").arg(shellQuote(options.tsaCert)); + jarSignerTool += QLatin1String(" -tsacert %1").arg(shellQuote(options.tsaCert)); if (options.internalSf) jarSignerTool += QLatin1String(" -internalsf"); @@ -2480,7 +2479,7 @@ bool jarSignerSignPackage(const Options &options) if (options.protectedAuthenticationPath) jarSignerTool += QLatin1String(" -protected"); - jarSignerTool += QString::fromLatin1(" %1 %2") + jarSignerTool += QLatin1String(" %1 %2") .arg(apkPath(options, UnsignedAPK)) .arg(shellQuote(options.keyStoreAlias)); @@ -2520,11 +2519,11 @@ bool jarSignerSignPackage(const Options &options) } } - zipAlignTool = QString::fromLatin1("%1%2 -f 4 %3 %4") - .arg(shellQuote(zipAlignTool)) - .arg(options.verbose ? QString::fromLatin1(" -v") : QString()) - .arg(apkPath(options, UnsignedAPK)) - .arg(apkPath(options, SignedAPK)); + zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4") + .arg(shellQuote(zipAlignTool), + options.verbose ? QLatin1String(" -v") : QLatin1String(), + apkPath(options, UnsignedAPK), + apkPath(options, SignedAPK)); FILE *zipAlignCommand = openProcess(zipAlignTool); if (zipAlignCommand == 0) { @@ -2575,11 +2574,11 @@ bool signPackage(const Options &options) } } - zipAlignTool = QString::fromLatin1("%1%2 -f 4 %3 %4") - .arg(shellQuote(zipAlignTool)) - .arg(options.verbose ? QString::fromLatin1(" -v") : QString()) - .arg(apkPath(options, UnsignedAPK)) - .arg(apkPath(options, SignedAPK)); + zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4") + .arg(shellQuote(zipAlignTool), + options.verbose ? QLatin1String(" -v") : QLatin1String(), + apkPath(options, UnsignedAPK), + apkPath(options, SignedAPK)); FILE *zipAlignCommand = openProcess(zipAlignTool); if (zipAlignCommand == 0) { @@ -2599,22 +2598,22 @@ bool signPackage(const Options &options) return false; } - QString apkSignerCommandLine = QString::fromLatin1("%1 sign --ks %2") - .arg(shellQuote(apksignerTool)).arg(shellQuote(options.keyStore)); + QString apkSignerCommandLine = QLatin1String("%1 sign --ks %2") + .arg(shellQuote(apksignerTool), shellQuote(options.keyStore)); if (!options.keyStorePassword.isEmpty()) - apkSignerCommandLine += QString::fromLatin1(" --ks-pass pass:%1").arg(shellQuote(options.keyStorePassword)); + apkSignerCommandLine += QLatin1String(" --ks-pass pass:%1").arg(shellQuote(options.keyStorePassword)); if (!options.keyStoreAlias.isEmpty()) - apkSignerCommandLine += QString::fromLatin1(" --ks-key-alias %1").arg(shellQuote(options.keyStoreAlias)); + apkSignerCommandLine += QLatin1String(" --ks-key-alias %1").arg(shellQuote(options.keyStoreAlias)); if (!options.keyPass.isEmpty()) - apkSignerCommandLine += QString::fromLatin1(" --key-pass pass:%1").arg(shellQuote(options.keyPass)); + apkSignerCommandLine += QLatin1String(" --key-pass pass:%1").arg(shellQuote(options.keyPass)); if (options.verbose) apkSignerCommandLine += QLatin1String(" --verbose"); - apkSignerCommandLine += QString::fromLatin1(" %1") + apkSignerCommandLine += QLatin1String(" %1") .arg(apkPath(options, SignedAPK)); auto apkSignerRunner = [&] { @@ -2642,8 +2641,8 @@ bool signPackage(const Options &options) if (!apkSignerRunner()) return false; - apkSignerCommandLine = QString::fromLatin1("%1 verify --verbose %2") - .arg(shellQuote(apksignerTool)).arg(apkPath(options, SignedAPK)); + apkSignerCommandLine = QLatin1String("%1 verify --verbose %2") + .arg(shellQuote(apksignerTool), apkPath(options, SignedAPK)); // Verify the package and remove the unsigned apk return apkSignerRunner() && QFile::remove(apkPath(options, UnsignedAPK)); @@ -2672,7 +2671,7 @@ bool generateAssetsFileList(const Options &options) const QString name = dirIterator.next().mid(assetsPath.length()); int slashIndex = name.lastIndexOf(QLatin1Char('/')); - QString pathName = slashIndex >= 0 ? name.left(slashIndex) : QString::fromLatin1("/"); + QString pathName = slashIndex >= 0 ? name.left(slashIndex) : QStringLiteral("/"); QString fileName = slashIndex >= 0 ? name.mid(pathName.length() + 1) : name; if (!fileName.isEmpty() && dirIterator.fileInfo().isDir() && !fileName.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 6273de56a6..bb00db4c01 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -11523,9 +11523,11 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change) case QGraphicsItem::ItemFlagsHaveChanged: str = "ItemFlagsHaveChanged"; break; +#if QT_DEPRECATED_SINCE(5, 14) case QGraphicsItem::ItemMatrixChange: str = "ItemMatrixChange"; break; +#endif case QGraphicsItem::ItemParentChange: str = "ItemParentChange"; break; diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index 7dd4441ae9..d66a4917e5 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -110,8 +110,10 @@ public: enum GraphicsItemChange { ItemPositionChange, - ItemMatrixChange, - ItemVisibleChange, +#if QT_DEPRECATED_SINCE(5, 14) + ItemMatrixChange Q_DECL_ENUMERATOR_DEPRECATED_X("Use ItemTransformChange instead"), +#endif + ItemVisibleChange = 2, ItemEnabledChange, ItemSelectedChange, ItemParentChange, diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 9e8c0cb500..cf5a81c204 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -119,6 +119,8 @@ QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcWidgetPainting, "qt.widgets.painting", QtWarningMsg); + static inline bool qRectIntersects(const QRect &r1, const QRect &r2) { return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) && @@ -5273,10 +5275,14 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (rgn.isEmpty()) return; + Q_Q(QWidget); + + qCInfo(lcWidgetPainting) << "Drawing" << rgn << "of" << q << "at" << offset + << "into paint device" << pdev << "with" << flags; + const bool asRoot = flags & DrawAsRoot; bool onScreen = shouldPaintOnScreen(); - Q_Q(QWidget); #if QT_CONFIG(graphicseffect) if (graphicsEffect && graphicsEffect->isEnabled()) { QGraphicsEffectSource *source = graphicsEffect->d_func()->source; @@ -5307,9 +5313,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } sourced->context = 0; - // Native widgets need to be marked dirty on screen so painting will be done in correct context - // Same check as in the no effects case below. - if (repaintManager && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) + if (repaintManager) repaintManager->markNeedsFlush(q, rgn, offset); return; @@ -5416,8 +5420,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP sendPaintEvent(toBePainted); } - // Native widgets need to be marked dirty on screen so painting will be done in correct context - if (repaintManager && !asRoot && (q->internalWinId() || (q->nativeParentWidget() && !q->nativeParentWidget()->isWindow()))) + if (repaintManager) repaintManager->markNeedsFlush(q, toBePainted, offset); //restore diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 7d8a3ae737..698928b0b0 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -80,6 +80,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcWidgetPainting); + // Extra QWidget data // - to minimize memory usage for members that are seldom used. // - top-level widgets have extra extra data to reduce cost further diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index 11647ae05e..4eb298e108 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -206,6 +206,9 @@ static inline QRect widgetRectFor(QWidget *widget, const QRegion &) { return wid template <class T> void QWidgetRepaintManager::markDirty(const T &r, QWidget *widget, UpdateTime updateTime, BufferState bufferState) { + qCInfo(lcWidgetPainting) << "Marking" << r << "of" << widget << "dirty" + << "with" << updateTime; + Q_ASSERT(tlw->d_func()->extra); Q_ASSERT(tlw->d_func()->extra->topextra); Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); @@ -370,6 +373,8 @@ void QWidgetRepaintManager::sendUpdateRequest(QWidget *widget, UpdateTime update if (!widget) return; + qCInfo(lcWidgetPainting) << "Sending update request to" << widget << "with" << updateTime; + #ifndef QT_NO_OPENGL // Having every repaint() leading to a sync/flush is bad as it causes // compositing and waiting for vsync each and every time. Change to @@ -713,6 +718,8 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) */ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedRegion) { + qCInfo(lcWidgetPainting) << "Syncing" << exposedRegion << "of" << exposedWidget; + QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize) return; @@ -745,6 +752,8 @@ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedR */ void QWidgetRepaintManager::sync() { + qCInfo(lcWidgetPainting) << "Syncing dirty widgets"; + updateRequestSent = false; if (qt_widget_private(tlw)->shouldDiscardSyncRequest()) { // If the top-level is minimized, it's not visible on the screen so we can delay the @@ -798,6 +807,9 @@ bool QWidgetRepaintManager::syncAllowed() void QWidgetRepaintManager::paintAndFlush() { + qCInfo(lcWidgetPainting) << "Painting and flushing dirty" + << "top level" << dirty << "and dirty widgets" << dirtyWidgets; + const bool updatesDisabled = !tlw->updatesEnabled(); bool repaintAllWidgets = false; @@ -967,12 +979,6 @@ void QWidgetRepaintManager::paintAndFlush() } #endif - // Always flush repainted areas. FIXME: We should mark individual widgets, - // not the top level widget unconditionally, as this results in always - // flushing the top level widget, even if the painted region is entirely - // within a native child. - markNeedsFlush(tlw, toClean, QPoint()); - store->beginPaint(toClean); // Must do this before sending any paint events because @@ -1027,14 +1033,17 @@ void QWidgetRepaintManager::markNeedsFlush(QWidget *widget, const QRegion ®io if (widget == tlw) { // Top-level (native) - if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) - topLevelNeedsFlush += region; + qCInfo(lcWidgetPainting) << "Marking" << region << "of top level" + << widget << "as needing flush"; + topLevelNeedsFlush += region; } else if (!hasPlatformWindow(widget) && !widget->isWindow()) { QWidget *nativeParent = widget->nativeParentWidget(); + qCInfo(lcWidgetPainting) << "Marking" << region << "of" + << widget << "as needing flush in" << nativeParent + << "at offset" << topLevelOffset; if (nativeParent == tlw) { // Alien widgets with the top-level as the native parent (common case) - if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) - topLevelNeedsFlush += region.translated(topLevelOffset); + topLevelNeedsFlush += region.translated(topLevelOffset); } else { // Alien widgets with native parent != tlw const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint()); @@ -1042,6 +1051,8 @@ void QWidgetRepaintManager::markNeedsFlush(QWidget *widget, const QRegion ®io } } else { // Native child widgets + qCInfo(lcWidgetPainting) << "Marking" << region + << "of native child" << widget << "as needing flush"; markNeedsFlush(widget, region); } } @@ -1063,17 +1074,18 @@ void QWidgetRepaintManager::markNeedsFlush(QWidget *widget, const QRegion ®io /*! Flushes the contents of the backing store into the top-level widget. - If the \a widget is non-zero, the content is flushed to the \a widget. */ -void QWidgetRepaintManager::flush(QWidget *widget) +void QWidgetRepaintManager::flush() { + qCInfo(lcWidgetPainting) << "Flushing top level" + << topLevelNeedsFlush << "and children" << needsFlushWidgets; + const bool hasNeedsFlushWidgets = !needsFlushWidgets.isEmpty(); bool flushed = false; // Flush the top level widget if (!topLevelNeedsFlush.isEmpty()) { - QWidget *target = widget ? widget : tlw; - flush(target, topLevelNeedsFlush, widgetTexturesFor(tlw, tlw)); + flush(tlw, topLevelNeedsFlush, widgetTexturesFor(tlw, tlw)); topLevelNeedsFlush = QRegion(); flushed = true; } @@ -1082,11 +1094,8 @@ void QWidgetRepaintManager::flush(QWidget *widget) if (!flushed && !hasNeedsFlushWidgets) { #ifndef QT_NO_OPENGL if (!tlw->d_func()->topData()->widgetTextures.empty()) { - QPlatformTextureList *widgetTextures = widgetTexturesFor(tlw, tlw); - if (widgetTextures) { - QWidget *target = widget ? widget : tlw; - flush(target, QRegion(), widgetTextures); - } + if (QPlatformTextureList *widgetTextures = widgetTexturesFor(tlw, tlw)) + flush(tlw, QRegion(), widgetTextures); } #endif } @@ -1128,6 +1137,8 @@ void QWidgetRepaintManager::flush(QWidget *widget, const QRegion ®ion, QPlatf return; } + qCInfo(lcWidgetPainting) << "Flushing" << region << "of" << widget; + static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS"); if (fpsDebug) { if (!perfFrames++) diff --git a/src/widgets/kernel/qwidgetrepaintmanager_p.h b/src/widgets/kernel/qwidgetrepaintmanager_p.h index e81eee0816..58687383f4 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager_p.h +++ b/src/widgets/kernel/qwidgetrepaintmanager_p.h @@ -65,16 +65,19 @@ class QWidgetRepaintManager; class Q_AUTOTEST_EXPORT QWidgetRepaintManager { + Q_GADGET public: enum UpdateTime { UpdateNow, UpdateLater }; + Q_ENUM(UpdateTime) enum BufferState{ BufferValid, BufferInvalid }; + Q_ENUM(BufferState) QWidgetRepaintManager(QWidget *t); ~QWidgetRepaintManager(); @@ -115,7 +118,7 @@ private: void markNeedsFlush(QWidget *widget, const QRegion ®ion = QRegion()); - void flush(QWidget *widget = nullptr); + void flush(); void flush(QWidget *widget, const QRegion ®ion, QPlatformTextureList *widgetTextures); bool isDirty() const; |