get the corona from the item itself

BUG:277135
This commit is contained in:
Aaron Seigo 2011-07-30 20:18:07 +02:00
parent 9a9d2bd419
commit 44815f6ae0

View File

@ -246,10 +246,11 @@ void ToolTipManager::setContent(QGraphicsWidget *widget, const ToolTipContent &d
d->tipWidget->setContent(widget, data); d->tipWidget->setContent(widget, data);
d->tipWidget->prepareShowing(); d->tipWidget->prepareShowing();
if (m_corona) {
//look if the data prefers aother graphicswidget, otherwise use the one used as event catcher //look if the data prefers aother graphicswidget, otherwise use the one used as event catcher
QGraphicsWidget *referenceWidget = data.graphicsWidget() ? data.graphicsWidget() : widget; QGraphicsWidget *referenceWidget = data.graphicsWidget() ? data.graphicsWidget() : widget;
d->tipWidget->moveTo(m_corona->popupPosition(referenceWidget, d->tipWidget->size(), Qt::AlignCenter)); Corona *corona = qobject_cast<Corona *>(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(); clickable = tooltip.value().isClickable();
tipWidget->setContent(currentWidget, tooltip.value()); tipWidget->setContent(currentWidget, tooltip.value());
tipWidget->prepareShowing(); tipWidget->prepareShowing();
if (q->m_corona) { QGraphicsWidget *referenceWidget = tooltip.value().graphicsWidget() ? tooltip.value().graphicsWidget() : currentWidget;
QGraphicsWidget *referenceWidget = tooltip.value().graphicsWidget()?tooltip.value().graphicsWidget():currentWidget; Corona *corona = qobject_cast<Corona *>(referenceWidget->scene());
tipWidget->moveTo(q->m_corona->popupPosition(referenceWidget, tipWidget->size(), Qt::AlignCenter)); if (corona) {
tipWidget->moveTo(corona->popupPosition(referenceWidget, tipWidget->size(), Qt::AlignCenter));
} }
tipWidget->show(); tipWidget->show();
isShown = true; //ToolTip is visible isShown = true; //ToolTip is visible