diff options
Diffstat (limited to 'src/plugins/qmldesigner/components')
4 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp index fde3f3ef14..75cf14f7ef 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp @@ -40,6 +40,7 @@ PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) : m_backendValues(0), m_majorVersion(-1), m_minorVersion(-1), + m_majorQtQuickVersion(-1), m_qmlComponent(0), m_qmlContext(0) { @@ -52,6 +53,11 @@ int PropertyEditorContextObject::majorVersion() const } +int PropertyEditorContextObject::majorQtQuickVersion() const +{ + return m_majorQtQuickVersion; +} + void PropertyEditorContextObject::setMajorVersion(int majorVersion) { if (m_majorVersion == majorVersion) @@ -62,6 +68,17 @@ void PropertyEditorContextObject::setMajorVersion(int majorVersion) emit majorVersionChanged(); } +void PropertyEditorContextObject::setMajorQtQuickVersion(int majorVersion) +{ + if (m_majorQtQuickVersion == majorVersion) + return; + + m_majorQtQuickVersion = majorVersion; + + emit majorQtQuickVersionChanged(); + +} + int PropertyEditorContextObject::minorVersion() const { return m_minorVersion; diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h index 0c5e4a5690..22ec4d44f9 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.h @@ -53,6 +53,7 @@ class PropertyEditorContextObject : public QObject Q_PROPERTY(int majorVersion READ majorVersion WRITE setMajorVersion NOTIFY majorVersionChanged) Q_PROPERTY(int minorVersion READ minorVersion WRITE setMinorVersion NOTIFY minorVersionChanged) + Q_PROPERTY(int majorQtQuickVersion READ majorQtQuickVersion WRITE setMajorQtQuickVersion NOTIFY majorQtQuickVersionChanged) Q_PROPERTY(QQmlPropertyMap* backendValues READ backendValues WRITE setBackendValues NOTIFY backendValuesChanged) @@ -74,7 +75,9 @@ public: Q_INVOKABLE QString convertColorToString(const QColor &color) { return color.name(); } int majorVersion() const; + int majorQtQuickVersion() const; void setMajorVersion(int majorVersion); + void setMajorQtQuickVersion(int majorVersion); int minorVersion() const; void setMinorVersion(int minorVersion); @@ -91,6 +94,7 @@ signals: void backendValuesChanged(); void majorVersionChanged(); void minorVersionChanged(); + void majorQtQuickVersionChanged(); void specificQmlComponentChanged(); public slots: @@ -124,6 +128,7 @@ private: int m_majorVersion; int m_minorVersion; + int m_majorQtQuickVersion; QQmlComponent *m_qmlComponent; QQmlContext *m_qmlContext; }; diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 25cdc1cd69..12f74c5218 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -290,8 +290,10 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q } else { contextObject()->setMajorVersion(-1); contextObject()->setMinorVersion(-1); + contextObject()->setMajorQtQuickVersion(-1); } + contextObject()->setMajorQtQuickVersion(qmlObjectNode.view()->majorQtQuickVersion()); } else { qWarning() << "PropertyEditor: invalid node for setup"; } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index f209cf8b23..126be7ad71 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -240,6 +240,9 @@ void PropertyEditorView::changeExpression(const QString &propertyName) if (m_locked) return; + if (!m_selectedNode.isValid()) + return; + RewriterTransaction transaction = beginRewriterTransaction(QByteArrayLiteral("PropertyEditorView::changeExpression")); try { |