QmlJS: Ensure QtQuick is the first import

Some items will show empty property panel and cannot be reparented
in QmlDesigner if the module that defines the item is imported before
QtQuick module. This fix ensures QtQuick module is always imported
first.

Change-Id: Ie610fef681f5bf0ac62d1b879bb9306d4f7d293b
Fixes: QDS-3115
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-11-13 16:51:07 +02:00
parent c7b5501c84
commit d661c2ed12

View File

@@ -228,6 +228,11 @@ bool Bind::visit(UiImport *ast)
_doc->setLanguage(Dialect::QmlQtQuick2);
}
}
// Make sure QtQuick import is in the list before imports that might depend on it
if (import.name() == QLatin1String("QtQuick"))
_imports.prepend(import);
else
_imports += import;
} else if (!ast->fileName.isEmpty()) {
_imports += ImportInfo::pathImport(_doc->path(), ast->fileName.toString(),