forked from qt-creator/qt-creator
QmlDesigner.PropertyEditor: expose version to QML
This allows property sheets to take the version number into account. Task-number: QTCREATORBUG-8681 Change-Id: I22a99fd30ba42572f070f67a56bb24fd1a04275f Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
@@ -283,6 +283,17 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS
|
|||||||
m_contextObject->setSelectionChanged(false);
|
m_contextObject->setSelectionChanged(false);
|
||||||
|
|
||||||
m_contextObject->setSelectionChanged(false);
|
m_contextObject->setSelectionChanged(false);
|
||||||
|
|
||||||
|
NodeMetaInfo metaInfo = fxObjectNode.modelNode().metaInfo();
|
||||||
|
|
||||||
|
if (metaInfo.isValid()) {
|
||||||
|
m_contextObject->setMajorVersion(metaInfo.majorVersion());
|
||||||
|
m_contextObject->setMinorVersion(metaInfo.minorVersion());
|
||||||
|
} else {
|
||||||
|
m_contextObject->setMajorVersion(-1);
|
||||||
|
m_contextObject->setMinorVersion(-1);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "PropertyEditor: invalid node for setup";
|
qWarning() << "PropertyEditor: invalid node for setup";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,51 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "propertyeditorcontextobject.h"
|
#include "propertyeditorcontextobject.h"
|
||||||
|
#include <nodemetainfo.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) :
|
PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) :
|
||||||
QObject(parent), m_isBaseState(false), m_selectionChanged(false), m_backendValues(0)
|
QObject(parent),
|
||||||
|
m_isBaseState(false),
|
||||||
|
m_selectionChanged(false),
|
||||||
|
m_backendValues(0),
|
||||||
|
m_majorVersion(-1),
|
||||||
|
m_minorVersion(-1)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PropertyEditorContextObject::majorVersion() const
|
||||||
|
{
|
||||||
|
return m_majorVersion;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyEditorContextObject::setMajorVersion(int majorVersion)
|
||||||
|
{
|
||||||
|
if (m_majorVersion == majorVersion)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_majorVersion = majorVersion;
|
||||||
|
|
||||||
|
emit majorVersionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
int PropertyEditorContextObject::minorVersion() const
|
||||||
|
{
|
||||||
|
return m_minorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyEditorContextObject::setMinorVersion(int minorVersion)
|
||||||
|
{
|
||||||
|
if (m_minorVersion == minorVersion)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_minorVersion = minorVersion;
|
||||||
|
|
||||||
|
emit minorVersionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
} //QmlDesigner
|
} //QmlDesigner
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class PropertyEditorContextObject : public QObject
|
|||||||
Q_PROPERTY(bool isBaseState READ isBaseState WRITE setIsBaseState NOTIFY isBaseStateChanged)
|
Q_PROPERTY(bool isBaseState READ isBaseState WRITE setIsBaseState NOTIFY isBaseStateChanged)
|
||||||
Q_PROPERTY(bool selectionChanged READ selectionChanged WRITE setSelectionChanged NOTIFY selectionChangedChanged)
|
Q_PROPERTY(bool selectionChanged READ selectionChanged WRITE setSelectionChanged NOTIFY selectionChangedChanged)
|
||||||
|
|
||||||
|
Q_PROPERTY(int majorVersion READ majorVersion WRITE setMajorVersion NOTIFY majorVersionChanged)
|
||||||
|
Q_PROPERTY(int minorVersion READ minorVersion WRITE setMinorVersion NOTIFY minorVersionChanged)
|
||||||
|
|
||||||
Q_PROPERTY(QDeclarativePropertyMap* backendValues READ backendValues WRITE setBackendValues NOTIFY backendValuesChanged)
|
Q_PROPERTY(QDeclarativePropertyMap* backendValues READ backendValues WRITE setBackendValues NOTIFY backendValuesChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -67,6 +70,11 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE QString convertColorToString(const QColor &color) { return color.name(); }
|
Q_INVOKABLE QString convertColorToString(const QColor &color) { return color.name(); }
|
||||||
|
|
||||||
|
int majorVersion() const;
|
||||||
|
void setMajorVersion(int majorVersion);
|
||||||
|
int minorVersion() const;
|
||||||
|
void setMinorVersion(int minorVersion);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void globalBaseUrlChanged();
|
void globalBaseUrlChanged();
|
||||||
void specificsUrlChanged();
|
void specificsUrlChanged();
|
||||||
@@ -75,6 +83,8 @@ signals:
|
|||||||
void isBaseStateChanged();
|
void isBaseStateChanged();
|
||||||
void selectionChangedChanged();
|
void selectionChangedChanged();
|
||||||
void backendValuesChanged();
|
void backendValuesChanged();
|
||||||
|
void majorVersionChanged();
|
||||||
|
void minorVersionChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setGlobalBaseUrl(const QUrl &newBaseUrl)
|
void setGlobalBaseUrl(const QUrl &newBaseUrl)
|
||||||
@@ -157,6 +167,8 @@ private:
|
|||||||
|
|
||||||
QDeclarativePropertyMap* m_backendValues;
|
QDeclarativePropertyMap* m_backendValues;
|
||||||
|
|
||||||
|
int m_majorVersion;
|
||||||
|
int m_minorVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //QmlDesigner {
|
} //QmlDesigner {
|
||||||
|
|||||||
Reference in New Issue
Block a user