I set about implementing a type that allows a user to set the window mask (aka wayland input region, i.e. non-rectangular windows) from QML.

I ended up with a qml Item that works like this:

|Window|

|{
|

|    WaylandInputRegion {|

|        item: theMenu
|

|    }|

|    Rectangle {|

|        id: theMenu|

|        radius:50|

|        //etc pp
|

|    }
|

|}|

|
|

behind the scenes it uses grabToImage, then QBitMap::fromImage, QRegion(QBitmap&) and finally window()->handle()->setMask()

I also added a fast path for when item is null to use the WaylandInputRegion itself as a simple rectangular region.


However, the current implementation has the following issues that I would appreciate input for:

using an external item as the bitmap source requires us to track changes in that item including its scene position to correctly reflect that in the window mask.

I haven't found a way to do that so I rely on explicit calls to updateRegion() from qml code at known points when animations stop.

Also for items anchored to the windows contentItem, position is invalid as the contentItem geometry appears to be 0x0, 0,0 for some time after start.


Florian

--
Florian Hänel
Geschäftsführer

echtzeit.solutions GmbH
Handelsregistergericht München HRB 231056
Ust-ID DE310379807
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to