Commit d7d4c982 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.metaInfo: support for QEasingCurve

parent ab3442ea
......@@ -68,6 +68,7 @@ public:
QString scopeAndName(const QString &combiner = QString("::")) const;
QList<QString> elementNames() const;
int elementValue(const QString &enumeratorName) const;
QString valueToString(int value) const;
private:
void setScope(const QString &scope);
......
......@@ -118,6 +118,11 @@ int EnumeratorMetaInfo::elementValue(const QString &enumeratorName) const
return m_data->elements.value(unscoped, -1);
}
QString EnumeratorMetaInfo::valueToString(int value) const
{
return m_data->elements.key(value);
}
void EnumeratorMetaInfo::setScope(const QString &scope)
{
Q_ASSERT(!scope.isEmpty());
......
......@@ -127,6 +127,55 @@
<element name="NonModal" value="0" />
<element name="ApplicationModal" value="2" />
</enumerator>
<enumerator name="Type" scope="QEasingCurve">
<element name="Linear" value="0" />
<element name="InQuad" value="1" />
<element name="OutQuad" value="2" />
<element name="InOutQuad" value="3" />
<element name="OutInQuad" value="4" />
<element name="InCubic" value="5" />
<element name="OutCubic" value="6" />
<element name="InOutCubic" value="7" />
<element name="OutInCubic" value="8" />
<element name="InQuart" value="9" />
<element name="OutQuart" value="10" />
<element name="InOutQuart" value="11" />
<element name="OutInQuart" value="12" />
<element name="InQuint" value="13" />
<element name="OutQuint" value="14" />
<element name="InOutQuint" value="15" />
<element name="OutInQuint" value="16" />
<element name="InSine" value="17" />
<element name="OutSine" value="18" />
<element name="InOutSine" value="19" />
<element name="OutInSine" value="20" />
<element name="InExpo" value="21" />
<element name="OutExpo" value="22" />
<element name="InOutExpo" value="23" />
<element name="OutInExpo" value="24" />
<element name="InCirc" value="25" />
<element name="OutCirc" value="26" />
<element name="InOutCirc" value="27" />
<element name="OutInCirc" value="28" />
<element name="InElastic" value="29" />
<element name="OutElastic" value="30" />
<element name="InOutElastic" value="31" />
<element name="OutInElastic" value="32" />
<element name="InBack" value="33" />
<element name="OutBack" value="34" />
<element name="InOutBack" value="35" />
<element name="OutInBack" value="36" />
<element name="InBounce" value="37" />
<element name="OutBounce" value="38" />
<element name="InOutBounce" value="39" />
<element name="OutInBounce" value="40" />
<element name="InCurve" value="41" />
<element name="OutCurve" value="42" />
<element name="SineCurve" value="43" />
<element name="CosineCurve" value="44" />
<element name="Custom" value="45" />
<element name="NCurveTypes" value="46" />
</enumerator>
<flag name="Alignment" scope="Qt">
<element name="AlignLeft" value="1" />
<element name="AlignTrailing" value="2" />
......
......@@ -115,8 +115,8 @@ void MetaInfoPrivate::initialize()
parseQmlTypes();
parseNonQmlTypes();
parseValueTypes();
parseXmlFiles();
parseValueTypes();
m_isInitialized = true;
}
......@@ -155,9 +155,9 @@ void MetaInfoPrivate::parseProperties(NodeMetaInfo &nodeMetaInfo, const QMetaObj
propertyInfo.setFlagType(qProperty.isFlagType());
if (propertyInfo.isEnumType()) {
EnumeratorMetaInfo enumerator;
QMetaEnum qEnumerator = qProperty.enumerator();
EnumeratorMetaInfo enumerator = m_q->addEnumerator(qEnumerator.scope(), qEnumerator.name());
enumerator.setValid(qEnumerator.isValid());
enumerator.setIsFlagType(qEnumerator.isFlag());
enumerator.setScope(qEnumerator.scope());
......@@ -168,6 +168,7 @@ void MetaInfoPrivate::parseProperties(NodeMetaInfo &nodeMetaInfo, const QMetaObj
}
propertyInfo.setEnumerator(enumerator);
}
nodeMetaInfo.addProperty(propertyInfo);
......@@ -240,7 +241,8 @@ void MetaInfoPrivate::parseValueTypes()
<< "QRectF"
<< "QSize"
<< "QSizeF"
<< "QVector3D";
<< "QVector3D"
<< "QEasingCurve";
foreach (const QString &type, valueTypes) {
NodeMetaInfo nodeMetaInfo(*m_q);
......@@ -268,6 +270,12 @@ void MetaInfoPrivate::parseValueTypes()
propertyInfo.setType("int");
} else if (type == ("QRect")) {
propertyInfo.setType("int");
} else if (type == ("QEasingCurve")) {
if (propertyName == "type") {
propertyInfo.setEnumType("true");
propertyInfo.setType("QEasingCurve::Type");
propertyInfo.setEnumerator(m_q->enumerator("QEasingCurve::Type"));
}
}
propertyInfo.setValid(true);
propertyInfo.setReadable(true);
......
......@@ -230,7 +230,7 @@ QmlObjectNode AbstractProperty::parentQmlObjectNode() const
*/
PropertyMetaInfo AbstractProperty::metaInfo() const
{
return ModelNode(m_internalNode, m_model.data(), view()).metaInfo().property(m_propertyName);
return ModelNode(m_internalNode, m_model.data(), view()).metaInfo().property(m_propertyName, true);
}
/*!
......
......@@ -38,6 +38,7 @@
#include <QSize>
#include <QSizeF>
#include <QVector3D>
#include <QEasingCurve>
#include <QMetaProperty>
namespace QmlDesigner {
......@@ -114,6 +115,8 @@ VariantParser VariantParser::create(const QString &type)
return VariantParser(QVariant(QRectF()));
if (type == "QVector3D")
return VariantParser(QVariant(QVector3D()));
if (type == "QEasingCurve")
return VariantParser(QVariant(QEasingCurve()));
return VariantParser(QVariant());
}
......@@ -135,7 +138,9 @@ void VariantParser::init(const QString &type)
if (type == "QRectF")
m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::RectF);
if (type == "QVector3D")
m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::Vector3D);
m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::Vector3D);
if (type == "QEasingCurve")
m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::EasingCurve);
}
bool VariantParser::isValid()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment