From 2967510213373fa92db94385e3904196637e8df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 14 Oct 2019 14:14:01 +0200 Subject: macOS: Merge [QCocoaApplicationDelegate canQuit] into callsite The logic for handling termination without any event loops has been moved up as an early exit, and the code has been modernized. Change-Id: I202720b9923e35732cffea656e1ce108ef11953d Reviewed-by: Paul Olav Tvete --- .../platforms/cocoa/qcocoaapplicationdelegate.mm | 54 ++++++++++------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 33a45985a8..01abeb1a0e 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -140,46 +140,40 @@ QT_USE_NAMESPACE return [[self.dockMenu retain] autorelease]; } -- (BOOL)canQuit -{ - QCloseEvent ev; - QGuiApplication::sendEvent(qGuiApp, &ev); - return ev.isAccepted(); -} - // This function will only be called when NSApp is actually running. - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { if ([reflectionDelegate respondsToSelector:_cmd]) return [reflectionDelegate applicationShouldTerminate:sender]; - if ([self canQuit]) { - if (!startedQuit) { - startedQuit = true; - // Close open windows. This is done in order to deliver de-expose - // events while the event loop is still running. - const QWindowList topLevels = QGuiApplication::topLevelWindows(); - for (int i = 0; i < topLevels.size(); ++i) { - QWindow *topLevelWindow = topLevels.at(i); - // Already closed windows will not have a platform window, skip those - if (topLevelWindow->handle()) - QWindowSystemInterface::handleCloseEvent(topLevelWindow); - } - QWindowSystemInterface::flushWindowSystemEvents(); - - QGuiApplication::exit(0); - startedQuit = false; - } - } - if (QGuiApplicationPrivate::instance()->threadData->eventLoops.isEmpty()) { - // INVARIANT: No event loop is executing. This probably - // means that Qt is used as a plugin, or as a part of a native - // Cocoa application. In any case it should be fine to - // terminate now: + // No event loop is executing. This probably means that Qt is used as a plugin, + // or as a part of a native Cocoa application. In any case it should be fine to + // terminate now. return NSTerminateNow; } + QCloseEvent ev; + QGuiApplication::sendEvent(qGuiApp, &ev); + if (!ev.isAccepted()) + return NSTerminateCancel; + + if (!startedQuit) { + startedQuit = true; + // Close open windows. This is done in order to deliver de-expose + // events while the event loop is still running. + for (QWindow *topLevelWindow : QGuiApplication::topLevelWindows()) { + // Already closed windows will not have a platform window, skip those + if (!topLevelWindow->handle()) + continue; + + QWindowSystemInterface::handleCloseEvent(topLevelWindow); + } + + QGuiApplication::exit(0); + startedQuit = false; + } + return NSTerminateCancel; } -- cgit v1.2.3 From 1b6db1849477be30ef0ca52c288d358b911ea1e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 14 Oct 2019 15:58:50 +0200 Subject: Propagate application termination requests through QPA Instead of having each platform plugin deal with application termination in their own weird ways, we now have a QPA API to signal that the system requested the application to terminate. On the QGuiApplication side this results in a Quit event being sent to the application, which triggers the default behavior of closing all app windows, and then finally calling QCoreApplication::quit(). The quit event replaces the misuse of a close event being sent to the application. Close events are documented as being sent to windows. The close events that are sent to individual windows as part of the quit process can be ignored. This will skip the final quit() of the application, and also inform the platform that the quit was not accepted, in case that should be propagated further. In the future the logic for closing windows should be unified between the various approaches in closeAllWindows, shouldQuit, and friends. Change-Id: I0ed7f1c0d3f0bf1a755e1dd4066e1575fc3a28e1 Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qguiapplication.cpp | 23 ++++++++++++++++ src/gui/kernel/qguiapplication_p.h | 2 ++ src/gui/kernel/qwindowsysteminterface.cpp | 6 +++++ src/gui/kernel/qwindowsysteminterface.h | 3 +++ src/gui/kernel/qwindowsysteminterface_p.h | 3 ++- .../platforms/cocoa/qcocoaapplicationdelegate.mm | 31 +++++++++------------- src/plugins/platforms/haiku/qhaikuapplication.cpp | 5 ++-- src/plugins/platforms/xcb/qxcbsessionmanager.cpp | 5 ++-- src/widgets/kernel/qapplication.cpp | 19 ++++++------- 9 files changed, 62 insertions(+), 35 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 13de8af8b5..54f3996b6e 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1863,7 +1863,20 @@ bool QGuiApplication::event(QEvent *e) { if(e->type() == QEvent::LanguageChange) { setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); + } else if (e->type() == QEvent::Quit) { + // Close open windows. This is done in order to deliver de-expose + // events while the event loop is still running. + for (QWindow *topLevelWindow : QGuiApplication::topLevelWindows()) { + // Already closed windows will not have a platform window, skip those + if (!topLevelWindow->handle()) + continue; + if (!topLevelWindow->close()) { + e->ignore(); + return true; + } + } } + return QCoreApplication::event(e); } @@ -1940,6 +1953,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QWindowSystemInterfacePrivate::ApplicationStateChangedEvent * changeEvent = static_cast(e); QGuiApplicationPrivate::setApplicationState(changeEvent->newState, changeEvent->forcePropagate); } break; + case QWindowSystemInterfacePrivate::ApplicationTermination: + QGuiApplicationPrivate::processApplicationTermination(e); + break; case QWindowSystemInterfacePrivate::FlushEvents: { QWindowSystemInterfacePrivate::FlushEventsEvent *flushEventsEvent = static_cast(e); QWindowSystemInterface::deferredFlushWindowSystemEvents(flushEventsEvent->flags); } @@ -3489,6 +3505,13 @@ bool QGuiApplicationPrivate::tryCloseRemainingWindows(QWindowList processedWindo return true; } +void QGuiApplicationPrivate::processApplicationTermination(QWindowSystemInterfacePrivate::WindowSystemEvent *windowSystemEvent) +{ + QEvent event(QEvent::Quit); + QGuiApplication::sendSpontaneousEvent(QGuiApplication::instance(), &event); + windowSystemEvent->eventAccepted = event.isAccepted(); +} + /*! \since 5.2 \fn Qt::ApplicationState QGuiApplication::applicationState() diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index e28607bad6..26f65b2f16 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -141,6 +141,8 @@ public: static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e); + static void processApplicationTermination(QWindowSystemInterfacePrivate::WindowSystemEvent *e); + static void updateFilteredScreenOrientation(QScreen *screen); static void reportScreenOrientationChange(QScreen *screen); static void processScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 5f61853a6d..4f1056e906 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -285,6 +285,12 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::Application QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } +QT_DEFINE_QPA_EVENT_HANDLER(bool, handleApplicationTermination) +{ + auto *e = new QWindowSystemInterfacePrivate::WindowSystemEvent(QWindowSystemInterfacePrivate::ApplicationTermination); + return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); +} + QWindowSystemInterfacePrivate::GeometryChangeEvent::GeometryChangeEvent(QWindow *window, const QRect &newGeometry) : WindowSystemEvent(GeometryChange) , window(window) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 4a0bc858a9..d5a4ad30d8 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -215,6 +215,9 @@ public: template static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false); + template + static bool handleApplicationTermination(); + #if QT_CONFIG(draganddrop) #if QT_DEPRECATED_SINCE(5, 11) QT_DEPRECATED static QPlatformDragQtResponse handleDrag(QWindow *window, const QMimeData *dropData, diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 55fd181ef0..6e4bce607e 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -99,7 +99,8 @@ public: ApplicationStateChanged = 0x19, FlushEvents = 0x20, WindowScreenChanged = 0x21, - SafeAreaMarginsChanged = 0x22 + SafeAreaMarginsChanged = 0x22, + ApplicationTermination = 0x23 }; class WindowSystemEvent { diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 01abeb1a0e..9b0a6b1b86 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -88,10 +88,13 @@ #include #include +QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQpaApplication, "qt.qpa.application"); +QT_END_NAMESPACE + QT_USE_NAMESPACE @implementation QCocoaApplicationDelegate { - bool startedQuit; NSObject *reflectionDelegate; bool inLaunch; } @@ -150,30 +153,20 @@ QT_USE_NAMESPACE // No event loop is executing. This probably means that Qt is used as a plugin, // or as a part of a native Cocoa application. In any case it should be fine to // terminate now. + qCDebug(lcQpaApplication) << "No running event loops, terminating now"; return NSTerminateNow; } - QCloseEvent ev; - QGuiApplication::sendEvent(qGuiApp, &ev); - if (!ev.isAccepted()) + if (!QWindowSystemInterface::handleApplicationTermination()) { + qCDebug(lcQpaApplication) << "Application termination canceled"; return NSTerminateCancel; - - if (!startedQuit) { - startedQuit = true; - // Close open windows. This is done in order to deliver de-expose - // events while the event loop is still running. - for (QWindow *topLevelWindow : QGuiApplication::topLevelWindows()) { - // Already closed windows will not have a platform window, skip those - if (!topLevelWindow->handle()) - continue; - - QWindowSystemInterface::handleCloseEvent(topLevelWindow); - } - - QGuiApplication::exit(0); - startedQuit = false; } + // Even if the application termination was accepted by the application we can't + // return NSTerminateNow, as that would trigger AppKit to ultimately call exit(). + // We need to ensure that the runloop continues spinning so that we can return + // from our own event loop back to main(), and exit from there. + qCDebug(lcQpaApplication) << "Termination accepted, but returning to runloop for exit through main()"; return NSTerminateCancel; } diff --git a/src/plugins/platforms/haiku/qhaikuapplication.cpp b/src/plugins/platforms/haiku/qhaikuapplication.cpp index b75810c453..de4acdfd4a 100644 --- a/src/plugins/platforms/haiku/qhaikuapplication.cpp +++ b/src/plugins/platforms/haiku/qhaikuapplication.cpp @@ -42,6 +42,8 @@ #include #include +#include + #include #include @@ -52,8 +54,7 @@ QHaikuApplication::QHaikuApplication(const char *signature) bool QHaikuApplication::QuitRequested() { - QEvent quitEvent(QEvent::Quit); - QCoreApplication::sendEvent(QCoreApplication::instance(), &quitEvent); + QWindowSystemInterface::handleApplicationTermination(); return true; } diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 2303ccf806..f880d4d722 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -42,6 +42,8 @@ #ifndef QT_NO_SESSIONMANAGER +#include + #include #include #include @@ -289,8 +291,7 @@ static void sm_dieCallback(SmcConn smcConn, SmPointer /* clientData */) if (smcConn != smcConnection) return; resetSmState(); - QEvent quitEvent(QEvent::Quit); - QGuiApplication::sendEvent(qApp, &quitEvent); + QWindowSystemInterface::handleApplicationTermination(); } static void sm_shutdownCancelledCallback(SmcConn smcConn, SmPointer clientData) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3223781b63..dfa1bc23b1 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1866,22 +1866,19 @@ void QApplication::aboutQt() bool QApplication::event(QEvent *e) { Q_D(QApplication); - if(e->type() == QEvent::Close) { - QCloseEvent *ce = static_cast(e); - ce->accept(); + if (e->type() == QEvent::Quit) { closeAllWindows(); - - const QWidgetList list = topLevelWidgets(); - for (auto *w : list) { + for (auto *w : topLevelWidgets()) { if (w->isVisible() && !(w->windowType() == Qt::Desktop) && !(w->windowType() == Qt::Popup) && (!(w->windowType() == Qt::Dialog) || !w->parentWidget())) { - ce->ignore(); - break; + e->ignore(); + return true; } } - if (ce->isAccepted()) { - return true; - } + // Explicitly call QCoreApplication instead of QGuiApplication so that + // we don't let QGuiApplication close any windows we skipped earlier in + // closeAllWindows(). FIXME: Unify all this close magic through closeAllWindows. + return QCoreApplication::event(e); #ifndef Q_OS_WIN } else if (e->type() == QEvent::LocaleChange) { // on Windows the event propagation is taken care by the -- cgit v1.2.3 From 51edfdd212ed8be611ce6719db7ef454de5b5bcc Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 17 Oct 2019 10:24:12 +0200 Subject: Doc: Prevent QDoc from auto-linking certain words 'macOS' appears in the documentation frequently, and because it resembles a variable/property name, QDoc links each occurrence of it. 'WebChannel' appears as part of a module name, but it's also a QML type - auto-linking each word to QML documentation is confusing. Likewise, there's no need to link 'OpenGL' each time. Explicit links such as \l [QML] WebChannel continue to work. Task-number: QTBUG-79135 Change-Id: I76cc84b0076255e260aa88c244102702a48f35a6 Reviewed-by: Martin Smith --- doc/global/config.qdocconf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/global/config.qdocconf b/doc/global/config.qdocconf index 0b276c400f..16d4e5c63a 100644 --- a/doc/global/config.qdocconf +++ b/doc/global/config.qdocconf @@ -11,6 +11,12 @@ dita.metadata.default.audience = programmer navigation.homepage = index.html navigation.hometitle = "Qt $QT_VER" +#Words to ignore for auto-linking +ignorewords += \ + macOS \ + WebChannel \ + OpenGL + sourcedirs += includes $$BUILDDIR url = http://doc.qt.io/qt-5 -- cgit v1.2.3 From cc4087b18a488ffb02105d31da6f05acad65b728 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 16 Oct 2019 15:24:07 +0200 Subject: Remove mapping from CJK/Latin to Common script in Harfbuzz NG The original commit message says this is to ensure compatibility with the old Harfbuzz, but since OpenType features such as kerning are often matched based on the writing system of the glyphs, it will break kerning (and other OpenType features) for text in these languages in some fonts. Even font that were successfully kerned by the old Harfbuzz are broken. To avoid regressing on finding cursor positions inside ligatures, we need to amend 9f837af9458ea4825b9a8061de444f62d8a7a048. This would enable cursor positions inside ligatures for languages where they are only used for cosmetic purposes, and this was generalized to Common and Greek at the time. This now has to be expanded to include all the writing systems that were previously covered by "Common". [ChangeLog][Text] Fixed kerning error with certain fonts. Fixes: QTBUG-77908 Change-Id: Id261fef05f86841b1533b7d87207c3d17e01e96e Reviewed-by: Simon Hausmann --- src/gui/text/qtextengine.cpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index b37353bf2c..209433dac5 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2125,22 +2125,7 @@ void QTextEngine::itemize() const } #if QT_CONFIG(harfbuzz) analysis = scriptAnalysis.data(); - if (qt_useHarfbuzzNG()) { - // ### pretend HB-old behavior for now - for (int i = 0; i < length; ++i) { - switch (analysis[i].script) { - case QChar::Script_Latin: - case QChar::Script_Hiragana: - case QChar::Script_Katakana: - case QChar::Script_Bopomofo: - case QChar::Script_Han: - analysis[i].script = QChar::Script_Common; - break; - default: - break; - } - } - } else { + if (!qt_useHarfbuzzNG()) { for (int i = 0; i < length; ++i) analysis[i].script = hbscript_to_script(script_to_hbscript(analysis[i].script)); } @@ -3619,7 +3604,12 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, int clusterLength = 0; if (si->analysis.script != QChar::Script_Common && - si->analysis.script != QChar::Script_Greek) { + si->analysis.script != QChar::Script_Greek && + si->analysis.script != QChar::Script_Latin && + si->analysis.script != QChar::Script_Hiragana && + si->analysis.script != QChar::Script_Katakana && + si->analysis.script != QChar::Script_Bopomofo && + si->analysis.script != QChar::Script_Han) { if (glyph_pos == -1) return si->position + end; else { -- cgit v1.2.3 From 5205510524602bb36d3150001c22c2566259655b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 21 Oct 2019 08:12:28 +0200 Subject: Enable cursor in ligature test on Windows The default font on Windows ("Times" is not found) does not have a ligature for "fi", so the test would not actually be testing what it was supposed to on this platform, and would pass even when the code was buggy. To enable the test on Windows, we select a standard font which has the ligature (Calibri). Change-Id: Ic117cd8e549aa729a0cd68006d7c180c6c89c053 Reviewed-by: Simon Hausmann --- tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index a474acd790..2dcca0209e 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -2068,7 +2068,12 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines() void tst_QTextLayout::xToCursorForLigatures() { +#if defined(Q_OS_WIN32) + QTextLayout layout("fi", QFont("Calibri", 20)); +#else QTextLayout layout("fi", QFont("Times", 20)); +#endif + layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); -- cgit v1.2.3 From d71dbe3e9322430dceed9cb2d3f957fbac2ab715 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 11 Oct 2019 09:52:24 +0200 Subject: docs: clarify usage of css 'qproperty' in stylesheets Clarify that the qproperty properties will only be evaluated once. Fixes: QTBUG-2982 Change-Id: Ie294ced118f740c7378c62c0b5a4924d5628e118 Reviewed-by: Venugopal Shivashankar --- src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 00323eace6..84233e4b62 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -549,6 +549,10 @@ If the property references an enum declared with Q_ENUMS, you should reference its constants by name, i.e., not their numeric value. + \note Use the qproperty syntax with care, as it modifies the + widget that is being painted. Also, the qproperty syntax is evaluated only + once, which is when the widget is polished by the style. This means that any + attempt to use them in pseudo-states such as QPushButton:hover, will not work. */ /*! -- cgit v1.2.3 From 5288c8dae34ae3a3883f12c8fabeb717e1c5a263 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sun, 20 Oct 2019 18:06:07 +0200 Subject: rhi: Enhance swapchain size query docs Inspired by a recent Qt Quick fix. Make sure we make it clear that QRhi-based rendering code should base output size calculations (e.g. for setViewport() and similar) on the pixel size reported from QRhiSwapChain, instead of going to the QWindow. Change-Id: I2fc22972162ccc6307ac07ceb7766c746d5f562a Reviewed-by: Paul Olav Tvete --- src/gui/rhi/qrhi.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index dabad35688..8ef98d2e42 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -3518,14 +3518,36 @@ QRhiResource::Type QRhiSwapChain::resourceType() const \c{currentPixelSize() != surfacePixelSize()} then the swapchain needs to be resized. + \note Typical rendering logic will call this function to get the output + size when starting to prepare a new frame, and base dependent calculations + (such as, the viewport) on the size returned from this function. + + While in many cases the value is the same as \c{QWindow::size() * + QWindow::devicePixelRatio()}, relying on the QWindow-reported size is not + guaranteed to be correct on all platforms and graphics API implementations. + Using this function is therefore strongly recommended whenever there is a + need to identify the dimensions, in pixels, of the output layer or surface. + + This also has the added benefit of avoiding potential data races when QRhi + is used on a dedicated rendering thread, because the need to call QWindow + functions, that may then access data updated on the main thread, is + avoided. + \sa surfacePixelSize() */ /*! \fn QSize QRhiSwapChain::surfacePixelSize() - \return The size of the window's associated surface or layer. Do not assume - this is the same as QWindow::size() * QWindow::devicePixelRatio(). + \return The size of the window's associated surface or layer. + + \warning Do not assume this is the same as \c{QWindow::size() * + QWindow::devicePixelRatio()}. With some graphics APIs and windowing system + interfaces (for example, Vulkan) there is a theoretical possibility for a + surface to assume a size different from the associated window. To support + these cases, rendering logic must always base size-derived calculations + (such as, viewports) on the size reported from QRhiSwapChain, and never on + the size queried from QWindow. \note Can also be called before buildOrResize(), if at least window() is already set) This in combination with currentPixelSize() allows to detect -- cgit v1.2.3 From aa4b0f5cb7e84046530fbc26581f777506fea658 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 19 Oct 2019 16:39:58 +0200 Subject: Uic: fix crash when trying to resource icon information Fix a typo introduced in be56db2c49be02fd7083c5a02131462748e29bef to avoid a crash when a pixmap is given for selected on but not for selected off. Fixes: QTBUG-79125 Change-Id: I84072b6b4e8a4d21684be21f5bff1deeaddbba6d Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cppwriteinitialization.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index fd5f8c9017..717bff4a51 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1680,7 +1680,7 @@ static void writeResourceIcon(QTextStream &output, "Selected", "Off"); } if (i->hasElementSelectedOn()) { - writeIconAddFile(output, indent, iconName, i->elementSelectedOff()->text(), + writeIconAddFile(output, indent, iconName, i->elementSelectedOn()->text(), "Selected", "On"); } } -- cgit v1.2.3