Results 1 to 2 of 2

Thread: QGraphicsRectItem rounded corners

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

    Default QGraphicsRectItem rounded corners

    Hi,

    Since it says nothing about rounding the corners of a QGraphicsRectItem in the Qt-Documentation, I would like to know if it's possible, and if yes how?

    Thanks in advance,
    forty-two

  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: QGraphicsRectItem rounded corners

    You have to subclass QGraphicsRectItem and call QPainter::drawRoundRect() in your paint() implementation. Implementing shape() would also be advised if you wish to do collision detection.
    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.


  3. The following user says thank you to wysota for this useful post:

    forty-two (4th July 2012)

Similar Threads

  1. Rounded corners for a QWidget
    By Ying in forum Qt Programming
    Replies: 5
    Last Post: 2nd September 2011, 07:46
  2. How to create region with rounded corners
    By sanjayshelke in forum Qt Programming
    Replies: 1
    Last Post: 30th June 2009, 09:23
  3. QDialog with rounded corners
    By rossm in forum Qt Programming
    Replies: 2
    Last Post: 27th April 2009, 23:31
  4. Toplevel widget with rounded corners.
    By munna in forum Qt Programming
    Replies: 7
    Last Post: 18th August 2006, 20:46
  5. 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.