Results 1 to 4 of 4

Thread: How to redraw QGraphicsScene background in running

  1. #1
    Join Date
    Nov 2008
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default How to redraw QGraphicsScene background in running

    In my QGraphicsScene object declare, I have draw a picture in drawBackground(), see below:
    Qt Code:
    1. class MyScene : public QGraphicsScene
    2. {
    3. public:
    4. MyScene(qreal x, qreal y, qreal w, qreal h)
    5. : QGraphicsScene(x, y, w, h) { }
    6.  
    7. protected:
    8. void drawBackground(QPainter *painter, const QRectF &rect)
    9. { //draw an old background
    10. };
    To copy to clipboard, switch view to plain text mode 

    In my program running, I need redraw the background, how I will do?
    Very Thanks
    Last edited by wysota; 16th November 2008 at 09:43. Reason: missing [code] tags

  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 redraw QGraphicsScene background in running

    Call QGraphicsScene::invalidate() with QGraphicsScene::BackgroundLayer.

  3. #3
    Join Date
    Nov 2008
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to redraw QGraphicsScene background in running

    Thank you. But I not understand. Do you give me a particular explain or a source code

  4. #4
    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 redraw QGraphicsScene background in running

    Follow the link in my post.

Similar Threads

  1. OpenGL texture on QGraphicsScene background
    By Ovnan in forum Qt Programming
    Replies: 5
    Last Post: 11th July 2008, 10:39
  2. Moving the QGraphicsScene background content
    By maverick_pol in forum Qt Programming
    Replies: 5
    Last Post: 16th May 2008, 07:37

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.