Core: Return context help id by callback

...to support asynchronous providers.

Change-Id: I483489c74e7886d5bc2bf00b65540c3d2c7afee0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-01-17 16:06:13 +01:00
parent 9990fff2c8
commit dd06a4188d
27 changed files with 96 additions and 75 deletions

View File

@@ -61,7 +61,7 @@ namespace Internal {
// CMakeEditor
//
QString CMakeEditor::contextHelpId() const
void CMakeEditor::contextHelpId(const HelpIdCallback &callback) const
{
int pos = position();
@@ -71,8 +71,10 @@ QString CMakeEditor::contextHelpId() const
if (pos < 0)
break;
chr = characterAt(pos);
if (chr == QLatin1Char('('))
return QString();
if (chr == QLatin1Char('(')) {
callback(QString());
return;
}
} while (chr.unicode() != QChar::ParagraphSeparator);
++pos;
@@ -95,11 +97,13 @@ QString CMakeEditor::contextHelpId() const
}
// Not a command
if (chr != QLatin1Char('('))
return QString();
if (chr != QLatin1Char('(')) {
callback(QString());
return;
}
QString command = textAt(begin, end - begin).toLower();
return QLatin1String("command/") + command;
callback(QLatin1String("command/") + command);
}
//