PDA

View Full Version : Round-corner dialogs?



WinchellChung
14th March 2008, 20:07
Windows Qt v 4.3.2

The art department at my work has told me that the dialogs on the latest program have to have rounded corners. And no title bar.

Is this even possible with Qt?

The closest I've managed to get has rounded corners, but the cut away portion is gray instead of transparent. I subclassed QDialog (so I could apply a style sheet) and had the constructor pass the Qt::SplashScreen flag to the QDialog constructor.

That got rid of the title bar.

Then I loaded in a style sheet that contained:


QDialog
{
border-radius: 16px;
}


That made the rounded corners.

The only problem is that the cut-away part of the corners is gray instead of transparent. Does anybody have suggestions?

jpn
14th March 2008, 20:25
You'll have to use QWidget::setMask(). See for example this thread: Toplevel widget with rounded corners (http://www.qtcentre.org/forum/f-qt-programming-2/t-toplevel-widget-with-rounded-corners-3205.html).

WinchellChung
14th March 2008, 20:47
Thank you very much! I dropped your code into my dialog, and it worked like magic.