[Qt-interest] Screen coordinates in QGraphicsItem::hoverEnterEvent() ?
Giuseppe D'Angelo
dangelog at gmail.com
Wed May 25 02:36:26 CEST 2011
On Wed, May 25, 2011 at 2:14 AM, <bd.anon at free.fr> wrote:
> 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 ?
Ok, now it's clear. 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. From there it should be quite
easy to call QToolTip::showText with the right parameters.
--
Giuseppe D'Angelo
More information about the Qt-interest-old
mailing list