diff --git a/share/qtcreator/qmldesigner/statusbar/Main.qml b/share/qtcreator/qmldesigner/statusbar/Main.qml index 16b687abc00..9569aced92c 100644 --- a/share/qtcreator/qmldesigner/statusbar/Main.qml +++ b/share/qtcreator/qmldesigner/statusbar/Main.qml @@ -34,8 +34,11 @@ Item { id: settingButton style: StudioTheme.Values.statusbarButtonStyle buttonIcon: StudioTheme.Constants.settings_medium - onClicked: backend.triggerProjectSettings() - enabled: backend.isInDesignMode || (backend.isInEditMode && backend.projectOpened) + checkable: true + checkedInverted: true + checked: backend.isInSessionMode + onClicked: settingButton.checked ? backend.triggerProjectSettings() : backend.triggerModeChange() + enabled: backend.projectOpened tooltip: qsTr("Set runtime configuration for the project.") } diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp index 4ef8cf311c4..98cd50150ee 100644 --- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp +++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp @@ -343,6 +343,7 @@ ToolBarBackend::ToolBarBackend(QObject *parent) connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this]() { emit isInDesignModeChanged(); emit isInEditModeChanged(); + emit isInSessionModeChanged(); emit isDesignModeEnabledChanged(); }); @@ -634,6 +635,14 @@ bool ToolBarBackend::isInEditMode() const return Core::ModeManager::currentModeId() == Core::Constants::MODE_EDIT; } +bool ToolBarBackend::isInSessionMode() const +{ + if (!Core::ModeManager::instance()) + return false; + + return Core::ModeManager::currentModeId() == ProjectExplorer::Constants::MODE_SESSION; +} + bool ToolBarBackend::isDesignModeEnabled() const { if (Core::DesignMode::instance()) diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h index 66572515fcb..52aa69a4db8 100644 --- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h +++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h @@ -87,6 +87,7 @@ class ToolBarBackend : public QObject Q_PROPERTY(QStringList styles READ styles CONSTANT) Q_PROPERTY(bool isInDesignMode READ isInDesignMode NOTIFY isInDesignModeChanged) Q_PROPERTY(bool isInEditMode READ isInEditMode NOTIFY isInEditModeChanged) + Q_PROPERTY(bool isInSessionMode READ isInSessionMode NOTIFY isInSessionModeChanged) Q_PROPERTY(bool isDesignModeEnabled READ isDesignModeEnabled NOTIFY isDesignModeEnabledChanged) Q_PROPERTY(int currentStyle READ currentStyle NOTIFY currentStyleChanged) Q_PROPERTY(QStringList kits READ kits NOTIFY kitsChanged) @@ -128,6 +129,7 @@ public: bool isInDesignMode() const; bool isInEditMode() const; + bool isInSessionMode() const; bool isDesignModeEnabled() const; int currentStyle() const; @@ -149,6 +151,7 @@ signals: void lockWorkspaceChanged(); void isInDesignModeChanged(); void isInEditModeChanged(); + void isInSessionModeChanged(); void isDesignModeEnabledChanged(); void currentStyleChanged(); void kitsChanged();