Results 1 to 5 of 5

Thread: QGraphicsItem flickering

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGraphicsItem flickering

    You are drawing outside your boundingRect(). Calling setPos() in the item constructor doesn't make much sense either.
    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.


  2. #2
    Join Date
    Feb 2011
    Location
    Poland
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: QGraphicsItem flickering

    Do you mean adding adjust*2 when I specify rectf width and height?

    Qt Code:
    1. QRectF BallItem::boundingRect() const
    2. {
    3. qreal adjust = 0.5;
    4. QRectF rectf = QRectF(-iRadius-adjust, -iRadius-adjust, iRadius*2 + adjust*2
    5. , iRadius*2 + adjust*2);
    6.  
    7. return rectf;
    8. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: QGraphicsItem flickering

    Simplify the code (QRectF has a bunch of nice methods). And what's the purpose of calling setPos() in the constructor?
    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.


  4. #4
    Join Date
    Feb 2011
    Location
    Poland
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: QGraphicsItem flickering

    I am going to rewrite it so it will look better.

    If it comes to constructor, hmm well it is a remaining from my try-outs, setPos() is going to be removed. Now I know it is not the best way to do so, but when I started with QGraphics... stuff I didn't know that.

Similar Threads

  1. Qt flickering animation
    By tomrider in forum Qt Programming
    Replies: 5
    Last Post: 5th May 2011, 14:31
  2. QGraphicsItem flickering problems
    By aladagemre in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2010, 16:48
  3. Flickering problem
    By yagabey in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2010, 12:25
  4. Flickering
    By Pembar in forum Qt Programming
    Replies: 2
    Last Post: 19th May 2009, 19:21
  5. QtOgreFramework flickering with qt 4.5
    By Angelo Moriconi in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2009, 10:52

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
  •  
Qt is a trademark of The Qt Company.