[Interest] Custom-shaped QDialog or similar

Sensei senseiwa at gmail.com
Wed May 22 10:29:18 CEST 2013

Thanks to both of you for your hints.

I am now modifying the Window Flags example, in order to have it my way. 
For this proof of concept, I am trying to do two things:

- Have the custom-shaped window

- Move the window where I want: beside the "Quit" button.

However, something's wrong here. I am using QRegion to define the shape, 
and moving it with move().

If I set the window type to Qt::Tool I still have the window title, but 
I can see the clipping working just fine. When I set the type to 
Qt::Tooltip or use Qt::FramelessWindowHint, the whole window disappears!

Moreover, I am unable to move it where I want. I know it is some kind of 
coordinates misunderstanding here...

Can anyone enlighten me? Code follows.


void ControllerWindow::updatePreview()

     QPoint b = quitButton->mapToGlobal(quitButton->pos());

     pos.setX(b.x() + quitButton->width()  / 2);
     pos.setY(b.y() + quitButton->height() / 2);


PreviewWindow::PreviewWindow(QWidget *parent) : QWidget(parent)
     QVector<QPoint> pts;

     pts.push_back(QPoint(0, 10));
     pts.push_back(QPoint(36, 10));
     pts.push_back(QPoint(36+10, 0));
     pts.push_back(QPoint(36+20, 10));
     pts.push_back(QPoint(296, 10));
     pts.push_back(QPoint(296, 266));
     pts.push_back(QPoint(0, 266));
     QPolygon p(pts);


More information about the Interest mailing list