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

bd.anon at free.fr bd.anon at free.fr
Sun May 29 02:43:14 CEST 2011


Le Wed, 25 May 2011 02:36:26 +0200, "Giuseppe D'Angelo"
<dangelog at gmail.com>  écrivait:

>I haven't tested it yet, but it seems reasonable
>to me that QGraphicsSceneHoverEvent::widget() returns the viewport of
>the QGraphicsView which got the event.

We do not know that.

It might (or not) be fact for the current implementation, but since
the documentation do not state anything about which widget
QGraphicsSceneEvent::widget() refers to, is it not unsafe to assume it
would always be the case ?

> From there it should be quite
>easy to call QToolTip::showText with the right parameters.

I am probably missing something here to, but no, I fail to see how
that would be easy.

It is easy to map to and from a QGraphicsItem parent, or sibling, or
scene, but I do not know how to do that with some anonymous Widget.

Besides, even if that were possible, it still would not answer my
initial question : How can I return a single Rect in a single device
coordinate system if that Rect is spread over several different
screens, and hence different coordinate systems ?

As I see it, the only reasonable option would have been for Qt to
offer an option to define the Rect for QToolTip::showText in
QGraphicsItem's local coordinates.

Is this an oversight in Qt, or is there a simple answer to my tooltip
problem from within a QGraphicsItem mouse Event ?

Bertrand Anon



More information about the Qt-interest-old mailing list