From a367c85e530fde47923ff8a6e70881e69990346e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 23 Apr 2019 11:28:55 +0200 Subject: Doc: Document qmake's plugin_bundle CONFIG value Fixes: QTBUG-17171 Change-Id: I05bf6ba7498fb05394ff8c118973da2b0dbe4fc3 Reviewed-by: Kavindra Palaraja Reviewed-by: Leena Miettinen Reviewed-by: Kai Koehne --- qmake/doc/src/qmake-manual.qdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index a4c314b709..97030acd85 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -1105,6 +1105,8 @@ \header \li Option \li Description \row \li app_bundle \li Puts the executable into a bundle (this is the default). \row \li lib_bundle \li Puts the library into a library bundle. + \row \li plugin_bundle \li Puts the plugin into a plugin bundle. This value + is not supported by the Xcode project generator. \endtable The build process for bundles is also influenced by -- cgit v1.2.3 From 37b5bb42d8fdf66cc0f8428fa64624a34b72b1fd Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 11 Feb 2019 11:55:41 +0100 Subject: manual shortcut test: add more shortcut sequences Change-Id: I45fdda6f35f7ab1416a273ed136e49bc3f002cc4 Reviewed-by: Friedemann Kleint --- tests/manual/shortcuts/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/manual/shortcuts/main.cpp b/tests/manual/shortcuts/main.cpp index acc2a2525c..289e8526f0 100644 --- a/tests/manual/shortcuts/main.cpp +++ b/tests/manual/shortcuts/main.cpp @@ -108,6 +108,7 @@ void ShortcutTester::setupLayout() Qt::ControlModifier + Qt::Key_5, Qt::AltModifier + Qt::Key_5, Qt::ControlModifier + Qt::Key_Plus, Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Plus, + Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Equal, Qt::ControlModifier + Qt::Key_Y, Qt::ShiftModifier + Qt::Key_Comma, Qt::ControlModifier + Qt::Key_Comma, Qt::ControlModifier + Qt::Key_Slash, Qt::ControlModifier + Qt::Key_Backslash @@ -121,6 +122,8 @@ void ShortcutTester::setupLayout() const int keys3[] = { Qt::MetaModifier + Qt::ShiftModifier + Qt::Key_A, + Qt::MetaModifier + Qt::Key_A, + Qt::MetaModifier + Qt::Key_Q, Qt::MetaModifier + Qt::ShiftModifier + Qt::Key_5, Qt::ControlModifier + Qt::Key_BracketRight, Qt::ShiftModifier + Qt::Key_F3, -- cgit v1.2.3 From 7db9e02ad11c391c1d616defd11e7deb2718d60a Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 23 Apr 2019 09:12:30 +1000 Subject: wasm: don't propagate touch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-75263 Change-Id: I099f76114f876b3d6d81df3efb94db126db6a806 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmeventtranslator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp index f4ca49997a..c5c12e9f87 100644 --- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp +++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp @@ -776,7 +776,7 @@ int QWasmEventTranslator::handleTouch(int eventType, const EmscriptenTouchEvent QWindowSystemInterface::handleTouchCancelEvent(window2, getTimestamp(), touchDevice, keyModifier); QWasmEventDispatcher::maintainTimers(); - return 0; + return 1; } quint64 QWasmEventTranslator::getTimestamp() -- cgit v1.2.3 From 0674c870b403e0aa2f93cce4fe432287e425e845 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 12 Apr 2019 21:48:40 -0700 Subject: TinyCBOR: Fix parsing on big-endian machines Original commit from https://github.com/thiagomacieira/tinycbor/pull/1 Change-Id: I194d3f37471a49788a7bfffd1594ef5db19465fd Reviewed-by: Edward Welbourne --- src/3rdparty/tinycbor/src/cborparser.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/tinycbor/src/cborparser.c b/src/3rdparty/tinycbor/src/cborparser.c index 90a7d2ced6..2019e7b808 100644 --- a/src/3rdparty/tinycbor/src/cborparser.c +++ b/src/3rdparty/tinycbor/src/cborparser.c @@ -203,10 +203,13 @@ static CborError preparse_value(CborValue *it) it->extra = 0; /* read up to 16 bits into it->extra */ - if (bytesNeeded <= 2) { + if (bytesNeeded == 1) { + uint8_t extra; + read_bytes_unchecked(it, &extra, 1, bytesNeeded); + it->extra = extra; + } else if (bytesNeeded == 2) { read_bytes_unchecked(it, &it->extra, 1, bytesNeeded); - if (bytesNeeded == 2) - it->extra = cbor_ntohs(it->extra); + it->extra = cbor_ntohs(it->extra); } else { cbor_static_assert(CborIteratorFlag_IntegerValueTooLarge == (Value32Bit & 3)); cbor_static_assert((CborIteratorFlag_IntegerValueIs64Bit | -- cgit v1.2.3 From f2b5baf9d0b723b721d9cb7c60a3c04afe904d4f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 12 Apr 2019 16:48:21 +0200 Subject: Update external links to CMake documentation We don't support CMake version 2 anymore. Instead of just updating to a newer (but fixed) version let's link to the latest documentation. This might create a bigger risk that links get stale, but hopefully let people find always the latest information. Task-number: QTBUG-72159 Change-Id: I082de80cf9ee107b5d017ab8ad6369f2448b0e1b Reviewed-by: Leena Miettinen --- doc/global/externalsites/external-resources.qdoc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/global/externalsites/external-resources.qdoc b/doc/global/externalsites/external-resources.qdoc index 6019f5013f..01c6939dca 100644 --- a/doc/global/externalsites/external-resources.qdoc +++ b/doc/global/externalsites/external-resources.qdoc @@ -62,28 +62,27 @@ */ /*! - \externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package + \externalpage https://cmake.org/cmake/help/latest/command/find_package.html \title CMake find_package Documentation */ /*! - \externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_tgt:AUTOMOC + \externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#automoc \title CMake AUTOMOC Documentation */ - /*! - \externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_tgt:LOCATION + \externalpage https://cmake.org/cmake/help/latest/prop_tgt/LOCATION.html \title CMake LOCATION Documentation */ /*! - \externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_tgt:POSITION_INDEPENDENT_CODE + \externalpage https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html \title CMake POSITION_INDEPENDENT_CODE Documentation */ /*! - \externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:target_link_libraries + \externalpage https://cmake.org/cmake/help/latest/command/target_link_libraries.html \title CMake target_link_libraries Documentation */ -- cgit v1.2.3 From 8f8267f00bfa0d1716e38358ecc0fafff1d9df14 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 4 Apr 2019 10:53:06 +0200 Subject: Avoid hanging on painting dashed lines with non-finite coordinates The dash stroker did not check for inf/nan coordinates. Fixes: QTBUG-47887 Change-Id: I1e696cd15cc37d8fcb6a464cac3da33c3a8b95c2 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qstroker.cpp | 4 ++++ src/gui/painting/qstroker_p.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 292952b7c0..56d0917c6c 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -1150,6 +1150,8 @@ void QDashStroker::processCurrentSubpath() QSubpathFlatIterator it(&m_elements, m_dashThreshold); qfixed2d prev = it.next(); + if (!prev.isFinite()) + return; bool clipping = !m_clip_rect.isEmpty(); qfixed2d move_to_pos = prev; @@ -1165,6 +1167,8 @@ void QDashStroker::processCurrentSubpath() bool hasMoveTo = false; while (it.hasNext()) { QStrokerOps::Element e = it.next(); + if (!qfixed2d(e).isFinite()) + continue; Q_ASSERT(e.isLineTo()); cline = QLineF(qt_fixed_to_real(prev.x), diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index 1a7c184e1a..59e4cc6a7b 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -104,6 +104,7 @@ struct qfixed2d qfixed x; qfixed y; + bool isFinite() { return qIsFinite(x) && qIsFinite(y); } bool operator==(const qfixed2d &other) const { return qFuzzyCompare(x, other.x) && qFuzzyCompare(y, other.y); } }; -- cgit v1.2.3 From d6c3fa6e0cdb55b9676f1a3f1365d835a039a6e2 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 10 Apr 2019 12:35:39 +0200 Subject: Fix aliased painting with non-uniform scaling The full stroker does not produce good results for aliased lines thinner than 1 pixel. Avoid it by making sure that such thin lines are painted by the cosmetic stroker, even when they have non-uniform transformation. Fixes: QTBUG-73866 Change-Id: I7b5f0fa555903246e0c3fd92cd435cc8c0b15a24 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qpaintengine_raster.cpp | 2 +- tests/auto/other/lancelot/scripts/thinlines.qps | 79 +++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 tests/auto/other/lancelot/scripts/thinlines.qps diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 90b6d16551..ab22a71134 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -796,7 +796,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) s->flags.fast_pen = pen_style > Qt::NoPen && s->penData.blend && ((cosmetic && penWidth <= 1) - || (!cosmetic && s->flags.tx_noshear && penWidth * s->txscale <= 1)); + || (!cosmetic && (s->flags.tx_noshear || !s->flags.antialiased) && penWidth * s->txscale <= 1)); s->flags.non_complex_pen = qpen_capStyle(s->lastPen) <= Qt::SquareCap && s->flags.tx_noshear; diff --git a/tests/auto/other/lancelot/scripts/thinlines.qps b/tests/auto/other/lancelot/scripts/thinlines.qps new file mode 100644 index 0000000000..dddfff4538 --- /dev/null +++ b/tests/auto/other/lancelot/scripts/thinlines.qps @@ -0,0 +1,79 @@ +# Version: 1 +# CheckVsReference: 5% + +drawRect 0 0 800 800 + +path_addRect p 0 0 75 75 +path_addEllipse p 25 25 75 75 + +translate -500 -500 + +begin_block drawing + save + drawLine 0 0 100 100 + + translate 0 100 + drawPath p + + translate 0 110 + drawRect 0 0 100 100 + + translate 0 110 + drawPolyline [0 0 100 0 50 50] + + drawPoint 40 40 + drawPoint 41 40 + drawPoint 42 40 + drawPoint 43 40 + drawPoint 44 40 + drawPoint 45 40 + drawPoint 46 40 + drawPoint 47 40 + drawPoint 48 40 + drawPoint 49 40 + drawPoint 50 40 + + restore +end_block + +begin_block univsnonuni + save + + save + scale 0.7 0.7 + repeat_block drawing + restore + + translate 100 0 + save + scale 0.7 0.8 + repeat_block drawing + restore + + restore +end_block + +resetMatrix +translate 20.5 20.5 + +begin_block row +save + repeat_block univsnonuni + + translate 240 0 + save + rotate 10 + repeat_block univsnonuni + restore + + translate 220 0 + save + rotate_y 30 + repeat_block univsnonuni + restore +restore +end_block + +translate 0 320 +setRenderHint AntiAliasing +repeat_block row -- cgit v1.2.3 From 1d128ed1dfbcf49453ada922e54381c37264fde5 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 23 Apr 2019 16:30:15 +0200 Subject: Fix artifacts when reading certain 32 bit ico files Images in an ico file contains transparency information stored as a 1 bit mask. However, when the depth is 32 bit, it means there is an alpha channel present, and the mask should be ignored. The Qt ico handler failed to do that. This has gone unnoticed, since the mask in such images is typically set to all 0s, and so makes no difference to the result. But ico files exist that contain junk mask data, so fix the reader to ignore it properly. Fixes: QTBUG-75214 Change-Id: I1b4456d71689ec783076a582f2fb215e7dc56e62 Reviewed-by: Allan Sandfeld Jensen --- src/plugins/imageformats/ico/qicohandler.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index 30935cacda..4908850cc5 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -523,17 +523,21 @@ QImage ICOReader::iconAt(int index) if (!image.isNull()) { readBMP(image); if (!image.isNull()) { - QImage mask(image.width(), image.height(), QImage::Format_Mono); - if (!mask.isNull()) { - mask.setColorCount(2); - mask.setColor(0, qRgba(255,255,255,0xff)); - mask.setColor(1, qRgba(0 ,0 ,0 ,0xff)); - read1BitBMP(mask); + if (icoAttrib.depth == 32) { + img = std::move(image).convertToFormat(QImage::Format_ARGB32_Premultiplied); + } else { + QImage mask(image.width(), image.height(), QImage::Format_Mono); if (!mask.isNull()) { - img = image; - img.setAlphaChannel(mask); - // (Luckily, it seems that setAlphaChannel() does not ruin the alpha values - // of partially transparent pixels in those icons that have that) + mask.setColorCount(2); + mask.setColor(0, qRgba(255,255,255,0xff)); + mask.setColor(1, qRgba(0 ,0 ,0 ,0xff)); + read1BitBMP(mask); + if (!mask.isNull()) { + img = image; + img.setAlphaChannel(mask); + // (Luckily, it seems that setAlphaChannel() does not ruin the alpha values + // of partially transparent pixels in those icons that have that) + } } } } -- cgit v1.2.3 From fc2e9ac7e060bf693f6c4df17e419539f0547878 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 22 Apr 2019 10:04:22 +0300 Subject: Revert "androiddeployqt: Do not check for stdcpp-path in auxiliary mode" stdcpp-path is needed to set the correct stdc++ library in libs.xml file. This reverts commit 1366c4f04645d74e83847687adcf61ecfa20b3d2. Change-Id: I79b398c5d97c1e98bf503ef7b95b2e9f0f18bc11 Reviewed-by: Christian Kandeler --- src/tools/androiddeployqt/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 20b1befc38..45808c4311 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -900,7 +900,7 @@ bool readInputFile(Options *options) options->extraPlugins = extraPlugins.toString().split(QLatin1Char(',')); } - if (!options->auxMode) { + { const QJsonValue stdcppPath = jsonObject.value(QStringLiteral("stdcpp-path")); if (stdcppPath.isUndefined()) { fprintf(stderr, "No stdcpp-path defined in json file.\n"); -- cgit v1.2.3 From 65a33d73ea6e95de997503e4796d7c9ba685438a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 25 Apr 2019 12:13:13 +0300 Subject: qmake: Always split QMAKE_DEFAULT_LIBDIRS using ; with clang on windows When building in a unix style build system (i.e. msys), QMAKE_DIRLIST_SEP is a colon, not a semicolon. Thus, always split the incoming string (after the fixup regex) using semicolons on windows. This matches the code for gcc, further up, which does: equals(QMAKE_HOST.os, Windows): \ paths = $$split(line, ;) else: \ paths = $$split(line, $$QMAKE_DIRLIST_SEP) Change-Id: I6a0175f9d14ae9ca188553483b7868f0549c784a Reviewed-by: Joerg Bornemann --- mkspecs/features/toolchain.prf | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 9c3a64aa8b..03612e5689 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -267,9 +267,13 @@ isEmpty($${target_prefix}.INCDIRS) { for (line, output) { contains(line, "^libraries: .*") { line ~= s,^libraries: ,, - # clang (7.x) on Windows uses the wrong path list separator ... - equals(QMAKE_HOST.os, Windows): line ~= s,:(?![/\\\\]),;, - paths = $$split(line, $$QMAKE_DIRLIST_SEP) + equals(QMAKE_HOST.os, Windows) { + # clang (7.x) on Windows uses the wrong path list separator ... + line ~= s,:(?![/\\\\]),;, + paths = $$split(line, ;) + } else { + paths = $$split(line, $$QMAKE_DIRLIST_SEP) + } for (path, paths): \ QMAKE_DEFAULT_LIBDIRS += $$clean_path($$replace(path, ^=, $$[SYSROOT])) } -- cgit v1.2.3 From 1269f9cd16485d0081f5027ffec914bcb696f658 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 24 Apr 2019 17:44:22 +0200 Subject: Linux Accessibility: Add missing roles: Terminal and Desktop There is an effort to make KDE software accessible, which exposed the missing roles. Check that they are complete with an assert. Change-Id: Ibaff0a90e1cee316983569ecee7759a13212e3c3 Reviewed-by: Mitch Curtis --- src/platformsupport/linuxaccessibility/bridge.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/platformsupport/linuxaccessibility/bridge.cpp b/src/platformsupport/linuxaccessibility/bridge.cpp index 9b02d44aa5..a96fe258df 100644 --- a/src/platformsupport/linuxaccessibility/bridge.cpp +++ b/src/platformsupport/linuxaccessibility/bridge.cpp @@ -261,6 +261,10 @@ static RoleMapping map[] = { //: Role of an accessible object { QAccessible::ComplementaryContent, ATSPI_ROLE_SECTION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "complementary content") }, //: Role of an accessible object + { QAccessible::Terminal, ATSPI_ROLE_TERMINAL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "terminal") }, + //: Role of an accessible object + { QAccessible::Desktop, ATSPI_ROLE_DESKTOP_FRAME, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "desktop") }, + //: Role of an accessible object { QAccessible::UserRole, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "unknown") } }; @@ -268,6 +272,12 @@ void QSpiAccessibleBridge::initializeConstantMappings() { for (uint i = 0; i < sizeof(map) / sizeof(RoleMapping); ++i) qSpiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1String(map[i].name), tr(map[i].name))); + + // -1 because we have button duplicated, as PushButton and Button. + Q_ASSERT_X(qSpiRoleMapping.size() == + QAccessible::staticMetaObject.enumerator( + QAccessible::staticMetaObject.indexOfEnumerator("Role")).keyCount() - 1, + "", "Handle all QAccessible::Role members in qSpiRoleMapping"); } QT_END_NAMESPACE -- cgit v1.2.3 From 9ca81260e9293f6ef9a8e8da08eda7bdbdb90a7d Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 16 Apr 2019 17:12:21 +0300 Subject: Android: Fix hang in runOnAndroidThreadSync and requestPermissionsSync Keep spinning the main event loop if we can't acquire the semaphore, this way the Android UI thread can post events on it. Fixes: QTBUG-74076 Change-Id: Ia87e0535f94c67728176918ab928ff5ce8b00f8e Reviewed-by: VaL Doroshchuk --- src/corelib/kernel/qjnihelpers.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp index 712e8bbcab..7d278c69f2 100644 --- a/src/corelib/kernel/qjnihelpers.cpp +++ b/src/corelib/kernel/qjnihelpers.cpp @@ -45,6 +45,7 @@ #include "qsharedpointer.h" #include "qvector.h" #include "qthread.h" +#include "qcoreapplication.h" #include #include @@ -474,6 +475,17 @@ void QtAndroidPrivate::runOnAndroidThread(const QtAndroidPrivate::Runnable &runn env->CallStaticVoidMethod(g_jNativeClass, g_runPendingCppRunnablesMethodID); } +static bool waitForSemaphore(int timeoutMs, QSharedPointer sem) +{ + while (timeoutMs > 0) { + if (sem->tryAcquire(1, 10)) + return true; + timeoutMs -= 10; + QCoreApplication::processEvents(); + } + return false; +} + void QtAndroidPrivate::runOnAndroidThreadSync(const QtAndroidPrivate::Runnable &runnable, JNIEnv *env, int timeoutMs) { QSharedPointer sem(new QSemaphore); @@ -481,7 +493,7 @@ void QtAndroidPrivate::runOnAndroidThreadSync(const QtAndroidPrivate::Runnable & runnable(); sem->release(); }, env); - sem->tryAcquire(1, timeoutMs); + waitForSemaphore(timeoutMs, sem); } void QtAndroidPrivate::requestPermissions(JNIEnv *env, const QStringList &permissions, const QtAndroidPrivate::PermissionsResultFunc &callbackFunc, bool directCall) @@ -524,7 +536,7 @@ QtAndroidPrivate::PermissionsHash QtAndroidPrivate::requestPermissionsSync(JNIEn *res = result; sem->release(); }, true); - if (sem->tryAcquire(1, timeoutMs)) + if (waitForSemaphore(timeoutMs, sem)) return std::move(*res); else // mustn't touch *res return QHash(); -- cgit v1.2.3 From 913dd26c92f406e3da83ed83701ce47e659bcc48 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 12 Apr 2019 12:21:52 +0200 Subject: QMacStyle - set the proper appearance if needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, AppKit, while rendering 'detached' (not in any view hierarchy) controls and cells will use NSAppearance.currentAppearance, which is not guaranteed to be the same as NSApplication.effectiveAppearance. Task-number: QTBUG-74515 Change-Id: I82dcebf2230932ecfcbf33c422a3b7bd0aed61d7 Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 847b1a6034..2a6f212569 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -447,6 +447,42 @@ static const int toolButtonArrowMargin = 2; static const qreal focusRingWidth = 3.5; +// An application can force 'Aqua' theme while the system theme is one of +// the 'Dark' variants. Since in Qt we sometimes use NSControls and even +// NSCells directly without attaching them to any view hierarchy, we have +// to set NSAppearance.currentAppearance to 'Aqua' manually, to make sure +// the correct rendering path is triggered. Apple recommends us to un-set +// the current appearance back after we finished with drawing. This is what +// AppearanceSync is for. + +class AppearanceSync { +public: + AppearanceSync() + { +#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave + && !qt_mac_applicationIsInDarkMode()) { + auto requiredAppearanceName = NSApplication.sharedApplication.effectiveAppearance.name; + if (![NSAppearance.currentAppearance.name isEqualToString:requiredAppearanceName]) { + previous = NSAppearance.currentAppearance; + NSAppearance.currentAppearance = [NSAppearance appearanceNamed:requiredAppearanceName]; + } + } +#endif // QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) + } + + ~AppearanceSync() + { + if (previous) + NSAppearance.currentAppearance = previous; + } + +private: + NSAppearance *previous = nil; + + Q_DISABLE_COPY(AppearanceSync) +}; + static bool setupScroller(NSScroller *scroller, const QStyleOptionSlider *sb) { const qreal length = sb->maximum - sb->minimum + sb->pageStep; @@ -2918,6 +2954,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai const QWidget *w) const { Q_D(const QMacStyle); + const AppearanceSync appSync; QMacCGContext cg(p); QWindow *window = w && w->window() ? w->window()->windowHandle() : nullptr; d->resolveCurrentNSView(window); @@ -3443,6 +3480,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter const QWidget *w) const { Q_D(const QMacStyle); + const AppearanceSync sync; QMacCGContext cg(p); QWindow *window = w && w->window() ? w->window()->windowHandle() : nullptr; d->resolveCurrentNSView(window); @@ -5033,6 +5071,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex const QWidget *widget) const { Q_D(const QMacStyle); + const AppearanceSync sync; QMacCGContext cg(p); QWindow *window = widget && widget->window() ? widget->window()->windowHandle() : nullptr; d->resolveCurrentNSView(window); -- cgit v1.2.3 From ecfda0d523ff237a9cbfc1a36b7a93abfcccc04d Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 10 Apr 2019 11:21:56 +0200 Subject: Fix manual lance test: avoid using deprecated api ...and other slight modernizations and minor fixes. Change-Id: Ide587d9fe59ca9113ae775882c99a50debaf9000 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/other/lancelot/paintcommands.cpp | 3 ++ tests/manual/lance/interactivewidget.cpp | 2 +- tests/manual/lance/main.cpp | 10 ++--- tests/manual/lance/widgets.h | 62 ++++++++++------------------- 4 files changed, 30 insertions(+), 47 deletions(-) diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 8aa3a035e3..8a2934049e 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -1200,7 +1200,10 @@ void PaintCommands::command_drawRoundRect(QRegularExpressionMatch re) if (m_verboseMode) printf(" -(lance) drawRoundRect(%d, %d, %d, %d, [%d, %d])\n", x, y, w, h, xs, ys); + QT_WARNING_PUSH + QT_WARNING_DISABLE_DEPRECATED m_painter->drawRoundRect(x, y, w, h, xs, ys); + QT_WARNING_POP } /***************************************************************************************************/ diff --git a/tests/manual/lance/interactivewidget.cpp b/tests/manual/lance/interactivewidget.cpp index 8ac3881af7..d172fac900 100644 --- a/tests/manual/lance/interactivewidget.cpp +++ b/tests/manual/lance/interactivewidget.cpp @@ -45,7 +45,7 @@ InteractiveWidget::InteractiveWidget() // create and populate the command toolbox m_commandsToolBox = new QToolBox(); - QListWidget *currentListWidget = 0; + QListWidget *currentListWidget = nullptr; foreach (PaintCommands::PaintCommandInfos paintCommandInfo, PaintCommands::s_commandInfoTable) { if (paintCommandInfo.isSectionHeader()) { currentListWidget = new QListWidget(); diff --git a/tests/manual/lance/main.cpp b/tests/manual/lance/main.cpp index 749a4b1943..7f5af2d908 100644 --- a/tests/manual/lance/main.cpp +++ b/tests/manual/lance/main.cpp @@ -185,7 +185,7 @@ static void displayCommands() " pixmap_load filename name_in_script\n" " image_load filename name_in_script\n"); } -static InteractiveWidget *interactive_widget = 0; +static InteractiveWidget *interactive_widget = nullptr; static void runInteractive() { @@ -350,15 +350,15 @@ int main(int argc, char **argv) #endif } } - scaledWidth = width * scalefactor; - scaledHeight = height * scalefactor; + scaledWidth = int(width * scalefactor); + scaledHeight = int(height * scalefactor); PaintCommands pcmd(QStringList(), 800, 800, imageFormat); pcmd.setVerboseMode(verboseMode); pcmd.setType(type); pcmd.setCheckersBackground(checkers_background); - QWidget *activeWidget = 0; + QWidget *activeWidget = nullptr; if (interactive) { runInteractive(); @@ -610,7 +610,7 @@ int main(int argc, char **argv) QPrinter p(highres ? QPrinter::HighResolution : QPrinter::ScreenResolution); if (printdlg) { - QPrintDialog printDialog(&p, 0); + QPrintDialog printDialog(&p, nullptr); if (printDialog.exec() != QDialog::Accepted) break; } else { diff --git a/tests/manual/lance/widgets.h b/tests/manual/lance/widgets.h index 583d9e2455..46c55f4c16 100644 --- a/tests/manual/lance/widgets.h +++ b/tests/manual/lance/widgets.h @@ -45,31 +45,12 @@ #include #include #include +#include #include const int CP_RADIUS = 10; -class StupidWorkaround : public QObject -{ - Q_OBJECT -public: - StupidWorkaround(QWidget *widget, int *value) - : QObject(widget), w(widget), mode(value) - { - } - -public slots: - void setViewMode(int m) { - *mode = m; - w->update(); - } - -private: - QWidget *w; - int *mode; -}; - template class OnScreenWidget : public T { @@ -81,7 +62,7 @@ public: DifferenceView }; - OnScreenWidget(const QString &file, QWidget *parent = 0) + OnScreenWidget(const QString &file, QWidget *parent = nullptr) : T(parent), m_filename(file), m_view_mode(RenderView) @@ -108,33 +89,20 @@ public: } else { T::setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference"); - StupidWorkaround *workaround = new StupidWorkaround(this, &m_view_mode); - - QSignalMapper *mapper = new QSignalMapper(this); - T::connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int))); - T::connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString))); - QAction *renderViewAction = new QAction("Render View", this); renderViewAction->setShortcut(Qt::Key_1); - T::connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map())); - mapper->setMapping(renderViewAction, RenderView); - mapper->setMapping(renderViewAction, "Render View: " + file); + T::connect(renderViewAction, &QAction::triggered, [&] { setMode(RenderView); }); T::addAction(renderViewAction); QAction *baselineAction = new QAction("Baseline", this); baselineAction->setShortcut(Qt::Key_2); - T::connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map())); - mapper->setMapping(baselineAction, BaselineView); - mapper->setMapping(baselineAction, "Baseline View: " + file); + T::connect(baselineAction, &QAction::triggered, [&] { setMode(BaselineView); }); T::addAction(baselineAction); - QAction *differenceAction = new QAction("Differenfe View", this); + QAction *differenceAction = new QAction("Difference View", this); differenceAction->setShortcut(Qt::Key_3); - T::connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map())); - mapper->setMapping(differenceAction, DifferenceView); - mapper->setMapping(differenceAction, "Difference View" + file); + T::connect(differenceAction, &QAction::triggered, [&] { setMode(DifferenceView); }); T::addAction(differenceAction); - } } @@ -148,6 +116,18 @@ public: settings.sync(); } + void setMode(ViewMode mode) { + m_view_mode = mode; + QString title; + switch (m_view_mode) { + case RenderView: title = "Render"; break; + case BaselineView: title = "Baseline"; break; + case DifferenceView: title = "Difference"; break; + } + T::setWindowTitle(title + " View: " + m_filename); + T::update(); + } + void setVerboseMode(bool v) { m_verboseMode = v; } void setCheckersBackground(bool b) { m_checkersBackground = b; } void setType(DeviceType t) { m_deviceType = t; } @@ -205,7 +185,7 @@ public: pt.begin(this); pt.setRenderHint(QPainter::Antialiasing); pt.setFont(this->font()); - pt.resetMatrix(); + pt.resetTransform(); pt.setPen(QColor(127, 127, 127, 191)); pt.setBrush(QColor(191, 191, 255, 63)); for (int i=0; i Date: Fri, 26 Apr 2019 09:46:44 +0300 Subject: Extend blacklisting of dirsBeforeFiles as it's flaky Task-number: QTBUG-75452 Change-Id: I4b35dfff6c0a888e62441e51985e0bccb2081be1 Reviewed-by: Heikki Halmet --- tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST index 01679eb6ee..f78d23c6b1 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST @@ -9,3 +9,5 @@ b2qt ubuntu b2qt windows +rhel +suse-leap -- cgit v1.2.3 From d6e65ecac5852ed09fbf580b3fab5b21125dfd69 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 15 Mar 2019 11:56:01 +0100 Subject: platforminputcontexts: future-proof compose plugin If this plugin is loaded at some later point during application run-time, the focus object might be nullptr. We can avoid that by using qApp->focusObject(), when m_focusObject==nullptr; Task-number: QTBUG-74465 Change-Id: I0d82410ed557ea1a8fde28a1807f790854951cda Reviewed-by: Johan Helsing --- .../compose/qcomposeplatforminputcontext.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp index 57fe7c2fa2..4e9828663f 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp @@ -40,6 +40,7 @@ #include #include +#include #include @@ -121,7 +122,14 @@ bool QComposeInputContext::filterEvent(const QEvent *event) QInputMethodEvent event; event.setCommitString(composedText); - QCoreApplication::sendEvent(m_focusObject, &event); + + if (!m_focusObject && qApp) + m_focusObject = qApp->focusObject(); + + if (m_focusObject) + QCoreApplication::sendEvent(m_focusObject, &event); + else + qCWarning(lcXkbCompose, "no focus object"); reset(); return true; -- cgit v1.2.3