From 4ae1e1177f437fc31745acca85356f275ccb8a72 Mon Sep 17 00:00:00 2001 From: 0xd34df00d <0xd34df00d@gmail.com> Date: Sat, 6 Dec 2014 02:04:35 +0300 Subject: [PATCH] Avoid calling winId() on Qt5. Avoids breaking QQuickWidget and the likes. See: * https://bugreports.qt-project.org/browse/QTBUG-41779 * https://bugreports.qt-project.org/browse/QTBUG-40765 * https://bugreports.qt-project.org/browse/QTBUG-41942 --- lib/Session.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Session.cpp b/lib/Session.cpp index e6eca88..1bf9abb 100644 --- a/lib/Session.cpp +++ b/lib/Session.cpp @@ -129,7 +129,17 @@ WId Session::windowId() const // there are multiple views, then the window ID for the // top-level window which contains the first view is // returned + // + // On Qt5, requesting window IDs breaks QQuickWidget and the likes, + // for example, see the following bug reports: + // + // https://bugreports.qt-project.org/browse/QTBUG-41779 + // https://bugreports.qt-project.org/browse/QTBUG-40765 + // https://bugreports.qt-project.org/browse/QTBUG-41942 +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + return 0; +#else if ( _views.count() == 0 ) { return 0; } else { @@ -143,6 +153,7 @@ WId Session::windowId() const return window->winId(); } +#endif } void Session::setDarkBackground(bool darkBackground)