Android: Fix crash when setting WA_NativeWindow
We don't support native widgets in Android, so we can get into a mess when people set this widget attribute, since the FB compositor will assume that all widgets have their own backing store. This adds a capability flag to the QPlatformIntegration which allows the plugin to disable the WA_NativeWindow feature. Task-number: QTBUG-32685 Change-Id: Ic200487da4a297f71ab594cf7c90d1e1d53bacd3 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
parent
1d2941f978
commit
0bbc32a0cb
@ -237,7 +237,7 @@ QPlatformServices *QPlatformIntegration::services() const
|
||||
|
||||
bool QPlatformIntegration::hasCapability(Capability cap) const
|
||||
{
|
||||
return cap == NonFullScreenWindows;
|
||||
return cap == NonFullScreenWindows || cap == NativeWidgets;
|
||||
}
|
||||
|
||||
QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
|
||||
|
@ -91,7 +91,8 @@ public:
|
||||
MultipleWindows,
|
||||
ApplicationState,
|
||||
ForeignWindows,
|
||||
NonFullScreenWindows
|
||||
NonFullScreenWindows,
|
||||
NativeWidgets
|
||||
};
|
||||
|
||||
virtual ~QPlatformIntegration() { }
|
||||
|
@ -118,6 +118,7 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
|
||||
switch (cap) {
|
||||
case ThreadedPixmaps: return true;
|
||||
case NonFullScreenWindows: return false;
|
||||
case NativeWidgets: return false;
|
||||
default:
|
||||
#ifndef ANDROID_PLUGIN_OPENGL
|
||||
return QPlatformIntegration::hasCapability(cap);
|
||||
|
@ -10039,6 +10039,13 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Don't set WA_NativeWindow on platforms that don't support it
|
||||
if (attribute == Qt::WA_NativeWindow) {
|
||||
QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
|
||||
if (!platformIntegration->hasCapability(QPlatformIntegration::NativeWidgets))
|
||||
return;
|
||||
}
|
||||
|
||||
setAttribute_internal(attribute, on, data, d);
|
||||
|
||||
switch (attribute) {
|
||||
|
Loading…
Reference in New Issue
Block a user