"Simple" masking
-
I'm pretty new to QML, so this may be kind of a dumb question.
The goal: In the context of a more complex use case, I need to do something on/to a solid form to create "hole" through which the background can be seen.
What I've tried: I was suggested to use an OpacityMask, but need to use Qt6.7, so as I understand it, I need to use MultiEffect in stead, but haven't been able to get it to work. Could you please help me with use case below?
Simplified use-case:
For the sake of this explanation I will reduce the use case to the following:- Starting from a green background window
- Draw a yellow, 200x200, rectangle at it's center
- Apply a 100x100 mask the center of the the yellow rectangle, through which I the green background can be seen.
The samples I found lead me to be believe this should be easy enough, but it hasn't been. What am I missing?
-
Hi @Pena
Note that I am not very experienced with MultiEffect, but did you try setting maskSource ? Did you check the MultiEffect examples ?
One other option would be to use a ShaderEffect with a custom shader to discard pixels you want to remove,this is probably a bit overkill and not that trivial.