QmlDesigner: Make kit settings button a toggle

Task-number: QDS-10258
Change-Id: If680778b6cc1f5795887ac9da69f35ae9858308c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
Brook Cronin
2023-10-30 16:22:57 +01:00
committed by Thomas Hartmann
parent 4d1a210060
commit 0899c540be
3 changed files with 17 additions and 2 deletions

View File

@@ -34,8 +34,11 @@ Item {
id: settingButton id: settingButton
style: StudioTheme.Values.statusbarButtonStyle style: StudioTheme.Values.statusbarButtonStyle
buttonIcon: StudioTheme.Constants.settings_medium buttonIcon: StudioTheme.Constants.settings_medium
onClicked: backend.triggerProjectSettings() checkable: true
enabled: backend.isInDesignMode || (backend.isInEditMode && backend.projectOpened) checkedInverted: true
checked: backend.isInSessionMode
onClicked: settingButton.checked ? backend.triggerProjectSettings() : backend.triggerModeChange()
enabled: backend.projectOpened
tooltip: qsTr("Set runtime configuration for the project.") tooltip: qsTr("Set runtime configuration for the project.")
} }

View File

@@ -343,6 +343,7 @@ ToolBarBackend::ToolBarBackend(QObject *parent)
connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this]() { connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this]() {
emit isInDesignModeChanged(); emit isInDesignModeChanged();
emit isInEditModeChanged(); emit isInEditModeChanged();
emit isInSessionModeChanged();
emit isDesignModeEnabledChanged(); emit isDesignModeEnabledChanged();
}); });
@@ -634,6 +635,14 @@ bool ToolBarBackend::isInEditMode() const
return Core::ModeManager::currentModeId() == Core::Constants::MODE_EDIT; 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 bool ToolBarBackend::isDesignModeEnabled() const
{ {
if (Core::DesignMode::instance()) if (Core::DesignMode::instance())

View File

@@ -87,6 +87,7 @@ class ToolBarBackend : public QObject
Q_PROPERTY(QStringList styles READ styles CONSTANT) Q_PROPERTY(QStringList styles READ styles CONSTANT)
Q_PROPERTY(bool isInDesignMode READ isInDesignMode NOTIFY isInDesignModeChanged) Q_PROPERTY(bool isInDesignMode READ isInDesignMode NOTIFY isInDesignModeChanged)
Q_PROPERTY(bool isInEditMode READ isInEditMode NOTIFY isInEditModeChanged) 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(bool isDesignModeEnabled READ isDesignModeEnabled NOTIFY isDesignModeEnabledChanged)
Q_PROPERTY(int currentStyle READ currentStyle NOTIFY currentStyleChanged) Q_PROPERTY(int currentStyle READ currentStyle NOTIFY currentStyleChanged)
Q_PROPERTY(QStringList kits READ kits NOTIFY kitsChanged) Q_PROPERTY(QStringList kits READ kits NOTIFY kitsChanged)
@@ -128,6 +129,7 @@ public:
bool isInDesignMode() const; bool isInDesignMode() const;
bool isInEditMode() const; bool isInEditMode() const;
bool isInSessionMode() const;
bool isDesignModeEnabled() const; bool isDesignModeEnabled() const;
int currentStyle() const; int currentStyle() const;
@@ -149,6 +151,7 @@ signals:
void lockWorkspaceChanged(); void lockWorkspaceChanged();
void isInDesignModeChanged(); void isInDesignModeChanged();
void isInEditModeChanged(); void isInEditModeChanged();
void isInSessionModeChanged();
void isDesignModeEnabledChanged(); void isDesignModeEnabledChanged();
void currentStyleChanged(); void currentStyleChanged();
void kitsChanged(); void kitsChanged();