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>
This commit is contained in:
parent
7b2d98d906
commit
b56caf5f4e
@ -790,6 +790,39 @@ qreal QWindow::opacity() const
|
||||
return d->opacity;
|
||||
}
|
||||
|
||||
/*!
|
||||
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.
|
||||
|
||||
|
@ -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;
|
||||
|
@ -143,6 +143,7 @@ public:
|
||||
PositionPolicy positionPolicy;
|
||||
Qt::ScreenOrientation contentOrientation;
|
||||
qreal opacity;
|
||||
QRegion mask;
|
||||
|
||||
QSize minimumSize;
|
||||
QSize maximumSize;
|
||||
|
@ -77,6 +77,7 @@ private slots:
|
||||
void tabletEvents();
|
||||
void windowModality_QTBUG27039();
|
||||
void visibility();
|
||||
void mask();
|
||||
|
||||
void initTestCase()
|
||||
{
|
||||
@ -1119,6 +1120,22 @@ void tst_QWindow::visibility()
|
||||
spy.clear();
|
||||
}
|
||||
|
||||
void tst_QWindow::mask()
|
||||
{
|
||||
QRegion mask = QRect(10, 10, 800 - 20, 600 - 20);
|
||||
|
||||
QWindow window;
|
||||
window.resize(800, 600);
|
||||
window.setMask(mask);
|
||||
|
||||
QCOMPARE(window.mask(), QRegion());
|
||||
|
||||
window.create();
|
||||
window.setMask(mask);
|
||||
|
||||
QCOMPARE(window.mask(), mask);
|
||||
}
|
||||
|
||||
#include <tst_qwindow.moc>
|
||||
QTEST_MAIN(tst_QWindow)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user