is there a way to check if mouse is over (within) the boundingrect for a qgraphicsitem. (akin to hoverover)
is there a way to check if mouse is over (within) the boundingrect for a qgraphicsitem. (akin to hoverover)
Last edited by rogerholmes; 11th January 2010 at 00:39.
kichi
Kichi,
Thank You for you response.
I am using that. I need a similar functionally for boundingrect, hover events only fire when the mouse is over the actual image, i want to have a method fire when mouse is over the boundingrect of the image.
It really depends on the context. The simplest way would be to use this:
If you can have the position of the cursor in item coordinates (i.e. in item events containing the cursor position).Qt Code:
QPointF pos = ... bool inside = item->boundingRect().contains(pos);To copy to clipboard, switch view to plain text mode
If you have the position of the cursor relative to the scene or the view then you can use the family of mapTo* or mapFrom* to get to local coordinates and use the code above.
rogerholmes (11th January 2010)
Thank You Wysota,
I will try that.
Bookmarks