Results 1 to 2 of 2

Thread: How to create region with rounded corners

  1. #1
    Join Date
    Jul 2007
    Posts
    90
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to create region with rounded corners

    Hi,

    I need to create a widget with rounded corners.
    I can do this using setMask.
    But how to create a QRegion with rounded corners so that i can use this region in setMask.


    Regards,
    ~Sanjay

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to create region with rounded corners

    Add a rounded rect to QPainterPath, convert it to a polygon and then to a region.

    But it might be much easier if you go through the version of setMask() that takes a bitmap - simply create a pixmap and draw a rounded rect on it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QDialog with rounded corners
    By rossm in forum Qt Programming
    Replies: 2
    Last Post: 27th April 2009, 23:31
  2. Widget with rounded edges
    By gruszczy in forum Qt Programming
    Replies: 14
    Last Post: 26th April 2009, 07:03
  3. Toplevel widget with rounded corners.
    By munna in forum Qt Programming
    Replies: 7
    Last Post: 18th August 2006, 20:46
  4. widget with rounded corners
    By sreedhar in forum Qt Programming
    Replies: 4
    Last Post: 7th June 2006, 12:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.