embeddedwindows: Mask the painting manually by applying a clip

QWindow::setMask() is not guaranteed to turn the masked out areas
transparent, and it's up to the client to ensure this during
painting.

Pick-to: 6.6
Change-Id: I1155b3ad095152a993532f2290cacb670e20daa7
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-08-15 21:49:03 +02:00
parent 61c043333b
commit 5ce4aecd49

View File

@ -33,6 +33,8 @@ protected:
{ {
QPainter painter(this); QPainter painter(this);
painter.setCompositionMode(QPainter::CompositionMode_Source); painter.setCompositionMode(QPainter::CompositionMode_Source);
if (!mask().isNull())
painter.setClipRegion(mask());
painter.fillRect(QRect(0, 0, width(), height()), painter.fillRect(QRect(0, 0, width(), height()),
m_pressed ? QGradient(QGradient::JuicyPeach) : m_brush); m_pressed ? QGradient(QGradient::JuicyPeach) : m_brush);
} }