I need to cut in half a widget a few times, so I decided to use masks, the only thing is that I can't get them to work with rectangles.
So this does not work:
QRegion maskedRegion
(0,
0,width
(),height
()/2);
setMask(maskedRegion);
QRegion maskedRegion(0,0,width(),height()/2);
setMask(maskedRegion);
To copy to clipboard, switch view to plain text mode
However, this does (but doesn't get me what I want seeing as its an ellipse):
setMask(maskedRegion);
QRegion maskedRegion(0,0,width(),height()/2,QRegion::Ellipse);
setMask(maskedRegion);
To copy to clipboard, switch view to plain text mode
Right now I call these from outside a resize event, however when I tried from within one all I got was a black section where the mask should have been.
Is there some method that I have to call afterwards of something? I've tried update and repaint but no success.
Bookmarks