diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-09-12 22:26:05 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-09-15 18:57:48 +0200 |
commit | bde9387dba244a2bf5324fa22bc5f64f1f0714ea (patch) | |
tree | 5a69abf1376aaac1742a179e9d8fa1225a6eff2f | |
parent | 75834c223295b6b0e335521370c7c9a6cdca5664 (diff) |
Do not drop the context when sharing globally
There is no point in recreating the QOpenGLWidget's
context when it shares with all top-levels'
shareContext().
Change-Id: I659a8ef6563de0cc1e833198af4dfb8c705e40d8
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index bcc3e3592b..22ea852d99 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -367,6 +367,10 @@ QT_BEGIN_NAMESPACE from the derived class' destructor, since the slot connected to the signal will not get invoked when the widget is being destroyed. + \note When Qt::AA_ShareOpenGLContexts is set, the widget's context never + changes, not even when reparenting because the widget's associated texture is + guaranteed to be accessible also from the new top-level's context. + Proper cleanup is especially important due to context sharing. Even though each QOpenGLWidget's associated context is destroyed together with the QOpenGLWidget, the sharable resources in that context, like textures, will @@ -1052,6 +1056,8 @@ bool QOpenGLWidget::event(QEvent *e) Q_D(QOpenGLWidget); switch (e->type()) { case QEvent::WindowChangeInternal: + if (qGuiApp->testAttribute(Qt::AA_ShareOpenGLContexts)) + break; if (d->initialized) d->reset(); // FALLTHROUGH |