From 04770a6fd881775e66abfe17f949d9c05beb50d8 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 15 Jan 2022 11:22:20 +0800 Subject: [PATCH] - enhancement: better behavior of mouse tips --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index edaf3d0c..1bf37f97 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,7 @@ Red Panda C++ Version 0.13.2 - fix: If project's compiler set is not the same with the default compiler set, auto openned project's file will use wrong compiler set to do syntax check. - fix: open a project file through "File"->"Open" will not correctly connect it with the project internally - fix: wrong project program directory parameter is sent to the debugger + - enhancement: better behavior of mouse tips Red Panda C++ Version 0.13.1 - enhancement: suppoort localization info in project templates diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 38ace815..474bcb4c 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1080,6 +1080,9 @@ bool Editor::event(QEvent *event) } else if (cursor() == Qt::PointingHandCursor) { updateMouseCursor(); } + if (pMainWindow->functionTip()->isVisible()) { + pMainWindow->functionTip()->hide(); + } QToolTip::showText(mapToGlobal(helpEvent->pos()),hint); event->ignore(); } else { @@ -2577,6 +2580,9 @@ void Editor::exportAsHTML(const QString &htmlFilename) void Editor::showCompletion(const QString& preWord,bool autoComplete) { + if (pMainWindow->functionTip()->isVisible()) { + pMainWindow->functionTip()->hide(); + } if (!pSettings->codeCompletion().enabled()) return; if (!mParser->enabled()) @@ -3060,8 +3066,8 @@ void Editor::cancelHint() // disable editor hint QToolTip::hideText(); - mCurrentWord = ""; - mCurrentTipType = TipType::None; + //mCurrentWord = ""; + //mCurrentTipType = TipType::None; updateMouseCursor(); } @@ -3129,6 +3135,9 @@ void Editor::showDebugHint(const QString &s, int line) } if (pMainWindow->debugger()->commandRunning()) return; + if (pMainWindow->functionTip()->isVisible()) { + pMainWindow->functionTip()->hide(); + } connect(pMainWindow->debugger(), &Debugger::evalValueReady, this, &Editor::onTipEvalValueReady); mCurrentDebugTipWord = s; @@ -3358,6 +3367,7 @@ void Editor::updateFunctionTip() pMainWindow->functionTip()->setParamIndex( paramPos ); + cancelHint(); pMainWindow->functionTip()->show(); }