diff options
-rw-r--r-- | examples/quick/animation/easing/easing.qml | 4 | ||||
-rw-r--r-- | src/imports/builtins/builtins.qmltypes | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetype.cpp | 7 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetype_p.h | 55 | ||||
-rw-r--r-- | src/quick/qtquick2.cpp | 1 | ||||
-rw-r--r-- | src/quick/util/qquickanimation.cpp | 4 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes.cpp | 7 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes_p.h | 6 | ||||
-rw-r--r-- | tests/auto/quick/qquickanimations/tst_qquickanimations.cpp | 2 | ||||
-rw-r--r-- | tools/qmlplugindump/main.cpp | 14 |
10 files changed, 25 insertions, 76 deletions
diff --git a/examples/quick/animation/easing/easing.qml b/examples/quick/animation/easing/easing.qml index f443486141..44c078b9a2 100644 --- a/examples/quick/animation/easing/easing.qml +++ b/examples/quick/animation/easing/easing.qml @@ -102,7 +102,7 @@ Rectangle { ListElement { name: "Easing.InBounce"; type: Easing.InBounce; ballColor: "DimGray" } ListElement { name: "Easing.InOutBounce"; type: Easing.InOutBounce; ballColor: "SlateGray" } ListElement { name: "Easing.OutInBounce"; type: Easing.OutInBounce; ballColor: "DarkSlateGray" } - ListElement { name: "Easing.Bezier"; type: Easing.Bezier; ballColor: "Chartreuse"; } + ListElement { name: "Easing.BezierSpline"; type: Easing.BezierSpline; ballColor: "Chartreuse"; } } Component { @@ -180,7 +180,7 @@ Rectangle { function getBezierCurve(name) { - if (name === "Easing.Bezier") + if (name === "Easing.BezierSpline") return easingCurve; return []; } diff --git a/src/imports/builtins/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes index 87d599677a..d3897c7b95 100644 --- a/src/imports/builtins/builtins.qmltypes +++ b/src/imports/builtins/builtins.qmltypes @@ -1698,5 +1698,4 @@ Module { } } } - Component { name: "QEasingCurve"; prototype: "QQmlEasingValueType" } } diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp index 254f1015e2..f326e86e64 100644 --- a/src/qml/qml/qqmlvaluetype.cpp +++ b/src/qml/qml/qqmlvaluetype.cpp @@ -214,13 +214,6 @@ const QMetaObject *QQmlValueTypeFactory::metaObjectForMetaType(int type) return factoryImpl()->metaObjectForMetaType(type); } -void QQmlValueTypeFactory::registerValueTypes(const char *uri, int versionMajor, int versionMinor) -{ -#if QT_CONFIG(easingcurve) - qmlRegisterValueTypeEnums<QQmlEasingValueType>(uri, versionMajor, versionMinor, "Easing"); -#endif -} - QQmlValueType::QQmlValueType(int typeId, const QMetaObject *gadgetMetaObject) : metaType(typeId) { diff --git a/src/qml/qml/qqmlvaluetype_p.h b/src/qml/qml/qqmlvaluetype_p.h index 056baf87d0..73e6d37908 100644 --- a/src/qml/qml/qqmlvaluetype_p.h +++ b/src/qml/qml/qqmlvaluetype_p.h @@ -123,8 +123,6 @@ public: static bool isValueType(int idx); static QQmlValueType *valueType(int idx); static const QMetaObject *metaObjectForMetaType(int type); - - static void registerValueTypes(const char *uri, int versionMajor, int versionMinor); }; struct QQmlPointFValueType @@ -265,19 +263,13 @@ public: }; #if QT_CONFIG(easingcurve) -struct QQmlEasingValueType +struct QQmlEasingEnums { - QEasingCurve v; Q_GADGET QML_NAMED_ELEMENT(Easing) QML_ADDED_IN_VERSION(2, 0) QML_UNCREATABLE("Use the Type enum.") - Q_PROPERTY(QQmlEasingValueType::Type type READ type WRITE setType FINAL) - Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude FINAL) - Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot FINAL) - Q_PROPERTY(qreal period READ period WRITE setPeriod FINAL) - Q_PROPERTY(QVariantList bezierCurve READ bezierCurve WRITE setBezierCurve FINAL) public: enum Type { Linear = QEasingCurve::Linear, @@ -303,10 +295,28 @@ public: InOutBounce = QEasingCurve::InOutBounce, OutInBounce = QEasingCurve::OutInBounce, InCurve = QEasingCurve::InCurve, OutCurve = QEasingCurve::OutCurve, SineCurve = QEasingCurve::SineCurve, CosineCurve = QEasingCurve::CosineCurve, - Bezier = QEasingCurve::BezierSpline + BezierSpline = QEasingCurve::BezierSpline, + + Bezier = BezierSpline // Evil! Don't use this! }; Q_ENUM(Type) +}; +struct QQmlEasingValueType : public QQmlEasingEnums +{ + QEasingCurve v; + Q_GADGET + QML_ANONYMOUS + QML_FOREIGN(QEasingCurve) + QML_ADDED_IN_VERSION(2, 0) + + Q_PROPERTY(Type type READ type WRITE setType FINAL) + Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude FINAL) + Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot FINAL) + Q_PROPERTY(qreal period READ period WRITE setPeriod FINAL) + Q_PROPERTY(QVariantList bezierCurve READ bezierCurve WRITE setBezierCurve FINAL) + +public: Type type() const; qreal amplitude() const; qreal overshoot() const; @@ -335,31 +345,6 @@ public: QString name() const; }; -template<typename T> -int qmlRegisterValueTypeEnums(const char *uri, int versionMajor, int versionMinor, const char *qmlName) -{ - QQmlPrivate::RegisterType type = { - 0, - - QMetaType::fromType<T*>(), QMetaType(), 0, nullptr, - - QString(), - - uri, QTypeRevision::fromVersion(versionMajor, versionMinor), qmlName, &T::staticMetaObject, - - nullptr, nullptr, - - 0, 0, 0, - - nullptr, nullptr, - - nullptr, - QTypeRevision::zero() - }; - - return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type); -} - QT_END_NAMESPACE #endif // QQMLVALUETYPE_P_H diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index 4ba7e896db..f380aeed4b 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -189,7 +189,6 @@ void QQmlQtQuick2Module::defineModule() qRegisterMetaType<QKeySequence::StandardKey>(); #endif - QQuickValueTypes::registerValueTypes(); QQuickItemsModule::defineModule(); #if QT_CONFIG(accessibility) diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index e5e25d141b..a65065564b 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -2393,7 +2393,7 @@ void QQuickPropertyAnimation::setTo(const QVariant &t) \li Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration. \li \inlineimage qeasingcurve-outinbounce.png \row - \li \c Easing.Bezier + \li \c Easing.BezierSpline \li Custom easing curve defined by the easing.bezierCurve property. \li \endtable @@ -2408,7 +2408,7 @@ void QQuickPropertyAnimation::setTo(const QVariant &t) \c easing.period is only applicable if easing.type is: \c Easing.InElastic, \c Easing.OutElastic, \c Easing.InOutElastic or \c Easing.OutInElastic. - \c easing.bezierCurve is only applicable if easing.type is: \c Easing.Bezier. This property is a list<real> containing + \c easing.bezierCurve is only applicable if easing.type is: \c Easing.BezierSpline. This property is a list<real> containing groups of three points defining a curve from 0,0 to 1,1 - control1, control2, end point: [cx1, cy1, cx2, cy2, endx, endy, ...]. The last point must be 1,1. diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp index d836946214..8fc108de8c 100644 --- a/src/quick/util/qquickvaluetypes.cpp +++ b/src/quick/util/qquickvaluetypes.cpp @@ -46,13 +46,6 @@ QT_BEGIN_NAMESPACE -namespace QQuickValueTypes { - void registerValueTypes() - { - QQmlValueTypeFactory::registerValueTypes("QtQuick", 2, 0); - } -} - QString QQuickColorValueType::toString() const { return v.name(v.alpha() != 255 ? QColor::HexArgb : QColor::HexRgb); diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index a94f4ac6a7..8859e12322 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -66,12 +66,6 @@ QT_BEGIN_NAMESPACE -namespace QQuickValueTypes { - -void registerValueTypes(); - -} - class QQuickColorValueType { QColor v; diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index b4eb33eb7a..8580a2dc1b 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -1234,7 +1234,7 @@ void tst_qquickanimations::easingProperties() { QQmlEngine engine; - QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"Bezier\"; easing.bezierCurve: [0.5, 0.2, 0.13, 0.65, 1.0, 1.0] }"; + QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"BezierSpline\"; easing.bezierCurve: [0.5, 0.2, 0.13, 0.65, 1.0, 1.0] }"; QQmlComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QScopedPointer<QObject> obj(animationComponent.create()); diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 3efa4dc605..0aa163707c 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -642,14 +642,6 @@ public: qml->writeEndObject(); } - void writeEasingCurve() - { - qml->writeStartObject(QLatin1String("Component")); - qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("QEasingCurve"))); - qml->writeScriptBinding(QLatin1String("prototype"), enquote(QLatin1String("QQmlEasingValueType"))); - qml->writeEndObject(); - } - private: /* Removes pointer and list annotations from a type name, returning @@ -1337,7 +1329,6 @@ int main(int argc, char *argv[]) // setup static rewrites of type names cppToId.insert("QString", "string"); - cppToId.insert("QQmlEasingValueType::Type", "Type"); // start dumping data QByteArray bytes; @@ -1381,11 +1372,6 @@ int main(int argc, char *argv[]) for (; iter != compositeTypes.constEnd(); ++iter) dumper.dumpComposite(&engine, iter.value(), info); - // define QEasingCurve as an extension of QQmlEasingValueType, this way - // properties using the QEasingCurve type get useful type information. - if (pluginImportUri.isEmpty()) - dumper.writeEasingCurve(); - // Insert merge file. qml.write(mergeComponents); |