diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2013-12-18 14:48:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-12 20:12:17 +0100 |
commit | eacd58d4e78e7238ba5fcca90ba960aaf3ebd263 (patch) | |
tree | 779bf1735aecb7985bc3136264b9147eb23d5374 /src/widgets/kernel/qwidget_p.h | |
parent | 5ae5bebb93ec38e17c0dcb9bec47e0ebfbce4937 (diff) |
Enabling QQuickWidget and QOpenGLWidget
Enable child widgets (without a native window) that render to an FBO
and are composed with the raster backingstore by the platform plugin.
A preliminary version of QOpenGLWidget is included as private API.
Change-Id: I8f984a4d7db285069ce3d6564707942c823d890d
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget_p.h')
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 45606685cb..bdfc57f7c3 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -60,6 +60,7 @@ #include "QtCore/qset.h" #include "QtGui/qregion.h" #include "QtGui/qinputmethod.h" +#include "QtGui/qopengl.h" #include "QtWidgets/qsizepolicy.h" #include "QtWidgets/qstyle.h" #include "QtWidgets/qapplication.h" @@ -80,6 +81,7 @@ class QPixmap; class QWidgetBackingStore; class QGraphicsProxyWidget; class QWidgetItemV2; +class QOpenGLContext; class QStyle; @@ -216,6 +218,7 @@ struct QTLWExtra { bool wasMaximized; #endif QWidgetWindow *window; + QOpenGLContext *shareContext; quint32 screenIndex; // index in qplatformscreenlist }; @@ -324,6 +327,8 @@ public: explicit QWidgetPrivate(int version = QObjectPrivateVersion); ~QWidgetPrivate(); + static QWidgetPrivate *get(QWidget *w) { return w->d_func(); } + QWExtra *extraData() const; QTLWExtra *topData() const; QTLWExtra *maybeTopData() const; @@ -618,6 +623,27 @@ public: inline QRect mapFromWS(const QRect &r) const { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; } + QOpenGLContext *shareContext() const; + +#ifndef QT_NO_OPENGL + virtual GLuint textureId() const { return 0; } + + void setRenderToTexture() { renderToTexture = true; textureChildSeen = true; } + void setTextureChildSeen() + { + Q_Q(QWidget); + if (textureChildSeen) + return; + textureChildSeen = 1; + + if (!q->isWindow()) { + QWidget *parent = q->parentWidget(); + if (parent) + get(parent)->setTextureChildSeen(); + } + } +#endif + // Variables. // Regular pointers (keep them together to avoid gaps on 64 bit architectures). QWExtra *extra; @@ -698,6 +724,8 @@ public: uint isMoved : 1; uint usesDoubleBufferedGLContext : 1; uint mustHaveWindowHandle : 1; + uint renderToTexture : 1; + uint textureChildSeen : 1; #ifndef QT_NO_IM uint inheritsInputMethodHints : 1; #endif |