diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-07-24 10:23:12 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-08-13 14:34:50 +0200 |
commit | 2b3de73defd4fca0888b5c2824c73d4fc26d6f7c (patch) | |
tree | 3cb02ab95a74307ca991447c0a3a0c5af683e16e /src/quickwidgets/qquickwidget.cpp | |
parent | 2fea3d1899eb8cc81920b631ea73a1f130674950 (diff) |
Add QQuickWidget::setClearColor()
And make qquickviewcomparison able to demonstrate how to create a
partially transparent QQuickWidget.
Avoid also recreating the QQuickView/QQuickWidget multiple times
when switching between the radio buttons.
[ChangeLog] Added QQuickWidget::setClearColor() in order to support
semi-transparent QQuickWidgets.
Change-Id: I319ad4afbe909530274d09f2a7fcff23730d6ebd
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/quickwidgets/qquickwidget.cpp')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 2541359fdd..0a521984e1 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -1115,4 +1115,23 @@ QImage QQuickWidget::grabFramebuffer() const return const_cast<QQuickWidgetPrivate *>(d_func())->grabFramebuffer(); } +/*! + Sets the clear \a color. By default this is an opaque color. + + To get a semi- or fully transparent QQuickWidget, call this function with \a + color set to Qt::transparent and set the Qt::WA_TranslucentBackground widget + attribute. + + \note The limitations for having widgets underneath visible that are described + in QOpenGLWidget::setFormat() apply also to QQuickWidget. In that case use + Qt::WA_AlwaysStackOnTop instead of Qt::WA_TranslucentBackground. + + \sa QQuickWindow::setColor() + */ +void QQuickWidget::setClearColor(const QColor &color) +{ + Q_D(QQuickWidget); + d->offscreenWindow->setColor(color); +} + QT_END_NAMESPACE |