[Interest] making 'hole' in the rectangle
Bo Thorsen
bo at vikingsoft.eu
Fri Jul 25 08:51:28 CEST 2014
Den 24-07-2014 22:55, Alexander Ivash skrev:
> Is it possible to implement a 'hole' component which would make color of
> its parent control transparent? For example:
>
> Rectangle {
> width: 100
> height: 100
>
> color: 'blue'
>
> Rectangle {
> width: 50
> height: 50
>
> color: 'green'
>
> Hole {
> anchors.fill: parent
> width: 25
> height: 50
> }
> }
> }
>
> Expected result: area 100x100, filled with blue and 25x50 (not 50x50 as
> we erased half of area with 'Hole') area of green on top.
You can't do this.
It's possible there might be something you can do with the Canvas.
Otherwise you are going to have to subclass the Item in C++ and
implement it in the paint method. It's not hard to do and this gives you
the full QPainter power.
Bo.
--
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu
More information about the Interest
mailing list