Fix crash when adding widgets to the panel

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=751539
This commit is contained in:
Jason Stubbs 2007-12-22 06:43:05 +00:00
parent 8d9aa19d83
commit c0bba16e87

View File

@ -560,8 +560,18 @@ void Widget::hoverEnterEvent(QGraphicsSceneHoverEvent *e)
if (view()->mouseGrabber()) {
return; // Someone has the mouse (eg. a context menu)
}
QPoint viewPos = view()->mapFromScene(scenePos());
QPoint globalPos = view()->mapToGlobal(viewPos);
// If the mouse is in the widget's area at the time that it is being created
// the widget can receive a hover event before it is fully initialized, in
// which case view() will return 0.
QGraphicsView *parentView = view();
if (!parentView) {
kDebug() << "no parent view";
return;
}
QPoint viewPos = parentView->mapFromScene(scenePos());
QPoint globalPos = parentView->mapToGlobal(viewPos);
ToolTip::instance()->show(globalPos, d->toolTip);
}