forked from qt-creator/qt-creator
Do not enter edit mode when opening a .qmlproject as QDS
If the user opens a .qmlproject in QDS mode we do not want to enter the edit mode by default. We check the startup project after opening and calling openEditMode() will determine if we keep the default of opening the edit mode or not. Change-Id: Ic8a7fbefa007d487ec680099544c07fe007c0b29 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -1078,6 +1078,11 @@ bool Project::isModified() const
|
||||
return !modifiedDocuments().isEmpty();
|
||||
}
|
||||
|
||||
bool Project::isEditModePreferred() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(WITH_TESTS)
|
||||
|
||||
static FilePath constructTestPath(const char *basePath)
|
||||
|
@@ -183,6 +183,8 @@ public:
|
||||
QList<Core::IDocument *> modifiedDocuments() const;
|
||||
bool isModified() const;
|
||||
|
||||
virtual bool isEditModePreferred() const;
|
||||
|
||||
signals:
|
||||
void projectFileIsDirty(const Utils::FilePath &path);
|
||||
|
||||
|
@@ -2512,12 +2512,13 @@ ProjectExplorerPlugin::OpenProjectResult ProjectExplorerPlugin::openProjects(con
|
||||
}
|
||||
dd->updateActions();
|
||||
|
||||
bool switchToProjectsMode = Utils::anyOf(openedPro, &Project::needsConfiguration);
|
||||
|
||||
const bool switchToProjectsMode = Utils::anyOf(openedPro, &Project::needsConfiguration);
|
||||
const bool switchToEditMode = Utils::allOf(openedPro,
|
||||
[](Project *p) { return p->isEditModePreferred(); });
|
||||
if (!openedPro.isEmpty()) {
|
||||
if (switchToProjectsMode)
|
||||
ModeManager::activateMode(Constants::MODE_SESSION);
|
||||
else
|
||||
else if (switchToEditMode)
|
||||
ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||
ModeManager::setFocusToCurrentMode();
|
||||
}
|
||||
|
@@ -456,6 +456,11 @@ Tasks QmlProject::projectIssues(const Kit *k) const
|
||||
return result;
|
||||
}
|
||||
|
||||
bool QmlProject::isEditModePreferred() const
|
||||
{
|
||||
return !isQtDesignStudio();
|
||||
}
|
||||
|
||||
Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||
{
|
||||
RestoreResult result = Project::fromMap(map, errorMessage);
|
||||
|
@@ -148,6 +148,8 @@ public:
|
||||
|
||||
static bool isQtDesignStudio();
|
||||
|
||||
bool isEditModePreferred() const override;
|
||||
|
||||
protected:
|
||||
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
||||
|
||||
|
Reference in New Issue
Block a user