QmlProject: Do not open .qml.ui file if a file from that project is open

The wizards and example browser already open a .ui.qml file.
In this case we do not want to open the first one.

Change-Id: I8278ca28cd02dfde2b4ab0ffd1b551073d85859f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
Thomas Hartmann
2021-09-07 13:05:53 +02:00
parent 3a26271660
commit 97a65f9ea2

View File

@@ -151,8 +151,14 @@ QmlProject::QmlProject(const Utils::FilePath &fileName)
return node->filePath().completeSuffix() == "ui.qml"
&& node->filePath().parentDir() == folder;
});
if (!uiFiles.isEmpty())
Core::EditorManager::openEditor(uiFiles.first(), Utils::Id());
if (!uiFiles.isEmpty()) {
Utils::FilePath currentFile;
if (auto cd = Core::EditorManager::currentDocument())
currentFile = cd->filePath();
if (currentFile.isEmpty() || !isKnownFile(currentFile))
Core::EditorManager::openEditor(uiFiles.first(), Utils::Id());
}
}
});
}