[Interest] Masking an hidden widget (glitch?)

Sensei senseiwa at gmail.com
Fri Jun 28 16:30:55 CEST 2013

Dear all,

I'm trying to avoid sub-classing a widget, because I don't really need 
it. However, I'd like to apply a mask to it, but I'm looking at a weird 

First of all, I don't know how I can apply a mask on a widget that is 
currently being created (and hidden). If I try to mask it, I get the 
geometry wrong. I think this is quite normal.

So what I'm doing is to apply a mask whenever I show it.

When I first click on the button that will show the widget, I see the 
"frameless" widget you see in the attachment on the left.

Clicking again on the button you see in the picture, hides the widget, 
and behold the magic: clicking again shows it as I intended! You can see 
it on the right of the attachment.

What am I doing wrong here? My code follows with an ugly patch: showing, 
maskin, hiding, and showing again!

I am using Qt 4.8.4 (from homebrew) on OSX 10.8.4.


// Options button is activated
void SubContainer::showFollower()

     // Follower width (fixed)
     int w = 300;

     // Follower height (there is a QVBoxLayout that handles this)
     int h = follower_->geometry().height();

     // Set the mask to make it cool
     QPolygon mask;
     mask << QPoint(   0,   10);
     mask << QPoint(  10,   10);
     mask << QPoint(  20,    0);
     mask << QPoint(  30,   10);
     mask << QPoint(   w,   10);
     mask << QPoint(   w,    h);
     mask << QPoint(   0,    h);
     mask << QPoint(   0,   10);


     // UGLY AS HELL...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wat.png
Type: image/png
Size: 12457 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130628/dfe0f119/attachment.png>

More information about the Interest mailing list