diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-08-05 13:40:36 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-08-19 06:49:56 +0000 |
commit | 42b8a228401f1d74854dc48edb23f7ee4287e18c (patch) | |
tree | 87508129c052b51560033a5757e5df335620dda7 /src/plugins/cmakeprojectmanager/cmakeeditor.cpp | |
parent | 22092ee4e629907b4852a2ad474219f5cd26e031 (diff) |
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 <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakeeditor.cpp')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeeditor.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index d3a4fd1d29..351c08c6f9 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -45,6 +45,7 @@ #include <texteditor/texteditorconstants.h> #include <utils/qtcassert.h> +#include <utils/textutils.h> #include <QFileInfo> #include <QTextBlock> @@ -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}); } // |