forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user