aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/qtcreator/qmldesigner/newstateseditor/Main.qml2
-rw-r--r--share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml21
-rw-r--r--src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp20
-rw-r--r--src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h6
-rw-r--r--src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp20
-rw-r--r--src/plugins/qmldesigner/components/stateseditornew/propertymodel.h5
6 files changed, 68 insertions, 6 deletions
diff --git a/share/qtcreator/qmldesigner/newstateseditor/Main.qml b/share/qtcreator/qmldesigner/newstateseditor/Main.qml
index 4431252ecc..21385de257 100644
--- a/share/qtcreator/qmldesigner/newstateseditor/Main.qml
+++ b/share/qtcreator/qmldesigner/newstateseditor/Main.qml
@@ -659,7 +659,7 @@ Rectangle {
required property var extendString
function setPropertyChangesVisible(value) {
- stateThumbnail.propertyChangesVisible = value
+ stateThumbnail.setPropertyChangesVisible(value)
}
width: Constants.thumbnailSize
diff --git a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
index e154bb4d39..6d4a84e44c 100644
--- a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
+++ b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
@@ -46,7 +46,7 @@ Item {
property alias menuChecked: menuButton.checked
property bool baseState: false
property bool isTiny: false
- property bool propertyChangesVisible: false
+ property bool propertyChangesVisible: propertyChangesModel.propertyChangesVisible
property bool isChecked: false
property bool hasExtend: false
@@ -80,6 +80,11 @@ Item {
return statesEditorModel.hasAnnotation(root.internalNodeId)
}
+ function setPropertyChangesVisible(value) {
+ root.propertyChangesVisible = value
+ propertyChangesModel.setPropertyChangesVisible(value)
+ }
+
onIsTinyChanged: {
if (root.isTiny) {
buttonGrid.rows = 2
@@ -315,6 +320,9 @@ Item {
Column {
id: column
+ property bool hoverEnabled: false
+ onPositioningComplete: column.hoverEnabled = true
+
// Grid sizes
property int gridSpacing: 20
property int gridRowSpacing: 5
@@ -354,7 +362,7 @@ Item {
Item {
id: section
property int animationDuration: 120
- property bool expanded: false
+ property bool expanded: propertyModel.expanded
clip: true
width: stateBackground.innerWidth
@@ -416,6 +424,7 @@ Item {
anchors.fill: parent
onClicked: {
section.expanded = !section.expanded
+ propertyModel.setExpanded(section.expanded)
if (!section.expanded)
section.forceActiveFocus()
root.focusSignal()
@@ -519,6 +528,8 @@ Item {
Repeater {
model: propertyModel
+ onModelChanged: column.hoverEnabled = false
+
delegate: ItemDelegate {
id: propertyDelegate
@@ -528,7 +539,7 @@ Item {
width: stateBackground.innerWidth - 2 * column.gridPadding
height: 26
- hoverEnabled: true
+ hoverEnabled: column.hoverEnabled
onClicked: root.focusSignal()
@@ -561,7 +572,7 @@ Item {
MouseArea {
id: propertyDelegateMouseArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: column.hoverEnabled
onClicked: {
root.focusSignal()
propertyModel.removeProperty(
@@ -718,7 +729,7 @@ Item {
onClone: root.clone()
onExtend: root.extend()
onRemove: root.remove()
- onToggle: root.propertyChangesVisible = !root.propertyChangesVisible
+ onToggle: root.setPropertyChangesVisible(!root.propertyChangesVisible)
onResetWhenCondition: statesEditorModel.resetWhenCondition(root.internalNodeId)
onEditAnnotation: {
statesEditorModel.setAnnotation(root.internalNodeId)
diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp
index a2f022c119..85a81537b7 100644
--- a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp
+++ b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp
@@ -123,6 +123,7 @@ void PropertyChangesModel::setModelNodeBackend(const QVariant &modelNodeBackend)
m_view->registerPropertyChangesModel(this);
emit modelNodeBackendChanged();
+ emit propertyChangesVisibleChanged();
}
void PropertyChangesModel::reset()
@@ -138,6 +139,25 @@ int PropertyChangesModel::count() const
return rowCount();
}
+void PropertyChangesModel::setPropertyChangesVisible(bool value)
+{
+ if (!m_modelNode.isValid() || !m_modelNode.view()->isAttached())
+ return;
+
+ if (value)
+ m_modelNode.setAuxiliaryData("propertyChangesVisible@Internal", value);
+ else
+ m_modelNode.removeAuxiliaryData("propertyChangesVisible@Internal");
+}
+
+bool PropertyChangesModel::propertyChangesVisible() const
+{
+ if (!m_modelNode.isValid() || !m_modelNode.view()->isAttached())
+ return false;
+
+ return m_modelNode.hasAuxiliaryData("propertyChangesVisible@Internal");
+}
+
void PropertyChangesModel::registerDeclarativeType()
{
qmlRegisterType<PropertyChangesModel>("HelperWidgets", 2, 0, "PropertyChangesModel");
diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h
index 622a1d2946..b73d4dad69 100644
--- a/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h
+++ b/src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.h
@@ -42,6 +42,8 @@ class PropertyChangesModel : public QAbstractListModel
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend
NOTIFY modelNodeBackendChanged)
+ Q_PROPERTY(bool propertyChangesVisible READ propertyChangesVisible NOTIFY
+ propertyChangesVisibleChanged)
enum {
Target = Qt::DisplayRole,
@@ -62,11 +64,15 @@ public:
void reset();
int count() const;
+ Q_INVOKABLE void setPropertyChangesVisible(bool value);
+ Q_INVOKABLE bool propertyChangesVisible() const;
+
static void registerDeclarativeType();
signals:
void modelNodeBackendChanged();
void countChanged();
+ void propertyChangesVisibleChanged();
private:
QVariant modelNodeBackend() const;
diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp
index ef589465b9..f53ecce3af 100644
--- a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp
+++ b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp
@@ -114,6 +114,7 @@ void PropertyModel::setModelNodeBackend(const QVariant &modelNodeBackend)
setupModel();
emit modelNodeBackendChanged();
+ emit expandedChanged();
}
void PropertyModel::setExplicit(bool value)
@@ -146,6 +147,25 @@ void PropertyModel::removeProperty(const QString &name)
m_modelNode.removeProperty(name.toUtf8());
}
+void PropertyModel::setExpanded(bool value)
+{
+ if (!m_modelNode.isValid() || !m_modelNode.view()->isAttached())
+ return;
+
+ if (value)
+ m_modelNode.setAuxiliaryData("expanded@Internal", value);
+ else
+ m_modelNode.removeAuxiliaryData("expanded@Internal");
+}
+
+bool PropertyModel::expanded() const
+{
+ if (!m_modelNode.isValid() || !m_modelNode.view()->isAttached())
+ return false;
+
+ return m_modelNode.hasAuxiliaryData("expanded@Internal");
+}
+
void PropertyModel::registerDeclarativeType()
{
qmlRegisterType<PropertyModel>("HelperWidgets", 2, 0, "PropertyModel");
diff --git a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h
index 26c92cb763..492b1362c0 100644
--- a/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h
+++ b/src/plugins/qmldesigner/components/stateseditornew/propertymodel.h
@@ -39,6 +39,7 @@ class PropertyModel : public QAbstractListModel
Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend
NOTIFY modelNodeBackendChanged)
+ Q_PROPERTY(bool expanded READ expanded NOTIFY expandedChanged)
enum { Name = Qt::DisplayRole, Value = Qt::UserRole, Type };
@@ -55,10 +56,14 @@ 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:
void modelNodeBackendChanged();
+ void expandedChanged();
private:
QVariant modelNodeBackend() const;