BatteryCell
1st October 2007, 22:47
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);
However, this does (but doesn't get me what I want seeing as its an ellipse):
QRegion maskedRegion(0,0,width(),height()/2,QRegion::Ellipse);
setMask(maskedRegion);
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.
So this does not work:
QRegion maskedRegion(0,0,width(),height()/2);
setMask(maskedRegion);
However, this does (but doesn't get me what I want seeing as its an ellipse):
QRegion maskedRegion(0,0,width(),height()/2,QRegion::Ellipse);
setMask(maskedRegion);
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.