Results 1 to 8 of 8

Thread: Any way to stop QGraphicsview render when zooming or panning ?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Any way to stop QGraphicsview render when zooming or panning ?

    When I have a lot of graphic information I'd need a way to stop the drawing in case, in example, I use the wheel to zoom in or out.
    If the drawing takes 1 second, and I'm going to do a deep zoom, every update is unusefull.
    Now I see how the wheel events are detected when the update is done

    Any idea to do this ? Thanks.

  2. #2
    Join Date
    Nov 2011
    Posts
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Any way to stop QGraphicsview render when zooming or panning ?

    Try updatesEnabled.
    It may not be what you are looking for tho.

  3. #3
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Any way to stop QGraphicsview render when zooming or panning ?

    Thanks but ...
    I'd need to know when the update starts, how to interrupt it, and when the update ends..
    Maybe have I to reimplement paint event for the QGrapchicsView ?
    Thanks.

  4. #4
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Any way to stop QGraphicsview render when zooming or panning ?

    IMHO first you have to find what is painted so long and fix it.
    One of tricks is to cache drawing. Do heavy drawing to QPixmap in some thread and in main thread show this QPixmap.

  5. #5
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Any way to stop QGraphicsview render when zooming or panning ?

    I'm drawing 100000 rectangles, with indexing.
    For Panning maybe useffull what you suggest.
    But I keep without knowing the progress of painting... neither stop it.

    Nobody else can give me some idea ?

    Thanks

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Any way to stop QGraphicsview render when zooming or panning ?

    If you are already trapping QWheelEvent events to do the zooming, then set a timer (250 ms or so) in the wheel event handler but do not zoom. If the user is moving the wheel quickly, the timer will be reset before it has a chance to time out. When the user stops moving the wheel, the timer will fire. Then in the timer slot, that's where you do the zoom. In the wheel event handler, you have to keep track of the total wheel movement so you can do a zoom as deep as needed.

  7. The following user says thank you to d_stranz for this useful post:

    tonnot (23rd November 2011)

  8. #7
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Any way to stop QGraphicsview render when zooming or panning ?

    Yes, it can be a way. However, in case I want to abort painting have I to investigate paintengine ? (I dont know where to look...)
    Also, I'd want to have a way to know the progress. I'm working with big vectorial worlds and need to show when it will be finished .
    Thanks d_st

  9. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Any way to stop QGraphicsview render when zooming or panning ?

    Also, I'd want to have a way to know the progress. I'm working with big vectorial worlds and need to show when it will be finished .
    Then I guess you need to make a custom QGraphicsView class and rewrite the paintEvent() handler. However, interrupting the painting to update a progress indicator might slow things down even more than now.

Similar Threads

  1. QGLWidget render or QGraphicsView with GL viewport render
    By QTInfinity in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2011, 11:34
  2. smooth panning and zooming an image, to use OpenGL or not?
    By scarleton in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2010, 22:25
  3. Replies: 1
    Last Post: 20th July 2010, 12:16
  4. QGraphicsView and panning performance
    By prashant in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2009, 19:40
  5. Graphics View Panning ,zooming
    By linuxdev in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2008, 07:17

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.