From a8e74a17388408a992c86afa5afad0b592afb674 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 29 Sep 2022 12:59:07 +0200 Subject: [PATCH] QmlDesigner: Use new auxiliary properties Adapt cf9b36a6c774eee851cdffbdd821a91587bae1f5 to master. Task-number: QDS-7732 Change-Id: Ifcf57aeb540fd970a29614d6381fb235e6970ab7 Reviewed-by: Marco Bubke --- .../stateseditornew/propertychangesmodel.cpp | 15 +++++++++++++++ .../stateseditornew/propertychangesmodel.h | 3 +++ .../components/stateseditornew/propertymodel.cpp | 16 ++++++++++++++++ .../components/stateseditornew/propertymodel.h | 3 +++ 4 files changed, 37 insertions(+) diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp index a2f022c1194..bbe32f3f902 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp @@ -138,6 +138,21 @@ int PropertyChangesModel::count() const return rowCount(); } +namespace { +constexpr AuxiliaryDataKeyDefaultValue propertyChangesVisibleProperty{AuxiliaryDataType::Temporary, + "propertyChangesVisible", + false}; +} +void PropertyChangesModel::setPropertyChangesVisible(bool value) +{ + m_modelNode.setAuxiliaryData(propertyChangesVisibleProperty, value); +} + +bool PropertyChangesModel::propertyChangesVisible() const +{ + return m_modelNode.auxiliaryDataWithDefault(propertyChangesVisibleProperty).toBool(); +} + void PropertyChangesModel::registerDeclarativeType() { qmlRegisterType("HelperWidgets", 2, 0, "PropertyChangesModel"); diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h index 622a1d29467..6cdfcc105c4 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h +++ b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h @@ -62,6 +62,9 @@ public: void reset(); int count() const; + Q_INVOKABLE void setPropertyChangesVisible(bool value); + Q_INVOKABLE bool propertyChangesVisible() const; + static void registerDeclarativeType(); signals: diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp index 71a76d93160..64e267fcce6 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp @@ -149,6 +149,22 @@ void PropertyModel::removeProperty(const QString &name) m_modelNode.removeProperty(name.toUtf8()); } +namespace { +constexpr AuxiliaryDataKeyDefaultValue expandedProperty{AuxiliaryDataType::Temporary, + "propertyModelExpanded", + false}; +} + +void PropertyModel::setExpanded(bool value) +{ + m_modelNode.setAuxiliaryData(expandedProperty, value); +} + +bool PropertyModel::expanded() const +{ + return m_modelNode.auxiliaryDataWithDefault(expandedProperty).toBool(); +} + void PropertyModel::registerDeclarativeType() { qmlRegisterType("HelperWidgets", 2, 0, "PropertyModel"); diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h index 26c92cb7634..b6f695cd165 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h +++ b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h @@ -55,6 +55,9 @@ public: Q_INVOKABLE void setRestoreEntryValues(bool value); Q_INVOKABLE void removeProperty(const QString &name); + Q_INVOKABLE void setExpanded(bool value); + Q_INVOKABLE bool expanded() const; + static void registerDeclarativeType(); signals: