Results 1 to 2 of 2

Thread: Possible QGraphicsView/Scene bug

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    England
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Possible QGraphicsView/Scene bug

    Hey all,
    I think I might have found a bug in Qt4 but of course it's always possible that I've just done something wrong.

    I you could have a look at the attached sources and first let me know if you encounter the same thing as me:

    Clicking in the area will draw dots (the view will move around to centre on the dots)
    Click "New" to create a new GameBoardScene
    Clicking in the area no longer works the same:
    The dots are added to the Scene but, for some reason, the View isn't updated unless you:
    * Resize the window
    * Probably some other things which force a refresh

    And if you do encounter the same bug, is there anything in my code that is blatantly wrong?

    Many thanks,
    Matt Williams
    Attached Files Attached Files

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

    Default Re: Possible QGraphicsView/Scene bug

    I've changed your code a little and now it works fine:
    Qt Code:
    1. void KSquares::gameNew()
    2. {
    3. QGraphicsScene *sc = m_scene; // store old scene
    4. m_scene = new GameBoardScene(); // create new scene
    5. m_view->setScene(m_scene); // set new scene
    6. delete sc; // delete old scene
    7. }
    To copy to clipboard, switch view to plain text mode 

    This way the graphics view always has a valid scene.

Similar Threads

  1. Windows XP and QGraphicsView/Scene
    By maxpower in forum Qt Programming
    Replies: 7
    Last Post: 9th January 2007, 21:34

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.