[Qt-interest] widget with round corners

manish.s.sharma at nokia.com manish.s.sharma at nokia.com
Tue Feb 17 07:45:37 CET 2009


One way to do without coding is modify the image with help of some image editing software eg. gimp.
- what you have to do is add a transparent layer in the image. (in the corners)
- then set this image as baclground image to your widget

Now widget will be only visible in the non-transparent area.

A small tutorial on how to add transparency in a image.
http://www.fabiovisentin.com/tutorial/GIMP_transparent_image/gimp_how_to_make_transparent_image.asp


Hope this helps.

Regards,
Manish


>-----Original Message-----
>From: qt-interest-bounces at trolltech.com
>[mailto:qt-interest-bounces at trolltech.com] On Behalf Of ext
>Markus Franke
>Sent: Tuesday, February 17, 2009 11:46 AM
>To: pbisht at nivio.com
>Cc: Qt-interest at trolltech.com
>Subject: Re: [Qt-interest] widget with round corners
>
>Zitat von Puneet Bisht <pbisht at nivio.com>:
>
>> i want to cut the extra region on the corners.
>> can someone help me on this.
>
>Well, Qt4 provides style-sheets to achieve this. If it's a
>QLabel you can simply set "border-radius" to some value. Don't
>know if this is also possible with Qt3 but I am afraid it
>isn't. You can also paint the widget by yourself in the
>widget's paintEvent() handler using primives like drawRoundRect().
>
>So long,
>Markus
>
>_______________________________________________
>Qt-interest mailing list
>Qt-interest at trolltech.com
>http://lists.trolltech.com/mailman/listinfo/qt-interest
>




More information about the Qt-interest-old mailing list