Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: How can both graphicsView and graphicsItem receive mousemoveEvent?

  1. #21
    Join Date
    Mar 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy Re: How can both graphicsView and graphicsItem receive mousemoveEvent?

    Quote Originally Posted by aamer4yu View Post
    In short what I understand is you want to zoom into the scene / view with rubberband effect.

    I dont think you have to go to items level for that. What you need to do is - catch mouse events in your scene / view. Draw the rubberband in mouse move events, and finally on mouse release event you capture a rect, from the mousepress(x,y) and mouserelease(x,y).
    Now you convert this rect in to scene rect, and call QGraphicsView::fitInView()
    Thats it, you are zoomed in :-) , and you only had to capture events in the view
    That is exactly what I need! I've implemented almost all of it, but it is not working when i subclass a scene, and subclass the GraphicsView will be sort of problematic, because I'm using the widget from the Designer widget bar. I would have to create dynamically including the layouts

    Thanks in advance for any Help
    SC

  2. #22
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Qt products
    Qt4
    Platforms
    Windows Android
    Thanks
    14
    Thanked 13 Times in 13 Posts

    Default Re: How can both graphicsView and graphicsItem receive mousemoveEvent?

    Hi,

    I have very similar problem regarding this subject.

    I have a QGraphicsView and QGraphicsScene and some QGraphicsItem (as usual). For again to zoom upan a rubberband action I needed to reimplement mouse move event in QGraphicsView. Moreover, I also want to change the color of the item whenever mouse moves on the item. So it seemed I need to reimplement the mouse move event also in the QGraphicsItem. But I doesn't work. I also tried out eventFilter thing.

    Can anyone help me?

    Thanks in advance.

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
  •  
Qt is a trademark of The Qt Company.