summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/kernel/qwidget.cpp10
-rw-r--r--src/widgets/kernel/qwidget_p.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index eea44300e8..76c4cbcb97 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -269,6 +269,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
, isScrolled(0)
, isMoved(0)
, usesDoubleBufferedGLContext(0)
+ , mustHaveWindowHandle(0)
#ifndef QT_NO_IM
, inheritsInputMethodHints(0)
#endif
@@ -1148,9 +1149,10 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
data.in_destructor = false;
// Widgets with Qt::MSWindowsOwnDC (typically QGLWidget) must have a window handle.
- if (f & Qt::MSWindowsOwnDC)
+ if (f & Qt::MSWindowsOwnDC) {
+ mustHaveWindowHandle = 1;
q->setAttribute(Qt::WA_NativeWindow);
-
+ }
//#ifdef Q_WS_MAC
// q->setAttribute(Qt::WA_NativeWindow);
//#endif
@@ -10072,8 +10074,8 @@ 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) {
+ // Don't set WA_NativeWindow on platforms that don't support it -- except for QGLWidget, which depends on it
+ if (attribute == Qt::WA_NativeWindow && !d->mustHaveWindowHandle) {
QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
if (!platformIntegration->hasCapability(QPlatformIntegration::NativeWidgets))
return;
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 0580f72e11..88aff2b65d 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -693,6 +693,7 @@ public:
uint isScrolled : 1;
uint isMoved : 1;
uint usesDoubleBufferedGLContext : 1;
+ uint mustHaveWindowHandle : 1;
#ifndef QT_NO_IM
uint inheritsInputMethodHints : 1;
#endif