From 4e1269974f59e47aeafc5c869aba565616e3c522 Mon Sep 17 00:00:00 2001 From: Melg Eight Date: Thu, 10 Feb 2022 04:20:53 +0300 Subject: [PATCH] Fix wrong pointer type casting Method event can get called with QChildEvent instead of QHelpEvent. Signed-off-by: Melg Eight --- widgets/MainWindow.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/widgets/MainWindow.h b/widgets/MainWindow.h index aaba52be..b3ecc856 100644 --- a/widgets/MainWindow.h +++ b/widgets/MainWindow.h @@ -39,10 +39,11 @@ class tipMenu : public QMenu tipMenu(QString n, QWidget *w) : QMenu(n, w) {} bool event (QEvent * e) { - const QHelpEvent *helpEvent = static_cast (e); - if (helpEvent->type() == QEvent::ToolTip && activeAction() && + + if (e->type() == QEvent::ToolTip && activeAction() && activeAction()->toolTip() != activeAction()->text()) { - QToolTip::showText(helpEvent->globalPos(), + const QHelpEvent *helpEvent = static_cast (e); + QToolTip::showText(helpEvent->globalPos(), activeAction()->toolTip()); } else { QToolTip::hideText();