From 44815f6ae0318fef8dd0d0c8621a3fb402dc74ac Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Sat, 30 Jul 2011 20:18:07 +0200 Subject: [PATCH] get the corona from the item itself BUG:277135 --- tooltipmanager.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tooltipmanager.cpp b/tooltipmanager.cpp index 2952d7dea..a67599373 100644 --- a/tooltipmanager.cpp +++ b/tooltipmanager.cpp @@ -246,10 +246,11 @@ void ToolTipManager::setContent(QGraphicsWidget *widget, const ToolTipContent &d d->tipWidget->setContent(widget, data); d->tipWidget->prepareShowing(); - if (m_corona) { - //look if the data prefers aother graphicswidget, otherwise use the one used as event catcher - QGraphicsWidget *referenceWidget = data.graphicsWidget() ? data.graphicsWidget() : widget; - d->tipWidget->moveTo(m_corona->popupPosition(referenceWidget, d->tipWidget->size(), Qt::AlignCenter)); + //look if the data prefers aother graphicswidget, otherwise use the one used as event catcher + QGraphicsWidget *referenceWidget = data.graphicsWidget() ? data.graphicsWidget() : widget; + Corona *corona = qobject_cast(referenceWidget->scene()); + if (corona) { + d->tipWidget->moveTo(corona->popupPosition(referenceWidget, d->tipWidget->size(), Qt::AlignCenter)); } } } @@ -401,9 +402,10 @@ void ToolTipManagerPrivate::showToolTip() clickable = tooltip.value().isClickable(); tipWidget->setContent(currentWidget, tooltip.value()); tipWidget->prepareShowing(); - if (q->m_corona) { - QGraphicsWidget *referenceWidget = tooltip.value().graphicsWidget()?tooltip.value().graphicsWidget():currentWidget; - tipWidget->moveTo(q->m_corona->popupPosition(referenceWidget, tipWidget->size(), Qt::AlignCenter)); + QGraphicsWidget *referenceWidget = tooltip.value().graphicsWidget() ? tooltip.value().graphicsWidget() : currentWidget; + Corona *corona = qobject_cast(referenceWidget->scene()); + if (corona) { + tipWidget->moveTo(corona->popupPosition(referenceWidget, tipWidget->size(), Qt::AlignCenter)); } tipWidget->show(); isShown = true; //ToolTip is visible