Results 1 to 4 of 4

Thread: scrolling graphicsWidget using mouse

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default scrolling graphicsWidget using mouse

    hi friends,expert,

    im adding QGraphicsLayoutItem in a QGraphicsWidget in run time using QGraphicsLinearLayout.

    i have to add more items to the layout that exceeds the height of the viewport height and items shown outside the viewport area.so is it possible to pan or scroll in QGraphicsWidget like QGraphicsView. QGraphicsView i can pan using centerOn and showing only a visible rect.
    the normal view
    Screen1.jpg

    and and when more item added
    Screen2.jpg

    i have done panning in qgraphicsview using centerOn and visibleViewport but how i can do for the QGraphicsWidget and show only a certain part of the QGraphicsWidget having layout items added in vertical layout .

    how to show only a visible region or rect of QGraphicsItem

    please help me

    thanks in advance .
    Last edited by wagmare; 18th December 2014 at 09:26.
    "Behind every great fortune lies a crime" - Balzac

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: scrolling graphicsWidget using mouse

    You could put it into a "viewport" item and make that item clip to its shape.
    Then implement mouse handling in that viewport item to move the child/content accordingly

    Cheers,
    _

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

    wagmare (19th December 2014)

  4. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scrolling graphicsWidget using mouse

    you mean to say . create a qgraphicsitem and add the graphicsWidget with layout item as a child and clip the rect of the parent item to the required rect and add to the scene .?
    it is a very good idea thanks .

    but one more doubt .. how i can scroll in the qgraphicsitem (parent) ..?
    "Behind every great fortune lies a crime" - Balzac

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: scrolling graphicsWidget using mouse

    Quote Originally Posted by wagmare View Post
    but one more doubt .. how i can scroll in the qgraphicsitem (parent) ..?
    By moving the child. Its position is relative to the parent and the parent clips.

    Cheers,
    _

Similar Threads

  1. Replies: 0
    Last Post: 4th January 2013, 04:59
  2. Scrolling on Mouse Wheel
    By penny in forum Qt Programming
    Replies: 4
    Last Post: 7th April 2011, 07:30
  3. Replies: 1
    Last Post: 3rd November 2010, 12:06
  4. Replies: 3
    Last Post: 9th March 2010, 09:37
  5. Prob: Adding SpinBox to the GraphicsWidget
    By ashishsaryar in forum Qt Programming
    Replies: 1
    Last Post: 20th May 2008, 09:00

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.