diff options
author | Samuel Rødal <samuel.rodal@digia.com> | 2013-02-25 08:54:30 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-27 09:11:18 +0100 |
commit | b56caf5f4e50d867bfef4b9090b1fba130284688 (patch) | |
tree | 0f4d63502c6bd0fb219856c57d992a0153a66347 /src/gui | |
parent | 7b2d98d90642ce7ac4ab0800bd7930f97ba6b10c (diff) |
Introduced QWindow::setMask() to expose existing platform functionality.
Task-number: QTBUG-28555
Change-Id: I2c649b6d9e9dc69be246cb7658b3edbe9682b1bf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 33 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 1 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 69ae30389e..33fd4954eb 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -791,6 +791,39 @@ qreal QWindow::opacity() const } /*! + Sets the mask of the window. + + The mask is a hint to the windowing system that the application does not + want to receive mouse or touch input outside the given \a region. + + The window manager may or may not choose to display any areas of the window + not included in the mask, thus it is the application's responsibility to + clear to transparent the areas that are not part of the mask. + + Setting the mask before the window has been created has no effect. +*/ +void QWindow::setMask(const QRegion ®ion) +{ + Q_D(QWindow); + if (!d->platformWindow) + return; + d->platformWindow->setMask(region); + d->mask = region; +} + +/*! + Returns the mask set on the window. + + The mask is a hint to the windowing system that the application does not + want to receive mouse or touch input outside the given region. +*/ +QRegion QWindow::mask() const +{ + Q_D(const QWindow); + return d->mask; +} + +/*! Requests the window to be activated, i.e. receive keyboard focus. \sa isActive(), QGuiApplication::focusWindow() diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 4b8f0ca3e7..0842e9ceb6 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -163,6 +163,9 @@ public: void setOpacity(qreal level); qreal opacity() const; + void setMask(const QRegion ®ion); + QRegion mask() const; + void requestActivate(); bool isActive() const; diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index bcbface370..e92f37c34f 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -143,6 +143,7 @@ public: PositionPolicy positionPolicy; Qt::ScreenOrientation contentOrientation; qreal opacity; + QRegion mask; QSize minimumSize; QSize maximumSize; |