diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-02-27 12:10:30 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-02-27 18:32:36 +0000 |
commit | 2c9acfbec667878ce913fecda6361e7150b3a778 (patch) | |
tree | 4f730498e405e0c5084d946760d5dd8ae7ffbe8b /src | |
parent | 7a717aaf459476f4a1f091b0e1d832c592f2caf1 (diff) |
Enable QWindowContainer on Android
[ChangeLog][Platform Specific Changes][Android] QWidget::createWindowContainer()
is now supported on Android for embedding OpenGL-based QWindows into widget UIs.
Task-number: QTBUG-59175
Change-Id: I84d3703bcd44c63b1fdfe6772b7f3de9d5c18ddf
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformintegration.cpp | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qwindowcontainer.cpp | 13 |
4 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index fe1861e08b..0af3295430 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -237,6 +237,10 @@ QPlatformServices *QPlatformIntegration::services() const is required to have this capability. \value ApplicationIcon The platform supports setting the application icon. (since 5.5) + + \value TopStackedNativeChildWindows The platform supports native child windows via + QWindowContainer without having to punch a transparent hole in the + backingstore. (since 5.10) */ /*! @@ -260,7 +264,8 @@ QPlatformServices *QPlatformIntegration::services() const bool QPlatformIntegration::hasCapability(Capability cap) const { - return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement; + return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement + || cap == TopStackedNativeChildWindows; } QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 466b3348bd..29f7b9b3a6 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -99,7 +99,8 @@ public: RasterGLSurface, AllGLFunctionsQueryable, ApplicationIcon, - SwitchableWidgetComposition + SwitchableWidgetComposition, + TopStackedNativeChildWindows }; virtual ~QPlatformIntegration() { } diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 173431208f..184a836e13 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -233,6 +233,7 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const case ForeignWindows: return QtAndroid::activity(); case ThreadedOpenGL: return !needsBasicRenderloopWorkaround() && QtAndroid::activity(); case RasterGLSurface: return QtAndroid::activity(); + case TopStackedNativeChildWindows: return false; default: return QPlatformIntegration::hasCapability(cap); } diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index bb25a3a986..e72479fd09 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -329,6 +329,19 @@ bool QWindowContainer::event(QEvent *e) e->accept(); return true; #endif + + case QEvent::Paint: + { + static bool needsPunch = !QGuiApplicationPrivate::platformIntegration()->hasCapability( + QPlatformIntegration::TopStackedNativeChildWindows); + if (needsPunch) { + QPainter p(this); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(rect(), Qt::transparent); + } + break; + } + default: break; } |