forked from qt-creator/qt-creator
QmlJS: Fix enum completion with 'as' imports.
Change-Id: Ifc229c23c14a6395c9d3e5f7ec76b9b04678787d Reviewed-on: http://codereview.qt-project.org/5134 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
@@ -643,9 +643,16 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface
|
||||
getPropertyValue(qmlScopeType, contextFinder.bindingPropertyName(), context);
|
||||
if (const QmlEnumValue *enumValue =
|
||||
dynamic_cast<const QmlEnumValue *>(value)) {
|
||||
foreach (const QString &key, enumValue->keys())
|
||||
const QString &name = context->imports(document.data())->nameForImportedObject(enumValue->owner(), context.data());
|
||||
foreach (const QString &key, enumValue->keys()) {
|
||||
QString completion;
|
||||
if (name.isEmpty())
|
||||
completion = QString("\"%1\"").arg(key);
|
||||
else
|
||||
completion = QString("%1.%2").arg(name, key);
|
||||
addCompletion(&m_completions, key, m_interface->symbolIcon(),
|
||||
EnumValueOrder, QString("%1.%2").arg(enumValue->owner()->className(), key));
|
||||
EnumValueOrder, completion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user