[Qt-interest] QDialog with rounded "corners"

Özgün Bayramoglu ozgun.bayramoglu at macio.de
Thu Feb 10 15:17:34 CET 2011


Zitat von Markus Franke <Franke.M at sebakmt.com>:

> Dear all,
Dear Markus, 

> I am having problems when styling QDialog in my Qt application. Basically 
> I would like to have dialog windows which have rounded corners. I have a 
> class "MyDialog" which inherits from QDialog. So far I tried to use 
> stylesheets as follows:
> 
> setStyleSheet("MyDialog { background-color: yellow; border-radius: 5px; 
> border-color: black; border-width: 2px; border-style: outset; padding-top: 
> 2px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px}")
> 
> The result which I achieve are actually quiet similar to what I want. I 
> see rounded "corners" but it seems like the background is not taken into 
> account as I can see a few pixels of the background color in each of the 
> corners. (see attached dialog.png)

Maybe you have to overwrite the paint() method of your dialog make the corners 
of your rectangle rounded and _then_ paint your background into this rectangle? 





More information about the Qt-interest-old mailing list