Results 1 to 2 of 2

Thread: How to know when the user scroll through or is panning the QGraphicsView

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to know when the user scroll through or is panning the QGraphicsView

    Hi,

    I am using QGraphicsView to display my UI.

    The UI is big enough to show the scrollbar and I also have view's drag mode set to panning. Now how can I know when the user is scrolling though the view or panning through the view? What signal is emitted or what event should I override?

    Thanks

  2. #2
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: How to know when the user scroll through or is panning the QGraphicsView

    Hi ,

    You can have set one of the following possible drags

    View.setDragMode(QGraphicsView::ScrollHandDrag orQGraphicsView::RubberBandDrag);
    view.show();

    In QGraphicsView::ScrollHandDrag ,The cursor changes into a pointing hand, and dragging the mouse around will scroll the scrolbars. This mode works both in interactive and non-interactive mode.

    In orQGraphicsView::RubberBandDrag A rubber band will appear. Dragging the mouse will set the rubber band geometry, and all items covered by the rubber band are selected. This mode is disabled for non-interactive views.

    Alternatively if you want override any of the events related to Viewport you can use : QAbstractScrollArea::viewportEvent().

    Hope this helps.

  3. The following user says thank you to Aster036 for this useful post:

    dpatel (20th July 2010)

Similar Threads

  1. How to Disable Scroll Bar of QGraphicsView (or QWidget) ??
    By jiapei100 in forum Qt Programming
    Replies: 5
    Last Post: 6th November 2011, 03:45
  2. QGraphicsView and panning performance
    By prashant in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2009, 19:40
  3. QGraphicsView without scroll bar
    By sanjayshelke in forum Qt Programming
    Replies: 4
    Last Post: 20th July 2009, 12:17
  4. Replies: 1
    Last Post: 11th June 2009, 05:49
  5. QGraphicsView : scroll on drag
    By kghose in forum Qt Programming
    Replies: 4
    Last Post: 14th August 2008, 21:50

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.