diff options
-rw-r--r-- | doc/src/declarative/globalobject.qdoc | 12 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 20 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine_p.h | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/closestangle.qml | 12 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp | 18 |
5 files changed, 0 insertions, 63 deletions
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 4b1c7d3..9f6be12 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -182,18 +182,6 @@ This function returns a color 50% darker than \c baseColor. See QColor::darker() \image declarative-rect_tint.png Tint is most useful when a subtle change is intended to be conveyed due to some event; you can then use tinting to more effectively tune the visible color. -\section3 Qt.closestAngle(number fromAngle, number toAngle) -This function returns an equivalent angle to toAngle, such that the difference between fromAngle and toAngle is never more than 180 degrees. This is useful when animating angles using a NumberAnimation, which does not know about equivalent angles, when you always want to take the shortest path. - -For example, the following would rotate myItem counterclockwise from 350 degrees to 10 degrees, for a total of 340 degrees of rotation. -\qml -NumberAnimation { target: myItem; property: "rotation"; from: 350; to: 10 } -\endqml - -while the following would rotate myItem clockwise from 350 degrees to 370 degrees (which is visually equivilant to 10 degrees), for a total of 20 degrees of rotation. -\qml -NumberAnimation { target: myItem; property: "rotation"; from: 350; to: Qt.closetAngle(350, 10) } -\endqml \section3 Qt.openUrlExternally(url target) This function attempts to open the specified \c target url in an external application, based on the user's desktop preferences. It will return true if it succeeds, and false otherwise. diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index a32e6c3..72335d4 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -243,7 +243,6 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr qtObject.setProperty(QLatin1String("formatDateTime"),newFunction(QDeclarativeEnginePrivate::formatDateTime, 2)); //misc methods - qtObject.setProperty(QLatin1String("closestAngle"), newFunction(QDeclarativeEnginePrivate::closestAngle, 2)); qtObject.setProperty(QLatin1String("openUrlExternally"),newFunction(QDeclarativeEnginePrivate::desktopOpenUrl, 1)); qtObject.setProperty(QLatin1String("md5"),newFunction(QDeclarativeEnginePrivate::md5, 1)); qtObject.setProperty(QLatin1String("btoa"),newFunction(QDeclarativeEnginePrivate::btoa, 1)); @@ -1237,25 +1236,6 @@ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptE return QScriptValue(); } -QScriptValue QDeclarativeEnginePrivate::closestAngle(QScriptContext *ctxt, QScriptEngine *e) -{ - if(ctxt->argumentCount() < 2) - return e->newVariant(QVariant(0.0)); - qreal a = ctxt->argument(0).toNumber(); - qreal b = ctxt->argument(1).toNumber(); - qreal ret = b; - qreal diff = b-a; - while(diff > 180.0){ - ret -= 360.0; - diff -= 360.0; - } - while(diff < -180.0){ - ret += 360.0; - diff += 360.0; - } - return e->newVariant(QVariant(ret)); -} - QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine) { if(ctxt->argumentCount() != 2) diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index fb63164..0f8b90a 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -318,7 +318,6 @@ public: static QScriptValue darker(QScriptContext*, QScriptEngine*); static QScriptValue tint(QScriptContext*, QScriptEngine*); - static QScriptValue closestAngle(QScriptContext*, QScriptEngine*); static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*); static QScriptValue md5(QScriptContext*, QScriptEngine*); static QScriptValue btoa(QScriptContext*, QScriptEngine*); diff --git a/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml b/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml deleted file mode 100644 index b5f7fc6..0000000 --- a/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml +++ /dev/null @@ -1,12 +0,0 @@ -import Qt 4.6 - -QtObject { - property var testSame: Qt.closestAngle(0,1) - property var testLess: Qt.closestAngle(0,-359) - property var testMore: Qt.closestAngle(0,361) - property var testFail: Qt.closestAngle(0) - property var test5: Qt.closestAngle(0,1,2) - property var test6: Qt.closestAngle(123.45465768,1.11) - property var test7: Qt.closestAngle(-3.1415,1.11) -} - diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index b70011b..debec02 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -66,7 +66,6 @@ private slots: void lighter(); void darker(); void tint(); - void closestAngle(); void openUrlExternally(); void md5(); void createComponent(); @@ -262,23 +261,6 @@ void tst_qdeclarativeqt::tint() delete object; } -void tst_qdeclarativeqt::closestAngle() -{ - QDeclarativeComponent component(&engine, TEST_FILE("closestangle.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<qreal>(object->property("testSame")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testLess")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testMore")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testFail")), 0.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test5")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test6")), 1.11); - QCOMPARE(qvariant_cast<qreal>(object->property("test7")), 1.11); - - delete object; -} - void tst_qdeclarativeqt::openUrlExternally() { QEXPECT_FAIL("", "How do we test this?", Abort); |