Results 1 to 4 of 4

Thread: QGraphics view update : Help needed

  1. #1
    Join Date
    Dec 2006
    Posts
    17
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default QGraphics view update : Help needed

    Hi,

    I am stuck with some problem regarding GraphicsView update.

    if drag the scroll bar on the right to move the viewing area up
    and down directly to the area that I want to view, then the
    display does not clean up the view first. There is some left-over
    picture mixed with the new viewing area. If i drag the scroll
    bar all the way to the top or all the way to the bottom, then you
    will see some image left at the top edge or the bottom edge.
    [ This is true only at the edges.

    I have overrriden
    void GraphicsScene:: scrollByContents(int dx, int dy)
    {
    scene()->update();
    }

    Thanx.

  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: QGraphics view update : Help needed

    Why did you override that method this way? You're not calling the default implementation. The code simply doesn't have any sense.

  3. #3
    Join Date
    Dec 2006
    Posts
    17
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QGraphics view update : Help needed

    Previously when ever i moved the scrollbars i used to get
    previous picture mixed with the new viewing area. So i thought that scene is not updating
    properly and reimplemented the scrollByContents method.

    This solved the problem but iam still not getting the proper picture at the ends.

  4. #4
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QGraphics view update : Help needed

    Looks like some of your items don't implement the boundingrect properly. Make sure you are not painting outside the bounding rect in your items.
    Also are you implementing any item which changes its size ? If so make sure you also use prepareGeometryChange() berfore changing its bounding rect.
    Ofcourse these are only gusses. If you show your code we might help in a better way

    EDIT: BTW don't reimplement scrollByContents() if you don't want to change the default behaviour. Otherwise you might totally mess up the scrolling.
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

Similar Threads

  1. QGraphics view problem
    By kiranraj in forum Qt Programming
    Replies: 5
    Last Post: 6th March 2007, 21:28
  2. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  3. Replies: 9
    Last Post: 7th November 2006, 15:10
  4. Replies: 6
    Last Post: 20th April 2006, 10:23
  5. View update problem
    By prakash in forum Qt Programming
    Replies: 6
    Last Post: 17th March 2006, 10:13

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.