Results 1 to 20 of 22

Thread: How can both graphicsView and graphicsItem receive mousemoveEvent?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    38
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    29

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

    Quote Originally Posted by olidem View Post
    Because the item "lets them through" ? As long as you call QGraphicsItem::mouseXXXEvent, it will travel through, I think
    Now i counter another problem, the class which inherit from QGraphicsItem can't be moved and seletable.
    and i have setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable)
    in it's constructor,but it still can move.(i also try to put setFlags of this item in any possible postion, but it still can't be moved)
    but i also add a ellipse item in the scene, howerver,the ellipse item can move.

    Why? I don't understand why this happen to this item?
    Wish anyone's help soonly !Thank you!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

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

    Are you overriding some events of the item you inherited from graphicsitem ?

    If yes, are you calling the base class QGraphicsItem methods from there ?

  3. #3
    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.