summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp9
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h6
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp5
3 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
index 0bf0503888..8be49060e6 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
@@ -347,6 +347,15 @@ void PropertyEditorContextObject::setStateName(const QString &newStateName)
emit stateNameChanged();
}
+void PropertyEditorContextObject::setAllStateNames(const QStringList &allStates)
+{
+ if (allStates == m_allStateNames)
+ return;
+
+ m_allStateNames = allStates;
+ emit allStateNamesChanged();
+}
+
void PropertyEditorContextObject::setIsBaseState(bool newIsBaseState)
{
if (newIsBaseState == m_isBaseState)
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
index 4b74f7331b..9e3309ee35 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h
@@ -46,6 +46,7 @@ class PropertyEditorContextObject : public QObject
Q_PROPERTY(QString specificQmlData READ specificQmlData WRITE setSpecificQmlData NOTIFY specificQmlDataChanged)
Q_PROPERTY(QString stateName READ stateName WRITE setStateName NOTIFY stateNameChanged)
+ Q_PROPERTY(QStringList allStateNames READ allStateNames WRITE setAllStateNames NOTIFY allStateNamesChanged)
Q_PROPERTY(bool isBaseState READ isBaseState WRITE setIsBaseState NOTIFY isBaseStateChanged)
Q_PROPERTY(bool selectionChanged READ selectionChanged WRITE setSelectionChanged NOTIFY selectionChangedChanged)
@@ -70,6 +71,7 @@ public:
QUrl specificsUrl() const {return m_specificsUrl; }
QString specificQmlData() const {return m_specificQmlData; }
QString stateName() const {return m_stateName; }
+ QStringList allStateNames() const { return m_allStateNames; }
bool isBaseState() const { return m_isBaseState; }
bool selectionChanged() const { return m_selectionChanged; }
@@ -114,6 +116,7 @@ signals:
void specificsUrlChanged();
void specificQmlDataChanged();
void stateNameChanged();
+ void allStateNamesChanged();
void isBaseStateChanged();
void selectionChangedChanged();
void backendValuesChanged();
@@ -134,6 +137,8 @@ public slots:
void setStateName(const QString &newStateName);
+ void setAllStateNames(const QStringList &allStates);
+
void setIsBaseState(bool newIsBaseState);
void setSelectionChanged(bool newSelectionChanged);
@@ -151,6 +156,7 @@ private:
QString m_specificQmlData;
QString m_stateName;
+ QStringList m_allStateNames;
bool m_isBaseState;
bool m_selectionChanged;
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
index 56202a2596..d9a685c703 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
@@ -394,8 +394,13 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q
contextObject()->setStateName(stateName);
if (!qmlObjectNode.isValid())
return;
+
context()->setContextProperty(QLatin1String("propertyCount"), QVariant(qmlObjectNode.modelNode().properties().count()));
+ QStringList stateNames = qmlObjectNode.allStateNames();
+ stateNames.prepend("base state");
+ contextObject()->setAllStateNames(stateNames);
+
contextObject()->setIsBaseState(qmlObjectNode.isInBaseState());
contextObject()->setHasAliasExport(qmlObjectNode.isAliasExported());