qmljs: Suppress "package requires a version number" with unknown Qt

Assume Qt6 instead of the version creator was built against when we
cannot get the qtVersion one builds against.
This is a better default and avoiding spurious warnings for example
when building qt.

Fixes: QTCREATORBUG-24533
Change-Id: I53dc6387229c510c390b41af8866c2e9b2ece3de
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Fawzi Mohamed
2021-01-22 11:04:55 +01:00
parent 422d5cf908
commit fecb0a4c83

View File

@@ -206,12 +206,12 @@ bool Bind::visit(UiImport *ast)
version = ComponentVersion(ast->version->majorVersion, ast->version->minorVersion);
if (ast->importUri) {
QVersionNumber qtVersion = QLibraryInfo::version();
QVersionNumber qtVersion;
if (ModelManagerInterface *model = ModelManagerInterface::instance()) {
ModelManagerInterface::ProjectInfo pInfo = model->projectInfoForPath(_doc->fileName());
qtVersion = QVersionNumber::fromString(pInfo.qtVersionString);
}
if (!version.isValid() && qtVersion.majorVersion() < 6) {
if (version.isValid() && (!qtVersion.isNull() && qtVersion.majorVersion() < 6)) {
_diagnosticMessages->append(
errorMessage(ast, tr("package import requires a version number")));
}