[Qt-interest] Screen coordinates in QGraphicsItem::hoverEnterEvent() ?

bd.anon at free.fr bd.anon at free.fr
Wed May 25 02:14:37 CEST 2011


Le Mon, 23 May 2011 14:50:22 +0200, "Giuseppe D'Angelo"
<dangelog at gmail.com>  écrivait:

>> Am I missing something ?
>
>QGraphicsSceneHoverEvent::screenPos?

No.

QToolTip::showText also requires a Rect, not just a point, in order to
automatically destroy the Tooltip when the mouse stops hovering above
this very Rect.

Said Rect must be in some widget coordinates, according to the
documentation. But which widget should it be ?

It cannot be the QGraphicsItem, as it is not widget derived. That is
unfortunate, as it is the only coordinate system that it knows about.

It cannot be the screen itself, as I do not know which screen the
QGraphicsItem is displayed on ; furthermore, for all I know, the
QGraphicsItem could very well be split between up to 4 different
screens.

QGraphicsItem certainly knows about the Scene, but this is not a
widget. True, from the scene, you can access the widget-derived view,
displaying this scene, but how do I know which view to select when
there are several of them displaying the same scene ?

I am certain there has to be a simple solution, but it escapes me. If
you already solved this problem, a cut and paste of the relevant part
of your QGraphicsItem::hoverEnterEvent() would be very helpful.

Bertrand Anon



More information about the Qt-interest-old mailing list