forked from qt-creator/qt-creator
QmlProject: Delay the opening of the fake project
There are cases e.g. when restarting QDS when the correct .qmlproject will be opened anyway. Task-number: QDS-13495 Change-Id: I04e13d148484c3afa8e08fe2a43eb700c615720a Reviewed-by: Burak Hancerli <burak.hancerli@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -409,10 +409,16 @@ void QmlProjectPlugin::initialize()
|
|||||||
[](Core::IDocument *document) {
|
[](Core::IDocument *document) {
|
||||||
if (!ProjectManager::startupProject()
|
if (!ProjectManager::startupProject()
|
||||||
&& document->filePath().completeSuffix() == "ui.qml") {
|
&& document->filePath().completeSuffix() == "ui.qml") {
|
||||||
|
QTimer::singleShot(1000, [document]() {
|
||||||
|
if (ProjectManager::startupProject())
|
||||||
|
return;
|
||||||
|
|
||||||
const Utils::FilePath fileName = Utils::FilePath::fromString(
|
const Utils::FilePath fileName = Utils::FilePath::fromString(
|
||||||
document->filePath().toString() + Constants::fakeProjectName);
|
document->filePath().toString() + Constants::fakeProjectName);
|
||||||
auto result = ProjectExplorer::ProjectExplorerPlugin::openProjects({fileName});
|
auto result = ProjectExplorer::ProjectExplorerPlugin::openProjects(
|
||||||
|
{fileName});
|
||||||
QTC_ASSERT(result.project(), return);
|
QTC_ASSERT(result.project(), return);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user