From 42b8a228401f1d74854dc48edb23f7ee4287e18c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 5 Aug 2019 13:40:36 +0200 Subject: [PATCH] CMakeEditor: Add fallback help ID Like we do for the BaseTextEditor. This allows users to get context help also for items that are not "commands", like various variables that have a meaning for CMake. Change-Id: Ie1af61bdffdeecb406b1dc7e6127000c17ea5a8e Reviewed-by: Cristian Adam Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakeeditor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index d3a4fd1d29a..351c08c6f9b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -71,7 +72,7 @@ void CMakeEditor::contextHelp(const HelpCallback &callback) const break; chr = characterAt(pos); if (chr == QLatin1Char('(')) { - callback({}); + BaseTextEditor::contextHelp(callback); return; } } while (chr.unicode() != QChar::ParagraphSeparator); @@ -97,12 +98,13 @@ void CMakeEditor::contextHelp(const HelpCallback &callback) const // Not a command if (chr != QLatin1Char('(')) { - callback({}); + BaseTextEditor::contextHelp(callback); return; } const QString id = "command/" + textAt(begin, end - begin).toLower(); - callback(id); + callback( + {{id, Utils::Text::wordUnderCursor(editorWidget()->textCursor())}, {}, HelpItem::Unknown}); } //