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>
This commit is contained in:
Laszlo Agocs 2017-02-27 12:10:30 +01:00
parent 7a717aaf45
commit 2c9acfbec6
4 changed files with 22 additions and 2 deletions

View File

@ -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

View File

@ -99,7 +99,8 @@ public:
RasterGLSurface,
AllGLFunctionsQueryable,
ApplicationIcon,
SwitchableWidgetComposition
SwitchableWidgetComposition,
TopStackedNativeChildWindows
};
virtual ~QPlatformIntegration() { }

View File

@ -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);
}

View File

@ -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;
}