PDA

View Full Version : Implement transparent round corners of resizable Qdialog using stylesheets



vertusd
28th December 2010, 10:28
Hi

I tried following code to implement round corners of Qdialog ,but the corners are not transparent , Their color is black.

All corner of dialog.png is transparent.

QDialog{
border-image: url(qss/dialog.png);
border-width: 5px;
background-color:transparent;
}

and if i use border-radius:3px, It doesn't work. dialog will have a black border.

This methed works for QPushbutton, but doesn't work for QDialog, I think it's because the QDialog is in toplevel

Thx in advance,and sry for my bad english

high_flyer
28th December 2010, 10:43
It works for the button since the button is on a widget, so the transparent parts show the parent widget under it.
A QDialog is a top level widget, which has the desktop under it, and you application knows nothing about it, so the transparent parts become black.
You will have to use a mask.
See here:
http://www.qtcentre.org/threads/37351-problem-of-customize-the-shape-of-QDialog