diff --git a/private/tooltip.cpp b/private/tooltip.cpp index b2aca0e8a..fca9b6715 100644 --- a/private/tooltip.cpp +++ b/private/tooltip.cpp @@ -234,8 +234,9 @@ void ToolTip::hideEvent(QHideEvent *e) QWidget::hideEvent(e); d->animation->stop(); - if (d->source) { - QMetaObject::invokeMethod(d->source.data(), "toolTipHidden"); + QObject *source = d->source.data(); + if (source && source->metaObject()->indexOfMethod("toolTipHidden()") != -1) { + QMetaObject::invokeMethod(source, "toolTipHidden"); } WindowEffects::highlightWindows(winId(), QList()); diff --git a/tooltipmanager.cpp b/tooltipmanager.cpp index 1e1508c06..5c3aac88f 100644 --- a/tooltipmanager.cpp +++ b/tooltipmanager.cpp @@ -364,13 +364,15 @@ void ToolTipManagerPrivate::showToolTip() return; } - // toolTipAboutToShow may call into methods such as setContent which play - // with the current widget; so let's just pretend for a moment that we don't have - // a current widget - QGraphicsWidget *temp = currentWidget; - currentWidget = 0; - QMetaObject::invokeMethod(temp, "toolTipAboutToShow"); - currentWidget = temp; + if (currentWidget->metaObject()->indexOfMethod("toolTipAboutToShow()") != -1) { + // toolTipAboutToShow may call into methods such as setContent which play + // with the current widget; so let's just pretend for a moment that we don't have + // a current widget + QGraphicsWidget *temp = currentWidget; + currentWidget = 0; + QMetaObject::invokeMethod(temp, "toolTipAboutToShow"); + currentWidget = temp; + } QHash::const_iterator tooltip = tooltips.constFind(currentWidget);