From 734e8e0630160151ff9247c72e45ea46ceac37ef Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Tue, 24 Dec 2024 14:57:41 +0000 Subject: [PATCH] Add tooltip event filter controlled by setting --- src/clientdlg.cpp | 14 ++++++++++++++ src/clientdlg.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index cbfa04518d..f58511457f 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -49,6 +49,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP, { setupUi ( this ); + // install event filter for tooltips + qApp->installEventFilter ( this ); + // Add help text to controls ----------------------------------------------- // input level meter QString strInpLevH = "" + tr ( "Input Level Meter" ) + ": " + @@ -1516,3 +1519,14 @@ void CClientDlg::SetPingTime ( const int iPingTime, const int iOverallDelayMs, c // set current LED status ledDelay->SetLight ( eOverallDelayLEDColor ); } + +bool CClientDlg::eventFilter ( QObject* obj, QEvent* event ) +{ + if ( event->type() == QEvent::ToolTip && !pSettings->bShowToolTips ) + { + return true; // don't show tooltip + } + + // continue with normal processing of event + return CBaseDlg::eventFilter ( obj, event ); +} diff --git a/src/clientdlg.h b/src/clientdlg.h index 2a9062a58d..747326a9f1 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -120,6 +120,7 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase virtual void dragEnterEvent ( QDragEnterEvent* Event ) { ManageDragNDrop ( Event, true ); } virtual void dropEvent ( QDropEvent* Event ) { ManageDragNDrop ( Event, false ); } void UpdateDisplay(); + bool eventFilter ( QObject* obj, QEvent* event ); CClientSettingsDlg ClientSettingsDlg; CChatDlg ChatDlg;