Results 1 to 2 of 2

Thread: QRegion from QPolygon border issue

  1. #1
    Join Date
    May 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QRegion from QPolygon border issue

    Hello,

    I'm developing a little game that uses QPolygons as game-elements. These polygons may change position on the screen (it's a board-game), thus paintEvent is called whenever this happens. Since a QPolygon can be promoted to a QRegion through one of QRegions constructors, it is possible to pass the polygon that needs updating to the QWidget::update() function in order to only update this area and avoid redrawing the entire screen. However, on constructing a QRegion from a QPolygon, it seems that only the inside of the QPolygon is taken in account. For example, when removing such a polygon from the screen (i.e. redrawing the background), some of the border of the polygon (a black edge) remains! Does anyone have a suggestion on how to fix this?
    I considered redrawing the entire boundingRect() of the polygon, but this brings a lot of inconveniences along with it...

    Cheers,

    Joren

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QRegion from QPolygon border issue

    I'm guessing you have to account for pen width used to draw that polygon but I'm not sure how you would do that.

Similar Threads

  1. Replies: 2
    Last Post: 21st March 2012, 14:30
  2. What really is a QPolygon...
    By giusepped in forum Qt Programming
    Replies: 11
    Last Post: 14th January 2009, 06:57
  3. How to get a round rectangle (QRegion)
    By quzcFroal in forum Qt Programming
    Replies: 7
    Last Post: 2nd June 2008, 21:14
  4. QRegion multiply
    By xgoan in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2006, 09:54
  5. Clipping with QRegion(QBitmap());
    By high_flyer in forum Qt Programming
    Replies: 7
    Last Post: 27th April 2006, 17:17

Tags for this Thread

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.