Results 1 to 4 of 4

Thread: which event/slot get called on scrolling QGraphicsView?

  1. #1
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Unhappy which event/slot get called on scrolling QGraphicsView?

    1. I want to know starting and ending X position of displayed data on every scroll.
    which event get called on scrolling QGraphicsView or QGraphicsScene
    where I handle scrolling?
    2. can I fix some item in QGraphicsScene, so, it will be displayed on scrolling also?
    3.
    setFlag( QGraphicsItem::ItemIsMovable );
    can I fix to move QGraphicsItem only in X direction not in Y direction?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: which event/slot get called on scrolling QGraphicsView?

    Quote Originally Posted by rajesh View Post
    1. I want to know starting and ending X position of displayed data on every scroll.
    which event get called on scrolling QGraphicsView or QGraphicsScene
    where I handle scrolling?
    Override QAbstractScrollArea::scrollContentsBy(int dx, int dy).
    J-P Nurmi

  3. #3
    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: which event/slot get called on scrolling QGraphicsView?

    Quote Originally Posted by rajesh View Post
    2. can I fix some item in QGraphicsScene, so, it will be displayed on scrolling also?
    When you scroll the canvas, simply move the item to remain in place (if that is what you want). You can do it in scrollContentsBy() as well.

    3. setFlag( QGraphicsItem::ItemIsMovable );
    can I fix to move QGraphicsItem only in X direction not in Y direction?
    No, you have to subclass the item and reimplement mouseMoveEvent to do that.

  4. #4
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: which event/slot get called on scrolling QGraphicsView?

    I going to Override scrollContentsBy(int dx, int dy).
    if it work then I can solve 2nd one also.

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.