From 0d8a94c74a8799b278d32d9cf0c32dee7cd35d11 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 1 Mar 2010 16:45:59 +1000 Subject: Export QDeclarativeWorkerScript and QDeclarativeWorkerListModel and call other usual macros. --- src/declarative/qml/qdeclarativeworkerscript_p.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h index 8ebd2c1..a810801 100644 --- a/src/declarative/qml/qdeclarativeworkerscript_p.h +++ b/src/declarative/qml/qdeclarativeworkerscript_p.h @@ -61,8 +61,12 @@ #include #include +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Declarative) + class QDeclarativeWorkerScript; class QDeclarativeWorkerScriptEnginePrivate; class QDeclarativeWorkerScriptEngine : public QThread @@ -84,7 +88,7 @@ private: QDeclarativeWorkerScriptEnginePrivate *d; }; -class QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus +class Q_DECLARATIVE_EXPORT QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) @@ -115,7 +119,7 @@ private: }; class QDeclarativeWorkerListModelAgent; -class QDeclarativeWorkerListModel : public QListModelInterface +class Q_DECLARATIVE_EXPORT QDeclarativeWorkerListModel : public QListModelInterface { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) @@ -157,4 +161,6 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QDeclarativeWorkerScript); QML_DECLARE_TYPE(QDeclarativeWorkerListModel); +QT_END_HEADER + #endif // QDECLARATIVEWORKERSCRIPT_P_H -- cgit v0.12 From 32cdbb6de84eab0c3619d36f3091e68e93caf3e9 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 1 Mar 2010 19:11:41 +1000 Subject: use ParentAnimation --- examples/declarative/package/Delegate.qml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/examples/declarative/package/Delegate.qml b/examples/declarative/package/Delegate.qml index 4109633..62198d0 100644 --- a/examples/declarative/package/Delegate.qml +++ b/examples/declarative/package/Delegate.qml @@ -2,24 +2,26 @@ import Qt 4.6 //![0] Package { - Text { id: listDelegate; width: 200; height: 25; text: "Empty"; Package.name: "list" } - Text { id: gridDelegate; width: 100; height: 50; text: "Empty"; Package.name: "grid" } + Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' } + Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' } Rectangle { id: wrapper width: 200; height: 25 - color: "lightsteelblue" + color: 'lightsteelblue' + Text { text: display; anchors.centerIn: parent } MouseRegion { anchors.fill: parent onClicked: { - if (wrapper.state == "inList") - wrapper.state = "inGrid"; + if (wrapper.state == 'inList') + wrapper.state = 'inGrid'; else - wrapper.state = "inList"; + wrapper.state = 'inList'; } } - state: "inList" + + state: 'inList' states: [ State { name: 'inList' @@ -27,15 +29,17 @@ Package { }, State { name: 'inGrid' - ParentChange { target: wrapper; parent: gridDelegate } - PropertyChanges { target: wrapper; x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height } + ParentChange { + target: wrapper; parent: gridDelegate + x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height + } } ] + transitions: [ Transition { - SequentialAnimation { - ParentAction { target: wrapper } - NumberAnimation { targets: wrapper; properties: 'x,y,width,height'; duration: 300 } + ParentAnimation { + NumberAnimation { properties: 'x,y,width,height'; duration: 300 } } } ] -- cgit v0.12 From 3e03276736d89e1ab214b50d57bf2ba6f6d560f7 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 1 Mar 2010 11:43:09 +0100 Subject: Introduce optional qdoc_bootstrapped qmake flag This allows building documentation even when cross-compiling. Note that for official documentation, you should always use your host's qdoc3 binary. This qmake option is for testing whether you introduced new qdoc warnings even if you don't have a native build around. --- tools/qdoc3/codeparser.cpp | 1 - tools/qdoc3/command.cpp | 9 +++++++++ tools/qdoc3/config.cpp | 6 +++++- tools/qdoc3/cppcodeparser.cpp | 1 - tools/qdoc3/doc.h | 1 + tools/qdoc3/generator.cpp | 1 - tools/qdoc3/helpprojectwriter.cpp | 1 - tools/qdoc3/jambiapiparser.cpp | 2 -- tools/qdoc3/main.cpp | 17 ++++++++++++++--- tools/qdoc3/node.cpp | 4 ++-- tools/qdoc3/pagegenerator.cpp | 3 +-- tools/qdoc3/qdoc3.pro | 16 ++++++++++++---- tools/qdoc3/tree.cpp | 3 ++- tools/qdoc3/webxmlgenerator.cpp | 4 ++-- tools/qdoc3/webxmlgenerator.h | 5 +++++ 15 files changed, 53 insertions(+), 21 deletions(-) diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 5ae63ac..042378e 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -43,7 +43,6 @@ codeparser.cpp */ -#include #include "codeparser.h" #include "node.h" #include "tree.h" diff --git a/tools/qdoc3/command.cpp b/tools/qdoc3/command.cpp index 76b483c..b78ad07 100644 --- a/tools/qdoc3/command.cpp +++ b/tools/qdoc3/command.cpp @@ -47,6 +47,8 @@ #include "command.h" +#include + QT_BEGIN_NAMESPACE void executeCommand(const Location& location, @@ -69,6 +71,12 @@ void executeCommand(const Location& location, if (space != -1) toolName.truncate(space); +#ifdef QT_BOOTSTRAPPED + int status = system(qPrintable(actualCommand)); + int exitCode = WEXITSTATUS(status); + if (status == -1 || exitCode != EXIT_SUCCESS) + location.fatal(QString("Error executing '$1': $2").arg(toolName).arg(exitCode)); +#else QProcess process; process.start(QLatin1String("sh"), QStringList() << QLatin1String("-c") << actualCommand); @@ -89,6 +97,7 @@ void executeCommand(const Location& location, tr("The tool was invoked like this:\n%1\n" "It emitted these errors:\n%2") .arg(actualCommand).arg(errors)); +#endif } QT_END_NAMESPACE diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index acb1576..3150f28 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -43,7 +43,11 @@ config.cpp */ -#include +#include +#include +#include +#include +#include #include "archiveextractor.h" #include "config.h" diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 021d64a..e144a74 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -43,7 +43,6 @@ cppcodeparser.cpp */ -#include #include #include diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h index e98bb26..3e76456 100644 --- a/tools/qdoc3/doc.h +++ b/tools/qdoc3/doc.h @@ -48,6 +48,7 @@ #include #include +#include #include "location.h" diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 6a8899a..200a0e7 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -42,7 +42,6 @@ /* generator.cpp */ -#include #include #include #include "codemarker.h" diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index 2189e02..71810e4 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include #include #include diff --git a/tools/qdoc3/jambiapiparser.cpp b/tools/qdoc3/jambiapiparser.cpp index 3aba1b0..23f2716 100644 --- a/tools/qdoc3/jambiapiparser.cpp +++ b/tools/qdoc3/jambiapiparser.cpp @@ -43,8 +43,6 @@ jambiapiparser.cpp */ -#include - #include "cppcodeparser.h" #include "jambiapiparser.h" #include "node.h" diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 57823fb..ea843ba 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -44,7 +44,6 @@ */ #include -#include #include #include "apigenerator.h" #include "codemarker.h" @@ -72,6 +71,11 @@ #include "tokenizer.h" #include "tree.h" +#include "qtranslator.h" +#ifndef QT_BOOTSTRAPPED +# include "qcoreapplication.h" +#endif + QT_BEGIN_NAMESPACE /* @@ -151,7 +155,9 @@ static void printVersion() */ static void processQdocconfFile(const QString &fileName) { +#ifndef QT_NO_TRANSLATION QList translators; +#endif /* The Config instance represents the configuration data for qdoc. @@ -207,6 +213,7 @@ static void processQdocconfFile(const QString &fileName) CodeParser::initialize(config); Generator::initialize(config); +#ifndef QT_NO_TRANSLATION /* Load the language translators, if the configuration specifies any. */ @@ -221,6 +228,7 @@ static void processQdocconfFile(const QString &fileName) translators.append(translator); ++fn; } +#endif //QSet outputLanguages = config.getStringSet(CONFIG_OUTPUTLANGUAGES); @@ -351,8 +359,9 @@ static void processQdocconfFile(const QString &fileName) Location::terminate(); QDir::setCurrent(prevCurrentDir); - foreach (QTranslator *translator, translators) - delete translator; +#ifndef QT_NO_TRANSLATION + qDeleteAll(translators); +#endif delete tree; } @@ -362,7 +371,9 @@ int main(int argc, char **argv) { QT_USE_NAMESPACE +#ifndef QT_BOOTSTRAPPED QCoreApplication app(argc, argv); +#endif QString cf = "qsauncompress \1 \2"; PolyArchiveExtractor qsaExtractor(QStringList() << "qsa",cf); cf = "tar -C \2 -xf \1"; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 4ddcfb1..694f499 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -43,7 +43,6 @@ node.cpp */ -#include #include "node.h" QT_BEGIN_NAMESPACE @@ -1161,7 +1160,8 @@ QString FunctionNode::signature(bool values) const */ void FunctionNode::debug() const { - qDebug() << "QML METHOD" << name() << "rt" << rt << "pp" << pp; + qDebug("QML METHOD %s rt %s pp %s", + qPrintable(name()), qPrintable(rt), qPrintable(pp.join(" "))); } /*! diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 2cad9ed..f0f14fe 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -43,7 +43,6 @@ pagegenerator.cpp */ -#include #include #include @@ -212,7 +211,7 @@ void PageGenerator::generateInnerNode(const InnerNode *node, #endif if (fakeNode->subType() == Node::Page) { if (node->count() > 0) - qDebug() << "PAGE" << fakeNode->title() << "HAS CHILDREN"; + qDebug("PAGE %s HAS CHILDREN", qPrintable(fakeNode->title())); } } diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 7705692..e394799 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -4,9 +4,16 @@ DEFINES += QT_NO_CAST_TO_ASCII #DEFINES += QT_USE_FAST_OPERATOR_PLUS #DEFINES += QT_USE_FAST_CONCATENATION -QT = core xml -CONFIG += console -CONFIG -= debug_and_release_target +qdoc_bootstrapped { + include(../../src/tools/bootstrap/bootstrap.pri) + DEFINES -= QT_NO_CAST_FROM_ASCII + DEFINES += QT_NO_TRANSLATION +} else { + QT = core xml + CONFIG += console + CONFIG -= debug_and_release_target +} + !isEmpty(QT_BUILD_TREE):DESTDIR = $$QT_BUILD_TREE/bin #CONFIG += debug build_all:!build_pass { @@ -14,7 +21,8 @@ build_all:!build_pass { CONFIG += release # CONFIG += debug } -mac:CONFIG -= app_bundle + +CONFIG -= app_bundle HEADERS += apigenerator.h \ archiveextractor.h \ atom.h \ diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 6c2502d..922c23e 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -43,7 +43,6 @@ tree.cpp */ -#include #include #include "atom.h" @@ -54,6 +53,8 @@ #include "text.h" #include "tree.h" +#include + QT_BEGIN_NAMESPACE struct InheritanceBound diff --git a/tools/qdoc3/webxmlgenerator.cpp b/tools/qdoc3/webxmlgenerator.cpp index 205bc8c..6020b1b 100644 --- a/tools/qdoc3/webxmlgenerator.cpp +++ b/tools/qdoc3/webxmlgenerator.cpp @@ -43,8 +43,6 @@ webxmlgenerator.cpp */ -#include - #include "codemarker.h" #include "pagegenerator.h" #include "webxmlgenerator.h" @@ -52,6 +50,8 @@ #include "separator.h" #include "tree.h" +#include + QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") diff --git a/tools/qdoc3/webxmlgenerator.h b/tools/qdoc3/webxmlgenerator.h index cadf176..071896a 100644 --- a/tools/qdoc3/webxmlgenerator.h +++ b/tools/qdoc3/webxmlgenerator.h @@ -46,12 +46,17 @@ #ifndef WEBXMLGENERATOR_H #define WEBXMLGENERATOR_H +#include + #include "codemarker.h" #include "config.h" #include "pagegenerator.h" QT_BEGIN_NAMESPACE +class QXmlStreamReader; +class QXmlStreamWriter; + class WebXMLGenerator : public PageGenerator { public: -- cgit v0.12 From 9fe43ff4e313220a1ecb02a990324cb6b768e585 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 25 Feb 2010 16:48:33 +0100 Subject: Fixed coordinate system conversion for gestures. When converting hotspot position (which is in global coordinates) to graphics scene coordinates we should use the viewport because the mapToScene() takes a position in a viewport. Task-number: related to QTBUG-6876 Reviewed-by: Thomas Zander --- src/gui/graphicsview/qgraphicsscene.cpp | 8 +++--- tests/auto/gestures/tst_gestures.cpp | 45 ++++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 365afdd..a72761a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5972,12 +5972,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QList allGestures = event->gestures(); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "Delivering gestures:" << allGestures; + << "Gestures:" << allGestures; QSet startedGestures; - QPoint delta = graphicsView->mapFromGlobal(QPoint()); - QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y()) - * graphicsView->viewportTransform().inverted(); + QPoint delta = viewport->mapFromGlobal(QPoint()); + QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y()) + * graphicsView->viewportTransform().inverted(); foreach (QGesture *gesture, allGestures) { // cache scene coordinates of the hot spot if (gesture->hasHotSpot()) { diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index a2058cd..a1afa0a 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -58,7 +58,7 @@ static QPointF mapToGlobal(const QPointF &pt, QGraphicsItem *item, QGraphicsView *view) { - return view->mapToGlobal(view->mapFromScene(item->mapToScene(pt))); + return view->viewport()->mapToGlobal(view->mapFromScene(item->mapToScene(pt))); } class CustomGesture : public QGesture @@ -353,6 +353,7 @@ private slots: void deleteGestureTargetWidget(); void deleteGestureTargetItem_data(); void deleteGestureTargetItem(); + void viewportCoordinates(); }; tst_Gestures::tst_Gestures() @@ -742,7 +743,6 @@ public: ignoredFinishedGestures.clear(); } -protected: QRectF boundingRect() const { return size; @@ -1771,7 +1771,6 @@ void tst_Gestures::panelStacksBehindParent() void tst_Gestures::deleteGestureTargetWidget() { - } void tst_Gestures::deleteGestureTargetItem_data() @@ -1857,5 +1856,45 @@ void tst_Gestures::deleteGestureTargetItem() sendCustomGesture(&event, item1, &scene); } +class GraphicsView : public QGraphicsView +{ +public: + GraphicsView(QGraphicsScene *scene, QWidget *parent = 0) + : QGraphicsView(scene, parent) + { + } + + using QGraphicsView::setViewportMargins; +}; + +// just making sure that even if the graphicsview has margins hotspot still +// works properly. It should use viewport for converting global coordinates to +// scene coordinates. +void tst_Gestures::viewportCoordinates() +{ + QGraphicsScene scene; + GraphicsView view(&scene); + view.setViewportMargins(10,20,15,25); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item1 = new GestureItem("item1"); + item1->grabGesture(CustomGesture::GestureType); + item1->size = QRectF(0, 0, 3, 3); + item1->setZValue(2); + scene.addItem(item1); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + + CustomEvent event; + event.hotSpot = mapToGlobal(item1->boundingRect().center(), item1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item1, &scene); + QVERIFY(item1->gestureEventsReceived != 0); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From 82e224ee5e5388e8b5be186db6a60339e7b8fba3 Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 1 Mar 2010 14:13:45 +0100 Subject: Fix compilation with namespace. --- src/corelib/tools/qsimd_p.h | 4 ++-- src/declarative/qml/qdeclarativebinding_p.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 44c1798..53593aa 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -117,10 +117,10 @@ enum CPUFeatures { }; +Q_CORE_EXPORT uint qDetectCPUFeatures(); + QT_END_NAMESPACE QT_END_HEADER -Q_CORE_EXPORT uint qDetectCPUFeatures(); - #endif // QSIMD_P_H diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index f66b9c7..ec5809d 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -130,8 +130,9 @@ protected: private: Q_DECLARE_PRIVATE(QDeclarativeBinding) }; -Q_DECLARE_METATYPE(QDeclarativeBinding*); QT_END_NAMESPACE +Q_DECLARE_METATYPE(QDeclarativeBinding*); + #endif // QDECLARATIVEBINDING_P_H -- cgit v0.12 From 51bfbc326be268f552650dc30408479150a36744 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 1 Mar 2010 15:21:32 +0100 Subject: Extended gesture autotest. Make sure partial gestures do not propagate further if an item that expects partial gestures received it. Task-number: resulted from QTBUG-6876 Reviewed-by: trustme --- src/gui/graphicsview/qgraphicsscene.cpp | 7 ++++- tests/auto/gestures/tst_gestures.cpp | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a72761a..6bc02cc 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -6003,7 +6003,8 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) cachedTargetItems = cachedItemGestures.keys(); qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "Conflicting gestures:" << conflictedGestures; + << "Normal gestures:" << normalGestures + << "Conflicting gestures:" << conflictedGestures; // deliver conflicted gestures as override events AND remember // initial gesture targets @@ -6080,6 +6081,10 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType()); if (flags & Qt::IgnoredGesturesPropagateToParent) parentPropagatedGestures.insert(gesture); + } else { + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "no target for" << gesture << "at" + << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; } } qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index a1afa0a..f8ecca3 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -354,6 +354,7 @@ private slots: void deleteGestureTargetItem_data(); void deleteGestureTargetItem(); void viewportCoordinates(); + void partialGesturePropagation(); }; tst_Gestures::tst_Gestures() @@ -1896,5 +1897,57 @@ void tst_Gestures::viewportCoordinates() QVERIFY(item1->gestureEventsReceived != 0); } +void tst_Gestures::partialGesturePropagation() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item1 = new GestureItem("item1"); + item1->grabGesture(CustomGesture::GestureType); + item1->setZValue(8); + scene.addItem(item1); + + GestureItem *item2 = new GestureItem("item2[partial]"); + item2->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); + item2->setZValue(6); + scene.addItem(item2); + + GestureItem *item3 = new GestureItem("item3"); + item3->grabGesture(CustomGesture::GestureType); + item3->setZValue(4); + scene.addItem(item3); + + GestureItem *item4 = new GestureItem("item4[partial]"); + item4->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); + item4->setZValue(2); + scene.addItem(item4); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + + item1->ignoredUpdatedGestures << CustomGesture::GestureType; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(5, 5), item1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item1, &scene); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item3->gestureOverrideEventsReceived, 1); + QCOMPARE(item4->gestureOverrideEventsReceived, 1); + + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount-2); // except for started and finished + QCOMPARE(item3->gestureEventsReceived, 0); + QCOMPARE(item4->gestureEventsReceived, 0); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From a76c8424dab298c2fa36226f47bf7ac6f7e4014a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 1 Mar 2010 15:28:36 +0100 Subject: Fixed qDrawPixmaps() to draw on integer coordinates on Mac OS X. This is the 4.7 port of d04f5336f769d9e5d2f9105e1da4a7d23ea91795. Task-number: related to QTBUG-8455 Reviewed-by: Kim --- src/gui/painting/qpainter.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index dc96c17..9d83718 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -8933,8 +8933,15 @@ void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount, for (int i = 0; i < fragmentCount; ++i) { QTransform transform = oldTransform; - transform.translate(fragments[i].x, fragments[i].y); - transform.rotate(fragments[i].rotation); + qreal xOffset = 0; + qreal yOffset = 0; + if (fragments[i].rotation == 0) { + xOffset = fragments[i].x; + yOffset = fragments[i].y; + } else { + transform.translate(fragments[i].x, fragments[i].y); + transform.rotate(fragments[i].rotation); + } setOpacity(oldOpacity * fragments[i].opacity); setTransform(transform); @@ -8942,7 +8949,7 @@ void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount, qreal h = fragments[i].scaleY * fragments[i].height; QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, fragments[i].width, fragments[i].height); - drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect); + drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, sourceRect); } setOpacity(oldOpacity); -- cgit v0.12 From 31f2d97e28dff1a72511ab1ef7737e5f78d4cf66 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 1 Mar 2010 12:40:33 +0100 Subject: QMetaObject::invokeMethod: print a warning if the method is not found. Also adapt QTestLib not to call invokeMethod on unexisting method to avoid warnings Task-number: QTBUG-7331 Reviewed-by: Brad --- src/corelib/kernel/qmetaobject.cpp | 5 ++++- src/testlib/qtestcase.cpp | 28 +++++++++++++++++++++------- tests/auto/qmetaobject/tst_qmetaobject.cpp | 13 +++++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index be1b2ae..ecffe99 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1137,8 +1137,11 @@ bool QMetaObject::invokeMethod(QObject *obj, idx = obj->metaObject()->indexOfMethod(norm.constData()); } - if (idx < 0 || idx >= obj->metaObject()->methodCount()) + if (idx < 0 || idx >= obj->metaObject()->methodCount()) { + qWarning("QMetaObject::invokeMethod: No such method %s::%s", + obj->metaObject()->className(), sig.constData()); return false; + } QMetaMethod method = obj->metaObject()->method(idx); return method.invoke(obj, type, ret, val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 5c9dd55..4590f17 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -877,6 +877,19 @@ int qt_snprintf(char *str, int size, const char *format, ...) return res; } +/*! \internal + Invoke a method of the object without generating warning if the method does not exist + */ +static void invokeMethod(QObject *obj, const char *methodName) +{ + const QMetaObject *metaObject = obj->metaObject(); + int funcIndex = metaObject->indexOfMethod(methodName); + if (funcIndex >= 0) { + QMetaMethod method = metaObject->method(funcIndex); + method.invoke(obj, Qt::DirectConnection); + } +} + bool Q_TESTLIB_EXPORT defaultKeyVerbose() { if (keyVerbose == -1) { @@ -1213,7 +1226,7 @@ static void qInvokeTestMethodDataEntry(char *slot) bool invokeOk; do { QTestResult::setCurrentTestLocation(QTestResult::InitFunc); - QMetaObject::invokeMethod(QTest::currentTestObject, "init"); + invokeMethod(QTest::currentTestObject, "init()"); if (QTestResult::skipCurrentTest()) break; @@ -1233,7 +1246,7 @@ static void qInvokeTestMethodDataEntry(char *slot) QTestResult::addFailure("Unable to execute slot", __FILE__, __LINE__); QTestResult::setCurrentTestLocation(QTestResult::CleanupFunc); - QMetaObject::invokeMethod(QTest::currentTestObject, "cleanup"); + invokeMethod(QTest::currentTestObject, "cleanup()"); QTestResult::setCurrentTestLocation(QTestResult::NoWhere); // If this test method has a benchmark, repeat until all measurements are @@ -1300,8 +1313,9 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0) if (curGlobalDataIndex == 0) { QTestResult::setCurrentTestLocation(QTestResult::DataFunc); - QTest::qt_snprintf(member, 512, "%s_data", slot); - QMetaObject::invokeMethod(QTest::currentTestObject, member, Qt::DirectConnection); + QTest::qt_snprintf(member, 512, "%s_data()", slot); + invokeMethod(QTest::currentTestObject, member); + // if we encounter a SkipAll in the _data slot, we skip the whole // testfunction, no matter how much global data exists if (QTestResult::skipCurrentTest()) { @@ -1466,11 +1480,11 @@ static void qInvokeTestMethods(QObject *testObject) QTestResult::setCurrentTestFunction("initTestCase"); QTestResult::setCurrentTestLocation(QTestResult::DataFunc); QTestTable::globalTestTable(); - QMetaObject::invokeMethod(testObject, "initTestCase_data", Qt::DirectConnection); + invokeMethod(testObject, "initTestCase_data()"); if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) { QTestResult::setCurrentTestLocation(QTestResult::InitFunc); - QMetaObject::invokeMethod(testObject, "initTestCase"); + invokeMethod(testObject, "initTestCase()"); // finishedCurrentTestFunction() resets QTestResult::testFailed(), so use a local copy. const bool previousFailed = QTestResult::testFailed(); @@ -1498,7 +1512,7 @@ static void qInvokeTestMethods(QObject *testObject) QTestResult::setSkipCurrentTest(false); QTestResult::setCurrentTestFunction("cleanupTestCase"); - QMetaObject::invokeMethod(testObject, "cleanupTestCase"); + invokeMethod(testObject, "cleanupTestCase()"); } QTestResult::finishedCurrentTestFunction(); QTestResult::setCurrentTestFunction(0); diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 15b6204..bd54975 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -513,6 +513,19 @@ void tst_QMetaObject::invokeMetaMember() QVERIFY(QMetaObject::invokeMethod(&obj, "sig1", Q_RETURN_ARG(QString, exp), Q_ARG(QString, "hehe"))); QCOMPARE(exp, QString("yessir")); QCOMPARE(obj.slotResult, QString("sl1:hehe")); + + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::doesNotExist()"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "doesNotExist")); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl1(QString)(QString)"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "sl1(QString)", Q_ARG(QString, "arg"))); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl3(QString)"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "sl3", Q_ARG(QString, "arg"))); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: No such method QtTestObject::sl1(QString,QString,QString)"); + QVERIFY(!QMetaObject::invokeMethod(&obj, "sl1", Q_ARG(QString, "arg"), Q_ARG(QString, "arg"), Q_ARG(QString, "arg"))); + + //should not have changed since last test. + QCOMPARE(exp, QString("yessir")); + QCOMPARE(obj.slotResult, QString("sl1:hehe")); } void tst_QMetaObject::invokeQueuedMetaMember() -- cgit v0.12 From 7afc26c45ba19ba1fa077629e388be32ea1664bc Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Mon, 1 Mar 2010 15:39:17 +0100 Subject: compile --- src/multimedia/qml/qsoundeffect_pulse_p.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/multimedia/qml/qsoundeffect_pulse_p.cpp b/src/multimedia/qml/qsoundeffect_pulse_p.cpp index ec851aa..f7870c2 100644 --- a/src/multimedia/qml/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/qml/qsoundeffect_pulse_p.cpp @@ -63,7 +63,7 @@ #include "qsoundeffect_pulse_p.h" -#if(Q_WS_MAEMO_5) +#if defined(Q_WS_MAEMO_5) #include #endif @@ -155,7 +155,7 @@ private: lock(); m_context = pa_context_new(m_mainLoopApi, QString(QLatin1String("QtPulseAudio:%1")).arg(::getpid()).toAscii().constData()); -#if(Q_WS_MAEMO_5) +#if defined(Q_WS_MAEMO_5) pa_context_set_state_callback(m_context, context_state_callback, this); #endif if (m_context == 0) { @@ -183,7 +183,7 @@ private: m_prepared = false; } -#if(Q_WS_MAEMO_5) +#if defined(Q_WS_MAEMO_5) static void context_state_callback(pa_context *c, void *userdata) { PulseDaemon *self = reinterpret_cast(userdata); @@ -299,7 +299,7 @@ void QSoundEffectPrivate::play() pa_volume_t m_vol = PA_VOLUME_NORM; daemon()->lock(); -#if(Q_WS_MAEMO_5) +#if defined(Q_WS_MAEMO_5) m_vol = PA_VOLUME_NORM/100*((daemon()->volume()+m_vol)/2); #endif pa_operation_unref( -- cgit v0.12 From cab1428311067872b811679e72e0ad457d76a24f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 2 Mar 2010 01:01:58 +1000 Subject: Document TextEdit::textMargin --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 8e44b26..be73b39 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -613,6 +613,11 @@ void QDeclarativeTextEdit::setPersistentSelection(bool on) emit persistentSelectionChanged(d->persistentSelection); } +/* + \qmlproperty number TextEdit::textMargin + + The margin, in pixels, around the text in the TextEdit. +*/ qreal QDeclarativeTextEdit::textMargin() const { Q_D(const QDeclarativeTextEdit); -- cgit v0.12 From 83c37c2cdf7adf2604e1e6012a9e0e6e67d97d6b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 1 Mar 2010 17:31:44 +0100 Subject: removed dead code Reviewed-by: denis --- src/gui/kernel/qcursor_mac.mm | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/gui/kernel/qcursor_mac.mm b/src/gui/kernel/qcursor_mac.mm index cfebf60..03e38b0 100644 --- a/src/gui/kernel/qcursor_mac.mm +++ b/src/gui/kernel/qcursor_mac.mm @@ -114,27 +114,18 @@ void qt_mac_set_cursor(const QCursor *c, const QPoint &) } c->handle(); //force the cursor to get loaded, if it's not - if(1 || currentCursor != c->d) { - if(currentCursor && currentCursor->type == QCursorData::TYPE_ThemeCursor - && currentCursor->curs.tc.anim) - currentCursor->curs.tc.anim->stop(); - QMacCocoaAutoReleasePool pool; - if(c->d->type == QCursorData::TYPE_ImageCursor) { - [static_cast(c->d->curs.cp.nscursor) set]; - } else if(c->d->type == QCursorData::TYPE_ThemeCursor) { -#ifdef QT_MAC_USE_COCOA - if (c->d->curs.cp.nscursor == 0) - [[NSCursor arrowCursor] set]; - [static_cast(c->d->curs.cp.nscursor) set]; -#else - if(SetAnimatedThemeCursor(c->d->curs.tc.curs, 0) == themeBadCursorIndexErr) { - SetThemeCursor(c->d->curs.tc.curs); - } else { - if(!c->d->curs.tc.anim) - c->d->curs.tc.anim = new QMacAnimateCursor; - c->d->curs.tc.anim->start(c->d->curs.tc.curs); - } -#endif + if(currentCursor && currentCursor->type == QCursorData::TYPE_ThemeCursor + && currentCursor->curs.tc.anim) + currentCursor->curs.tc.anim->stop(); + if(c->d->type == QCursorData::TYPE_ImageCursor) { + [static_cast(c->d->curs.cp.nscursor) set]; + } else if(c->d->type == QCursorData::TYPE_ThemeCursor) { + if(SetAnimatedThemeCursor(c->d->curs.tc.curs, 0) == themeBadCursorIndexErr) { + SetThemeCursor(c->d->curs.tc.curs); + } else { + if(!c->d->curs.tc.anim) + c->d->curs.tc.anim = new QMacAnimateCursor; + c->d->curs.tc.anim->start(c->d->curs.tc.curs); } } currentCursor = c->d; -- cgit v0.12 From 7024111f8615b84741640e8dbbb1dd9482c9e1ea Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 1 Mar 2010 19:07:41 +0100 Subject: Expand documention of status property with examples Task-number: QTBUG-8542 --- src/declarative/graphicsitems/qdeclarativeimage.cpp | 10 ++++++++++ src/declarative/graphicsitems/qdeclarativeloader.cpp | 9 +++++++++ src/declarative/util/qdeclarativefontloader.cpp | 10 ++++++++++ src/declarative/util/qdeclarativexmllistmodel.cpp | 12 +++++++++++- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 99ab053..2739ab8 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -232,6 +232,16 @@ qreal QDeclarativeImage::paintedHeight() const \o Error - an error occurred while loading the image \endlist + Note that a change in the status property does not cause anything to happen + (although it reflects what has happened with the image internally). If you wish + to react to the change in status you need to do it yourself, for example in one + of the following ways: + \list + \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: image.status = Image.Ready;} + \o Do something inside the onStatusChanged signal handler, e.g. Image{id: image; onStatusChanged: if(image.status == Image.Ready) console.log('Loaded');} + \o Bind to the status variable somewhere, e.g. Text{text: if(image.status!=Image.Ready){'Not Loaded';}else{'Loaded';}} + \endlist + \sa progress */ diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index bd89321..b0499d7 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -320,6 +320,15 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() \o Error - an error occurred while loading the QML source \endlist + Note that a change in the status property does not cause anything to happen + (although it reflects what has happened to the loader internally). If you wish + to react to the change in status you need to do it yourself, for example in one + of the following ways: + \list + \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: loader.status = Loader.Ready;} + \o Do something inside the onStatusChanged signal handler, e.g. Loader{id: loader; onStatusChanged: if(loader.status == Loader.Ready) console.log('Loaded');} + \o Bind to the status variable somewhere, e.g. Text{text: if(loader.status!=Loader.Ready){'Not Loaded';}else{'Loaded';}} + \endlist \sa progress */ diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 4d12ae1..8f5f537 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -189,6 +189,16 @@ void QDeclarativeFontLoader::setName(const QString &name) \o Loading - the font is currently being loaded \o Error - an error occurred while loading the font \endlist + + Note that a change in the status property does not cause anything to happen + (although it reflects what has happened to the font loader internally). If you wish + to react to the change in status you need to do it yourself, for example in one + of the following ways: + \list + \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: loader.status = FontLoader.Ready;} + \o Do something inside the onStatusChanged signal handler, e.g. FontLoader{id: loader; onStatusChanged: if(loader.status == FontLoader.Ready) console.log('Loaded');} + \o Bind to the status variable somewhere, e.g. Text{text: if(loader.status!=FontLoader.Ready){'Not Loaded';}else{'Loaded';}} + \endlist */ QDeclarativeFontLoader::Status QDeclarativeFontLoader::status() const { diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 162a669..d260ada 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -647,11 +647,21 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati This property holds the status of data source loading. It can be one of: \list \o Null - no data source has been set - \o Ready - nthe data source has been loaded + \o Ready - the data source has been loaded \o Loading - the data source is currently being loaded \o Error - an error occurred while loading the data source \endlist + Note that a change in the status property does not cause anything to happen + (although it reflects what has happened to the XmlListModel internally). If you wish + to react to the change in status you need to do it yourself, for example in one + of the following ways: + \list + \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: xmlListModel.status = XmlListModel.Ready;} + \o Do something inside the onStatusChanged signal handler, e.g. XmlListModel{id: xmlListModel; onStatusChanged: if(xmlListModel.status == XmlListModel.Ready) console.log('Loaded');} + \o Bind to the status variable somewhere, e.g. Text{text: if(xmlListModel.status!=XmlListModel.Ready){'Not Loaded';}else{'Loaded';}} + \endlist + \sa progress */ -- cgit v0.12 From e1aa5c3641ba3945e2e6a7b4c37c394eece53dd0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 2 Mar 2010 09:11:13 +1000 Subject: Setting the same source again causes reload. Task-number: QTBUG-8623 --- src/declarative/util/qdeclarativeview.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 6fe5bf3..a3c372d 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -282,13 +282,14 @@ QDeclarativeView::~QDeclarativeView() /*! Sets the source to the \a url, loads the QML component and instantiates it. + + Calling this methods multiple times with the same url will result + in the QML being reloaded. */ void QDeclarativeView::setSource(const QUrl& url) { - if (url != d->source) { - d->source = url; - d->execute(); - } + d->source = url; + d->execute(); } /*! -- cgit v0.12 From 001d1a2eac5b0fe63ae9809c4c69065b7ae14f38 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 09:33:27 +1000 Subject: Reapply "Some animation cleanup/refactoring." This reverts commit 543c4b82e6d6cc4a396b1c105d7321643b6ef4c6. Conflicts: src/declarative/util/qdeclarativeanimation.cpp --- src/declarative/util/qdeclarativeanimation.cpp | 11 ++++++----- src/declarative/util/qdeclarativeanimation_p_p.h | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 10230d3..ebf1a20 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1573,7 +1573,8 @@ QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent QDeclarativeAnimationGroup(parent) { Q_D(QDeclarativeAnimationGroup); - d->ag = new QSequentialAnimationGroup(this); + d->ag = new QSequentialAnimationGroup; + QDeclarative_setParent_noEvent(d->ag, this); } QDeclarativeSequentialAnimation::~QDeclarativeSequentialAnimation() @@ -1638,7 +1639,8 @@ QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) : QDeclarativeAnimationGroup(parent) { Q_D(QDeclarativeAnimationGroup); - d->ag = new QParallelAnimationGroup(this); + d->ag = new QParallelAnimationGroup; + QDeclarative_setParent_noEvent(d->ag, this); } QDeclarativeParallelAnimation::~QDeclarativeParallelAnimation() @@ -1797,7 +1799,7 @@ QDeclarativePropertyAnimation::~QDeclarativePropertyAnimation() void QDeclarativePropertyAnimationPrivate::init() { Q_Q(QDeclarativePropertyAnimation); - va = new QDeclarativeTimeLineValueAnimator; + va = new QDeclarativeBulkValueAnimator; QDeclarative_setParent_noEvent(va, q); } @@ -2213,7 +2215,7 @@ QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation() return d->va; } -struct PropertyUpdater : public QDeclarativeTimeLineValue +struct PropertyUpdater : public QDeclarativeBulkValueUpdater { QDeclarativeStateActions actions; int interpolatorType; //for Number/ColorAnimation @@ -2231,7 +2233,6 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue wasDeleted = &deleted; if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 v = 1 - v; - QDeclarativeTimeLineValue::setValue(v); for (int ii = 0; ii < actions.count(); ++ii) { QDeclarativeAction &action = actions[ii]; diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index e582066..ae82a90 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -149,14 +149,21 @@ private: bool running; }; -//animates QDeclarativeTimeLineValue (assumes start and end values will be reals or compatible) -class QDeclarativeTimeLineValueAnimator : public QVariantAnimation +class QDeclarativeBulkValueUpdater +{ +public: + virtual ~QDeclarativeBulkValueUpdater() {} + virtual void setValue(qreal value) = 0; +}; + +//animates QDeclarativeBulkValueUpdater (assumes start and end values will be reals or compatible) +class QDeclarativeBulkValueAnimator : public QVariantAnimation { Q_OBJECT public: - QDeclarativeTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} - ~QDeclarativeTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } - void setAnimValue(QDeclarativeTimeLineValue *value, DeletionPolicy p) + QDeclarativeBulkValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} + ~QDeclarativeBulkValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } + void setAnimValue(QDeclarativeBulkValueUpdater *value, DeletionPolicy p) { if (state() == Running) stop(); @@ -193,7 +200,7 @@ protected: } private: - QDeclarativeTimeLineValue *animValue; + QDeclarativeBulkValueUpdater *animValue; bool *fromSourced; DeletionPolicy policy; }; @@ -352,7 +359,7 @@ public: int interpolatorType; QVariantAnimation::Interpolator interpolator; - QDeclarativeTimeLineValueAnimator *va; + QDeclarativeBulkValueAnimator *va; static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); static void convertVariant(QVariant &variant, int type); -- cgit v0.12 From d943ce63bd962763205796cfb5bf960e1228a0b3 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 09:49:27 +1000 Subject: Replace remaining QGuard usage with QDeclarativeGuard. --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 3 ++- src/declarative/graphicsitems/qdeclarativelistview.cpp | 3 ++- src/declarative/graphicsitems/qdeclarativepathview_p_p.h | 3 ++- src/declarative/util/qdeclarativeview.cpp | 5 +++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index b43b30b..8d778f8 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -45,6 +45,7 @@ #include "qdeclarativeflickable_p_p.h" #include +#include #include #include @@ -251,7 +252,7 @@ public: } } - QGuard model; + QDeclarativeGuard model; QVariant modelVariant; QList visibleItems; QHash unrequestedItems; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 03303a0..02a8493 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -429,7 +430,7 @@ public: virtual void flickX(qreal velocity); virtual void flickY(qreal velocity); - QGuard model; + QDeclarativeGuard model; QVariant modelVariant; QList visibleItems; QHash unrequestedItems; diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h index ca50910..6344a8a 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h @@ -60,6 +60,7 @@ #include #include +#include #include @@ -132,7 +133,7 @@ public: int pathOffset; int requestedIndex; QList items; - QGuard model; + QDeclarativeGuard model; QVariant modelVariant; enum MovementReason { Other, Key, Mouse }; MovementReason moveReason; diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index a3c372d..f08e634 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -136,8 +137,8 @@ public: QDeclarativeView *q; - QGuard root; - QGuard qmlRoot; + QDeclarativeGuard root; + QDeclarativeGuard qmlRoot; QUrl source; -- cgit v0.12 From 759888f3074deace6550a8b878d8464903dcfa09 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 2 Mar 2010 09:58:50 +1000 Subject: Test GridView.onAdd & GridView.onRemove. Reduce wait()s --- .../qdeclarativegridview/data/gridview.qml | 6 +++ .../tst_qdeclarativegridview.cpp | 59 ++++++++++++---------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml index 344b4b5..ba6b807 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml @@ -1,6 +1,10 @@ import Qt 4.6 Rectangle { + id: root + property int added: -1 + property var removed + width: 240 height: 320 color: "#ffffff" @@ -33,6 +37,8 @@ Rectangle { text: number } color: GridView.isCurrentItem ? "lightsteelblue" : "white" + GridView.onAdd: root.added = index + GridView.onRemove: root.removed = name } } ] diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 2a60fee..7a6a060 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -253,7 +254,7 @@ void tst_QDeclarativeGridView::inserted() model.insertItem(1, "Will", "9876"); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item @@ -264,6 +265,10 @@ void tst_QDeclarativeGridView::inserted() QVERIFY(number != 0); QCOMPARE(number->text(), model.number(1)); + // Checks that onAdd is called + int added = canvas->rootObject()->property("added").toInt(); + QCOMPARE(added, 1); + // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem(viewport, "wrapper", i); @@ -274,7 +279,7 @@ void tst_QDeclarativeGridView::inserted() model.insertItem(0, "Foo", "1111"); // zero index, and current item // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item @@ -296,14 +301,14 @@ void tst_QDeclarativeGridView::inserted() for (int i = model.count(); i < 30; ++i) model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(300); + QTest::qWait(100); gridview->setContentY(120); - QTest::qWait(300); + QTest::qWait(100); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); - QTest::qWait(300); + QTest::qWait(100); QVERIFY(gridview->contentY() == 120); @@ -334,7 +339,7 @@ void tst_QDeclarativeGridView::removed() model.removeItem(1); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QDeclarativeText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); @@ -343,6 +348,10 @@ void tst_QDeclarativeGridView::removed() QVERIFY(number != 0); QCOMPARE(number->text(), model.number(1)); + // Checks that onRemove is called + QString removed = canvas->rootObject()->property("removed").toString(); + QCOMPARE(removed, QString("Item1")); + // Confirm items positioned correctly int itemCount = findItems(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { @@ -357,7 +366,7 @@ void tst_QDeclarativeGridView::removed() model.removeItem(0); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); name = findItem(viewport, "textName", 0); QVERIFY(name != 0); @@ -379,7 +388,7 @@ void tst_QDeclarativeGridView::removed() // Remove items not visible model.removeItem(25); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly itemCount = findItems(viewport, "wrapper").count(); @@ -393,11 +402,11 @@ void tst_QDeclarativeGridView::removed() // Remove items before visible gridview->setContentY(120); - QTest::qWait(500); + QTest::qWait(100); gridview->setCurrentIndex(10); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Setting currentIndex above shouldn't cause view to scroll QCOMPARE(gridview->contentY(), 120.0); @@ -405,7 +414,7 @@ void tst_QDeclarativeGridView::removed() model.removeItem(1); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly for (int i = 6; i < 18; ++i) { @@ -419,14 +428,14 @@ void tst_QDeclarativeGridView::removed() // Remove currentIndex QDeclarativeItem *oldCurrent = gridview->currentItem(); model.removeItem(9); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), 9); QVERIFY(gridview->currentItem() != oldCurrent); gridview->setContentY(0); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly itemCount = findItems(viewport, "wrapper").count(); @@ -440,7 +449,7 @@ void tst_QDeclarativeGridView::removed() // remove item outside current view. gridview->setCurrentIndex(32); - QTest::qWait(500); + QTest::qWait(100); gridview->setContentY(240); model.removeItem(30); @@ -448,21 +457,21 @@ void tst_QDeclarativeGridView::removed() // remove current item beyond visible items. gridview->setCurrentIndex(20); - QTest::qWait(500); + QTest::qWait(100); gridview->setContentY(0); model.removeItem(20); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), 20); QVERIFY(gridview->currentItem() != 0); // remove item before current, but visible gridview->setCurrentIndex(8); - QTest::qWait(500); + QTest::qWait(100); gridview->setContentY(240); oldCurrent = gridview->currentItem(); model.removeItem(6); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), 7); QVERIFY(gridview->currentItem() == oldCurrent); @@ -494,7 +503,7 @@ void tst_QDeclarativeGridView::moved() model.moveItem(1, 8); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); QDeclarativeText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); @@ -526,7 +535,7 @@ void tst_QDeclarativeGridView::moved() model.moveItem(1, 25); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly and indexes correct itemCount = findItems(viewport, "wrapper").count()-1; @@ -548,7 +557,7 @@ void tst_QDeclarativeGridView::moved() model.moveItem(28, 8); // let transitions settle. - QTest::qWait(300); + QTest::qWait(100); // Confirm items positioned correctly and indexes correct for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { @@ -591,7 +600,7 @@ void tst_QDeclarativeGridView::currentIndex() QDeclarativeItem *viewport = gridview->viewport(); QVERIFY(viewport != 0); - QTest::qWait(500); + QTest::qWait(300); // current item should be third item QCOMPARE(gridview->currentIndex(), 5); @@ -618,7 +627,7 @@ void tst_QDeclarativeGridView::currentIndex() QCOMPARE(gridview->currentIndex(), 0); gridview->setCurrentIndex(model.count()-1); - QTest::qWait(500); + QTest::qWait(100); QCOMPARE(gridview->currentIndex(), model.count()-1); gridview->moveCurrentIndexRight(); @@ -677,8 +686,6 @@ void tst_QDeclarativeGridView::currentIndex() // turn off auto highlight gridview->setHighlightFollowsCurrentItem(false); QVERIFY(gridview->highlightFollowsCurrentItem() == false); - - QTest::qWait(500); QVERIFY(gridview->highlightItem()); qreal hlPosX = gridview->highlightItem()->x(); qreal hlPosY = gridview->highlightItem()->y(); @@ -729,7 +736,7 @@ void tst_QDeclarativeGridView::changeFlow() } ctxt->setContextProperty("testTopToBottom", QVariant(true)); - QTest::qWait(500); + QTest::qWait(100); // Confirm items positioned correctly and indexes correct itemCount = findItems(viewport, "wrapper").count(); -- cgit v0.12 From 7ac4de570aa37d4b6a30e2e935ebab3642415f74 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 10:36:47 +1000 Subject: Minor optimization. --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index cd72ef9..47ba917 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -984,8 +985,8 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray if (complete) d->m_delegate->completeCreate(); if (nobj) { - ctxt->setParent(nobj); - data->setParent(nobj); + QDeclarative_setParent_noEvent(ctxt, nobj); + QDeclarative_setParent_noEvent(data, nobj); d->m_cache.insertItem(index, nobj); if (QDeclarativePackage *package = qobject_cast(nobj)) emit createdPackage(index, package); -- cgit v0.12 From 21c15c9efb1b34df6b990c69479979a336267d1b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 10:37:17 +1000 Subject: Fix warning. --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 47ba917..59d6db8 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1269,7 +1269,6 @@ void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const void QDeclarativeVisualDataModel::_q_modelReset() { - Q_D(QDeclarativeVisualDataModel); emit modelReset(); } -- cgit v0.12 From 2790cb59f6877c1027c833578b72e168c912758a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 2 Mar 2010 10:47:10 +1000 Subject: Make "on" syntax mandatory for value sources and interceptors Where you would have written x: NumberAnimation {} y: Behavior {} you now must write NumberAnimation on x {} Behavior on y {} This change also makes the parser more strict with respect to multiple assignments to a single property - they're no longer allowed. For example this x: 10 x: 11 is now an error. --- demos/declarative/flickr/common/Loading.qml | 2 +- demos/declarative/flickr/mobile/GridDelegate.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 2 +- demos/declarative/flickr/mobile/ListDelegate.qml | 4 +- demos/declarative/minehunt/main.cpp | 5 +- demos/declarative/minehunt/minehunt.qml | 2 +- demos/declarative/samegame/content/BoomBlock.qml | 6 +- demos/declarative/samegame/content/Dialog.qml | 2 +- demos/declarative/samegame/samegame.qml | 2 +- demos/declarative/snake/content/Cookie.qml | 2 +- demos/declarative/snake/content/Link.qml | 8 +- demos/declarative/snake/content/Skull.qml | 6 +- demos/declarative/snake/content/snake.js | 4 +- demos/declarative/snake/snake.qml | 6 +- demos/declarative/twitter/content/FatDelegate.qml | 2 +- demos/declarative/twitter/content/Loading.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- .../declarative/animations/color-animation.qml | 10 +- .../declarative/animations/property-animation.qml | 2 +- .../declarative/aspectratio/face_fit_animated.qml | 2 +- examples/declarative/behaviours/behavior.qml | 6 +- examples/declarative/behaviours/test.qml | 102 ---------- .../border-image/content/MyBorderImage.qml | 4 +- examples/declarative/clocks/content/Clock.qml | 6 +- examples/declarative/connections/connections.qml | 2 +- examples/declarative/dial/content/Dial.qml | 2 +- examples/declarative/effects/effects.qml | 4 +- examples/declarative/fillmode/fillmode.qml | 2 +- examples/declarative/fonts/banner.qml | 2 +- examples/declarative/fonts/hello.qml | 4 +- examples/declarative/layouts/positioners.qml | 20 +- .../listview/content/ClickAutoRepeating.qml | 2 +- examples/declarative/listview/highlight.qml | 2 +- examples/declarative/parallax/qml/Smiley.qml | 2 +- .../progressbar/content/ProgressBar.qml | 2 +- examples/declarative/progressbar/progressbars.qml | 6 +- examples/declarative/snow/ImageBatch.qml | 72 ------- examples/declarative/snow/Loading.qml | 8 - examples/declarative/snow/create.js | 12 -- examples/declarative/snow/pics/loading.png | Bin 761 -> 0 bytes examples/declarative/snow/snow.qml | 69 ------- .../tutorials/samegame/samegame3/Dialog.qml | 2 +- .../samegame/samegame4/content/BoomBlock.qml | 6 +- .../samegame/samegame4/content/Dialog.qml | 2 +- examples/declarative/tvtennis/tvtennis.qml | 8 +- examples/declarative/velocity/Day.qml | 2 +- src/declarative/qml/qdeclarativecompiler.cpp | 209 ++++++++++++--------- src/declarative/qml/qdeclarativecompiler_p.h | 5 + src/declarative/qml/qdeclarativedom.cpp | 14 +- src/declarative/qml/qdeclarativeparser.cpp | 9 +- src/declarative/qml/qdeclarativeparser_p.h | 3 + src/declarative/qml/qdeclarativescriptparser.cpp | 66 +++++-- tests/auto/declarative/examples/tst_examples.cpp | 1 - .../qdeclarativeanimations/data/badtype1.qml | 2 +- .../qdeclarativeanimations/data/badtype2.qml | 2 +- .../qdeclarativeanimations/data/badtype3.qml | 2 +- .../qdeclarativeanimations/data/dontAutoStart.qml | 2 +- .../qdeclarativeanimations/data/dontStart.qml | 2 +- .../qdeclarativeanimations/data/properties.qml | 2 +- .../qdeclarativeanimations/data/properties2.qml | 2 +- .../qdeclarativeanimations/data/properties3.qml | 2 +- .../qdeclarativeanimations/data/properties4.qml | 2 +- .../qdeclarativeanimations/data/properties5.qml | 2 +- .../qdeclarativeanimations/data/valuesource.qml | 2 +- .../qdeclarativeanimations/data/valuesource2.qml | 2 +- .../qdeclarativebehaviors/data/binding.qml | 2 +- .../qdeclarativebehaviors/data/color.qml | 2 +- .../qdeclarativebehaviors/data/cpptrigger.qml | 2 +- .../qdeclarativebehaviors/data/disabled.qml | 2 +- .../qdeclarativebehaviors/data/dontStart.qml | 2 +- .../qdeclarativebehaviors/data/empty.qml | 2 +- .../qdeclarativebehaviors/data/explicit.qml | 2 +- .../qdeclarativebehaviors/data/groupProperty.qml | 2 +- .../qdeclarativebehaviors/data/groupProperty2.qml | 2 +- .../qdeclarativebehaviors/data/loop.qml | 2 +- .../qdeclarativebehaviors/data/nonSelecting2.qml | 2 +- .../qdeclarativebehaviors/data/parent.qml | 2 +- .../data/reassignedAnimation.qml | 2 +- .../qdeclarativebehaviors/data/scripttrigger.qml | 2 +- .../qdeclarativebehaviors/data/simple.qml | 2 +- .../tst_qdeclarativebehaviors.cpp | 2 +- .../qdeclarativedom/tst_qdeclarativedom.cpp | 72 +++---- .../qdeclarativelanguage/data/assignBasicTypes.qml | 2 - .../data/component.3.errors.txt | 2 +- .../data/doubleSignal.errors.txt | 2 +- .../data/invalidGroupedProperty.6.errors.txt | 2 +- .../data/invalidID.4.errors.txt | 2 +- .../data/listAssignment.3.errors.txt | 2 +- .../data/multiSet.1.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.1.qml | 7 + .../data/multiSet.10.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.10.qml | 6 + .../data/multiSet.2.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.2.qml | 7 + .../data/multiSet.3.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.3.qml | 7 + .../data/multiSet.4.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.4.qml | 7 + .../data/multiSet.5.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.5.qml | 6 + .../data/multiSet.6.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.6.qml | 7 + .../data/multiSet.7.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.7.qml | 7 + .../data/multiSet.8.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.8.qml | 8 + .../data/multiSet.9.errors.txt | 1 + .../qdeclarativelanguage/data/multiSet.9.qml | 6 + .../data/propertyValueSource.2.qml | 2 +- .../data/propertyValueSource.qml | 2 +- .../qdeclarativelanguage/data/script.8.errors.txt | 2 +- .../declarative/qdeclarativelanguage/testtypes.h | 5 + .../tst_qdeclarativelanguage.cpp | 11 ++ .../qdeclarativeparticles/data/particles.qml | 2 +- .../qdeclarativepathview/data/pathview2.qml | 2 +- .../qdeclarativepathview/data/pathview3.qml | 2 +- .../data/valueInterceptors.qml | 2 +- .../qdeclarativevaluetypes/data/valueSources.qml | 2 +- .../tst_qdeclarativevaluetypes.cpp | 3 +- tools/qml/qfxtester.h | 4 +- 120 files changed, 454 insertions(+), 532 deletions(-) delete mode 100644 examples/declarative/behaviours/test.qml delete mode 100644 examples/declarative/snow/ImageBatch.qml delete mode 100644 examples/declarative/snow/Loading.qml delete mode 100644 examples/declarative/snow/create.js delete mode 100644 examples/declarative/snow/pics/loading.png delete mode 100644 examples/declarative/snow/snow.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml index 174cd21..938a080 100644 --- a/demos/declarative/flickr/common/Loading.qml +++ b/demos/declarative/flickr/common/Loading.qml @@ -2,7 +2,7 @@ import Qt 4.6 Image { id: loading; source: "pics/loading.png"; transformOrigin: "Center" - rotation: NumberAnimation { + NumberAnimation on rotation { from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 7634573..291d874 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -23,7 +23,7 @@ Item { anchors.centerIn: parent scale: 0.0 - scale: Behavior { NumberAnimation { easing.type: "InOutQuad"} } + Behavior on scale { NumberAnimation { easing.type: "InOutQuad"} } id: scaleMe Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true } diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 8749b4c..f1b3c7d 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -45,7 +45,7 @@ Flipable { Text { color: "white"; elide: Text.ElideRight; text: "Author: " + container.photoAuthor } Text { color: "white"; elide: Text.ElideRight; text: "Published: " + container.photoDate } Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "Tags: " } - Text { color: "white"; elide: Text.ElideRight; elide: Text.ElideRight; text: container.photoTags } + Text { color: "white"; elide: Text.ElideRight; text: container.photoTags } } } diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml index 75c4572..381664b 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/mobile/ListDelegate.qml @@ -15,8 +15,8 @@ Component { Column { x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } - Text { text: photoAuthor; color: "white"; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } - Text { text: photoDate; color: "white"; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoAuthor; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoDate; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } } } } diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 0e99731..c8b4b54 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -100,8 +100,8 @@ public: MyWidget(int = 370, int = 480, QWidget *parent=0, Qt::WindowFlags flags=0); ~MyWidget(); - Q_PROPERTY(QList *tiles READ tiles CONSTANT); - QList *tiles() { return &_tiles; } + Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT); + QDeclarativeListProperty tiles() { return QDeclarativeListProperty(this, _tiles); } Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged); bool isPlaying() {return playing;} @@ -168,7 +168,6 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->addDefaultObject(this); - ctxt->setContextProperty("tiles", QVariant::fromValue*>(&_tiles));//QTBUG-5675 canvas->setSource(QUrl::fromLocalFile(fileName)); } diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 617a6ed..c54e741 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -32,7 +32,7 @@ Item { anchors.verticalCenter: parent.verticalCenter source: "pics/flag.png" opacity: model.hasFlag - opacity: Behavior { + Behavior on opacity { NumberAnimation { property: "opacity" duration: 250 diff --git a/demos/declarative/samegame/content/BoomBlock.qml b/demos/declarative/samegame/content/BoomBlock.qml index 723e62a..e48194a 100644 --- a/demos/declarative/samegame/content/BoomBlock.qml +++ b/demos/declarative/samegame/content/BoomBlock.qml @@ -7,8 +7,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } Image { id: img source: { @@ -21,7 +21,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } anchors.fill: parent } diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/content/Dialog.qml index 7769328..6d5d6b5 100644 --- a/demos/declarative/samegame/content/Dialog.qml +++ b/demos/declarative/samegame/content/Dialog.qml @@ -14,7 +14,7 @@ Rectangle { property Item text: myText color: "white"; border.width: 1; width: myText.width + 20; height: myText.height + 40; opacity: 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 50f6293..c81f292 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -39,7 +39,7 @@ Rectangle { Dialog { id: scoreName; anchors.centerIn: parent; z: 22; property int initialWidth: 0 - width: Behavior{NumberAnimation{} enabled: initialWidth!=0} + Behavior on width {NumberAnimation{} enabled: initialWidth!=0} Text { id: spacer anchors.left: scoreName.left diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index 7f0aadf..0ea95cb 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -17,7 +17,7 @@ Item { anchors.fill: parent source: "pics/cookie.png" opacity: 0 - opacity: Behavior { NumberAnimation { duration: 100 } } + Behavior on opacity { NumberAnimation { duration: 100 } } Text { font.bold: true anchors.verticalCenter: parent.verticalCenter diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 1b3f7bf..31ac4b9 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -13,8 +13,8 @@ Item { id:link x: margin - 3 + gridSize * column y: margin - 3 + gridSize * row - x: Behavior { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } - y: Behavior { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } + Behavior on x { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } Item { @@ -35,7 +35,7 @@ Item { id:link id: actualImageRotation origin.x: width/2; origin.y: height/2; angle: rotation * 90 - angle: Behavior{ NumberAnimation { duration: spawned ? 200 : 0} } + Behavior on angle { NumberAnimation { duration: spawned ? 200 : 0} } } } @@ -44,7 +44,7 @@ Item { id:link } opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } } diff --git a/demos/declarative/snake/content/Skull.qml b/demos/declarative/snake/content/Skull.qml index 585e7d3..821996a 100644 --- a/demos/declarative/snake/content/Skull.qml +++ b/demos/declarative/snake/content/Skull.qml @@ -9,11 +9,11 @@ Image { x: margin + column * gridSize + 2 y: margin + row * gridSize - 3 - x: Behavior { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } - y: Behavior { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } + Behavior on x { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } opacity: spawned ? 1 : 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } source: "pics/skull.png" width: 24 diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index a65aebc..12176c7 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -54,7 +54,7 @@ function startNewGame() } else { if(linkComponent.isReady == false){ if(linkComponent.isError == true) - print(linkComponent.errorString()); + print(linkComponent.errorsString()); else print("Still loading linkComponent"); continue;//TODO: Better error handling? @@ -295,7 +295,7 @@ function createCookie(value) { if(cookieComponent.isReady == false){ if(cookieComponent.isError == true) - print(cookieComponent.errorString()); + print(cookieComponent.errorsString()); else print("Still loading cookieComponent"); return;//TODO: Better error handling? diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 09b6b7f..f9d02c7 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -65,7 +65,7 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - opacity: Behavior { NumberAnimation { duration: 500 } } + Behavior on opacity { NumberAnimation { duration: 500 } } Text { color: "white" @@ -121,7 +121,7 @@ Rectangle { Rectangle { id: progressBar opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } color: "transparent" border.width: 2 border.color: "#221edd" @@ -137,7 +137,7 @@ Rectangle { id: progressIndicator color: "#221edd"; width: 0; - width: Behavior { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} + Behavior on width { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} height: 30; } } diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/content/FatDelegate.qml index 2b9288b..0f013e6 100644 --- a/demos/declarative/twitter/content/FatDelegate.qml +++ b/demos/declarative/twitter/content/FatDelegate.qml @@ -37,7 +37,7 @@ Component { + ''+userScreenName + " from " +source + "
" + addTags(statusText) + ""; textFormat: Qt.RichText - color: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: handleLink(link) } diff --git a/demos/declarative/twitter/content/Loading.qml b/demos/declarative/twitter/content/Loading.qml index 3151415..76bf64b 100644 --- a/demos/declarative/twitter/content/Loading.qml +++ b/demos/declarative/twitter/content/Loading.qml @@ -2,7 +2,7 @@ import Qt 4.6 Image { id: loading; source: "images/loading.png"; transformOrigin: "Center" - rotation: NumberAnimation { + NumberAnimation on rotation { from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index b091b03..0ea1309 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -35,7 +35,7 @@ Item { Text { width: 180 text: "Could not access twitter using this screen name and password pair."; - color: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent } diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml index 7171a69..6740522 100644 --- a/examples/declarative/animations/color-animation.qml +++ b/examples/declarative/animations/color-animation.qml @@ -10,7 +10,7 @@ Item { gradient: Gradient { GradientStop { position: 0.0 - color: SequentialAnimation { + SequentialAnimation on color { repeat: true ColorAnimation { from: "DeepSkyBlue"; to: "#0E1533"; duration: 5000 } ColorAnimation { from: "#0E1533"; to: "DeepSkyBlue"; duration: 5000 } @@ -18,7 +18,7 @@ Item { } GradientStop { position: 1.0 - color: SequentialAnimation { + SequentialAnimation on color { repeat: true ColorAnimation { from: "SkyBlue"; to: "#437284"; duration: 5000 } ColorAnimation { from: "#437284"; to: "SkyBlue"; duration: 5000 } @@ -31,7 +31,7 @@ Item { Item { width: parent.width; height: 2 * parent.height transformOrigin: Item.Center - rotation: NumberAnimation { from: 0; to: 360; duration: 10000; repeat: true } + NumberAnimation on rotation { from: 0; to: 360; duration: 10000; repeat: true } Image { source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter transformOrigin: Item.Center; rotation: -3 * parent.rotation @@ -44,7 +44,7 @@ Item { x: 0; y: parent.height/2; width: parent.width; height: parent.height/2 source: "images/star.png"; angleDeviation: 360; velocity: 0 velocityDeviation: 0; count: parent.width / 10; fadeInDuration: 2800 - opacity: SequentialAnimation { + SequentialAnimation on opacity { repeat: true NumberAnimation { from: 0; to: 1; duration: 5000 } NumberAnimation { from: 1; to: 0; duration: 5000 } @@ -58,7 +58,7 @@ Item { gradient: Gradient { GradientStop { position: 0.0 - color: SequentialAnimation { + SequentialAnimation on color { repeat: true ColorAnimation { from: "ForestGreen"; to: "#001600"; duration: 5000 } ColorAnimation { from: "#001600"; to: "ForestGreen"; duration: 5000 } diff --git a/examples/declarative/animations/property-animation.qml b/examples/declarative/animations/property-animation.qml index 537ee26..4428f34 100644 --- a/examples/declarative/animations/property-animation.qml +++ b/examples/declarative/animations/property-animation.qml @@ -42,7 +42,7 @@ Item { // Animate the y property. Setting repeat to true makes the // animation repeat indefinitely, otherwise it would only run once. - y: SequentialAnimation { + SequentialAnimation on y { repeat: true // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 90ea516..79e99e9 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -18,7 +18,7 @@ Rectangle { source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 - scale: SpringFollow { + SpringFollow on scale { source: Math.max(Math.min(face.parent.width/face.width*1.333,face.parent.height/face.height), Math.min(face.parent.width/face.width,face.parent.height/face.height*1.333)) spring: 1 diff --git a/examples/declarative/behaviours/behavior.qml b/examples/declarative/behaviours/behavior.qml index 2732c0a..c84bf62 100644 --- a/examples/declarative/behaviours/behavior.qml +++ b/examples/declarative/behaviours/behavior.qml @@ -50,12 +50,12 @@ Rectangle { radius: 5 border.width: 10; border.color: "white"; x: 100-37; y: 100-25 - x: Behavior { NumberAnimation { duration: 300 } } - y: Behavior { NumberAnimation { duration: 300 } } + Behavior on x { NumberAnimation { duration: 300 } } + Behavior on y { NumberAnimation { duration: 300 } } Text { id: focusText text: focusRect.text; - text: Behavior { + Behavior on text { SequentialAnimation { NumberAnimation { target: focusText; property: "opacity"; to: 0; duration: 150 } PropertyAction {} diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml deleted file mode 100644 index 8fffd59..0000000 --- a/examples/declarative/behaviours/test.qml +++ /dev/null @@ -1,102 +0,0 @@ -import Qt 4.6 - -Rectangle { - color: "lightsteelblue" - width: 800 - height: 600 - id: page - MouseArea { - anchors.fill: parent - onClicked: { bluerect.parent = page; console.log(mouseX); bluerect.x = mouseX; } - } - MyRect { - color: "green" - x: 200 - y: 200 - } - MyRect { - color: "red" - x: 400 - y: 200 - } - MyRect { - color: "yellow" - x: 400 - y: 400 - } - MyRect { - color: "orange" - x: 400 - y: 500 - } - MyRect { - color: "pink" - x: 400 - y: 0 - } - MyRect { - color: "lightsteelblue" - x: 100 - y: 500 - } - MyRect { - color: "black" - x: 0 - y: 200 - } - MyRect { - color: "white" - x: 400 - y: 0 - } - Rectangle { - color: "blue" - x: 0 - y: 0 - width: 100 - height: 100 - id: bluerect - x: Behavior { - ParallelAnimation { - SequentialAnimation { - NumberAnimation { - target: bluerect - property: "y" - from: 0 - to: 10 - easing.type: "OutBounce" - easing.amplitude: 30 - duration: 250 - } - NumberAnimation { - target: bluerect - property: "y" - from: 10 - to: 0 - easing.type: "OutBounce" - easing.amplitude: 30 - duration: 250 - } - } - NumberAnimation { duration: 500 } - } - } - parent: Behavior { - SequentialAnimation { - NumberAnimation { - target: bluerect - property: "opacity" - to: 0 - duration: 150 - } - PropertyAction {} - NumberAnimation { - target: bluerect - property: "opacity" - to: 1 - duration: 150 - } - } - } - } -} diff --git a/examples/declarative/border-image/content/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml index ca886e9..5621e18 100644 --- a/examples/declarative/border-image/content/MyBorderImage.qml +++ b/examples/declarative/border-image/content/MyBorderImage.qml @@ -17,13 +17,13 @@ Item { BorderImage { id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2 - width: SequentialAnimation { + SequentialAnimation on width { repeat: true NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"} NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" } } - height: SequentialAnimation { + SequentialAnimation on height { repeat: true NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"} NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" } diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index 0c6836f..75a1cf5 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -34,7 +34,7 @@ Item { transform: Rotation { id: hourRotation origin.x: 7.5; origin.y: 73; angle: 0 - angle: SpringFollow { + SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 source: (clock.hours * 30) + (clock.minutes * 0.5) } @@ -48,7 +48,7 @@ Item { transform: Rotation { id: minuteRotation origin.x: 6.5; origin.y: 83; angle: 0 - angle: SpringFollow { + SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 source: clock.minutes * 6 } @@ -62,7 +62,7 @@ Item { transform: Rotation { id: secondRotation origin.x: 2.5; origin.y: 80; angle: 0 - angle: SpringFollow { + SpringFollow on angle { spring: 5; damping: 0.25; modulus: 360 source: clock.seconds * 6 } diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml index 4692343..c35bda5 100644 --- a/examples/declarative/connections/connections.qml +++ b/examples/declarative/connections/connections.qml @@ -10,7 +10,7 @@ Rectangle { Image { id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center rotation: window.angle - rotation: Behavior { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } + Behavior on rotation { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } } Button { diff --git a/examples/declarative/dial/content/Dial.qml b/examples/declarative/dial/content/Dial.qml index 6fd0f39..ad4717a 100644 --- a/examples/declarative/dial/content/Dial.qml +++ b/examples/declarative/dial/content/Dial.qml @@ -26,7 +26,7 @@ Item { id: needleRotation origin.x: 7; origin.y: 65 angle: -130 - angle: SpringFollow { + SpringFollow on angle { spring: 1.4 damping: .15 source: Math.min(Math.max(-130, root.value*2.6 - 130), 133) diff --git a/examples/declarative/effects/effects.qml b/examples/declarative/effects/effects.qml index 0674433..997d7de 100644 --- a/examples/declarative/effects/effects.qml +++ b/examples/declarative/effects/effects.qml @@ -11,7 +11,7 @@ Rectangle { source: "pic.png" effect: Blur { - blurRadius: NumberAnimation { + NumberAnimation on blurRadius { id: blurEffect running: false from: 0; to: 10 @@ -33,7 +33,7 @@ Rectangle { effect: DropShadow { blurRadius: 3 offset.x: 3 - offset.y: NumberAnimation { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; repeat: true; } + NumberAnimation on offset.y { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; repeat: true; } } MouseArea { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running } diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml index ec3717f..ab0f81c 100644 --- a/examples/declarative/fillmode/fillmode.qml +++ b/examples/declarative/fillmode/fillmode.qml @@ -4,7 +4,7 @@ Image { width: 400 height: 250 source: "face.png" - fillMode: SequentialAnimation { + SequentialAnimation on fillMode { repeat: true PropertyAction { value: Image.Stretch } PropertyAction { target: label; property: "text"; value: "Stretch" } diff --git a/examples/declarative/fonts/banner.qml b/examples/declarative/fonts/banner.qml index 00b8660..7989f80 100644 --- a/examples/declarative/fonts/banner.qml +++ b/examples/declarative/fonts/banner.qml @@ -10,7 +10,7 @@ Rectangle { Row { y: -screen.height / 4.5 - x: NumberAnimation { from: 0; to: -text.width; duration: 6000; repeat: true } + NumberAnimation on x { from: 0; to: -text.width; duration: 6000; repeat: true } Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } diff --git a/examples/declarative/fonts/hello.qml b/examples/declarative/fonts/hello.qml index fcc9580..334409e 100644 --- a/examples/declarative/fonts/hello.qml +++ b/examples/declarative/fonts/hello.qml @@ -9,7 +9,7 @@ Rectangle { id: text; color: "white"; anchors.centerIn: parent text: "Hello world!"; font.pixelSize: 60 - font.letterSpacing: SequentialAnimation { + SequentialAnimation on font.letterSpacing { repeat: true; NumberAnimation { from: 100; to: 300; easing.type: "InQuad"; duration: 3000 } ScriptAction { script: { @@ -17,7 +17,7 @@ Rectangle { container.x = (screen.width / 4) + (Math.random() * screen.width / 2) } } } - opacity: SequentialAnimation { + SequentialAnimation on opacity { repeat: true; NumberAnimation { from: 1; to: 0; duration: 2600 } PauseAnimation { duration: 400 } diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml index 7146702..bce53bd 100644 --- a/examples/declarative/layouts/positioners.qml +++ b/examples/declarative/layouts/positioners.qml @@ -21,11 +21,11 @@ Rectangle { } Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueV1; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueV2; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 } } @@ -45,11 +45,11 @@ Rectangle { } Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } Rectangle { id: blueH1; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } Rectangle { id: blueH2; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } } @@ -113,15 +113,15 @@ Rectangle { Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueG1; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueG2; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueG3; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } @@ -147,15 +147,15 @@ Rectangle { } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueF1; color: "lightsteelblue"; width: 60; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueF2; color: "lightsteelblue"; width: 60; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { id: blueF3; color: "lightsteelblue"; width: 40; height: 50; border.color: "black"; radius: 15 - opacity: Behavior{NumberAnimation{}} + Behavior on opacity {NumberAnimation{}} } Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 } } diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml index 0850f4e..5240e65 100644 --- a/examples/declarative/listview/content/ClickAutoRepeating.qml +++ b/examples/declarative/listview/content/ClickAutoRepeating.qml @@ -10,7 +10,7 @@ Item { signal released signal clicked - isPressed: SequentialAnimation { + SequentialAnimation on isPressed { running: false id: autoRepeat PropertyAction { target: page; property: "isPressed"; value: true } diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index be1f62d..5e4911d 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -44,7 +44,7 @@ Rectangle { id: petHighlight Rectangle { width: 200; height: 50; color: "#FFFF88" - y: SpringFollow { source: list1.currentItem.y; spring: 3; damping: 0.1 } + SpringFollow on y { source: list1.currentItem.y; spring: 3; damping: 0.1 } } } ListView { diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml index 81eadda..4442d5e 100644 --- a/examples/declarative/parallax/qml/Smiley.qml +++ b/examples/declarative/parallax/qml/Smiley.qml @@ -24,7 +24,7 @@ Item { // Animate the y property. Setting repeat to true makes the // animation repeat indefinitely, otherwise it would only run once. - y: SequentialAnimation { + SequentialAnimation on y { repeat: true // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function diff --git a/examples/declarative/progressbar/content/ProgressBar.qml b/examples/declarative/progressbar/content/ProgressBar.qml index bfc801c..65c80b2 100644 --- a/examples/declarative/progressbar/content/ProgressBar.qml +++ b/examples/declarative/progressbar/content/ProgressBar.qml @@ -21,7 +21,7 @@ Item { id: highlight; radius: 1 anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3 - width: EaseFollow { source: highlight.widthDest; velocity: 1200 } + EaseFollow on width { source: highlight.widthDest; velocity: 1200 } gradient: Gradient { GradientStop { id: g1; position: 0.0 } GradientStop { id: g2; position: 1.0 } diff --git a/examples/declarative/progressbar/progressbars.qml b/examples/declarative/progressbar/progressbars.qml index 6530c3d..a66d544 100644 --- a/examples/declarative/progressbar/progressbars.qml +++ b/examples/declarative/progressbar/progressbars.qml @@ -14,9 +14,9 @@ Rectangle { ProgressBar { property int r: Math.floor(Math.random() * 5000 + 1000) width: main.width - 20 - value: NumberAnimation { duration: r; from: 0; to: 100; repeat: true } - color: ColorAnimation { duration: r; from: "lightsteelblue"; to: "thistle"; repeat: true } - secondColor: ColorAnimation { duration: r; from: "steelblue"; to: "#CD96CD"; repeat: true } + NumberAnimation on value { duration: r; from: 0; to: 100; repeat: true } + ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; repeat: true } + ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; repeat: true } } } } diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml deleted file mode 100644 index c2a2674..0000000 --- a/examples/declarative/snow/ImageBatch.qml +++ /dev/null @@ -1,72 +0,0 @@ -import Qt 4.6 - -GridView { - id: grid - property int offset: 0 - property var ref - property bool isSelected: ref.selectedItemColumn >= offset && ref.selectedItemColumn < offset + 5 - - currentIndex: (ref.selectedItemColumn - offset) + ref.selectedItemRow * 5 - - property int imageWidth: ref.imageWidth - property int imageHeight: ref.imageHeight - - width: 5 * imageWidth - height: 4 * imageHeight - cellWidth: imageWidth - cellHeight: imageHeight - - states: State { - name: "selected"; when: grid.isSelected - PropertyChanges { target: grid; z: 150 } - } - transitions: Transition { - SequentialAnimation { - PauseAnimation { duration: 150 } - PropertyAction { properties: "z" } - } - } - model: XmlListModel { - property string tags : "" - source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "")+"format=rss2" - query: "/rss/channel/item" - namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" - - XmlRole { name: "url"; query: "media:content/@url/string()" } - } - - delegate: Item { - id: root - property bool isSelected: GridView.isCurrentItem && grid.isSelected - transformOrigin: Item.Center - width: grid.imageWidth; height: grid.imageHeight; - - Image { id: flickrImage; source: url; fillMode: Image.PreserveAspectFit; smooth: true; anchors.fill: parent; - opacity: (status == Image.Ready)?1:0; opacity: Behavior { NumberAnimation { } } } - Loading { anchors.centerIn: parent; visible: flickrImage.status!=1 } - - states: State { - name: "selected" - when: root.isSelected - PropertyChanges { target: root; scale: 3; z: 100 } - } - transitions: [ - Transition { - to: "selected" - SequentialAnimation { - PauseAnimation { duration: 150 } - PropertyAction { properties: "z" } - NumberAnimation { properties: "scale"; duration: 150; } - } - }, - Transition { - from: "selected" - SequentialAnimation { - NumberAnimation { properties: "scale"; duration: 150 } - PropertyAction { properties: "z" } - } - } - ] - } -} - diff --git a/examples/declarative/snow/Loading.qml b/examples/declarative/snow/Loading.qml deleted file mode 100644 index 238d9c7..0000000 --- a/examples/declarative/snow/Loading.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Qt 4.6 - -Image { - id: loading; source: "pics/loading.png"; transformOrigin: Item.Center - rotation: NumberAnimation { - id: rotationAnimation; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 - } -} diff --git a/examples/declarative/snow/create.js b/examples/declarative/snow/create.js deleted file mode 100644 index 2bdae4a..0000000 --- a/examples/declarative/snow/create.js +++ /dev/null @@ -1,12 +0,0 @@ -var myComponent = null; - -function createNewBlock() { - if (myComponent == null) - myComponent = createComponent("ImageBatch.qml"); - - var obj = myComponent.createObject(); - obj.parent = layout; - obj.offset = maximumColumn + 1; - obj.ref = imagePanel; - maximumColumn += 5; -} diff --git a/examples/declarative/snow/pics/loading.png b/examples/declarative/snow/pics/loading.png deleted file mode 100644 index 0296cfe..0000000 Binary files a/examples/declarative/snow/pics/loading.png and /dev/null differ diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml deleted file mode 100644 index 39c9c43..0000000 --- a/examples/declarative/snow/snow.qml +++ /dev/null @@ -1,69 +0,0 @@ -import Qt 4.6 - -Rectangle { - id: imagePanel - width: 1024 - height: 768 - color: "black" - - property int maximumColumn: 4 - property int selectedItemRow: 0 - property int selectedItemColumn: 0 - - Script { source: "create.js" } - - onSelectedItemColumnChanged: if (selectedItemColumn == maximumColumn) createNewBlock(); - - property int imageWidth: 200 - property int imageHeight: 200 - - property int selectedX: selectedItemColumn * imageWidth - property int selectedY: selectedItemRow * imageHeight - - Item { - anchors.centerIn: parent - Row { - id: layout - property real targetX: -(selectedX + imageWidth / 2) - - property real targetDeform: 0 - property bool slowDeform: true - - property real deform: 0 - deform: SpringFollow { - id: deformFollow; source: layout.targetDeform; velocity: layout.slowDeform?0.1:2 - onSyncChanged: if(inSync) { layout.slowDeform = true; layout.targetDeform = 0; } - } - - ImageBatch { offset: 0; ref: imagePanel } - - x: SpringFollow { source: layout.targetX; velocity: 1000 } - y: SpringFollow { source: -(selectedY + imageHeight / 2); velocity: 500 } - } - - transform: Rotation { - axis.y: 1; axis.z: 0 - angle: layout.deform * -100 - } - } - - Script { - function left() { - if (selectedItemColumn <= 0) return; - selectedItemColumn -= 1; - layout.slowDeform = false; - layout.targetDeform = Math.max(Math.min(layout.deform - 0.1, -0.1), -0.4); - } - function right() { - selectedItemColumn += 1; - layout.slowDeform = false; - layout.targetDeform = Math.min(Math.max(layout.deform + 0.1, 0.1), 0.4); - } - } - - focus: true - Keys.onLeftPressed: "left()" - Keys.onRightPressed: "right()" - Keys.onUpPressed: "if (selectedItemRow > 0) selectedItemRow = selectedItemRow - 1" - Keys.onDownPressed: "if (selectedItemRow < 3) selectedItemRow = selectedItemRow + 1" -} diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml index 9d35832..36178ec 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml @@ -14,7 +14,7 @@ Rectangle { signal closed(); color: "white"; border.width: 1; width: myText.width + 20; height: 60; opacity: 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index 4c2ba43..1e3a0ed 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -8,8 +8,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } //![1] //![2] @@ -24,7 +24,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } + Behavior on opacity { NumberAnimation { properties:"opacity"; duration: 200 } } anchors.fill: parent } //![2] diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index ed9fd32..831c03b 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -13,7 +13,7 @@ Rectangle { signal closed(); color: "white"; border.width: 1; width: myText.width + 20; height: 60; opacity: 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index 4bd5319..1585c7b 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -16,7 +16,7 @@ Rectangle { x: 20; width: 20; height: 20; z: 1 // Move the ball to the right and back to the left repeatedly - x: SequentialAnimation { + SequentialAnimation on x { repeat: true NumberAnimation { to: page.width - 40; duration: 2000 } ScriptAction { script: Qt.playSound('paddle.wav') } @@ -27,7 +27,7 @@ Rectangle { } // Make y follow the target y coordinate, with a velocity of 200 - y: SpringFollow { source: ball.targetY; velocity: 200 } + SpringFollow on y { source: ball.targetY; velocity: 200 } // Detect the ball hitting the top or bottom of the view and bounce it onYChanged: { @@ -47,7 +47,7 @@ Rectangle { id: leftBat color: "Lime" x: 2; width: 20; height: 90 - y: SpringFollow { + SpringFollow on y { source: ball.y - 45; velocity: 300 enabled: ball.direction == 'left' } @@ -56,7 +56,7 @@ Rectangle { id: rightBat color: "Lime" x: page.width - 22; width: 20; height: 90 - y: SpringFollow { + SpringFollow on y { source: ball.y-45; velocity: 300 enabled: ball.direction == 'right' } diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index c39f99b..7424f60 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -24,7 +24,7 @@ Rectangle { id: stickyPage x: Math.random() * 200 + 100 y: Math.random() * 300 + 50 - rotation: SpringFollow { + SpringFollow on rotation { source: -flickable.horizontalVelocity / 100 spring: 2.0; damping: 0.1 } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 5da207d..a9809c0 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -718,6 +718,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) BindingContext objCtxt(obj); // Create the synthesized meta object, ignoring aliases + COMPILE_CHECK(checkDynamicMeta(obj)); COMPILE_CHECK(mergeDynamicMetaProperties(obj)); COMPILE_CHECK(buildDynamicMeta(obj, IgnoreAliases)); @@ -1623,6 +1624,10 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p for (int ii = 0; ii < prop->values.count(); ++ii) { QDeclarativeParser::Value *v = prop->values.at(ii); + Q_ASSERT(v->type == Value::CreatedObject || + v->type == Value::PropertyBinding || + v->type == Value::Literal); + if (v->type == Value::CreatedObject) { genObject(v->object); @@ -1652,7 +1657,27 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p output->bytecode << store; } - } else if (v->type == Value::ValueSource) { + } else if (v->type == Value::PropertyBinding) { + + genBindingAssignment(v, prop, obj, valueTypeProperty); + + } else if (v->type == Value::Literal) { + + QMetaProperty mp = obj->metaObject()->property(prop->index); + genLiteralAssignment(mp, v); + + } + + } + + for (int ii = 0; ii < prop->onValues.count(); ++ii) { + + QDeclarativeParser::Value *v = prop->onValues.at(ii); + + Q_ASSERT(v->type == Value::ValueSource || + v->type == Value::ValueInterceptor); + + if (v->type == Value::ValueSource) { genObject(v->object); QDeclarativeInstruction store; @@ -1685,16 +1710,6 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p QDeclarativeType *valueType = toQmlType(v->object); store.assignValueInterceptor.castValue = valueType->propertyValueInterceptorCast(); output->bytecode << store; - - } else if (v->type == Value::PropertyBinding) { - - genBindingAssignment(v, prop, obj, valueTypeProperty); - - } else if (v->type == Value::Literal) { - - QMetaProperty mp = obj->metaObject()->property(prop->index); - genLiteralAssignment(mp, v); - } } @@ -1793,8 +1808,8 @@ bool QDeclarativeCompiler::buildAttachedProperty(QDeclarativeParser::Property *p // } // font is a nested property. pointSize and family are not. bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + const BindingContext &ctxt) { Q_ASSERT(prop->type != 0); Q_ASSERT(prop->index != -1); @@ -1829,9 +1844,9 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr } bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, - QDeclarativeParser::Object *obj, - QDeclarativeParser::Object *baseObj, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + QDeclarativeParser::Object *baseObj, + const BindingContext &ctxt) { if (obj->defaultProperty) COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Invalid property use")); @@ -1848,37 +1863,36 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, if (prop->value) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Property assignment expected")); - if (prop->values.count() != 1) + if (prop->values.count() > 1) { COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Single property assignment expected")); + } else if (prop->values.count()) { + Value *value = prop->values.at(0); - Value *value = prop->values.at(0); - - if (value->object) { - bool isPropertyValue = output->types.at(value->object->type).type->propertyValueSourceCast() != -1; - bool isPropertyInterceptor = output->types.at(value->object->type).type->propertyValueInterceptorCast() != -1; - if (!isPropertyValue && !isPropertyInterceptor) { + if (value->object) { COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Unexpected object assignment")); - } else { - COMPILE_CHECK(buildObject(value->object, ctxt)); - - if (isPropertyInterceptor && baseObj->synthdata.isEmpty()) - buildDynamicMeta(baseObj, ForceCreation); - value->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; + } else if (value->value.isScript()) { + // ### Check for writability + BindingReference reference; + reference.expression = value->value; + reference.property = prop; + reference.value = value; + reference.bindingContext = ctxt; + reference.bindingContext.owner++; + addBindingReference(reference); + value->type = Value::PropertyBinding; + } else { + COMPILE_CHECK(testLiteralAssignment(p, value)); + value->type = Value::Literal; } - } else if (value->value.isScript()) { - // ### Check for writability - BindingReference reference; - reference.expression = value->value; - reference.property = prop; - reference.value = value; - reference.bindingContext = ctxt; - reference.bindingContext.owner++; - addBindingReference(reference); - value->type = Value::PropertyBinding; - } else { - COMPILE_CHECK(testLiteralAssignment(p, value)); - value->type = Value::Literal; } + + for (int ii = 0; ii < prop->onValues.count(); ++ii) { + Value *v = prop->onValues.at(ii); + Q_ASSERT(v->object); + + COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, baseObj, v, ctxt)); + } + obj->addValueProperty(prop); } @@ -1886,13 +1900,11 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, } // Build assignments to QML lists. QML lists are properties of type -// QList * and QDeclarativeList *. -// -// QList * types can accept a list of objects, or a single binding -// QDeclarativeList * types can accept a list of objects +// QDeclarativeListProperty. List properties can accept a list of +// objects, or a single binding. bool QDeclarativeCompiler::buildListProperty(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + const BindingContext &ctxt) { Q_ASSERT(QDeclarativeEnginePrivate::get(engine)->isList(prop->type)); @@ -1950,20 +1962,6 @@ bool QDeclarativeCompiler::buildScriptStringProperty(QDeclarativeParser::Propert } // Compile regular property assignments of the form "property: " -// -// ### The following problems exist -// -// There is no distinction between how "lists" of values are specified. This -// Item { -// children: Item {} -// children: Item {} -// } -// is identical to -// Item { -// children: [ Item {}, Item {} ] -// } -// -// We allow assignming multiple values to single value properties bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, const BindingContext &ctxt) @@ -1983,14 +1981,21 @@ bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property } } + for (int ii = 0; ii < prop->onValues.count(); ++ii) { + Value *v = prop->onValues.at(ii); + + Q_ASSERT(v->object); + COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, obj, v, ctxt)); + } + return true; } // Compile assigning a single object instance to a regular property bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - QDeclarativeParser::Value *v, - const BindingContext &ctxt) + QDeclarativeParser::Object *obj, + QDeclarativeParser::Value *v, + const BindingContext &ctxt) { Q_ASSERT(prop->index != -1); Q_ASSERT(v->object->type != -1); @@ -2019,15 +2024,6 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro v->object->metatype = output->types.at(v->object->type).metaObject(); Q_ASSERT(v->object->metaObject()); - // Will be true if the assigned type inherits QDeclarativePropertyValueSource - bool isPropertyValue = false; - // Will be true if the assigned type inherits QDeclarativePropertyValueInterceptor - bool isPropertyInterceptor = false; - if (QDeclarativeType *valueType = toQmlType(v->object)) { - isPropertyValue = valueType->propertyValueSourceCast() != -1; - isPropertyInterceptor = valueType->propertyValueInterceptorCast() != -1; - } - // We want to raw metaObject here as the raw metaobject is the // actual property type before we applied any extensions that might // effect the properties on the type, but don't effect assignability @@ -2063,13 +2059,6 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro component->getDefaultProperty()->addValue(componentValue); v->object = component; COMPILE_CHECK(buildPropertyObjectAssignment(prop, obj, v, ctxt)); - } else if (isPropertyValue || isPropertyInterceptor) { - // Assign as a property value source - COMPILE_CHECK(buildObject(v->object, ctxt)); - - if (isPropertyInterceptor && prop->parent->synthdata.isEmpty()) - buildDynamicMeta(prop->parent, ForceCreation); - v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; } else { COMPILE_EXCEPTION(v->object, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign object to property")); } @@ -2078,6 +2067,55 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro return true; } +// Compile assigning a single object instance to a regular property using the "on" syntax. +// +// For example: +// Item { +// NumberAnimation on x { } +// } +bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Property *prop, + QDeclarativeParser::Object *obj, + QDeclarativeParser::Object *baseObj, + QDeclarativeParser::Value *v, + const BindingContext &ctxt) +{ + Q_ASSERT(prop->index != -1); + Q_ASSERT(v->object->type != -1); + + if (!obj->metaObject()->property(prop->index).isWritable()) + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + + + // Normally buildObject() will set this up, but we need the static + // meta object earlier to test for assignability. It doesn't matter + // that there may still be outstanding synthesized meta object changes + // on this type, as they are not relevant for assignability testing + v->object->metatype = output->types.at(v->object->type).metaObject(); + Q_ASSERT(v->object->metaObject()); + + // Will be true if the assigned type inherits QDeclarativePropertyValueSource + bool isPropertyValue = false; + // Will be true if the assigned type inherits QDeclarativePropertyValueInterceptor + bool isPropertyInterceptor = false; + if (QDeclarativeType *valueType = toQmlType(v->object)) { + isPropertyValue = valueType->propertyValueSourceCast() != -1; + isPropertyInterceptor = valueType->propertyValueInterceptorCast() != -1; + } + + if (isPropertyValue || isPropertyInterceptor) { + // Assign as a property value source + COMPILE_CHECK(buildObject(v->object, ctxt)); + + if (isPropertyInterceptor && prop->parent->synthdata.isEmpty()) + buildDynamicMeta(baseObj, ForceCreation); + v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; + } else { + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" cannot operate on \"%2\"").arg(v->object->typeName.constData()).arg(prop->name.constData())); + } + + return true; +} + // Compile assigning a literal or binding to a regular property bool QDeclarativeCompiler::buildPropertyLiteralAssignment(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, @@ -2203,10 +2241,13 @@ bool QDeclarativeCompiler::mergeDynamicMetaProperties(QDeclarativeParser::Object continue; Property *property = 0; - if (p.isDefaultProperty) + if (p.isDefaultProperty) { property = obj->getDefaultProperty(); - else + } else { property = obj->getProperty(p.name); + if (!property->values.isEmpty()) + COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Property value set multiple times")); + } if (property->value) COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Invalid property nesting")); @@ -2233,8 +2274,6 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn obj->dynamicSlots.isEmpty()) return true; - COMPILE_CHECK(checkDynamicMeta(obj)); - QByteArray dynamicData(sizeof(QDeclarativeVMEMetaData), (char)0); QByteArray newClassName = obj->metatype->className(); diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 2ea3366..93a3f83 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -219,6 +219,11 @@ private: QDeclarativeParser::Object *obj, QDeclarativeParser::Value *value, const BindingContext &ctxt); + bool buildPropertyOnAssignment(QDeclarativeParser::Property *prop, + QDeclarativeParser::Object *obj, + QDeclarativeParser::Object *baseObj, + QDeclarativeParser::Value *value, + const BindingContext &ctxt); bool buildPropertyLiteralAssignment(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, QDeclarativeParser::Value *value, diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 6c81f34..5b43109 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -374,7 +374,10 @@ QDeclarativeDomValue QDeclarativeDomProperty::value() const QDeclarativeDomValue rv; if (d->property) { rv.d->property = d->property; - rv.d->value = d->property->values.at(0); + if (d->property->values.count()) + rv.d->value = d->property->values.at(0); + else + rv.d->value = d->property->onValues.at(0); rv.d->property->addref(); rv.d->value->addref(); } @@ -1346,7 +1349,7 @@ QDeclarativeDomValue::Type QDeclarativeDomValue::type() const { if (d->property) if (QDeclarativeMetaType::isList(d->property->type) || - (d->property && d->property->values.count() > 1)) + (d->property && (d->property->values.count() + d->property->onValues.count()) > 1)) return List; QDeclarativeParser::Value *value = d->value; @@ -1628,6 +1631,13 @@ QList QDeclarativeDomList::values() const rv << v; } + for (int ii = 0; ii < d->property->onValues.count(); ++ii) { + QDeclarativeDomValue v; + v.d->value = d->property->onValues.at(ii); + v.d->value->addref(); + rv << v; + } + return rv; } diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp index 5ac49d5..0e3d856 100644 --- a/src/declarative/qml/qdeclarativeparser.cpp +++ b/src/declarative/qml/qdeclarativeparser.cpp @@ -221,6 +221,8 @@ QDeclarativeParser::Property::~Property() { foreach(Value *value, values) value->release(); + foreach(Value *value, onValues) + value->release(); if (value) value->release(); } @@ -235,9 +237,14 @@ void QDeclarativeParser::Property::addValue(Value *v) values << v; } +void QDeclarativeParser::Property::addOnValue(Value *v) +{ + onValues << v; +} + bool QDeclarativeParser::Property::isEmpty() const { - return !value && values.isEmpty(); + return !value && values.isEmpty() && onValues.isEmpty(); } QDeclarativeParser::Value::Value() diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index aae507e..d0d7de1 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -320,6 +320,7 @@ namespace QDeclarativeParser Object *getValue(); void addValue(Value *v); + void addOnValue(Value *v); // The QVariant::Type of the property, or 0 (QVariant::Invalid) if // unknown. @@ -333,6 +334,8 @@ namespace QDeclarativeParser // The list of values assigned to this property. Content in values // and value are mutually exclusive QList values; + // The list of values assigned to this property using the "on" syntax + QList onValues; // The accessed property. This is used to represent dot properties. // Content in value and values are mutually exclusive. Object *value; diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index f4c9cdd..a4b3668 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -106,12 +106,12 @@ public: void operator()(const QString &code, AST::Node *node); protected: - Object *defineObjectBinding(AST::UiQualifiedId *propertyName, + Object *defineObjectBinding(AST::UiQualifiedId *propertyName, bool onAssignment, AST::UiQualifiedId *objectTypeName, LocationSpan location, AST::UiObjectInitializer *initializer = 0); - Object *defineObjectBinding_helper(AST::UiQualifiedId *propertyName, + Object *defineObjectBinding_helper(AST::UiQualifiedId *propertyName, bool onAssignment, const QString &objectType, AST::SourceLocation typeLocation, LocationSpan location, @@ -243,6 +243,7 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const Object * ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, + bool onAssignment, const QString &objectType, AST::SourceLocation typeLocation, LocationSpan location, @@ -254,10 +255,19 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, (lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper())); int propertyCount = 0; - for (; propertyName; propertyName = propertyName->next){ + for (AST::UiQualifiedId *name = propertyName; name; name = name->next){ ++propertyCount; - _stateStack.pushProperty(propertyName->name->asString(), - this->location(propertyName)); + _stateStack.pushProperty(name->name->asString(), + this->location(name)); + } + + if (!onAssignment && propertyCount && currentProperty() && currentProperty()->values.count()) { + QDeclarativeError error; + error.setDescription(QCoreApplication::translate("QDeclarativeParser","Property value set multiple times")); + error.setLine(this->location(propertyName).start.line); + error.setColumn(this->location(propertyName).start.column); + _parser->_errors << error; + return 0; } if (!isType) { @@ -327,7 +337,10 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, Value *v = new Value; v->object = obj; v->location = obj->location; - prop->addValue(v); + if (onAssignment) + prop->addOnValue(v); + else + prop->addValue(v); while (propertyCount--) _stateStack.pop(); @@ -363,7 +376,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, } } -Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, +Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, bool onAssignment, AST::UiQualifiedId *objectTypeName, LocationSpan location, AST::UiObjectInitializer *initializer) @@ -395,7 +408,7 @@ Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, } - return defineObjectBinding_helper(qualifiedId, objectType, typeLocation, location, initializer); + return defineObjectBinding_helper(qualifiedId, onAssignment, objectType, typeLocation, location, initializer); } LocationSpan ProcessAST::location(AST::UiQualifiedId *id) @@ -623,7 +636,7 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node) LocationSpan l = location(node->firstSourceLocation(), node->lastSourceLocation()); - defineObjectBinding(/*propertyName = */ 0, + defineObjectBinding(/*propertyName = */ 0, false, node->qualifiedTypeNameId, l, node->initializer); @@ -638,7 +651,7 @@ bool ProcessAST::visit(AST::UiObjectBinding *node) LocationSpan l = location(node->qualifiedTypeNameId->identifierToken, node->initializer->rbraceToken); - defineObjectBinding(node->qualifiedId, + defineObjectBinding(node->qualifiedId, node->hasOnToken, node->qualifiedTypeNameId, l, node->initializer); @@ -674,14 +687,23 @@ bool ProcessAST::visit(AST::UiScriptBinding *node) { int propertyCount = 0; AST::UiQualifiedId *propertyName = node->qualifiedId; - for (; propertyName; propertyName = propertyName->next){ + for (AST::UiQualifiedId *name = propertyName; name; name = name->next){ ++propertyCount; - _stateStack.pushProperty(propertyName->name->asString(), - location(propertyName)); + _stateStack.pushProperty(name->name->asString(), + location(name)); } Property *prop = currentProperty(); + if (prop->values.count()) { + QDeclarativeError error; + error.setDescription(QCoreApplication::translate("QDeclarativeParser","Property value set multiple times")); + error.setLine(this->location(propertyName).start.line); + error.setColumn(this->location(propertyName).start.column); + _parser->_errors << error; + return 0; + } + QDeclarativeParser::Variant primitive; if (AST::ExpressionStatement *stmt = AST::cast(node->statement)) { @@ -724,16 +746,26 @@ bool ProcessAST::visit(AST::UiArrayBinding *node) { int propertyCount = 0; AST::UiQualifiedId *propertyName = node->qualifiedId; - for (; propertyName; propertyName = propertyName->next){ + for (AST::UiQualifiedId *name = propertyName; name; name = name->next){ ++propertyCount; - _stateStack.pushProperty(propertyName->name->asString(), - location(propertyName)); + _stateStack.pushProperty(name->name->asString(), + location(name)); + } + + Property* prop = currentProperty(); + + if (prop->values.count()) { + QDeclarativeError error; + error.setDescription(QCoreApplication::translate("QDeclarativeParser","Property value set multiple times")); + error.setLine(this->location(propertyName).start.line); + error.setColumn(this->location(propertyName).start.column); + _parser->_errors << error; + return 0; } accept(node->members); // For the DOM, store the position of the T_LBRACKET upto the T_RBRACKET as the range: - Property* prop = currentProperty(); prop->listValueRange.offset = node->lbracketToken.offset; prop->listValueRange.length = node->rbracketToken.offset + node->rbracketToken.length - node->lbracketToken.offset; diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 6160e7c..106a4e0 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -190,7 +190,6 @@ void tst_examples::examples() << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; QProcess p; -qDebug() << qmlruntime << arguments; p.start(qmlruntime, arguments); QVERIFY(p.waitForFinished()); QCOMPARE(p.exitStatus(), QProcess::NormalExit); diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml index 6381df3..2629cf4 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml @@ -7,6 +7,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: PropertyAnimation { from: "blue"; to: "green"; } + PropertyAnimation on x { from: "blue"; to: "green"; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml index 8d57e41..1543a2a 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml @@ -7,6 +7,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { from: "blue"; to: "green"; } + NumberAnimation on x { from: "blue"; to: "green"; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml index c4867c3..aa98c33 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml @@ -5,7 +5,7 @@ Rectangle { height: 320 Rectangle { color: "red" - color: ColorAnimation { from: 10; to: 15; } + ColorAnimation on color { from: 10; to: 15; } width: 50; height: 50 x: 100; y: 100 } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml index d9660b6..3f00e68 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml @@ -9,7 +9,7 @@ Rectangle { id: redRect width: 100; height: 100 color: Qt.rgba(1,0,0) - x: Behavior { + Behavior on x { NumberAnimation { objectName: "MyAnim"; target: redRect; property: "y"; to: 300; repeat: true} } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml index 36417db..efed058 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml @@ -9,7 +9,7 @@ Rectangle { id: redRect width: 100; height: 100 color: Qt.rgba(1,0,0) - x: SequentialAnimation { + SequentialAnimation on x { running: false NumberAnimation { objectName: "MyAnim"; running: true } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml index 7e73f57..4437815 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { to: 200 } + NumberAnimation on x { to: 200 } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml index 6c96155..b1f2020 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { targets: theRect; properties: "x"; to: 200; } + NumberAnimation on x { targets: theRect; properties: "x"; to: 200; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml index ff08885..0a0ed6f 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { target: theRect; property: "x"; to: 300; } + NumberAnimation on x { target: theRect; property: "x"; to: 300; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml index dab7e5f..a90f004 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { target: theRect; property: "y"; to: 200; } + NumberAnimation on x { target: theRect; property: "y"; to: 200; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml index 38396b1..7d3cec9 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { targets: theRect; properties: "y"; to: 200; } + NumberAnimation on x { targets: theRect; properties: "y"; to: 200; } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml index c35063d..2260440 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { id: anim; objectName: "MyAnim"; to: 200 } + NumberAnimation on x { id: anim; objectName: "MyAnim"; to: 200 } } } diff --git a/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml index 1a60542..36d6c72 100644 --- a/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml @@ -9,6 +9,6 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - x: NumberAnimation { id: anim; objectName: "MyAnim"; running: false; to: 200 } + NumberAnimation on x { id: anim; objectName: "MyAnim"; running: false; to: 200 } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml index 201da37..e982f21 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml @@ -9,7 +9,7 @@ Rectangle { objectName: "MyRect" width: 100; height: 100; color: "green" x: basex - x: Behavior { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml index 91dbbd1..f2f4742 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml @@ -7,7 +7,7 @@ Rectangle { objectName: "MyRect" width: 100; height: 100; color: "green" - color: Behavior { ColorAnimation { duration: 500; } } + Behavior on color { ColorAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml index 8d032f0..3ea9376 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml @@ -6,6 +6,6 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 500; } } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml index 3c7078a..1403eb9 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; enabled: false NumberAnimation { duration: 200; } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml index ba7cc9c..12b1b7b 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml @@ -9,7 +9,7 @@ Rectangle { id: redRect width: 100; height: 100 color: Qt.rgba(1,0,0) - x: Behavior { + Behavior on x { NumberAnimation { objectName: "MyAnim"; running: true } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml index 95d934a..5e30f03 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior {} + Behavior on x {} } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml index 1b2025a..ca0ea54 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; NumberAnimation { target: rect; property: "x"; duration: 500; } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml index 14883d4..a6c4ed9 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - pos: Behavior { PropertyAnimation { duration: 500; } } + Behavior on pos { PropertyAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml index b43ddbc..2dda220 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - pos.x: Behavior { NumberAnimation { duration: 500; } } + Behavior on pos.x { NumberAnimation { duration: 500; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml index 5f2c057..6187768 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { NumberAnimation { duration: 200; } } + Behavior on x { NumberAnimation { duration: 200; } } onXChanged: x = 100; } states: State { diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml index f267a05..640a7d1 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; NumberAnimation { targets: rect; properties: "y"; duration: 200; } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml index 7c7fdcb..3860ec7 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - parent: Behavior { + Behavior on parent { SequentialAnimation { PauseAnimation { duration: 500 } PropertyAction {} diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml index ba744b1..6419a6b 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior" NumberAnimation { duration: 200 } NumberAnimation { duration: 1000 } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml index a91ca88..b22441a 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml @@ -11,6 +11,6 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 500; } } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml index ac98ed0..c28fa9a 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml @@ -6,7 +6,7 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - x: Behavior { + Behavior on x { objectName: "MyBehavior"; NumberAnimation { duration: 500; } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index f87330d..0bf0b81 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -260,7 +260,7 @@ void tst_qdeclarativebehaviors::reassignedAnimation() { QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml")); - QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:12) Cannot change the animation assigned to a Behavior.").toUtf8().constData()); + QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9) Cannot change the animation assigned to a Behavior.").toUtf8().constData()); QDeclarativeRectangle *rect = qobject_cast(c.create()); QVERIFY(rect); QCOMPARE(qobject_cast( diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 9543280..6cd0bdb 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -274,7 +274,7 @@ void tst_qdeclarativedom::loadComposite() void tst_qdeclarativedom::testValueSource() { QByteArray qml = "import Qt 4.6\n" - "Rectangle { height: SpringFollow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; + "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QDeclarativeEngine freshEngine; QDeclarativeDomDocument document; @@ -306,7 +306,7 @@ void tst_qdeclarativedom::testValueSource() void tst_qdeclarativedom::testValueInterceptor() { QByteArray qml = "import Qt 4.6\n" - "Rectangle { height: Behavior { NumberAnimation { duration: 100 } } }"; + "Rectangle { Behavior on height { NumberAnimation { duration: 100 } } }"; QDeclarativeEngine freshEngine; QDeclarativeDomDocument document; @@ -823,8 +823,8 @@ void tst_qdeclarativedom::copy() " property int a: 10\n" " x: 10\n" " y: x + 10\n" - " z: NumberAnimation {}\n" - " opacity: Behavior {}\n" + " NumberAnimation on z {}\n" + " Behavior on opacity {}\n" " Component {\n" " Item{}\n" " }\n" @@ -1193,18 +1193,18 @@ void tst_qdeclarativedom::copy() void tst_qdeclarativedom::position() { QByteArray qml = "import Qt 4.6\n" - /*14*/ "Item {\n" - /*21*/ " id: myItem\n" - /*36*/ " property int a: 10\n" - /*59*/ " x: 10\n" - /*69*/ " y: x + 10\n" - /*83*/ " z: NumberAnimation {}\n" - /*109*/ " opacity: Behavior {}\n" - /*134*/ " Component {\n" - /*150*/ " Item{}\n" - /*165*/ " }\n" - /*171*/ " children: [ Item{}, Item{} ]\n" - /*204*/ "}\n"; + "Item {\n" + " id: myItem\n" + " property int a: 10\n" + " x: 10\n" + " y: x + 10\n" + " NumberAnimation on z {}\n" + " Behavior on opacity {}\n" + " Component {\n" + " Item{}\n" + " }\n" + " children: [ Item{}, Item{} ]\n" + "}\n"; QDeclarativeDomDocument document; @@ -1227,19 +1227,19 @@ void tst_qdeclarativedom::position() QCOMPARE(y.length(), 1); QDeclarativeDomProperty z = root.property("z"); - QCOMPARE(z.position(), 87); + QCOMPARE(z.position(), 106); QCOMPARE(z.length(), 1); QDeclarativeDomProperty opacity = root.property("opacity"); - QCOMPARE(opacity.position(), 113); + QCOMPARE(opacity.position(), 127); QCOMPARE(opacity.length(), 7); QDeclarativeDomProperty data = root.property("data"); - QCOMPARE(data.position(), 138); + QCOMPARE(data.position(), 142); QCOMPARE(data.length(), 0); QDeclarativeDomProperty children = root.property("children"); - QCOMPARE(children.position(), 175); + QCOMPARE(children.position(), 179); QCOMPARE(children.length(), 8); QDeclarativeDomList dataList = data.value().toList(); @@ -1249,30 +1249,30 @@ void tst_qdeclarativedom::position() // All QDeclarativeDomObject QCOMPARE(root.position(), 14); - QCOMPARE(root.length(), 191); + QCOMPARE(root.length(), 195); QDeclarativeDomObject numberAnimation = z.value().toValueSource().object(); - QCOMPARE(numberAnimation.position(), 90); - QCOMPARE(numberAnimation.length(), 18); + QCOMPARE(numberAnimation.position(), 87); + QCOMPARE(numberAnimation.length(), 23); QDeclarativeDomObject behavior = opacity.value().toValueInterceptor().object(); - QCOMPARE(behavior.position(), 122); - QCOMPARE(behavior.length(), 11); + QCOMPARE(behavior.position(), 115); + QCOMPARE(behavior.length(), 22); QDeclarativeDomObject component = dataList.values().at(0).toObject(); - QCOMPARE(component.position(), 138); + QCOMPARE(component.position(), 142); QCOMPARE(component.length(), 32); QDeclarativeDomObject componentRoot = component.toComponent().componentRoot(); - QCOMPARE(componentRoot.position(), 158); + QCOMPARE(componentRoot.position(), 162); QCOMPARE(componentRoot.length(), 6); QDeclarativeDomObject child1 = childrenList.values().at(0).toObject(); - QCOMPARE(child1.position(), 187); + QCOMPARE(child1.position(), 191); QCOMPARE(child1.length(), 6); QDeclarativeDomObject child2 = childrenList.values().at(1).toObject(); - QCOMPARE(child2.position(), 195); + QCOMPARE(child2.position(), 199); QCOMPARE(child2.length(), 6); // All QDeclarativeDomValue @@ -1285,23 +1285,23 @@ void tst_qdeclarativedom::position() QCOMPARE(yValue.length(), 6); QDeclarativeDomValue zValue = z.value(); - QCOMPARE(zValue.position(), 90); - QCOMPARE(zValue.length(), 18); + QCOMPARE(zValue.position(), 87); + QCOMPARE(zValue.length(), 23); QDeclarativeDomValue opacityValue = opacity.value(); - QCOMPARE(opacityValue.position(), 122); - QCOMPARE(opacityValue.length(), 11); + QCOMPARE(opacityValue.position(), 115); + QCOMPARE(opacityValue.length(), 22); QDeclarativeDomValue dataValue = data.value(); - QCOMPARE(dataValue.position(), 138); + QCOMPARE(dataValue.position(), 142); QCOMPARE(dataValue.length(), 32); QDeclarativeDomValue child1Value = childrenList.values().at(0); - QCOMPARE(child1Value.position(), 187); + QCOMPARE(child1Value.position(), 191); QCOMPARE(child1Value.length(), 6); QDeclarativeDomValue child2Value = childrenList.values().at(1); - QCOMPARE(child2Value.position(), 195); + QCOMPARE(child2Value.position(), 199); QCOMPARE(child2Value.length(), 6); // All QDeclarativeDomList diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml index c86c96b..9fe0ded 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml @@ -10,8 +10,6 @@ MyTypeObject { floatProperty: 8.5 colorProperty: "red" dateProperty: "1982-11-25" - timeProperty: "11:11:31" - timeProperty: "11:11:32" timeProperty: "11:11:32" dateTimeProperty: "2009-05-12T13:22:01" pointProperty: "99,13" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt index 9a13142..450fc16 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt @@ -1 +1 @@ -6:9:Invalid component id specification +6:9:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt index 2aea251..e1f7ec5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt @@ -1 +1 @@ -5:5:Incorrectly specified signal +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt index 8331725..e1f7ec5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt @@ -1 +1 @@ -5:18:Single property assignment expected +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt index cfe8756..c721fe9 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt @@ -1 +1 @@ -4:5:Invalid use of id property +4:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt index 8c7b7e9..c721fe9 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt @@ -1 +1 @@ -4:15:Can only assign one binding to lists +4:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml new file mode 100644 index 0000000..649c49e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.1.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: 11 +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml new file mode 100644 index 0000000..bc21db9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.10.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + property int a: 10 + a: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml new file mode 100644 index 0000000..abcd216 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.2.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: a + 10 +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml new file mode 100644 index 0000000..77eaba0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.3.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: a + 10 + intProperty: 10 +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml new file mode 100644 index 0000000..c16d04f --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + intProperty: 10 + intProperty: MyTypeObject {} +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml new file mode 100644 index 0000000..2980c5b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.5.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyContainer { + children: MyContainer {} + children: MyContainer {} +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml new file mode 100644 index 0000000..492c720 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.6.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyContainer { + children: MyContainer {} + children: [ MyContainer {}, MyContainer {} ] +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml new file mode 100644 index 0000000..2a9c1d0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.7.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyContainer { + children: [ MyContainer {}, MyContainer {} ] + children: MyContainer {} +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt new file mode 100644 index 0000000..450fc16 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.errors.txt @@ -0,0 +1 @@ +6:9:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml new file mode 100644 index 0000000..052437e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.8.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + grouped { + value: 10 + value: 11 + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt new file mode 100644 index 0000000..e1f7ec5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.errors.txt @@ -0,0 +1 @@ +5:5:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml new file mode 100644 index 0000000..e2e954f --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/multiSet.9.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + grouped.value: 10 + grouped.value: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml index 57a6070..e48526a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml @@ -1,5 +1,5 @@ import Test 1.0 MyTypeObject { - intProperty : MyCompositeValueSource {} + MyCompositeValueSource on intProperty {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml index ad71fcf..22aa682 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml @@ -1,4 +1,4 @@ import Test 1.0 MyTypeObject { - intProperty : MyPropertyValueSource {} + MyPropertyValueSource on intProperty {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt index b5bf1a8..450fc16 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt @@ -1 +1 @@ -6:9:Invalid Script source value +6:9:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index 8ac7aa6..ec2c5f7 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -166,11 +166,16 @@ class MyGroupedObject : public QObject { Q_OBJECT Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript); + Q_PROPERTY(int value READ value WRITE setValue); public: QDeclarativeScriptString script() const { return m_script; } void setScript(const QDeclarativeScriptString &s) { m_script = s; } + int value() const { return m_value; } + void setValue(int v) { m_value = v; } + private: + int m_value; QDeclarativeScriptString m_script; }; diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 1ba4454..39f5223 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -288,6 +288,17 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("Component.5") << "component.5.qml" << "component.5.errors.txt" << false; QTest::newRow("Component.6") << "component.6.qml" << "component.6.errors.txt" << false; + QTest::newRow("MultiSet.1") << "multiSet.1.qml" << "multiSet.1.errors.txt" << false; + QTest::newRow("MultiSet.2") << "multiSet.2.qml" << "multiSet.2.errors.txt" << false; + QTest::newRow("MultiSet.3") << "multiSet.3.qml" << "multiSet.3.errors.txt" << false; + QTest::newRow("MultiSet.4") << "multiSet.4.qml" << "multiSet.4.errors.txt" << false; + QTest::newRow("MultiSet.5") << "multiSet.5.qml" << "multiSet.5.errors.txt" << false; + QTest::newRow("MultiSet.6") << "multiSet.6.qml" << "multiSet.6.errors.txt" << false; + QTest::newRow("MultiSet.7") << "multiSet.7.qml" << "multiSet.7.errors.txt" << false; + QTest::newRow("MultiSet.8") << "multiSet.8.qml" << "multiSet.8.errors.txt" << false; + QTest::newRow("MultiSet.9") << "multiSet.9.qml" << "multiSet.9.errors.txt" << false; + QTest::newRow("MultiSet.10") << "multiSet.10.qml" << "multiSet.10.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; QTest::newRow("invalidAttachedProperty.3") << "invalidAttachedProperty.3.qml" << "invalidAttachedProperty.3.errors.txt" << false; diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml index c58927e..0d42645 100644 --- a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml +++ b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml @@ -8,7 +8,7 @@ Rectangle{ objectName: "particles" width:1; height:1; anchors.centerIn: parent; opacity: 1 lifeSpan: 100; lifeSpanDeviation: 20; count:1000; - fadeInDuration: 20; fadeOutDuration: 20; count: -1; emissionRate: 1000 + fadeInDuration: 20; fadeOutDuration: 20; emissionRate: 1000 angle: 0; angleDeviation: 360; velocity: 500; velocityDeviation:30 source: "particle.png" } diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml index 0d5c98b..c825292 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml @@ -1,7 +1,7 @@ import Qt 4.6 PathView { - id: photoPathView; model: rssModel; delegate: photoDelegate + id: photoPathView y: 100; width: 800; height: 330; pathItemCount: 10; z: 1 path: Path { diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml index 412cca2..af3ae13 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml @@ -1,7 +1,7 @@ import Qt 4.6 PathView { - id: photoPathView; model: rssModel; delegate: photoDelegate + id: photoPathView y: 100; width: 800; height: 330; pathItemCount: 4; offset: 10 dragMargin: 24; snapPosition: 50 diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml index 026ae83..0897847 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property int value: 13; - rect.x: MyOffsetValueInterceptor {} + MyOffsetValueInterceptor on rect.x {} rect.x: value } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml index d4d4391..717f350 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml @@ -1,5 +1,5 @@ import Test 1.0 MyTypeObject { - rect.x: MyConstantValueSource {} + MyConstantValueSource on rect.x {} } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 69646b9..8732215 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -502,10 +502,9 @@ void tst_qdeclarativevaluetypes::valueInterceptors() QDeclarativeComponent component(&engine, TEST_FILE("valueInterceptors.qml")); MyTypeObject *object = qobject_cast(component.create()); checkNoErrors(component); - QEXPECT_FAIL("", "QT-2920", Abort); QVERIFY(object != 0); - QCOMPARE(object->rect().x(), 26); + QCOMPARE(object->rect().x(), 13); object->setProperty("value", 99); diff --git a/tools/qml/qfxtester.h b/tools/qml/qfxtester.h index 1a9f077..6521409 100644 --- a/tools/qml/qfxtester.h +++ b/tools/qml/qfxtester.h @@ -54,12 +54,12 @@ QT_BEGIN_NAMESPACE class QDeclarativeVisualTest : public QObject { Q_OBJECT - Q_PROPERTY(QList* events READ events CONSTANT) + Q_PROPERTY(QDeclarativeListProperty events READ events CONSTANT) Q_CLASSINFO("DefaultProperty", "events") public: QDeclarativeVisualTest() {} - QList *events() { return &m_events; } + QDeclarativeListProperty events() { return QDeclarativeListProperty(this, m_events); } int count() const { return m_events.count(); } QObject *event(int idx) { return m_events.at(idx); } -- cgit v0.12 From a9d327db7e77cc167172ad3199b6ffbc1c9da74f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 2 Mar 2010 11:17:02 +1000 Subject: Add accessor operations to VisualItemModel::children --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 59d6db8..a0aed46 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -81,6 +81,14 @@ public: static_cast(prop->data)->emitChildrenChanged(); } + static int children_count(QDeclarativeListProperty *prop) { + return static_cast(prop->data)->children.count(); + } + + static QDeclarativeItem *children_at(QDeclarativeListProperty *prop, int index) { + return static_cast(prop->data)->children.at(index); + } + void itemAppended() { Q_Q(QDeclarativeVisualItemModel); QDeclarativeVisualItemModelAttached *attached = QDeclarativeVisualItemModelAttached::properties(children.last()); @@ -136,7 +144,8 @@ QDeclarativeVisualItemModel::QDeclarativeVisualItemModel() QDeclarativeListProperty QDeclarativeVisualItemModel::children() { Q_D(QDeclarativeVisualItemModel); - return QDeclarativeListProperty(this, d, QDeclarativeVisualItemModelPrivate::children_append); + return QDeclarativeListProperty(this, d, d->children_append, + d->children_count, d->children_at); } /*! -- cgit v0.12 From ffe622b5424bd13155fea01116ed6504f06d9d83 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 1 Mar 2010 15:55:03 +1000 Subject: Example of text focus. Task-number: QT-448 --- examples/declarative/focusscope/test5.qml | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 examples/declarative/focusscope/test5.qml diff --git a/examples/declarative/focusscope/test5.qml b/examples/declarative/focusscope/test5.qml new file mode 100644 index 0000000..da98350 --- /dev/null +++ b/examples/declarative/focusscope/test5.qml @@ -0,0 +1,83 @@ +import Qt 4.6 + +Rectangle { + color: "white" + width: 800 + height: 600 + + Keys.onReturnPressed: console.log("Error - Root") + + FocusScope { + id: myScope + focus: true + + Keys.onReturnPressed: console.log("Error - FocusScope") + + Rectangle { + height: 120 + width: 420 + + color: "transparent" + border.width: 5 + border.color: myScope.wantsFocus?"blue":"black" + + Rectangle { + x: 10; y: 10 + width: 100; height: 100; color: "green" + border.width: 5 + border.color: item1.wantsFocus?"blue":"black" + } + + TextEdit { + id: item1 + x: 20; y: 20 + width: 90; height: 90 + color: "white" + font.pixelSize: 20 + Keys.onReturnPressed: console.log("Top Left"); + KeyNavigation.right: item2 + focus: true + wrap: true + text: "Box 1" + } + + Rectangle { + id: item2 + x: 310; y: 10 + width: 100; height: 100; color: "green" + border.width: 5 + border.color: wantsFocus?"blue":"black" + KeyNavigation.left: item1 + Keys.onReturnPressed: console.log("Top Right"); + + Rectangle { + width: 50; height: 50; anchors.centerIn: parent + color: parent.focus?"red":"transparent" + } + } + } + KeyNavigation.down: item3 + } + + Text { x:100; y:170; text: "Blue border indicates scoped focus\nBlack border indicates NOT scoped focus\nRed box or flashing cursor indicates active focus\nUse arrow keys to navigate\nPress Ctrl-Return to print currently focused item" } + + Rectangle { + x: 10; y: 300 + width: 100; height: 100; color: "green" + border.width: 5 + border.color: item3.wantsFocus?"blue":"black" + } + + TextEdit { + id: item3 + x: 20; y: 310 + width: 90; height: 90 + color: "white" + font.pixelSize: 20 + text: "Box 3" + + Keys.onReturnPressed: console.log("Bottom Left"); + KeyNavigation.up: myScope + wrap: true + } +} -- cgit v0.12 From 2de0a9ff40c6dcbfca5dc75aae7ac0a294618f4a Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 26 Feb 2010 16:34:28 +1000 Subject: Add NOTIFY signals to list, grid and path views Reviewed-by: akennedy --- .../graphicsitems/qdeclarativegridview.cpp | 12 +- .../graphicsitems/qdeclarativegridview_p.h | 20 ++- .../graphicsitems/qdeclarativelistview.cpp | 24 ++- .../graphicsitems/qdeclarativelistview_p.h | 38 +++-- src/declarative/graphicsitems/qdeclarativepath.cpp | 11 +- src/declarative/graphicsitems/qdeclarativepath_p.h | 11 +- .../graphicsitems/qdeclarativepathview.cpp | 26 +++- .../graphicsitems/qdeclarativepathview_p.h | 18 ++- .../qdeclarativegridview/data/propertychanges.qml | 69 +++++++++ .../tst_qdeclarativegridview.cpp | 125 +++++++++++++-- .../qdeclarativelistview/data/propertychanges.qml | 71 +++++++++ .../tst_qdeclarativelistview.cpp | 168 +++++++++++++++++++-- .../qdeclarativepathview/data/displaypath.qml | 2 +- .../qdeclarativepathview/data/pathview.qml | 2 +- .../qdeclarativepathview/data/pathview3.qml | 2 +- .../qdeclarativepathview/data/propertychanges.qml | 115 ++++++++++++++ .../tst_qdeclarativepathview.cpp | 167 +++++++++++++++++++- 17 files changed, 815 insertions(+), 66 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml create mode 100644 tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml create mode 100644 tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index b43b30b..a7376cc 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -618,7 +618,7 @@ void QDeclarativeGridViewPrivate::createHighlight() } } if (changed) - emit q->highlightChanged(); + emit q->highlightItemChanged(); } void QDeclarativeGridViewPrivate::updateHighlight() @@ -784,6 +784,8 @@ QVariant QDeclarativeGridView::model() const void QDeclarativeGridView::setModel(const QVariant &model) { Q_D(QDeclarativeGridView); + if (d->modelVariant == model) + return; if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); @@ -828,6 +830,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } + emit modelChanged(); } /*! @@ -871,6 +874,7 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate) d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); } + emit delegateChanged(); } } @@ -966,6 +970,7 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight) if (highlight != d->highlightComponent) { d->highlightComponent = highlight; d->updateCurrent(d->currentIndex); + emit highlightChanged(); } } @@ -1039,6 +1044,7 @@ void QDeclarativeGridView::setFlow(Flow flow) d->updateGrid(); refill(); d->updateCurrent(d->currentIndex); + emit flowChanged(); } } @@ -1058,7 +1064,10 @@ bool QDeclarativeGridView::isWrapEnabled() const void QDeclarativeGridView::setWrapEnabled(bool wrap) { Q_D(QDeclarativeGridView); + if (d->wrap == wrap) + return; d->wrap = wrap; + emit keyNavigationWrapsChanged(); } /*! @@ -1082,6 +1091,7 @@ void QDeclarativeGridView::setCacheBuffer(int buffer) d->buffer = buffer; if (isComponentComplete()) refill(); + emit cacheBufferChanged(); } } diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index b488475..d463a46 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -57,19 +57,19 @@ class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGridView) - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight) - Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged) + Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) + Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) - Q_PROPERTY(Flow flow READ flow WRITE setFlow) - Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled) - Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) + Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) + Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) + Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged) Q_PROPERTY(int cellHeight READ cellHeight WRITE setCellHeight NOTIFY cellHeightChanged) Q_CLASSINFO("DefaultProperty", "data") @@ -129,6 +129,12 @@ Q_SIGNALS: void cellWidthChanged(); void cellHeightChanged(); void highlightChanged(); + void highlightItemChanged(); + void modelChanged(); + void delegateChanged(); + void flowChanged(); + void keyNavigationWrapsChanged(); + void cacheBufferChanged(); protected: virtual void viewportMoved(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 03303a0..e7fff90 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -816,7 +816,7 @@ void QDeclarativeListViewPrivate::createHighlight() } } if (changed) - emit q->highlightChanged(); + emit q->highlightItemChanged(); } void QDeclarativeListViewPrivate::updateHighlight() @@ -1473,6 +1473,8 @@ QVariant QDeclarativeListView::model() const void QDeclarativeListView::setModel(const QVariant &model) { Q_D(QDeclarativeListView); + if (d->modelVariant == model) + return; if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); @@ -1517,6 +1519,7 @@ void QDeclarativeListView::setModel(const QVariant &model) connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } + emit modelChanged(); } /*! @@ -1563,6 +1566,7 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate) d->updateCurrent(d->currentIndex); } } + emit delegateChanged(); } /*! @@ -1663,6 +1667,7 @@ void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight) d->createHighlight(); if (d->currentItem) d->updateHighlight(); + emit highlightChanged(); } } @@ -1700,6 +1705,7 @@ void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight) d->highlightSizeAnimator->setEnabled(d->autoHighlight); } d->updateHighlight(); + emit highlightFollowsCurrentItemChanged(); } } @@ -1745,8 +1751,11 @@ qreal QDeclarativeListView::preferredHighlightBegin() const void QDeclarativeListView::setPreferredHighlightBegin(qreal start) { Q_D(QDeclarativeListView); + if (d->highlightRangeStart == start) + return; d->highlightRangeStart = start; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + emit preferredHighlightBeginChanged(); } qreal QDeclarativeListView::preferredHighlightEnd() const @@ -1758,8 +1767,11 @@ qreal QDeclarativeListView::preferredHighlightEnd() const void QDeclarativeListView::setPreferredHighlightEnd(qreal end) { Q_D(QDeclarativeListView); + if (d->highlightRangeEnd == end) + return; d->highlightRangeEnd = end; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + emit preferredHighlightEndChanged(); } QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMode() const @@ -1771,8 +1783,11 @@ QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMod void QDeclarativeListView::setHighlightRangeMode(HighlightRangeMode mode) { Q_D(QDeclarativeListView); + if (d->highlightRange == mode) + return; d->highlightRange = mode; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + emit highlightRangeModeChanged(); } /*! @@ -1848,7 +1863,10 @@ bool QDeclarativeListView::isWrapEnabled() const void QDeclarativeListView::setWrapEnabled(bool wrap) { Q_D(QDeclarativeListView); + if (d->wrap == wrap) + return; d->wrap = wrap; + emit keyNavigationWrapsChanged(); } /*! @@ -1874,6 +1892,7 @@ void QDeclarativeListView::setCacheBuffer(int b) d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter; refill(); } + emit cacheBufferChanged(); } } @@ -1998,6 +2017,7 @@ void QDeclarativeListView::setSnapMode(SnapMode mode) Q_D(QDeclarativeListView); if (d->snapMode != mode) { d->snapMode = mode; + emit snapModeChanged(); } } @@ -2020,6 +2040,7 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer) d->maxExtentDirty = true; d->updateFooter(); d->updateViewport(); + emit footerChanged(); } } @@ -2043,6 +2064,7 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header) d->updateHeader(); d->updateFooter(); d->updateViewport(); + emit headerChanged(); } } diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 5e3edb0..f9b7b50 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -91,33 +91,33 @@ class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView) - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight) - Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged) - Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) + Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) + Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) + Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem NOTIFY highlightFollowsCurrentItemChanged) Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged) Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged) - Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin) - Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd) - Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode) + Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) + Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) + Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) - Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled) - Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) + Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) + Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT) Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged) - Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode) + Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged) - Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader) - Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter) + Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader NOTIFY headerChanged) + Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter NOTIFY footerChanged) Q_ENUMS(HighlightRangeMode) Q_ENUMS(Orientation) @@ -205,6 +205,18 @@ Q_SIGNALS: void highlightMoveSpeedChanged(); void highlightResizeSpeedChanged(); void highlightChanged(); + void highlightItemChanged(); + void modelChanged(); + void delegateChanged(); + void highlightFollowsCurrentItemChanged(); + void preferredHighlightBeginChanged(); + void preferredHighlightEndChanged(); + void highlightRangeModeChanged(); + void keyNavigationWrapsChanged(); + void cacheBufferChanged(); + void snapModeChanged(); + void headerChanged(); + void footerChanged(); protected: virtual void viewportMoved(); diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index 48f112a..80586b8 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -114,7 +114,10 @@ qreal QDeclarativePath::startX() const void QDeclarativePath::setStartX(qreal x) { Q_D(QDeclarativePath); + if (qFuzzyCompare(x, d->startX)) + return; d->startX = x; + emit startXChanged(); } qreal QDeclarativePath::startY() const @@ -126,7 +129,10 @@ qreal QDeclarativePath::startY() const void QDeclarativePath::setStartY(qreal y) { Q_D(QDeclarativePath); + if (qFuzzyCompare(y, d->startY)) + return; d->startY = y; + emit startYChanged(); } /*! @@ -522,7 +528,10 @@ QString QDeclarativePathAttribute::name() const void QDeclarativePathAttribute::setName(const QString &name) { - _name = name; + if (_name == name) + return; + _name = name; + emit nameChanged(); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h index b3139f8..d7cfca1 100644 --- a/src/declarative/graphicsitems/qdeclarativepath_p.h +++ b/src/declarative/graphicsitems/qdeclarativepath_p.h @@ -67,7 +67,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathAttribute : public QDeclarativePathEl { Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) public: QDeclarativePathAttribute(QObject *parent=0) : QDeclarativePathElement(parent), _value(0) {} @@ -79,6 +79,9 @@ public: qreal value() const; void setValue(qreal value); +Q_SIGNALS: + void nameChanged(); + private: QString _name; qreal _value; @@ -190,8 +193,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativePath : public QObject, public QDeclarativ Q_INTERFACES(QDeclarativeParserStatus) Q_PROPERTY(QDeclarativeListProperty pathElements READ pathElements) - Q_PROPERTY(qreal startX READ startX WRITE setStartX) - Q_PROPERTY(qreal startY READ startY WRITE setStartY) + Q_PROPERTY(qreal startX READ startX WRITE setStartX NOTIFY startXChanged) + Q_PROPERTY(qreal startY READ startY WRITE setStartY NOTIFY startYChanged) Q_PROPERTY(bool closed READ isClosed NOTIFY changed) Q_CLASSINFO("DefaultProperty", "pathElements") Q_INTERFACES(QDeclarativeParserStatus) @@ -216,6 +219,8 @@ public: Q_SIGNALS: void changed(); + void startXChanged(); + void startYChanged(); protected: virtual void componentComplete(); diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index f1b0213..50aa9ef 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -203,6 +203,9 @@ QVariant QDeclarativePathView::model() const void QDeclarativePathView::setModel(const QVariant &model) { Q_D(QDeclarativePathView); + if (d->modelVariant == model) + return; + if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); @@ -242,6 +245,7 @@ void QDeclarativePathView::setModel(const QVariant &model) d->pathOffset = 0; d->regenerate(); d->fixOffset(); + emit modelChanged(); } /*! @@ -269,9 +273,12 @@ QDeclarativePath *QDeclarativePathView::path() const void QDeclarativePathView::setPath(QDeclarativePath *path) { Q_D(QDeclarativePathView); + if (d->path == path) + return; d->path = path; connect(d->path, SIGNAL(changed()), this, SLOT(refill())); d->regenerate(); + emit pathChanged(); } /*! @@ -333,7 +340,7 @@ void QDeclarativePathViewPrivate::setOffset(qreal o) /*! \qmlproperty real PathView::snapPosition - This property determines the position (0-100) the nearest item will snap to. + This property determines the position (0.0-1.0) the nearest item will snap to. */ qreal QDeclarativePathView::snapPosition() const { @@ -344,8 +351,12 @@ qreal QDeclarativePathView::snapPosition() const void QDeclarativePathView::setSnapPosition(qreal pos) { Q_D(QDeclarativePathView); - d->snapPos = pos/100; + qreal normalizedPos = pos - int(pos); + if (qFuzzyCompare(normalizedPos, d->snapPos)) + return; + d->snapPos = normalizedPos; d->fixOffset(); + emit snapPositionChanged(); } /*! @@ -365,7 +376,10 @@ qreal QDeclarativePathView::dragMargin() const void QDeclarativePathView::setDragMargin(qreal dragMargin) { Q_D(QDeclarativePathView); + if (d->dragMargin == dragMargin) + return; d->dragMargin = dragMargin; + emit dragMarginChanged(); } /*! @@ -392,16 +406,19 @@ QDeclarativeComponent *QDeclarativePathView::delegate() const return 0; } -void QDeclarativePathView::setDelegate(QDeclarativeComponent *c) +void QDeclarativePathView::setDelegate(QDeclarativeComponent *delegate) { Q_D(QDeclarativePathView); + if (delegate == this->delegate()) + return; if (!d->ownModel) { d->model = new QDeclarativeVisualDataModel(qmlContext(this)); d->ownModel = true; } if (QDeclarativeVisualDataModel *dataModel = qobject_cast(d->model)) { - dataModel->setDelegate(c); + dataModel->setDelegate(delegate); d->regenerate(); + emit delegateChanged(); } } @@ -422,6 +439,7 @@ void QDeclarativePathView::setPathItemCount(int i) return; d->pathItems = i; d->regenerate(); + pathItemCountChanged(); } QPointF QDeclarativePathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 709a4fc..df9c6ae 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -56,15 +56,15 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem { Q_OBJECT - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath NOTIFY pathChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged) - Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition) - Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin) + Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition NOTIFY snapPositionChanged) + Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin NOTIFY dragMarginChanged) Q_PROPERTY(int count READ count) - Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate) - Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount) + Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) + Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount NOTIFY pathItemCountChanged) public: QDeclarativePathView(QDeclarativeItem *parent=0); @@ -101,6 +101,12 @@ public: Q_SIGNALS: void currentIndexChanged(); void offsetChanged(); + void modelChanged(); + void pathChanged(); + void dragMarginChanged(); + void snapPositionChanged(); + void delegateChanged(); + void pathItemCountChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml new file mode 100644 index 0000000..da2e8d0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml @@ -0,0 +1,69 @@ +import Qt 4.6 + +Rectangle { + width: 360; height: 120; color: "white" + Component { + id: delegate + Item { + id: wrapper + width: 180; height: 40; + Column { + x: 5; y: 5 + Text { text: 'Name: ' + name } + Text { text: 'Number: ' + number } + } + } + } + Component { + id: highlightRed + Rectangle { + color: "red" + radius: 10 + opacity: 0.5 + } + } + GridView { + cellWidth:180 + cellHeight:40 + objectName: "gridView" + anchors.fill: parent + model: listModel + delegate: delegate + highlight: highlightRed + focus: true + keyNavigationWraps: true + cacheBuffer: 10 + flow: GridView.LeftToRight + } + + data:[ + ListModel { + id: listModel + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + }, + ListModel { + objectName: "alternateModel" + ListElement { + name: "Jack" + number: "555 8426" + } + ListElement { + name: "Mary" + number: "555 3264" + } + } + ] +} + + \ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 2a60fee..cc65d32 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -39,16 +39,17 @@ ** ****************************************************************************/ -#include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include class tst_QDeclarativeGridView : public QObject { @@ -66,6 +67,9 @@ private slots: void currentIndex(); void defaultValues(); void properties(); + void propertyChanges(); + void componentChanges(); + void modelChanges(); void positionViewAtIndex(); void resetModel(); void QTBUG_8456(); @@ -91,7 +95,7 @@ public: setRoleNames(roles); } - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); } QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { QVariant rv; if (role == Name) @@ -796,6 +800,107 @@ void tst_QDeclarativeGridView::properties() delete obj; } +void tst_QDeclarativeGridView::propertyChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeGridView *gridView = canvas->rootObject()->findChild("gridView"); + QVERIFY(gridView); + + QSignalSpy keyNavigationWrapsSpy(gridView, SIGNAL(keyNavigationWrapsChanged())); + QSignalSpy cacheBufferSpy(gridView, SIGNAL(cacheBufferChanged())); + QSignalSpy flowSpy(gridView, SIGNAL(flowChanged())); + + QCOMPARE(gridView->isWrapEnabled(), true); + QCOMPARE(gridView->cacheBuffer(), 10); + QCOMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight); + + gridView->setWrapEnabled(false); + gridView->setCacheBuffer(3); + gridView->setFlow(QDeclarativeGridView::TopToBottom); + + QCOMPARE(gridView->isWrapEnabled(), false); + QCOMPARE(gridView->cacheBuffer(), 3); + QCOMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom); + + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(flowSpy.count(),1); + + gridView->setWrapEnabled(false); + gridView->setCacheBuffer(3); + gridView->setFlow(QDeclarativeGridView::TopToBottom); + + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(flowSpy.count(),1); + + delete canvas; +} + +void tst_QDeclarativeGridView::componentChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeGridView *gridView = canvas->rootObject()->findChild("gridView"); + QVERIFY(gridView); + + QDeclarativeComponent component(canvas->engine()); + component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + + QDeclarativeComponent delegateComponent(canvas->engine()); + delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + + QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged())); + QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged())); + + gridView->setHighlight(&component); + gridView->setDelegate(&delegateComponent); + + QCOMPARE(gridView->highlight(), &component); + QCOMPARE(gridView->delegate(), &delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + + gridView->setHighlight(&component); + gridView->setDelegate(&delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + delete canvas; +} + +void tst_QDeclarativeGridView::modelChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeGridView *gridView = canvas->rootObject()->findChild("gridView"); + QVERIFY(gridView); + + QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild("alternateModel"); + QVERIFY(alternateModel); + QVariant modelVariant = QVariant::fromValue(alternateModel); + QSignalSpy modelSpy(gridView, SIGNAL(modelChanged())); + + gridView->setModel(modelVariant); + QCOMPARE(gridView->model(), modelVariant); + QCOMPARE(modelSpy.count(),1); + + gridView->setModel(modelVariant); + QCOMPARE(modelSpy.count(),1); + + gridView->setModel(QVariant()); + QCOMPARE(modelSpy.count(),2); + delete canvas; +} + void tst_QDeclarativeGridView::positionViewAtIndex() { QDeclarativeView *canvas = createView(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml new file mode 100644 index 0000000..a41f003 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml @@ -0,0 +1,71 @@ +import Qt 4.6 + +Rectangle { + width: 180; height: 120; color: "white" + Component { + id: delegate + Item { + id: wrapper + width: 180; height: 40; + Column { + x: 5; y: 5 + Text { text: 'Name: ' + name } + Text { text: 'Number: ' + number } + } + } + } + Component { + id: highlightRed + Rectangle { + color: "red" + radius: 10 + opacity: 0.5 + } + } + ListView { + objectName: "listView" + anchors.fill: parent + model: listModel + delegate: delegate + highlight: highlightRed + focus: true + highlightFollowsCurrentItem: true + preferredHighlightBegin: 0.0 + preferredHighlightEnd: 0.0 + highlightRangeMode: ListView.ApplyRange + keyNavigationWraps: true + cacheBuffer: 10 + snapMode: ListView.SnapToItem + } + + data:[ + ListModel { + id: listModel + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + }, + ListModel { + objectName: "alternateModel" + ListElement { + name: "Jack" + number: "555 8426" + } + ListElement { + name: "Mary" + number: "555 3264" + } + } + ] +} + + \ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index f15f26b..a36224f 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -38,15 +38,18 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include class tst_QDeclarativeListView : public QObject { @@ -82,6 +85,9 @@ private slots: void cacheBuffer(); void positionViewAtIndex(); void resetModel(); + void propertyChanges(); + void componentChanges(); + void modelChanges(); private: template void items(); @@ -240,7 +246,7 @@ public: setRoleNames(roles); } - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); } QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { QVariant rv; if (role == Name) @@ -379,6 +385,7 @@ void tst_QDeclarativeListView::items() delete canvas; } + template void tst_QDeclarativeListView::changed() { @@ -1275,6 +1282,149 @@ void tst_QDeclarativeListView::resetModel() } } +void tst_QDeclarativeListView::propertyChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeListView *listView = canvas->rootObject()->findChild("listView"); + QVERIFY(listView); + + QSignalSpy highlightFollowsCurrentItemSpy(listView, SIGNAL(highlightFollowsCurrentItemChanged())); + QSignalSpy preferredHighlightBeginSpy(listView, SIGNAL(preferredHighlightBeginChanged())); + QSignalSpy preferredHighlightEndSpy(listView, SIGNAL(preferredHighlightEndChanged())); + QSignalSpy highlightRangeModeSpy(listView, SIGNAL(highlightRangeModeChanged())); + QSignalSpy keyNavigationWrapsSpy(listView, SIGNAL(keyNavigationWrapsChanged())); + QSignalSpy cacheBufferSpy(listView, SIGNAL(cacheBufferChanged())); + QSignalSpy snapModeSpy(listView, SIGNAL(snapModeChanged())); + + QCOMPARE(listView->highlightFollowsCurrentItem(), true); + QCOMPARE(listView->preferredHighlightBegin(), 0.0); + QCOMPARE(listView->preferredHighlightEnd(), 0.0); + QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::ApplyRange); + QCOMPARE(listView->isWrapEnabled(), true); + QCOMPARE(listView->cacheBuffer(), 10); + QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapToItem); + + listView->setHighlightFollowsCurrentItem(false); + listView->setPreferredHighlightBegin(1.0); + listView->setPreferredHighlightEnd(1.0); + listView->setHighlightRangeMode(QDeclarativeListView::StrictlyEnforceRange); + listView->setWrapEnabled(false); + listView->setCacheBuffer(3); + listView->setSnapMode(QDeclarativeListView::SnapOneItem); + + QCOMPARE(listView->highlightFollowsCurrentItem(), false); + QCOMPARE(listView->preferredHighlightBegin(), 1.0); + QCOMPARE(listView->preferredHighlightEnd(), 1.0); + QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); + QCOMPARE(listView->isWrapEnabled(), false); + QCOMPARE(listView->cacheBuffer(), 3); + QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapOneItem); + + QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); + QCOMPARE(preferredHighlightBeginSpy.count(),1); + QCOMPARE(preferredHighlightEndSpy.count(),1); + QCOMPARE(highlightRangeModeSpy.count(),1); + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(snapModeSpy.count(),1); + + listView->setHighlightFollowsCurrentItem(false); + listView->setPreferredHighlightBegin(1.0); + listView->setPreferredHighlightEnd(1.0); + listView->setHighlightRangeMode(QDeclarativeListView::StrictlyEnforceRange); + listView->setWrapEnabled(false); + listView->setCacheBuffer(3); + listView->setSnapMode(QDeclarativeListView::SnapOneItem); + + QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); + QCOMPARE(preferredHighlightBeginSpy.count(),1); + QCOMPARE(preferredHighlightEndSpy.count(),1); + QCOMPARE(highlightRangeModeSpy.count(),1); + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(snapModeSpy.count(),1); + + delete canvas; +} + +void tst_QDeclarativeListView::componentChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeListView *listView = canvas->rootObject()->findChild("listView"); + QVERIFY(listView); + + QDeclarativeComponent component(canvas->engine()); + component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + + QDeclarativeComponent delegateComponent(canvas->engine()); + delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + + QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged())); + QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged())); + QSignalSpy headerSpy(listView, SIGNAL(headerChanged())); + QSignalSpy footerSpy(listView, SIGNAL(footerChanged())); + + listView->setHighlight(&component); + listView->setHeader(&component); + listView->setFooter(&component); + listView->setDelegate(&delegateComponent); + + QCOMPARE(listView->highlight(), &component); + QCOMPARE(listView->header(), &component); + QCOMPARE(listView->footer(), &component); + QCOMPARE(listView->delegate(), &delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + QCOMPARE(headerSpy.count(),1); + QCOMPARE(footerSpy.count(),1); + + listView->setHighlight(&component); + listView->setHeader(&component); + listView->setFooter(&component); + listView->setDelegate(&delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + QCOMPARE(headerSpy.count(),1); + QCOMPARE(footerSpy.count(),1); + + delete canvas; +} + +void tst_QDeclarativeListView::modelChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeListView *listView = canvas->rootObject()->findChild("listView"); + QVERIFY(listView); + + QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild("alternateModel"); + QVERIFY(alternateModel); + QVariant modelVariant = QVariant::fromValue(alternateModel); + QSignalSpy modelSpy(listView, SIGNAL(modelChanged())); + + listView->setModel(modelVariant); + QCOMPARE(listView->model(), modelVariant); + QCOMPARE(modelSpy.count(),1); + + listView->setModel(modelVariant); + QCOMPARE(modelSpy.count(),1); + + listView->setModel(QVariant()); + QCOMPARE(modelSpy.count(),2); + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); diff --git a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml index 627f38a..ab1538b 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml @@ -33,7 +33,7 @@ Rectangle { height: 320 model: testModel delegate: delegate - snapPosition: 0.01 + snapPosition: 0.0001 path: Path { startY: 120 startX: 160 diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml index 8fa8d59..c5d88cd 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml @@ -39,7 +39,7 @@ Rectangle { height: 320 model: testModel delegate: delegate - snapPosition: 0.01 + snapPosition: 0.0001 path: Path { startY: 120 startX: 160 diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml index af3ae13..f8ed29f 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml @@ -3,7 +3,7 @@ import Qt 4.6 PathView { id: photoPathView y: 100; width: 800; height: 330; pathItemCount: 4; offset: 10 - dragMargin: 24; snapPosition: 50 + dragMargin: 24; snapPosition: 0.50 path: Path { startX: -50; startY: 40; diff --git a/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml new file mode 100644 index 0000000..db70b7b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml @@ -0,0 +1,115 @@ +import Qt 4.6 + +Rectangle { + width: 350; height: 220; color: "white" + Component { + id: myDelegate + Item { + id: wrapper + width: 180; height: 40; + opacity: PathView.opacity + Column { + x: 5; y: 5 + Text { text: 'Name: ' + name } + Text { text: 'Number: ' + number } + } + } + } + + PathView { + snapPosition: 0.1 + dragMargin: 5.0 + id: pathView + objectName: "pathView" + anchors.fill: parent + model: listModel + delegate: myDelegate + focus: true + path: Path { + id: myPath + objectName: "path" + startX: 220; startY: 200 + PathAttribute { name: "opacity"; value: 1.0; objectName: "pathAttribute"; } + PathQuad { x: 220; y: 25; controlX: 260; controlY: 75 } + PathAttribute { name: "opacity"; value: 0.3 } + PathQuad { x: 220; y: 200; controlX: -20; controlY: 75 } + } + Timer { + interval: 2000; running: true; repeat: true + onTriggered: { + if (pathView.path == alternatePath) + pathView.path = myPath; + else + pathView.path = alternatePath; + } + } + } + + data:[ + ListModel { + id: listModel + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + }, + ListModel { + objectName: "alternateModel" + ListElement { + name: "Jack" + number: "555 8426" + } + ListElement { + name: "Mary" + number: "555 3264" + } + }, + Path { + id: alternatePath + objectName: "alternatePath" + startX: 100; startY: 40 + PathAttribute { name: "opacity"; value: 0.0 } + PathLine { x: 100; y: 160 } + PathAttribute { name: "opacity"; value: 0.2 } + PathLine { x: 300; y: 160 } + PathAttribute { name: "opacity"; value: 0.0 } + PathLine { x: 300; y: 40 } + PathAttribute { name: "opacity"; value: 0.2 } + PathLine { x: 100; y: 40 } + } + ] +} + + diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 79bc607..fa4e9d3 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -38,20 +38,23 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include -#include -#include -#include -#include + +#include +#include #include #include -#include +#include +#include +#include +#include #include #include +#include +#include #include #include #include -#include + #include "../../../shared/util.h" class tst_QDeclarativePathView : public QObject @@ -69,6 +72,11 @@ private slots: void path(); void pathMoved(); void resetModel(); + void propertyChanges(); + void pathChanges(); + void componentChanges(); + void modelChanges(); + private: QDeclarativeView *createView(); @@ -120,7 +128,7 @@ public: setRoleNames(roles); } - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); } QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { QVariant rv; if (role == Name) @@ -465,6 +473,149 @@ void tst_QDeclarativePathView::resetModel() } } +void tst_QDeclarativePathView::propertyChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QSignalSpy snapPositionSpy(pathView, SIGNAL(snapPositionChanged())); + QSignalSpy dragMarginSpy(pathView, SIGNAL(dragMarginChanged())); + + QCOMPARE(pathView->snapPosition(), 0.1); + QCOMPARE(pathView->dragMargin(), 5.0); + + pathView->setSnapPosition(0.4); + pathView->setDragMargin(20.0); + + QCOMPARE(pathView->snapPosition(), 0.4); + QCOMPARE(pathView->dragMargin(), 20.0); + + QCOMPARE(snapPositionSpy.count(), 1); + QCOMPARE(dragMarginSpy.count(), 1); + + pathView->setSnapPosition(0.4); + pathView->setDragMargin(20.0); + + QCOMPARE(snapPositionSpy.count(), 1); + QCOMPARE(dragMarginSpy.count(), 1); + delete canvas; +} + +void tst_QDeclarativePathView::pathChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativePath *path = canvas->rootObject()->findChild("path"); + QVERIFY(path); + + QSignalSpy startXSpy(path, SIGNAL(startXChanged())); + QSignalSpy startYSpy(path, SIGNAL(startYChanged())); + + QCOMPARE(path->startX(), 220.0); + QCOMPARE(path->startY(), 200.0); + + path->setStartX(240.0); + path->setStartY(220.0); + + QCOMPARE(path->startX(), 240.0); + QCOMPARE(path->startY(), 220.0); + + QCOMPARE(startXSpy.count(),1); + QCOMPARE(startYSpy.count(),1); + + path->setStartX(240); + path->setStartY(220); + + QCOMPARE(startXSpy.count(),1); + QCOMPARE(startYSpy.count(),1); + + QDeclarativePath *alternatePath = canvas->rootObject()->findChild("alternatePath"); + QVERIFY(alternatePath); + + QSignalSpy pathSpy(pathView, SIGNAL(pathChanged())); + + QCOMPARE(pathView->path(), path); + + pathView->setPath(alternatePath); + QCOMPARE(pathView->path(), alternatePath); + QCOMPARE(pathSpy.count(),1); + + pathView->setPath(alternatePath); + QCOMPARE(pathSpy.count(),1); + + QDeclarativePathAttribute *pathAttribute = canvas->rootObject()->findChild("pathAttribute"); + QVERIFY(pathAttribute); + + QSignalSpy nameSpy(pathAttribute, SIGNAL(nameChanged())); + QCOMPARE(pathAttribute->name(), QString("opacity")); + + pathAttribute->setName("scale"); + QCOMPARE(pathAttribute->name(), QString("scale")); + QCOMPARE(nameSpy.count(),1); + + pathAttribute->setName("scale"); + QCOMPARE(nameSpy.count(),1); + delete canvas; +} + +void tst_QDeclarativePathView::componentChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativeComponent delegateComponent(canvas->engine()); + delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + + QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged())); + + pathView->setDelegate(&delegateComponent); + QCOMPARE(pathView->delegate(), &delegateComponent); + QCOMPARE(delegateSpy.count(),1); + + pathView->setDelegate(&delegateComponent); + QCOMPARE(delegateSpy.count(),1); + delete canvas; +} + +void tst_QDeclarativePathView::modelChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild("alternateModel"); + QVERIFY(alternateModel); + QVariant modelVariant = QVariant::fromValue(alternateModel); + QSignalSpy modelSpy(pathView, SIGNAL(modelChanged())); + + pathView->setModel(modelVariant); + QCOMPARE(pathView->model(), modelVariant); + QCOMPARE(modelSpy.count(),1); + + pathView->setModel(modelVariant); + QCOMPARE(modelSpy.count(),1); + + pathView->setModel(QVariant()); + QCOMPARE(modelSpy.count(),2); + + delete canvas; +} QDeclarativeView *tst_QDeclarativePathView::createView() { -- cgit v0.12 From 8da93faace82eb2bc86e76c0ad0a0c5c95e3b8bf Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 2 Mar 2010 12:07:40 +1000 Subject: Add docs and tests for WorkerListModel. Task-number: QT-2807 --- doc/src/declarative/elements.qdoc | 2 + examples/declarative/workerlistmodel/dataloader.js | 14 ++ .../declarative/workerlistmodel/timedisplay.qml | 33 ++++ src/declarative/qml/qdeclarativeworkerscript.cpp | 137 ++++++++++++++- src/declarative/qml/qdeclarativeworkerscript_p.h | 9 +- .../qdeclarativeworkerlistmodel/data/model.qml | 14 ++ .../qdeclarativeworkerlistmodel/data/script.js | 6 + .../qdeclarativeworkerlistmodel.pro | 9 + .../tst_qdeclarativeworkerlistmodel.cpp | 193 +++++++++++++++++++++ 9 files changed, 414 insertions(+), 3 deletions(-) create mode 100644 examples/declarative/workerlistmodel/dataloader.js create mode 100644 examples/declarative/workerlistmodel/timedisplay.qml create mode 100644 tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml create mode 100644 tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js create mode 100644 tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro create mode 100644 tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 1fd4dad..6cca39b 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -91,6 +91,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l VisualDataModel \o \l Package \o \l XmlListModel and XmlRole +\o \l WorkerListModel \o \l DateTimeFormatter \o \l NumberFormatter \endlist @@ -102,6 +103,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l Component \o \l Timer \o \l QtObject +\o \l WorkerScript \endlist \endtable diff --git a/examples/declarative/workerlistmodel/dataloader.js b/examples/declarative/workerlistmodel/dataloader.js new file mode 100644 index 0000000..eac7478 --- /dev/null +++ b/examples/declarative/workerlistmodel/dataloader.js @@ -0,0 +1,14 @@ +// ![0] +WorkerScript.onMessage = function(msg) { + console.log("Worker told to", msg.action); + + if (msg.action == 'appendCurrentTime') { + var data = {'time': new Date().toTimeString()}; + msg.model.append(data); + msg.model.sync(); // updates the changes to the list + + var msgToSend = {'msg': 'Model updated!'}; + WorkerScript.sendMessage(msgToSend); + } +} +// ![0] diff --git a/examples/declarative/workerlistmodel/timedisplay.qml b/examples/declarative/workerlistmodel/timedisplay.qml new file mode 100644 index 0000000..3bf2630 --- /dev/null +++ b/examples/declarative/workerlistmodel/timedisplay.qml @@ -0,0 +1,33 @@ +// ![0] +import Qt 4.6 + +ListView { + width: 200 + height: 300 + + model: listModel + delegate: Component { + Text { text: time } + } + + WorkerListModel { id: listModel } + + WorkerScript { + id: worker + source: "dataloader.js" + onMessage: { + console.log("Worker said", messageObject.msg); + } + } + + Timer { + id: timer + interval: 2000; repeat: true; running: true; triggeredOnStart: true + + onTriggered: { + var msg = {'action': 'appendCurrentTime', 'model': listModel}; + worker.sendMessage(msg); + } + } +} +// ![0] diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index 03151e4..c1d090e 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -841,6 +841,41 @@ bool QDeclarativeWorkerListModelAgent::event(QEvent *e) return QObject::event(e); } +/*! + \qmlclass WorkerListModel QDeclarativeWorkerListModel + \brief The WorkerListModel element provides a threaded list model. + + Use WorkerListModel together with WorkerScript to define a list model + that is controlled by a separate thread. This is useful if list modification + operations are synchronous and take some time: using WorkerListModel + moves these operations to a different thread and avoids blocking of the + main GUI thread. + + The thread that creates the WorkerListModel can modify the model for any + initial set-up requirements. However, once the model has been modified by + the associated WorkerScript, the model can only be modified by that worker + script and becomes read-only to all other threads. + + Here is an example application that uses WorkerScript to append the + current time to a WorkerListModel: + + \snippet examples/declarative/workerlistmodel/timedisplay.qml 0 + + The included file, \tt dataloader.js, looks like this: + + \snippet examples/declarative/workerlistmodel/dataloader.js 0 + + The application's \tt Timer object periodically sends a message to the + worker script by calling \tt WorkerScript::sendMessage(). When this message + is received, \tt WorkerScript.onMessage() is invoked in + \tt dataloader.js, which appends the current time to the worker list + model. + + Note that unlike ListModel, WorkerListModel does not have \tt move() and + \tt setProperty() methods. + + \sa WorkerScript, ListModel +*/ QDeclarativeWorkerListModel::QDeclarativeWorkerListModel(QObject *parent) : QListModelInterface(parent), m_agent(0) { @@ -854,6 +889,14 @@ QDeclarativeWorkerListModel::~QDeclarativeWorkerListModel() } } +/*! + \qmlmethod WorkerListModel::clear() + + Deletes all content from the model. The properties are cleared such that + different properties may be set on subsequent additions. + + \sa append() remove() +*/ void QDeclarativeWorkerListModel::clear() { if (m_agent) { @@ -869,6 +912,13 @@ void QDeclarativeWorkerListModel::clear() } } +/*! + \qmlmethod WorkerListModel::remove(int index) + + Deletes the content at \a index from the model. + + \sa clear() +*/ void QDeclarativeWorkerListModel::remove(int index) { if (m_agent) { @@ -884,6 +934,18 @@ void QDeclarativeWorkerListModel::remove(int index) emit countChanged(); } +/*! + \qmlmethod WorkerListModel::append(jsobject dict) + + Adds a new item to the end of the list model, with the + values in \a dict. + + \code + FruitModel.append({"cost": 5.95, "name":"Pizza"}) + \endcode + + \sa set() remove() +*/ void QDeclarativeWorkerListModel::append(const QScriptValue &value) { if (m_agent) { @@ -914,6 +976,21 @@ void QDeclarativeWorkerListModel::append(const QScriptValue &value) emit countChanged(); } +/*! + \qmlmethod WorkerListModel::insert(int index, jsobject dict) + + Adds a new item to the list model at position \a index, with the + values in \a dict. + + \code + FruitModel.insert(2, {"cost": 5.95, "name":"Pizza"}) + \endcode + + The \a index must be to an existing item in the list, or one past + the end of the list (equivalent to append). + + \sa set() append() +*/ void QDeclarativeWorkerListModel::insert(int index, const QScriptValue &value) { if (m_agent) { @@ -946,6 +1023,30 @@ void QDeclarativeWorkerListModel::insert(int index, const QScriptValue &value) emit countChanged(); } +/*! + \qmlmethod object ListModel::get(int index) + + Returns the item at \a index in the list model. + + \code + FruitModel.append({"cost": 5.95, "name":"Jackfruit"}) + FruitModel.get(0).cost + \endcode + + The \a index must be an element in the list. + + Note that properties of the returned object that are themselves objects + will also be models, and this get() method is used to access elements: + + \code + FruitModel.append(..., "attributes": + [{"name":"spikes","value":"7mm"}, + {"name":"color","value":"green"}]); + FruitModel.get(0).attributes.get(1).value; // == "green" + \endcode + + \sa append() +*/ QScriptValue QDeclarativeWorkerListModel::get(int index) const { QDeclarativeEngine *engine = qmlEngine(this); @@ -962,6 +1063,21 @@ QScriptValue QDeclarativeWorkerListModel::get(int index) const return rv; } +/*! + \qmlmethod WorkerListModel::set(int index, jsobject dict) + + Changes the item at \a index in the list model with the + values in \a dict. Properties not appearing in \a valuemap + are left unchanged. + + \code + FruitModel.set(3, {"cost": 5.95, "name":"Pizza"}) + \endcode + + The \a index must be an element in the list. + + \sa append() +*/ void QDeclarativeWorkerListModel::set(int index, const QScriptValue &value) { if (m_agent) { @@ -995,6 +1111,22 @@ void QDeclarativeWorkerListModel::set(int index, const QScriptValue &value) } } +/*! + \qmlmethod WorkerListModel::sync() + + Writes any unsaved changes to the list model. This must be called after + changes have been made to the list model in the worker script. + + Note that this method can only be called from the associated worker script. +*/ +void QDeclarativeWorkerListModel::sync() +{ + // This is really a dummy method to make it look like sync() exists in + // WorkerListModel (and not QDeclarativeWorkerListModelAgent) and to let + // us document sync(). + qmlInfo(this) << "sync() can only be called from a WorkerScript"; +} + QDeclarativeWorkerListModelAgent *QDeclarativeWorkerListModel::agent() { if (!m_agent) @@ -1013,6 +1145,10 @@ QString QDeclarativeWorkerListModel::toString(int role) const return m_roles.value(role); } +/*! + \qmlproperty int ListModel::count + The number of data entries in the model. +*/ int QDeclarativeWorkerListModel::count() const { return m_values.count(); @@ -1038,4 +1174,3 @@ QT_END_NAMESPACE #include "qdeclarativeworkerscript.moc" - diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h index 8ebd2c1..01cc72a 100644 --- a/src/declarative/qml/qdeclarativeworkerscript_p.h +++ b/src/declarative/qml/qdeclarativeworkerscript_p.h @@ -61,6 +61,8 @@ #include #include +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE class QDeclarativeWorkerScript; @@ -84,7 +86,7 @@ private: QDeclarativeWorkerScriptEnginePrivate *d; }; -class QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus +class Q_DECLARATIVE_EXPORT QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) @@ -115,7 +117,7 @@ private: }; class QDeclarativeWorkerListModelAgent; -class QDeclarativeWorkerListModel : public QListModelInterface +class Q_DECLARATIVE_EXPORT QDeclarativeWorkerListModel : public QListModelInterface { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) @@ -130,6 +132,7 @@ public: Q_INVOKABLE void insert(int index, const QScriptValue&); Q_INVOKABLE QScriptValue get(int index) const; Q_INVOKABLE void set(int index, const QScriptValue &); + Q_INVOKABLE void sync(); QDeclarativeWorkerListModelAgent *agent(); @@ -157,4 +160,6 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QDeclarativeWorkerScript); QML_DECLARE_TYPE(QDeclarativeWorkerListModel); +QT_END_HEADER + #endif // QDECLARATIVEWORKERSCRIPT_P_H diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml new file mode 100644 index 0000000..be94e00 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/model.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Item { + property alias model: model + + WorkerListModel { id: model } + + function workerModifyModel(cmd) { worker.sendMessage({'command': cmd, 'model': model}) } + + WorkerScript { + id: worker + source: "script.js" + } +} diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js new file mode 100644 index 0000000..8ee62b4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/data/script.js @@ -0,0 +1,6 @@ +WorkerScript.onMessage = function(msg) { + eval("msg.model." + msg.command) + msg.model.sync() +} + + diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro b/tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro new file mode 100644 index 0000000..960dbe1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/qdeclarativeworkerlistmodel.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += script +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeworkerlistmodel.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp b/tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp new file mode 100644 index 0000000..11a7447 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerlistmodel/tst_qdeclarativeworkerlistmodel.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include +#include +#include + +#include +#include +#include "../../../shared/util.h" + + + +class tst_QDeclarativeWorkerListModel : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeWorkerListModel() {} +private slots: + void clear(); + void remove(); + void append(); + void insert(); + void get(); + void set(); + +private: + QByteArray modificationWarning() const { + QString file = QUrl::fromLocalFile(SRCDIR "/data/model.qml").toString(); + return QString("QML WorkerListModel (" + file + ":6:5) List can only be modified from a WorkerScript").toUtf8(); + } + + QDeclarativeEngine m_engine; +}; + +void tst_QDeclarativeWorkerListModel::clear() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml"); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item != 0); + QDeclarativeWorkerListModel *model = item->property("model").value(); + QVERIFY(model != 0); + + QCOMPARE(model->count(), 0); + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})"))); + QTRY_COMPARE(model->count(), 1); + + QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData()); + model->clear(); + QCOMPARE(model->count(), 1); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "clear()"))); + QTRY_COMPARE(model->count(), 0); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerListModel::remove() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml"); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item != 0); + QDeclarativeWorkerListModel *model = item->property("model").value(); + QVERIFY(model != 0); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})"))); + QTRY_COMPARE(model->count(), 1); + + QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData()); + model->remove(0); + QCOMPARE(model->count(), 1); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "remove(0)"))); + QTRY_COMPARE(model->count(), 0); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerListModel::append() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml"); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item != 0); + QDeclarativeWorkerListModel *model = item->property("model").value(); + QVERIFY(model != 0); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})"))); + QTRY_COMPARE(model->count(), 1); + + QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData()); + model->append(QScriptValue(1)); + QCOMPARE(model->count(), 1); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerListModel::insert() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml"); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item != 0); + QDeclarativeWorkerListModel *model = item->property("model").value(); + QVERIFY(model != 0); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "insert(0, {'name': 'A'})"))); + QTRY_COMPARE(model->count(), 1); + + QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData()); + model->insert(0, QScriptValue(1)); + QCOMPARE(model->count(), 1); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerListModel::get() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml"); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item != 0); + QDeclarativeWorkerListModel *model = item->property("model").value(); + QVERIFY(model != 0); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})"))); + QTRY_COMPARE(model->count(), 1); + QCOMPARE(model->get(0).property("name").toString(), QString("A")); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerListModel::set() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/model.qml"); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item != 0); + QDeclarativeWorkerListModel *model = item->property("model").value(); + QVERIFY(model != 0); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "append({'name': 'A'})"))); + QTRY_COMPARE(model->count(), 1); + + QTest::ignoreMessage(QtWarningMsg, modificationWarning().constData()); + model->set(0, QScriptValue(1)); + + QVERIFY(QMetaObject::invokeMethod(item, "workerModifyModel", Q_ARG(QVariant, "set(0, {'name': 'Z'})"))); + QTRY_COMPARE(model->get(0).property("name").toString(), QString("Z")); + + qApp->processEvents(); +} + +QTEST_MAIN(tst_QDeclarativeWorkerListModel) + +#include "tst_qdeclarativeworkerlistmodel.moc" + -- cgit v0.12 From e71f8823d22c99a4da7de4f49463a05427186c0f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 1 Mar 2010 15:55:03 +1000 Subject: Example of text focus. Task-number: QT-448 --- examples/declarative/focusscope/test5.qml | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 examples/declarative/focusscope/test5.qml diff --git a/examples/declarative/focusscope/test5.qml b/examples/declarative/focusscope/test5.qml new file mode 100644 index 0000000..da98350 --- /dev/null +++ b/examples/declarative/focusscope/test5.qml @@ -0,0 +1,83 @@ +import Qt 4.6 + +Rectangle { + color: "white" + width: 800 + height: 600 + + Keys.onReturnPressed: console.log("Error - Root") + + FocusScope { + id: myScope + focus: true + + Keys.onReturnPressed: console.log("Error - FocusScope") + + Rectangle { + height: 120 + width: 420 + + color: "transparent" + border.width: 5 + border.color: myScope.wantsFocus?"blue":"black" + + Rectangle { + x: 10; y: 10 + width: 100; height: 100; color: "green" + border.width: 5 + border.color: item1.wantsFocus?"blue":"black" + } + + TextEdit { + id: item1 + x: 20; y: 20 + width: 90; height: 90 + color: "white" + font.pixelSize: 20 + Keys.onReturnPressed: console.log("Top Left"); + KeyNavigation.right: item2 + focus: true + wrap: true + text: "Box 1" + } + + Rectangle { + id: item2 + x: 310; y: 10 + width: 100; height: 100; color: "green" + border.width: 5 + border.color: wantsFocus?"blue":"black" + KeyNavigation.left: item1 + Keys.onReturnPressed: console.log("Top Right"); + + Rectangle { + width: 50; height: 50; anchors.centerIn: parent + color: parent.focus?"red":"transparent" + } + } + } + KeyNavigation.down: item3 + } + + Text { x:100; y:170; text: "Blue border indicates scoped focus\nBlack border indicates NOT scoped focus\nRed box or flashing cursor indicates active focus\nUse arrow keys to navigate\nPress Ctrl-Return to print currently focused item" } + + Rectangle { + x: 10; y: 300 + width: 100; height: 100; color: "green" + border.width: 5 + border.color: item3.wantsFocus?"blue":"black" + } + + TextEdit { + id: item3 + x: 20; y: 310 + width: 90; height: 90 + color: "white" + font.pixelSize: 20 + text: "Box 3" + + Keys.onReturnPressed: console.log("Bottom Left"); + KeyNavigation.up: myScope + wrap: true + } +} -- cgit v0.12 From 05f9a6aa5d6e4f20eb4dacff3acea9d186867ab1 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 26 Feb 2010 16:34:28 +1000 Subject: Add NOTIFY signals to list, grid and path views Reviewed-by: akennedy --- .../graphicsitems/qdeclarativegridview.cpp | 12 +- .../graphicsitems/qdeclarativegridview_p.h | 20 ++- .../graphicsitems/qdeclarativelistview.cpp | 24 ++- .../graphicsitems/qdeclarativelistview_p.h | 38 +++-- src/declarative/graphicsitems/qdeclarativepath.cpp | 11 +- src/declarative/graphicsitems/qdeclarativepath_p.h | 11 +- .../graphicsitems/qdeclarativepathview.cpp | 26 +++- .../graphicsitems/qdeclarativepathview_p.h | 18 ++- .../qdeclarativegridview/data/propertychanges.qml | 69 +++++++++ .../tst_qdeclarativegridview.cpp | 122 ++++++++++++++- .../qdeclarativelistview/data/propertychanges.qml | 71 +++++++++ .../tst_qdeclarativelistview.cpp | 168 +++++++++++++++++++-- .../qdeclarativepathview/data/displaypath.qml | 2 +- .../qdeclarativepathview/data/pathview.qml | 2 +- .../qdeclarativepathview/data/pathview3.qml | 2 +- .../qdeclarativepathview/data/propertychanges.qml | 115 ++++++++++++++ .../tst_qdeclarativepathview.cpp | 167 +++++++++++++++++++- 17 files changed, 818 insertions(+), 60 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml create mode 100644 tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml create mode 100644 tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 8d778f8..090c46d 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -619,7 +619,7 @@ void QDeclarativeGridViewPrivate::createHighlight() } } if (changed) - emit q->highlightChanged(); + emit q->highlightItemChanged(); } void QDeclarativeGridViewPrivate::updateHighlight() @@ -785,6 +785,8 @@ QVariant QDeclarativeGridView::model() const void QDeclarativeGridView::setModel(const QVariant &model) { Q_D(QDeclarativeGridView); + if (d->modelVariant == model) + return; if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); @@ -829,6 +831,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } + emit modelChanged(); } /*! @@ -872,6 +875,7 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate) d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); } + emit delegateChanged(); } } @@ -967,6 +971,7 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight) if (highlight != d->highlightComponent) { d->highlightComponent = highlight; d->updateCurrent(d->currentIndex); + emit highlightChanged(); } } @@ -1040,6 +1045,7 @@ void QDeclarativeGridView::setFlow(Flow flow) d->updateGrid(); refill(); d->updateCurrent(d->currentIndex); + emit flowChanged(); } } @@ -1059,7 +1065,10 @@ bool QDeclarativeGridView::isWrapEnabled() const void QDeclarativeGridView::setWrapEnabled(bool wrap) { Q_D(QDeclarativeGridView); + if (d->wrap == wrap) + return; d->wrap = wrap; + emit keyNavigationWrapsChanged(); } /*! @@ -1083,6 +1092,7 @@ void QDeclarativeGridView::setCacheBuffer(int buffer) d->buffer = buffer; if (isComponentComplete()) refill(); + emit cacheBufferChanged(); } } diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index b488475..d463a46 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -57,19 +57,19 @@ class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGridView) - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight) - Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged) + Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) + Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) - Q_PROPERTY(Flow flow READ flow WRITE setFlow) - Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled) - Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) + Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) + Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) + Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged) Q_PROPERTY(int cellHeight READ cellHeight WRITE setCellHeight NOTIFY cellHeightChanged) Q_CLASSINFO("DefaultProperty", "data") @@ -129,6 +129,12 @@ Q_SIGNALS: void cellWidthChanged(); void cellHeightChanged(); void highlightChanged(); + void highlightItemChanged(); + void modelChanged(); + void delegateChanged(); + void flowChanged(); + void keyNavigationWrapsChanged(); + void cacheBufferChanged(); protected: virtual void viewportMoved(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 02a8493..a05e638 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -817,7 +817,7 @@ void QDeclarativeListViewPrivate::createHighlight() } } if (changed) - emit q->highlightChanged(); + emit q->highlightItemChanged(); } void QDeclarativeListViewPrivate::updateHighlight() @@ -1474,6 +1474,8 @@ QVariant QDeclarativeListView::model() const void QDeclarativeListView::setModel(const QVariant &model) { Q_D(QDeclarativeListView); + if (d->modelVariant == model) + return; if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); @@ -1518,6 +1520,7 @@ void QDeclarativeListView::setModel(const QVariant &model) connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } + emit modelChanged(); } /*! @@ -1564,6 +1567,7 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate) d->updateCurrent(d->currentIndex); } } + emit delegateChanged(); } /*! @@ -1664,6 +1668,7 @@ void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight) d->createHighlight(); if (d->currentItem) d->updateHighlight(); + emit highlightChanged(); } } @@ -1701,6 +1706,7 @@ void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight) d->highlightSizeAnimator->setEnabled(d->autoHighlight); } d->updateHighlight(); + emit highlightFollowsCurrentItemChanged(); } } @@ -1746,8 +1752,11 @@ qreal QDeclarativeListView::preferredHighlightBegin() const void QDeclarativeListView::setPreferredHighlightBegin(qreal start) { Q_D(QDeclarativeListView); + if (d->highlightRangeStart == start) + return; d->highlightRangeStart = start; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + emit preferredHighlightBeginChanged(); } qreal QDeclarativeListView::preferredHighlightEnd() const @@ -1759,8 +1768,11 @@ qreal QDeclarativeListView::preferredHighlightEnd() const void QDeclarativeListView::setPreferredHighlightEnd(qreal end) { Q_D(QDeclarativeListView); + if (d->highlightRangeEnd == end) + return; d->highlightRangeEnd = end; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + emit preferredHighlightEndChanged(); } QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMode() const @@ -1772,8 +1784,11 @@ QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMod void QDeclarativeListView::setHighlightRangeMode(HighlightRangeMode mode) { Q_D(QDeclarativeListView); + if (d->highlightRange == mode) + return; d->highlightRange = mode; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + emit highlightRangeModeChanged(); } /*! @@ -1849,7 +1864,10 @@ bool QDeclarativeListView::isWrapEnabled() const void QDeclarativeListView::setWrapEnabled(bool wrap) { Q_D(QDeclarativeListView); + if (d->wrap == wrap) + return; d->wrap = wrap; + emit keyNavigationWrapsChanged(); } /*! @@ -1875,6 +1893,7 @@ void QDeclarativeListView::setCacheBuffer(int b) d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter; refill(); } + emit cacheBufferChanged(); } } @@ -1999,6 +2018,7 @@ void QDeclarativeListView::setSnapMode(SnapMode mode) Q_D(QDeclarativeListView); if (d->snapMode != mode) { d->snapMode = mode; + emit snapModeChanged(); } } @@ -2021,6 +2041,7 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer) d->maxExtentDirty = true; d->updateFooter(); d->updateViewport(); + emit footerChanged(); } } @@ -2044,6 +2065,7 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header) d->updateHeader(); d->updateFooter(); d->updateViewport(); + emit headerChanged(); } } diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 5e3edb0..f9b7b50 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -91,33 +91,33 @@ class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView) - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight) - Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged) - Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) + Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) + Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) + Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem NOTIFY highlightFollowsCurrentItemChanged) Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged) Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged) - Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin) - Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd) - Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode) + Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) + Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) + Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) - Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled) - Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) + Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) + Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT) Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged) - Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode) + Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged) - Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader) - Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter) + Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader NOTIFY headerChanged) + Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter NOTIFY footerChanged) Q_ENUMS(HighlightRangeMode) Q_ENUMS(Orientation) @@ -205,6 +205,18 @@ Q_SIGNALS: void highlightMoveSpeedChanged(); void highlightResizeSpeedChanged(); void highlightChanged(); + void highlightItemChanged(); + void modelChanged(); + void delegateChanged(); + void highlightFollowsCurrentItemChanged(); + void preferredHighlightBeginChanged(); + void preferredHighlightEndChanged(); + void highlightRangeModeChanged(); + void keyNavigationWrapsChanged(); + void cacheBufferChanged(); + void snapModeChanged(); + void headerChanged(); + void footerChanged(); protected: virtual void viewportMoved(); diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index 48f112a..80586b8 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -114,7 +114,10 @@ qreal QDeclarativePath::startX() const void QDeclarativePath::setStartX(qreal x) { Q_D(QDeclarativePath); + if (qFuzzyCompare(x, d->startX)) + return; d->startX = x; + emit startXChanged(); } qreal QDeclarativePath::startY() const @@ -126,7 +129,10 @@ qreal QDeclarativePath::startY() const void QDeclarativePath::setStartY(qreal y) { Q_D(QDeclarativePath); + if (qFuzzyCompare(y, d->startY)) + return; d->startY = y; + emit startYChanged(); } /*! @@ -522,7 +528,10 @@ QString QDeclarativePathAttribute::name() const void QDeclarativePathAttribute::setName(const QString &name) { - _name = name; + if (_name == name) + return; + _name = name; + emit nameChanged(); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h index b3139f8..d7cfca1 100644 --- a/src/declarative/graphicsitems/qdeclarativepath_p.h +++ b/src/declarative/graphicsitems/qdeclarativepath_p.h @@ -67,7 +67,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathAttribute : public QDeclarativePathEl { Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) public: QDeclarativePathAttribute(QObject *parent=0) : QDeclarativePathElement(parent), _value(0) {} @@ -79,6 +79,9 @@ public: qreal value() const; void setValue(qreal value); +Q_SIGNALS: + void nameChanged(); + private: QString _name; qreal _value; @@ -190,8 +193,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativePath : public QObject, public QDeclarativ Q_INTERFACES(QDeclarativeParserStatus) Q_PROPERTY(QDeclarativeListProperty pathElements READ pathElements) - Q_PROPERTY(qreal startX READ startX WRITE setStartX) - Q_PROPERTY(qreal startY READ startY WRITE setStartY) + Q_PROPERTY(qreal startX READ startX WRITE setStartX NOTIFY startXChanged) + Q_PROPERTY(qreal startY READ startY WRITE setStartY NOTIFY startYChanged) Q_PROPERTY(bool closed READ isClosed NOTIFY changed) Q_CLASSINFO("DefaultProperty", "pathElements") Q_INTERFACES(QDeclarativeParserStatus) @@ -216,6 +219,8 @@ public: Q_SIGNALS: void changed(); + void startXChanged(); + void startYChanged(); protected: virtual void componentComplete(); diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index f1b0213..50aa9ef 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -203,6 +203,9 @@ QVariant QDeclarativePathView::model() const void QDeclarativePathView::setModel(const QVariant &model) { Q_D(QDeclarativePathView); + if (d->modelVariant == model) + return; + if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); @@ -242,6 +245,7 @@ void QDeclarativePathView::setModel(const QVariant &model) d->pathOffset = 0; d->regenerate(); d->fixOffset(); + emit modelChanged(); } /*! @@ -269,9 +273,12 @@ QDeclarativePath *QDeclarativePathView::path() const void QDeclarativePathView::setPath(QDeclarativePath *path) { Q_D(QDeclarativePathView); + if (d->path == path) + return; d->path = path; connect(d->path, SIGNAL(changed()), this, SLOT(refill())); d->regenerate(); + emit pathChanged(); } /*! @@ -333,7 +340,7 @@ void QDeclarativePathViewPrivate::setOffset(qreal o) /*! \qmlproperty real PathView::snapPosition - This property determines the position (0-100) the nearest item will snap to. + This property determines the position (0.0-1.0) the nearest item will snap to. */ qreal QDeclarativePathView::snapPosition() const { @@ -344,8 +351,12 @@ qreal QDeclarativePathView::snapPosition() const void QDeclarativePathView::setSnapPosition(qreal pos) { Q_D(QDeclarativePathView); - d->snapPos = pos/100; + qreal normalizedPos = pos - int(pos); + if (qFuzzyCompare(normalizedPos, d->snapPos)) + return; + d->snapPos = normalizedPos; d->fixOffset(); + emit snapPositionChanged(); } /*! @@ -365,7 +376,10 @@ qreal QDeclarativePathView::dragMargin() const void QDeclarativePathView::setDragMargin(qreal dragMargin) { Q_D(QDeclarativePathView); + if (d->dragMargin == dragMargin) + return; d->dragMargin = dragMargin; + emit dragMarginChanged(); } /*! @@ -392,16 +406,19 @@ QDeclarativeComponent *QDeclarativePathView::delegate() const return 0; } -void QDeclarativePathView::setDelegate(QDeclarativeComponent *c) +void QDeclarativePathView::setDelegate(QDeclarativeComponent *delegate) { Q_D(QDeclarativePathView); + if (delegate == this->delegate()) + return; if (!d->ownModel) { d->model = new QDeclarativeVisualDataModel(qmlContext(this)); d->ownModel = true; } if (QDeclarativeVisualDataModel *dataModel = qobject_cast(d->model)) { - dataModel->setDelegate(c); + dataModel->setDelegate(delegate); d->regenerate(); + emit delegateChanged(); } } @@ -422,6 +439,7 @@ void QDeclarativePathView::setPathItemCount(int i) return; d->pathItems = i; d->regenerate(); + pathItemCountChanged(); } QPointF QDeclarativePathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 709a4fc..df9c6ae 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -56,15 +56,15 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem { Q_OBJECT - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath NOTIFY pathChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged) - Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition) - Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin) + Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition NOTIFY snapPositionChanged) + Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin NOTIFY dragMarginChanged) Q_PROPERTY(int count READ count) - Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate) - Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount) + Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) + Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount NOTIFY pathItemCountChanged) public: QDeclarativePathView(QDeclarativeItem *parent=0); @@ -101,6 +101,12 @@ public: Q_SIGNALS: void currentIndexChanged(); void offsetChanged(); + void modelChanged(); + void pathChanged(); + void dragMarginChanged(); + void snapPositionChanged(); + void delegateChanged(); + void pathItemCountChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml new file mode 100644 index 0000000..da2e8d0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/propertychanges.qml @@ -0,0 +1,69 @@ +import Qt 4.6 + +Rectangle { + width: 360; height: 120; color: "white" + Component { + id: delegate + Item { + id: wrapper + width: 180; height: 40; + Column { + x: 5; y: 5 + Text { text: 'Name: ' + name } + Text { text: 'Number: ' + number } + } + } + } + Component { + id: highlightRed + Rectangle { + color: "red" + radius: 10 + opacity: 0.5 + } + } + GridView { + cellWidth:180 + cellHeight:40 + objectName: "gridView" + anchors.fill: parent + model: listModel + delegate: delegate + highlight: highlightRed + focus: true + keyNavigationWraps: true + cacheBuffer: 10 + flow: GridView.LeftToRight + } + + data:[ + ListModel { + id: listModel + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + }, + ListModel { + objectName: "alternateModel" + ListElement { + name: "Jack" + number: "555 8426" + } + ListElement { + name: "Mary" + number: "555 3264" + } + } + ] +} + + \ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 7a6a060..5d57bb4 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -39,10 +39,8 @@ ** ****************************************************************************/ -#include -#include -#include #include +<<<<<<< HEAD #include #include #include @@ -50,6 +48,18 @@ #include #include #include +======= +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +>>>>>>> Add NOTIFY signals to list, grid and path views class tst_QDeclarativeGridView : public QObject { @@ -67,6 +77,9 @@ private slots: void currentIndex(); void defaultValues(); void properties(); + void propertyChanges(); + void componentChanges(); + void modelChanges(); void positionViewAtIndex(); void resetModel(); void QTBUG_8456(); @@ -92,7 +105,7 @@ public: setRoleNames(roles); } - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); } QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { QVariant rv; if (role == Name) @@ -803,6 +816,107 @@ void tst_QDeclarativeGridView::properties() delete obj; } +void tst_QDeclarativeGridView::propertyChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeGridView *gridView = canvas->rootObject()->findChild("gridView"); + QVERIFY(gridView); + + QSignalSpy keyNavigationWrapsSpy(gridView, SIGNAL(keyNavigationWrapsChanged())); + QSignalSpy cacheBufferSpy(gridView, SIGNAL(cacheBufferChanged())); + QSignalSpy flowSpy(gridView, SIGNAL(flowChanged())); + + QCOMPARE(gridView->isWrapEnabled(), true); + QCOMPARE(gridView->cacheBuffer(), 10); + QCOMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight); + + gridView->setWrapEnabled(false); + gridView->setCacheBuffer(3); + gridView->setFlow(QDeclarativeGridView::TopToBottom); + + QCOMPARE(gridView->isWrapEnabled(), false); + QCOMPARE(gridView->cacheBuffer(), 3); + QCOMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom); + + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(flowSpy.count(),1); + + gridView->setWrapEnabled(false); + gridView->setCacheBuffer(3); + gridView->setFlow(QDeclarativeGridView::TopToBottom); + + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(flowSpy.count(),1); + + delete canvas; +} + +void tst_QDeclarativeGridView::componentChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeGridView *gridView = canvas->rootObject()->findChild("gridView"); + QVERIFY(gridView); + + QDeclarativeComponent component(canvas->engine()); + component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + + QDeclarativeComponent delegateComponent(canvas->engine()); + delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + + QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged())); + QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged())); + + gridView->setHighlight(&component); + gridView->setDelegate(&delegateComponent); + + QCOMPARE(gridView->highlight(), &component); + QCOMPARE(gridView->delegate(), &delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + + gridView->setHighlight(&component); + gridView->setDelegate(&delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + delete canvas; +} + +void tst_QDeclarativeGridView::modelChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeGridView *gridView = canvas->rootObject()->findChild("gridView"); + QVERIFY(gridView); + + QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild("alternateModel"); + QVERIFY(alternateModel); + QVariant modelVariant = QVariant::fromValue(alternateModel); + QSignalSpy modelSpy(gridView, SIGNAL(modelChanged())); + + gridView->setModel(modelVariant); + QCOMPARE(gridView->model(), modelVariant); + QCOMPARE(modelSpy.count(),1); + + gridView->setModel(modelVariant); + QCOMPARE(modelSpy.count(),1); + + gridView->setModel(QVariant()); + QCOMPARE(modelSpy.count(),2); + delete canvas; +} + void tst_QDeclarativeGridView::positionViewAtIndex() { QDeclarativeView *canvas = createView(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml new file mode 100644 index 0000000..a41f003 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/propertychanges.qml @@ -0,0 +1,71 @@ +import Qt 4.6 + +Rectangle { + width: 180; height: 120; color: "white" + Component { + id: delegate + Item { + id: wrapper + width: 180; height: 40; + Column { + x: 5; y: 5 + Text { text: 'Name: ' + name } + Text { text: 'Number: ' + number } + } + } + } + Component { + id: highlightRed + Rectangle { + color: "red" + radius: 10 + opacity: 0.5 + } + } + ListView { + objectName: "listView" + anchors.fill: parent + model: listModel + delegate: delegate + highlight: highlightRed + focus: true + highlightFollowsCurrentItem: true + preferredHighlightBegin: 0.0 + preferredHighlightEnd: 0.0 + highlightRangeMode: ListView.ApplyRange + keyNavigationWraps: true + cacheBuffer: 10 + snapMode: ListView.SnapToItem + } + + data:[ + ListModel { + id: listModel + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + }, + ListModel { + objectName: "alternateModel" + ListElement { + name: "Jack" + number: "555 8426" + } + ListElement { + name: "Mary" + number: "555 3264" + } + } + ] +} + + \ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index f15f26b..a36224f 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -38,15 +38,18 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include class tst_QDeclarativeListView : public QObject { @@ -82,6 +85,9 @@ private slots: void cacheBuffer(); void positionViewAtIndex(); void resetModel(); + void propertyChanges(); + void componentChanges(); + void modelChanges(); private: template void items(); @@ -240,7 +246,7 @@ public: setRoleNames(roles); } - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); } QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { QVariant rv; if (role == Name) @@ -379,6 +385,7 @@ void tst_QDeclarativeListView::items() delete canvas; } + template void tst_QDeclarativeListView::changed() { @@ -1275,6 +1282,149 @@ void tst_QDeclarativeListView::resetModel() } } +void tst_QDeclarativeListView::propertyChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeListView *listView = canvas->rootObject()->findChild("listView"); + QVERIFY(listView); + + QSignalSpy highlightFollowsCurrentItemSpy(listView, SIGNAL(highlightFollowsCurrentItemChanged())); + QSignalSpy preferredHighlightBeginSpy(listView, SIGNAL(preferredHighlightBeginChanged())); + QSignalSpy preferredHighlightEndSpy(listView, SIGNAL(preferredHighlightEndChanged())); + QSignalSpy highlightRangeModeSpy(listView, SIGNAL(highlightRangeModeChanged())); + QSignalSpy keyNavigationWrapsSpy(listView, SIGNAL(keyNavigationWrapsChanged())); + QSignalSpy cacheBufferSpy(listView, SIGNAL(cacheBufferChanged())); + QSignalSpy snapModeSpy(listView, SIGNAL(snapModeChanged())); + + QCOMPARE(listView->highlightFollowsCurrentItem(), true); + QCOMPARE(listView->preferredHighlightBegin(), 0.0); + QCOMPARE(listView->preferredHighlightEnd(), 0.0); + QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::ApplyRange); + QCOMPARE(listView->isWrapEnabled(), true); + QCOMPARE(listView->cacheBuffer(), 10); + QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapToItem); + + listView->setHighlightFollowsCurrentItem(false); + listView->setPreferredHighlightBegin(1.0); + listView->setPreferredHighlightEnd(1.0); + listView->setHighlightRangeMode(QDeclarativeListView::StrictlyEnforceRange); + listView->setWrapEnabled(false); + listView->setCacheBuffer(3); + listView->setSnapMode(QDeclarativeListView::SnapOneItem); + + QCOMPARE(listView->highlightFollowsCurrentItem(), false); + QCOMPARE(listView->preferredHighlightBegin(), 1.0); + QCOMPARE(listView->preferredHighlightEnd(), 1.0); + QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); + QCOMPARE(listView->isWrapEnabled(), false); + QCOMPARE(listView->cacheBuffer(), 3); + QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapOneItem); + + QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); + QCOMPARE(preferredHighlightBeginSpy.count(),1); + QCOMPARE(preferredHighlightEndSpy.count(),1); + QCOMPARE(highlightRangeModeSpy.count(),1); + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(snapModeSpy.count(),1); + + listView->setHighlightFollowsCurrentItem(false); + listView->setPreferredHighlightBegin(1.0); + listView->setPreferredHighlightEnd(1.0); + listView->setHighlightRangeMode(QDeclarativeListView::StrictlyEnforceRange); + listView->setWrapEnabled(false); + listView->setCacheBuffer(3); + listView->setSnapMode(QDeclarativeListView::SnapOneItem); + + QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); + QCOMPARE(preferredHighlightBeginSpy.count(),1); + QCOMPARE(preferredHighlightEndSpy.count(),1); + QCOMPARE(highlightRangeModeSpy.count(),1); + QCOMPARE(keyNavigationWrapsSpy.count(),1); + QCOMPARE(cacheBufferSpy.count(),1); + QCOMPARE(snapModeSpy.count(),1); + + delete canvas; +} + +void tst_QDeclarativeListView::componentChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeListView *listView = canvas->rootObject()->findChild("listView"); + QVERIFY(listView); + + QDeclarativeComponent component(canvas->engine()); + component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + + QDeclarativeComponent delegateComponent(canvas->engine()); + delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + + QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged())); + QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged())); + QSignalSpy headerSpy(listView, SIGNAL(headerChanged())); + QSignalSpy footerSpy(listView, SIGNAL(footerChanged())); + + listView->setHighlight(&component); + listView->setHeader(&component); + listView->setFooter(&component); + listView->setDelegate(&delegateComponent); + + QCOMPARE(listView->highlight(), &component); + QCOMPARE(listView->header(), &component); + QCOMPARE(listView->footer(), &component); + QCOMPARE(listView->delegate(), &delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + QCOMPARE(headerSpy.count(),1); + QCOMPARE(footerSpy.count(),1); + + listView->setHighlight(&component); + listView->setHeader(&component); + listView->setFooter(&component); + listView->setDelegate(&delegateComponent); + + QCOMPARE(highlightSpy.count(),1); + QCOMPARE(delegateSpy.count(),1); + QCOMPARE(headerSpy.count(),1); + QCOMPARE(footerSpy.count(),1); + + delete canvas; +} + +void tst_QDeclarativeListView::modelChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativeListView *listView = canvas->rootObject()->findChild("listView"); + QVERIFY(listView); + + QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild("alternateModel"); + QVERIFY(alternateModel); + QVariant modelVariant = QVariant::fromValue(alternateModel); + QSignalSpy modelSpy(listView, SIGNAL(modelChanged())); + + listView->setModel(modelVariant); + QCOMPARE(listView->model(), modelVariant); + QCOMPARE(modelSpy.count(),1); + + listView->setModel(modelVariant); + QCOMPARE(modelSpy.count(),1); + + listView->setModel(QVariant()); + QCOMPARE(modelSpy.count(),2); + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); diff --git a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml index 627f38a..ab1538b 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml @@ -33,7 +33,7 @@ Rectangle { height: 320 model: testModel delegate: delegate - snapPosition: 0.01 + snapPosition: 0.0001 path: Path { startY: 120 startX: 160 diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml index 8fa8d59..c5d88cd 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml @@ -39,7 +39,7 @@ Rectangle { height: 320 model: testModel delegate: delegate - snapPosition: 0.01 + snapPosition: 0.0001 path: Path { startY: 120 startX: 160 diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml index af3ae13..f8ed29f 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml @@ -3,7 +3,7 @@ import Qt 4.6 PathView { id: photoPathView y: 100; width: 800; height: 330; pathItemCount: 4; offset: 10 - dragMargin: 24; snapPosition: 50 + dragMargin: 24; snapPosition: 0.50 path: Path { startX: -50; startY: 40; diff --git a/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml new file mode 100644 index 0000000..db70b7b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml @@ -0,0 +1,115 @@ +import Qt 4.6 + +Rectangle { + width: 350; height: 220; color: "white" + Component { + id: myDelegate + Item { + id: wrapper + width: 180; height: 40; + opacity: PathView.opacity + Column { + x: 5; y: 5 + Text { text: 'Name: ' + name } + Text { text: 'Number: ' + number } + } + } + } + + PathView { + snapPosition: 0.1 + dragMargin: 5.0 + id: pathView + objectName: "pathView" + anchors.fill: parent + model: listModel + delegate: myDelegate + focus: true + path: Path { + id: myPath + objectName: "path" + startX: 220; startY: 200 + PathAttribute { name: "opacity"; value: 1.0; objectName: "pathAttribute"; } + PathQuad { x: 220; y: 25; controlX: 260; controlY: 75 } + PathAttribute { name: "opacity"; value: 0.3 } + PathQuad { x: 220; y: 200; controlX: -20; controlY: 75 } + } + Timer { + interval: 2000; running: true; repeat: true + onTriggered: { + if (pathView.path == alternatePath) + pathView.path = myPath; + else + pathView.path = alternatePath; + } + } + } + + data:[ + ListModel { + id: listModel + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + }, + ListModel { + objectName: "alternateModel" + ListElement { + name: "Jack" + number: "555 8426" + } + ListElement { + name: "Mary" + number: "555 3264" + } + }, + Path { + id: alternatePath + objectName: "alternatePath" + startX: 100; startY: 40 + PathAttribute { name: "opacity"; value: 0.0 } + PathLine { x: 100; y: 160 } + PathAttribute { name: "opacity"; value: 0.2 } + PathLine { x: 300; y: 160 } + PathAttribute { name: "opacity"; value: 0.0 } + PathLine { x: 300; y: 40 } + PathAttribute { name: "opacity"; value: 0.2 } + PathLine { x: 100; y: 40 } + } + ] +} + + diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 79bc607..fa4e9d3 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -38,20 +38,23 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include -#include -#include -#include -#include + +#include +#include #include #include -#include +#include +#include +#include +#include #include #include +#include +#include #include #include #include -#include + #include "../../../shared/util.h" class tst_QDeclarativePathView : public QObject @@ -69,6 +72,11 @@ private slots: void path(); void pathMoved(); void resetModel(); + void propertyChanges(); + void pathChanges(); + void componentChanges(); + void modelChanges(); + private: QDeclarativeView *createView(); @@ -120,7 +128,7 @@ public: setRoleNames(roles); } - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); } QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { QVariant rv; if (role == Name) @@ -465,6 +473,149 @@ void tst_QDeclarativePathView::resetModel() } } +void tst_QDeclarativePathView::propertyChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QSignalSpy snapPositionSpy(pathView, SIGNAL(snapPositionChanged())); + QSignalSpy dragMarginSpy(pathView, SIGNAL(dragMarginChanged())); + + QCOMPARE(pathView->snapPosition(), 0.1); + QCOMPARE(pathView->dragMargin(), 5.0); + + pathView->setSnapPosition(0.4); + pathView->setDragMargin(20.0); + + QCOMPARE(pathView->snapPosition(), 0.4); + QCOMPARE(pathView->dragMargin(), 20.0); + + QCOMPARE(snapPositionSpy.count(), 1); + QCOMPARE(dragMarginSpy.count(), 1); + + pathView->setSnapPosition(0.4); + pathView->setDragMargin(20.0); + + QCOMPARE(snapPositionSpy.count(), 1); + QCOMPARE(dragMarginSpy.count(), 1); + delete canvas; +} + +void tst_QDeclarativePathView::pathChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativePath *path = canvas->rootObject()->findChild("path"); + QVERIFY(path); + + QSignalSpy startXSpy(path, SIGNAL(startXChanged())); + QSignalSpy startYSpy(path, SIGNAL(startYChanged())); + + QCOMPARE(path->startX(), 220.0); + QCOMPARE(path->startY(), 200.0); + + path->setStartX(240.0); + path->setStartY(220.0); + + QCOMPARE(path->startX(), 240.0); + QCOMPARE(path->startY(), 220.0); + + QCOMPARE(startXSpy.count(),1); + QCOMPARE(startYSpy.count(),1); + + path->setStartX(240); + path->setStartY(220); + + QCOMPARE(startXSpy.count(),1); + QCOMPARE(startYSpy.count(),1); + + QDeclarativePath *alternatePath = canvas->rootObject()->findChild("alternatePath"); + QVERIFY(alternatePath); + + QSignalSpy pathSpy(pathView, SIGNAL(pathChanged())); + + QCOMPARE(pathView->path(), path); + + pathView->setPath(alternatePath); + QCOMPARE(pathView->path(), alternatePath); + QCOMPARE(pathSpy.count(),1); + + pathView->setPath(alternatePath); + QCOMPARE(pathSpy.count(),1); + + QDeclarativePathAttribute *pathAttribute = canvas->rootObject()->findChild("pathAttribute"); + QVERIFY(pathAttribute); + + QSignalSpy nameSpy(pathAttribute, SIGNAL(nameChanged())); + QCOMPARE(pathAttribute->name(), QString("opacity")); + + pathAttribute->setName("scale"); + QCOMPARE(pathAttribute->name(), QString("scale")); + QCOMPARE(nameSpy.count(),1); + + pathAttribute->setName("scale"); + QCOMPARE(nameSpy.count(),1); + delete canvas; +} + +void tst_QDeclarativePathView::componentChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativeComponent delegateComponent(canvas->engine()); + delegateComponent.setData("import Qt 4.6; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + + QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged())); + + pathView->setDelegate(&delegateComponent); + QCOMPARE(pathView->delegate(), &delegateComponent); + QCOMPARE(delegateSpy.count(),1); + + pathView->setDelegate(&delegateComponent); + QCOMPARE(delegateSpy.count(),1); + delete canvas; +} + +void tst_QDeclarativePathView::modelChanges() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild("alternateModel"); + QVERIFY(alternateModel); + QVariant modelVariant = QVariant::fromValue(alternateModel); + QSignalSpy modelSpy(pathView, SIGNAL(modelChanged())); + + pathView->setModel(modelVariant); + QCOMPARE(pathView->model(), modelVariant); + QCOMPARE(modelSpy.count(),1); + + pathView->setModel(modelVariant); + QCOMPARE(modelSpy.count(),1); + + pathView->setModel(QVariant()); + QCOMPARE(modelSpy.count(),2); + + delete canvas; +} QDeclarativeView *tst_QDeclarativePathView::createView() { -- cgit v0.12 From 657e7881c11f2f7b313ebd303e7be8f7a28e309e Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 2 Mar 2010 13:52:55 +1000 Subject: Forgot to add qworkerlistmodel test dir to declarative.pro --- tests/auto/declarative/declarative.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 42ff523..38c75a8 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -55,6 +55,7 @@ SUBDIRS += \ qdeclarativexmllistmodel \ # Cover qpacketprotocol \ # Cover qdeclarativerepeater \ # Cover + qdeclarativeworkerlistmodel \ # Cover qdeclarativevaluetypes \ # Cover qdeclarativexmlhttprequest \ # Cover qdeclarativeimageprovider \ # Cover -- cgit v0.12 From 3507c6fbbb585ea3b7f6a13b16fa216aea4574ab Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 14:35:02 +1000 Subject: Make test more reliable. --- .../qdeclarativeanimations/tst_qdeclarativeanimations.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 53c63b5..0c166df 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -221,17 +221,17 @@ void tst_qdeclarativeanimations::resume() QVERIFY(animation.from() == 10); animation.start(); - QTest::qWait(100); + QTest::qWait(200); animation.pause(); qreal x = rect.x(); - QVERIFY(x != qreal(200)); + QVERIFY(x != qreal(200) && x != qreal(10)); QVERIFY(animation.isRunning()); QVERIFY(animation.isPaused()); animation.resume(); QVERIFY(animation.isRunning()); QVERIFY(!animation.isPaused()); - QTest::qWait(100); + QTest::qWait(200); animation.stop(); QVERIFY(rect.x() > x); } -- cgit v0.12 From 861a9f127e04aa135649ed64f268d72da6a35fd9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 14:48:07 +1000 Subject: Add autotests for script block scoping. --- .../qdeclarativeecmascript/data/scriptScope.1.qml | 13 ++++++++++ .../qdeclarativeecmascript/data/scriptScope.2.qml | 11 +++++++++ .../qdeclarativeecmascript/data/scriptScope.js | 5 ++++ .../tst_qdeclarativeecmascript.cpp | 28 ++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml new file mode 100644 index 0000000..9b11fa9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml @@ -0,0 +1,13 @@ +import Qt.test 1.0 + +MyQmlObject { + property string result + + Script{ + function f() { + result = b + } + + } + onArgumentSignal: f() +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml new file mode 100644 index 0000000..ec727e2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml @@ -0,0 +1,11 @@ +import Qt.test 1.0 + +MyQmlObject { + property string result + property string aProp: "hello" + + Script{ + source: "scriptScope.js" + } + onBasicSignal: f() +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js new file mode 100644 index 0000000..5689930 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js @@ -0,0 +1,5 @@ +var aProp = "world"; + +function f() { + result = aProp; +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 60c380c..8e7944d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -122,6 +122,7 @@ private slots: void listToVariant(); void multiEngineObject(); void deletedObject(); + void scriptScope(); void bug1(); @@ -1657,6 +1658,33 @@ void tst_qdeclarativeecmascript::deletedObject() delete object; } +void tst_qdeclarativeecmascript::scriptScope() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("scriptScope.1.qml")); + + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + emit object->argumentSignal(19, "Hello world!", 10.3); + QEXPECT_FAIL("", "QTBUG-8641", Continue); + QCOMPARE(object->property("result").toString(), QLatin1String("undefined")); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("scriptScope.2.qml")); + + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + emit object->basicSignal(); + QEXPECT_FAIL("", "QTBUG-8641", Continue); + QCOMPARE(object->property("result").toString(), QLatin1String("world")); + + delete object; + } +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From 685c0b930a1d1ecfdcc78aa688a333564cc9ca5b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 2 Mar 2010 15:08:11 +1000 Subject: Optimization. --- src/declarative/qml/qdeclarativepropertycache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 08b47b7..fea59e5 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -155,9 +155,9 @@ QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObj int parenIdx = methodName.indexOf(QLatin1Char('(')); Q_ASSERT(parenIdx != -1); - methodName = methodName.left(parenIdx); + QStringRef methodNameRef = methodName.leftRef(parenIdx); - if (methodName == property) { + if (methodNameRef == property) { rv.load(m); return rv; } -- cgit v0.12 From c139d16df004721894c08e2c86ab2b3078c1d170 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 2 Mar 2010 15:47:19 +1000 Subject: missed file --- .../declarative/qdeclarativewebview/data/forward.png | Bin 0 -> 2377 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativewebview/data/forward.png diff --git a/tests/auto/declarative/qdeclarativewebview/data/forward.png b/tests/auto/declarative/qdeclarativewebview/data/forward.png new file mode 100644 index 0000000..a82533e Binary files /dev/null and b/tests/auto/declarative/qdeclarativewebview/data/forward.png differ -- cgit v0.12 From 26e6b837ceb90ed3d0df63b39a1cd0ec4dc7aeae Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 2 Mar 2010 15:54:14 +1000 Subject: follow syntax change --- demos/declarative/webbrowser/content/fieldtext/FieldText.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml index 19b6acc..d282209 100644 --- a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml +++ b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml @@ -85,7 +85,7 @@ Item { font.bold: true text: label opacity: textEdit.text == '' ? 1 : 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { property: "opacity" duration: 250 -- cgit v0.12 From feb79bba984520fa30bad83eb4a6f34cfb86a697 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 2 Mar 2010 15:55:06 +1000 Subject: Move WebView to an extension plugin. Using WebView now requires: import org.webkit 1.0 Task-number: QT-2995 --- demos/declarative/flickr/common/ImageDetails.qml | 1 + .../webbrowser/content/FlickableWebView.qml | 1 + demos/declarative/webbrowser/webbrowser.qml | 1 + examples/declarative/webview/autosize.qml | 1 + examples/declarative/webview/content/FieldText.qml | 2 +- .../declarative/webview/content/Mapping/Map.qml | 1 + examples/declarative/webview/evalandattach.qml | 1 + examples/declarative/webview/googleMaps.qml | 1 + examples/declarative/webview/inline-html.qml | 1 + examples/declarative/webview/newwindows.qml | 1 + .../declarative/webview/qdeclarative-in-html.qml | 1 + examples/declarative/webview/transparent.qml | 1 + imports/org/webkit/qmldir | 1 + src/declarative/graphicsitems/graphicsitems.pri | 7 - .../graphicsitems/qdeclarativeitemsmodule.cpp | 3 - .../graphicsitems/qdeclarativewebview.cpp | 1338 ------------------- .../graphicsitems/qdeclarativewebview_p.h | 286 ----- .../graphicsitems/qdeclarativewebview_p_p.h | 151 --- .../qdeclarativemodules/qdeclarativemodules.pro | 1 + .../qdeclarativemodules/webkitqmlplugin/plugin.cpp | 66 + .../webkitqmlplugin/qdeclarativewebview.cpp | 1340 ++++++++++++++++++++ .../webkitqmlplugin/qdeclarativewebview_p.h | 285 +++++ .../webkitqmlplugin/qdeclarativewebview_p_p.h | 151 +++ .../webkitqmlplugin/webkitqmlplugin.pro | 18 + .../declarative/qdeclarativewebview/data/basic.qml | 1 + .../qdeclarativewebview/data/elements.qml | 1 + .../qdeclarativewebview/data/javaScript.qml | 1 + .../qdeclarativewebview/data/loadError.qml | 1 + .../qdeclarativewebview/data/newwindows.qml | 1 + .../qdeclarativewebview/data/propertychanges.qml | 3 +- .../qdeclarativewebview/data/sethtml.qml | 1 + .../qdeclarativewebview/qdeclarativewebview.pro | 3 +- .../declarative/qdeclarativewebview/testtypes.cpp | 52 - .../declarative/qdeclarativewebview/testtypes.h | 66 - .../tst_qdeclarativewebview.cpp | 346 ++--- .../visual/qfxwebview/autosize/autosize.qml | 1 + .../visual/webview/embedding/nesting.qml | 1 + .../webview/javascript/evaluateJavaScript.qml | 1 + .../visual/webview/javascript/windowObjects.qml | 1 + .../visual/webview/settings/fontFamily.qml | 1 + .../visual/webview/settings/fontSize.qml | 1 + .../visual/webview/settings/noAutoLoadImages.qml | 1 + .../visual/webview/settings/setFontFamily.qml | 1 + .../visual/webview/zooming/pageWidth.qml | 1 + .../visual/webview/zooming/renderControl.qml | 1 + .../visual/webview/zooming/resolution.qml | 1 + .../visual/webview/zooming/zoomTextOnly.qml | 1 + .../declarative/visual/webview/zooming/zooming.qml | 1 + 48 files changed, 2072 insertions(+), 2077 deletions(-) create mode 100644 imports/org/webkit/qmldir delete mode 100644 src/declarative/graphicsitems/qdeclarativewebview.cpp delete mode 100644 src/declarative/graphicsitems/qdeclarativewebview_p.h delete mode 100644 src/declarative/graphicsitems/qdeclarativewebview_p_p.h create mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp create mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp create mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h create mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h create mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro delete mode 100644 tests/auto/declarative/qdeclarativewebview/testtypes.cpp delete mode 100644 tests/auto/declarative/qdeclarativewebview/testtypes.h diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index 9604f10..862eeb1 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Flipable { id: container diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 76a5813..cf4c825 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Flickable { property alias title: webView.title diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 6a427f4..b6cccb0 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 import "content" diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml index 74c6844..3c00ee6 100644 --- a/examples/declarative/webview/autosize.qml +++ b/examples/declarative/webview/autosize.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 // The WebView size is determined by the width, height, // preferredWidth, and preferredHeight properties. diff --git a/examples/declarative/webview/content/FieldText.qml b/examples/declarative/webview/content/FieldText.qml index 19b6acc..d282209 100644 --- a/examples/declarative/webview/content/FieldText.qml +++ b/examples/declarative/webview/content/FieldText.qml @@ -85,7 +85,7 @@ Item { font.bold: true text: label opacity: textEdit.text == '' ? 1 : 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { property: "opacity" duration: 250 diff --git a/examples/declarative/webview/content/Mapping/Map.qml b/examples/declarative/webview/content/Mapping/Map.qml index 2e98940..6c3b021 100644 --- a/examples/declarative/webview/content/Mapping/Map.qml +++ b/examples/declarative/webview/content/Mapping/Map.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Item { id: page diff --git a/examples/declarative/webview/evalandattach.qml b/examples/declarative/webview/evalandattach.qml index 94301cd..d219d84 100644 --- a/examples/declarative/webview/evalandattach.qml +++ b/examples/declarative/webview/evalandattach.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Item { height: 640 diff --git a/examples/declarative/webview/googleMaps.qml b/examples/declarative/webview/googleMaps.qml index 1886961..a04fecb 100644 --- a/examples/declarative/webview/googleMaps.qml +++ b/examples/declarative/webview/googleMaps.qml @@ -6,6 +6,7 @@ // order to create a Map. import Qt 4.6 +import org.webkit 1.0 import "content/Mapping" Map { diff --git a/examples/declarative/webview/inline-html.qml b/examples/declarative/webview/inline-html.qml index 23b4555..41dfec3 100644 --- a/examples/declarative/webview/inline-html.qml +++ b/examples/declarative/webview/inline-html.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 // Inline HTML with loose formatting can be // set on the html property. diff --git a/examples/declarative/webview/newwindows.qml b/examples/declarative/webview/newwindows.qml index 5dd4cd5..c62aba6 100644 --- a/examples/declarative/webview/newwindows.qml +++ b/examples/declarative/webview/newwindows.qml @@ -4,6 +4,7 @@ // allow it on WebView with settings.javascriptCanOpenWindows: true import Qt 4.6 +import org.webkit 1.0 Grid { columns: 3 diff --git a/examples/declarative/webview/qdeclarative-in-html.qml b/examples/declarative/webview/qdeclarative-in-html.qml index 77180ec..172ea4b 100644 --- a/examples/declarative/webview/qdeclarative-in-html.qml +++ b/examples/declarative/webview/qdeclarative-in-html.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 // The WebView supports QML data through the HTML OBJECT tag Rectangle { diff --git a/examples/declarative/webview/transparent.qml b/examples/declarative/webview/transparent.qml index 9332f3e..5530819 100644 --- a/examples/declarative/webview/transparent.qml +++ b/examples/declarative/webview/transparent.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 // The WebView background is transparent // if the HTML does not specify a background diff --git a/imports/org/webkit/qmldir b/imports/org/webkit/qmldir new file mode 100644 index 0000000..258aa2c --- /dev/null +++ b/imports/org/webkit/qmldir @@ -0,0 +1 @@ +plugin webkitqmlplugin diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index 7a85f00..3ff92b1 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -84,10 +84,3 @@ SOURCES += \ $$PWD/qdeclarativegraphicsobjectcontainer.cpp \ $$PWD/qdeclarativeparticles.cpp \ $$PWD/qdeclarativelayoutitem.cpp \ - -contains(QT_CONFIG, webkit) { - QT+=webkit - SOURCES += $$PWD/qdeclarativewebview.cpp - HEADERS += $$PWD/qdeclarativewebview_p.h - HEADERS += $$PWD/qdeclarativewebview_p_p.h -} diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index f3b9385..e0ae2eb 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -139,9 +139,6 @@ void QDeclarativeItemModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,VisibleArea,QDeclarativeFlickableVisibleArea); QML_REGISTER_TYPE(Qt,4,6,VisualDataModel,QDeclarativeVisualDataModel); QML_REGISTER_TYPE(Qt,4,6,VisualItemModel,QDeclarativeVisualItemModel); -#ifdef QT_WEBKIT_LIB - QML_REGISTER_TYPE(Qt,4,6,WebView,QDeclarativeWebView); -#endif QML_REGISTER_NOCREATE_TYPE(QDeclarativeAnchors); QML_REGISTER_NOCREATE_TYPE(QGraphicsEffect); diff --git a/src/declarative/graphicsitems/qdeclarativewebview.cpp b/src/declarative/graphicsitems/qdeclarativewebview.cpp deleted file mode 100644 index a2b16ba..0000000 --- a/src/declarative/graphicsitems/qdeclarativewebview.cpp +++ /dev/null @@ -1,1338 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativewebview_p.h" -#include "qdeclarativewebview_p_p.h" - -#include "qdeclarativepainteditem_p_p.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system - -class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeWebView) - -public: - QDeclarativeWebViewPrivate() - : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0), - progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone), - newWindowComponent(0), newWindowParent(0), - pressTime(400), - rendering(true) - { - } - - QUrl url; // page url might be different if it has not loaded yet - QWebPage *page; - - int preferredwidth, preferredheight; - qreal progress; - QDeclarativeWebView::Status status; - QString statusText; - enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; - QUrl pending_url; - QString pending_string; - QByteArray pending_data; - mutable QDeclarativeWebSettings settings; - QDeclarativeComponent *newWindowComponent; - QDeclarativeItem *newWindowParent; - - QBasicTimer pressTimer; - QPoint pressPoint; - int pressTime; // milliseconds before it's a "hold" - - - static void windowObjects_append(QDeclarativeListProperty *prop, QObject *o) { - static_cast(prop->data)->windowObjects.append(o); - static_cast(prop->data)->updateWindowObjects(); - } - - void updateWindowObjects(); - QObjectList windowObjects; - - bool rendering; -}; - -/*! - \qmlclass WebView QDeclarativeWebView - \since 4.7 - \brief The WebView item allows you to add web content to a canvas. - \inherits Item - - A WebView renders web content based on a URL. - - If the width and height of the item is not set, they will - dynamically adjust to a size appropriate for the content. - This width may be large for typical online web pages. - - If the preferredWidth is set, the width will be this amount or larger, - usually laying out the web content to fit the preferredWidth. - - \qml - WebView { - url: "http://www.nokia.com" - width: 490 - height: 400 - scale: 0.5 - smooth: false - smoothCache: true - } - \endqml - - \image webview.png - - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. -*/ - -/*! - \internal - \class QDeclarativeWebView - \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView. - - A WebView renders web content base on a URL. - - \image webview.png - - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. - - A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView. -*/ - -QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) - : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent) -{ - init(); -} - -QDeclarativeWebView::~QDeclarativeWebView() -{ - Q_D(QDeclarativeWebView); - delete d->page; -} - -void QDeclarativeWebView::init() -{ - Q_D(QDeclarativeWebView); - - QWebSettings::enablePersistentStorage(); - - setAcceptHoverEvents(true); - setAcceptedMouseButtons(Qt::LeftButton); - setFlag(QGraphicsItem::ItemHasNoContents, false); - - d->page = 0; -} - -void QDeclarativeWebView::componentComplete() -{ - QDeclarativePaintedItem::componentComplete(); - Q_D(QDeclarativeWebView); - switch (d->pending) { - case QDeclarativeWebViewPrivate::PendingUrl: - setUrl(d->pending_url); - break; - case QDeclarativeWebViewPrivate::PendingHtml: - setHtml(d->pending_string, d->pending_url); - break; - case QDeclarativeWebViewPrivate::PendingContent: - setContent(d->pending_data, d->pending_string, d->pending_url); - break; - default: - break; - } - d->pending = QDeclarativeWebViewPrivate::PendingNone; - d->updateWindowObjects(); -} - -QDeclarativeWebView::Status QDeclarativeWebView::status() const -{ - Q_D(const QDeclarativeWebView); - return d->status; -} - - -/*! - \qmlproperty real WebView::progress - This property holds the progress of loading the current URL, from 0 to 1. - - If you just want to know when progress gets to 1, use - WebView::onLoadFinished() or WebView::onLoadFailed() instead. -*/ -qreal QDeclarativeWebView::progress() const -{ - Q_D(const QDeclarativeWebView); - return d->progress; -} - -void QDeclarativeWebView::doLoadStarted() -{ - Q_D(QDeclarativeWebView); - - if (!d->url.isEmpty()) { - d->status = Loading; - emit statusChanged(d->status); - } - emit loadStarted(); -} - -void QDeclarativeWebView::doLoadProgress(int p) -{ - Q_D(QDeclarativeWebView); - if (d->progress == p/100.0) - return; - d->progress = p/100.0; - emit progressChanged(); -} - -void QDeclarativeWebView::pageUrlChanged() -{ - Q_D(QDeclarativeWebView); - - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - expandToWebPage(); - - if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) - || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) - { - d->url = page()->mainFrame()->url(); - if (d->url == QUrl(QLatin1String("about:blank"))) - d->url = QUrl(); - emit urlChanged(); - } -} - -void QDeclarativeWebView::doLoadFinished(bool ok) -{ - Q_D(QDeclarativeWebView); - - if (title().isEmpty()) - pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() - - if (ok) { - d->status = d->url.isEmpty() ? Null : Ready; - emit loadFinished(); - } else { - d->status = Error; - emit loadFailed(); - } - emit statusChanged(d->status); -} - -/*! - \qmlproperty url WebView::url - This property holds the URL to the page displayed in this item. It can be set, - but also can change spontaneously (eg. because of network redirection). - - If the url is empty, the page is blank. - - The url is always absolute (QML will resolve relative URL strings in the context - of the containing QML document). -*/ -QUrl QDeclarativeWebView::url() const -{ - Q_D(const QDeclarativeWebView); - return d->url; -} - -void QDeclarativeWebView::setUrl(const QUrl &url) -{ - Q_D(QDeclarativeWebView); - if (url == d->url) - return; - - if (isComponentComplete()) { - d->url = url; - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - QUrl seturl = url; - if (seturl.isEmpty()) - seturl = QUrl(QLatin1String("about:blank")); - - Q_ASSERT(!seturl.isRelative()); - - page()->mainFrame()->load(seturl); - - emit urlChanged(); - } else { - d->pending = d->PendingUrl; - d->pending_url = url; - } -} - -/*! - \qmlproperty int WebView::preferredWidth - This property holds the ideal width for displaying the current URL. -*/ -int QDeclarativeWebView::preferredWidth() const -{ - Q_D(const QDeclarativeWebView); - return d->preferredwidth; -} - -void QDeclarativeWebView::setPreferredWidth(int iw) -{ - Q_D(QDeclarativeWebView); - if (d->preferredwidth == iw) return; - d->preferredwidth = iw; - //expandToWebPage(); - emit preferredWidthChanged(); -} - -/*! - \qmlproperty int WebView::preferredHeight - This property holds the ideal height for displaying the current URL. - This only affects the area zoomed by heuristicZoom(). -*/ -int QDeclarativeWebView::preferredHeight() const -{ - Q_D(const QDeclarativeWebView); - return d->preferredheight; -} -void QDeclarativeWebView::setPreferredHeight(int ih) -{ - Q_D(QDeclarativeWebView); - if (d->preferredheight == ih) return; - d->preferredheight = ih; - emit preferredHeightChanged(); -} - -/*! - \qmlmethod bool WebView::evaluateJavaScript(string) - - Evaluates the \a scriptSource JavaScript inside the context of the - main web frame, and returns the result of the last executed statement. - - Note that this JavaScript does \e not have any access to QML objects - except as made available as windowObjects. -*/ -QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource) -{ - return this->page()->mainFrame()->evaluateJavaScript(scriptSource); -} - -void QDeclarativeWebView::focusChanged(bool hasFocus) -{ - QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); - page()->event(&e); - QDeclarativeItem::focusChanged(hasFocus); -} - -void QDeclarativeWebView::initialLayout() -{ - // nothing useful to do at this point -} - -void QDeclarativeWebView::noteContentsSizeChanged(const QSize&) -{ - expandToWebPage(); -} - -void QDeclarativeWebView::expandToWebPage() -{ - Q_D(QDeclarativeWebView); - QSize cs = page()->mainFrame()->contentsSize(); - if (cs.width() < d->preferredwidth) - cs.setWidth(d->preferredwidth); - if (cs.height() < d->preferredheight) - cs.setHeight(d->preferredheight); - if (widthValid()) - cs.setWidth(width()); - if (heightValid()) - cs.setHeight(height()); - if (cs != page()->viewportSize()) { - page()->setViewportSize(cs); - } - if (cs != contentsSize()) - setContentsSize(cs); -} - -void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) -{ - if (newGeometry.size() != oldGeometry.size()) - expandToWebPage(); - QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); -} - -void QDeclarativeWebView::paintPage(const QRect& r) -{ - dirtyCache(r); - update(); -} - -/*! - \qmlproperty list WebView::javaScriptWindowObjects - - This property is a list of object that are available from within - the webview's JavaScript context. - - The \a object will be inserted as a child of the frame's window - object, under the name given by the attached property \c WebView.windowObjectName. - - \qml - WebView { - javaScriptWindowObjects: Object { - WebView.windowObjectName: "coordinates" - } - } - \endqml - - Properties of the object will be exposed as JavaScript properties and slots as - JavaScript methods. - - If Javascript is not enabled for this page, then this property does nothing. -*/ -QDeclarativeListProperty QDeclarativeWebView::javaScriptWindowObjects() -{ - Q_D(QDeclarativeWebView); - return QDeclarativeListProperty(this, d, &QDeclarativeWebViewPrivate::windowObjects_append); -} - -QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject *o) -{ - return new QDeclarativeWebViewAttached(o); -} - -void QDeclarativeWebViewPrivate::updateWindowObjects() -{ - Q_Q(QDeclarativeWebView); - if (!q->isComponentComplete() || !page) - return; - - for (int ii = 0; ii < windowObjects.count(); ++ii) { - QObject *object = windowObjects.at(ii); - QDeclarativeWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); - if (attached && !attached->windowObjectName().isEmpty()) { - page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); - } - } -} - -bool QDeclarativeWebView::renderingEnabled() const -{ - Q_D(const QDeclarativeWebView); - return d->rendering; -} - -void QDeclarativeWebView::setRenderingEnabled(bool enabled) -{ - Q_D(QDeclarativeWebView); - if (d->rendering == enabled) - return; - d->rendering = enabled; - emit renderingEnabledChanged(); - - setCacheFrozen(!enabled); - if (enabled) - clearCache(); -} - - -void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r) -{ - Q_D(QDeclarativeWebView); - if (d->rendering) - page()->mainFrame()->render(p,r); -} - -QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) -{ - QEvent::Type t; - switch(e->type()) { - default: - case QEvent::GraphicsSceneMousePress: - t = QEvent::MouseButtonPress; - break; - case QEvent::GraphicsSceneMouseRelease: - t = QEvent::MouseButtonRelease; - break; - case QEvent::GraphicsSceneMouseMove: - t = QEvent::MouseMove; - break; - case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick: - t = QEvent::MouseButtonDblClick; - break; - } - - QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), e->button(), e->buttons(), 0); - return me; -} - -QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) -{ - QEvent::Type t = QEvent::MouseMove; - - QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), Qt::NoButton, Qt::NoButton, 0); - - return me; -} - - -/*! - \qmlsignal WebView::onDoubleClick(clickx,clicky) - - The WebView does not pass double-click events to the web engine, but rather - emits this signals. -*/ - -void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -{ - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - emit doubleClick(me->x(),me->y()); - delete me; -} - -/*! - \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) - - Finds a zoom that: - \list - \i shows a whole item - \i includes (\a clickX, \a clickY) - \i fits into the preferredWidth and preferredHeight - \i zooms by no more than \a maxzoom - \i is more than 10% above the current zoom - \endlist - - If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, - no signal is emitted and returns false. -*/ -bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) -{ - Q_D(QDeclarativeWebView); - if (contentsScale() >= maxzoom/zoomFactor()) - return false; - qreal ozf = contentsScale(); - QRect showarea = elementAreaAt(clickX, clickY, d->preferredwidth/maxzoom, d->preferredheight/maxzoom); - qreal z = qMin(qreal(d->preferredwidth)/showarea.width(),qreal(d->preferredheight)/showarea.height()); - if (z > maxzoom/zoomFactor()) - z = maxzoom/zoomFactor(); - if (z/ozf > 1.2) { - QRectF r(showarea.left()*z, showarea.top()*z, showarea.width()*z, showarea.height()*z); - emit zoomTo(z,r.x()+r.width()/2, r.y()+r.height()/2); - return true; - } else { - return false; - } -} - -/*! - \qmlproperty int WebView::pressGrabTime - - The number of milliseconds the user must press before the WebView - starts passing move events through to the web engine (rather than - letting other QML elements such as a Flickable take them). - - Defaults to 400ms. Set to 0 to always grab and pass move events to - the web engine. -*/ -int QDeclarativeWebView::pressGrabTime() const -{ - Q_D(const QDeclarativeWebView); - return d->pressTime; -} - -void QDeclarativeWebView::setPressGrabTime(int ms) -{ - Q_D(QDeclarativeWebView); - if (d->pressTime == ms) - return; - d->pressTime = ms; - emit pressGrabTimeChanged(); -} - -void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - setFocus (true); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - - d->pressPoint = me->pos(); - if (d->pressTime) { - d->pressTimer.start(d->pressTime,this); - setKeepMouseGrab(false); - } else { - grabMouse(); - setKeepMouseGrab(true); - } - - page()->event(me); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit - Might be a bug in WebKit, though - */ -#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) { - QDeclarativePaintedItem::mousePressEvent(event); - } -} - -void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - page()->event(me); - d->pressTimer.stop(); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send all the events to WebKit - */ -#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) { - QDeclarativePaintedItem::mouseReleaseEvent(event); - } - setKeepMouseGrab(false); - ungrabMouse(); -} - -void QDeclarativeWebView::timerEvent(QTimerEvent *event) -{ - Q_D(QDeclarativeWebView); - if (event->timerId() == d->pressTimer.timerId()) { - d->pressTimer.stop(); - grabMouse(); - setKeepMouseGrab(true); - } -} - -void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - if (d->pressTimer.isActive()) { - if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { - d->pressTimer.stop(); - } - } - if (keepMouseGrab()) { - page()->event(me); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit - Might be a bug in WebKit, though - */ -#if 1 // QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - } - delete me; - if (!event->isAccepted()) - QDeclarativePaintedItem::mouseMoveEvent(event); - -} -void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) -{ - QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); - page()->event(me); - event->setAccepted( -#if QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) - QDeclarativePaintedItem::hoverMoveEvent(event); -} - -void QDeclarativeWebView::keyPressEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyPressEvent(event); -} - -void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyReleaseEvent(event); -} - -bool QDeclarativeWebView::sceneEvent(QEvent *event) -{ - if (event->type() == QEvent::KeyPress) { - QKeyEvent *k = static_cast(event); - if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { - if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? - page()->event(event); - if (event->isAccepted()) - return true; - } - } - } - return QDeclarativePaintedItem::sceneEvent(event); -} - - -/*! - \qmlproperty action WebView::back - This property holds the action for causing the previous URL in the history to be displayed. -*/ -QAction *QDeclarativeWebView::backAction() const -{ - return page()->action(QWebPage::Back); -} - -/*! - \qmlproperty action WebView::forward - This property holds the action for causing the next URL in the history to be displayed. -*/ -QAction *QDeclarativeWebView::forwardAction() const -{ - return page()->action(QWebPage::Forward); -} - -/*! - \qmlproperty action WebView::reload - This property holds the action for reloading with the current URL -*/ -QAction *QDeclarativeWebView::reloadAction() const -{ - return page()->action(QWebPage::Reload); -} - -/*! - \qmlproperty action WebView::stop - This property holds the action for stopping loading with the current URL -*/ -QAction *QDeclarativeWebView::stopAction() const -{ - return page()->action(QWebPage::Stop); -} - -/*! - \qmlproperty real WebView::title - This property holds the title of the web page currently viewed - - By default, this property contains an empty string. -*/ -QString QDeclarativeWebView::title() const -{ - return page()->mainFrame()->title(); -} - - - -/*! - \qmlproperty pixmap WebView::icon - This property holds the icon associated with the web page currently viewed -*/ -QPixmap QDeclarativeWebView::icon() const -{ - return page()->mainFrame()->icon().pixmap(QSize(256,256)); -} - - -/*! - \qmlproperty real WebView::zoomFactor - This property holds the multiplier used to scale the contents of a Web page. -*/ -void QDeclarativeWebView::setZoomFactor(qreal factor) -{ - Q_D(QDeclarativeWebView); - if (factor == page()->mainFrame()->zoomFactor()) - return; - - page()->mainFrame()->setZoomFactor(factor); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor, - d->preferredheight>0 ? d->preferredheight*factor : height()*factor)); - expandToWebPage(); - - emit zoomFactorChanged(); -} - -qreal QDeclarativeWebView::zoomFactor() const -{ - return page()->mainFrame()->zoomFactor(); -} - -/*! - \qmlproperty string WebView::statusText - - This property is the current status suggested by the current web page. In a web browser, - such status is often shown in some kind of status bar. -*/ -void QDeclarativeWebView::setStatusText(const QString& s) -{ - Q_D(QDeclarativeWebView); - d->statusText = s; - emit statusTextChanged(); -} - -void QDeclarativeWebView::windowObjectCleared() -{ - Q_D(QDeclarativeWebView); - d->updateWindowObjects(); -} - -QString QDeclarativeWebView::statusText() const -{ - Q_D(const QDeclarativeWebView); - return d->statusText; -} - -QWebPage *QDeclarativeWebView::page() const -{ - Q_D(const QDeclarativeWebView); - - if (!d->page) { - QDeclarativeWebView *self = const_cast(this); - QWebPage *wp = new QDeclarativeWebPage(self); - - // QML items don't default to having a background, - // even though most we pages will set one anyway. - QPalette pal = QApplication::palette(); - pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); - wp->setPalette(pal); - - wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); - - self->setPage(wp); - - return wp; - } - - return d->page; -} - - -// The QObject interface to settings(). -/*! - \qmlproperty string WebView::settings.standardFontFamily - \qmlproperty string WebView::settings.fixedFontFamily - \qmlproperty string WebView::settings.serifFontFamily - \qmlproperty string WebView::settings.sansSerifFontFamily - \qmlproperty string WebView::settings.cursiveFontFamily - \qmlproperty string WebView::settings.fantasyFontFamily - - \qmlproperty int WebView::settings.minimumFontSize - \qmlproperty int WebView::settings.minimumLogicalFontSize - \qmlproperty int WebView::settings.defaultFontSize - \qmlproperty int WebView::settings.defaultFixedFontSize - - \qmlproperty bool WebView::settings.autoLoadImages - \qmlproperty bool WebView::settings.javascriptEnabled - \qmlproperty bool WebView::settings.javaEnabled - \qmlproperty bool WebView::settings.pluginsEnabled - \qmlproperty bool WebView::settings.privateBrowsingEnabled - \qmlproperty bool WebView::settings.javascriptCanOpenWindows - \qmlproperty bool WebView::settings.javascriptCanAccessClipboard - \qmlproperty bool WebView::settings.developerExtrasEnabled - \qmlproperty bool WebView::settings.linksIncludedInFocusChain - \qmlproperty bool WebView::settings.zoomTextOnly - \qmlproperty bool WebView::settings.printElementBackgrounds - \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled - \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled - \qmlproperty bool WebView::settings.localStorageDatabaseEnabled - \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls - - These properties give access to the settings controlling the web view. - - See QWebSettings for details of these properties. - - \qml - WebView { - settings.pluginsEnabled: true - settings.standardFontFamily: "Arial" - ... - } - \endqml -*/ -QDeclarativeWebSettings *QDeclarativeWebView::settingsObject() const -{ - Q_D(const QDeclarativeWebView); - d->settings.s = page()->settings(); - return &d->settings; -} - -void QDeclarativeWebView::setPage(QWebPage *page) -{ - Q_D(QDeclarativeWebView); - if (d->page == page) - return; - if (d->page) { - if (d->page->parent() == this) { - delete d->page; - } else { - d->page->disconnect(this); - } - } - d->page = page; - d->page->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff); - d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); - connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); - connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); - connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); - connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); - connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); - connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); - connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); - - connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted())); - connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int))); - connect(d->page,SIGNAL(loadFinished(bool)),this,SLOT(doLoadFinished(bool))); - connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString))); - - connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared())); -} - -/*! - \qmlsignal WebView::onLoadStarted() - - This handler is called when the web engine begins loading - a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() - will be emitted. -*/ - -/*! - \qmlsignal WebView::onLoadFinished() - - This handler is called when the web engine \e successfully - finishes loading a page, including any component content - (WebView::onLoadFailed() will be emitted otherwise). - - \sa progress -*/ - -/*! - \qmlsignal WebView::onLoadFailed() - - This handler is called when the web engine fails loading - a page or any component content - (WebView::onLoadFinished() will be emitted on success). -*/ - -void QDeclarativeWebView::load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation, - const QByteArray &body) -{ - page()->mainFrame()->load(request, operation, body); -} - -QString QDeclarativeWebView::html() const -{ - return page()->mainFrame()->toHtml(); -} - -/*! - \qmlproperty string WebView::html - This property holds HTML text set directly - - The html property can be set as a string. - - \qml - WebView { - html: "

This is HTML." - } - \endqml -*/ -void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) -{ - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - if (isComponentComplete()) - page()->mainFrame()->setHtml(html, baseUrl); - else { - d->pending = d->PendingHtml; - d->pending_url = baseUrl; - d->pending_string = html; - } - emit htmlChanged(); -} - -void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) -{ - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - - if (isComponentComplete()) - page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); - else { - d->pending = d->PendingContent; - d->pending_url = baseUrl; - d->pending_string = mimeType; - d->pending_data = data; - } -} - -QWebHistory *QDeclarativeWebView::history() const -{ - return page()->history(); -} - -QWebSettings *QDeclarativeWebView::settings() const -{ - return page()->settings(); -} - -QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) -{ - Q_D(QDeclarativeWebView); - switch (type) { - case QWebPage::WebBrowserWindow: { - if (!d->newWindowComponent && d->newWindowParent) - qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored"); - else if (d->newWindowComponent && !d->newWindowParent) - qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); - else if (d->newWindowComponent && d->newWindowParent) { - QDeclarativeWebView *webview = 0; - QDeclarativeContext *windowContext = new QDeclarativeContext(qmlContext(this)); - - QObject *nobj = d->newWindowComponent->create(windowContext); - if (nobj) { - windowContext->setParent(nobj); - QDeclarativeItem *item = qobject_cast(nobj); - if (!item) { - delete nobj; - } else { - webview = item->findChild(); - if (!webview) { - delete item; - } else { - nobj->setParent(d->newWindowParent); - static_cast(item)->setParentItem(d->newWindowParent); - } - } - } else { - delete windowContext; - } - - return webview; - } - } - break; - case QWebPage::WebModalDialog: { - // Not supported - } - } - return 0; -} - -/*! - \qmlproperty component WebView::newWindowComponent - - This property holds the component to use for new windows. - The component must have a WebView somewhere in its structure. - - When the web engine requests a new window, it will be an instance of - this component. - - The parent of the new window is set by newWindowParent. It must be set. -*/ -QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const -{ - Q_D(const QDeclarativeWebView); - return d->newWindowComponent; -} - -void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow) -{ - Q_D(QDeclarativeWebView); - if (newWindow == d->newWindowComponent) - return; - d->newWindowComponent = newWindow; - emit newWindowComponentChanged(); -} - - -/*! - \qmlproperty item WebView::newWindowParent - - The parent item for new windows. - - \sa newWindowComponent -*/ -QDeclarativeItem *QDeclarativeWebView::newWindowParent() const -{ - Q_D(const QDeclarativeWebView); - return d->newWindowParent; -} - -void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) -{ - Q_D(QDeclarativeWebView); - if (parent == d->newWindowParent) - return; - if (d->newWindowParent && parent) { - QList children = d->newWindowParent->childItems(); - for (int i = 0; i < children.count(); ++i) { - children.at(i)->setParentItem(parent); - } - } - d->newWindowParent = parent; - emit newWindowParentChanged(); -} - -/*! - Returns the area of the largest element at position (\a x,\a y) that is no larger - than \a maxwidth by \a maxheight pixels. - - May return an area larger in the case when no smaller element is at the position. -*/ -QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const -{ - QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y)); - QRect rv = hit.boundingRect(); - QWebElement element = hit.enclosingBlockElement(); - if (maxwidth<=0) maxwidth = INT_MAX; - if (maxheight<=0) maxheight = INT_MAX; - while (!element.parent().isNull() && element.geometry().width() <= maxwidth && element.geometry().height() <= maxheight) { - rv = element.geometry(); - element = element.parent(); - } - return rv; -} - -/*! - \internal - \class QDeclarativeWebPage - \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins. - - \sa QDeclarativeWebView -*/ -QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView *parent) : - QWebPage(parent) -{ -} - -QDeclarativeWebPage::~QDeclarativeWebPage() -{ -} - -void QDeclarativeWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) -{ - qWarning() << sourceID << ':' << lineNumber << ':' << message; -} - -QString QDeclarativeWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(oldFile) - return oldFile; -} - -void QDeclarativeWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) -{ - Q_UNUSED(originatingFrame) - emit viewItem()->alert(msg); -} - -bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - return false; -} - -bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - Q_UNUSED(defaultValue) - Q_UNUSED(result) - return false; -} - - -/* - Qt WebKit does not understand non-QWidget plugins, so dummy widgets - are created, parented to a single dummy tool window. - - The requirements for QML object plugins are input to the Qt WebKit - non-QWidget plugin support, which will obsolete this kludge. -*/ -class QWidget_Dummy_Plugin : public QWidget -{ - Q_OBJECT -public: - static QWidget *dummy_shared_parent() - { - static QWidget *dsp = 0; - if (!dsp) { - dsp = new QWidget(0,Qt::Tool); - dsp->setGeometry(-10000,-10000,0,0); - dsp->show(); - } - return dsp; - } - QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : - QWidget(dummy_shared_parent()), - propertyNames(paramNames), - propertyValues(paramValues), - webview(view) - { - QDeclarativeEngine *engine = qmlEngine(webview); - component = new QDeclarativeComponent(engine, url, this); - item = 0; - if (component->isLoading()) - connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded())); - else - qmlLoaded(); - } - -public Q_SLOTS: - void qmlLoaded() - { - if (component->isError()) { - // ### Could instead give these errors to the WebView to handle. - qWarning() << component->errors(); - return; - } - item = qobject_cast(component->create(qmlContext(webview))); - item->setParent(webview); - QString jsObjName; - for (int i=0; isetProperty(propertyNames[i].toUtf8(),propertyValues[i]); - if (propertyNames[i] == QLatin1String("objectname")) - jsObjName = propertyValues[i]; - } - } - if (!jsObjName.isNull()) { - QWebFrame *f = webview->page()->mainFrame(); - f->addToJavaScriptWindowObject(jsObjName, item); - } - resizeEvent(0); - delete component; - component = 0; - } - void resizeEvent(QResizeEvent*) - { - if (item) { - item->setX(x()); - item->setY(y()); - item->setWidth(width()); - item->setHeight(height()); - } - } - -private: - QDeclarativeComponent *component; - QDeclarativeItem *item; - QStringList propertyNames, propertyValues; - QDeclarativeWebView *webview; -}; - -QDeclarativeWebView *QDeclarativeWebPage::viewItem() -{ - return static_cast(parent()); -} - -QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) -{ - QUrl comp = qmlContext(viewItem())->resolvedUrl(url); - return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); -} - -QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) -{ - QDeclarativeWebView *newView = viewItem()->createWindow(type); - if (newView) - return newView->page(); - return 0; -} - -QT_END_NAMESPACE - -#include diff --git a/src/declarative/graphicsitems/qdeclarativewebview_p.h b/src/declarative/graphicsitems/qdeclarativewebview_p.h deleted file mode 100644 index a65aab3..0000000 --- a/src/declarative/graphicsitems/qdeclarativewebview_p.h +++ /dev/null @@ -1,286 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEWEBVIEW_H -#define QDECLARATIVEWEBVIEW_H - -#include "qdeclarativepainteditem_p.h" - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -class QWebHistory; -class QWebSettings; - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QDeclarativeWebViewPrivate; -class QNetworkRequest; -class QDeclarativeWebView; - -class Q_DECLARATIVE_EXPORT QDeclarativeWebPage : public QWebPage -{ - Q_OBJECT -public: - explicit QDeclarativeWebPage(QDeclarativeWebView *parent); - ~QDeclarativeWebPage(); -protected: - QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); - QWebPage *createWindow(WebWindowType type); - void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); - QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); - void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); - -private: - QDeclarativeWebView *viewItem(); -}; - - -class QDeclarativeWebViewAttached; -class QDeclarativeWebSettings; - -//### TODO: browser plugins - -class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem -{ - Q_OBJECT - - Q_ENUMS(Status SelectionMode) - - Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) - Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) - Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) - - Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) - - Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged) - - Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) - Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - - Q_PROPERTY(QAction* reload READ reloadAction CONSTANT) - Q_PROPERTY(QAction* back READ backAction CONSTANT) - Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) - Q_PROPERTY(QAction* stop READ stopAction CONSTANT) - - Q_PROPERTY(QDeclarativeWebSettings* settings READ settingsObject CONSTANT) - - Q_PROPERTY(QDeclarativeListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) - - Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) - Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) - - Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) - -public: - QDeclarativeWebView(QDeclarativeItem *parent=0); - ~QDeclarativeWebView(); - - QUrl url() const; - void setUrl(const QUrl &); - - QString title() const; - - QPixmap icon() const; - - qreal zoomFactor() const; - void setZoomFactor(qreal); - Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); - QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; - - int pressGrabTime() const; - void setPressGrabTime(int); - - int preferredWidth() const; - void setPreferredWidth(int); - int preferredHeight() const; - void setPreferredHeight(int); - - enum Status { Null, Ready, Loading, Error }; - Status status() const; - qreal progress() const; - QString statusText() const; - - QAction *reloadAction() const; - QAction *backAction() const; - QAction *forwardAction() const; - QAction *stopAction() const; - - QWebPage *page() const; - void setPage(QWebPage *page); - - void load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, - const QByteArray &body = QByteArray()); - - QString html() const; - - void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); - void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); - - QWebHistory *history() const; - QWebSettings *settings() const; - QDeclarativeWebSettings *settingsObject() const; - - bool renderingEnabled() const; - void setRenderingEnabled(bool); - - QDeclarativeListProperty javaScriptWindowObjects(); - - static QDeclarativeWebViewAttached *qmlAttachedProperties(QObject *); - - QDeclarativeComponent *newWindowComponent() const; - void setNewWindowComponent(QDeclarativeComponent *newWindow); - QDeclarativeItem *newWindowParent() const; - void setNewWindowParent(QDeclarativeItem *newWindow); - -Q_SIGNALS: - void preferredWidthChanged(); - void preferredHeightChanged(); - void urlChanged(); - void progressChanged(); - void statusChanged(Status); - void titleChanged(const QString&); - void iconChanged(); - void statusTextChanged(); - void htmlChanged(); - void pressGrabTimeChanged(); - void zoomFactorChanged(); - void newWindowComponentChanged(); - void newWindowParentChanged(); - void renderingEnabledChanged(); - - void loadStarted(); - void loadFinished(); - void loadFailed(); - - void doubleClick(int clickX, int clickY); - - void zoomTo(qreal zoom, int centerX, int centerY); - - void alert(const QString& message); - -public Q_SLOTS: - QVariant evaluateJavaScript(const QString&); - -private Q_SLOTS: - void expandToWebPage(); - void paintPage(const QRect&); - void doLoadStarted(); - void doLoadProgress(int p); - void doLoadFinished(bool ok); - void setStatusText(const QString&); - void windowObjectCleared(); - void pageUrlChanged(); - void noteContentsSizeChanged(const QSize&); - void initialLayout(); - -protected: - void drawContents(QPainter *, const QRect &); - - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void timerEvent(QTimerEvent *event); - void hoverMoveEvent (QGraphicsSceneHoverEvent * event); - void keyPressEvent(QKeyEvent* event); - void keyReleaseEvent(QKeyEvent* event); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - virtual void focusChanged(bool); - virtual bool sceneEvent(QEvent *event); - QDeclarativeWebView *createWindow(QWebPage::WebWindowType type); - -private: - void init(); - virtual void componentComplete(); - Q_DISABLE_COPY(QDeclarativeWebView) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView) - QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *); - QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *); - friend class QDeclarativeWebPage; -}; - -class QDeclarativeWebViewAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) -public: - QDeclarativeWebViewAttached(QObject *parent) - : QObject(parent) - { - } - - QString windowObjectName() const - { - return m_windowObjectName; - } - - void setWindowObjectName(const QString &n) - { - m_windowObjectName = n; - } - -private: - QString m_windowObjectName; -}; - - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeWebView) -QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES) - -QT_END_HEADER - -#endif diff --git a/src/declarative/graphicsitems/qdeclarativewebview_p_p.h b/src/declarative/graphicsitems/qdeclarativewebview_p_p.h deleted file mode 100644 index 258b472..0000000 --- a/src/declarative/graphicsitems/qdeclarativewebview_p_p.h +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEWEBVIEW_P_H -#define QDECLARATIVEWEBVIEW_P_H - -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeWebSettings : public QObject { - Q_OBJECT - - Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) - Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) - Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) - Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) - Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) - Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) - - Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) - Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) - Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) - Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) - - Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) - Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) - Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) - Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) - Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) - Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) - Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) - Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) - Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) - Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) - Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) - Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) - Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) - Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) - Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) - -public: - QDeclarativeWebSettings() {} - - QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } - void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } - QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } - void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } - QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } - void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } - QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } - void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } - QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } - void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } - QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } - void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } - - int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } - void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } - int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } - void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } - int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } - void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } - int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } - void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } - - bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } - void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } - bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } - void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } - bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } - void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } - bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } - void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } - bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } - void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } - bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } - void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } - bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } - void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } - bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } - void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } - bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } - void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } - bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } - void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } - bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } - void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } - bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } - void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } - bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } - void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } - bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } - void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } - bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } - void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } - - QWebSettings *s; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeWebSettings) - -QT_END_HEADER - -#endif diff --git a/src/plugins/qdeclarativemodules/qdeclarativemodules.pro b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro index 0a6f444..ae53578 100644 --- a/src/plugins/qdeclarativemodules/qdeclarativemodules.pro +++ b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro @@ -3,4 +3,5 @@ TEMPLATE = subdirs SUBDIRS += widgets contains(QT_CONFIG, multimedia): SUBDIRS += multimedia +contains(QT_CONFIG, webkit): SUBDIRS += webkitqmlplugin diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp b/src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp new file mode 100644 index 0000000..2f6205d --- /dev/null +++ b/src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "qdeclarativewebview_p.h" +#include "qdeclarativewebview_p_p.h" + +QT_BEGIN_NAMESPACE + +class WebKitQmlPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit")); + qmlRegisterType(uri,1,0,"WebView"); + } +}; + +QT_END_NAMESPACE + +#include "plugin.moc" + +Q_EXPORT_PLUGIN2(webkitqmlplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); + diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp new file mode 100644 index 0000000..733ac86 --- /dev/null +++ b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp @@ -0,0 +1,1340 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativewebview_p.h" +#include "qdeclarativewebview_p_p.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system + +class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeWebView) + +public: + QDeclarativeWebViewPrivate() + : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0), + progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone), + newWindowComponent(0), newWindowParent(0), + pressTime(400), + rendering(true) + { + } + + QUrl url; // page url might be different if it has not loaded yet + QWebPage *page; + + int preferredwidth, preferredheight; + qreal progress; + QDeclarativeWebView::Status status; + QString statusText; + enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; + QUrl pending_url; + QString pending_string; + QByteArray pending_data; + mutable QDeclarativeWebSettings settings; + QDeclarativeComponent *newWindowComponent; + QDeclarativeItem *newWindowParent; + + QBasicTimer pressTimer; + QPoint pressPoint; + int pressTime; // milliseconds before it's a "hold" + + + static void windowObjects_append(QDeclarativeListProperty *prop, QObject *o) { + static_cast(prop->data)->windowObjects.append(o); + static_cast(prop->data)->updateWindowObjects(); + } + + void updateWindowObjects(); + QObjectList windowObjects; + + bool rendering; +}; + +/*! + \qmlclass WebView QDeclarativeWebView + \since 4.7 + \brief The WebView item allows you to add web content to a canvas. + \inherits Item + + A WebView renders web content based on a URL. + + If the width and height of the item is not set, they will + dynamically adjust to a size appropriate for the content. + This width may be large for typical online web pages. + + If the preferredWidth is set, the width will be this amount or larger, + usually laying out the web content to fit the preferredWidth. + + \qml + import org.webkit 1.0 + + WebView { + url: "http://www.nokia.com" + width: 490 + height: 400 + scale: 0.5 + smooth: false + smoothCache: true + } + \endqml + + \image webview.png + + The item includes no scrolling, scaling, + toolbars, etc., those must be implemented around WebView. See the WebBrowser example + for a demonstration of this. +*/ + +/*! + \internal + \class QDeclarativeWebView + \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView. + + A WebView renders web content base on a URL. + + \image webview.png + + The item includes no scrolling, scaling, + toolbars, etc., those must be implemented around WebView. See the WebBrowser example + for a demonstration of this. + + A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView. +*/ + +QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) + : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent) +{ + init(); +} + +QDeclarativeWebView::~QDeclarativeWebView() +{ + Q_D(QDeclarativeWebView); + delete d->page; +} + +void QDeclarativeWebView::init() +{ + Q_D(QDeclarativeWebView); + + QWebSettings::enablePersistentStorage(); + + setAcceptHoverEvents(true); + setAcceptedMouseButtons(Qt::LeftButton); + setFlag(QGraphicsItem::ItemHasNoContents, false); + + d->page = 0; +} + +void QDeclarativeWebView::componentComplete() +{ + QDeclarativePaintedItem::componentComplete(); + Q_D(QDeclarativeWebView); + switch (d->pending) { + case QDeclarativeWebViewPrivate::PendingUrl: + setUrl(d->pending_url); + break; + case QDeclarativeWebViewPrivate::PendingHtml: + setHtml(d->pending_string, d->pending_url); + break; + case QDeclarativeWebViewPrivate::PendingContent: + setContent(d->pending_data, d->pending_string, d->pending_url); + break; + default: + break; + } + d->pending = QDeclarativeWebViewPrivate::PendingNone; + d->updateWindowObjects(); +} + +QDeclarativeWebView::Status QDeclarativeWebView::status() const +{ + Q_D(const QDeclarativeWebView); + return d->status; +} + + +/*! + \qmlproperty real WebView::progress + This property holds the progress of loading the current URL, from 0 to 1. + + If you just want to know when progress gets to 1, use + WebView::onLoadFinished() or WebView::onLoadFailed() instead. +*/ +qreal QDeclarativeWebView::progress() const +{ + Q_D(const QDeclarativeWebView); + return d->progress; +} + +void QDeclarativeWebView::doLoadStarted() +{ + Q_D(QDeclarativeWebView); + + if (!d->url.isEmpty()) { + d->status = Loading; + emit statusChanged(d->status); + } + emit loadStarted(); +} + +void QDeclarativeWebView::doLoadProgress(int p) +{ + Q_D(QDeclarativeWebView); + if (d->progress == p/100.0) + return; + d->progress = p/100.0; + emit progressChanged(); +} + +void QDeclarativeWebView::pageUrlChanged() +{ + Q_D(QDeclarativeWebView); + + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + expandToWebPage(); + + if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) + || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) + { + d->url = page()->mainFrame()->url(); + if (d->url == QUrl(QLatin1String("about:blank"))) + d->url = QUrl(); + emit urlChanged(); + } +} + +void QDeclarativeWebView::doLoadFinished(bool ok) +{ + Q_D(QDeclarativeWebView); + + if (title().isEmpty()) + pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() + + if (ok) { + d->status = d->url.isEmpty() ? Null : Ready; + emit loadFinished(); + } else { + d->status = Error; + emit loadFailed(); + } + emit statusChanged(d->status); +} + +/*! + \qmlproperty url WebView::url + This property holds the URL to the page displayed in this item. It can be set, + but also can change spontaneously (eg. because of network redirection). + + If the url is empty, the page is blank. + + The url is always absolute (QML will resolve relative URL strings in the context + of the containing QML document). +*/ +QUrl QDeclarativeWebView::url() const +{ + Q_D(const QDeclarativeWebView); + return d->url; +} + +void QDeclarativeWebView::setUrl(const QUrl &url) +{ + Q_D(QDeclarativeWebView); + if (url == d->url) + return; + + if (isComponentComplete()) { + d->url = url; + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + QUrl seturl = url; + if (seturl.isEmpty()) + seturl = QUrl(QLatin1String("about:blank")); + + Q_ASSERT(!seturl.isRelative()); + + page()->mainFrame()->load(seturl); + + emit urlChanged(); + } else { + d->pending = d->PendingUrl; + d->pending_url = url; + } +} + +/*! + \qmlproperty int WebView::preferredWidth + This property holds the ideal width for displaying the current URL. +*/ +int QDeclarativeWebView::preferredWidth() const +{ + Q_D(const QDeclarativeWebView); + return d->preferredwidth; +} + +void QDeclarativeWebView::setPreferredWidth(int iw) +{ + Q_D(QDeclarativeWebView); + if (d->preferredwidth == iw) return; + d->preferredwidth = iw; + //expandToWebPage(); + emit preferredWidthChanged(); +} + +/*! + \qmlproperty int WebView::preferredHeight + This property holds the ideal height for displaying the current URL. + This only affects the area zoomed by heuristicZoom(). +*/ +int QDeclarativeWebView::preferredHeight() const +{ + Q_D(const QDeclarativeWebView); + return d->preferredheight; +} +void QDeclarativeWebView::setPreferredHeight(int ih) +{ + Q_D(QDeclarativeWebView); + if (d->preferredheight == ih) return; + d->preferredheight = ih; + emit preferredHeightChanged(); +} + +/*! + \qmlmethod bool WebView::evaluateJavaScript(string) + + Evaluates the \a scriptSource JavaScript inside the context of the + main web frame, and returns the result of the last executed statement. + + Note that this JavaScript does \e not have any access to QML objects + except as made available as windowObjects. +*/ +QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource) +{ + return this->page()->mainFrame()->evaluateJavaScript(scriptSource); +} + +void QDeclarativeWebView::focusChanged(bool hasFocus) +{ + QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); + page()->event(&e); + QDeclarativeItem::focusChanged(hasFocus); +} + +void QDeclarativeWebView::initialLayout() +{ + // nothing useful to do at this point +} + +void QDeclarativeWebView::noteContentsSizeChanged(const QSize&) +{ + expandToWebPage(); +} + +void QDeclarativeWebView::expandToWebPage() +{ + Q_D(QDeclarativeWebView); + QSize cs = page()->mainFrame()->contentsSize(); + if (cs.width() < d->preferredwidth) + cs.setWidth(d->preferredwidth); + if (cs.height() < d->preferredheight) + cs.setHeight(d->preferredheight); + if (widthValid()) + cs.setWidth(width()); + if (heightValid()) + cs.setHeight(height()); + if (cs != page()->viewportSize()) { + page()->setViewportSize(cs); + } + if (cs != contentsSize()) + setContentsSize(cs); +} + +void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) +{ + if (newGeometry.size() != oldGeometry.size()) + expandToWebPage(); + QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); +} + +void QDeclarativeWebView::paintPage(const QRect& r) +{ + dirtyCache(r); + update(); +} + +/*! + \qmlproperty list WebView::javaScriptWindowObjects + + This property is a list of object that are available from within + the webview's JavaScript context. + + The \a object will be inserted as a child of the frame's window + object, under the name given by the attached property \c WebView.windowObjectName. + + \qml + WebView { + javaScriptWindowObjects: Object { + WebView.windowObjectName: "coordinates" + } + } + \endqml + + Properties of the object will be exposed as JavaScript properties and slots as + JavaScript methods. + + If Javascript is not enabled for this page, then this property does nothing. +*/ +QDeclarativeListProperty QDeclarativeWebView::javaScriptWindowObjects() +{ + Q_D(QDeclarativeWebView); + return QDeclarativeListProperty(this, d, &QDeclarativeWebViewPrivate::windowObjects_append); +} + +QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject *o) +{ + return new QDeclarativeWebViewAttached(o); +} + +void QDeclarativeWebViewPrivate::updateWindowObjects() +{ + Q_Q(QDeclarativeWebView); + if (!q->isComponentComplete() || !page) + return; + + for (int ii = 0; ii < windowObjects.count(); ++ii) { + QObject *object = windowObjects.at(ii); + QDeclarativeWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); + if (attached && !attached->windowObjectName().isEmpty()) { + page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); + } + } +} + +bool QDeclarativeWebView::renderingEnabled() const +{ + Q_D(const QDeclarativeWebView); + return d->rendering; +} + +void QDeclarativeWebView::setRenderingEnabled(bool enabled) +{ + Q_D(QDeclarativeWebView); + if (d->rendering == enabled) + return; + d->rendering = enabled; + emit renderingEnabledChanged(); + + setCacheFrozen(!enabled); + if (enabled) + clearCache(); +} + + +void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r) +{ + Q_D(QDeclarativeWebView); + if (d->rendering) + page()->mainFrame()->render(p,r); +} + +QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) +{ + QEvent::Type t; + switch(e->type()) { + default: + case QEvent::GraphicsSceneMousePress: + t = QEvent::MouseButtonPress; + break; + case QEvent::GraphicsSceneMouseRelease: + t = QEvent::MouseButtonRelease; + break; + case QEvent::GraphicsSceneMouseMove: + t = QEvent::MouseMove; + break; + case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick: + t = QEvent::MouseButtonDblClick; + break; + } + + QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), e->button(), e->buttons(), 0); + return me; +} + +QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) +{ + QEvent::Type t = QEvent::MouseMove; + + QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), Qt::NoButton, Qt::NoButton, 0); + + return me; +} + + +/*! + \qmlsignal WebView::onDoubleClick(clickx,clicky) + + The WebView does not pass double-click events to the web engine, but rather + emits this signals. +*/ + +void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + emit doubleClick(me->x(),me->y()); + delete me; +} + +/*! + \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) + + Finds a zoom that: + \list + \i shows a whole item + \i includes (\a clickX, \a clickY) + \i fits into the preferredWidth and preferredHeight + \i zooms by no more than \a maxzoom + \i is more than 10% above the current zoom + \endlist + + If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, + no signal is emitted and returns false. +*/ +bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) +{ + Q_D(QDeclarativeWebView); + if (contentsScale() >= maxzoom/zoomFactor()) + return false; + qreal ozf = contentsScale(); + QRect showarea = elementAreaAt(clickX, clickY, d->preferredwidth/maxzoom, d->preferredheight/maxzoom); + qreal z = qMin(qreal(d->preferredwidth)/showarea.width(),qreal(d->preferredheight)/showarea.height()); + if (z > maxzoom/zoomFactor()) + z = maxzoom/zoomFactor(); + if (z/ozf > 1.2) { + QRectF r(showarea.left()*z, showarea.top()*z, showarea.width()*z, showarea.height()*z); + emit zoomTo(z,r.x()+r.width()/2, r.y()+r.height()/2); + return true; + } else { + return false; + } +} + +/*! + \qmlproperty int WebView::pressGrabTime + + The number of milliseconds the user must press before the WebView + starts passing move events through to the web engine (rather than + letting other QML elements such as a Flickable take them). + + Defaults to 400ms. Set to 0 to always grab and pass move events to + the web engine. +*/ +int QDeclarativeWebView::pressGrabTime() const +{ + Q_D(const QDeclarativeWebView); + return d->pressTime; +} + +void QDeclarativeWebView::setPressGrabTime(int ms) +{ + Q_D(QDeclarativeWebView); + if (d->pressTime == ms) + return; + d->pressTime = ms; + emit pressGrabTimeChanged(); +} + +void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + setFocus (true); + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + + d->pressPoint = me->pos(); + if (d->pressTime) { + d->pressTimer.start(d->pressTime,this); + setKeepMouseGrab(false); + } else { + grabMouse(); + setKeepMouseGrab(true); + } + + page()->event(me); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit + Might be a bug in WebKit, though + */ +#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) { + QDeclarativePaintedItem::mousePressEvent(event); + } +} + +void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + page()->event(me); + d->pressTimer.stop(); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send all the events to WebKit + */ +#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) { + QDeclarativePaintedItem::mouseReleaseEvent(event); + } + setKeepMouseGrab(false); + ungrabMouse(); +} + +void QDeclarativeWebView::timerEvent(QTimerEvent *event) +{ + Q_D(QDeclarativeWebView); + if (event->timerId() == d->pressTimer.timerId()) { + d->pressTimer.stop(); + grabMouse(); + setKeepMouseGrab(true); + } +} + +void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + if (d->pressTimer.isActive()) { + if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { + d->pressTimer.stop(); + } + } + if (keepMouseGrab()) { + page()->event(me); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit + Might be a bug in WebKit, though + */ +#if 1 // QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + } + delete me; + if (!event->isAccepted()) + QDeclarativePaintedItem::mouseMoveEvent(event); + +} +void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) +{ + QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); + page()->event(me); + event->setAccepted( +#if QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) + QDeclarativePaintedItem::hoverMoveEvent(event); +} + +void QDeclarativeWebView::keyPressEvent(QKeyEvent* event) +{ + page()->event(event); + if (!event->isAccepted()) + QDeclarativePaintedItem::keyPressEvent(event); +} + +void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event) +{ + page()->event(event); + if (!event->isAccepted()) + QDeclarativePaintedItem::keyReleaseEvent(event); +} + +bool QDeclarativeWebView::sceneEvent(QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *k = static_cast(event); + if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { + if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? + page()->event(event); + if (event->isAccepted()) + return true; + } + } + } + return QDeclarativePaintedItem::sceneEvent(event); +} + + +/*! + \qmlproperty action WebView::back + This property holds the action for causing the previous URL in the history to be displayed. +*/ +QAction *QDeclarativeWebView::backAction() const +{ + return page()->action(QWebPage::Back); +} + +/*! + \qmlproperty action WebView::forward + This property holds the action for causing the next URL in the history to be displayed. +*/ +QAction *QDeclarativeWebView::forwardAction() const +{ + return page()->action(QWebPage::Forward); +} + +/*! + \qmlproperty action WebView::reload + This property holds the action for reloading with the current URL +*/ +QAction *QDeclarativeWebView::reloadAction() const +{ + return page()->action(QWebPage::Reload); +} + +/*! + \qmlproperty action WebView::stop + This property holds the action for stopping loading with the current URL +*/ +QAction *QDeclarativeWebView::stopAction() const +{ + return page()->action(QWebPage::Stop); +} + +/*! + \qmlproperty real WebView::title + This property holds the title of the web page currently viewed + + By default, this property contains an empty string. +*/ +QString QDeclarativeWebView::title() const +{ + return page()->mainFrame()->title(); +} + + + +/*! + \qmlproperty pixmap WebView::icon + This property holds the icon associated with the web page currently viewed +*/ +QPixmap QDeclarativeWebView::icon() const +{ + return page()->mainFrame()->icon().pixmap(QSize(256,256)); +} + + +/*! + \qmlproperty real WebView::zoomFactor + This property holds the multiplier used to scale the contents of a Web page. +*/ +void QDeclarativeWebView::setZoomFactor(qreal factor) +{ + Q_D(QDeclarativeWebView); + if (factor == page()->mainFrame()->zoomFactor()) + return; + + page()->mainFrame()->setZoomFactor(factor); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor, + d->preferredheight>0 ? d->preferredheight*factor : height()*factor)); + expandToWebPage(); + + emit zoomFactorChanged(); +} + +qreal QDeclarativeWebView::zoomFactor() const +{ + return page()->mainFrame()->zoomFactor(); +} + +/*! + \qmlproperty string WebView::statusText + + This property is the current status suggested by the current web page. In a web browser, + such status is often shown in some kind of status bar. +*/ +void QDeclarativeWebView::setStatusText(const QString& s) +{ + Q_D(QDeclarativeWebView); + d->statusText = s; + emit statusTextChanged(); +} + +void QDeclarativeWebView::windowObjectCleared() +{ + Q_D(QDeclarativeWebView); + d->updateWindowObjects(); +} + +QString QDeclarativeWebView::statusText() const +{ + Q_D(const QDeclarativeWebView); + return d->statusText; +} + +QWebPage *QDeclarativeWebView::page() const +{ + Q_D(const QDeclarativeWebView); + + if (!d->page) { + QDeclarativeWebView *self = const_cast(this); + QWebPage *wp = new QDeclarativeWebPage(self); + + // QML items don't default to having a background, + // even though most we pages will set one anyway. + QPalette pal = QApplication::palette(); + pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); + wp->setPalette(pal); + + wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); + + self->setPage(wp); + + return wp; + } + + return d->page; +} + + +// The QObject interface to settings(). +/*! + \qmlproperty string WebView::settings.standardFontFamily + \qmlproperty string WebView::settings.fixedFontFamily + \qmlproperty string WebView::settings.serifFontFamily + \qmlproperty string WebView::settings.sansSerifFontFamily + \qmlproperty string WebView::settings.cursiveFontFamily + \qmlproperty string WebView::settings.fantasyFontFamily + + \qmlproperty int WebView::settings.minimumFontSize + \qmlproperty int WebView::settings.minimumLogicalFontSize + \qmlproperty int WebView::settings.defaultFontSize + \qmlproperty int WebView::settings.defaultFixedFontSize + + \qmlproperty bool WebView::settings.autoLoadImages + \qmlproperty bool WebView::settings.javascriptEnabled + \qmlproperty bool WebView::settings.javaEnabled + \qmlproperty bool WebView::settings.pluginsEnabled + \qmlproperty bool WebView::settings.privateBrowsingEnabled + \qmlproperty bool WebView::settings.javascriptCanOpenWindows + \qmlproperty bool WebView::settings.javascriptCanAccessClipboard + \qmlproperty bool WebView::settings.developerExtrasEnabled + \qmlproperty bool WebView::settings.linksIncludedInFocusChain + \qmlproperty bool WebView::settings.zoomTextOnly + \qmlproperty bool WebView::settings.printElementBackgrounds + \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled + \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled + \qmlproperty bool WebView::settings.localStorageDatabaseEnabled + \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls + + These properties give access to the settings controlling the web view. + + See QWebSettings for details of these properties. + + \qml + WebView { + settings.pluginsEnabled: true + settings.standardFontFamily: "Arial" + ... + } + \endqml +*/ +QObject *QDeclarativeWebView::settingsObject() const +{ + Q_D(const QDeclarativeWebView); + d->settings.s = page()->settings(); + return &d->settings; +} + +void QDeclarativeWebView::setPage(QWebPage *page) +{ + Q_D(QDeclarativeWebView); + if (d->page == page) + return; + if (d->page) { + if (d->page->parent() == this) { + delete d->page; + } else { + d->page->disconnect(this); + } + } + d->page = page; + d->page->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff); + d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); + connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); + connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); + connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); + connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); + connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); + + connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted())); + connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int))); + connect(d->page,SIGNAL(loadFinished(bool)),this,SLOT(doLoadFinished(bool))); + connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString))); + + connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared())); +} + +/*! + \qmlsignal WebView::onLoadStarted() + + This handler is called when the web engine begins loading + a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() + will be emitted. +*/ + +/*! + \qmlsignal WebView::onLoadFinished() + + This handler is called when the web engine \e successfully + finishes loading a page, including any component content + (WebView::onLoadFailed() will be emitted otherwise). + + \sa progress +*/ + +/*! + \qmlsignal WebView::onLoadFailed() + + This handler is called when the web engine fails loading + a page or any component content + (WebView::onLoadFinished() will be emitted on success). +*/ + +void QDeclarativeWebView::load(const QNetworkRequest &request, + QNetworkAccessManager::Operation operation, + const QByteArray &body) +{ + page()->mainFrame()->load(request, operation, body); +} + +QString QDeclarativeWebView::html() const +{ + return page()->mainFrame()->toHtml(); +} + +/*! + \qmlproperty string WebView::html + This property holds HTML text set directly + + The html property can be set as a string. + + \qml + WebView { + html: "

This is HTML." + } + \endqml +*/ +void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) +{ + Q_D(QDeclarativeWebView); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + if (isComponentComplete()) + page()->mainFrame()->setHtml(html, baseUrl); + else { + d->pending = d->PendingHtml; + d->pending_url = baseUrl; + d->pending_string = html; + } + emit htmlChanged(); +} + +void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) +{ + Q_D(QDeclarativeWebView); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + + if (isComponentComplete()) + page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); + else { + d->pending = d->PendingContent; + d->pending_url = baseUrl; + d->pending_string = mimeType; + d->pending_data = data; + } +} + +QWebHistory *QDeclarativeWebView::history() const +{ + return page()->history(); +} + +QWebSettings *QDeclarativeWebView::settings() const +{ + return page()->settings(); +} + +QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) +{ + Q_D(QDeclarativeWebView); + switch (type) { + case QWebPage::WebBrowserWindow: { + if (!d->newWindowComponent && d->newWindowParent) + qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored"); + else if (d->newWindowComponent && !d->newWindowParent) + qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); + else if (d->newWindowComponent && d->newWindowParent) { + QDeclarativeWebView *webview = 0; + QDeclarativeContext *windowContext = new QDeclarativeContext(qmlContext(this)); + + QObject *nobj = d->newWindowComponent->create(windowContext); + if (nobj) { + windowContext->setParent(nobj); + QDeclarativeItem *item = qobject_cast(nobj); + if (!item) { + delete nobj; + } else { + webview = item->findChild(); + if (!webview) { + delete item; + } else { + nobj->setParent(d->newWindowParent); + static_cast(item)->setParentItem(d->newWindowParent); + } + } + } else { + delete windowContext; + } + + return webview; + } + } + break; + case QWebPage::WebModalDialog: { + // Not supported + } + } + return 0; +} + +/*! + \qmlproperty component WebView::newWindowComponent + + This property holds the component to use for new windows. + The component must have a WebView somewhere in its structure. + + When the web engine requests a new window, it will be an instance of + this component. + + The parent of the new window is set by newWindowParent. It must be set. +*/ +QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const +{ + Q_D(const QDeclarativeWebView); + return d->newWindowComponent; +} + +void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow) +{ + Q_D(QDeclarativeWebView); + if (newWindow == d->newWindowComponent) + return; + d->newWindowComponent = newWindow; + emit newWindowComponentChanged(); +} + + +/*! + \qmlproperty item WebView::newWindowParent + + The parent item for new windows. + + \sa newWindowComponent +*/ +QDeclarativeItem *QDeclarativeWebView::newWindowParent() const +{ + Q_D(const QDeclarativeWebView); + return d->newWindowParent; +} + +void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) +{ + Q_D(QDeclarativeWebView); + if (parent == d->newWindowParent) + return; + if (d->newWindowParent && parent) { + QList children = d->newWindowParent->childItems(); + for (int i = 0; i < children.count(); ++i) { + children.at(i)->setParentItem(parent); + } + } + d->newWindowParent = parent; + emit newWindowParentChanged(); +} + +/*! + Returns the area of the largest element at position (\a x,\a y) that is no larger + than \a maxwidth by \a maxheight pixels. + + May return an area larger in the case when no smaller element is at the position. +*/ +QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const +{ + QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y)); + QRect rv = hit.boundingRect(); + QWebElement element = hit.enclosingBlockElement(); + if (maxwidth<=0) maxwidth = INT_MAX; + if (maxheight<=0) maxheight = INT_MAX; + while (!element.parent().isNull() && element.geometry().width() <= maxwidth && element.geometry().height() <= maxheight) { + rv = element.geometry(); + element = element.parent(); + } + return rv; +} + +/*! + \internal + \class QDeclarativeWebPage + \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins. + + \sa QDeclarativeWebView +*/ +QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView *parent) : + QWebPage(parent) +{ +} + +QDeclarativeWebPage::~QDeclarativeWebPage() +{ +} + +void QDeclarativeWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) +{ + qWarning() << sourceID << ':' << lineNumber << ':' << message; +} + +QString QDeclarativeWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(oldFile) + return oldFile; +} + +void QDeclarativeWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) +{ + Q_UNUSED(originatingFrame) + emit viewItem()->alert(msg); +} + +bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(msg) + return false; +} + +bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(msg) + Q_UNUSED(defaultValue) + Q_UNUSED(result) + return false; +} + + +/* + Qt WebKit does not understand non-QWidget plugins, so dummy widgets + are created, parented to a single dummy tool window. + + The requirements for QML object plugins are input to the Qt WebKit + non-QWidget plugin support, which will obsolete this kludge. +*/ +class QWidget_Dummy_Plugin : public QWidget +{ + Q_OBJECT +public: + static QWidget *dummy_shared_parent() + { + static QWidget *dsp = 0; + if (!dsp) { + dsp = new QWidget(0,Qt::Tool); + dsp->setGeometry(-10000,-10000,0,0); + dsp->show(); + } + return dsp; + } + QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : + QWidget(dummy_shared_parent()), + propertyNames(paramNames), + propertyValues(paramValues), + webview(view) + { + QDeclarativeEngine *engine = qmlEngine(webview); + component = new QDeclarativeComponent(engine, url, this); + item = 0; + if (component->isLoading()) + connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded())); + else + qmlLoaded(); + } + +public Q_SLOTS: + void qmlLoaded() + { + if (component->isError()) { + // ### Could instead give these errors to the WebView to handle. + qWarning() << component->errors(); + return; + } + item = qobject_cast(component->create(qmlContext(webview))); + item->setParent(webview); + QString jsObjName; + for (int i=0; isetProperty(propertyNames[i].toUtf8(),propertyValues[i]); + if (propertyNames[i] == QLatin1String("objectname")) + jsObjName = propertyValues[i]; + } + } + if (!jsObjName.isNull()) { + QWebFrame *f = webview->page()->mainFrame(); + f->addToJavaScriptWindowObject(jsObjName, item); + } + resizeEvent(0); + delete component; + component = 0; + } + void resizeEvent(QResizeEvent*) + { + if (item) { + item->setX(x()); + item->setY(y()); + item->setWidth(width()); + item->setHeight(height()); + } + } + +private: + QDeclarativeComponent *component; + QDeclarativeItem *item; + QStringList propertyNames, propertyValues; + QDeclarativeWebView *webview; +}; + +QDeclarativeWebView *QDeclarativeWebPage::viewItem() +{ + return static_cast(parent()); +} + +QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) +{ + QUrl comp = qmlContext(viewItem())->resolvedUrl(url); + return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); +} + +QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) +{ + QDeclarativeWebView *newView = viewItem()->createWindow(type); + if (newView) + return newView->page(); + return 0; +} + +QT_END_NAMESPACE + +#include diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h new file mode 100644 index 0000000..0bb5d29 --- /dev/null +++ b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h @@ -0,0 +1,285 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEWEBVIEW_H +#define QDECLARATIVEWEBVIEW_H + +#include + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +class QWebHistory; +class QWebSettings; + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) +class QDeclarativeWebViewPrivate; +class QNetworkRequest; +class QDeclarativeWebView; + +class Q_DECLARATIVE_EXPORT QDeclarativeWebPage : public QWebPage +{ + Q_OBJECT +public: + explicit QDeclarativeWebPage(QDeclarativeWebView *parent); + ~QDeclarativeWebPage(); +protected: + QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); + QWebPage *createWindow(WebWindowType type); + void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); + QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); + void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); + +private: + QDeclarativeWebView *viewItem(); +}; + + +class QDeclarativeWebViewAttached; + +//### TODO: browser plugins + +class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem +{ + Q_OBJECT + + Q_ENUMS(Status SelectionMode) + + Q_PROPERTY(QString title READ title NOTIFY titleChanged) + Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) + Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) + + Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) + + Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged) + + Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) + Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + + Q_PROPERTY(QAction* reload READ reloadAction CONSTANT) + Q_PROPERTY(QAction* back READ backAction CONSTANT) + Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) + Q_PROPERTY(QAction* stop READ stopAction CONSTANT) + + Q_PROPERTY(QObject* settings READ settingsObject CONSTANT) + + Q_PROPERTY(QDeclarativeListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) + + Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) + Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) + + Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) + +public: + QDeclarativeWebView(QDeclarativeItem *parent=0); + ~QDeclarativeWebView(); + + QUrl url() const; + void setUrl(const QUrl &); + + QString title() const; + + QPixmap icon() const; + + qreal zoomFactor() const; + void setZoomFactor(qreal); + Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); + QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; + + int pressGrabTime() const; + void setPressGrabTime(int); + + int preferredWidth() const; + void setPreferredWidth(int); + int preferredHeight() const; + void setPreferredHeight(int); + + enum Status { Null, Ready, Loading, Error }; + Status status() const; + qreal progress() const; + QString statusText() const; + + QAction *reloadAction() const; + QAction *backAction() const; + QAction *forwardAction() const; + QAction *stopAction() const; + + QWebPage *page() const; + void setPage(QWebPage *page); + + void load(const QNetworkRequest &request, + QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, + const QByteArray &body = QByteArray()); + + QString html() const; + + void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); + void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); + + QWebHistory *history() const; + QWebSettings *settings() const; + QObject *settingsObject() const; + + bool renderingEnabled() const; + void setRenderingEnabled(bool); + + QDeclarativeListProperty javaScriptWindowObjects(); + + static QDeclarativeWebViewAttached *qmlAttachedProperties(QObject *); + + QDeclarativeComponent *newWindowComponent() const; + void setNewWindowComponent(QDeclarativeComponent *newWindow); + QDeclarativeItem *newWindowParent() const; + void setNewWindowParent(QDeclarativeItem *newWindow); + +Q_SIGNALS: + void preferredWidthChanged(); + void preferredHeightChanged(); + void urlChanged(); + void progressChanged(); + void statusChanged(Status); + void titleChanged(const QString&); + void iconChanged(); + void statusTextChanged(); + void htmlChanged(); + void pressGrabTimeChanged(); + void zoomFactorChanged(); + void newWindowComponentChanged(); + void newWindowParentChanged(); + void renderingEnabledChanged(); + + void loadStarted(); + void loadFinished(); + void loadFailed(); + + void doubleClick(int clickX, int clickY); + + void zoomTo(qreal zoom, int centerX, int centerY); + + void alert(const QString& message); + +public Q_SLOTS: + QVariant evaluateJavaScript(const QString&); + +private Q_SLOTS: + void expandToWebPage(); + void paintPage(const QRect&); + void doLoadStarted(); + void doLoadProgress(int p); + void doLoadFinished(bool ok); + void setStatusText(const QString&); + void windowObjectCleared(); + void pageUrlChanged(); + void noteContentsSizeChanged(const QSize&); + void initialLayout(); + +protected: + void drawContents(QPainter *, const QRect &); + + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void timerEvent(QTimerEvent *event); + void hoverMoveEvent (QGraphicsSceneHoverEvent * event); + void keyPressEvent(QKeyEvent* event); + void keyReleaseEvent(QKeyEvent* event); + virtual void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry); + virtual void focusChanged(bool); + virtual bool sceneEvent(QEvent *event); + QDeclarativeWebView *createWindow(QWebPage::WebWindowType type); + +private: + void init(); + virtual void componentComplete(); + Q_DISABLE_COPY(QDeclarativeWebView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView) + QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *); + QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *); + friend class QDeclarativeWebPage; +}; + +class QDeclarativeWebViewAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) +public: + QDeclarativeWebViewAttached(QObject *parent) + : QObject(parent) + { + } + + QString windowObjectName() const + { + return m_windowObjectName; + } + + void setWindowObjectName(const QString &n) + { + m_windowObjectName = n; + } + +private: + QString m_windowObjectName; +}; + + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeWebView) +QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES) + +QT_END_HEADER + +#endif diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h new file mode 100644 index 0000000..258b472 --- /dev/null +++ b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEWEBVIEW_P_H +#define QDECLARATIVEWEBVIEW_P_H + +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeWebSettings : public QObject { + Q_OBJECT + + Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) + Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) + Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) + Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) + Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) + Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) + + Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) + Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) + Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) + Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) + + Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) + Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) + Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) + Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) + Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) + Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) + Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) + Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) + Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) + Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) + Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) + Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) + Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) + Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) + Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) + +public: + QDeclarativeWebSettings() {} + + QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } + void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } + QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } + void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } + QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } + void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } + QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } + void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } + QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } + void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } + QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } + void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } + + int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } + void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } + int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } + void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } + int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } + void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } + int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } + void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } + + bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } + void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } + bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } + void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } + bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } + void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } + bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } + void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } + bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } + void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } + bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } + void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } + bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } + void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } + bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } + void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } + bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } + void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } + bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } + void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } + bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } + void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } + bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } + void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } + bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } + void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } + bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } + void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } + bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } + void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } + + QWebSettings *s; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeWebSettings) + +QT_END_HEADER + +#endif diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro b/src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro new file mode 100644 index 0000000..37fe37c --- /dev/null +++ b/src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro @@ -0,0 +1,18 @@ +TARGET = webkitqmlplugin +include(../../qpluginbase.pri) + +contains(QT_CONFIG, webkit) { + QT += webkit declarative + + SOURCES += qdeclarativewebview.cpp plugin.cpp + HEADERS += qdeclarativewebview_p.h + HEADERS += qdeclarativewebview_p_p.h + + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/org/webkit + target.path = $$[QT_INSTALL_IMPORTS]/org/webkit + + qmldir.files += $$QT_BUILD_TREE/imports/org/webkit/qmldir + qmldir.path += $$[QT_INSTALL_IMPORTS]/org/webkit + + INSTALLS += target qmldir +} diff --git a/tests/auto/declarative/qdeclarativewebview/data/basic.qml b/tests/auto/declarative/qdeclarativewebview/data/basic.qml index 5394837..f0b41ef 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/basic.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/basic.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { url: "basic.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/elements.qml b/tests/auto/declarative/qdeclarativewebview/data/elements.qml index 7c030e6..16e5788 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/elements.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/elements.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { url: "elements.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml index 07eee88..0e92e0e 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { url: "javaScript.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml index 1460f30..f827238 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { url: "does-not-exist.html" diff --git a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml index 0bc8263..4d9df43 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml @@ -1,6 +1,7 @@ // Demonstrates opening new WebViews from HTML import Qt 4.6 +import org.webkit 1.0 Grid { columns: 3 diff --git a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml index 3dd4e51..0770acf 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Item { width: 240 @@ -30,4 +31,4 @@ Item { pressGrabTime: 200 } } -} \ No newline at end of file +} diff --git a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml index 063b5a8..9e17597 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { html: "

This is a string set on the WebView" diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro index 6af0a60..20173c6 100644 --- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -3,8 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative contains(QT_CONFIG,webkit): QT += webkit macx:CONFIG -= app_bundle -SOURCES += tst_qdeclarativewebview.cpp testtypes.cpp -HEADERS += testtypes.h +SOURCES += tst_qdeclarativewebview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativewebview/testtypes.cpp b/tests/auto/declarative/qdeclarativewebview/testtypes.cpp deleted file mode 100644 index 7efc214..0000000 --- a/tests/auto/declarative/qdeclarativewebview/testtypes.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "testtypes.h" - -void MyWebView::drawContents(QPainter *p, const QRect &r) -{ - pp += r.width()*r.height(); - QDeclarativeWebView::drawContents(p,r); -} - -void registerTypes() -{ - QML_REGISTER_TYPE(Test,1,0,MyWebView,MyWebView); -} diff --git a/tests/auto/declarative/qdeclarativewebview/testtypes.h b/tests/auto/declarative/qdeclarativewebview/testtypes.h deleted file mode 100644 index 8eb703f..0000000 --- a/tests/auto/declarative/qdeclarativewebview/testtypes.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TESTTYPES_H -#define TESTTYPES_H - -#include - -class MyWebView : public QDeclarativeWebView -{ - Q_OBJECT - Q_PROPERTY(int pixelsPainted READ pixelsPainted); - -public: - MyWebView() : pp(0) {} - - int pixelsPainted() const { return pp; } - - void drawContents(QPainter *p, const QRect &r); - -private: - int pp; -}; - -QML_DECLARE_TYPE(MyWebView); - -void registerTypes(); - -#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index 6d16056..1d6bedc 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -43,15 +43,12 @@ #include "../../../shared/util.h" #include #include -#include -#include #include #include #include #include #include #include -#include "testtypes.h" class tst_qdeclarativewebview : public QObject { @@ -70,7 +67,7 @@ private slots: void setHtml(); void javaScript(); void cleanupTestCase(); - void pixelCache(); + //void pixelCache(); void newWindowParent(); void newWindowComponent(); void renderingEnabled(); @@ -89,7 +86,6 @@ private: void tst_qdeclarativewebview::initTestCase() { - registerTypes(); } static QString strippedHtml(QString html) @@ -148,81 +144,81 @@ void tst_qdeclarativewebview::basicProperties() checkNoErrors(component); QWebSettings::enablePersistentStorage(tmpDir()); - QDeclarativeWebView *wv = qobject_cast(component.create()); + QObject *wv = component.create(); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->title(),QString("Basic")); - QTRY_COMPARE(wv->icon().width(), 48); - QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.png")); - QCOMPARE(wv->statusText(),QString("status here")); - QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html())); - QCOMPARE(wv->width(), 123.0); - QCOMPARE(wv->preferredWidth(), 0); - QCOMPARE(wv->preferredHeight(), 0); - QCOMPARE(wv->zoomFactor(), 1.0); - QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); - QCOMPARE(wv->status(), QDeclarativeWebView::Ready); - QVERIFY(wv->reloadAction()); - QVERIFY(wv->reloadAction()->isEnabled()); - QVERIFY(wv->backAction()); - QVERIFY(!wv->backAction()->isEnabled()); - QVERIFY(wv->forwardAction()); - QVERIFY(!wv->forwardAction()->isEnabled()); - QVERIFY(wv->stopAction()); - QVERIFY(!wv->stopAction()->isEnabled()); - - wv->setPixelCacheSize(0); // mainly testing that it doesn't crash or anything! - QCOMPARE(wv->pixelCacheSize(),0); - wv->reloadAction()->trigger(); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + QCOMPARE(wv->property("title").toString(),QString("Basic")); + QTRY_COMPARE(qvariant_cast(wv->property("icon")).width(), 48); + QCOMPARE(qvariant_cast(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png")); + QCOMPARE(wv->property("statusText").toString(),QString("status here")); + QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); + QCOMPARE(wv->property("width").toDouble(), 123.0); + QCOMPARE(wv->property("preferredWidth").toInt(), 0); + QCOMPARE(wv->property("preferredHeight").toInt(), 0); + QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); + QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); + QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); + QVERIFY(qvariant_cast(wv->property("reload"))); + QVERIFY(qvariant_cast(wv->property("reload"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("back"))); + QVERIFY(!qvariant_cast(wv->property("back"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("forward"))); + QVERIFY(!qvariant_cast(wv->property("forward"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("stop"))); + QVERIFY(!qvariant_cast(wv->property("stop"))->isEnabled()); + + wv->setProperty("pixelCacheSize", 0); // mainly testing that it doesn't crash or anything! + QCOMPARE(wv->property("pixelCacheSize").toInt(),0); + qvariant_cast(wv->property("reload"))->trigger(); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); } void tst_qdeclarativewebview::settings() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); checkNoErrors(component); - QDeclarativeWebView *wv = qobject_cast(component.create()); + QObject *wv = component.create(); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QDeclarativeWebSettings *s = wv->settingsObject(); + QObject *s = qvariant_cast(wv->property("settings")); // merely tests that setting gets stored (in QWebSettings) // behavioural tests are in WebKit. for (int b=0; b<=1; ++b) { bool on = !!b; - s->setAutoLoadImages(on); - s->setDeveloperExtrasEnabled(on); - s->setJavaEnabled(on); - s->setJavascriptCanAccessClipboard(on); - s->setJavascriptCanOpenWindows(on); - s->setJavascriptEnabled(on); - s->setLinksIncludedInFocusChain(on); - s->setLocalContentCanAccessRemoteUrls(on); - s->setLocalStorageDatabaseEnabled(on); - s->setOfflineStorageDatabaseEnabled(on); - s->setOfflineWebApplicationCacheEnabled(on); - s->setPluginsEnabled(on); - s->setPrintElementBackgrounds(on); - s->setPrivateBrowsingEnabled(on); - s->setZoomTextOnly(on); - - QVERIFY(s->autoLoadImages() == on); - QVERIFY(s->developerExtrasEnabled() == on); - QVERIFY(s->javaEnabled() == on); - QVERIFY(s->javascriptCanAccessClipboard() == on); - QVERIFY(s->javascriptCanOpenWindows() == on); - QVERIFY(s->javascriptEnabled() == on); - QVERIFY(s->linksIncludedInFocusChain() == on); - QVERIFY(s->localContentCanAccessRemoteUrls() == on); - QVERIFY(s->localStorageDatabaseEnabled() == on); - QVERIFY(s->offlineStorageDatabaseEnabled() == on); - QVERIFY(s->offlineWebApplicationCacheEnabled() == on); - QVERIFY(s->pluginsEnabled() == on); - QVERIFY(s->printElementBackgrounds() == on); - QVERIFY(s->privateBrowsingEnabled() == on); - QVERIFY(s->zoomTextOnly() == on); + s->setProperty("autoLoadImages", on); + s->setProperty("developerExtrasEnabled", on); + s->setProperty("javaEnabled", on); + s->setProperty("javascriptCanAccessClipboard", on); + s->setProperty("javascriptCanOpenWindows", on); + s->setProperty("javascriptEnabled", on); + s->setProperty("linksIncludedInFocusChain", on); + s->setProperty("localContentCanAccessRemoteUrls", on); + s->setProperty("localStorageDatabaseEnabled", on); + s->setProperty("offlineStorageDatabaseEnabled", on); + s->setProperty("offlineWebApplicationCacheEnabled", on); + s->setProperty("pluginsEnabled", on); + s->setProperty("printElementBackgrounds", on); + s->setProperty("privateBrowsingEnabled", on); + s->setProperty("zoomTextOnly", on); + + QVERIFY(s->property("autoLoadImages") == on); + QVERIFY(s->property("developerExtrasEnabled") == on); + QVERIFY(s->property("javaEnabled") == on); + QVERIFY(s->property("javascriptCanAccessClipboard") == on); + QVERIFY(s->property("javascriptCanOpenWindows") == on); + QVERIFY(s->property("javascriptEnabled") == on); + QVERIFY(s->property("linksIncludedInFocusChain") == on); + QVERIFY(s->property("localContentCanAccessRemoteUrls") == on); + QVERIFY(s->property("localStorageDatabaseEnabled") == on); + QVERIFY(s->property("offlineStorageDatabaseEnabled") == on); + QVERIFY(s->property("offlineWebApplicationCacheEnabled") == on); + QVERIFY(s->property("pluginsEnabled") == on); + QVERIFY(s->property("printElementBackgrounds") == on); + QVERIFY(s->property("privateBrowsingEnabled") == on); + QVERIFY(s->property("zoomTextOnly") == on); QVERIFY(s->property("autoLoadImages") == on); QVERIFY(s->property("developerExtrasEnabled") == on); @@ -248,65 +244,65 @@ void tst_qdeclarativewebview::historyNav() checkNoErrors(component); QWebSettings::enablePersistentStorage(tmpDir()); - QDeclarativeWebView *wv = qobject_cast(component.create()); + QObject *wv = component.create(); QVERIFY(wv != 0); for (int i=1; i<=2; ++i) { - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->title(),QString("Basic")); - QTRY_COMPARE(wv->icon().width(), 48); - QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.png")); - QCOMPARE(wv->statusText(),QString("status here")); - QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html())); - QCOMPARE(wv->width(), 123.0); - QCOMPARE(wv->preferredWidth(), 0); - QCOMPARE(wv->zoomFactor(), 1.0); - QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); - QCOMPARE(wv->status(), QDeclarativeWebView::Ready); - QVERIFY(wv->reloadAction()); - QVERIFY(wv->reloadAction()->isEnabled()); - QVERIFY(wv->backAction()); - QVERIFY(!wv->backAction()->isEnabled()); - QVERIFY(wv->forwardAction()); - QVERIFY(!wv->forwardAction()->isEnabled()); - QVERIFY(wv->stopAction()); - QVERIFY(!wv->stopAction()->isEnabled()); - - wv->reloadAction()->trigger(); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + QCOMPARE(wv->property("title").toString(),QString("Basic")); + QTRY_COMPARE(qvariant_cast(wv->property("icon")).width(), 48); + QCOMPARE(qvariant_cast(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png")); + QCOMPARE(wv->property("statusText").toString(),QString("status here")); + QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); + QCOMPARE(wv->property("width").toDouble(), 123.0); + QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0); + QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0); + QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); + QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); + QVERIFY(qvariant_cast(wv->property("reload"))); + QVERIFY(qvariant_cast(wv->property("reload"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("back"))); + QVERIFY(!qvariant_cast(wv->property("back"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("forward"))); + QVERIFY(!qvariant_cast(wv->property("forward"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("stop"))); + QVERIFY(!qvariant_cast(wv->property("stop"))->isEnabled()); + + qvariant_cast(wv->property("reload"))->trigger(); } - wv->setUrl(QUrl::fromLocalFile(SRCDIR "/data/forward.html")); - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->title(),QString("Forward")); - QTRY_COMPARE(wv->icon().width(), 32); - QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/forward.png")); - QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/forward.html")), strippedHtml(wv->html())); - QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/forward.html")); - QCOMPARE(wv->status(), QDeclarativeWebView::Ready); - QCOMPARE(wv->statusText(),QString("")); - QVERIFY(wv->reloadAction()); - QVERIFY(wv->reloadAction()->isEnabled()); - QVERIFY(wv->backAction()); - QVERIFY(wv->backAction()->isEnabled()); - QVERIFY(wv->forwardAction()); - QVERIFY(!wv->forwardAction()->isEnabled()); - QVERIFY(wv->stopAction()); - QVERIFY(!wv->stopAction()->isEnabled()); - - wv->backAction()->trigger(); - - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->title(),QString("Basic")); - QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->html())); - QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); - QCOMPARE(wv->status(), QDeclarativeWebView::Ready); - QVERIFY(wv->reloadAction()); - QVERIFY(wv->reloadAction()->isEnabled()); - QVERIFY(wv->backAction()); - QVERIFY(!wv->backAction()->isEnabled()); - QVERIFY(wv->forwardAction()); - QVERIFY(wv->forwardAction()->isEnabled()); - QVERIFY(wv->stopAction()); - QVERIFY(!wv->stopAction()->isEnabled()); + wv->setProperty("url", QUrl::fromLocalFile(SRCDIR "/data/forward.html")); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + QCOMPARE(wv->property("title").toString(),QString("Forward")); + QTRY_COMPARE(qvariant_cast(wv->property("icon")).width(), 32); + QCOMPARE(qvariant_cast(wv->property("icon")),QPixmap(SRCDIR "/data/forward.png")); + QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/forward.html")), strippedHtml(wv->property("html").toString())); + QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/forward.html")); + QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); + QCOMPARE(wv->property("statusText").toString(),QString("")); + QVERIFY(qvariant_cast(wv->property("reload"))); + QVERIFY(qvariant_cast(wv->property("reload"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("back"))); + QVERIFY(qvariant_cast(wv->property("back"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("forward"))); + QVERIFY(!qvariant_cast(wv->property("forward"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("stop"))); + QVERIFY(!qvariant_cast(wv->property("stop"))->isEnabled()); + + qvariant_cast(wv->property("back"))->trigger(); + + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + QCOMPARE(wv->property("title").toString(),QString("Basic")); + QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString())); + QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); + QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/); + QVERIFY(qvariant_cast(wv->property("reload"))); + QVERIFY(qvariant_cast(wv->property("reload"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("back"))); + QVERIFY(!qvariant_cast(wv->property("back"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("forward"))); + QVERIFY(qvariant_cast(wv->property("forward"))->isEnabled()); + QVERIFY(qvariant_cast(wv->property("stop"))); + QVERIFY(!qvariant_cast(wv->property("stop"))->isEnabled()); } void tst_qdeclarativewebview::multipleWindows() @@ -328,16 +324,16 @@ void tst_qdeclarativewebview::loadError() checkNoErrors(component); QWebSettings::enablePersistentStorage(tmpDir()); - QDeclarativeWebView *wv = qobject_cast(component.create()); + QObject *wv = component.create(); QVERIFY(wv != 0); for (int i=1; i<=2; ++i) { - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->title(),QString("")); - QCOMPARE(wv->statusText(),QString("")); // HTML 'status bar' text, not error message - QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/does-not-exist.html")); // Unlike QWebPage, which loses url - QCOMPARE(wv->status(), QDeclarativeWebView::Error); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + QCOMPARE(wv->property("title").toString(),QString("")); + QCOMPARE(wv->property("statusText").toString(),QString("")); // HTML 'status bar' text, not error message + QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/does-not-exist.html")); // Unlike QWebPage, which loses url + QCOMPARE(wv->property("status").toInt(), 3 /*QDeclarativeWebView::Error*/); - wv->reloadAction()->trigger(); + qvariant_cast(wv->property("reload"))->trigger(); } } @@ -345,12 +341,12 @@ void tst_qdeclarativewebview::setHtml() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/sethtml.qml")); checkNoErrors(component); - QDeclarativeWebView *wv = qobject_cast(component.create()); + QObject *wv = component.create(); QVERIFY(wv != 0); - QCOMPARE(wv->html(),QString("

This is a string set on the WebView

")); + QCOMPARE(wv->property("html").toString(),QString("

This is a string set on the WebView

")); QSignalSpy spy(wv, SIGNAL(htmlChanged())); - wv->setHtml(QString("Basic

text

")); + wv->setProperty("html", QString("Basic

text

")); QCOMPARE(spy.count(),1); } @@ -358,81 +354,91 @@ void tst_qdeclarativewebview::elementAreaAt() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/elements.qml")); checkNoErrors(component); - QDeclarativeWebView *wv = qobject_cast(component.create()); + QObject *wv = component.create(); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + /* not now it's a plugin... QCOMPARE(wv->elementAreaAt(40,30,100,100),QRect(1,1,75,54)); // Area A in data/elements.html QCOMPARE(wv->elementAreaAt(130,30,200,100),QRect(78,3,110,50)); // Area B QCOMPARE(wv->elementAreaAt(40,30,400,400),QRect(0,0,310,100)); // Whole view QCOMPARE(wv->elementAreaAt(130,30,280,280),QRect(76,1,223,54)); // Area BC QCOMPARE(wv->elementAreaAt(130,30,400,400),QRect(0,0,310,100)); // Whole view + */ } void tst_qdeclarativewebview::javaScript() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/javaScript.qml")); checkNoErrors(component); - QDeclarativeWebView *wv = qobject_cast(component.create()); + QObject *wv = component.create(); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + /* not now it's a plugin... QCOMPARE(wv->evaluateJavaScript("123").toInt(), 123); QCOMPARE(wv->evaluateJavaScript("window.status").toString(), QString("status here")); QCOMPARE(wv->evaluateJavaScript("window.myjsname.qmlprop").toString(), QString("qmlvalue")); + */ } +/* +Cannot be done now that webkit is a plugin + void tst_qdeclarativewebview::pixelCache() { + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/pixelCache.qml")); checkNoErrors(component); MyWebView *wv = qobject_cast(component.create()); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress"), 1.0); QPixmap pm(150,150); QPainter p(&pm); wv->paint(&p,0,0); const int expected = 120*(150+128); // 120 = width of HTML page, 150=pixmap height, 128=cache extra area - QCOMPARE(wv->pixelsPainted(), expected); + QCOMPARE(wv->property("pixelsPainted"), expected); wv->paint(&p,0,0); - QCOMPARE(wv->pixelsPainted(), expected); // nothing new needed to be painted - wv->setPixelCacheSize(0); // clears the cache + QCOMPARE(wv->property("pixelsPainted"), expected); // nothing new needed to be painted + wv->setProperty("pixelCacheSize", 0); // clears the cache wv->paint(&p,0,0); - QCOMPARE(wv->pixelsPainted(), expected*2); // everything needed to be painted + QCOMPARE(wv->property("pixelsPainted"), expected*2); // everything needed to be painted // Note that painted things always go into the cache (even if they don't "fit"), // just that they will be removed if anything else needs to be painted. - wv->setPixelCacheSize(expected); // won't clear the cache + wv->setProperty("pixelCacheSize", expected); // won't clear the cache wv->paint(&p,0,0); - QCOMPARE(wv->pixelsPainted(), expected*2); // still there - wv->setPixelCacheSize(expected-1); // too small - will clear the cache + QCOMPARE(wv->property("pixelsPainted"), expected*2); // still there + wv->setProperty("pixelCacheSize", expected-1); // too small - will clear the cache wv->paint(&p,0,0); - QCOMPARE(wv->pixelsPainted(), expected*3); // repainted + QCOMPARE(wv->property("pixelsPainted"), expected*3); // repainted } +*/ void tst_qdeclarativewebview::newWindowParent() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); checkNoErrors(component); QDeclarativeItem *rootItem = qobject_cast(component.create()); - QDeclarativeWebView *wv = rootItem->findChild("webView"); + QObject *wv = rootItem->findChild("webView"); QVERIFY(rootItem != 0); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); QDeclarativeItem* oldWindowParent = rootItem->findChild("oldWindowParent"); - QCOMPARE(wv->newWindowParent(), oldWindowParent); + QCOMPARE(qvariant_cast(wv->property("newWindowParent")), oldWindowParent); QSignalSpy newWindowParentSpy(wv, SIGNAL(newWindowParentChanged())); QDeclarativeItem* newWindowParent = rootItem->findChild("newWindowParent"); - wv->setNewWindowParent(newWindowParent); + wv->setProperty("newWindowParent", QVariant::fromValue(newWindowParent)); + QVERIFY(newWindowParent); QVERIFY(oldWindowParent); QVERIFY(oldWindowParent->childItems().count() == 0); - QCOMPARE(wv->newWindowParent(), newWindowParent); + QCOMPARE(wv->property("newWindowParent"), QVariant::fromValue(newWindowParent)); QCOMPARE(newWindowParentSpy.count(),1); - wv->setNewWindowParent(newWindowParent); + wv->setProperty("newWindowParent", QVariant::fromValue(newWindowParent)); QCOMPARE(newWindowParentSpy.count(),1); - wv->setNewWindowParent(0); + wv->setProperty("newWindowParent", QVariant::fromValue((QDeclarativeItem*)0)); QCOMPARE(newWindowParentSpy.count(),2); } @@ -441,23 +447,23 @@ void tst_qdeclarativewebview::newWindowComponent() QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); checkNoErrors(component); QDeclarativeItem *rootItem = qobject_cast(component.create()); - QDeclarativeWebView *wv = rootItem->findChild("webView"); + QObject *wv = rootItem->findChild("webView"); QVERIFY(rootItem != 0); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); QDeclarativeComponent substituteComponent(&engine); substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); - wv->setNewWindowComponent(&substituteComponent); - QCOMPARE(wv->newWindowComponent(), &substituteComponent); + wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); + QCOMPARE(wv->property("newWindowComponent"), QVariant::fromValue(&substituteComponent)); QCOMPARE(newWindowComponentSpy.count(),1); - wv->setNewWindowComponent(&substituteComponent); + wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); QCOMPARE(newWindowComponentSpy.count(),1); - wv->setNewWindowComponent(0); + wv->setProperty("newWindowComponent", QVariant::fromValue((QDeclarativeComponent*)0)); QCOMPARE(newWindowComponentSpy.count(),2); } @@ -466,22 +472,22 @@ void tst_qdeclarativewebview::renderingEnabled() QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); checkNoErrors(component); QDeclarativeItem *rootItem = qobject_cast(component.create()); - QDeclarativeWebView *wv = rootItem->findChild("webView"); + QObject *wv = rootItem->findChild("webView"); QVERIFY(rootItem != 0); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QVERIFY(wv->renderingEnabled()); + QVERIFY(wv->property("renderingEnabled").toBool()); QSignalSpy renderingEnabledSpy(wv, SIGNAL(renderingEnabledChanged())); - wv->setRenderingEnabled(false); - QVERIFY(!wv->renderingEnabled()); + wv->setProperty("renderingEnabled", false); + QVERIFY(!wv->property("renderingEnabled").toBool()); QCOMPARE(renderingEnabledSpy.count(),1); - wv->setRenderingEnabled(false); + wv->setProperty("renderingEnabled", false); QCOMPARE(renderingEnabledSpy.count(),1); - wv->setRenderingEnabled(true); + wv->setProperty("renderingEnabled", true); QCOMPARE(renderingEnabledSpy.count(),2); } @@ -490,21 +496,21 @@ void tst_qdeclarativewebview::pressGrabTime() QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); checkNoErrors(component); QDeclarativeItem *rootItem = qobject_cast(component.create()); - QDeclarativeWebView *wv = rootItem->findChild("webView"); + QObject *wv = rootItem->findChild("webView"); QVERIFY(rootItem != 0); QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->pressGrabTime(), 200); + QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + QCOMPARE(wv->property("pressGrabTime").toInt(), 200); QSignalSpy pressGrabTimeSpy(wv, SIGNAL(pressGrabTimeChanged())); - wv->setPressGrabTime(100); - QCOMPARE(wv->pressGrabTime(), 100); + wv->setProperty("pressGrabTime", 100); + QCOMPARE(wv->property("pressGrabTime").toInt(), 100); QCOMPARE(pressGrabTimeSpy.count(),1); - wv->setPressGrabTime(100); + wv->setProperty("pressGrabTime", 100); QCOMPARE(pressGrabTimeSpy.count(),1); - wv->setPressGrabTime(0); + wv->setProperty("pressGrabTime", 0); QCOMPARE(pressGrabTimeSpy.count(),2); } diff --git a/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml b/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml index 74c6844..3c00ee6 100644 --- a/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml +++ b/tests/auto/declarative/visual/qfxwebview/autosize/autosize.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 // The WebView size is determined by the width, height, // preferredWidth, and preferredHeight properties. diff --git a/tests/auto/declarative/visual/webview/embedding/nesting.qml b/tests/auto/declarative/visual/webview/embedding/nesting.qml index 0d76579..5e35306 100644 --- a/tests/auto/declarative/visual/webview/embedding/nesting.qml +++ b/tests/auto/declarative/visual/webview/embedding/nesting.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { width: 300 diff --git a/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml b/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml index 78d5cfc..6c01382 100644 --- a/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml +++ b/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Column { WebView { diff --git a/tests/auto/declarative/visual/webview/javascript/windowObjects.qml b/tests/auto/declarative/visual/webview/javascript/windowObjects.qml index a41de9a..8c52aff 100644 --- a/tests/auto/declarative/visual/webview/javascript/windowObjects.qml +++ b/tests/auto/declarative/visual/webview/javascript/windowObjects.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Column { WebView { diff --git a/tests/auto/declarative/visual/webview/settings/fontFamily.qml b/tests/auto/declarative/visual/webview/settings/fontFamily.qml index 2bb2a53..f547b0e 100644 --- a/tests/auto/declarative/visual/webview/settings/fontFamily.qml +++ b/tests/auto/declarative/visual/webview/settings/fontFamily.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { id: web diff --git a/tests/auto/declarative/visual/webview/settings/fontSize.qml b/tests/auto/declarative/visual/webview/settings/fontSize.qml index b970783..7eaa96b 100644 --- a/tests/auto/declarative/visual/webview/settings/fontSize.qml +++ b/tests/auto/declarative/visual/webview/settings/fontSize.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Grid { columns: 3 diff --git a/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml b/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml index 72e672d..67f1633 100644 --- a/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml +++ b/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Grid { columns: 2 diff --git a/tests/auto/declarative/visual/webview/settings/setFontFamily.qml b/tests/auto/declarative/visual/webview/settings/setFontFamily.qml index 26deed8..823469f 100644 --- a/tests/auto/declarative/visual/webview/settings/setFontFamily.qml +++ b/tests/auto/declarative/visual/webview/settings/setFontFamily.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { url: "test.html" diff --git a/tests/auto/declarative/visual/webview/zooming/pageWidth.qml b/tests/auto/declarative/visual/webview/zooming/pageWidth.qml index 86dd7d2..4a876dd 100644 --- a/tests/auto/declarative/visual/webview/zooming/pageWidth.qml +++ b/tests/auto/declarative/visual/webview/zooming/pageWidth.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { width: 200 diff --git a/tests/auto/declarative/visual/webview/zooming/renderControl.qml b/tests/auto/declarative/visual/webview/zooming/renderControl.qml index 0c8bb3b..49eb91b 100644 --- a/tests/auto/declarative/visual/webview/zooming/renderControl.qml +++ b/tests/auto/declarative/visual/webview/zooming/renderControl.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Rectangle { width: 200 diff --git a/tests/auto/declarative/visual/webview/zooming/resolution.qml b/tests/auto/declarative/visual/webview/zooming/resolution.qml index a9d4e3a..8542768 100644 --- a/tests/auto/declarative/visual/webview/zooming/resolution.qml +++ b/tests/auto/declarative/visual/webview/zooming/resolution.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { width: 200 * zoomFactor diff --git a/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml b/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml index 4455b43..c2e9348 100644 --- a/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml +++ b/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 WebView { width: 200 diff --git a/tests/auto/declarative/visual/webview/zooming/zooming.qml b/tests/auto/declarative/visual/webview/zooming/zooming.qml index 0ea9131..9f0b865 100644 --- a/tests/auto/declarative/visual/webview/zooming/zooming.qml +++ b/tests/auto/declarative/visual/webview/zooming/zooming.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 // Note that zooming is better done using zoomFactor and careful // control of rendering to avoid excessive re-rendering during -- cgit v0.12 From fd7d730d04862095898773a781bb9a254d0aeb00 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 2 Mar 2010 15:56:53 +1000 Subject: doc --- src/declarative/QmlChanges.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 34e4834..c312abf 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -12,6 +12,7 @@ Connection: syntax and rename: Connection { sender: a; signal: bar(); script: yyy } becomes: Connections { target: a; onFoo: xxx; onBar: yyy } +Using WebView now requires "import org.webkit 1.0" QmlView ------- -- cgit v0.12 From 1e4258c6098a87342b61935f1ad25102ce699af1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 2 Mar 2010 16:27:06 +1000 Subject: Fix zooming (broke with transformOrigin default change). Task-number: QTBUG-5845 --- demos/declarative/webbrowser/content/FlickableWebView.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index cf4c825..30a5d78 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -23,6 +23,7 @@ Flickable { WebView { id: webView pixelCacheSize: 4000000 + transformOrigin: Item.TopLeft Script { function fixUrl(url) -- cgit v0.12 From 56d32b57814cb35409bc9b0076ec753de488ae7f Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 16 Feb 2010 09:38:23 +0100 Subject: Move qegl_p.h -> qeglcontext_p.h and add a new qegl_p.h This puts the QEgl namespace in a single file which can be used by both qeglcontext and qeglproperties. Files which need QEglContext should now include qeglcontext_p.h. Reviewed-By: Aleksandar Sasha Babic --- src/gui/egl/egl.pri | 1 + src/gui/egl/qegl.cpp | 3 + src/gui/egl/qegl_p.h | 108 +++++++++++------------------ src/gui/egl/qegl_qws.cpp | 2 + src/gui/egl/qegl_symbian.cpp | 2 + src/gui/egl/qegl_wince.cpp | 2 + src/gui/egl/qegl_x11.cpp | 3 +- src/gui/egl/qeglcontext_p.h | 130 +++++++++++++++++++++++++++++++++++ src/gui/egl/qeglproperties.cpp | 3 +- src/gui/egl/qeglproperties_p.h | 42 +---------- src/opengl/qgl_egl_p.h | 3 +- src/opengl/qgl_wince.cpp | 3 +- src/opengl/qpixmapdata_x11gl_egl.cpp | 1 + src/opengl/qwindowsurface_gl.cpp | 2 +- src/openvg/qpaintengine_vg.cpp | 2 +- src/openvg/qvg_p.h | 2 +- src/openvg/qwindowsurface_vg.cpp | 2 +- src/openvg/qwindowsurface_vgegl_p.h | 2 +- 18 files changed, 196 insertions(+), 117 deletions(-) create mode 100644 src/gui/egl/qeglcontext_p.h diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 669d311..b90b9b0 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -2,6 +2,7 @@ CONFIG += egl HEADERS += \ egl/qegl_p.h \ + egl/qeglcontext_p.h \ egl/qeglproperties_p.h SOURCES += \ diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 0ed95ea..5052dfc 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -43,7 +43,10 @@ #include #include #include + #include "qegl_p.h" +#include "qeglcontext_p.h" + QT_BEGIN_NAMESPACE diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 87ed818..eb83002 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -53,13 +53,34 @@ // We mean it. // -#include -#include +QT_BEGIN_INCLUDE_NAMESPACE -#include +#if defined(QT_GLES_EGL) +#include +#else +#include +#endif -QT_BEGIN_INCLUDE_NAMESPACE +#if defined(Q_WS_X11) +// If included , then the global namespace +// may have been polluted with X #define's. The following makes sure +// the X11 headers were included properly and then cleans things up. +#include +#include +#undef Bool +#undef Status +#undef None +#undef KeyPress +#undef KeyRelease +#undef FocusIn +#undef FocusOut +#undef Type +#undef FontChange +#undef CursorShape +#endif +// Internally we use the EGL-prefixed native types which are used in EGL >= 1.3. +// For older versions of EGL, we have to define these types ourselves here: #if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED) #undef EGLNativeWindowType #undef EGLNativePixmapType @@ -69,74 +90,27 @@ typedef NativePixmapType EGLNativePixmapType; typedef NativeDisplayType EGLNativeDisplayType; #define QEGL_NATIVE_TYPES_DEFINED 1 #endif -QT_END_INCLUDE_NAMESPACE - -QT_BEGIN_NAMESPACE - -class Q_GUI_EXPORT QEglContext -{ -public: - QEglContext(); - ~QEglContext(); - - bool isValid() const; - bool isCurrent() const; - bool isSharing() const { return sharing; } - - QEgl::API api() const { return apiType; } - void setApi(QEgl::API api) { apiType = api; } - - bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); - bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0); - void destroyContext(); - EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0); - void destroySurface(EGLSurface surface); - - bool makeCurrent(EGLSurface surface); - bool doneCurrent(); - bool lazyDoneCurrent(); - bool swapBuffers(EGLSurface surface); - void waitNative(); - void waitClient(); - - bool configAttrib(int name, EGLint *value) const; - - static void clearError() { eglGetError(); } - static EGLint error() { return eglGetError(); } - static QString errorString(EGLint code); - - static EGLDisplay display(); - - EGLContext context() const { return ctx; } - void setContext(EGLContext context) { ctx = context; ownsContext = false;} - - EGLConfig config() const { return cfg; } - void setConfig(EGLConfig config) { cfg = config; } - - QEglProperties configProperties(EGLConfig cfg = 0) const; - - void dumpAllConfigs(); - - static QString extensions(); - static bool hasExtension(const char* extensionName); +QT_END_INCLUDE_NAMESPACE -private: - QEgl::API apiType; - EGLContext ctx; - EGLConfig cfg; - EGLSurface currentSurface; - bool current; - bool ownsContext; - bool sharing; - static EGLDisplay dpy; - static EGLNativeDisplayType nativeDisplay(); +QT_BEGIN_NAMESPACE - static QEglContext *currentContext(QEgl::API api); - static void setCurrentContext(QEgl::API api, QEglContext *context); +namespace QEgl { + enum API + { + OpenGL, + OpenVG + }; + + enum PixelFormatMatch + { + ExactPixelFormat, + BestPixelFormat + }; }; + QT_END_NAMESPACE -#endif // QEGL_P_H +#endif //QEGL_P_H diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp index 2a61beb..a40c236 100644 --- a/src/gui/egl/qegl_qws.cpp +++ b/src/gui/egl/qegl_qws.cpp @@ -42,7 +42,9 @@ #include #include #include + #include "qegl_p.h" +#include "qeglcontext_p.h" #if !defined(QT_NO_EGL) diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp index 5a010cd..0c91fd8 100644 --- a/src/gui/egl/qegl_symbian.cpp +++ b/src/gui/egl/qegl_symbian.cpp @@ -42,7 +42,9 @@ #include #include #include + #include "qegl_p.h" +#include "qeglcontext_p.h" #include diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index c9c9773..00341ba 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -42,7 +42,9 @@ #include #include #include + #include "qegl_p.h" +#include "qeglcontext_p.h" #include diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 634ff13..cd55849 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -49,8 +49,9 @@ #include #include #include -#include "qegl_p.h" +#include "qegl_p.h" +#include "qeglcontext_p.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h new file mode 100644 index 0000000..3857fb7 --- /dev/null +++ b/src/gui/egl/qeglcontext_p.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEGLCONTEXT_P_H +#define QEGLCONTEXT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience of +// the QtOpenGL and QtOpenVG modules. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_GUI_EXPORT QEglContext +{ +public: + QEglContext(); + ~QEglContext(); + + bool isValid() const; + bool isCurrent() const; + bool isSharing() const { return sharing; } + + QEgl::API api() const { return apiType; } + void setApi(QEgl::API api) { apiType = api; } + + bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); + bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0); + void destroyContext(); + EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0); + void destroySurface(EGLSurface surface); + + bool makeCurrent(EGLSurface surface); + bool doneCurrent(); + bool lazyDoneCurrent(); + bool swapBuffers(EGLSurface surface); + + void waitNative(); + void waitClient(); + + bool configAttrib(int name, EGLint *value) const; + + static void clearError() { eglGetError(); } + static EGLint error() { return eglGetError(); } + static QString errorString(EGLint code); + + static EGLDisplay display(); + + EGLContext context() const { return ctx; } + void setContext(EGLContext context) { ctx = context; ownsContext = false;} + + EGLConfig config() const { return cfg; } + void setConfig(EGLConfig config) { cfg = config; } + + QEglProperties configProperties(EGLConfig cfg = 0) const; + + void dumpAllConfigs(); + + static QString extensions(); + static bool hasExtension(const char* extensionName); + +private: + QEgl::API apiType; + EGLContext ctx; + EGLConfig cfg; + EGLSurface currentSurface; + bool current; + bool ownsContext; + bool sharing; + + static EGLDisplay dpy; + static EGLNativeDisplayType nativeDisplay(); + + static QEglContext *currentContext(QEgl::API api); + static void setCurrentContext(QEgl::API api, QEglContext *context); +}; + +QT_END_NAMESPACE + +#endif // QEGLCONTEXT_P_H diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index 236ec37..b83ae4e 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -46,7 +46,8 @@ QT_BEGIN_NAMESPACE #include #include -#include "qegl_p.h" +#include "qeglproperties_p.h" +#include "qeglcontext_p.h" // Initialize a property block. diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h index feed1d2..496847b 100644 --- a/src/gui/egl/qeglproperties_p.h +++ b/src/gui/egl/qeglproperties_p.h @@ -56,50 +56,10 @@ #include #include -QT_BEGIN_INCLUDE_NAMESPACE - -#if defined(QT_GLES_EGL) -#include -#else -#include -#endif - -#if defined(Q_WS_X11) -// If included , then the global namespace -// may have been polluted with X #define's. The following makes sure -// the X11 headers were included properly and then cleans things up. -#include -#include -#undef Bool -#undef Status -#undef None -#undef KeyPress -#undef KeyRelease -#undef FocusIn -#undef FocusOut -#undef Type -#undef FontChange -#undef CursorShape -#endif - -QT_END_INCLUDE_NAMESPACE +#include QT_BEGIN_NAMESPACE -namespace QEgl { - enum API - { - OpenGL, - OpenVG - }; - - enum PixelFormatMatch - { - ExactPixelFormat, - BestPixelFormat - }; -}; - class QX11Info; class QPaintDevice; diff --git a/src/opengl/qgl_egl_p.h b/src/opengl/qgl_egl_p.h index c503724..518b500 100644 --- a/src/opengl/qgl_egl_p.h +++ b/src/opengl/qgl_egl_p.h @@ -53,7 +53,8 @@ // We mean it. // -#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index f81115c..2b71201 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -54,7 +54,8 @@ #include -#include +#include +#include #include #include diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp index 6a1d030..4f1543c 100644 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ b/src/opengl/qpixmapdata_x11gl_egl.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #if !defined(QT_OPENGL_ES_1) #include diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 4ac4a3a..0334cbc 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -83,7 +83,7 @@ #endif #ifdef QT_OPENGL_ES -#include +#include #endif QT_BEGIN_NAMESPACE diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 35f552e..47ce11c 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -45,7 +45,7 @@ #include "qvgcompositionhelper_p.h" #include "qvgimagepool_p.h" #if !defined(QT_NO_EGL) -#include +#include #include "qwindowsurface_vgegl_p.h" #endif #include diff --git a/src/openvg/qvg_p.h b/src/openvg/qvg_p.h index 7857bb6..51abbee 100644 --- a/src/openvg/qvg_p.h +++ b/src/openvg/qvg_p.h @@ -58,7 +58,7 @@ #include #if !defined(QT_NO_EGL) -#include +#include #endif QT_BEGIN_NAMESPACE diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 83b0764..07d9209 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -47,7 +47,7 @@ #if !defined(QT_NO_EGL) -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h index aa0c648..f6adbf3 100644 --- a/src/openvg/qwindowsurface_vgegl_p.h +++ b/src/openvg/qwindowsurface_vgegl_p.h @@ -58,7 +58,7 @@ #if !defined(QT_NO_EGL) -#include +#include QT_BEGIN_NAMESPACE -- cgit v0.12 From 28b85c76dd0ba4796ec519b890f6fab0fc813061 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 16 Feb 2010 13:29:36 +0100 Subject: Move static methods from QEglContext to QEgl namespace Reviewed-By: Aleksandar Sasha Babic --- src/gui/egl/qegl.cpp | 83 +++++++++++++++++++----------------- src/gui/egl/qegl_p.h | 18 ++++++++ src/gui/egl/qegl_wince.cpp | 6 +-- src/gui/egl/qegl_x11.cpp | 8 ++-- src/gui/egl/qeglcontext_p.h | 18 ++------ src/gui/egl/qeglproperties.cpp | 6 +-- src/opengl/qgl_egl.cpp | 2 +- src/opengl/qgl_x11egl.cpp | 20 ++++----- src/opengl/qglpixelbuffer_egl.cpp | 4 +- src/opengl/qpixmapdata_x11gl_egl.cpp | 20 ++++----- 10 files changed, 97 insertions(+), 88 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 5052dfc..ef5eb67 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -57,8 +57,6 @@ QT_BEGIN_NAMESPACE static QEglContext * volatile currentGLContext = 0; static QEglContext * volatile currentVGContext = 0; -EGLDisplay QEglContext::dpy = EGL_NO_DISPLAY; - QEglContext::QEglContext() : apiType(QEgl::OpenGL) , ctx(EGL_NO_CONTEXT) @@ -98,7 +96,8 @@ bool QEglContext::chooseConfig do { // Get the number of matching configurations for this set of properties. EGLint matching = 0; - if (!eglChooseConfig(display(), props.properties(), 0, 0, &matching) || !matching) + EGLDisplay dpy = QEgl::display(); + if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching) continue; // If we want the best pixel format, then return the first @@ -145,7 +144,7 @@ bool QEglContext::chooseConfig qWarning() << "QEglContext::chooseConfig(): Could not find a suitable EGL configuration"; qWarning() << "Requested:" << props.toString(); qWarning() << "Available:"; - dumpAllConfigs(); + QEgl::dumpAllConfigs(); } return false; } @@ -175,9 +174,9 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties if (shareContext && shareContext->ctx == EGL_NO_CONTEXT) shareContext = 0; if (shareContext) { - ctx = eglCreateContext(display(), cfg, shareContext->ctx, contextProps.properties()); + ctx = eglCreateContext(QEgl::display(), cfg, shareContext->ctx, contextProps.properties()); if (ctx == EGL_NO_CONTEXT) { - qWarning() << "QEglContext::createContext(): Could not share context:" << errorString(eglGetError()); + qWarning() << "QEglContext::createContext(): Could not share context:" << QEgl::errorString(); shareContext = 0; } else { sharing = true; @@ -186,7 +185,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties if (ctx == EGL_NO_CONTEXT) { ctx = eglCreateContext(display(), cfg, 0, contextProps.properties()); if (ctx == EGL_NO_CONTEXT) { - qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << errorString(eglGetError()); + qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << QEgl::errorString(); return false; } } @@ -243,9 +242,9 @@ bool QEglContext::makeCurrent(EGLSurface surface) eglBindAPI(EGL_OPENVG_API); #endif - bool ok = eglMakeCurrent(display(), surface, surface, ctx); + bool ok = eglMakeCurrent(QEgl::display(), surface, surface, ctx); if (!ok) - qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError()); + qWarning() << "QEglContext::makeCurrent():" << QEgl::errorString(); return ok; } @@ -272,9 +271,9 @@ bool QEglContext::doneCurrent() eglBindAPI(EGL_OPENVG_API); #endif - bool ok = eglMakeCurrent(display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + bool ok = eglMakeCurrent(QEgl::display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (!ok) - qWarning() << "QEglContext::doneCurrent():" << errorString(eglGetError()); + qWarning() << "QEglContext::doneCurrent():" << QEgl::errorString(); return ok; } @@ -294,9 +293,9 @@ bool QEglContext::swapBuffers(EGLSurface surface) if(ctx == EGL_NO_CONTEXT) return false; - bool ok = eglSwapBuffers(display(), surface); + bool ok = eglSwapBuffers(QEgl::display(), surface); if (!ok) - qWarning() << "QEglContext::swapBuffers():" << errorString(eglGetError()); + qWarning() << "QEglContext::swapBuffers():" << QEgl::errorString(); return ok; } @@ -333,43 +332,33 @@ void QEglContext::waitClient() // Query the value of a configuration attribute. bool QEglContext::configAttrib(int name, EGLint *value) const { - return eglGetConfigAttrib(display(), cfg, name, value); + return eglGetConfigAttrib(QEgl::display(), cfg, name, value); } -// Retrieve all of the properties on "cfg". If zero, return -// the context's configuration. -QEglProperties QEglContext::configProperties(EGLConfig cfg) const +QEglProperties QEglContext::configProperties() const { - if (!cfg) - cfg = config(); - QEglProperties props; - for (int name = 0x3020; name <= 0x304F; ++name) { - EGLint value; - if (name != EGL_NONE && eglGetConfigAttrib(display(), cfg, name, &value)) - props.setValue(name, value); - } - eglGetError(); // Clear the error state. - return props; + return QEglProperties(config()); } -EGLDisplay QEglContext::display() +EGLDisplay QEgl::display() { + static EGLDisplay dpy = EGL_NO_DISPLAY; static bool openedDisplay = false; if (!openedDisplay) { dpy = eglGetDisplay(nativeDisplay()); openedDisplay = true; if (dpy == EGL_NO_DISPLAY) { - qWarning("QEglContext::display(): Falling back to EGL_DEFAULT_DISPLAY"); + qWarning("QEgl::display(): Falling back to EGL_DEFAULT_DISPLAY"); dpy = eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); } if (dpy == EGL_NO_DISPLAY) { - qWarning("QEglContext::display(): Can't even open the default display"); + qWarning("QEgl::display(): Can't even open the default display"); return EGL_NO_DISPLAY; } if (!eglInitialize(dpy, NULL, NULL)) { - qWarning() << "QEglContext::display(): Cannot initialize EGL display:" << errorString(eglGetError()); + qWarning() << "QEgl::display(): Cannot initialize EGL display:" << QEgl::errorString(); return EGL_NO_DISPLAY; } } @@ -378,14 +367,14 @@ EGLDisplay QEglContext::display() } #if !defined(Q_WS_X11) && !defined(Q_WS_WINCE) // WinCE & X11 implement this properly -EGLNativeDisplayType QEglContext::nativeDisplay() +EGLNativeDisplayType QEgl::nativeDisplay() { return EGL_DEFAULT_DISPLAY; } #endif // Return the error string associated with a specific code. -QString QEglContext::errorString(EGLint code) +QString QEgl::errorString(EGLint code) { static const char * const errors[] = { "Success (0x3000)", // No tr @@ -411,8 +400,24 @@ QString QEglContext::errorString(EGLint code) } } +QString QEgl::errorString() +{ + return errorString(error()); +} + +void QEgl::clearError() +{ + eglGetError(); +} + +EGLint QEgl::error() +{ + return eglGetError(); +} + + // Dump all of the EGL configurations supported by the system. -void QEglContext::dumpAllConfigs() +void QEgl::dumpAllConfigs() { QEglProperties props; EGLint count = 0; @@ -421,23 +426,23 @@ void QEglContext::dumpAllConfigs() EGLConfig *configs = new EGLConfig [count]; eglGetConfigs(display(), configs, count, &count); for (EGLint index = 0; index < count; ++index) { - props = configProperties(configs[index]); + props = QEglProperties(configs[index]); qWarning() << props.toString(); } delete [] configs; } -QString QEglContext::extensions() +QString QEgl::extensions() { - const char* exts = eglQueryString(QEglContext::display(), EGL_EXTENSIONS); + const char* exts = eglQueryString(QEgl::display(), EGL_EXTENSIONS); return QString(QLatin1String(exts)); } -bool QEglContext::hasExtension(const char* extensionName) +bool QEgl::hasExtension(const char* extensionName) { QList extensions = QByteArray(reinterpret_cast - (eglQueryString(QEglContext::display(), EGL_EXTENSIONS))).split(' '); + (eglQueryString(QEgl::display(), EGL_EXTENSIONS))).split(' '); return extensions.contains(extensionName); } diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index eb83002..e48e4a0 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -96,6 +96,8 @@ QT_END_INCLUDE_NAMESPACE QT_BEGIN_NAMESPACE +class QEglProperties; + namespace QEgl { enum API { @@ -108,6 +110,22 @@ namespace QEgl { ExactPixelFormat, BestPixelFormat }; + +// EGLConfig chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); +// EGLSurface createSurface(QPaintDevice *device, EGLConfig config, const QEglProperties *properties = 0); + + Q_GUI_EXPORT void dumpAllConfigs(); + + Q_GUI_EXPORT void clearError(); + Q_GUI_EXPORT EGLint error(); + Q_GUI_EXPORT QString errorString(EGLint code); + Q_GUI_EXPORT QString errorString(); + + Q_GUI_EXPORT QString extensions(); + Q_GUI_EXPORT bool hasExtension(const char* extensionName); + + Q_GUI_EXPORT EGLDisplay display(); + Q_GUI_EXPORT EGLNativeDisplayType nativeDisplay(); }; diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index 00341ba..2f79005 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -80,16 +80,16 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties props = 0; EGLSurface surf; if (devType == QInternal::Widget) - surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, props); + surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); else - surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, props); + surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props); if (surf == EGL_NO_SURFACE) { qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); } return surf; } -EGLNativeDisplayType QEglContext::nativeDisplay() +EGLNativeDisplayType QEgl::nativeDisplay() { HWND win = (static_cast(device))->winId(); HDC myDc = GetDC(win); diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index cd55849..4a813c6 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -84,17 +84,17 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties props = 0; EGLSurface surf; if (devType == QInternal::Widget) - surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, props); + surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); else - surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, props); + surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props); if (surf == EGL_NO_SURFACE) { qWarning() << "QEglContext::createSurface(): Unable to create EGL surface:" - << errorString(eglGetError()); + << QEgl::errorString(); } return surf; } -EGLNativeDisplayType QEglContext::nativeDisplay() +EGLNativeDisplayType QEgl::nativeDisplay() { Display *xdpy = QX11Info::display(); if (!xdpy) { diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h index 3857fb7..c656d1d 100644 --- a/src/gui/egl/qeglcontext_p.h +++ b/src/gui/egl/qeglcontext_p.h @@ -90,24 +90,15 @@ public: bool configAttrib(int name, EGLint *value) const; - static void clearError() { eglGetError(); } - static EGLint error() { return eglGetError(); } - static QString errorString(EGLint code); - - static EGLDisplay display(); - EGLContext context() const { return ctx; } void setContext(EGLContext context) { ctx = context; ownsContext = false;} + EGLDisplay display() {return QEgl::display();} + EGLConfig config() const { return cfg; } void setConfig(EGLConfig config) { cfg = config; } - QEglProperties configProperties(EGLConfig cfg = 0) const; - - void dumpAllConfigs(); - - static QString extensions(); - static bool hasExtension(const char* extensionName); + QEglProperties configProperties() const; private: QEgl::API apiType; @@ -118,9 +109,6 @@ private: bool ownsContext; bool sharing; - static EGLDisplay dpy; - static EGLNativeDisplayType nativeDisplay(); - static QEglContext *currentContext(QEgl::API api); static void setCurrentContext(QEgl::API api, QEglContext *context); }; diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index b83ae4e..86e158b 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -61,7 +61,7 @@ QEglProperties::QEglProperties(EGLConfig cfg) props.append(EGL_NONE); for (int name = 0x3020; name <= 0x304F; ++name) { EGLint value; - if (name != EGL_NONE && eglGetConfigAttrib(QEglContext::display(), cfg, name, &value)) + if (name != EGL_NONE && eglGetConfigAttrib(QEgl::display(), cfg, name, &value)) setValue(name, value); } eglGetError(); // Clear the error state. @@ -274,12 +274,12 @@ static void addTag(QString& str, const QString& tag) void QEglProperties::dumpAllConfigs() { EGLint count = 0; - eglGetConfigs(QEglContext::display(), 0, 0, &count); + eglGetConfigs(QEgl::display(), 0, 0, &count); if (count < 1) return; EGLConfig *configs = new EGLConfig [count]; - eglGetConfigs(QEglContext::display(), configs, count, &count); + eglGetConfigs(QEgl::display(), configs, count, &count); for (EGLint index = 0; index < count; ++index) qWarning() << QEglProperties(configs[index]).toString(); delete [] configs; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 3addea1..90fb2bb 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -126,7 +126,7 @@ void qt_egl_update_format(const QEglContext& context, QGLFormat& format) // Clear the EGL error state because some of the above may // have errored out because the attribute is not applicable // to the surface type. Such errors don't matter. - context.clearError(); + QEgl::clearError(); } bool QGLFormat::hasOpenGL() diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 3d183ee..972a5f6 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -609,7 +609,7 @@ EGLConfig Q_OPENGL_EXPORT qt_chooseEGLConfigForPixmap(bool hasAlpha, bool readOn EGLint configCount = 0; do { - eglChooseConfig(QEglContext::display(), configAttribs.properties(), targetConfig, 1, &configCount); + eglChooseConfig(QEgl::display(), configAttribs.properties(), targetConfig, 1, &configCount); if (configCount > 0) { // Got one qDebug() << "Found an" << (hasAlpha ? "ARGB" : "RGB") << (readOnly ? "readonly" : "target" ) @@ -648,7 +648,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl pixmapAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB); EGLSurface pixmapSurface; - pixmapSurface = eglCreatePixmapSurface(QEglContext::display(), + pixmapSurface = eglCreatePixmapSurface(QEgl::display(), pixmapConfig, (EGLNativePixmapType) pixmapData->handle(), pixmapAttribs.properties()); @@ -656,7 +656,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl // pixmapSurface, pixmapData->handle()); if (pixmapSurface == EGL_NO_SURFACE) { qWarning() << "Failed to create a pixmap surface using config" << (int)pixmapConfig - << ":" << QEglContext::errorString(eglGetError()); + << ":" << QEgl::errorString(); return false; } @@ -693,8 +693,8 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons if (!checkedForTFP) { // Check for texture_from_pixmap egl extension checkedForTFP = true; - if (eglContext->hasExtension("EGL_NOKIA_texture_from_pixmap") || - eglContext->hasExtension("EGL_EXT_texture_from_pixmap")) + if (QEgl::hasExtension("EGL_NOKIA_texture_from_pixmap") || + QEgl::hasExtension("EGL_EXT_texture_from_pixmap")) { qDebug("Found texture_from_pixmap EGL extension!"); haveTFP = true; @@ -734,7 +734,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons EGLBoolean success; success = eglBindTexImage(eglContext->display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { - qWarning() << "eglBindTexImage() failed:" << eglContext->errorString(eglGetError()); + qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); eglDestroySurface(eglContext->display(), (EGLSurface)pixmapData->gl_surface); pixmapData->gl_surface = (Qt::HANDLE)EGL_NO_SURFACE; haveTFP = false; @@ -757,10 +757,10 @@ void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd) QX11PixmapData *pixmapData = static_cast(pmd); if (pixmapData->gl_surface) { EGLBoolean success; - success = eglDestroySurface(QEglContext::display(), (EGLSurface)pixmapData->gl_surface); + success = eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); if (success == EGL_FALSE) { qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: " - << QEglContext::errorString(eglGetError()); + << QEgl::errorString(); } pixmapData->gl_surface = 0; } @@ -772,12 +772,12 @@ void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) QX11PixmapData *pixmapData = static_cast(pmd); if (pixmapData->gl_surface) { EGLBoolean success; - success = eglReleaseTexImage(QEglContext::display(), + success = eglReleaseTexImage(QEgl::display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { qWarning() << "unbindPixmapFromTexture() - Unable to release bound texture: " - << QEglContext::errorString(eglGetError()); + << QEgl::errorString(); } } } diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index 954049d..cee5a1f 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -137,7 +137,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge } #endif if (pbuf == EGL_NO_SURFACE) { - qWarning() << "QGLPixelBufferPrivate::init(): Unable to create EGL pbuffer surface:" << QEglContext::errorString(eglGetError()); + qWarning() << "QGLPixelBufferPrivate::init(): Unable to create EGL pbuffer surface:" << QEgl::errorString(); return false; } @@ -204,7 +204,7 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const bool QGLPixelBuffer::hasOpenGLPbuffers() { // See if we have at least 1 configuration that matches the default format. - EGLDisplay dpy = QEglContext::display(); + EGLDisplay dpy = QEgl::display(); if (dpy == EGL_NO_DISPLAY) return false; QEglProperties configProps; diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp index 4f1543c..811e554 100644 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ b/src/opengl/qpixmapdata_x11gl_egl.cpp @@ -97,14 +97,14 @@ bool QX11GLPixmapData::hasX11GLPixmaps() #endif EGL_NONE }; - qPixmapARGBSharedEglContext = eglCreateContext(QEglContext::display(), + qPixmapARGBSharedEglContext = eglCreateContext(QEgl::display(), argbConfig, 0, contextAttribs); if (argbConfig == rgbConfig) { // If the configs are the same, we can re-use the same context. qPixmapRGBSharedEglContext = qPixmapARGBSharedEglContext; } else { - qPixmapRGBSharedEglContext = eglCreateContext(QEglContext::display(), + qPixmapRGBSharedEglContext = eglCreateContext(QEgl::display(), rgbConfig, 0, contextAttribs); } @@ -115,13 +115,12 @@ bool QX11GLPixmapData::hasX11GLPixmaps() if (!qt_createEGLSurfaceForPixmap(argbPixmapData, false)) break; - haveX11Pixmaps = eglMakeCurrent(QEglContext::display(), + haveX11Pixmaps = eglMakeCurrent(QEgl::display(), (EGLSurface)argbPixmapData->gl_surface, (EGLSurface)argbPixmapData->gl_surface, qPixmapARGBSharedEglContext); if (!haveX11Pixmaps) { - EGLint err = eglGetError(); - qWarning() << "Unable to make pixmap config current:" << err << QEglContext::errorString(err); + qWarning() << "Unable to make pixmap config current:" << QEgl::errorString(); break; } @@ -135,20 +134,19 @@ bool QX11GLPixmapData::hasX11GLPixmaps() if (!qt_createEGLSurfaceForPixmap(rgbPixmapData, false)) break; - haveX11Pixmaps = eglMakeCurrent(QEglContext::display(), + haveX11Pixmaps = eglMakeCurrent(QEgl::display(), (EGLSurface)rgbPixmapData->gl_surface, (EGLSurface)rgbPixmapData->gl_surface, qPixmapRGBSharedEglContext); if (!haveX11Pixmaps) { - EGLint err = eglGetError(); - qWarning() << "Unable to make pixmap config current:" << err << QEglContext::errorString(err); + qWarning() << "Unable to make pixmap config current:" << QEgl::errorString(); break; } } } while (0); if (qPixmapARGBSharedEglContext || qPixmapRGBSharedEglContext) { - eglMakeCurrent(QEglContext::display(), + eglMakeCurrent(QEgl::display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } @@ -168,12 +166,12 @@ bool QX11GLPixmapData::hasX11GLPixmaps() if (!haveX11Pixmaps) { // Clean up the context(s) if we can't use X11GL pixmaps if (qPixmapARGBSharedEglContext != EGL_NO_CONTEXT) - eglDestroyContext(QEglContext::display(), qPixmapARGBSharedEglContext); + eglDestroyContext(QEgl::display(), qPixmapARGBSharedEglContext); if (qPixmapRGBSharedEglContext != qPixmapARGBSharedEglContext && qPixmapRGBSharedEglContext != EGL_NO_CONTEXT) { - eglDestroyContext(QEglContext::display(), qPixmapRGBSharedEglContext); + eglDestroyContext(QEgl::display(), qPixmapRGBSharedEglContext); } qPixmapRGBSharedEglContext = EGL_NO_CONTEXT; qPixmapARGBSharedEglContext = EGL_NO_CONTEXT; -- cgit v0.12 From 6378d3d0e851f6af3e518ff53351de3253368026 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 16 Feb 2010 16:15:04 +0100 Subject: Move chooseConfig and createSurface logic to QEgl functions We keep the methods in QEglContext, but these are useful helpers which wrap the QEgl version of the functions, which is where the bulk of the logic is (for these functions anyway). Reviewed-By: Aleksandar Sasha Babic --- src/gui/egl/qegl.cpp | 24 ++++++++++++++++++------ src/gui/egl/qegl_p.h | 7 +++++-- src/gui/egl/qegl_qws.cpp | 3 ++- src/gui/egl/qegl_symbian.cpp | 2 +- src/gui/egl/qegl_wince.cpp | 2 +- src/gui/egl/qegl_x11.cpp | 2 +- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index ef5eb67..6d719ba 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -89,10 +89,10 @@ bool QEglContext::isCurrent() const } // Choose a configuration that matches "properties". -bool QEglContext::chooseConfig - (const QEglProperties& properties, QEgl::PixelFormatMatch match) +EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match) { - QEglProperties props(properties); + QEglProperties props(*properties); + EGLConfig cfg = QEGL_NO_CONFIG; do { // Get the number of matching configurations for this set of properties. EGLint matching = 0; @@ -106,7 +106,7 @@ bool QEglContext::chooseConfig eglChooseConfig(display(), props.properties(), &cfg, 1, &matching); if (matching < 1) continue; - return true; + return cfg; } // Fetch all of the matching configurations and find the @@ -127,7 +127,7 @@ bool QEglContext::chooseConfig alpha == props.value(EGL_ALPHA_SIZE))) { cfg = configs[index]; delete [] configs; - return true; + return cfg; } } delete [] configs; @@ -146,9 +146,21 @@ bool QEglContext::chooseConfig qWarning() << "Available:"; QEgl::dumpAllConfigs(); } - return false; + return QEGL_NO_CONFIG; } +bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match) +{ + cfg = QEgl::chooseConfig(&properties, match); + return cfg != QEGL_NO_CONFIG; +} + +EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties) +{ + return QEgl::createSurface(device, cfg, properties); +} + + // Create the EGLContext. bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties) { diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index e48e4a0..a50e4e1 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -93,9 +93,12 @@ typedef NativeDisplayType EGLNativeDisplayType; QT_END_INCLUDE_NAMESPACE +#include QT_BEGIN_NAMESPACE +#define QEGL_NO_CONFIG ((EGLConfig)-1) + class QEglProperties; namespace QEgl { @@ -111,8 +114,8 @@ namespace QEgl { BestPixelFormat }; -// EGLConfig chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); -// EGLSurface createSurface(QPaintDevice *device, EGLConfig config, const QEglProperties *properties = 0); + Q_GUI_EXPORT EGLConfig chooseConfig(const QEglProperties* configAttribs, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); + Q_GUI_EXPORT EGLSurface createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *surfaceAttribs = 0); Q_GUI_EXPORT void dumpAllConfigs(); diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp index a40c236..935fe67 100644 --- a/src/gui/egl/qegl_qws.cpp +++ b/src/gui/egl/qegl_qws.cpp @@ -59,9 +59,10 @@ QT_BEGIN_NAMESPACE // We don't have QGLScreen to create EGL surfaces for us, // so surface creation needs to be done in QtOpenGL or // QtOpenVG for Qt/Embedded. -EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { Q_UNUSED(device); + Q_UNUSED(cfg); Q_UNUSED(properties); return EGL_NO_SURFACE; } diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp index 0c91fd8..2276ce0 100644 --- a/src/gui/egl/qegl_symbian.cpp +++ b/src/gui/egl/qegl_symbian.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { // Create the native drawable for the paint device. int devType = device->devType(); diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index 2f79005..fae491b 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE -EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { // Create the native drawable for the paint device. int devType = device->devType(); diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 4a813c6..d24727a 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE -EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { // Create the native drawable for the paint device. int devType = device->devType(); -- cgit v0.12 From d0a2d10dfac7be20af78988a3351d374acfdd208 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 16 Feb 2010 17:38:25 +0100 Subject: Make QEgl::createSurface cross-platform and add native getters QEgl::createSurface was virtually identical for every platform apart from the line which returned the native window type. This patch just adds QEgl::nativePixmap and QEgl::nativeWindow which are platform specific (though the default widget->winId() works for everything apart from symbian). Reviewed-By: Aleksandar Sasha Babic --- src/gui/egl/qegl.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++ src/gui/egl/qegl_p.h | 3 +++ src/gui/egl/qegl_qws.cpp | 12 ---------- src/gui/egl/qegl_symbian.cpp | 37 ++----------------------------- src/gui/egl/qegl_wince.cpp | 38 -------------------------------- src/gui/egl/qegl_x11.cpp | 38 -------------------------------- 6 files changed, 57 insertions(+), 123 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 6d719ba..ef30029 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -385,6 +385,58 @@ EGLNativeDisplayType QEgl::nativeDisplay() } #endif +#if !defined(Q_OS_SYMBIAN) +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) +{ + return (EGLNativeWindowType)(widget->winId()); +} +#endif + +EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) +{ + return (EGLNativePixmapType)(pixmap->handle()); +} + +EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) +{ + // Create the native drawable for the paint device. + int devType = device->devType(); + EGLNativePixmapType pixmapDrawable = 0; + EGLNativeWindowType windowDrawable = 0; + bool ok; + if (devType == QInternal::Pixmap) { + pixmapDrawable = nativePixmap(static_cast(device)); + ok = (pixmapDrawable != 0); + } else if (devType == QInternal::Widget) { + windowDrawable = nativeWindow(static_cast(device)); + ok = (windowDrawable != 0); + } else { + ok = false; + } + if (!ok) { + qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); + return EGL_NO_SURFACE; + } + + // Create the EGL surface to draw into, based on the native drawable. + const int *props; + if (properties) + props = properties->properties(); + else + props = 0; + EGLSurface surf; + if (devType == QInternal::Widget) + surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); + else + surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props); + if (surf == EGL_NO_SURFACE) { + qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); + } + return surf; +} + + + // Return the error string associated with a specific code. QString QEgl::errorString(EGLint code) { diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index a50e4e1..8a9d815 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -128,7 +128,10 @@ namespace QEgl { Q_GUI_EXPORT bool hasExtension(const char* extensionName); Q_GUI_EXPORT EGLDisplay display(); + Q_GUI_EXPORT EGLNativeDisplayType nativeDisplay(); + Q_GUI_EXPORT EGLNativeWindowType nativeWindow(QWidget*); + Q_GUI_EXPORT EGLNativePixmapType nativePixmap(QPixmap*); }; diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp index 935fe67..eb41bcc 100644 --- a/src/gui/egl/qegl_qws.cpp +++ b/src/gui/egl/qegl_qws.cpp @@ -55,18 +55,6 @@ QT_BEGIN_NAMESPACE -// Create the surface for a QPixmap, QImage, or QWidget. -// We don't have QGLScreen to create EGL surfaces for us, -// so surface creation needs to be done in QtOpenGL or -// QtOpenVG for Qt/Embedded. -EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) -{ - Q_UNUSED(device); - Q_UNUSED(cfg); - Q_UNUSED(properties); - return EGL_NO_SURFACE; -} - static QScreen *screenForDevice(QPaintDevice *device) { QScreen *screen = qt_screen; diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp index 2276ce0..8833b42 100644 --- a/src/gui/egl/qegl_symbian.cpp +++ b/src/gui/egl/qegl_symbian.cpp @@ -50,42 +50,9 @@ QT_BEGIN_NAMESPACE -EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) { - // Create the native drawable for the paint device. - int devType = device->devType(); - EGLNativePixmapType pixmapDrawable = 0; - EGLNativeWindowType windowDrawable = 0; - bool ok; - if (devType == QInternal::Pixmap) { - pixmapDrawable = 0; - ok = (pixmapDrawable != 0); - } else if (devType == QInternal::Widget) { - QWidget *w = static_cast(device); - windowDrawable = (EGLNativeWindowType)(w->winId()->DrawableWindow()); - ok = (windowDrawable != 0); - } else { - ok = false; - } - if (!ok) { - qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return EGL_NO_SURFACE; - } - - // Create the EGL surface to draw into, based on the native drawable. - const int *props; - if (properties) - props = properties->properties(); - else - props = 0; - EGLSurface surf; - if (devType == QInternal::Widget) - surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, props); - else - surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, props); - if (surf == EGL_NO_SURFACE) - qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); - return surf; + return (EGLNativeWindowType)(widget->winId()->DrawableWindow()); } // Set pixel format and other properties based on a paint device. diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index fae491b..b201153 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -51,44 +51,6 @@ QT_BEGIN_NAMESPACE -EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) -{ - // Create the native drawable for the paint device. - int devType = device->devType(); - EGLNativePixmapType pixmapDrawable = 0; - EGLNativeWindowType windowDrawable = 0; - bool ok; - if (devType == QInternal::Pixmap) { - pixmapDrawable = 0; - ok = (pixmapDrawable != 0); - } else if (devType == QInternal::Widget) { - windowDrawable = (EGLNativeWindowType)(static_cast(device))->winId(); - ok = (windowDrawable != 0); - } else { - ok = false; - } - if (!ok) { - qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return EGL_NO_SURFACE; - } - - // Create the EGL surface to draw into, based on the native drawable. - const int *props; - if (properties) - props = properties->properties(); - else - props = 0; - EGLSurface surf; - if (devType == QInternal::Widget) - surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); - else - surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props); - if (surf == EGL_NO_SURFACE) { - qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); - } - return surf; -} - EGLNativeDisplayType QEgl::nativeDisplay() { HWND win = (static_cast(device))->winId(); diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index d24727a..e8fb662 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -55,44 +55,6 @@ QT_BEGIN_NAMESPACE -EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) -{ - // Create the native drawable for the paint device. - int devType = device->devType(); - EGLNativePixmapType pixmapDrawable = 0; - EGLNativeWindowType windowDrawable = 0; - bool ok; - if (devType == QInternal::Pixmap) { - pixmapDrawable = (EGLNativePixmapType)(static_cast(device))->handle(); - ok = (pixmapDrawable != 0); - } else if (devType == QInternal::Widget) { - windowDrawable = (EGLNativeWindowType)(static_cast(device))->winId(); - ok = (windowDrawable != 0); - } else { - ok = false; - } - if (!ok) { - qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return EGL_NO_SURFACE; - } - - // Create the EGL surface to draw into, based on the native drawable. - const int *props; - if (properties) - props = properties->properties(); - else - props = 0; - EGLSurface surf; - if (devType == QInternal::Widget) - surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); - else - surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props); - if (surf == EGL_NO_SURFACE) { - qWarning() << "QEglContext::createSurface(): Unable to create EGL surface:" - << QEgl::errorString(); - } - return surf; -} EGLNativeDisplayType QEgl::nativeDisplay() { -- cgit v0.12 From 551b41e20118b66edb37704a0cfbfe5d3a960067 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 18 Feb 2010 09:58:57 +0100 Subject: Add QEgl::defaultConfig method to select configs suitable for Qt Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 163 +++++++++++++++++++++++++++++++++++++++++ src/gui/egl/qegl_p.h | 15 ++++ src/gui/egl/qeglproperties.cpp | 10 +++ 3 files changed, 188 insertions(+) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index ef30029..8bd4d7f 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -88,6 +88,169 @@ bool QEglContext::isCurrent() const return current; } +EGLConfig QEgl::defaultConfig(QPaintDevice* device, API api, ConfigOptions options) +{ + int devType = device->devType(); + + if ( (devType != QInternal::Pixmap) && ((options & Renderable) == 0)) + qWarning("QEgl::defaultConfig() - Only configs for pixmaps make sense to be read-only!"); + + EGLConfig* targetConfig = 0; + + static EGLConfig defaultVGConfigs[] = { + QEGL_NO_CONFIG, // 0 Window Renderable Translucent + QEGL_NO_CONFIG, // 1 Window Renderable Opaque + QEGL_NO_CONFIG, // 2 Pixmap Renderable Translucent + QEGL_NO_CONFIG, // 3 Pixmap Renderable Opaque + QEGL_NO_CONFIG, // 4 Pixmap ReadOnly Translucent + QEGL_NO_CONFIG // 5 Pixmap ReadOnly Opaque + }; + if (api == OpenVG) { + if (devType == QInternal::Widget) { + if (options & Translucent) + targetConfig = &(defaultVGConfigs[0]); + else + targetConfig = &(defaultVGConfigs[1]); + } else if (devType == QInternal::Pixmap) { + if (options & Renderable) { + if (options & Translucent) + targetConfig = &(defaultVGConfigs[2]); + else // Opaque + targetConfig = &(defaultVGConfigs[3]); + } else { // Read-only + if (options & Translucent) + targetConfig = &(defaultVGConfigs[4]); + else // Opaque + targetConfig = &(defaultVGConfigs[5]); + } + } + } + + + static EGLConfig defaultGLConfigs[] = { + QEGL_NO_CONFIG, // 0 Window Renderable Translucent + QEGL_NO_CONFIG, // 1 Window Renderable Opaque + QEGL_NO_CONFIG, // 2 PBuffer Renderable Translucent + QEGL_NO_CONFIG, // 3 PBuffer Renderable Opaque + QEGL_NO_CONFIG, // 4 Pixmap Renderable Translucent + QEGL_NO_CONFIG, // 5 Pixmap Renderable Opaque + QEGL_NO_CONFIG, // 6 Pixmap ReadOnly Translucent + QEGL_NO_CONFIG // 7 Pixmap ReadOnly Opaque + }; + if (api == OpenGL) { + if (devType == QInternal::Widget) { + if (options & Translucent) + targetConfig = &(defaultGLConfigs[0]); + else // Opaque + targetConfig = &(defaultGLConfigs[1]); + } else if (devType == QInternal::Pbuffer) { + if (options & Translucent) + targetConfig = &(defaultGLConfigs[2]); + else // Opaque + targetConfig = &(defaultGLConfigs[3]); + } else if (devType == QInternal::Pixmap) { + if (options & Renderable) { + if (options & Translucent) + targetConfig = &(defaultGLConfigs[4]); + else // Opaque + targetConfig = &(defaultGLConfigs[5]); + } else { // ReadOnly + if (options & Translucent) + targetConfig = &(defaultGLConfigs[6]); + else // Opaque + targetConfig = &(defaultGLConfigs[7]); + } + } + } + + if (!targetConfig) { + qWarning("QEgl::defaultConfig() - No default config for device/api/options combo"); + return QEGL_NO_CONFIG; + } + if (*targetConfig != QEGL_NO_CONFIG) + return *targetConfig; + + + // We haven't found an EGL config for the target config yet, so do it now: + + + // Allow overriding from an environment variable: + QByteArray configId; + if (api == OpenVG) + configId = qgetenv("QT_VG_EGL_CONFIG"); + else + configId = qgetenv("QT_GL_EGL_CONFIG"); + if (!configId.isEmpty()) { + // Overriden, so get the EGLConfig for the specified config ID: + EGLint properties[] = { + EGL_CONFIG_ID, (EGLint)configId.toInt(), + EGL_NONE + }; + EGLint configCount = 0; + eglChooseConfig(display(), properties, targetConfig, 1, &configCount); + if (configCount > 0) + return *targetConfig; + qWarning() << "QEgl::defaultConfig() -" << configId << "appears to be invalid"; + } + + QEglProperties configAttribs; + configAttribs.setRenderableType(api); + + EGLint surfaceType; + switch (devType) { + case QInternal::Widget: + surfaceType = EGL_WINDOW_BIT; + break; + case QInternal::Pixmap: + surfaceType = EGL_PIXMAP_BIT; + break; + case QInternal::Pbuffer: + surfaceType = EGL_PBUFFER_BIT; + break; + default: + qWarning("QEgl::defaultConfig() - Can't create EGL surface for %d device type", devType); + return QEGL_NO_CONFIG; + }; +#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT + // For OpenVG, we try to create a surface using a pre-multiplied format if + // the surface needs to have an alpha channel: + if (api == OpenVG && (options & Translucent)) + surfaceType |= EGL_VG_ALPHA_FORMAT_PRE_BIT; +#endif + configAttribs.setValue(EGL_SURFACE_TYPE, surfaceType); + +#ifdef EGL_BIND_TO_TEXTURE_RGBA + if (devType == QInternal::Pixmap || devType == QInternal::Pbuffer) { + if (options & Translucent) + configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE); + else + configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE); + } +#endif + + // Add paint engine requirements + if (api == OpenVG) { +#ifndef QVG_SCISSOR_CLIP + configAttribs.setValue(EGL_ALPHA_MASK_SIZE, 1); +#endif + } else { + // Both OpenGL paint engines need to have stencil and sample buffers + configAttribs.setValue(EGL_STENCIL_SIZE, 1); + configAttribs.setValue(EGL_SAMPLE_BUFFERS, 1); +#ifndef QT_OPENGL_ES_2 + // Aditionally, the GL1 engine likes to have a depth buffer for clipping + configAttribs.setValue(EGL_DEPTH_SIZE, 1); +#endif + } + + // Finally, set the color format based on the device: + configAttribs.setPaintDeviceFormat(device); + + *targetConfig = chooseConfig(&configAttribs, QEgl::BestPixelFormat); + return *targetConfig; +} + + // Choose a configuration that matches "properties". EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match) { diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 8a9d815..1a5e4c0 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -114,6 +114,21 @@ namespace QEgl { BestPixelFormat }; + enum ConfigOptions + { + Opaque = 0x00, + Translucent = 0x01, + + ReadOnly = 0x00, + Renderable = 0x02 // Config will be compatable with the paint engines (VG or GL) + }; + + // Most of the time we use the same config for things like widgets & pixmaps, so rather than + // go through the eglChooseConfig loop every time, we use defaultConfig, which will return + // the config for a particular device/api/option combo. This function assumes that once a + // config is chosen for a particular combo, it's safe to always use that combo. + Q_GUI_EXPORT EGLConfig defaultConfig(QPaintDevice* device, API api, ConfigOptions options); + Q_GUI_EXPORT EGLConfig chooseConfig(const QEglProperties* configAttribs, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); Q_GUI_EXPORT EGLSurface createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *surfaceAttribs = 0); diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index 86e158b..e0e8481 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -230,6 +230,16 @@ void QEglProperties::setRenderableType(QEgl::API api) // reductions in complexity are possible. bool QEglProperties::reduceConfiguration() { +#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT + // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't + // find a config which supports pre-multiplied formats, remove the flag on the surface type: + EGLint surfaceType = value(EGL_SURFACE_TYPE); + if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) { + surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT; + setValue(EGL_SURFACE_TYPE, surfaceType); + return true; + } +#endif // EGL chooses configs with the highest color depth over // those with smaller (but faster) lower color depths. One // way around this is to set EGL_BUFFER_SIZE to 16, which -- cgit v0.12 From 4c5549269144eae79bdcefc7119b2adf3044e000 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 19 Feb 2010 15:54:09 +0100 Subject: Add getCompatibleVisualId to QEgl on X11 This method takes an EGLConfig and hands back an X11 VisualID which can be used to create native windows/pixmaps which will have an EGL surface created for them using the given EGL config. Reviewed-By: TrustMe --- src/gui/egl/qegl_p.h | 4 ++ src/gui/egl/qegl_x11.cpp | 145 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+) diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 1a5e4c0..7f753d0 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -147,6 +147,10 @@ namespace QEgl { Q_GUI_EXPORT EGLNativeDisplayType nativeDisplay(); Q_GUI_EXPORT EGLNativeWindowType nativeWindow(QWidget*); Q_GUI_EXPORT EGLNativePixmapType nativePixmap(QPixmap*); + +#ifdef Q_WS_X11 + Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config); +#endif }; diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index e8fb662..2c0bbd3 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -116,4 +116,149 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) setVisualFormat(qt_x11Info(dev)); } + +VisualID QEgl::getCompatibleVisualId(EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLint configRedSize = 0; + eglGetConfigAttrib(display(), config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(display(), config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(display(), config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(display(), config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(display(), config, EGL_BUFFER_SIZE, &eglValue); + int configBitDepth = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(display(), config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(X11->display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + if (configBitDepth == chosenVisualInfo->depth) { +#if !defined(QT_NO_XRENDER) + // If we have XRender, actually check the visual supplied by EGL is ARGB + if (configAlphaSize > 0) { + XRenderPictFormat *format; + format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual); + if (!format || (format->type != PictTypeDirect) || (!format->direct.alphaMask)) { + qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this is not ARGB", + (int)visualId, (int)config); + visualId = 0; + } + } +#endif + } else { + qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!", + (int)visualId, chosenVisualInfo->depth, (int)config, configBitDepth); + visualId = 0; + } + } + XFree(chosenVisualInfo); + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configHasAlpha) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); +#endif + return visualId; + } + + + // If EGL didn't give us a valid visual ID, try XRender +#if !defined(QT_NO_XRENDER) + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + + visualInfoTemplate.depth = configBitDepth; + visualInfoTemplate.c_class = TrueColor; + + XVisualInfo *matchingVisuals; + int matchingCount = 0; + matchingVisuals = XGetVisualInfo(X11->display, + VisualDepthMask|VisualClassMask, + &visualInfoTemplate, + &matchingCount); + + for (int i = 0; i < matchingCount; ++i) { + XRenderPictFormat *format; + format = XRenderFindVisualFormat(X11->display, matchingVisuals[i].visual); + + // Check the format for the visual matches the EGL config + if ( (countBits(format->direct.redMask) == configRedSize) && + (countBits(format->direct.greenMask) == configGreenSize) && + (countBits(format->direct.blueMask) == configBlueSize) && + (countBits(format->direct.alphaMask) == configAlphaSize) ) + { + visualId = matchingVisuals[i].visualid; + break; + } + } + if (matchingVisuals) + XFree(matchingVisuals); + + } + if (visualId) { +# ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configHasAlpha) + qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); + else + qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); +# endif // QT_DEBUG_X11_VISUAL_SELECTION + return visualId; + } +#endif //!defined(QT_NO_XRENDER) + + + // Finally, if XRender also failed to find a visual (or isn't present), try to + // use XGetVisualInfo and only use the bit depth to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + + visualInfoTemplate.depth = configBitDepth; + + XVisualInfo *matchingVisuals; + int matchingCount = 0; + matchingVisuals = XGetVisualInfo(X11->display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, (int)config); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", (int)config); + return (VisualID)0; +} + + QT_END_NAMESPACE -- cgit v0.12 From c993aef82eca9f5d5241093f407179e4189ab7f1 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 19 Feb 2010 18:17:08 +0100 Subject: Add QEglContext::configAttrib(int name) helper Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 10 ++++++++++ src/gui/egl/qeglcontext_p.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 8bd4d7f..d4c9913 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -510,6 +510,16 @@ bool QEglContext::configAttrib(int name, EGLint *value) const return eglGetConfigAttrib(QEgl::display(), cfg, name, value); } +int QEglContext::configAttrib(int name) const +{ + EGLint value; + EGLBoolean success = eglGetConfigAttrib(QEgl::display(), cfg, name, &value); + if (success) + return value; + else + return EGL_DONT_CARE; +} + QEglProperties QEglContext::configProperties() const { return QEglProperties(config()); diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h index c656d1d..7eec7eb 100644 --- a/src/gui/egl/qeglcontext_p.h +++ b/src/gui/egl/qeglcontext_p.h @@ -89,6 +89,7 @@ public: void waitClient(); bool configAttrib(int name, EGLint *value) const; + int configAttrib(int name) const; EGLContext context() const { return ctx; } void setContext(EGLContext context) { ctx = context; ownsContext = false;} -- cgit v0.12 From 445b62cb432deb8aed3be766d3c37b9567e1d4ec Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 19 Feb 2010 18:29:42 +0100 Subject: Make QGLWidget use new QEgl::getCompatibleVisualId API Reviewed-By: TrustMe --- src/gui/egl/qegl_x11.cpp | 5 +++-- src/opengl/qgl_x11egl.cpp | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 2c0bbd3..49c8d60 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -116,6 +116,7 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) setVisualFormat(qt_x11Info(dev)); } +//#define QT_DEBUG_X11_VISUAL_SELECTION 1 VisualID QEgl::getCompatibleVisualId(EGLConfig config) { @@ -174,7 +175,7 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configHasAlpha) + if (configAlphaSize > 0) qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); else qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); @@ -219,7 +220,7 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) } if (visualId) { # ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configHasAlpha) + if (configAlphaSize > 0) qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); else qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 972a5f6..b8da156 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -282,6 +282,7 @@ void QGLWidget::updateOverlayGL() } //#define QT_DEBUG_X11_VISUAL_SELECTION 1 +//#undef QT_DEBUG_X11_VISUAL_SELECTION bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, const QX11Info &x11Info, bool useArgbVisual) { @@ -471,10 +472,21 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, if (visible) hide(); - XVisualInfo vi; QEglContext *eglContext = d->glcx->d_func()->eglContext; - bool usingArgbVisual = qt_egl_setup_x11_visual(vi, eglContext->display(), eglContext->config(), - x11Info(), tryArgbVisual); + + XVisualInfo vi; + memset(&vi, 0, sizeof(XVisualInfo)); + vi.visualid = QEgl::getCompatibleVisualId(eglContext->config()); + + { + XVisualInfo *visualInfoPtr; + int matchingCount = 0; + visualInfoPtr = XGetVisualInfo(X11->display, VisualIDMask, &vi, &matchingCount); + vi = *visualInfoPtr; + XFree(visualInfoPtr); + } + + bool usingArgbVisual = eglContext->configAttrib(EGL_ALPHA_SIZE) > 0; XSetWindowAttributes a; -- cgit v0.12 From dbc62b34b54ec3294f1cf8248630fbd1eaad9cbc Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 23 Feb 2010 18:08:08 +0100 Subject: Remove qt_egl_setup_x11_visual This method has been re-written as QEgl::getCompatibleVisualId() which is much cleaner code. Reviewed-By: TrustMe --- src/opengl/qgl_x11egl.cpp | 150 +--------------------------------------------- 1 file changed, 1 insertion(+), 149 deletions(-) diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index b8da156..99ff5b8 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE -bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, - const QX11Info &x11Info, bool useArgbVisual); - /* QGLTemporaryContext implementation */ @@ -107,15 +104,7 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) int numVisuals; EGLint id = 0; - eglGetConfigAttrib(d->display, config, EGL_NATIVE_VISUAL_ID, &id); - if (id == 0) { - // EGL_NATIVE_VISUAL_ID is optional and might not be supported - // on some implementations - we'll have to do it the hard way - QX11Info xinfo; - qt_egl_setup_x11_visual(visualInfo, d->display, config, xinfo, false); - } else { - visualInfo.visualid = id; - } + visualInfo.visualid = QEgl::getCompatibleVisualId(config); vi = XGetVisualInfo(X11->display, VisualIDMask, &visualInfo, &numVisuals); if (!vi || numVisuals < 1) { qWarning("QGLTemporaryContext: Unable to get X11 visual info id."); @@ -281,143 +270,6 @@ void QGLWidget::updateOverlayGL() //handle overlay } -//#define QT_DEBUG_X11_VISUAL_SELECTION 1 -//#undef QT_DEBUG_X11_VISUAL_SELECTION - -bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, const QX11Info &x11Info, bool useArgbVisual) -{ - bool foundVisualIsArgb = useArgbVisual; - -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("qt_egl_setup_x11_visual() - useArgbVisual=%d", useArgbVisual); -#endif - - memset(&vi, 0, sizeof(XVisualInfo)); - - EGLint eglConfigColorSize; - eglGetConfigAttrib(display, config, EGL_BUFFER_SIZE, &eglConfigColorSize); - - // Check to see if EGL is suggesting an appropriate visual id: - EGLint nativeVisualId; - eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &nativeVisualId); - vi.visualid = nativeVisualId; - - if (vi.visualid) { - // EGL has suggested a visual id, so get the rest of the visual info for that id: - XVisualInfo *chosenVisualInfo; - int matchingCount = 0; - chosenVisualInfo = XGetVisualInfo(x11Info.display(), VisualIDMask, &vi, &matchingCount); - if (chosenVisualInfo) { -#if !defined(QT_NO_XRENDER) - if (useArgbVisual) { - // Check to make sure the visual provided by EGL is ARGB - XRenderPictFormat *format; - format = XRenderFindVisualFormat(x11Info.display(), chosenVisualInfo->visual); - if (format->type == PictTypeDirect && format->direct.alphaMask) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using ARGB X Visual ID (%d) provided by EGL", (int)vi.visualid); -#endif - foundVisualIsArgb = true; - vi = *chosenVisualInfo; - } - else { - qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this is not ARGB", - nativeVisualId, (int)config); - vi.visualid = 0; - } - } else -#endif - { - if (eglConfigColorSize == chosenVisualInfo->depth) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid); -#endif - vi = *chosenVisualInfo; - } else - qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!", - nativeVisualId, chosenVisualInfo->depth, (int)config, eglConfigColorSize); - } - XFree(chosenVisualInfo); - } - else { - qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this seems to be invalid!", - nativeVisualId, (int)config); - vi.visualid = 0; - } - } - - // If EGL does not know the visual ID, so try to select an appropriate one ourselves, first - // using XRender if we're supposed to have an alpha, then falling back to XGetVisualInfo - -#if !defined(QT_NO_XRENDER) - if (vi.visualid == 0 && useArgbVisual) { - // Try to use XRender to find an ARGB visual we can use - vi.screen = x11Info.screen(); - vi.depth = 32; //### We might at some point (soon) get ARGB4444 - vi.c_class = TrueColor; - XVisualInfo *matchingVisuals; - int matchingCount = 0; - matchingVisuals = XGetVisualInfo(x11Info.display(), - VisualScreenMask|VisualDepthMask|VisualClassMask, - &vi, &matchingCount); - - for (int i = 0; i < matchingCount; ++i) { - XRenderPictFormat *format; - format = XRenderFindVisualFormat(x11Info.display(), matchingVisuals[i].visual); - if (format->type == PictTypeDirect && format->direct.alphaMask) { - vi = matchingVisuals[i]; - foundVisualIsArgb = true; -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using X Visual ID (%d) for ARGB visual as provided by XRender", (int)vi.visualid); -#endif - break; - } - } - XFree(matchingVisuals); - } -#endif - - if (vi.visualid == 0) { - EGLint depth; - eglGetConfigAttrib(display, config, EGL_BUFFER_SIZE, &depth); - int err; - err = XMatchVisualInfo(x11Info.display(), x11Info.screen(), depth, TrueColor, &vi); - if (err == 0) { - qWarning("Warning: Can't find an X visual which matches the EGL config(%d)'s depth (%d)!", - (int)config, depth); - depth = x11Info.depth(); - err = XMatchVisualInfo(x11Info.display(), x11Info.screen(), depth, TrueColor, &vi); - if (err == 0) { - qWarning("Error: Couldn't get any matching X visual!"); - return false; - } else - qWarning(" - Falling back to X11 suggested depth (%d)", depth); - } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - else - qDebug("Using X Visual ID (%d) for EGL provided depth (%d)", (int)vi.visualid, depth); -#endif - - // Don't try to use ARGB now unless the visual is 32-bit - even then it might stil fail :-( - if (useArgbVisual) - foundVisualIsArgb = vi.depth == 32; //### We might at some point (soon) get ARGB4444 - } - -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Visual Info:"); - qDebug(" bits_per_rgb=%d", vi.bits_per_rgb); - qDebug(" red_mask=0x%x", vi.red_mask); - qDebug(" green_mask=0x%x", vi.green_mask); - qDebug(" blue_mask=0x%x", vi.blue_mask); - qDebug(" colormap_size=%d", vi.colormap_size); - qDebug(" c_class=%d", vi.c_class); - qDebug(" depth=%d", vi.depth); - qDebug(" screen=%d", vi.screen); - qDebug(" visualid=%d", vi.visualid); -#endif - return foundVisualIsArgb; -} - void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, bool deleteOldContext) { Q_D(QGLWidget); -- cgit v0.12 From ebdfa7270f67e4ce3b5034aa5144fdabeaecbbcd Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 24 Feb 2010 13:41:29 +0100 Subject: Use QEgl::display in QGLTemporaryContext so EGL is init'd only once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-By: Trond Kjernåsen --- src/opengl/qgl_x11egl.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 99ff5b8..ff58fba 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -76,12 +76,7 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) d->surface = 0; int screen = 0; - d->display = eglGetDisplay(EGLNativeDisplayType(X11->display)); - - if (!eglInitialize(d->display, NULL, NULL)) { - qWarning("QGLTemporaryContext: Unable to initialize EGL display."); - return; - } + d->display = QEgl::display(); EGLConfig config; int numConfigs = 0; -- cgit v0.12 From a2eddea1432d6e558dcd620cd5100ce4531975e8 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 24 Feb 2010 17:26:11 +0100 Subject: Replace qt_egl_add_platform_config with existing QEglProperties API QEglProperties::setPaintDeviceFormat() seems to be a copy & paste of qt_egl_add_platform_config for every platform anyway. Reviewed-By: TrustMe --- src/opengl/qgl_egl_p.h | 1 - src/opengl/qgl_qws.cpp | 17 +---------------- src/opengl/qgl_wince.cpp | 12 +----------- src/opengl/qgl_x11egl.cpp | 8 +------- 4 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/opengl/qgl_egl_p.h b/src/opengl/qgl_egl_p.h index 518b500..1d8cbf1 100644 --- a/src/opengl/qgl_egl_p.h +++ b/src/opengl/qgl_egl_p.h @@ -62,7 +62,6 @@ class QGLFormat; void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f); void qt_egl_update_format(const QEglContext& context, QGLFormat& format); -void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device); QT_END_NAMESPACE diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index fd17a27..c221134 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -119,21 +119,6 @@ bool QGLFormat::hasOpenGLOverlays() return false; } -void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device) -{ - // Find the QGLScreen for this paint device. - QGLScreen *glScreen = glScreenForDevice(device); - if (!glScreen) { - qWarning("QGLContext::chooseContext(): The screen is not a QGLScreen"); - return; - } - int devType = device->devType(); - if (devType == QInternal::Image) - props.setPixelFormat(static_cast(device)->format()); - else - props.setPixelFormat(glScreen->pixelFormat()); -} - static EGLSurface qt_egl_create_surface (QEglContext *context, QPaintDevice *device, const QEglProperties *properties = 0) @@ -201,8 +186,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Construct the configuration we need for this surface. QEglProperties configProps; - qt_egl_add_platform_config(configProps, device()); qt_egl_set_format(configProps, devType, d->glFormat); + configProps.setPaintDeviceFormat(device()); configProps.setRenderableType(QEgl::OpenGL); // Search for a matching configuration, reducing the complexity diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index 2b71201..ed8b4f7 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -122,16 +122,6 @@ QGLTemporaryContext::~QGLTemporaryContext() QGLFormat Win32/WGL-specific code *****************************************************************************/ -void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device) -{ - int devType = device->devType(); - if (devType == QInternal::Image) - props.setPixelFormat(static_cast(device)->format()); - else - props.setPixelFormat(QImage::Format_RGB16); -} - - static bool opengl32dll = false; bool QGLFormat::hasOpenGLOverlays() @@ -159,8 +149,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Construct the configuration we need for this surface. QEglProperties configProps; - qt_egl_add_platform_config(configProps, device()); qt_egl_set_format(configProps, devType, d->glFormat); + configProps.setPaintDeviceFormat(device()); configProps.setRenderableType(QEgl::OpenGL); // Search for a matching configuration, reducing the complexity diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index ff58fba..21ddfe3 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -154,12 +154,6 @@ bool QGLFormat::hasOpenGLOverlays() return false; } -void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device) -{ - if (device->devType() == QInternal::Image) - props.setPixelFormat(static_cast(device)->format()); -} - // Chooses the EGL config and creates the EGL context bool QGLContext::chooseContext(const QGLContext* shareContext) { @@ -178,7 +172,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Construct the configuration we need for this surface. QEglProperties configProps; qt_egl_set_format(configProps, devType, d->glFormat); - qt_egl_add_platform_config(configProps, device()); + configProps.setPaintDeviceFormat(device()); configProps.setRenderableType(QEgl::OpenGL); #if We_have_an_EGL_library_which_bothers_to_check_EGL_BUFFER_SIZE -- cgit v0.12 From f936cc4e2a7b377981a626b1d45dbbb1c1df1cb8 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 1 Mar 2010 12:59:34 +0100 Subject: Move EGL surface type setting to new QEglProperties::setDeviceType Also renamed qt_egl_set_format->qt_eglproperties_set_glformat Reviewed-By: TrustMe --- src/gui/egl/qeglproperties.cpp | 11 +++++++ src/gui/egl/qeglproperties_p.h | 4 +-- src/opengl/qgl_egl.cpp | 62 ++++++++++++++++++--------------------- src/opengl/qgl_egl_p.h | 2 +- src/opengl/qgl_qws.cpp | 3 +- src/opengl/qgl_wince.cpp | 3 +- src/opengl/qgl_x11egl.cpp | 3 +- src/opengl/qglpixelbuffer_egl.cpp | 6 ++-- 8 files changed, 53 insertions(+), 41 deletions(-) diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index e0e8481..636f469 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -167,6 +167,17 @@ bool QEglProperties::removeValue(int name) return false; } +void QEglProperties::setDeviceType(int devType) +{ + if (devType == QInternal::Pixmap || devType == QInternal::Image) + setValue(EGL_SURFACE_TYPE, EGL_PIXMAP_BIT); + else if (devType == QInternal::Pbuffer) + setValue(EGL_SURFACE_TYPE, EGL_PBUFFER_BIT); + else + setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT); +} + + // Sets the red, green, blue, and alpha sizes based on a pixel format. // Normally used to match a configuration request to the screen format. void QEglProperties::setPixelFormat(QImage::Format pixelFormat) diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h index 496847b..eebcf72 100644 --- a/src/gui/egl/qeglproperties_p.h +++ b/src/gui/egl/qeglproperties_p.h @@ -82,9 +82,9 @@ public: #ifdef Q_WS_X11 void setVisualFormat(const QX11Info *xinfo); #endif - void setRenderableType(QEgl::API api); - + void setDeviceType(int devType); void setPaintDeviceFormat(QPaintDevice *dev); + void setRenderableType(QEgl::API api); bool reduceConfiguration(); diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 90fb2bb..f1abab8 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -45,44 +45,40 @@ QT_BEGIN_NAMESPACE -// Set device configuration attributes from a QGLFormat instance. -void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f) +void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat) { - if (deviceType == QInternal::Pixmap || deviceType == QInternal::Image) - props.setValue(EGL_SURFACE_TYPE, EGL_PIXMAP_BIT); - else if (deviceType == QInternal::Pbuffer) - props.setValue(EGL_SURFACE_TYPE, EGL_PBUFFER_BIT); - else - props.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT); - - // Set the pixel format to that contained in the QGLFormat - // if the system hasn't already chosen a fixed format to - // match the pixmap, widget, etc. - if (props.value(EGL_RED_SIZE) == 0 || f.redBufferSize() != -1) - props.setValue(EGL_RED_SIZE, f.redBufferSize() == -1 ? 1 : f.redBufferSize()); - if (props.value(EGL_GREEN_SIZE) == 0 || f.greenBufferSize() != -1) - props.setValue(EGL_GREEN_SIZE, f.greenBufferSize() == -1 ? 1 : f.greenBufferSize()); - if (props.value(EGL_BLUE_SIZE) == 0 || f.blueBufferSize() != -1) - props.setValue(EGL_BLUE_SIZE, f.blueBufferSize() == -1 ? 1 : f.blueBufferSize()); - if (f.alpha()) { - if (props.value(EGL_ALPHA_SIZE) == 0 || f.alphaBufferSize() != -1) - props.setValue(EGL_ALPHA_SIZE, f.alphaBufferSize() == -1 ? 1 : f.alphaBufferSize()); + // NOTE: QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that + // type has been requested. + if (glFormat.depth()) { + int depthSize = glFormat.depthBufferSize(); + eglProperties.setValue(EGL_DEPTH_SIZE, depthSize == -1 ? 1 : depthSize); } - - if (f.depth()) - props.setValue(EGL_DEPTH_SIZE, f.depthBufferSize() == -1 ? 1 : f.depthBufferSize()); - if (f.stencil()) - props.setValue(EGL_STENCIL_SIZE, f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize()); - if (f.sampleBuffers()) { - props.setValue(EGL_SAMPLE_BUFFERS, 1); - props.setValue(EGL_SAMPLES, f.samples() == -1 ? 1 : f.samples()); - } else { - props.setValue(EGL_SAMPLE_BUFFERS, 0); + if (glFormat.stencil()) { + int stencilSize = glFormat.stencilBufferSize(); + eglProperties.setValue(EGL_STENCIL_SIZE, stencilSize == -1 ? 1 : stencilSize); + } + if (glFormat.sampleBuffers()) { + int sampleCount = glFormat.samples(); + eglProperties.setValue(EGL_SAMPLES, sampleCount == -1 ? 1 : sampleCount); + eglProperties.setValue(EGL_SAMPLE_BUFFERS, 1); + } + if (glFormat.alpha()) { + int alphaSize = glFormat.alphaBufferSize(); + eglProperties.setValue(EGL_ALPHA_SIZE, alphaSize == -1 ? 1 : alphaSize); } - if (deviceType == QInternal::Widget) - props.setValue(EGL_LEVEL, f.plane()); + + int redSize = glFormat.redBufferSize(); + int greenSize = glFormat.greenBufferSize(); + int blueSize = glFormat.blueBufferSize(); + int alphaSize = glFormat.alphaBufferSize(); + + eglProperties.setValue(EGL_RED_SIZE, redSize > 0 ? redSize : 1); + eglProperties.setValue(EGL_GREEN_SIZE, greenSize > 0 ? greenSize : 1); + eglProperties.setValue(EGL_BLUE_SIZE, blueSize > 0 ? blueSize : 1); + eglProperties.setValue(EGL_ALPHA_SIZE, alphaSize > 0 ? alphaSize : 0); } + // Updates "format" with the parameters of the selected configuration. void qt_egl_update_format(const QEglContext& context, QGLFormat& format) { diff --git a/src/opengl/qgl_egl_p.h b/src/opengl/qgl_egl_p.h index 1d8cbf1..6b65227 100644 --- a/src/opengl/qgl_egl_p.h +++ b/src/opengl/qgl_egl_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class QGLFormat; -void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f); +void qt_eglproperties_set_glformat(QEglProperties& props, const QGLFormat& format); void qt_egl_update_format(const QEglContext& context, QGLFormat& format); QT_END_NAMESPACE diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index c221134..f72f051 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -186,7 +186,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Construct the configuration we need for this surface. QEglProperties configProps; - qt_egl_set_format(configProps, devType, d->glFormat); + qt_eglproperties_set_glformat(configProps, d->glFormat); + configProps.setDeviceType(devType); configProps.setPaintDeviceFormat(device()); configProps.setRenderableType(QEgl::OpenGL); diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index ed8b4f7..3bf7f3a 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -149,7 +149,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Construct the configuration we need for this surface. QEglProperties configProps; - qt_egl_set_format(configProps, devType, d->glFormat); + qt_eglproperties_set_glformat(configProps, d->glFormat); + configProps.setDeviceType(devType); configProps.setPaintDeviceFormat(device()); configProps.setRenderableType(QEgl::OpenGL); diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 21ddfe3..7be4973 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -171,7 +171,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Construct the configuration we need for this surface. QEglProperties configProps; - qt_egl_set_format(configProps, devType, d->glFormat); + qt_eglproperties_set_glformat(configProps, d->glFormat); + configProps.setDeviceType(devType); configProps.setPaintDeviceFormat(device()); configProps.setRenderableType(QEgl::OpenGL); diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index cee5a1f..ee0714f 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -82,7 +82,8 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge #endif } else { QEglProperties configProps; - qt_egl_set_format(configProps, QInternal::Pbuffer, f); + qt_eglproperties_set_glformat(configProps, f); + configProps.setDeviceType(QInternal::Pbuffer); configProps.setRenderableType(ctx->api()); bool ok = false; #if QGL_RENDER_TEXTURE @@ -208,7 +209,8 @@ bool QGLPixelBuffer::hasOpenGLPbuffers() if (dpy == EGL_NO_DISPLAY) return false; QEglProperties configProps; - qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat()); + qt_eglproperties_set_glformat(configProps, QGLFormat::defaultFormat()); + configProps.setDeviceType(QInternal::Pbuffer); configProps.setRenderableType(QEgl::OpenGL); do { EGLConfig cfg = 0; -- cgit v0.12 From b2cbb880273ae6516d68be5b5f3f9b614c31ca79 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 1 Mar 2010 14:12:23 +0100 Subject: Move QGLWidget::setContext logic into QEgl & QGLContext QEgl::createSurface() on X11 will now check to see if the device's X11 Visual is compatible with the EGLConfig passed in. If it is not compatible, the function will re-create the QPaintDevice's native drawable with a different Visual (one which is compatable with the EGLConfig). This represented the bulk of the QGLWidget::setContext method which is now much simpler. As a consequense of this change, QWidgets with graphicssystem opengl will behave much more like QGLWidget as most of the code is re-used. So things like WA_TranslucentBackground should now work with opengl graphicssystem too. Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 3 +- src/gui/egl/qegl_x11.cpp | 121 +++++++++++++++++++++++++++ src/gui/image/qpixmap_x11_p.h | 1 + src/gui/kernel/qwidget.h | 1 + src/opengl/qgl_x11egl.cpp | 173 +++++++++++++-------------------------- src/opengl/qwindowsurface_gl.cpp | 12 --- 6 files changed, 180 insertions(+), 131 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index d4c9913..e2002ed 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -570,6 +570,7 @@ EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) return (EGLNativePixmapType)(pixmap->handle()); } +#ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { // Create the native drawable for the paint device. @@ -607,7 +608,7 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr } return surf; } - +#endif // Return the error string associated with a specific code. diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 49c8d60..b710889 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include "qegl_p.h" #include "qeglcontext_p.h" @@ -261,5 +262,125 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) return (VisualID)0; } +void qt_set_winid_on_widget(QWidget* w, Qt::HANDLE id) +{ + w->create(id); +} + + +// NOTE: The X11 version of createSurface will re-create the native drawable if it's visual doesn't +// match the one for the passed in EGLConfig +EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEglProperties *unusedProperties) +{ + Q_UNUSED(unusedProperties); + + int devType = device->devType(); + + if (devType == QInternal::Pbuffer) { + // TODO + return EGL_NO_SURFACE; + } + + QX11PixmapData *x11PixmapData = 0; + if (devType == QInternal::Pixmap) { + QPixmapData *pmd = static_cast(device)->data_ptr().data(); + if (pmd->classId() == QPixmapData::X11Class) + x11PixmapData = static_cast(pmd); + else { + // TODO: Replace the pixmap's data with a new QX11PixmapData + qWarning("WARNING: Creating an EGL surface on a QPixmap is only supported for QX11PixmapData"); + return EGL_NO_SURFACE; + } + } else if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { + qWarning("WARNING: Creating an EGLSurface for device type %d isn't supported", devType); + return EGL_NO_SURFACE; + } + + VisualID visualId = QEgl::getCompatibleVisualId(config); + EGLint alphaSize; + eglGetConfigAttrib(QEgl::display(), config, EGL_ALPHA_SIZE, &alphaSize); + + if (devType == QInternal::Widget) { + QWidget *widget = static_cast(device); + + VisualID currentVisualId = 0; + if (widget->testAttribute(Qt::WA_WState_Created)) + currentVisualId = XVisualIDFromVisual((Visual*)widget->x11Info().visual()); + + if (currentVisualId != visualId) { + // The window is either not created or has the wrong visual. Either way, we need + // to create a window with the correct visual and call create() on the widget: + + bool visible = widget->isVisible(); + if (visible) + widget->hide(); + + XVisualInfo visualInfo; + visualInfo.visualid = visualId; + { + XVisualInfo *visualInfoPtr; + int matchingCount = 0; + visualInfoPtr = XGetVisualInfo(widget->x11Info().display(), VisualIDMask, + &visualInfo, &matchingCount); + Q_ASSERT(visualInfoPtr); // visualId really should be valid! + visualInfo = *visualInfoPtr; + XFree(visualInfoPtr); + } + + Window parentWindow = RootWindow(widget->x11Info().display(), widget->x11Info().screen()); + if (widget->parentWidget()) + parentWindow = widget->parentWidget()->winId(); + + XSetWindowAttributes windowAttribs; + QColormap colmap = QColormap::instance(widget->x11Info().screen()); + windowAttribs.background_pixel = colmap.pixel(widget->palette().color(widget->backgroundRole())); + windowAttribs.border_pixel = colmap.pixel(Qt::black); + + unsigned int valueMask = CWBackPixel|CWBorderPixel; + if (alphaSize > 0) { + windowAttribs.colormap = XCreateColormap(widget->x11Info().display(), parentWindow, + visualInfo.visual, AllocNone); + valueMask |= CWColormap; + } + + Window window = XCreateWindow(widget->x11Info().display(), parentWindow, + widget->x(), widget->y(), widget->width(), widget->height(), + 0, visualInfo.depth, InputOutput, visualInfo.visual, + valueMask, &windowAttribs); + + // This is a nasty hack to get round the fact that we can't be a friend of QWidget: + qt_set_winid_on_widget(widget, window); + + if (visible) + widget->show(); + } + + // At this point, the widget's window should be created and have the correct visual. Now we + // just need to create the EGL surface for it: + return eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0); + } + + if (x11PixmapData) { + VisualID currentVisualId = XVisualIDFromVisual((Visual*)qt_x11Info(device)->visual()); + if (visualId != currentVisualId) + qWarning("Error: The QPixmap's visual does not match the EGLConfig's visual!"); + + QEglProperties surfaceAttribs; + + // If the pixmap can't be bound to a texture, it's pretty useless + surfaceAttribs.setValue(EGL_TEXTURE_TARGET, EGL_TEXTURE_2D); + if (alphaSize > 0) + surfaceAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA); + else + surfaceAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB); + + return eglCreatePixmapSurface(QEgl::display(), config, + (EGLNativePixmapType) x11PixmapData->handle(), + surfaceAttribs.properties()); + } + + return EGL_NO_SURFACE; +} + QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index 0c0a9bd..7bc586d 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -105,6 +105,7 @@ private: friend class QRasterWindowSurface; friend class QGLContextPrivate; // Needs to access xinfo, gl_surface & flags friend class QEglContext; // Needs gl_surface + friend class QGLContext; // Needs gl_surface friend class QX11GLPixmapData; // Needs gl_surface friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 0d7475e9..e12148b 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -773,6 +773,7 @@ private: #ifdef Q_WS_X11 friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp); friend void qt_net_remove_user_time(QWidget *tlw); + friend void qt_set_winid_on_widget(QWidget*, Qt::HANDLE); #endif friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 7be4973..18a2ee5 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -48,6 +48,7 @@ #include "qgl_egl_p.h" #include "qcolormap.h" #include +#include QT_BEGIN_NAMESPACE @@ -164,55 +165,53 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) int devType = device()->devType(); - // Get the display and initialize it. + QX11PixmapData *x11PixmapData = 0; + if (devType == QInternal::Pixmap) { + QPixmapData *pmd = static_cast(device())->data_ptr().data(); + if (pmd->classId() == QPixmapData::X11Class) + x11PixmapData = static_cast(pmd); + else { + // TODO: Replace the pixmap's data with a new QX11PixmapData + qWarning("WARNING: Creating a QGLContext on a QPixmap is only supported for X11 pixmap backend"); + return false; + } + } else if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { + qWarning("WARNING: Creating a QGLContext not supported on device type %d", devType); + return false; + } + + // Only create the eglContext if we don't already have one: if (d->eglContext == 0) { d->eglContext = new QEglContext(); d->eglContext->setApi(QEgl::OpenGL); + // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat + // has the alpha channel option set: + if (devType == QInternal::Widget) { + QWidget* widget = static_cast(device()); + if (widget->testAttribute(Qt::WA_TranslucentBackground)) + d->glFormat.setAlpha(true); + } + // Construct the configuration we need for this surface. QEglProperties configProps; - qt_eglproperties_set_glformat(configProps, d->glFormat); configProps.setDeviceType(devType); - configProps.setPaintDeviceFormat(device()); configProps.setRenderableType(QEgl::OpenGL); + qt_eglproperties_set_glformat(configProps, d->glFormat); -#if We_have_an_EGL_library_which_bothers_to_check_EGL_BUFFER_SIZE - if (device()->depth() == 16 && configProps.value(EGL_ALPHA_SIZE) <= 0) { - qDebug("Setting EGL_BUFFER_SIZE to 16"); + // Use EGL_BUFFER_SIZE to make sure we prefer a 16-bit config over a 32-bit config + if (device()->depth() == 16 && !d->glFormat.alpha()) configProps.setValue(EGL_BUFFER_SIZE, 16); - configProps.setValue(EGL_ALPHA_SIZE, 0); - } if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) { delete d->eglContext; d->eglContext = 0; return false; } -#else - QEgl::PixelFormatMatch matchType = QEgl::BestPixelFormat; - if ((device()->depth() == 16) && configProps.value(EGL_ALPHA_SIZE) == 0) { - configProps.setValue(EGL_RED_SIZE, 5); - configProps.setValue(EGL_GREEN_SIZE, 6); - configProps.setValue(EGL_BLUE_SIZE, 5); - configProps.setValue(EGL_ALPHA_SIZE, 0); - matchType = QEgl::ExactPixelFormat; - } - - // Search for a matching configuration, reducing the complexity - // each time until we get something that matches. - if (!d->eglContext->chooseConfig(configProps, matchType)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } -#endif - -// qDebug("QGLContext::chooseContext() - using EGL config %d:", d->eglContext->config()); -// qDebug() << QEglProperties(d->eglContext->config()).toString(); // Create a new context for the configuration. - if (!d->eglContext->createContext - (shareContext ? shareContext->d_func()->eglContext : 0)) { + QEglContext* eglSharedContext = shareContext ? shareContext->d_func()->eglContext : 0; + if (!d->eglContext->createContext(eglSharedContext)) { delete d->eglContext; d->eglContext = 0; return false; @@ -220,16 +219,34 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) d->sharing = d->eglContext->isSharing(); if (d->sharing && shareContext) const_cast(shareContext)->d_func()->sharing = true; - -#if defined(EGL_VERSION_1_1) - if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget) - eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval()); -#endif } // Inform the higher layers about the actual format properties. qt_egl_update_format(*(d->eglContext), d->glFormat); + + // Do don't create the EGLSurface for everything. + // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface + // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface + // QPixmap - yes, create the EGLSurface but store it in QX11PixmapData::gl_surface + // QGLPixelBuffer - no, it creates the surface itself + + if (devType == QInternal::Widget) { + if (d->eglSurface != EGL_NO_SURFACE) + eglDestroySurface(d->eglContext->display(), d->eglSurface); + d->eglSurface = QEgl::createSurface(device(), d->eglContext->config()); + XFlush(X11->display); + setWindowCreated(true); + } + + if (x11PixmapData) { + // TODO: Actually check to see if the existing surface can be re-used + if (x11PixmapData->gl_surface) + eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PixmapData->gl_surface); + + x11PixmapData->gl_surface = (Qt::HANDLE)QEgl::createSurface(device(), d->eglContext->config()); + } + return true; } @@ -277,20 +294,6 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, QGLContext* oldcx = d->glcx; d->glcx = context; - if (parentWidget()) { - // force creation of delay-created widgets - parentWidget()->winId(); - if (parentWidget()->x11Info().screen() != x11Info().screen()) - d_func()->xinfo = parentWidget()->d_func()->xinfo; - } - - // If the application has set WA_TranslucentBackground and not explicitly set - // the alpha buffer size to zero, modify the format so it have an alpha channel - QGLFormat& fmt = d->glcx->d_func()->glFormat; - const bool tryArgbVisual = testAttribute(Qt::WA_TranslucentBackground) || fmt.alpha(); - if (tryArgbVisual && fmt.alphaBufferSize() == -1) - fmt.setAlphaBufferSize(1); - bool createFailed = false; if (!d->glcx->isValid()) { // Create the QGLContext here, which in turn chooses the EGL config @@ -304,74 +307,8 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, return; } - if (d->glcx->windowCreated() || d->glcx->deviceIsPixmap()) { - if (deleteOldContext) - delete oldcx; - return; - } - - bool visible = isVisible(); - if (visible) - hide(); - - QEglContext *eglContext = d->glcx->d_func()->eglContext; - - XVisualInfo vi; - memset(&vi, 0, sizeof(XVisualInfo)); - vi.visualid = QEgl::getCompatibleVisualId(eglContext->config()); - - { - XVisualInfo *visualInfoPtr; - int matchingCount = 0; - visualInfoPtr = XGetVisualInfo(X11->display, VisualIDMask, &vi, &matchingCount); - vi = *visualInfoPtr; - XFree(visualInfoPtr); - } - - bool usingArgbVisual = eglContext->configAttrib(EGL_ALPHA_SIZE) > 0; - - XSetWindowAttributes a; - - Window p = RootWindow(x11Info().display(), x11Info().screen()); - if (parentWidget()) - p = parentWidget()->winId(); - - QColormap colmap = QColormap::instance(vi.screen); - a.background_pixel = colmap.pixel(palette().color(backgroundRole())); - a.border_pixel = colmap.pixel(Qt::black); - - unsigned int valueMask = CWBackPixel|CWBorderPixel; - if (usingArgbVisual) { - a.colormap = XCreateColormap(x11Info().display(), p, vi.visual, AllocNone); - valueMask |= CWColormap; - } - - Window w = XCreateWindow(x11Info().display(), p, x(), y(), width(), height(), - 0, vi.depth, InputOutput, vi.visual, valueMask, &a); - - if (deleteOldContext) - delete oldcx; - oldcx = 0; - - create(w); // Create with the ID of the window we've just created - - - // Create the EGL surface to draw into. - QGLContextPrivate *ctxpriv = d->glcx->d_func(); - ctxpriv->eglSurface = ctxpriv->eglContext->createSurface(this); - if (ctxpriv->eglSurface == EGL_NO_SURFACE) { - delete ctxpriv->eglContext; - ctxpriv->eglContext = 0; - return; - } - - d->eglSurfaceWindowId = w; // Remember the window id we created the surface for - - if (visible) - show(); - XFlush(X11->display); - d->glcx->setWindowCreated(true); + d->eglSurfaceWindowId = winId(); // Remember the window id we created the surface for } void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget) @@ -380,7 +317,7 @@ void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget) initContext(context, shareWidget); - if(q->isValid() && glcx->format().hasOverlay()) { + if (q->isValid() && glcx->format().hasOverlay()) { //no overlay qWarning("QtOpenGL ES doesn't currently support overlays"); } diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 0334cbc..ca88de3 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -353,18 +353,6 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) QGLContext *ctx = new QGLContext(surfaceFormat, widget); ctx->create(qt_gl_share_widget()->context()); -#if defined(Q_WS_X11) && defined(QT_OPENGL_ES) - // Create the EGL surface to draw into. QGLContext::chooseContext() - // does not do this for X11/EGL, but does do it for other platforms. - // This probably belongs in qgl_x11egl.cpp. - QGLContextPrivate *ctxpriv = ctx->d_func(); - ctxpriv->eglSurface = ctxpriv->eglContext->createSurface(widget); - if (ctxpriv->eglSurface == EGL_NO_SURFACE) { - qWarning() << "hijackWindow() could not create EGL surface"; - } - qDebug("QGLWindowSurface - using EGLConfig %d", reinterpret_cast(ctxpriv->eglContext->config())); -#endif - widgetPrivate->extraData()->glContext = ctx; union { QGLContext **ctxPtr; void **voidPtr; }; -- cgit v0.12 From 9c1ff07b427765beb71755e964b017d8258b834e Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 1 Mar 2010 16:53:17 +0100 Subject: Make bindTextureFromNativePixmap use new QEgl APIs The old qt_chooseEGLConfigForPixmap & qt_createEGLSurfaceForPixmap code will remain until QX11GLPixmapData can be re-written properly. Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 8 +++----- src/gui/egl/qegl_p.h | 6 ++---- src/gui/egl/qegl_x11.cpp | 23 ++++++++++++++++++++--- src/gui/image/qpixmap_x11.cpp | 4 ++-- src/gui/image/qpixmap_x11_p.h | 9 +++++---- src/opengl/qgl_x11egl.cpp | 9 +++++++-- 6 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index e2002ed..1bfba10 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -88,10 +88,8 @@ bool QEglContext::isCurrent() const return current; } -EGLConfig QEgl::defaultConfig(QPaintDevice* device, API api, ConfigOptions options) +EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options) { - int devType = device->devType(); - if ( (devType != QInternal::Pixmap) && ((options & Renderable) == 0)) qWarning("QEgl::defaultConfig() - Only configs for pixmaps make sense to be read-only!"); @@ -243,8 +241,8 @@ EGLConfig QEgl::defaultConfig(QPaintDevice* device, API api, ConfigOptions optio #endif } - // Finally, set the color format based on the device: - configAttribs.setPaintDeviceFormat(device); + if (options & Translucent) + configAttribs.setValue(EGL_ALPHA_SIZE, 1); *targetConfig = chooseConfig(&configAttribs, QEgl::BestPixelFormat); return *targetConfig; diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 7f753d0..aa89772 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -116,10 +116,8 @@ namespace QEgl { enum ConfigOptions { - Opaque = 0x00, + NoOptions = 0, Translucent = 0x01, - - ReadOnly = 0x00, Renderable = 0x02 // Config will be compatable with the paint engines (VG or GL) }; @@ -127,7 +125,7 @@ namespace QEgl { // go through the eglChooseConfig loop every time, we use defaultConfig, which will return // the config for a particular device/api/option combo. This function assumes that once a // config is chosen for a particular combo, it's safe to always use that combo. - Q_GUI_EXPORT EGLConfig defaultConfig(QPaintDevice* device, API api, ConfigOptions options); + Q_GUI_EXPORT EGLConfig defaultConfig(int devType, API api, ConfigOptions options); Q_GUI_EXPORT EGLConfig chooseConfig(const QEglProperties* configAttribs, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); Q_GUI_EXPORT EGLSurface createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *surfaceAttribs = 0); diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index b710889..a4bfcac 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -361,9 +361,26 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg } if (x11PixmapData) { - VisualID currentVisualId = XVisualIDFromVisual((Visual*)qt_x11Info(device)->visual()); - if (visualId != currentVisualId) - qWarning("Error: The QPixmap's visual does not match the EGLConfig's visual!"); + // X11 Pixmaps are only created with a depth, so that's all we need to check + EGLint configDepth; + eglGetConfigAttrib(QEgl::display(), config, EGL_BUFFER_SIZE , &configDepth); + if (x11PixmapData->depth() != configDepth) { + // The bit depths are wrong which means the EGLConfig isn't compatable with + // this pixmap. So we need to replace the pixmap's existing data with a new + // one which is created with the correct depth: + +#ifndef QT_NO_XRENDER + if (configDepth == 32) { + qWarning("Warning: EGLConfig's depth (32) != pixmap's depth (%d), converting to ARGB32", + x11PixmapData->depth()); + x11PixmapData->convertToARGB32(true); + } else +#endif + { + qWarning("Warning: EGLConfig's depth (%d) != pixmap's depth (%d)", + configDepth, x11PixmapData->depth()); + } + } QEglProperties surfaceAttribs; diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index b976376..5a882af 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -314,8 +314,8 @@ static int qt_pixmap_serial = 0; int Q_GUI_EXPORT qt_x11_preferred_pixmap_depth = 0; QX11PixmapData::QX11PixmapData(PixelType type) - : QPixmapData(type, X11Class), hd(0), - flags(Uninitialized), x11_mask(0), picture(0), mask_picture(0), hd2(0), gl_surface(0), + : QPixmapData(type, X11Class), gl_surface(0), hd(0), + flags(Uninitialized), x11_mask(0), picture(0), mask_picture(0), hd2(0), share_mode(QPixmap::ImplicitlyShared), pengine(0) { } diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index 7bc586d..521a612 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -94,6 +94,11 @@ public: static Qt::HANDLE createBitmapFromImage(const QImage &image); + Qt::HANDLE gl_surface; +#ifndef QT_NO_XRENDER + void convertToARGB32(bool preserveContents = true); +#endif + protected: int metric(QPaintDevice::PaintDeviceMetric metric) const; @@ -131,10 +136,6 @@ private: Qt::HANDLE picture; Qt::HANDLE mask_picture; Qt::HANDLE hd2; // sorted in the default display depth - Qt::HANDLE gl_surface; -#ifndef QT_NO_XRENDER - void convertToARGB32(bool preserveContents = true); -#endif QPixmap::ShareMode share_mode; QX11PaintEngine *pengine; diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 18a2ee5..bcde8c4 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -508,8 +508,13 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons } if (pixmapData->gl_surface == 0) { - bool success = qt_createEGLSurfaceForPixmap(pixmapData, true); - if (!success) { + EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap, + QEgl::OpenGL, + hasAlpha ? QEgl::Translucent : QEgl::NoOptions); + + QPixmap tmpPixmap(pixmapData); //### + pixmapData->gl_surface = (Qt::HANDLE)QEgl::createSurface(&tmpPixmap, config); + if (pixmapData->gl_surface == (Qt::HANDLE)EGL_NO_SURFACE) { haveTFP = false; return 0; } -- cgit v0.12 From 5363237c164667aa38433eefe8646aafee328b59 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 2 Mar 2010 09:40:55 +0100 Subject: qdoc: Second attempt, QML doc stuff. This change caused a crash on several platforms before, but not on mine, of course. It outputs a list of new QML elements on the What's New in 4.7 page, and it outputs the "Inherited by" list on each QML elemnent page for elements that are inherited by other elements. I can't see why it should crash anything, but I have included some debug output. I think the crash might have something to do with QList, which qdoc3 uses heavily. If it crashes for you, please get a stack trace and the debug output. --- tools/qdoc3/cppcodeparser.cpp | 2 +- tools/qdoc3/generator.cpp | 29 +++++++++++++++++++++ tools/qdoc3/generator.h | 7 +++++ tools/qdoc3/htmlgenerator.cpp | 60 +++++++++++++++++++++++-------------------- tools/qdoc3/htmlgenerator.h | 2 ++ tools/qdoc3/node.cpp | 9 ++++--- tools/qdoc3/node.h | 6 ++--- 7 files changed, 79 insertions(+), 36 deletions(-) diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 021d64a..d9e9c3b 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -1034,7 +1034,7 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, else if (command == COMMAND_QMLINHERITS) { setLink(node, Node::InheritsLink, arg); if (node->subType() == Node::QmlClass) { - QmlClassNode::addInheritedBy(arg,node->name()); + QmlClassNode::addInheritedBy(arg,node); } } else if (command == COMMAND_QMLDEFAULT) { diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 6a8899a..40fd0e2 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1186,6 +1186,35 @@ void Generator::appendSortedNames(Text& text, } } +void Generator::appendSortedQmlNames(Text& text, + const Node* base, + const NodeList& subs, + CodeMarker *marker) +{ + NodeList::ConstIterator r; + QMap classMap; + int index = 0; + + qDebug() << "Generator::appendSortedQmlNames():" << base->name() << "is inherited by..."; + + r = subs.begin(); + while (r != subs.end()) { + Text t; + qDebug() << " " << (*r)->name(); + appendFullName(t, (*r), base, marker); + classMap[t.toString().toLower()] = t; + ++r; + } + + QStringList names = classMap.keys(); + names.sort(); + + foreach (const QString &name, names) { + text << classMap[name]; + text << separator(index++, names.count()); + } +} + int Generator::skipAtoms(const Atom *atom, Atom::Type type) const { int skipAhead = 0; diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 44f56e2..30d9af4 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -169,6 +169,13 @@ class Generator const QList &classes, CodeMarker *marker); + protected: + void appendSortedQmlNames(Text& text, + const Node* base, + const NodeList& subs, + CodeMarker *marker); + + private: QString amp; QString lt; QString gt; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index e767460..411a886 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -73,6 +73,7 @@ QString HtmlGenerator::sinceTitles[] = " New Typedefs", " New Properties", " New Variables", + " New QML Elements", " New Qml Properties", " New Qml Signals", " New Qml Methods", @@ -687,6 +688,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, nsmap = newSinceMaps.find(atom->string()); NewClassMaps::const_iterator ncmap; ncmap = newClassMaps.find(atom->string()); + NewClassMaps::const_iterator nqcmap; + nqcmap = newQmlClassMaps.find(atom->string()); if ((nsmap != newSinceMaps.constEnd()) && !nsmap.value().isEmpty()) { QList
sections; QList
::ConstIterator s; @@ -697,6 +700,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, while (n != nsmap.value().constEnd()) { const Node* node = n.value(); switch (node->type()) { + case Node::Fake: + if (node->subType() == Node::QmlClass) { + sections[QmlClass].appendMember((Node*)node); + //qDebug() << "HtmlGenerator::generateAtom(): Atom::SinceList, append" + // << node->name(); + } + break; case Node::Namespace: sections[Namespace].appendMember((Node*)node); break; @@ -782,6 +792,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "

" << protectEnc((*s).name) << "

\n"; if (idx == Class) generateCompactList(0, marker, ncmap.value(), QString("Q")); + else if (idx == QmlClass) + generateCompactList(0, marker, nqcmap.value(), QString("Q")); else if (idx == MemberFunction) { ParentMaps parentmaps; ParentMaps::iterator pmap; @@ -2332,7 +2344,11 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << ""; - QStringList pieces = fullName(it.value(), relative, marker).split("::"); + QStringList pieces; + if (it.value()->subType() == Node::QmlClass) + pieces << it.value()->name(); + else + pieces = fullName(it.value(), relative, marker).split("::"); out() << protectEnc(pieces.last()); out() << ""; if (pieces.size() > 1) { @@ -3723,6 +3739,9 @@ void HtmlGenerator::findAllSince(const InnerNode *node) NewClassMaps::iterator ncmap = newClassMaps.find(sinceVersion); if (ncmap == newClassMaps.end()) ncmap = newClassMaps.insert(sinceVersion,NodeMap()); + NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion); + if (nqcmap == newQmlClassMaps.end()) + nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap()); if ((*child)->type() == Node::Function) { FunctionNode *func = static_cast(*child); @@ -3742,6 +3761,16 @@ void HtmlGenerator::findAllSince(const InnerNode *node) nsmap.value().insert(className,(*child)); ncmap.value().insert(className,(*child)); } + else if ((*child)->subType() == Node::QmlClass) { + QString className = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + className = (*child)->parent()->name()+"::"+className; + nsmap.value().insert(className,(*child)); + nqcmap.value().insert(className,(*child)); + //qDebug() << "findAllSince(): insert" << className << sinceVersion; + } } else { QString name = (*child)->name(); @@ -4316,40 +4345,15 @@ void HtmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker) { if (cn) { - QStringList subs; + NodeList subs; QmlClassNode::subclasses(cn->name(),subs); if (!subs.isEmpty()) { - subs.sort(); Text text; text << Atom::ParaLeft << "Inherited by "; - for (int i = 0; i < subs.size(); ++i) { - text << subs.at(i); - text << separator(i, subs.size()); - } + appendSortedQmlNames(text,cn,subs,marker); text << Atom::ParaRight; generateText(text, cn, marker); } -#if 0 - if (cn->links().contains(Node::InheritsLink)) { - QPair linkPair; - linkPair = cn->links()[Node::InheritsLink]; - QStringList strList(linkPair.first); - const Node* n = myTree->findNode(strList,Node::Fake); - if (n && n->subType() == Node::QmlClass) { - const QmlClassNode* qcn = static_cast(n); - out() << "

"; - Text text; - text << "[Inherits "; - text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); - text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); - text << Atom(Atom::String, linkPair.second); - text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); - text << "]"; - generateText(text, cn, marker); - out() << "

"; - } - } -#endif } } diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 551bead..8fe0331 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -90,6 +90,7 @@ class HtmlGenerator : public PageGenerator Typedef, Property, Variable, + QmlClass, QmlProperty, QmlSignal, QmlMethod, @@ -326,6 +327,7 @@ class HtmlGenerator : public PageGenerator NewSinceMaps newSinceMaps; static QString sinceTitles[]; NewClassMaps newClassMaps; + NewClassMaps newQmlClassMaps; static int id; }; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 358fdd1..d2ffff5 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1257,7 +1257,7 @@ bool TargetNode::isInnerNode() const #ifdef QDOC_QML bool QmlClassNode::qmlOnly = false; -QMultiMap QmlClassNode::inheritedBy; +QMultiMap QmlClassNode::inheritedBy; /*! Constructs a Qml class node (i.e. a Fake node with the @@ -1302,15 +1302,16 @@ QString QmlClassNode::fileBase() const Record the fact that QML class \a base is inherited by QML class \a sub. */ -void QmlClassNode::addInheritedBy(const QString& base, const QString& sub) +void QmlClassNode::addInheritedBy(const QString& base, Node* sub) { + //qDebug() << "QmlClassNode::addInheritedBy(): insert" << base << sub->name(); inheritedBy.insert(base,sub); } /*! - Loads the list \a subs with the names of all the subclasses of \a base. + Loads the list \a subs with the nodes of all the subclasses of \a base. */ -void QmlClassNode::subclasses(const QString& base, QStringList& subs) +void QmlClassNode::subclasses(const QString& base, NodeList& subs) { subs.clear(); if (inheritedBy.contains(base)) diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index ae5dcd7..fd39698 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -383,12 +383,12 @@ class QmlClassNode : public FakeNode const ClassNode* classNode() const { return cnode; } virtual QString fileBase() const; - static void addInheritedBy(const QString& base, const QString& sub); - static void subclasses(const QString& base, QStringList& subs); + static void addInheritedBy(const QString& base, Node* sub); + static void subclasses(const QString& base, NodeList& subs); public: static bool qmlOnly; - static QMultiMap inheritedBy; + static QMultiMap inheritedBy; private: const ClassNode* cnode; -- cgit v0.12 From d0c4433ca1aabab1a8fac1aae2ba65f25dae5f85 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 2 Mar 2010 10:19:21 +0100 Subject: doc: Fixed some qdoc errors. --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 +- src/network/bearer/qnetworksession.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index f48c761..5014fd8 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1172,7 +1172,7 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec See the \l {Keys}{Keys} attached property for detailed documentation. - \section 1 Property Change Signals + \section1 Property Change Signals Most properties on Item and Item derivatives have a signal emitted when they change. By convention, the signals are diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index f0d7ede..047c8d3 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -527,7 +527,7 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const \a key. Removing an already set property can be achieved by passing an invalid QVariant. - Note that the \i UserChoiceConfiguration and \i ActiveConfiguration + Note that the \e UserChoiceConfiguration and \e ActiveConfiguration properties are read only and cannot be changed using this method. */ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value) -- cgit v0.12 From f1412745126db129445a368525f7ec05b20a0885 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 2 Mar 2010 18:45:02 +1000 Subject: Empty URL test --- src/declarative/qml/qdeclarativecomponent.cpp | 7 ++ tests/auto/declarative/declarative.pro | 1 + .../qdeclarativecomponent.pro | 8 +++ .../tst_qdeclarativecomponent.cpp | 75 ++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro create mode 100644 tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 6a2d2d1..d6bb216 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -437,6 +437,13 @@ void QDeclarativeComponent::loadUrl(const QUrl &url) else d->url = url; + if (url.isEmpty()) { + QDeclarativeError error; + error.setDescription(tr("Invalid empty URL")); + d->state.errors << error; + return; + } + QDeclarativeCompositeTypeData *data = QDeclarativeEnginePrivate::get(d->engine)->typeManager.get(d->url); diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 42ff523..4ee6d8c 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -7,6 +7,7 @@ SUBDIRS += \ qdeclarativeanimations \ # Cover qdeclarativebehaviors \ # Cover qdeclarativebinding \ # Cover + qdeclarativecomponent \ # Cover qdeclarativeconnection \ # Cover qdeclarativecontext \ # Cover qdeclarativedatetimeformatter \ # Cover diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro new file mode 100644 index 0000000..c7affb7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += script network +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativecomponent.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp new file mode 100644 index 0000000..c9e304c --- /dev/null +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include +#include + +class tst_qdeclarativecomponent : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativecomponent() { } + +private slots: + void loadEmptyUrl(); + +private: + QDeclarativeEngine engine; +}; + +void tst_qdeclarativecomponent::loadEmptyUrl() +{ + QDeclarativeComponent c(&engine); + c.loadUrl(QUrl()); + + QVERIFY(c.isError()); + QCOMPARE(c.errors().count(), 1); + QDeclarativeError error = c.errors().first(); + QCOMPARE(error.url(), QUrl()); + QCOMPARE(error.line(), -1); + QCOMPARE(error.column(), -1); + QCOMPARE(error.description(), QLatin1String("Invalid empty URL")); +} + +QTEST_MAIN(tst_qdeclarativecomponent) + +#include "tst_qdeclarativecomponent.moc" -- cgit v0.12 From 3b8cad8be96d7791e8ca8305609d1155ec093b80 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 2 Mar 2010 19:35:30 +1000 Subject: Don't return QDeclarativeDeclarativeData for a deleting object This was causing crashes in the qmldesigner. --- src/declarative/qml/qdeclarativedeclarativedata_p.h | 5 ++++- src/declarative/qml/qdeclarativeengine_p.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h index 2c92419..a7a73bc 100644 --- a/src/declarative/qml/qdeclarativedeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h @@ -103,7 +103,10 @@ public: static QDeclarativeDeclarativeData *get(const QObject *object, bool create = false) { QObjectPrivate *priv = QObjectPrivate::get(const_cast(object)); - if (priv->declarativeData) { + if (priv->wasDeleted) { + Q_ASSERT(!create); + return 0; + } else if (priv->declarativeData) { return static_cast(priv->declarativeData); } else if (create) { priv->declarativeData = new QDeclarativeDeclarativeData; diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 0359f98..d3eb583 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -238,7 +238,8 @@ public: QHash propertyCache; QDeclarativePropertyCache *cache(QObject *obj) { Q_Q(QDeclarativeEngine); - if (!obj || QObjectPrivate::get(obj)->metaObject) return 0; + if (!obj || QObjectPrivate::get(obj)->metaObject || + QObjectPrivate::get(obj)->wasDeleted) return 0; const QMetaObject *mo = obj->metaObject(); QDeclarativePropertyCache *rv = propertyCache.value(mo); if (!rv) { -- cgit v0.12 From 6e84a270c94376d24392d797f99bc7e95b217a34 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 2 Mar 2010 19:48:54 +1000 Subject: Add "on" syntax to QmlChanges.txt --- src/declarative/QmlChanges.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index c312abf..4951cb3 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -53,6 +53,16 @@ matchProperties and matchTargets have been renamed back to properties and target The semantics are explained in the PropertyAnimation::properties documentation and the animation overview documentation. +Behavior and Animation syntax +----------------------------- + +Previously animations and behaviors could be "assigned" to properties like this: + Item { x: Behavior {}; y: NumberAnimation {} } +To make it more obvious that these are not regular value assignments a new "on" +syntax has been introduced: + Item { Behavior on x {}; NumberAnimation on y {} } +Only the syntax has changed, the behavior is identical. + ============================================================================= The changes below are pre-4.6.0 release. -- cgit v0.12 From 340eb4f20a5976be77ee66bbfc2ef16c97b033d2 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 1 Mar 2010 14:43:24 +0100 Subject: replace temporary disconnection with a very simple statemachine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this also fixes an issue with non-constant ordering of connections to document's contentsChange() signal Merge-request: 481 Reviewed-by: Thorbjørn Lindeijer --- src/gui/text/qsyntaxhighlighter.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 6750c09..9b3671d 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -59,23 +59,24 @@ class QSyntaxHighlighterPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QSyntaxHighlighter) public: - inline QSyntaxHighlighterPrivate() : rehighlightPending(false) {} + inline QSyntaxHighlighterPrivate() + : rehighlightPending(false), inReformatBlocks(false) + {} QPointer doc; void _q_reformatBlocks(int from, int charsRemoved, int charsAdded); + void reformatBlocks(int from, int charsRemoved, int charsAdded); void reformatBlock(QTextBlock block); inline void rehighlight(QTextCursor &cursor, QTextCursor::MoveOperation operation) { - QObject::disconnect(doc, SIGNAL(contentsChange(int,int,int)), - q_func(), SLOT(_q_reformatBlocks(int,int,int))); + inReformatBlocks = true; cursor.beginEditBlock(); int from = cursor.position(); cursor.movePosition(operation); - _q_reformatBlocks(from, 0, cursor.position() - from); + reformatBlocks(from, 0, cursor.position() - from); cursor.endEditBlock(); - QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), - q_func(), SLOT(_q_reformatBlocks(int,int,int))); + inReformatBlocks = false; } inline void _q_delayedRehighlight() { @@ -90,6 +91,7 @@ public: QVector formatChanges; QTextBlock currentBlock; bool rehighlightPending; + bool inReformatBlocks; }; void QSyntaxHighlighterPrivate::applyFormatChanges() @@ -162,6 +164,12 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded) { + if (!inReformatBlocks) + reformatBlocks(from, charsRemoved, charsAdded); +} + +void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded) +{ Q_UNUSED(charsRemoved); rehighlightPending = false; -- cgit v0.12 From 6d51c7b9d1f6700564ec9e3c3f7b41b6b94a74da Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 1 Mar 2010 14:43:26 +0100 Subject: don't cancel the scheduled complete rehighlight from rehighlightBlock() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if rehighlightBlock() is called just after setDocument() then it is possible that reformatBlocks() will be called just before q_delayedRehighlight() and thus will prevent previously scheduled complete rehighlighting. Merge-request: 481 Reviewed-by: Thorbjørn Lindeijer --- src/gui/text/qsyntaxhighlighter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 9b3671d..b5a7aa1 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -402,8 +402,13 @@ void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) if (!d->doc) return; + const bool rehighlightPending = d->rehighlightPending; + QTextCursor cursor(block); d->rehighlight(cursor, QTextCursor::EndOfBlock); + + if (rehighlightPending) + d->rehighlightPending = rehighlightPending; } /*! -- cgit v0.12 From 667ef5950bc16ff8582ac32f5150fc9f45a09682 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 1 Mar 2010 14:43:28 +0100 Subject: don't even try to rehighlight invalid or alien block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 481 Reviewed-by: Thorbjørn Lindeijer --- src/gui/text/qsyntaxhighlighter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index b5a7aa1..de16ca5 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -399,7 +399,7 @@ void QSyntaxHighlighter::rehighlight() void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) { Q_D(QSyntaxHighlighter); - if (!d->doc) + if (!d->doc || !block.isValid() || block.document() != d->doc) return; const bool rehighlightPending = d->rehighlightPending; -- cgit v0.12 From 24c5bc6c0c5c23d808f055dabefd15a551cb0902 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 1 Mar 2010 14:43:30 +0100 Subject: minor clean-ups and styling fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 481 Reviewed-by: Thorbjørn Lindeijer --- src/gui/text/qsyntaxhighlighter.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index de16ca5..02dabbb 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -67,8 +67,8 @@ public: void _q_reformatBlocks(int from, int charsRemoved, int charsAdded); void reformatBlocks(int from, int charsRemoved, int charsAdded); - void reformatBlock(QTextBlock block); - + void reformatBlock(const QTextBlock &block); + inline void rehighlight(QTextCursor &cursor, QTextCursor::MoveOperation operation) { inReformatBlocks = true; cursor.beginEditBlock(); @@ -84,7 +84,6 @@ public: return; rehighlightPending = false; q_func()->rehighlight(); - return; } void applyFormatChanges(); @@ -106,10 +105,11 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() QList::Iterator it = ranges.begin(); while (it != ranges.end()) { if (it->start >= preeditAreaStart - && it->start + it->length <= preeditAreaStart + preeditAreaLength) + && it->start + it->length <= preeditAreaStart + preeditAreaLength) { ++it; - else + } else { it = ranges.erase(it); + } } QTextCharFormat emptyFormat; @@ -137,11 +137,10 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() r.length = i - r.start; - if (r.start >= preeditAreaStart) { + if (r.start >= preeditAreaStart) r.start += preeditAreaLength; - } else if (r.start + r.length >= preeditAreaStart) { + else if (r.start + r.length >= preeditAreaStart) r.length += preeditAreaLength; - } ranges << r; r.start = r.length = -1; @@ -150,11 +149,10 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() if (r.start != -1) { r.length = formatChanges.count() - r.start; - if (r.start >= preeditAreaStart) { + if (r.start >= preeditAreaStart) r.start += preeditAreaLength; - } else if (r.start + r.length >= preeditAreaStart) { + else if (r.start + r.length >= preeditAreaStart) r.length += preeditAreaLength; - } ranges << r; } @@ -170,7 +168,6 @@ void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, in void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded) { - Q_UNUSED(charsRemoved); rehighlightPending = false; QTextBlock block = doc->findBlock(from); @@ -199,7 +196,7 @@ void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int c formatChanges.clear(); } -void QSyntaxHighlighterPrivate::reformatBlock(QTextBlock block) +void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block) { Q_Q(QSyntaxHighlighter); @@ -357,8 +354,8 @@ void QSyntaxHighlighter::setDocument(QTextDocument *doc) if (d->doc) { connect(d->doc, SIGNAL(contentsChange(int,int,int)), this, SLOT(_q_reformatBlocks(int,int,int))); - QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight())); d->rehighlightPending = true; + QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight())); } } @@ -473,7 +470,6 @@ void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) void QSyntaxHighlighter::setFormat(int start, int count, const QTextCharFormat &format) { Q_D(QSyntaxHighlighter); - if (start < 0 || start >= d->formatChanges.count()) return; @@ -641,7 +637,7 @@ QTextBlockUserData *QSyntaxHighlighter::currentBlockUserData() const \since 4.4 Returns the current text block. - */ +*/ QTextBlock QSyntaxHighlighter::currentBlock() const { Q_D(const QSyntaxHighlighter); -- cgit v0.12 From b49eaedbe81011483ce52af71e9ebf29c61cef43 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 1 Mar 2010 14:43:33 +0100 Subject: remove unused code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 481 Reviewed-by: Thorbjørn Lindeijer --- src/gui/text/qsyntaxhighlighter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 02dabbb..1dc8e23 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -203,7 +203,6 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block) Q_ASSERT_X(!currentBlock.isValid(), "QSyntaxHighlighter::reformatBlock()", "reFormatBlock() called recursively"); currentBlock = block; - QTextBlock previous = block.previous(); formatChanges.fill(QTextCharFormat(), block.length() - 1); q->highlightBlock(block.text()); -- cgit v0.12 From b7a79ea08be3e127058be549ed354d6276e32e0f Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 1 Mar 2010 14:43:35 +0100 Subject: minor optimization: ignore invalid preeditAreaPosition/preeditAreaText MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 481 Reviewed-by: Thorbjørn Lindeijer --- src/gui/text/qsyntaxhighlighter.cpp | 40 +++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 1dc8e23..d3db2a1 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -102,20 +102,22 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() const int preeditAreaStart = layout->preeditAreaPosition(); const int preeditAreaLength = layout->preeditAreaText().length(); - QList::Iterator it = ranges.begin(); - while (it != ranges.end()) { - if (it->start >= preeditAreaStart - && it->start + it->length <= preeditAreaStart + preeditAreaLength) { - ++it; - } else { - it = ranges.erase(it); + if (preeditAreaLength != 0) { + QList::Iterator it = ranges.begin(); + while (it != ranges.end()) { + if (it->start >= preeditAreaStart + && it->start + it->length <= preeditAreaStart + preeditAreaLength) { + ++it; + } else { + it = ranges.erase(it); + } } } QTextCharFormat emptyFormat; QTextLayout::FormatRange r; - r.start = r.length = -1; + r.start = -1; int i = 0; while (i < formatChanges.count()) { @@ -137,22 +139,26 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() r.length = i - r.start; - if (r.start >= preeditAreaStart) - r.start += preeditAreaLength; - else if (r.start + r.length >= preeditAreaStart) - r.length += preeditAreaLength; + if (preeditAreaLength != 0) { + if (r.start >= preeditAreaStart) + r.start += preeditAreaLength; + else if (r.start + r.length >= preeditAreaStart) + r.length += preeditAreaLength; + } ranges << r; - r.start = r.length = -1; + r.start = -1; } if (r.start != -1) { r.length = formatChanges.count() - r.start; - if (r.start >= preeditAreaStart) - r.start += preeditAreaLength; - else if (r.start + r.length >= preeditAreaStart) - r.length += preeditAreaLength; + if (preeditAreaLength != 0) { + if (r.start >= preeditAreaStart) + r.start += preeditAreaLength; + else if (r.start + r.length >= preeditAreaStart) + r.length += preeditAreaLength; + } ranges << r; } -- cgit v0.12 From 62faec229dfe654872d3791bee0a27e5290fff4c Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 1 Mar 2010 14:43:37 +0100 Subject: minor optimization: don't mark contents as dirty if nothing was changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 481 Reviewed-by: Thorbjørn Lindeijer --- src/gui/text/qsyntaxhighlighter.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index d3db2a1..28af5bb 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -95,6 +95,8 @@ public: void QSyntaxHighlighterPrivate::applyFormatChanges() { + bool formatsChanged = false; + QTextLayout *layout = currentBlock.layout(); QList ranges = layout->additionalFormats(); @@ -110,6 +112,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() ++it; } else { it = ranges.erase(it); + formatsChanged = true; } } } @@ -147,6 +150,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() } ranges << r; + formatsChanged = true; r.start = -1; } @@ -161,9 +165,13 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() } ranges << r; + formatsChanged = true; } - layout->setAdditionalFormats(ranges); + if (formatsChanged) { + layout->setAdditionalFormats(ranges); + doc->markContentsDirty(currentBlock.position(), currentBlock.length()); + } } void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded) @@ -214,8 +222,6 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block) q->highlightBlock(block.text()); applyFormatChanges(); - doc->markContentsDirty(block.position(), block.length()); - currentBlock = QTextBlock(); } -- cgit v0.12 From 0998fc069512d0ae2853929489b80f35e0d9d4ae Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 2 Mar 2010 11:23:45 +0100 Subject: QDeclarativeView: Make usable in Designer Make source a designable property, add missing declarations for enumerations. Reviewed-by: akennedy --- src/declarative/util/qdeclarativeview.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index 03d8db3..107f3f9 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -43,6 +43,7 @@ #define QDECLARATIVEVIEW_H #include +#include #include #include #include @@ -64,7 +65,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeView : public QGraphicsView Q_OBJECT Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) Q_PROPERTY(Status status READ status NOTIFY statusChanged) - + Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true) + Q_ENUMS(ResizeMode Status) public: explicit QDeclarativeView(QWidget *parent = 0); QDeclarativeView(const QUrl &source, QWidget *parent = 0); -- cgit v0.12 From 13f23b71cee682ccaaec455d72b1578afc2800ee Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 2 Mar 2010 11:25:16 +0100 Subject: QDeclarativeView: Add a Designer plugin. Reviewed-by: Jarek Kobus Acked-by: akennedy --- tools/designer/src/plugins/plugins.pro | 1 + .../plugins/qdeclarativeview/qdeclarativeview.pro | 13 ++ .../qdeclarativeview/qdeclarativeview_plugin.cpp | 132 +++++++++++++++++++++ .../qdeclarativeview/qdeclarativeview_plugin.h | 74 ++++++++++++ 4 files changed, 220 insertions(+) create mode 100644 tools/designer/src/plugins/qdeclarativeview/qdeclarativeview.pro create mode 100644 tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp create mode 100644 tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.h diff --git a/tools/designer/src/plugins/plugins.pro b/tools/designer/src/plugins/plugins.pro index baf5261..cf4fa8a 100644 --- a/tools/designer/src/plugins/plugins.pro +++ b/tools/designer/src/plugins/plugins.pro @@ -7,3 +7,4 @@ win32:!contains(QT_EDITION, OpenSource):SUBDIRS += activeqt # contains(QT_CONFIG, opengl): SUBDIRS += tools/view3d contains(QT_CONFIG, webkit): SUBDIRS += qwebview contains(QT_CONFIG, phonon): SUBDIRS += phononwidgets +contains(QT_CONFIG, declarative): SUBDIRS += qdeclarativeview diff --git a/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview.pro b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview.pro new file mode 100644 index 0000000..b8abe87 --- /dev/null +++ b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview.pro @@ -0,0 +1,13 @@ +TEMPLATE = lib +TARGET = qdeclarativeview +CONFIG += qt warn_on plugin designer +QT += declarative + +include(../plugins.pri) +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} + +SOURCES += qdeclarativeview_plugin.cpp +HEADERS += qdeclarativeview_plugin.h diff --git a/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp new file mode 100644 index 0000000..b352a9b --- /dev/null +++ b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativeview_plugin.h" + +#include +#include + +#include +#include + +static const char toolTipC[] = "QtDeclarative view widget"; + +QT_BEGIN_NAMESPACE + +QDeclarativeViewPlugin::QDeclarativeViewPlugin(QObject *parent) : + QObject(parent), + m_initialized(false) +{ +} + +QString QDeclarativeViewPlugin::name() const +{ + return QLatin1String("QDeclarativeView"); +} + +QString QDeclarativeViewPlugin::group() const +{ + return QLatin1String("Display Widgets"); +} + +QString QDeclarativeViewPlugin::toolTip() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString QDeclarativeViewPlugin::whatsThis() const +{ + return QString(QLatin1String(toolTipC)); +} + +QString QDeclarativeViewPlugin::includeFile() const +{ + return QLatin1String("QtDeclarative/QDeclarativeView"); +} + +QIcon QDeclarativeViewPlugin::icon() const +{ + return QIcon(); +} + +bool QDeclarativeViewPlugin::isContainer() const +{ + return false; +} + +QWidget *QDeclarativeViewPlugin::createWidget(QWidget *parent) +{ + return new QDeclarativeView(parent); +} + +bool QDeclarativeViewPlugin::isInitialized() const +{ + return m_initialized; +} + +void QDeclarativeViewPlugin::initialize(QDesignerFormEditorInterface * /*core*/) +{ + if (m_initialized) + return; + + m_initialized = true; +} + +QString QDeclarativeViewPlugin::domXml() const +{ + return QLatin1String("\ + \ + \ + \ + \ + 0\ + 0\ + 300\ + 200\ + \ + \ + \ + "); +} + +Q_EXPORT_PLUGIN2(customwidgetplugin, QDeclarativeViewPlugin) + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.h b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.h new file mode 100644 index 0000000..2f13f16 --- /dev/null +++ b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEVIEW_PLUGIN_H +#define QDECLARATIVEVIEW_PLUGIN_H + +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeViewPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + QDeclarativeViewPlugin(QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + bool m_initialized; +}; + +QT_END_NAMESPACE + +#endif // QDECLARATIVEVIEW_PLUGIN_H -- cgit v0.12 From 7366200d7600271c86144e70ae59ce77f39b2a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 15 Feb 2010 14:06:32 +0100 Subject: Implement alien widgets on Mac/Cocoa. This commit makes alien widgets opt in on a per-widget basis on Mac, set the Qt::WA_NativeWindow flag when creating the widget to enable. Setting this flag on widgets that have native child or sibling NSViews is not supported. The main use case for alien widgets on Mac is to improve performance for applications that have complex user interfaces. Qt can handle thousands of widgets per window, while Cocoa is designed to use a smaller number of NSViews in combination with NSCells and custom control implementations. This commit moves us in the direction of having a few main NSViews with "leaf" qwidgets implemented as a custom control. --- src/gui/kernel/qapplication.cpp | 8 ++---- src/gui/kernel/qapplication_mac.mm | 3 +- src/gui/kernel/qapplication_p.h | 2 +- src/gui/kernel/qcocoaview_mac.mm | 25 +++++++++++++++++ src/gui/kernel/qt_cocoa_helpers_mac.mm | 39 +++++++++++++++++++++++--- src/gui/kernel/qwidget.cpp | 43 +++++++++++++++++++++++++---- src/gui/kernel/qwidget_mac.mm | 50 ++++++++++++++++++++++++++-------- src/gui/kernel/qwidget_p.h | 1 + src/gui/widgets/qmainwindow.cpp | 3 +- 9 files changed, 145 insertions(+), 29 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 4ec2ae2..203f637 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -498,9 +498,7 @@ inline bool QApplicationPrivate::isAlien(QWidget *widget) { if (!widget) return false; -#if defined(Q_WS_MAC) // Fake alien behavior on the Mac :) - return !widget->isWindow() && widget->window()->testAttribute(Qt::WA_DontShowOnScreen); -#elif defined(Q_WS_QWS) +#if defined(Q_WS_QWS) return !widget->isWindow() # ifdef Q_BACKINGSTORE_SUBSURFACES && !(widget->d_func()->maybeTopData() && widget->d_func()->maybeTopData()->windowSurface) @@ -3013,7 +3011,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, return result; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_MAC) /* This function should only be called when the widget changes visibility, i.e. when the \a widget is shown, hidden or deleted. This function does nothing @@ -3073,7 +3071,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver); #endif // QT_NO_CURSOR } -#endif // Q_WS_WIN || Q_WS_X11 +#endif // Q_WS_WIN || Q_WS_X11 || Q_WS_MAC /*! Returns the desktop widget (also called the root window). diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index babfc72..c7d0e48 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -184,7 +184,8 @@ bool qt_mac_app_fullscreen = false; bool qt_scrollbar_jump_to_pos = false; static bool qt_mac_collapse_on_dblclick = true; extern int qt_antialiasing_threshold; // from qapplication.cpp -QPointer qt_button_down; // widget got last button-down +QWidget * qt_button_down; // widget got last button-down +QPointer qt_last_mouse_receiver; #ifndef QT_MAC_USE_COCOA static bool qt_button_down_in_content; // whether the button_down was in the content area. static bool qt_mac_previous_press_in_popup_mode = false; diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index e0a6103..8653dec 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -514,7 +514,7 @@ public: int symbianResourceChange(const QSymbianEvent *symbianEvent); #endif -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) void sendSyntheticEnterLeave(QWidget *widget); #endif diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 6a16403..a1dcc2a 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -185,6 +185,9 @@ extern "C" { extern NSString *NSTextInputReplacementRangeAttributeName; } +#ifdef ALIEN_DEBUG +static int qCocoaViewCount = 0; +#endif @implementation QT_MANGLE_NAMESPACE(QCocoaView) @@ -195,6 +198,12 @@ extern "C" { [self finishInitWithQWidget:widget widgetPrivate:widgetprivate]; } composingText = new QString(); + +#ifdef ALIEN_DEBUG + ++qCocoaViewCount; + qDebug() << "init: qCocoaViewCount is" << qCocoaViewCount; +#endif + composing = false; sendKeyEvents = true; [self setHidden:YES]; @@ -414,6 +423,12 @@ extern "C" { { delete composingText; [[NSNotificationCenter defaultCenter] removeObserver:self]; + +#ifdef ALIEN_DEBUG + --qCocoaViewCount; + qDebug() << "qCocoaViewCount is" << qCocoaViewCount; +#endif + [super dealloc]; } @@ -523,6 +538,10 @@ extern "C" { CGContextClearRect(cg, NSRectToCGRect(aRect)); } + // Check for alien widgets, use qwidgetPrivate->drawWidget() to draw the widget if this + // is the case. This makes sure child widgets are drawn as well, Cocoa does not know about + // those and wont send them drawRect calls. + if (qwidget->testAttribute(Qt::WA_NativeWindow) && qt_widget_private(qwidget)->hasAlienChildren == false) { if (engine && !qwidget->testAttribute(Qt::WA_NoSystemBackground) && (qwidget->isWindow() || qwidget->autoFillBackground()) || qwidget->testAttribute(Qt::WA_TintedBackground) @@ -542,6 +561,12 @@ extern "C" { e.setErased(true); #endif qt_sendSpontaneousEvent(qwidget, &e); + } else { + qwidget->setAttribute(Qt::WA_WState_InPaintEvent, false); // QWidgetPrivate::drawWidget sets this + QWidgetPrivate *qwidgetPrivate = qt_widget_private(qwidget); + qwidgetPrivate->drawWidget(qwidget, qrgn, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen | QWidgetPrivate::DrawRecursive, 0); + } + if (!redirectionOffset.isNull()) QPainter::restoreRedirected(qwidget); if (engine) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 9560952..19bae5a 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -139,7 +139,7 @@ void QMacWindowFader::performFade() extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // qapplication.cpp; extern QWidget * mac_mouse_grabber; -extern QPointer qt_button_down; //qapplication_mac.cpp +extern QWidget *qt_button_down; //qapplication_mac.cpp void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds) { @@ -686,6 +686,12 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve if ([event type] == NSKeyDown) { qt_keymapper_private()->updateKeyMap(0, key_event, 0); } + + // Redirect keys to alien widgets. + if (widgetToGetEvent->testAttribute(Qt::WA_NativeWindow) == false) { + widgetToGetEvent = qApp->focusWidget(); + } + if (widgetToGetEvent == 0) return false; @@ -940,7 +946,7 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev [static_cast(tmpView) qt_qwidget]; } } else { - extern QPointer qt_button_down; //qapplication_mac.cpp + extern QWidget * qt_button_down; //qapplication_mac.cpp QPoint pos; widgetToGetMouse = QApplicationPrivate::pickMouseReceiver(qwidget, qglobalPoint, pos, eventType, @@ -952,7 +958,20 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev return false; NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil]; - QPoint qlocalPoint(localPoint.x, localPoint.y); + QPoint qlocalPoint = QPoint(localPoint.x, localPoint.y); + + // Search for alien child widgets (either on this qwidget or on the popup) + if (widgetToGetMouse->testAttribute(Qt::WA_NativeWindow) == false || qt_widget_private(widgetToGetMouse)->hasAlienChildren) { + QPoint qScreenPoint = flipPoint(globalPoint).toPoint(); +#ifdef ALIEN_DEBUG + qDebug() << "alien mouse event" << qScreenPoint << possibleAlien; +#endif + QWidget *possibleAlien = widgetToGetMouse->childAt(qlocalPoint); + if (possibleAlien) { + qlocalPoint = possibleAlien->mapFromGlobal(widgetToGetMouse->mapToGlobal(qlocalPoint)); + widgetToGetMouse = possibleAlien; + } + } EventRef carbonEvent = static_cast(const_cast([theEvent eventRef])); if (qt_mac_sendMacEventToWidget(widgetToGetMouse, carbonEvent)) @@ -997,7 +1016,19 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev } [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->localPoint = localPoint; QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, buttons, keyMods); - qt_sendSpontaneousEvent(widgetToGetMouse, &qme); + +#ifdef ALIEN_DEBUG + qDebug() << "sending mouse event to" << widgetToGetMouse; +#endif + extern QWidget *qt_button_down; + extern QPointer qt_last_mouse_receiver; + + if (qwidget->testAttribute(Qt::WA_NativeWindow) && qt_widget_private(qwidget)->hasAlienChildren == false) + qt_sendSpontaneousEvent(widgetToGetMouse, &qme); + else + QApplicationPrivate::sendMouseEvent(widgetToGetMouse, &qme, widgetToGetMouse, qwidget, &qt_button_down, + qt_last_mouse_receiver); + if (eventType == QEvent::MouseButtonPress && button == Qt::RightButton) { QContextMenuEvent qcme(QContextMenuEvent::Mouse, qlocalPoint, qglobalPoint, keyMods); qt_sendSpontaneousEvent(widgetToGetMouse, &qcme); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2f6ec6b..b19d541 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -205,6 +205,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , nativeGesturePanEnabled(0) #elif defined(Q_WS_MAC) , needWindowChange(0) + , hasAlienChildren(0) , window_event(0) , qd_hd(0) #endif @@ -1168,6 +1169,10 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) if (f & Qt::MSWindowsOwnDC) q->setAttribute(Qt::WA_NativeWindow); +#ifdef Q_WS_MAC + q->setAttribute(Qt::WA_NativeWindow); +#endif + q->setAttribute(Qt::WA_QuitOnClose); // might be cleared in adjustQuitOnCloseAttribute() adjustQuitOnCloseAttribute(); @@ -1263,6 +1268,10 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) } if (QWidget *parent = parentWidget()) { +#ifdef Q_WS_MAC + if (testAttribute(Qt::WA_NativeWindow) == false) + parent->d_func()->hasAlienChildren = true; +#endif if (type & Qt::Window) { if (!parent->testAttribute(Qt::WA_WState_Created)) parent->createWinId(); @@ -1433,7 +1442,7 @@ QWidget::~QWidget() } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); #ifdef Q_WS_QWS @@ -2306,6 +2315,9 @@ QWidget *QWidget::find(WId id) WId QWidget::winId() const { if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) { +#ifdef ALIEN_DEBUG + qDebug() << "QWidget::winId: creating native window for" << this; +#endif QWidget *that = const_cast(this); that->setAttribute(Qt::WA_NativeWindow); that->d_func()->createWinId(); @@ -2318,6 +2330,10 @@ WId QWidget::winId() const void QWidgetPrivate::createWinId(WId winid) { Q_Q(QWidget); + +#ifdef ALIEN_DEBUG + qDebug() << "QWidgetPrivate::createWinId for" << q << winid; +#endif const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow); if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) { if (!q->isWindow()) { @@ -2360,6 +2376,9 @@ Ensures that the widget has a window system identifier, i.e. that it is known to void QWidget::createWinId() { Q_D(QWidget); +#ifdef ALIEN_DEBUG + qDebug() << "QWidget::createWinId" << this; +#endif // qWarning("QWidget::createWinId is obsolete, please fix your code."); d->createWinId(); } @@ -5249,7 +5268,15 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QPaintEngine *paintEngine = pdev->paintEngine(); if (paintEngine) { setRedirected(pdev, -offset); +#ifdef Q_WS_MAC + // (Alien support) Special case for Mac when redirecting: If the paint device + // is of the Widget type we need to set WA_WState_InPaintEvent since painting + // outside the paint event is not supported on QWidgets. The attributeis + // restored further down. + if (pdev->devType() == QInternal::Widget) + static_cast(pdev)->setAttribute(Qt::WA_WState_InPaintEvent); +#endif if (sharedPainter) paintEngine->d_func()->systemClip = toBePainted; else @@ -5290,6 +5317,10 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP //restore if (paintEngine) { +#ifdef Q_WS_MAC + if (pdev->devType() == QInternal::Widget) + static_cast(pdev)->setAttribute(Qt::WA_WState_InPaintEvent, false); +#endif restoreRedirected(); if (!sharedPainter) paintEngine->d_func()->systemRect = QRect(); @@ -7322,7 +7353,7 @@ void QWidgetPrivate::hide_helper() // next bit tries to move the focus if the focus widget is now // hidden. if (wasVisible) { -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) qApp->d_func()->sendSyntheticEnterLeave(q); #endif @@ -7454,7 +7485,7 @@ void QWidget::setVisible(bool visible) d->show_helper(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) qApp->d_func()->sendSyntheticEnterLeave(this); #endif } @@ -7569,7 +7600,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) widget->d_func()->hide_sys(); } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) qApp->d_func()->sendSyntheticEnterLeave(widget); #endif #ifndef QT_NO_ACCESSIBILITY @@ -9787,7 +9818,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) desktopWidget = parent; bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget; -#if defined(Q_WS_X11) || defined(Q_WS_WIN) +#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC) if (newParent && parent && !desktopWidget) { if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)) parent->d_func()->enforceNativeChildren(); @@ -10433,7 +10464,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } case Qt::WA_PaintOnScreen: d->updateIsOpaque(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) // Recreate the widget if it's already created as an alien widget and // WA_PaintOnScreen is enabled. Paint on screen widgets must have win id. // So must their children. diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index dcb87fc..6d8c97b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -459,7 +459,13 @@ static bool qt_isGenuineQWidget(OSViewRef ref) bool qt_isGenuineQWidget(const QWidget *window) { - return window && qt_isGenuineQWidget(OSViewRef(window->winId())); + if (!window) + return false; + + if (!window->internalWinId()) + return true; //alien + + return qt_isGenuineQWidget(OSViewRef(window->internalWinId())); } Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget *w) @@ -2608,7 +2614,16 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } } else { data.fstrut_dirty = false; // non-toplevel widgets don't have a frame, so no need to update the strut - if(OSViewRef osview = qt_mac_create_widget(q, this, qt_mac_nativeview_for(parentWidget))) { + +#ifdef QT_MAC_USE_COCOA + if (q->testAttribute(Qt::WA_NativeWindow) == false || + q->internalWinId() != 0) { +#ifdef ALIEN_DEBUG + qDebug() << "Skipping native widget creation for" << this; +#endif + } else +#endif + if (OSViewRef osview = qt_mac_create_widget(q, this, qt_mac_nativeview_for(parentWidget))) { #ifndef QT_MAC_USE_COCOA HIRect bounds = CGRectMake(data.crect.x(), data.crect.y(), data.crect.width(), data.crect.height()); HIViewSetFrame(osview, &bounds); @@ -2869,9 +2884,12 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) q->setAttribute(Qt::WA_WState_Visible, false); q->setAttribute(Qt::WA_WState_Hidden, false); adjustFlags(data.window_flags, q); - // keep compatibility with previous versions, we need to preserve the created state - // (but we recreate the winId for the widget being reparented, again for compatibility) - if (wasCreated || (!q->isWindow() && parent->testAttribute(Qt::WA_WState_Created))) { + // keep compatibility with previous versions, we need to preserve the created state. + // (but we recreate the winId for the widget being reparented, again for compatibility, + // unless this is an alien widget. ) + const bool nonWindowWithCreatedParent = !q->isWindow() && parent->testAttribute(Qt::WA_WState_Created); + const bool nativeWidget = q->internalWinId() != 0; + if (wasCreated || nativeWidget && nonWindowWithCreatedParent) { createWinId(); if (q->isWindow()) { #ifndef QT_MAC_USE_COCOA @@ -2955,7 +2973,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) QPoint QWidget::mapToGlobal(const QPoint &pos) const { Q_D(const QWidget); - if (!testAttribute(Qt::WA_WState_Created)) { + if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) { QPoint p = pos + data->crect.topLeft(); return isWindow() ? p : parentWidget()->mapToGlobal(p); } @@ -2982,7 +3000,7 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const QPoint QWidget::mapFromGlobal(const QPoint &pos) const { Q_D(const QWidget); - if (!testAttribute(Qt::WA_WState_Created)) { + if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) { QPoint p = isWindow() ? pos : parentWidget()->mapFromGlobal(pos); return p - data->crect.topLeft(); } @@ -3320,10 +3338,20 @@ void QWidgetPrivate::update_sys(const QRegion &rgn) } #else // Cocoa doesn't do regions, it seems more efficient to just update the bounding rect instead of a potential number of message passes for each rect. - const QRect &boundingRect = rgn.boundingRect(); - [qt_mac_nativeview_for(q) setNeedsDisplayInRect:NSMakeRect(boundingRect.x(), - boundingRect.y(), boundingRect.width(), - boundingRect.height())]; + const QRect & boundingRect = rgn.boundingRect(); + + // Alien support: get the first native ancestor widget (will be q itself in the non-alien case), + // map the coordinates from q space to NSView space and invalidate the rect. + QWidget *nativeParent = q->internalWinId() ? q : q->nativeParentWidget(); + if (nativeParent == 0) + return; + const QRect nativeBoundingRect = QRect( + QPoint(q->mapTo(nativeParent, boundingRect.topLeft())), + QSize(boundingRect.size())); + + [qt_mac_nativeview_for(nativeParent) setNeedsDisplayInRect:NSMakeRect(nativeBoundingRect.x(), + nativeBoundingRect.y(), nativeBoundingRect.width(), + nativeBoundingRect.height())]; #endif } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index efd9a0a..2cb8586 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -720,6 +720,7 @@ public: #elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC // This is new stuff uint needWindowChange : 1; + uint hasAlienChildren : 1; // Each wiget keeps a list of all its child and grandchild OpenGL widgets. // This list is used to update the gl context whenever a parent and a granparent diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 4620597..bdab6fb 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1478,7 +1478,8 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) return; // ### Disable the unified toolbar when using anything but the native graphics system. - if (windowSurface()) + // ### Disable when using alien widgets as well + if (windowSurface() || testAttribute(Qt::WA_NativeWindow) == false) return; d->useHIToolBar = set; -- cgit v0.12 From 2c0dec10520ce1ae25eaef2d1c67969528ac278d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 2 Mar 2010 12:00:09 +0100 Subject: QtDeclarative: Fix compiler warnings class/struct mixups, unused variables. Reviewed-by: Thomas Hartmann --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 1 - src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 1 - src/declarative/qml/qdeclarativelist.h | 2 +- src/declarative/util/qdeclarativetimeline_p_p.h | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index c54ddd0..1998ccf 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -154,7 +154,6 @@ void QDeclarativeFlickablePrivate::init() */ qreal QDeclarativeFlickablePrivate::overShootDistance(qreal velocity, qreal size) { - Q_Q(QDeclarativeFlickable); if (maxVelocity <= 0) return 0.0; diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index cd72ef9..693fd20 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1268,7 +1268,6 @@ void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const void QDeclarativeVisualDataModel::_q_modelReset() { - Q_D(QDeclarativeVisualDataModel); emit modelReset(); } diff --git a/src/declarative/qml/qdeclarativelist.h b/src/declarative/qml/qdeclarativelist.h index 8d59384..eac4967 100644 --- a/src/declarative/qml/qdeclarativelist.h +++ b/src/declarative/qml/qdeclarativelist.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QObject; -class QMetaObject; +struct QMetaObject; template struct QDeclarativeListProperty { typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); diff --git a/src/declarative/util/qdeclarativetimeline_p_p.h b/src/declarative/util/qdeclarativetimeline_p_p.h index c08c07c..598c897 100644 --- a/src/declarative/util/qdeclarativetimeline_p_p.h +++ b/src/declarative/util/qdeclarativetimeline_p_p.h @@ -160,7 +160,7 @@ public: QDeclarativeTimeLineObject *callbackObject() const; private: - friend class QDeclarativeTimeLinePrivate; + friend struct QDeclarativeTimeLinePrivate; Callback d0; void *d1; QDeclarativeTimeLineObject *d2; -- cgit v0.12 From 671a6a0dc82857dd84feddf49d38540dd59186df Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 2 Mar 2010 12:16:31 +0100 Subject: OS X 10.4 compile error; required casting int to GLint. --- src/multimedia/base/qpaintervideosurface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/multimedia/base/qpaintervideosurface.cpp b/src/multimedia/base/qpaintervideosurface.cpp index 97fddc9..fc3d493 100644 --- a/src/multimedia/base/qpaintervideosurface.cpp +++ b/src/multimedia/base/qpaintervideosurface.cpp @@ -1158,14 +1158,14 @@ QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint( glBindTexture(GL_TEXTURE_2D, m_textureIds[2]); glActiveTexture(GL_TEXTURE0); - m_program.setUniformValue("texY", 0); - m_program.setUniformValue("texU", 1); - m_program.setUniformValue("texV", 2); + m_program.setUniformValue("texY", GLint(0)); + m_program.setUniformValue("texU", GLint(1)); + m_program.setUniformValue("texV", GLint(2)); } else { glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, m_textureIds[0]); - m_program.setUniformValue("texRgb", 0); + m_program.setUniformValue("texRgb", GLint(0)); } m_program.setUniformValue("colorMatrix", m_colorMatrix); -- cgit v0.12 From 2d99a28a583b099cc0281b39b88b0bda8f5e5f7f Mon Sep 17 00:00:00 2001 From: mae Date: Tue, 2 Mar 2010 11:36:05 +0100 Subject: Moved qdeclarativemodules to imports --- src/declarative/declarative.pro | 28 +- src/declarative/imports/imports.pro | 7 + src/declarative/imports/multimedia/multimedia.cpp | 63 + src/declarative/imports/multimedia/multimedia.pro | 15 + src/declarative/imports/qimportbase.pri | 16 + src/declarative/imports/webkit/plugin.cpp | 66 + .../imports/webkit/qdeclarativewebview.cpp | 1340 ++++++++++++++++++++ .../imports/webkit/qdeclarativewebview_p.h | 285 +++++ .../imports/webkit/qdeclarativewebview_p_p.h | 151 +++ src/declarative/imports/webkit/webkit.pro | 18 + .../imports/widgets/graphicslayouts.cpp | 260 ++++ .../imports/widgets/graphicslayouts_p.h | 226 ++++ .../imports/widgets/graphicswidgets.cpp | 40 + .../imports/widgets/graphicswidgets_p.h | 68 + src/declarative/imports/widgets/widgets.cpp | 138 ++ src/declarative/imports/widgets/widgets.pro | 20 + src/declarative/libdeclarative.pro | 29 + src/plugins/plugins.pro | 1 - .../qdeclarativemodules/multimedia/multimedia.cpp | 63 - .../qdeclarativemodules/multimedia/multimedia.pro | 15 - .../qdeclarativemodules/qdeclarativemodules.pro | 7 - .../qdeclarativemodules/webkitqmlplugin/plugin.cpp | 66 - .../webkitqmlplugin/qdeclarativewebview.cpp | 1340 -------------------- .../webkitqmlplugin/qdeclarativewebview_p.h | 285 ----- .../webkitqmlplugin/qdeclarativewebview_p_p.h | 151 --- .../webkitqmlplugin/webkitqmlplugin.pro | 18 - .../widgets/graphicslayouts.cpp | 260 ---- .../widgets/graphicslayouts_p.h | 226 ---- .../widgets/graphicswidgets.cpp | 40 - .../widgets/graphicswidgets_p.h | 68 - .../qdeclarativemodules/widgets/widgets.cpp | 138 -- .../qdeclarativemodules/widgets/widgets.pro | 20 - 32 files changed, 2744 insertions(+), 2724 deletions(-) create mode 100644 src/declarative/imports/imports.pro create mode 100644 src/declarative/imports/multimedia/multimedia.cpp create mode 100644 src/declarative/imports/multimedia/multimedia.pro create mode 100644 src/declarative/imports/qimportbase.pri create mode 100644 src/declarative/imports/webkit/plugin.cpp create mode 100644 src/declarative/imports/webkit/qdeclarativewebview.cpp create mode 100644 src/declarative/imports/webkit/qdeclarativewebview_p.h create mode 100644 src/declarative/imports/webkit/qdeclarativewebview_p_p.h create mode 100644 src/declarative/imports/webkit/webkit.pro create mode 100644 src/declarative/imports/widgets/graphicslayouts.cpp create mode 100644 src/declarative/imports/widgets/graphicslayouts_p.h create mode 100644 src/declarative/imports/widgets/graphicswidgets.cpp create mode 100644 src/declarative/imports/widgets/graphicswidgets_p.h create mode 100644 src/declarative/imports/widgets/widgets.cpp create mode 100644 src/declarative/imports/widgets/widgets.pro create mode 100644 src/declarative/libdeclarative.pro delete mode 100644 src/plugins/qdeclarativemodules/multimedia/multimedia.cpp delete mode 100644 src/plugins/qdeclarativemodules/multimedia/multimedia.pro delete mode 100644 src/plugins/qdeclarativemodules/qdeclarativemodules.pro delete mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp delete mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp delete mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h delete mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h delete mode 100644 src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro delete mode 100644 src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp delete mode 100644 src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h delete mode 100644 src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp delete mode 100644 src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h delete mode 100644 src/plugins/qdeclarativemodules/widgets/widgets.cpp delete mode 100644 src/plugins/qdeclarativemodules/widgets/widgets.pro diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 4287e25..a7ec18e 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -1,29 +1,5 @@ -TARGET = QtDeclarative -QPRO_PWD = $$PWD -QT = core gui xml script network -contains(QT_CONFIG, svg): QT += svg -contains(QT_CONFIG, opengl): QT += opengl -DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING -win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 -solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 +TEMPLATE = subdirs -unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml +SUBDIRS = libdeclarative.pro imports -exists("qdeclarative_enable_gcov") { - QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors - LIBS += -lgcov -} -include(../qbase.pri) - -#INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$TARGET -#DESTDIR=. - -#modules -include(3rdparty/3rdparty.pri) -include(util/util.pri) -include(graphicsitems/graphicsitems.pri) -include(qml/qml.pri) -include(debugger/debugger.pri) - -symbian:TARGET.UID3=0x2001E623 diff --git a/src/declarative/imports/imports.pro b/src/declarative/imports/imports.pro new file mode 100644 index 0000000..f874644 --- /dev/null +++ b/src/declarative/imports/imports.pro @@ -0,0 +1,7 @@ +TEMPLATE = subdirs + +SUBDIRS += widgets + +contains(QT_CONFIG, multimedia): SUBDIRS += multimedia +contains(QT_CONFIG, webkit): SUBDIRS += webkit + diff --git a/src/declarative/imports/multimedia/multimedia.cpp b/src/declarative/imports/multimedia/multimedia.cpp new file mode 100644 index 0000000..8becbf3 --- /dev/null +++ b/src/declarative/imports/multimedia/multimedia.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QMultimediaQmlModule : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + QtMultimedia::qRegisterDeclarativeElements(uri); + } +}; + +QT_END_NAMESPACE + +#include "multimedia.moc" + +Q_EXPORT_PLUGIN2(qmultimediaqmlmodule, QT_PREPEND_NAMESPACE(QMultimediaQmlModule)); + diff --git a/src/declarative/imports/multimedia/multimedia.pro b/src/declarative/imports/multimedia/multimedia.pro new file mode 100644 index 0000000..d601d2e --- /dev/null +++ b/src/declarative/imports/multimedia/multimedia.pro @@ -0,0 +1,15 @@ +TARGET = multimedia +include(../qimportbase.pri) + +QT += multimedia declarative + +SOURCES += multimedia.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia +target.path = $$[QT_INSTALL_IMPORTS]/Qt/multimedia + +qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir +qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/multimedia + +INSTALLS += target qmldir + diff --git a/src/declarative/imports/qimportbase.pri b/src/declarative/imports/qimportbase.pri new file mode 100644 index 0000000..5b0a4e2 --- /dev/null +++ b/src/declarative/imports/qimportbase.pri @@ -0,0 +1,16 @@ +TEMPLATE = lib +CONFIG += qt plugin + +win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release +TARGET = $$qtLibraryTarget($$TARGET) +contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols + +include(../../qt_targets.pri) + +wince*:LIBS += $$QMAKE_LIBS_GUI + +symbian: { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = All -Tcb + load(armcc_warnings) +} diff --git a/src/declarative/imports/webkit/plugin.cpp b/src/declarative/imports/webkit/plugin.cpp new file mode 100644 index 0000000..2f6205d --- /dev/null +++ b/src/declarative/imports/webkit/plugin.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "qdeclarativewebview_p.h" +#include "qdeclarativewebview_p_p.h" + +QT_BEGIN_NAMESPACE + +class WebKitQmlPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit")); + qmlRegisterType(uri,1,0,"WebView"); + } +}; + +QT_END_NAMESPACE + +#include "plugin.moc" + +Q_EXPORT_PLUGIN2(webkitqmlplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); + diff --git a/src/declarative/imports/webkit/qdeclarativewebview.cpp b/src/declarative/imports/webkit/qdeclarativewebview.cpp new file mode 100644 index 0000000..733ac86 --- /dev/null +++ b/src/declarative/imports/webkit/qdeclarativewebview.cpp @@ -0,0 +1,1340 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativewebview_p.h" +#include "qdeclarativewebview_p_p.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system + +class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeWebView) + +public: + QDeclarativeWebViewPrivate() + : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0), + progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone), + newWindowComponent(0), newWindowParent(0), + pressTime(400), + rendering(true) + { + } + + QUrl url; // page url might be different if it has not loaded yet + QWebPage *page; + + int preferredwidth, preferredheight; + qreal progress; + QDeclarativeWebView::Status status; + QString statusText; + enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; + QUrl pending_url; + QString pending_string; + QByteArray pending_data; + mutable QDeclarativeWebSettings settings; + QDeclarativeComponent *newWindowComponent; + QDeclarativeItem *newWindowParent; + + QBasicTimer pressTimer; + QPoint pressPoint; + int pressTime; // milliseconds before it's a "hold" + + + static void windowObjects_append(QDeclarativeListProperty *prop, QObject *o) { + static_cast(prop->data)->windowObjects.append(o); + static_cast(prop->data)->updateWindowObjects(); + } + + void updateWindowObjects(); + QObjectList windowObjects; + + bool rendering; +}; + +/*! + \qmlclass WebView QDeclarativeWebView + \since 4.7 + \brief The WebView item allows you to add web content to a canvas. + \inherits Item + + A WebView renders web content based on a URL. + + If the width and height of the item is not set, they will + dynamically adjust to a size appropriate for the content. + This width may be large for typical online web pages. + + If the preferredWidth is set, the width will be this amount or larger, + usually laying out the web content to fit the preferredWidth. + + \qml + import org.webkit 1.0 + + WebView { + url: "http://www.nokia.com" + width: 490 + height: 400 + scale: 0.5 + smooth: false + smoothCache: true + } + \endqml + + \image webview.png + + The item includes no scrolling, scaling, + toolbars, etc., those must be implemented around WebView. See the WebBrowser example + for a demonstration of this. +*/ + +/*! + \internal + \class QDeclarativeWebView + \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView. + + A WebView renders web content base on a URL. + + \image webview.png + + The item includes no scrolling, scaling, + toolbars, etc., those must be implemented around WebView. See the WebBrowser example + for a demonstration of this. + + A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView. +*/ + +QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) + : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent) +{ + init(); +} + +QDeclarativeWebView::~QDeclarativeWebView() +{ + Q_D(QDeclarativeWebView); + delete d->page; +} + +void QDeclarativeWebView::init() +{ + Q_D(QDeclarativeWebView); + + QWebSettings::enablePersistentStorage(); + + setAcceptHoverEvents(true); + setAcceptedMouseButtons(Qt::LeftButton); + setFlag(QGraphicsItem::ItemHasNoContents, false); + + d->page = 0; +} + +void QDeclarativeWebView::componentComplete() +{ + QDeclarativePaintedItem::componentComplete(); + Q_D(QDeclarativeWebView); + switch (d->pending) { + case QDeclarativeWebViewPrivate::PendingUrl: + setUrl(d->pending_url); + break; + case QDeclarativeWebViewPrivate::PendingHtml: + setHtml(d->pending_string, d->pending_url); + break; + case QDeclarativeWebViewPrivate::PendingContent: + setContent(d->pending_data, d->pending_string, d->pending_url); + break; + default: + break; + } + d->pending = QDeclarativeWebViewPrivate::PendingNone; + d->updateWindowObjects(); +} + +QDeclarativeWebView::Status QDeclarativeWebView::status() const +{ + Q_D(const QDeclarativeWebView); + return d->status; +} + + +/*! + \qmlproperty real WebView::progress + This property holds the progress of loading the current URL, from 0 to 1. + + If you just want to know when progress gets to 1, use + WebView::onLoadFinished() or WebView::onLoadFailed() instead. +*/ +qreal QDeclarativeWebView::progress() const +{ + Q_D(const QDeclarativeWebView); + return d->progress; +} + +void QDeclarativeWebView::doLoadStarted() +{ + Q_D(QDeclarativeWebView); + + if (!d->url.isEmpty()) { + d->status = Loading; + emit statusChanged(d->status); + } + emit loadStarted(); +} + +void QDeclarativeWebView::doLoadProgress(int p) +{ + Q_D(QDeclarativeWebView); + if (d->progress == p/100.0) + return; + d->progress = p/100.0; + emit progressChanged(); +} + +void QDeclarativeWebView::pageUrlChanged() +{ + Q_D(QDeclarativeWebView); + + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + expandToWebPage(); + + if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) + || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) + { + d->url = page()->mainFrame()->url(); + if (d->url == QUrl(QLatin1String("about:blank"))) + d->url = QUrl(); + emit urlChanged(); + } +} + +void QDeclarativeWebView::doLoadFinished(bool ok) +{ + Q_D(QDeclarativeWebView); + + if (title().isEmpty()) + pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() + + if (ok) { + d->status = d->url.isEmpty() ? Null : Ready; + emit loadFinished(); + } else { + d->status = Error; + emit loadFailed(); + } + emit statusChanged(d->status); +} + +/*! + \qmlproperty url WebView::url + This property holds the URL to the page displayed in this item. It can be set, + but also can change spontaneously (eg. because of network redirection). + + If the url is empty, the page is blank. + + The url is always absolute (QML will resolve relative URL strings in the context + of the containing QML document). +*/ +QUrl QDeclarativeWebView::url() const +{ + Q_D(const QDeclarativeWebView); + return d->url; +} + +void QDeclarativeWebView::setUrl(const QUrl &url) +{ + Q_D(QDeclarativeWebView); + if (url == d->url) + return; + + if (isComponentComplete()) { + d->url = url; + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + QUrl seturl = url; + if (seturl.isEmpty()) + seturl = QUrl(QLatin1String("about:blank")); + + Q_ASSERT(!seturl.isRelative()); + + page()->mainFrame()->load(seturl); + + emit urlChanged(); + } else { + d->pending = d->PendingUrl; + d->pending_url = url; + } +} + +/*! + \qmlproperty int WebView::preferredWidth + This property holds the ideal width for displaying the current URL. +*/ +int QDeclarativeWebView::preferredWidth() const +{ + Q_D(const QDeclarativeWebView); + return d->preferredwidth; +} + +void QDeclarativeWebView::setPreferredWidth(int iw) +{ + Q_D(QDeclarativeWebView); + if (d->preferredwidth == iw) return; + d->preferredwidth = iw; + //expandToWebPage(); + emit preferredWidthChanged(); +} + +/*! + \qmlproperty int WebView::preferredHeight + This property holds the ideal height for displaying the current URL. + This only affects the area zoomed by heuristicZoom(). +*/ +int QDeclarativeWebView::preferredHeight() const +{ + Q_D(const QDeclarativeWebView); + return d->preferredheight; +} +void QDeclarativeWebView::setPreferredHeight(int ih) +{ + Q_D(QDeclarativeWebView); + if (d->preferredheight == ih) return; + d->preferredheight = ih; + emit preferredHeightChanged(); +} + +/*! + \qmlmethod bool WebView::evaluateJavaScript(string) + + Evaluates the \a scriptSource JavaScript inside the context of the + main web frame, and returns the result of the last executed statement. + + Note that this JavaScript does \e not have any access to QML objects + except as made available as windowObjects. +*/ +QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource) +{ + return this->page()->mainFrame()->evaluateJavaScript(scriptSource); +} + +void QDeclarativeWebView::focusChanged(bool hasFocus) +{ + QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); + page()->event(&e); + QDeclarativeItem::focusChanged(hasFocus); +} + +void QDeclarativeWebView::initialLayout() +{ + // nothing useful to do at this point +} + +void QDeclarativeWebView::noteContentsSizeChanged(const QSize&) +{ + expandToWebPage(); +} + +void QDeclarativeWebView::expandToWebPage() +{ + Q_D(QDeclarativeWebView); + QSize cs = page()->mainFrame()->contentsSize(); + if (cs.width() < d->preferredwidth) + cs.setWidth(d->preferredwidth); + if (cs.height() < d->preferredheight) + cs.setHeight(d->preferredheight); + if (widthValid()) + cs.setWidth(width()); + if (heightValid()) + cs.setHeight(height()); + if (cs != page()->viewportSize()) { + page()->setViewportSize(cs); + } + if (cs != contentsSize()) + setContentsSize(cs); +} + +void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) +{ + if (newGeometry.size() != oldGeometry.size()) + expandToWebPage(); + QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); +} + +void QDeclarativeWebView::paintPage(const QRect& r) +{ + dirtyCache(r); + update(); +} + +/*! + \qmlproperty list WebView::javaScriptWindowObjects + + This property is a list of object that are available from within + the webview's JavaScript context. + + The \a object will be inserted as a child of the frame's window + object, under the name given by the attached property \c WebView.windowObjectName. + + \qml + WebView { + javaScriptWindowObjects: Object { + WebView.windowObjectName: "coordinates" + } + } + \endqml + + Properties of the object will be exposed as JavaScript properties and slots as + JavaScript methods. + + If Javascript is not enabled for this page, then this property does nothing. +*/ +QDeclarativeListProperty QDeclarativeWebView::javaScriptWindowObjects() +{ + Q_D(QDeclarativeWebView); + return QDeclarativeListProperty(this, d, &QDeclarativeWebViewPrivate::windowObjects_append); +} + +QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject *o) +{ + return new QDeclarativeWebViewAttached(o); +} + +void QDeclarativeWebViewPrivate::updateWindowObjects() +{ + Q_Q(QDeclarativeWebView); + if (!q->isComponentComplete() || !page) + return; + + for (int ii = 0; ii < windowObjects.count(); ++ii) { + QObject *object = windowObjects.at(ii); + QDeclarativeWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); + if (attached && !attached->windowObjectName().isEmpty()) { + page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); + } + } +} + +bool QDeclarativeWebView::renderingEnabled() const +{ + Q_D(const QDeclarativeWebView); + return d->rendering; +} + +void QDeclarativeWebView::setRenderingEnabled(bool enabled) +{ + Q_D(QDeclarativeWebView); + if (d->rendering == enabled) + return; + d->rendering = enabled; + emit renderingEnabledChanged(); + + setCacheFrozen(!enabled); + if (enabled) + clearCache(); +} + + +void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r) +{ + Q_D(QDeclarativeWebView); + if (d->rendering) + page()->mainFrame()->render(p,r); +} + +QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) +{ + QEvent::Type t; + switch(e->type()) { + default: + case QEvent::GraphicsSceneMousePress: + t = QEvent::MouseButtonPress; + break; + case QEvent::GraphicsSceneMouseRelease: + t = QEvent::MouseButtonRelease; + break; + case QEvent::GraphicsSceneMouseMove: + t = QEvent::MouseMove; + break; + case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick: + t = QEvent::MouseButtonDblClick; + break; + } + + QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), e->button(), e->buttons(), 0); + return me; +} + +QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) +{ + QEvent::Type t = QEvent::MouseMove; + + QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), Qt::NoButton, Qt::NoButton, 0); + + return me; +} + + +/*! + \qmlsignal WebView::onDoubleClick(clickx,clicky) + + The WebView does not pass double-click events to the web engine, but rather + emits this signals. +*/ + +void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + emit doubleClick(me->x(),me->y()); + delete me; +} + +/*! + \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) + + Finds a zoom that: + \list + \i shows a whole item + \i includes (\a clickX, \a clickY) + \i fits into the preferredWidth and preferredHeight + \i zooms by no more than \a maxzoom + \i is more than 10% above the current zoom + \endlist + + If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, + no signal is emitted and returns false. +*/ +bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) +{ + Q_D(QDeclarativeWebView); + if (contentsScale() >= maxzoom/zoomFactor()) + return false; + qreal ozf = contentsScale(); + QRect showarea = elementAreaAt(clickX, clickY, d->preferredwidth/maxzoom, d->preferredheight/maxzoom); + qreal z = qMin(qreal(d->preferredwidth)/showarea.width(),qreal(d->preferredheight)/showarea.height()); + if (z > maxzoom/zoomFactor()) + z = maxzoom/zoomFactor(); + if (z/ozf > 1.2) { + QRectF r(showarea.left()*z, showarea.top()*z, showarea.width()*z, showarea.height()*z); + emit zoomTo(z,r.x()+r.width()/2, r.y()+r.height()/2); + return true; + } else { + return false; + } +} + +/*! + \qmlproperty int WebView::pressGrabTime + + The number of milliseconds the user must press before the WebView + starts passing move events through to the web engine (rather than + letting other QML elements such as a Flickable take them). + + Defaults to 400ms. Set to 0 to always grab and pass move events to + the web engine. +*/ +int QDeclarativeWebView::pressGrabTime() const +{ + Q_D(const QDeclarativeWebView); + return d->pressTime; +} + +void QDeclarativeWebView::setPressGrabTime(int ms) +{ + Q_D(QDeclarativeWebView); + if (d->pressTime == ms) + return; + d->pressTime = ms; + emit pressGrabTimeChanged(); +} + +void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + setFocus (true); + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + + d->pressPoint = me->pos(); + if (d->pressTime) { + d->pressTimer.start(d->pressTime,this); + setKeepMouseGrab(false); + } else { + grabMouse(); + setKeepMouseGrab(true); + } + + page()->event(me); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit + Might be a bug in WebKit, though + */ +#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) { + QDeclarativePaintedItem::mousePressEvent(event); + } +} + +void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + page()->event(me); + d->pressTimer.stop(); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send all the events to WebKit + */ +#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) { + QDeclarativePaintedItem::mouseReleaseEvent(event); + } + setKeepMouseGrab(false); + ungrabMouse(); +} + +void QDeclarativeWebView::timerEvent(QTimerEvent *event) +{ + Q_D(QDeclarativeWebView); + if (event->timerId() == d->pressTimer.timerId()) { + d->pressTimer.stop(); + grabMouse(); + setKeepMouseGrab(true); + } +} + +void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + if (d->pressTimer.isActive()) { + if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { + d->pressTimer.stop(); + } + } + if (keepMouseGrab()) { + page()->event(me); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit + Might be a bug in WebKit, though + */ +#if 1 // QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + } + delete me; + if (!event->isAccepted()) + QDeclarativePaintedItem::mouseMoveEvent(event); + +} +void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) +{ + QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); + page()->event(me); + event->setAccepted( +#if QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) + QDeclarativePaintedItem::hoverMoveEvent(event); +} + +void QDeclarativeWebView::keyPressEvent(QKeyEvent* event) +{ + page()->event(event); + if (!event->isAccepted()) + QDeclarativePaintedItem::keyPressEvent(event); +} + +void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event) +{ + page()->event(event); + if (!event->isAccepted()) + QDeclarativePaintedItem::keyReleaseEvent(event); +} + +bool QDeclarativeWebView::sceneEvent(QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *k = static_cast(event); + if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { + if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? + page()->event(event); + if (event->isAccepted()) + return true; + } + } + } + return QDeclarativePaintedItem::sceneEvent(event); +} + + +/*! + \qmlproperty action WebView::back + This property holds the action for causing the previous URL in the history to be displayed. +*/ +QAction *QDeclarativeWebView::backAction() const +{ + return page()->action(QWebPage::Back); +} + +/*! + \qmlproperty action WebView::forward + This property holds the action for causing the next URL in the history to be displayed. +*/ +QAction *QDeclarativeWebView::forwardAction() const +{ + return page()->action(QWebPage::Forward); +} + +/*! + \qmlproperty action WebView::reload + This property holds the action for reloading with the current URL +*/ +QAction *QDeclarativeWebView::reloadAction() const +{ + return page()->action(QWebPage::Reload); +} + +/*! + \qmlproperty action WebView::stop + This property holds the action for stopping loading with the current URL +*/ +QAction *QDeclarativeWebView::stopAction() const +{ + return page()->action(QWebPage::Stop); +} + +/*! + \qmlproperty real WebView::title + This property holds the title of the web page currently viewed + + By default, this property contains an empty string. +*/ +QString QDeclarativeWebView::title() const +{ + return page()->mainFrame()->title(); +} + + + +/*! + \qmlproperty pixmap WebView::icon + This property holds the icon associated with the web page currently viewed +*/ +QPixmap QDeclarativeWebView::icon() const +{ + return page()->mainFrame()->icon().pixmap(QSize(256,256)); +} + + +/*! + \qmlproperty real WebView::zoomFactor + This property holds the multiplier used to scale the contents of a Web page. +*/ +void QDeclarativeWebView::setZoomFactor(qreal factor) +{ + Q_D(QDeclarativeWebView); + if (factor == page()->mainFrame()->zoomFactor()) + return; + + page()->mainFrame()->setZoomFactor(factor); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor, + d->preferredheight>0 ? d->preferredheight*factor : height()*factor)); + expandToWebPage(); + + emit zoomFactorChanged(); +} + +qreal QDeclarativeWebView::zoomFactor() const +{ + return page()->mainFrame()->zoomFactor(); +} + +/*! + \qmlproperty string WebView::statusText + + This property is the current status suggested by the current web page. In a web browser, + such status is often shown in some kind of status bar. +*/ +void QDeclarativeWebView::setStatusText(const QString& s) +{ + Q_D(QDeclarativeWebView); + d->statusText = s; + emit statusTextChanged(); +} + +void QDeclarativeWebView::windowObjectCleared() +{ + Q_D(QDeclarativeWebView); + d->updateWindowObjects(); +} + +QString QDeclarativeWebView::statusText() const +{ + Q_D(const QDeclarativeWebView); + return d->statusText; +} + +QWebPage *QDeclarativeWebView::page() const +{ + Q_D(const QDeclarativeWebView); + + if (!d->page) { + QDeclarativeWebView *self = const_cast(this); + QWebPage *wp = new QDeclarativeWebPage(self); + + // QML items don't default to having a background, + // even though most we pages will set one anyway. + QPalette pal = QApplication::palette(); + pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); + wp->setPalette(pal); + + wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); + + self->setPage(wp); + + return wp; + } + + return d->page; +} + + +// The QObject interface to settings(). +/*! + \qmlproperty string WebView::settings.standardFontFamily + \qmlproperty string WebView::settings.fixedFontFamily + \qmlproperty string WebView::settings.serifFontFamily + \qmlproperty string WebView::settings.sansSerifFontFamily + \qmlproperty string WebView::settings.cursiveFontFamily + \qmlproperty string WebView::settings.fantasyFontFamily + + \qmlproperty int WebView::settings.minimumFontSize + \qmlproperty int WebView::settings.minimumLogicalFontSize + \qmlproperty int WebView::settings.defaultFontSize + \qmlproperty int WebView::settings.defaultFixedFontSize + + \qmlproperty bool WebView::settings.autoLoadImages + \qmlproperty bool WebView::settings.javascriptEnabled + \qmlproperty bool WebView::settings.javaEnabled + \qmlproperty bool WebView::settings.pluginsEnabled + \qmlproperty bool WebView::settings.privateBrowsingEnabled + \qmlproperty bool WebView::settings.javascriptCanOpenWindows + \qmlproperty bool WebView::settings.javascriptCanAccessClipboard + \qmlproperty bool WebView::settings.developerExtrasEnabled + \qmlproperty bool WebView::settings.linksIncludedInFocusChain + \qmlproperty bool WebView::settings.zoomTextOnly + \qmlproperty bool WebView::settings.printElementBackgrounds + \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled + \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled + \qmlproperty bool WebView::settings.localStorageDatabaseEnabled + \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls + + These properties give access to the settings controlling the web view. + + See QWebSettings for details of these properties. + + \qml + WebView { + settings.pluginsEnabled: true + settings.standardFontFamily: "Arial" + ... + } + \endqml +*/ +QObject *QDeclarativeWebView::settingsObject() const +{ + Q_D(const QDeclarativeWebView); + d->settings.s = page()->settings(); + return &d->settings; +} + +void QDeclarativeWebView::setPage(QWebPage *page) +{ + Q_D(QDeclarativeWebView); + if (d->page == page) + return; + if (d->page) { + if (d->page->parent() == this) { + delete d->page; + } else { + d->page->disconnect(this); + } + } + d->page = page; + d->page->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff); + d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); + connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); + connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); + connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); + connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); + connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); + + connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted())); + connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int))); + connect(d->page,SIGNAL(loadFinished(bool)),this,SLOT(doLoadFinished(bool))); + connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString))); + + connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared())); +} + +/*! + \qmlsignal WebView::onLoadStarted() + + This handler is called when the web engine begins loading + a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() + will be emitted. +*/ + +/*! + \qmlsignal WebView::onLoadFinished() + + This handler is called when the web engine \e successfully + finishes loading a page, including any component content + (WebView::onLoadFailed() will be emitted otherwise). + + \sa progress +*/ + +/*! + \qmlsignal WebView::onLoadFailed() + + This handler is called when the web engine fails loading + a page or any component content + (WebView::onLoadFinished() will be emitted on success). +*/ + +void QDeclarativeWebView::load(const QNetworkRequest &request, + QNetworkAccessManager::Operation operation, + const QByteArray &body) +{ + page()->mainFrame()->load(request, operation, body); +} + +QString QDeclarativeWebView::html() const +{ + return page()->mainFrame()->toHtml(); +} + +/*! + \qmlproperty string WebView::html + This property holds HTML text set directly + + The html property can be set as a string. + + \qml + WebView { + html: "

This is HTML." + } + \endqml +*/ +void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) +{ + Q_D(QDeclarativeWebView); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + if (isComponentComplete()) + page()->mainFrame()->setHtml(html, baseUrl); + else { + d->pending = d->PendingHtml; + d->pending_url = baseUrl; + d->pending_string = html; + } + emit htmlChanged(); +} + +void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) +{ + Q_D(QDeclarativeWebView); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + + if (isComponentComplete()) + page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); + else { + d->pending = d->PendingContent; + d->pending_url = baseUrl; + d->pending_string = mimeType; + d->pending_data = data; + } +} + +QWebHistory *QDeclarativeWebView::history() const +{ + return page()->history(); +} + +QWebSettings *QDeclarativeWebView::settings() const +{ + return page()->settings(); +} + +QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) +{ + Q_D(QDeclarativeWebView); + switch (type) { + case QWebPage::WebBrowserWindow: { + if (!d->newWindowComponent && d->newWindowParent) + qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored"); + else if (d->newWindowComponent && !d->newWindowParent) + qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); + else if (d->newWindowComponent && d->newWindowParent) { + QDeclarativeWebView *webview = 0; + QDeclarativeContext *windowContext = new QDeclarativeContext(qmlContext(this)); + + QObject *nobj = d->newWindowComponent->create(windowContext); + if (nobj) { + windowContext->setParent(nobj); + QDeclarativeItem *item = qobject_cast(nobj); + if (!item) { + delete nobj; + } else { + webview = item->findChild(); + if (!webview) { + delete item; + } else { + nobj->setParent(d->newWindowParent); + static_cast(item)->setParentItem(d->newWindowParent); + } + } + } else { + delete windowContext; + } + + return webview; + } + } + break; + case QWebPage::WebModalDialog: { + // Not supported + } + } + return 0; +} + +/*! + \qmlproperty component WebView::newWindowComponent + + This property holds the component to use for new windows. + The component must have a WebView somewhere in its structure. + + When the web engine requests a new window, it will be an instance of + this component. + + The parent of the new window is set by newWindowParent. It must be set. +*/ +QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const +{ + Q_D(const QDeclarativeWebView); + return d->newWindowComponent; +} + +void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow) +{ + Q_D(QDeclarativeWebView); + if (newWindow == d->newWindowComponent) + return; + d->newWindowComponent = newWindow; + emit newWindowComponentChanged(); +} + + +/*! + \qmlproperty item WebView::newWindowParent + + The parent item for new windows. + + \sa newWindowComponent +*/ +QDeclarativeItem *QDeclarativeWebView::newWindowParent() const +{ + Q_D(const QDeclarativeWebView); + return d->newWindowParent; +} + +void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) +{ + Q_D(QDeclarativeWebView); + if (parent == d->newWindowParent) + return; + if (d->newWindowParent && parent) { + QList children = d->newWindowParent->childItems(); + for (int i = 0; i < children.count(); ++i) { + children.at(i)->setParentItem(parent); + } + } + d->newWindowParent = parent; + emit newWindowParentChanged(); +} + +/*! + Returns the area of the largest element at position (\a x,\a y) that is no larger + than \a maxwidth by \a maxheight pixels. + + May return an area larger in the case when no smaller element is at the position. +*/ +QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const +{ + QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y)); + QRect rv = hit.boundingRect(); + QWebElement element = hit.enclosingBlockElement(); + if (maxwidth<=0) maxwidth = INT_MAX; + if (maxheight<=0) maxheight = INT_MAX; + while (!element.parent().isNull() && element.geometry().width() <= maxwidth && element.geometry().height() <= maxheight) { + rv = element.geometry(); + element = element.parent(); + } + return rv; +} + +/*! + \internal + \class QDeclarativeWebPage + \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins. + + \sa QDeclarativeWebView +*/ +QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView *parent) : + QWebPage(parent) +{ +} + +QDeclarativeWebPage::~QDeclarativeWebPage() +{ +} + +void QDeclarativeWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) +{ + qWarning() << sourceID << ':' << lineNumber << ':' << message; +} + +QString QDeclarativeWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(oldFile) + return oldFile; +} + +void QDeclarativeWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) +{ + Q_UNUSED(originatingFrame) + emit viewItem()->alert(msg); +} + +bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(msg) + return false; +} + +bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(msg) + Q_UNUSED(defaultValue) + Q_UNUSED(result) + return false; +} + + +/* + Qt WebKit does not understand non-QWidget plugins, so dummy widgets + are created, parented to a single dummy tool window. + + The requirements for QML object plugins are input to the Qt WebKit + non-QWidget plugin support, which will obsolete this kludge. +*/ +class QWidget_Dummy_Plugin : public QWidget +{ + Q_OBJECT +public: + static QWidget *dummy_shared_parent() + { + static QWidget *dsp = 0; + if (!dsp) { + dsp = new QWidget(0,Qt::Tool); + dsp->setGeometry(-10000,-10000,0,0); + dsp->show(); + } + return dsp; + } + QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : + QWidget(dummy_shared_parent()), + propertyNames(paramNames), + propertyValues(paramValues), + webview(view) + { + QDeclarativeEngine *engine = qmlEngine(webview); + component = new QDeclarativeComponent(engine, url, this); + item = 0; + if (component->isLoading()) + connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded())); + else + qmlLoaded(); + } + +public Q_SLOTS: + void qmlLoaded() + { + if (component->isError()) { + // ### Could instead give these errors to the WebView to handle. + qWarning() << component->errors(); + return; + } + item = qobject_cast(component->create(qmlContext(webview))); + item->setParent(webview); + QString jsObjName; + for (int i=0; isetProperty(propertyNames[i].toUtf8(),propertyValues[i]); + if (propertyNames[i] == QLatin1String("objectname")) + jsObjName = propertyValues[i]; + } + } + if (!jsObjName.isNull()) { + QWebFrame *f = webview->page()->mainFrame(); + f->addToJavaScriptWindowObject(jsObjName, item); + } + resizeEvent(0); + delete component; + component = 0; + } + void resizeEvent(QResizeEvent*) + { + if (item) { + item->setX(x()); + item->setY(y()); + item->setWidth(width()); + item->setHeight(height()); + } + } + +private: + QDeclarativeComponent *component; + QDeclarativeItem *item; + QStringList propertyNames, propertyValues; + QDeclarativeWebView *webview; +}; + +QDeclarativeWebView *QDeclarativeWebPage::viewItem() +{ + return static_cast(parent()); +} + +QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) +{ + QUrl comp = qmlContext(viewItem())->resolvedUrl(url); + return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); +} + +QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) +{ + QDeclarativeWebView *newView = viewItem()->createWindow(type); + if (newView) + return newView->page(); + return 0; +} + +QT_END_NAMESPACE + +#include diff --git a/src/declarative/imports/webkit/qdeclarativewebview_p.h b/src/declarative/imports/webkit/qdeclarativewebview_p.h new file mode 100644 index 0000000..0bb5d29 --- /dev/null +++ b/src/declarative/imports/webkit/qdeclarativewebview_p.h @@ -0,0 +1,285 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEWEBVIEW_H +#define QDECLARATIVEWEBVIEW_H + +#include + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +class QWebHistory; +class QWebSettings; + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) +class QDeclarativeWebViewPrivate; +class QNetworkRequest; +class QDeclarativeWebView; + +class Q_DECLARATIVE_EXPORT QDeclarativeWebPage : public QWebPage +{ + Q_OBJECT +public: + explicit QDeclarativeWebPage(QDeclarativeWebView *parent); + ~QDeclarativeWebPage(); +protected: + QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); + QWebPage *createWindow(WebWindowType type); + void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); + QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); + void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); + +private: + QDeclarativeWebView *viewItem(); +}; + + +class QDeclarativeWebViewAttached; + +//### TODO: browser plugins + +class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem +{ + Q_OBJECT + + Q_ENUMS(Status SelectionMode) + + Q_PROPERTY(QString title READ title NOTIFY titleChanged) + Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) + Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) + + Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) + + Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged) + + Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) + Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + + Q_PROPERTY(QAction* reload READ reloadAction CONSTANT) + Q_PROPERTY(QAction* back READ backAction CONSTANT) + Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) + Q_PROPERTY(QAction* stop READ stopAction CONSTANT) + + Q_PROPERTY(QObject* settings READ settingsObject CONSTANT) + + Q_PROPERTY(QDeclarativeListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) + + Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) + Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) + + Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) + +public: + QDeclarativeWebView(QDeclarativeItem *parent=0); + ~QDeclarativeWebView(); + + QUrl url() const; + void setUrl(const QUrl &); + + QString title() const; + + QPixmap icon() const; + + qreal zoomFactor() const; + void setZoomFactor(qreal); + Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); + QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; + + int pressGrabTime() const; + void setPressGrabTime(int); + + int preferredWidth() const; + void setPreferredWidth(int); + int preferredHeight() const; + void setPreferredHeight(int); + + enum Status { Null, Ready, Loading, Error }; + Status status() const; + qreal progress() const; + QString statusText() const; + + QAction *reloadAction() const; + QAction *backAction() const; + QAction *forwardAction() const; + QAction *stopAction() const; + + QWebPage *page() const; + void setPage(QWebPage *page); + + void load(const QNetworkRequest &request, + QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, + const QByteArray &body = QByteArray()); + + QString html() const; + + void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); + void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); + + QWebHistory *history() const; + QWebSettings *settings() const; + QObject *settingsObject() const; + + bool renderingEnabled() const; + void setRenderingEnabled(bool); + + QDeclarativeListProperty javaScriptWindowObjects(); + + static QDeclarativeWebViewAttached *qmlAttachedProperties(QObject *); + + QDeclarativeComponent *newWindowComponent() const; + void setNewWindowComponent(QDeclarativeComponent *newWindow); + QDeclarativeItem *newWindowParent() const; + void setNewWindowParent(QDeclarativeItem *newWindow); + +Q_SIGNALS: + void preferredWidthChanged(); + void preferredHeightChanged(); + void urlChanged(); + void progressChanged(); + void statusChanged(Status); + void titleChanged(const QString&); + void iconChanged(); + void statusTextChanged(); + void htmlChanged(); + void pressGrabTimeChanged(); + void zoomFactorChanged(); + void newWindowComponentChanged(); + void newWindowParentChanged(); + void renderingEnabledChanged(); + + void loadStarted(); + void loadFinished(); + void loadFailed(); + + void doubleClick(int clickX, int clickY); + + void zoomTo(qreal zoom, int centerX, int centerY); + + void alert(const QString& message); + +public Q_SLOTS: + QVariant evaluateJavaScript(const QString&); + +private Q_SLOTS: + void expandToWebPage(); + void paintPage(const QRect&); + void doLoadStarted(); + void doLoadProgress(int p); + void doLoadFinished(bool ok); + void setStatusText(const QString&); + void windowObjectCleared(); + void pageUrlChanged(); + void noteContentsSizeChanged(const QSize&); + void initialLayout(); + +protected: + void drawContents(QPainter *, const QRect &); + + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void timerEvent(QTimerEvent *event); + void hoverMoveEvent (QGraphicsSceneHoverEvent * event); + void keyPressEvent(QKeyEvent* event); + void keyReleaseEvent(QKeyEvent* event); + virtual void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry); + virtual void focusChanged(bool); + virtual bool sceneEvent(QEvent *event); + QDeclarativeWebView *createWindow(QWebPage::WebWindowType type); + +private: + void init(); + virtual void componentComplete(); + Q_DISABLE_COPY(QDeclarativeWebView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView) + QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *); + QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *); + friend class QDeclarativeWebPage; +}; + +class QDeclarativeWebViewAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) +public: + QDeclarativeWebViewAttached(QObject *parent) + : QObject(parent) + { + } + + QString windowObjectName() const + { + return m_windowObjectName; + } + + void setWindowObjectName(const QString &n) + { + m_windowObjectName = n; + } + +private: + QString m_windowObjectName; +}; + + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeWebView) +QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES) + +QT_END_HEADER + +#endif diff --git a/src/declarative/imports/webkit/qdeclarativewebview_p_p.h b/src/declarative/imports/webkit/qdeclarativewebview_p_p.h new file mode 100644 index 0000000..258b472 --- /dev/null +++ b/src/declarative/imports/webkit/qdeclarativewebview_p_p.h @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEWEBVIEW_P_H +#define QDECLARATIVEWEBVIEW_P_H + +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeWebSettings : public QObject { + Q_OBJECT + + Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) + Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) + Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) + Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) + Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) + Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) + + Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) + Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) + Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) + Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) + + Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) + Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) + Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) + Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) + Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) + Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) + Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) + Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) + Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) + Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) + Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) + Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) + Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) + Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) + Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) + +public: + QDeclarativeWebSettings() {} + + QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } + void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } + QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } + void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } + QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } + void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } + QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } + void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } + QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } + void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } + QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } + void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } + + int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } + void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } + int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } + void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } + int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } + void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } + int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } + void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } + + bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } + void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } + bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } + void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } + bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } + void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } + bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } + void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } + bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } + void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } + bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } + void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } + bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } + void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } + bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } + void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } + bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } + void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } + bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } + void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } + bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } + void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } + bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } + void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } + bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } + void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } + bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } + void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } + bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } + void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } + + QWebSettings *s; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeWebSettings) + +QT_END_HEADER + +#endif diff --git a/src/declarative/imports/webkit/webkit.pro b/src/declarative/imports/webkit/webkit.pro new file mode 100644 index 0000000..7ad8564 --- /dev/null +++ b/src/declarative/imports/webkit/webkit.pro @@ -0,0 +1,18 @@ +TARGET = webkitqmlplugin +include(../qimportbase.pri) + +contains(QT_CONFIG, webkit) { + QT += webkit declarative + + SOURCES += qdeclarativewebview.cpp plugin.cpp + HEADERS += qdeclarativewebview_p.h + HEADERS += qdeclarativewebview_p_p.h + + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/org/webkit + target.path = $$[QT_INSTALL_IMPORTS]/org/webkit + + qmldir.files += $$QT_BUILD_TREE/imports/org/webkit/qmldir + qmldir.path += $$[QT_INSTALL_IMPORTS]/org/webkit + + INSTALLS += target qmldir +} diff --git a/src/declarative/imports/widgets/graphicslayouts.cpp b/src/declarative/imports/widgets/graphicslayouts.cpp new file mode 100644 index 0000000..fc15ad2 --- /dev/null +++ b/src/declarative/imports/widgets/graphicslayouts.cpp @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "graphicslayouts_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +LinearLayoutAttached::LinearLayoutAttached(QObject *parent) +: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter) +{ +} + +void LinearLayoutAttached::setStretchFactor(int f) +{ + if (_stretch == f) + return; + + _stretch = f; + emit stretchChanged(reinterpret_cast(parent()), _stretch); +} + +void LinearLayoutAttached::setAlignment(Qt::Alignment a) +{ + if (_alignment == a) + return; + + _alignment = a; + emit alignmentChanged(reinterpret_cast(parent()), _alignment); +} + +QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent) + : QObject(parent) +{ +} + +QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ +Q_UNUSED(which); +Q_UNUSED(constraint); +return QSizeF(); +} + + +QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent) +: QObject(parent) +{ +} + +QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject() +{ +} + +void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item) +{ +insertItem(index, item); + +//connect attached properties +if (LinearLayoutAttached *obj = attachedProperties.value(item)) { + setStretchFactor(item, obj->stretchFactor()); + setAlignment(item, obj->alignment()); + QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)), + this, SLOT(updateStretch(QGraphicsLayoutItem*,int))); + QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)), + this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment))); + //### need to disconnect when widget is removed? +} +} + +//### is there a better way to do this? +void QGraphicsLinearLayoutObject::clearChildren() +{ +for (int i = 0; i < count(); ++i) + removeAt(i); +} + +void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch) +{ +QGraphicsLinearLayout::setStretchFactor(item, stretch); +} + +void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment) +{ +QGraphicsLinearLayout::setAlignment(item, alignment); +} + +QHash QGraphicsLinearLayoutObject::attachedProperties; +LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj) +{ +// ### This is not allowed - you must attach to any object +if (!qobject_cast(obj)) + return 0; +LinearLayoutAttached *rv = new LinearLayoutAttached(obj); +attachedProperties.insert(qobject_cast(obj), rv); +return rv; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// QGraphicsGridLayout-related classes +////////////////////////////////////////////////////////////////////////////////////////////////////// +GridLayoutAttached::GridLayoutAttached(QObject *parent) +: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1) +{ +} + +void GridLayoutAttached::setRow(int r) +{ + if (_row == r) + return; + + _row = r; + //emit rowChanged(reinterpret_cast(parent()), _row); +} + +void GridLayoutAttached::setColumn(int c) +{ + if (_column == c) + return; + + _column = c; + //emit columnChanged(reinterpret_cast(parent()), _column); +} + +void GridLayoutAttached::setRowSpan(int rs) +{ + if (_rowspan == rs) + return; + + _rowspan = rs; + //emit rowSpanChanged(reinterpret_cast(parent()), _rowSpan); +} + +void GridLayoutAttached::setColumnSpan(int cs) +{ + if (_colspan == cs) + return; + + _colspan = cs; + //emit columnSpanChanged(reinterpret_cast(parent()), _columnSpan); +} + +void GridLayoutAttached::setAlignment(Qt::Alignment a) +{ + if (_alignment == a) + return; + + _alignment = a; + //emit alignmentChanged(reinterpret_cast(parent()), _alignment); +} + +QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent) +: QObject(parent) +{ +} + +QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject() +{ +} + +void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid) +{ +//use attached properties +if (QObject *obj = attachedProperties.value(qobject_cast(wid))) { + int row = static_cast(obj)->row(); + int column = static_cast(obj)->column(); + int rowSpan = static_cast(obj)->rowSpan(); + int columnSpan = static_cast(obj)->columnSpan(); + if (row == -1 || column == -1) { + qWarning() << "Must set row and column for an item in a grid layout"; + return; + } + addItem(wid, row, column, rowSpan, columnSpan); +} +} + +void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item) +{ +//use attached properties +if (GridLayoutAttached *obj = attachedProperties.value(item)) { + int row = obj->row(); + int column = obj->column(); + int rowSpan = obj->rowSpan(); + int columnSpan = obj->columnSpan(); + Qt::Alignment alignment = obj->alignment(); + if (row == -1 || column == -1) { + qWarning() << "Must set row and column for an item in a grid layout"; + return; + } + addItem(item, row, column, rowSpan, columnSpan); + if (alignment != -1) + setAlignment(item,alignment); +} +} + +//### is there a better way to do this? +void QGraphicsGridLayoutObject::clearChildren() +{ +for (int i = 0; i < count(); ++i) + removeAt(i); +} + +qreal QGraphicsGridLayoutObject::spacing() const +{ +if (verticalSpacing() == horizontalSpacing()) + return verticalSpacing(); +return -1; //### +} + +QHash QGraphicsGridLayoutObject::attachedProperties; +GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj) +{ +// ### This is not allowed - you must attach to any object +if (!qobject_cast(obj)) + return 0; +GridLayoutAttached *rv = new GridLayoutAttached(obj); +attachedProperties.insert(qobject_cast(obj), rv); +return rv; +} + +QT_END_NAMESPACE diff --git a/src/declarative/imports/widgets/graphicslayouts_p.h b/src/declarative/imports/widgets/graphicslayouts_p.h new file mode 100644 index 0000000..f9b9ae8 --- /dev/null +++ b/src/declarative/imports/widgets/graphicslayouts_p.h @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GRAPHICSLAYOUTS_H +#define GRAPHICSLAYOUTS_H + +#include "graphicswidgets_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem +{ + Q_OBJECT + Q_INTERFACES(QGraphicsLayoutItem) +public: + QGraphicsLinearLayoutStretchItemObject(QObject *parent = 0); + + virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const; +}; + +class LinearLayoutAttached; +class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout +{ + Q_OBJECT + Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsLinearLayoutObject(QObject * = 0); + ~QGraphicsLinearLayoutObject(); + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } + + static LinearLayoutAttached *qmlAttachedProperties(QObject *); + +private Q_SLOTS: + void updateStretch(QGraphicsLayoutItem*,int); + void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment); + +private: + friend class LinearLayoutAttached; + void clearChildren(); + void insertLayoutItem(int, QGraphicsLayoutItem *); + static QHash attachedProperties; + + static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { + static_cast(prop->object)->insertLayoutItem(-1, item); + } + + static void children_clear(QDeclarativeListProperty *prop) { + static_cast(prop->object)->clearChildren(); + } + + static int children_count(QDeclarativeListProperty *prop) { + return static_cast(prop->object)->count(); + } + + static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { + return static_cast(prop->object)->itemAt(index); + } +}; + +class GridLayoutAttached; +class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout +{ + Q_OBJECT + Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) + Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) + Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsGridLayoutObject(QObject * = 0); + ~QGraphicsGridLayoutObject(); + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } + + qreal spacing() const; + + static GridLayoutAttached *qmlAttachedProperties(QObject *); + +private: + friend class GraphicsLayoutAttached; + void addWidget(QGraphicsWidget *); + void clearChildren(); + void addLayoutItem(QGraphicsLayoutItem *); + static QHash attachedProperties; + + static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { + static_cast(prop->object)->addLayoutItem(item); + } + + static void children_clear(QDeclarativeListProperty *prop) { + static_cast(prop->object)->clearChildren(); + } + + static int children_count(QDeclarativeListProperty *prop) { + return static_cast(prop->object)->count(); + } + + static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { + return static_cast(prop->object)->itemAt(index); + } +}; + +class LinearLayoutAttached : public QObject +{ + Q_OBJECT + + Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) +public: + LinearLayoutAttached(QObject *parent); + + int stretchFactor() const { return _stretch; } + void setStretchFactor(int f); + Qt::Alignment alignment() const { return _alignment; } + void setAlignment(Qt::Alignment a); + +Q_SIGNALS: + void stretchChanged(QGraphicsLayoutItem*,int); + void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment); + +private: + int _stretch; + Qt::Alignment _alignment; +}; + +class GridLayoutAttached : public QObject +{ + Q_OBJECT + + Q_PROPERTY(int row READ row WRITE setRow) + Q_PROPERTY(int column READ column WRITE setColumn) + Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan) + Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) +public: + GridLayoutAttached(QObject *parent); + + int row() const { return _row; } + void setRow(int r); + + int column() const { return _column; } + void setColumn(int c); + + int rowSpan() const { return _rowspan; } + void setRowSpan(int rs); + + int columnSpan() const { return _colspan; } + void setColumnSpan(int cs); + + Qt::Alignment alignment() const { return _alignment; } + void setAlignment(Qt::Alignment a); + +private: + int _row; + int _column; + int _rowspan; + int _colspan; + Qt::Alignment _alignment; +}; + +QT_END_NAMESPACE + +QML_DECLARE_INTERFACE(QGraphicsLayoutItem) +QML_DECLARE_INTERFACE(QGraphicsLayout) +QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject) +QML_DECLARE_TYPE(QGraphicsLinearLayoutObject) +QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QGraphicsGridLayoutObject) +QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES) + +QT_END_HEADER + +#endif // GRAPHICSLAYOUTS_H diff --git a/src/declarative/imports/widgets/graphicswidgets.cpp b/src/declarative/imports/widgets/graphicswidgets.cpp new file mode 100644 index 0000000..062e516 --- /dev/null +++ b/src/declarative/imports/widgets/graphicswidgets.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ diff --git a/src/declarative/imports/widgets/graphicswidgets_p.h b/src/declarative/imports/widgets/graphicswidgets_p.h new file mode 100644 index 0000000..2c2b707 --- /dev/null +++ b/src/declarative/imports/widgets/graphicswidgets_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GRAPHICSWIDGETS_H +#define GRAPHICSWIDGETS_H + +#include + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QGraphicsView) +QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene) +QML_DECLARE_TYPE(QGraphicsWidget) +QML_DECLARE_TYPE(QGraphicsObject) +QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem) + +QT_END_HEADER + +#endif // GRAPHICSWIDGETS_H diff --git a/src/declarative/imports/widgets/widgets.cpp b/src/declarative/imports/widgets/widgets.cpp new file mode 100644 index 0000000..ec21cc4 --- /dev/null +++ b/src/declarative/imports/widgets/widgets.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "graphicslayouts_p.h" +#include "graphicswidgets_p.h" + +QT_BEGIN_NAMESPACE + +class QGraphicsViewDeclarativeUI : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene) + Q_CLASSINFO("DefaultProperty", "scene") +public: + QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {} + + QGraphicsScene *scene() const { return static_cast(parent())->scene(); } + void setScene(QGraphicsScene *scene) + { + static_cast(parent())->setScene(scene); + } +}; + +class QGraphicsSceneDeclarativeUI : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {} + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this->parent(), 0, children_append); } + +private: + static void children_append(QDeclarativeListProperty *prop, QObject *o) { + if (QGraphicsObject *go = qobject_cast(o)) + static_cast(prop->object)->addItem(go); + } +}; + +class QGraphicsWidgetDeclarativeUI : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {} + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append); } + + QGraphicsLayout *layout() const { return static_cast(parent())->layout(); } + void setLayout(QGraphicsLayout *lo) + { + static_cast(parent())->setLayout(lo); + } + +private: + void setItemParent(QGraphicsItem *wid) + { + wid->setParentItem(static_cast(parent())); + } + + static void children_append(QDeclarativeListProperty *prop, QGraphicsItem *i) { + static_cast(prop->object)->setItemParent(i); + } +}; + +class QWidgetsQmlModule : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets")); + + QML_REGISTER_INTERFACE(QGraphicsLayoutItem); + QML_REGISTER_INTERFACE(QGraphicsLayout); + qmlRegisterType(uri,4,6,"QGraphicsLinearLayoutStretchItem"); + qmlRegisterType(uri,4,6,"QGraphicsLinearLayout"); + qmlRegisterType(uri,4,6,"QGraphicsGridLayout"); + qmlRegisterExtendedType(uri,4,6,"QGraphicsView"); + qmlRegisterExtendedType(uri,4,6,"QGraphicsScene"); + qmlRegisterExtendedType(uri,4,6,"QGraphicsWidget"); + QML_REGISTER_INTERFACE(QGraphicsItem); + } +}; + +QT_END_NAMESPACE + +#include "widgets.moc" + +Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule)); + diff --git a/src/declarative/imports/widgets/widgets.pro b/src/declarative/imports/widgets/widgets.pro new file mode 100644 index 0000000..230d398 --- /dev/null +++ b/src/declarative/imports/widgets/widgets.pro @@ -0,0 +1,20 @@ +TARGET = widgets +include(../qimportbase.pri) + +QT += declarative + +SOURCES += \ + graphicslayouts.cpp \ + widgets.cpp + +HEADERS += \ + graphicswidgets_p.h \ + graphicslayouts_p.h + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/widgets +target.path = $$[QT_INSTALL_IMPORTS]/Qt/widgets + +qmldir.files += $$QT_BUILD_TREE/imports/Qt/widgets/qmldir +qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/widgets + +INSTALLS += target qmldir diff --git a/src/declarative/libdeclarative.pro b/src/declarative/libdeclarative.pro new file mode 100644 index 0000000..4287e25 --- /dev/null +++ b/src/declarative/libdeclarative.pro @@ -0,0 +1,29 @@ +TARGET = QtDeclarative +QPRO_PWD = $$PWD +QT = core gui xml script network +contains(QT_CONFIG, svg): QT += svg +contains(QT_CONFIG, opengl): QT += opengl +DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING +win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 +solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 + +unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml + +exists("qdeclarative_enable_gcov") { + QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors + LIBS += -lgcov +} + +include(../qbase.pri) + +#INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$TARGET +#DESTDIR=. + +#modules +include(3rdparty/3rdparty.pri) +include(util/util.pri) +include(graphicsitems/graphicsitems.pri) +include(qml/qml.pri) +include(debugger/debugger.pri) + +symbian:TARGET.UID3=0x2001E623 diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 418fd81..730fdc5 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -12,6 +12,5 @@ embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers symbian:SUBDIRS += s60 contains(QT_CONFIG, phonon): SUBDIRS *= phonon contains(QT_CONFIG, multimedia): SUBDIRS *= audio mediaservices -contains(QT_CONFIG, declarative): SUBDIRS *= qdeclarativemodules diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp deleted file mode 100644 index 8becbf3..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QMultimediaQmlModule : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - QtMultimedia::qRegisterDeclarativeElements(uri); - } -}; - -QT_END_NAMESPACE - -#include "multimedia.moc" - -Q_EXPORT_PLUGIN2(qmultimediaqmlmodule, QT_PREPEND_NAMESPACE(QMultimediaQmlModule)); - diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro deleted file mode 100644 index d8ad18e..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro +++ /dev/null @@ -1,15 +0,0 @@ -TARGET = multimedia -include(../../qpluginbase.pri) - -QT += multimedia declarative - -SOURCES += multimedia.cpp - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia -target.path = $$[QT_INSTALL_IMPORTS]/Qt/multimedia - -qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/multimedia - -INSTALLS += target qmldir - diff --git a/src/plugins/qdeclarativemodules/qdeclarativemodules.pro b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro deleted file mode 100644 index ae53578..0000000 --- a/src/plugins/qdeclarativemodules/qdeclarativemodules.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += widgets - -contains(QT_CONFIG, multimedia): SUBDIRS += multimedia -contains(QT_CONFIG, webkit): SUBDIRS += webkitqmlplugin - diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp b/src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp deleted file mode 100644 index 2f6205d..0000000 --- a/src/plugins/qdeclarativemodules/webkitqmlplugin/plugin.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include "qdeclarativewebview_p.h" -#include "qdeclarativewebview_p_p.h" - -QT_BEGIN_NAMESPACE - -class WebKitQmlPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit")); - qmlRegisterType(uri,1,0,"WebView"); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" - -Q_EXPORT_PLUGIN2(webkitqmlplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); - diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp deleted file mode 100644 index 733ac86..0000000 --- a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview.cpp +++ /dev/null @@ -1,1340 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativewebview_p.h" -#include "qdeclarativewebview_p_p.h" - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system - -class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeWebView) - -public: - QDeclarativeWebViewPrivate() - : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0), - progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone), - newWindowComponent(0), newWindowParent(0), - pressTime(400), - rendering(true) - { - } - - QUrl url; // page url might be different if it has not loaded yet - QWebPage *page; - - int preferredwidth, preferredheight; - qreal progress; - QDeclarativeWebView::Status status; - QString statusText; - enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; - QUrl pending_url; - QString pending_string; - QByteArray pending_data; - mutable QDeclarativeWebSettings settings; - QDeclarativeComponent *newWindowComponent; - QDeclarativeItem *newWindowParent; - - QBasicTimer pressTimer; - QPoint pressPoint; - int pressTime; // milliseconds before it's a "hold" - - - static void windowObjects_append(QDeclarativeListProperty *prop, QObject *o) { - static_cast(prop->data)->windowObjects.append(o); - static_cast(prop->data)->updateWindowObjects(); - } - - void updateWindowObjects(); - QObjectList windowObjects; - - bool rendering; -}; - -/*! - \qmlclass WebView QDeclarativeWebView - \since 4.7 - \brief The WebView item allows you to add web content to a canvas. - \inherits Item - - A WebView renders web content based on a URL. - - If the width and height of the item is not set, they will - dynamically adjust to a size appropriate for the content. - This width may be large for typical online web pages. - - If the preferredWidth is set, the width will be this amount or larger, - usually laying out the web content to fit the preferredWidth. - - \qml - import org.webkit 1.0 - - WebView { - url: "http://www.nokia.com" - width: 490 - height: 400 - scale: 0.5 - smooth: false - smoothCache: true - } - \endqml - - \image webview.png - - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. -*/ - -/*! - \internal - \class QDeclarativeWebView - \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView. - - A WebView renders web content base on a URL. - - \image webview.png - - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. - - A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView. -*/ - -QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) - : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent) -{ - init(); -} - -QDeclarativeWebView::~QDeclarativeWebView() -{ - Q_D(QDeclarativeWebView); - delete d->page; -} - -void QDeclarativeWebView::init() -{ - Q_D(QDeclarativeWebView); - - QWebSettings::enablePersistentStorage(); - - setAcceptHoverEvents(true); - setAcceptedMouseButtons(Qt::LeftButton); - setFlag(QGraphicsItem::ItemHasNoContents, false); - - d->page = 0; -} - -void QDeclarativeWebView::componentComplete() -{ - QDeclarativePaintedItem::componentComplete(); - Q_D(QDeclarativeWebView); - switch (d->pending) { - case QDeclarativeWebViewPrivate::PendingUrl: - setUrl(d->pending_url); - break; - case QDeclarativeWebViewPrivate::PendingHtml: - setHtml(d->pending_string, d->pending_url); - break; - case QDeclarativeWebViewPrivate::PendingContent: - setContent(d->pending_data, d->pending_string, d->pending_url); - break; - default: - break; - } - d->pending = QDeclarativeWebViewPrivate::PendingNone; - d->updateWindowObjects(); -} - -QDeclarativeWebView::Status QDeclarativeWebView::status() const -{ - Q_D(const QDeclarativeWebView); - return d->status; -} - - -/*! - \qmlproperty real WebView::progress - This property holds the progress of loading the current URL, from 0 to 1. - - If you just want to know when progress gets to 1, use - WebView::onLoadFinished() or WebView::onLoadFailed() instead. -*/ -qreal QDeclarativeWebView::progress() const -{ - Q_D(const QDeclarativeWebView); - return d->progress; -} - -void QDeclarativeWebView::doLoadStarted() -{ - Q_D(QDeclarativeWebView); - - if (!d->url.isEmpty()) { - d->status = Loading; - emit statusChanged(d->status); - } - emit loadStarted(); -} - -void QDeclarativeWebView::doLoadProgress(int p) -{ - Q_D(QDeclarativeWebView); - if (d->progress == p/100.0) - return; - d->progress = p/100.0; - emit progressChanged(); -} - -void QDeclarativeWebView::pageUrlChanged() -{ - Q_D(QDeclarativeWebView); - - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - expandToWebPage(); - - if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) - || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) - { - d->url = page()->mainFrame()->url(); - if (d->url == QUrl(QLatin1String("about:blank"))) - d->url = QUrl(); - emit urlChanged(); - } -} - -void QDeclarativeWebView::doLoadFinished(bool ok) -{ - Q_D(QDeclarativeWebView); - - if (title().isEmpty()) - pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() - - if (ok) { - d->status = d->url.isEmpty() ? Null : Ready; - emit loadFinished(); - } else { - d->status = Error; - emit loadFailed(); - } - emit statusChanged(d->status); -} - -/*! - \qmlproperty url WebView::url - This property holds the URL to the page displayed in this item. It can be set, - but also can change spontaneously (eg. because of network redirection). - - If the url is empty, the page is blank. - - The url is always absolute (QML will resolve relative URL strings in the context - of the containing QML document). -*/ -QUrl QDeclarativeWebView::url() const -{ - Q_D(const QDeclarativeWebView); - return d->url; -} - -void QDeclarativeWebView::setUrl(const QUrl &url) -{ - Q_D(QDeclarativeWebView); - if (url == d->url) - return; - - if (isComponentComplete()) { - d->url = url; - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - QUrl seturl = url; - if (seturl.isEmpty()) - seturl = QUrl(QLatin1String("about:blank")); - - Q_ASSERT(!seturl.isRelative()); - - page()->mainFrame()->load(seturl); - - emit urlChanged(); - } else { - d->pending = d->PendingUrl; - d->pending_url = url; - } -} - -/*! - \qmlproperty int WebView::preferredWidth - This property holds the ideal width for displaying the current URL. -*/ -int QDeclarativeWebView::preferredWidth() const -{ - Q_D(const QDeclarativeWebView); - return d->preferredwidth; -} - -void QDeclarativeWebView::setPreferredWidth(int iw) -{ - Q_D(QDeclarativeWebView); - if (d->preferredwidth == iw) return; - d->preferredwidth = iw; - //expandToWebPage(); - emit preferredWidthChanged(); -} - -/*! - \qmlproperty int WebView::preferredHeight - This property holds the ideal height for displaying the current URL. - This only affects the area zoomed by heuristicZoom(). -*/ -int QDeclarativeWebView::preferredHeight() const -{ - Q_D(const QDeclarativeWebView); - return d->preferredheight; -} -void QDeclarativeWebView::setPreferredHeight(int ih) -{ - Q_D(QDeclarativeWebView); - if (d->preferredheight == ih) return; - d->preferredheight = ih; - emit preferredHeightChanged(); -} - -/*! - \qmlmethod bool WebView::evaluateJavaScript(string) - - Evaluates the \a scriptSource JavaScript inside the context of the - main web frame, and returns the result of the last executed statement. - - Note that this JavaScript does \e not have any access to QML objects - except as made available as windowObjects. -*/ -QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource) -{ - return this->page()->mainFrame()->evaluateJavaScript(scriptSource); -} - -void QDeclarativeWebView::focusChanged(bool hasFocus) -{ - QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); - page()->event(&e); - QDeclarativeItem::focusChanged(hasFocus); -} - -void QDeclarativeWebView::initialLayout() -{ - // nothing useful to do at this point -} - -void QDeclarativeWebView::noteContentsSizeChanged(const QSize&) -{ - expandToWebPage(); -} - -void QDeclarativeWebView::expandToWebPage() -{ - Q_D(QDeclarativeWebView); - QSize cs = page()->mainFrame()->contentsSize(); - if (cs.width() < d->preferredwidth) - cs.setWidth(d->preferredwidth); - if (cs.height() < d->preferredheight) - cs.setHeight(d->preferredheight); - if (widthValid()) - cs.setWidth(width()); - if (heightValid()) - cs.setHeight(height()); - if (cs != page()->viewportSize()) { - page()->setViewportSize(cs); - } - if (cs != contentsSize()) - setContentsSize(cs); -} - -void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) -{ - if (newGeometry.size() != oldGeometry.size()) - expandToWebPage(); - QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); -} - -void QDeclarativeWebView::paintPage(const QRect& r) -{ - dirtyCache(r); - update(); -} - -/*! - \qmlproperty list WebView::javaScriptWindowObjects - - This property is a list of object that are available from within - the webview's JavaScript context. - - The \a object will be inserted as a child of the frame's window - object, under the name given by the attached property \c WebView.windowObjectName. - - \qml - WebView { - javaScriptWindowObjects: Object { - WebView.windowObjectName: "coordinates" - } - } - \endqml - - Properties of the object will be exposed as JavaScript properties and slots as - JavaScript methods. - - If Javascript is not enabled for this page, then this property does nothing. -*/ -QDeclarativeListProperty QDeclarativeWebView::javaScriptWindowObjects() -{ - Q_D(QDeclarativeWebView); - return QDeclarativeListProperty(this, d, &QDeclarativeWebViewPrivate::windowObjects_append); -} - -QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject *o) -{ - return new QDeclarativeWebViewAttached(o); -} - -void QDeclarativeWebViewPrivate::updateWindowObjects() -{ - Q_Q(QDeclarativeWebView); - if (!q->isComponentComplete() || !page) - return; - - for (int ii = 0; ii < windowObjects.count(); ++ii) { - QObject *object = windowObjects.at(ii); - QDeclarativeWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); - if (attached && !attached->windowObjectName().isEmpty()) { - page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); - } - } -} - -bool QDeclarativeWebView::renderingEnabled() const -{ - Q_D(const QDeclarativeWebView); - return d->rendering; -} - -void QDeclarativeWebView::setRenderingEnabled(bool enabled) -{ - Q_D(QDeclarativeWebView); - if (d->rendering == enabled) - return; - d->rendering = enabled; - emit renderingEnabledChanged(); - - setCacheFrozen(!enabled); - if (enabled) - clearCache(); -} - - -void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r) -{ - Q_D(QDeclarativeWebView); - if (d->rendering) - page()->mainFrame()->render(p,r); -} - -QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) -{ - QEvent::Type t; - switch(e->type()) { - default: - case QEvent::GraphicsSceneMousePress: - t = QEvent::MouseButtonPress; - break; - case QEvent::GraphicsSceneMouseRelease: - t = QEvent::MouseButtonRelease; - break; - case QEvent::GraphicsSceneMouseMove: - t = QEvent::MouseMove; - break; - case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick: - t = QEvent::MouseButtonDblClick; - break; - } - - QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), e->button(), e->buttons(), 0); - return me; -} - -QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) -{ - QEvent::Type t = QEvent::MouseMove; - - QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), Qt::NoButton, Qt::NoButton, 0); - - return me; -} - - -/*! - \qmlsignal WebView::onDoubleClick(clickx,clicky) - - The WebView does not pass double-click events to the web engine, but rather - emits this signals. -*/ - -void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -{ - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - emit doubleClick(me->x(),me->y()); - delete me; -} - -/*! - \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) - - Finds a zoom that: - \list - \i shows a whole item - \i includes (\a clickX, \a clickY) - \i fits into the preferredWidth and preferredHeight - \i zooms by no more than \a maxzoom - \i is more than 10% above the current zoom - \endlist - - If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, - no signal is emitted and returns false. -*/ -bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) -{ - Q_D(QDeclarativeWebView); - if (contentsScale() >= maxzoom/zoomFactor()) - return false; - qreal ozf = contentsScale(); - QRect showarea = elementAreaAt(clickX, clickY, d->preferredwidth/maxzoom, d->preferredheight/maxzoom); - qreal z = qMin(qreal(d->preferredwidth)/showarea.width(),qreal(d->preferredheight)/showarea.height()); - if (z > maxzoom/zoomFactor()) - z = maxzoom/zoomFactor(); - if (z/ozf > 1.2) { - QRectF r(showarea.left()*z, showarea.top()*z, showarea.width()*z, showarea.height()*z); - emit zoomTo(z,r.x()+r.width()/2, r.y()+r.height()/2); - return true; - } else { - return false; - } -} - -/*! - \qmlproperty int WebView::pressGrabTime - - The number of milliseconds the user must press before the WebView - starts passing move events through to the web engine (rather than - letting other QML elements such as a Flickable take them). - - Defaults to 400ms. Set to 0 to always grab and pass move events to - the web engine. -*/ -int QDeclarativeWebView::pressGrabTime() const -{ - Q_D(const QDeclarativeWebView); - return d->pressTime; -} - -void QDeclarativeWebView::setPressGrabTime(int ms) -{ - Q_D(QDeclarativeWebView); - if (d->pressTime == ms) - return; - d->pressTime = ms; - emit pressGrabTimeChanged(); -} - -void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - setFocus (true); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - - d->pressPoint = me->pos(); - if (d->pressTime) { - d->pressTimer.start(d->pressTime,this); - setKeepMouseGrab(false); - } else { - grabMouse(); - setKeepMouseGrab(true); - } - - page()->event(me); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit - Might be a bug in WebKit, though - */ -#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) { - QDeclarativePaintedItem::mousePressEvent(event); - } -} - -void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - page()->event(me); - d->pressTimer.stop(); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send all the events to WebKit - */ -#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) { - QDeclarativePaintedItem::mouseReleaseEvent(event); - } - setKeepMouseGrab(false); - ungrabMouse(); -} - -void QDeclarativeWebView::timerEvent(QTimerEvent *event) -{ - Q_D(QDeclarativeWebView); - if (event->timerId() == d->pressTimer.timerId()) { - d->pressTimer.stop(); - grabMouse(); - setKeepMouseGrab(true); - } -} - -void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - if (d->pressTimer.isActive()) { - if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { - d->pressTimer.stop(); - } - } - if (keepMouseGrab()) { - page()->event(me); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit - Might be a bug in WebKit, though - */ -#if 1 // QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - } - delete me; - if (!event->isAccepted()) - QDeclarativePaintedItem::mouseMoveEvent(event); - -} -void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) -{ - QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); - page()->event(me); - event->setAccepted( -#if QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) - QDeclarativePaintedItem::hoverMoveEvent(event); -} - -void QDeclarativeWebView::keyPressEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyPressEvent(event); -} - -void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyReleaseEvent(event); -} - -bool QDeclarativeWebView::sceneEvent(QEvent *event) -{ - if (event->type() == QEvent::KeyPress) { - QKeyEvent *k = static_cast(event); - if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { - if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? - page()->event(event); - if (event->isAccepted()) - return true; - } - } - } - return QDeclarativePaintedItem::sceneEvent(event); -} - - -/*! - \qmlproperty action WebView::back - This property holds the action for causing the previous URL in the history to be displayed. -*/ -QAction *QDeclarativeWebView::backAction() const -{ - return page()->action(QWebPage::Back); -} - -/*! - \qmlproperty action WebView::forward - This property holds the action for causing the next URL in the history to be displayed. -*/ -QAction *QDeclarativeWebView::forwardAction() const -{ - return page()->action(QWebPage::Forward); -} - -/*! - \qmlproperty action WebView::reload - This property holds the action for reloading with the current URL -*/ -QAction *QDeclarativeWebView::reloadAction() const -{ - return page()->action(QWebPage::Reload); -} - -/*! - \qmlproperty action WebView::stop - This property holds the action for stopping loading with the current URL -*/ -QAction *QDeclarativeWebView::stopAction() const -{ - return page()->action(QWebPage::Stop); -} - -/*! - \qmlproperty real WebView::title - This property holds the title of the web page currently viewed - - By default, this property contains an empty string. -*/ -QString QDeclarativeWebView::title() const -{ - return page()->mainFrame()->title(); -} - - - -/*! - \qmlproperty pixmap WebView::icon - This property holds the icon associated with the web page currently viewed -*/ -QPixmap QDeclarativeWebView::icon() const -{ - return page()->mainFrame()->icon().pixmap(QSize(256,256)); -} - - -/*! - \qmlproperty real WebView::zoomFactor - This property holds the multiplier used to scale the contents of a Web page. -*/ -void QDeclarativeWebView::setZoomFactor(qreal factor) -{ - Q_D(QDeclarativeWebView); - if (factor == page()->mainFrame()->zoomFactor()) - return; - - page()->mainFrame()->setZoomFactor(factor); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor, - d->preferredheight>0 ? d->preferredheight*factor : height()*factor)); - expandToWebPage(); - - emit zoomFactorChanged(); -} - -qreal QDeclarativeWebView::zoomFactor() const -{ - return page()->mainFrame()->zoomFactor(); -} - -/*! - \qmlproperty string WebView::statusText - - This property is the current status suggested by the current web page. In a web browser, - such status is often shown in some kind of status bar. -*/ -void QDeclarativeWebView::setStatusText(const QString& s) -{ - Q_D(QDeclarativeWebView); - d->statusText = s; - emit statusTextChanged(); -} - -void QDeclarativeWebView::windowObjectCleared() -{ - Q_D(QDeclarativeWebView); - d->updateWindowObjects(); -} - -QString QDeclarativeWebView::statusText() const -{ - Q_D(const QDeclarativeWebView); - return d->statusText; -} - -QWebPage *QDeclarativeWebView::page() const -{ - Q_D(const QDeclarativeWebView); - - if (!d->page) { - QDeclarativeWebView *self = const_cast(this); - QWebPage *wp = new QDeclarativeWebPage(self); - - // QML items don't default to having a background, - // even though most we pages will set one anyway. - QPalette pal = QApplication::palette(); - pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); - wp->setPalette(pal); - - wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); - - self->setPage(wp); - - return wp; - } - - return d->page; -} - - -// The QObject interface to settings(). -/*! - \qmlproperty string WebView::settings.standardFontFamily - \qmlproperty string WebView::settings.fixedFontFamily - \qmlproperty string WebView::settings.serifFontFamily - \qmlproperty string WebView::settings.sansSerifFontFamily - \qmlproperty string WebView::settings.cursiveFontFamily - \qmlproperty string WebView::settings.fantasyFontFamily - - \qmlproperty int WebView::settings.minimumFontSize - \qmlproperty int WebView::settings.minimumLogicalFontSize - \qmlproperty int WebView::settings.defaultFontSize - \qmlproperty int WebView::settings.defaultFixedFontSize - - \qmlproperty bool WebView::settings.autoLoadImages - \qmlproperty bool WebView::settings.javascriptEnabled - \qmlproperty bool WebView::settings.javaEnabled - \qmlproperty bool WebView::settings.pluginsEnabled - \qmlproperty bool WebView::settings.privateBrowsingEnabled - \qmlproperty bool WebView::settings.javascriptCanOpenWindows - \qmlproperty bool WebView::settings.javascriptCanAccessClipboard - \qmlproperty bool WebView::settings.developerExtrasEnabled - \qmlproperty bool WebView::settings.linksIncludedInFocusChain - \qmlproperty bool WebView::settings.zoomTextOnly - \qmlproperty bool WebView::settings.printElementBackgrounds - \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled - \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled - \qmlproperty bool WebView::settings.localStorageDatabaseEnabled - \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls - - These properties give access to the settings controlling the web view. - - See QWebSettings for details of these properties. - - \qml - WebView { - settings.pluginsEnabled: true - settings.standardFontFamily: "Arial" - ... - } - \endqml -*/ -QObject *QDeclarativeWebView::settingsObject() const -{ - Q_D(const QDeclarativeWebView); - d->settings.s = page()->settings(); - return &d->settings; -} - -void QDeclarativeWebView::setPage(QWebPage *page) -{ - Q_D(QDeclarativeWebView); - if (d->page == page) - return; - if (d->page) { - if (d->page->parent() == this) { - delete d->page; - } else { - d->page->disconnect(this); - } - } - d->page = page; - d->page->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff); - d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); - connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); - connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); - connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); - connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); - connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); - connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); - connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); - - connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted())); - connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int))); - connect(d->page,SIGNAL(loadFinished(bool)),this,SLOT(doLoadFinished(bool))); - connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString))); - - connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared())); -} - -/*! - \qmlsignal WebView::onLoadStarted() - - This handler is called when the web engine begins loading - a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() - will be emitted. -*/ - -/*! - \qmlsignal WebView::onLoadFinished() - - This handler is called when the web engine \e successfully - finishes loading a page, including any component content - (WebView::onLoadFailed() will be emitted otherwise). - - \sa progress -*/ - -/*! - \qmlsignal WebView::onLoadFailed() - - This handler is called when the web engine fails loading - a page or any component content - (WebView::onLoadFinished() will be emitted on success). -*/ - -void QDeclarativeWebView::load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation, - const QByteArray &body) -{ - page()->mainFrame()->load(request, operation, body); -} - -QString QDeclarativeWebView::html() const -{ - return page()->mainFrame()->toHtml(); -} - -/*! - \qmlproperty string WebView::html - This property holds HTML text set directly - - The html property can be set as a string. - - \qml - WebView { - html: "

This is HTML." - } - \endqml -*/ -void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) -{ - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - if (isComponentComplete()) - page()->mainFrame()->setHtml(html, baseUrl); - else { - d->pending = d->PendingHtml; - d->pending_url = baseUrl; - d->pending_string = html; - } - emit htmlChanged(); -} - -void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) -{ - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - - if (isComponentComplete()) - page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); - else { - d->pending = d->PendingContent; - d->pending_url = baseUrl; - d->pending_string = mimeType; - d->pending_data = data; - } -} - -QWebHistory *QDeclarativeWebView::history() const -{ - return page()->history(); -} - -QWebSettings *QDeclarativeWebView::settings() const -{ - return page()->settings(); -} - -QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) -{ - Q_D(QDeclarativeWebView); - switch (type) { - case QWebPage::WebBrowserWindow: { - if (!d->newWindowComponent && d->newWindowParent) - qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored"); - else if (d->newWindowComponent && !d->newWindowParent) - qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); - else if (d->newWindowComponent && d->newWindowParent) { - QDeclarativeWebView *webview = 0; - QDeclarativeContext *windowContext = new QDeclarativeContext(qmlContext(this)); - - QObject *nobj = d->newWindowComponent->create(windowContext); - if (nobj) { - windowContext->setParent(nobj); - QDeclarativeItem *item = qobject_cast(nobj); - if (!item) { - delete nobj; - } else { - webview = item->findChild(); - if (!webview) { - delete item; - } else { - nobj->setParent(d->newWindowParent); - static_cast(item)->setParentItem(d->newWindowParent); - } - } - } else { - delete windowContext; - } - - return webview; - } - } - break; - case QWebPage::WebModalDialog: { - // Not supported - } - } - return 0; -} - -/*! - \qmlproperty component WebView::newWindowComponent - - This property holds the component to use for new windows. - The component must have a WebView somewhere in its structure. - - When the web engine requests a new window, it will be an instance of - this component. - - The parent of the new window is set by newWindowParent. It must be set. -*/ -QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const -{ - Q_D(const QDeclarativeWebView); - return d->newWindowComponent; -} - -void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow) -{ - Q_D(QDeclarativeWebView); - if (newWindow == d->newWindowComponent) - return; - d->newWindowComponent = newWindow; - emit newWindowComponentChanged(); -} - - -/*! - \qmlproperty item WebView::newWindowParent - - The parent item for new windows. - - \sa newWindowComponent -*/ -QDeclarativeItem *QDeclarativeWebView::newWindowParent() const -{ - Q_D(const QDeclarativeWebView); - return d->newWindowParent; -} - -void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) -{ - Q_D(QDeclarativeWebView); - if (parent == d->newWindowParent) - return; - if (d->newWindowParent && parent) { - QList children = d->newWindowParent->childItems(); - for (int i = 0; i < children.count(); ++i) { - children.at(i)->setParentItem(parent); - } - } - d->newWindowParent = parent; - emit newWindowParentChanged(); -} - -/*! - Returns the area of the largest element at position (\a x,\a y) that is no larger - than \a maxwidth by \a maxheight pixels. - - May return an area larger in the case when no smaller element is at the position. -*/ -QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const -{ - QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y)); - QRect rv = hit.boundingRect(); - QWebElement element = hit.enclosingBlockElement(); - if (maxwidth<=0) maxwidth = INT_MAX; - if (maxheight<=0) maxheight = INT_MAX; - while (!element.parent().isNull() && element.geometry().width() <= maxwidth && element.geometry().height() <= maxheight) { - rv = element.geometry(); - element = element.parent(); - } - return rv; -} - -/*! - \internal - \class QDeclarativeWebPage - \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins. - - \sa QDeclarativeWebView -*/ -QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView *parent) : - QWebPage(parent) -{ -} - -QDeclarativeWebPage::~QDeclarativeWebPage() -{ -} - -void QDeclarativeWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) -{ - qWarning() << sourceID << ':' << lineNumber << ':' << message; -} - -QString QDeclarativeWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(oldFile) - return oldFile; -} - -void QDeclarativeWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) -{ - Q_UNUSED(originatingFrame) - emit viewItem()->alert(msg); -} - -bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - return false; -} - -bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - Q_UNUSED(defaultValue) - Q_UNUSED(result) - return false; -} - - -/* - Qt WebKit does not understand non-QWidget plugins, so dummy widgets - are created, parented to a single dummy tool window. - - The requirements for QML object plugins are input to the Qt WebKit - non-QWidget plugin support, which will obsolete this kludge. -*/ -class QWidget_Dummy_Plugin : public QWidget -{ - Q_OBJECT -public: - static QWidget *dummy_shared_parent() - { - static QWidget *dsp = 0; - if (!dsp) { - dsp = new QWidget(0,Qt::Tool); - dsp->setGeometry(-10000,-10000,0,0); - dsp->show(); - } - return dsp; - } - QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : - QWidget(dummy_shared_parent()), - propertyNames(paramNames), - propertyValues(paramValues), - webview(view) - { - QDeclarativeEngine *engine = qmlEngine(webview); - component = new QDeclarativeComponent(engine, url, this); - item = 0; - if (component->isLoading()) - connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded())); - else - qmlLoaded(); - } - -public Q_SLOTS: - void qmlLoaded() - { - if (component->isError()) { - // ### Could instead give these errors to the WebView to handle. - qWarning() << component->errors(); - return; - } - item = qobject_cast(component->create(qmlContext(webview))); - item->setParent(webview); - QString jsObjName; - for (int i=0; isetProperty(propertyNames[i].toUtf8(),propertyValues[i]); - if (propertyNames[i] == QLatin1String("objectname")) - jsObjName = propertyValues[i]; - } - } - if (!jsObjName.isNull()) { - QWebFrame *f = webview->page()->mainFrame(); - f->addToJavaScriptWindowObject(jsObjName, item); - } - resizeEvent(0); - delete component; - component = 0; - } - void resizeEvent(QResizeEvent*) - { - if (item) { - item->setX(x()); - item->setY(y()); - item->setWidth(width()); - item->setHeight(height()); - } - } - -private: - QDeclarativeComponent *component; - QDeclarativeItem *item; - QStringList propertyNames, propertyValues; - QDeclarativeWebView *webview; -}; - -QDeclarativeWebView *QDeclarativeWebPage::viewItem() -{ - return static_cast(parent()); -} - -QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) -{ - QUrl comp = qmlContext(viewItem())->resolvedUrl(url); - return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); -} - -QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) -{ - QDeclarativeWebView *newView = viewItem()->createWindow(type); - if (newView) - return newView->page(); - return 0; -} - -QT_END_NAMESPACE - -#include diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h deleted file mode 100644 index 0bb5d29..0000000 --- a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p.h +++ /dev/null @@ -1,285 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEWEBVIEW_H -#define QDECLARATIVEWEBVIEW_H - -#include - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -class QWebHistory; -class QWebSettings; - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QDeclarativeWebViewPrivate; -class QNetworkRequest; -class QDeclarativeWebView; - -class Q_DECLARATIVE_EXPORT QDeclarativeWebPage : public QWebPage -{ - Q_OBJECT -public: - explicit QDeclarativeWebPage(QDeclarativeWebView *parent); - ~QDeclarativeWebPage(); -protected: - QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); - QWebPage *createWindow(WebWindowType type); - void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); - QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); - void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); - -private: - QDeclarativeWebView *viewItem(); -}; - - -class QDeclarativeWebViewAttached; - -//### TODO: browser plugins - -class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem -{ - Q_OBJECT - - Q_ENUMS(Status SelectionMode) - - Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) - Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) - Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) - - Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) - - Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged) - - Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) - Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - - Q_PROPERTY(QAction* reload READ reloadAction CONSTANT) - Q_PROPERTY(QAction* back READ backAction CONSTANT) - Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) - Q_PROPERTY(QAction* stop READ stopAction CONSTANT) - - Q_PROPERTY(QObject* settings READ settingsObject CONSTANT) - - Q_PROPERTY(QDeclarativeListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) - - Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) - Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) - - Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) - -public: - QDeclarativeWebView(QDeclarativeItem *parent=0); - ~QDeclarativeWebView(); - - QUrl url() const; - void setUrl(const QUrl &); - - QString title() const; - - QPixmap icon() const; - - qreal zoomFactor() const; - void setZoomFactor(qreal); - Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); - QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; - - int pressGrabTime() const; - void setPressGrabTime(int); - - int preferredWidth() const; - void setPreferredWidth(int); - int preferredHeight() const; - void setPreferredHeight(int); - - enum Status { Null, Ready, Loading, Error }; - Status status() const; - qreal progress() const; - QString statusText() const; - - QAction *reloadAction() const; - QAction *backAction() const; - QAction *forwardAction() const; - QAction *stopAction() const; - - QWebPage *page() const; - void setPage(QWebPage *page); - - void load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, - const QByteArray &body = QByteArray()); - - QString html() const; - - void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); - void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); - - QWebHistory *history() const; - QWebSettings *settings() const; - QObject *settingsObject() const; - - bool renderingEnabled() const; - void setRenderingEnabled(bool); - - QDeclarativeListProperty javaScriptWindowObjects(); - - static QDeclarativeWebViewAttached *qmlAttachedProperties(QObject *); - - QDeclarativeComponent *newWindowComponent() const; - void setNewWindowComponent(QDeclarativeComponent *newWindow); - QDeclarativeItem *newWindowParent() const; - void setNewWindowParent(QDeclarativeItem *newWindow); - -Q_SIGNALS: - void preferredWidthChanged(); - void preferredHeightChanged(); - void urlChanged(); - void progressChanged(); - void statusChanged(Status); - void titleChanged(const QString&); - void iconChanged(); - void statusTextChanged(); - void htmlChanged(); - void pressGrabTimeChanged(); - void zoomFactorChanged(); - void newWindowComponentChanged(); - void newWindowParentChanged(); - void renderingEnabledChanged(); - - void loadStarted(); - void loadFinished(); - void loadFailed(); - - void doubleClick(int clickX, int clickY); - - void zoomTo(qreal zoom, int centerX, int centerY); - - void alert(const QString& message); - -public Q_SLOTS: - QVariant evaluateJavaScript(const QString&); - -private Q_SLOTS: - void expandToWebPage(); - void paintPage(const QRect&); - void doLoadStarted(); - void doLoadProgress(int p); - void doLoadFinished(bool ok); - void setStatusText(const QString&); - void windowObjectCleared(); - void pageUrlChanged(); - void noteContentsSizeChanged(const QSize&); - void initialLayout(); - -protected: - void drawContents(QPainter *, const QRect &); - - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void timerEvent(QTimerEvent *event); - void hoverMoveEvent (QGraphicsSceneHoverEvent * event); - void keyPressEvent(QKeyEvent* event); - void keyReleaseEvent(QKeyEvent* event); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - virtual void focusChanged(bool); - virtual bool sceneEvent(QEvent *event); - QDeclarativeWebView *createWindow(QWebPage::WebWindowType type); - -private: - void init(); - virtual void componentComplete(); - Q_DISABLE_COPY(QDeclarativeWebView) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView) - QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *); - QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *); - friend class QDeclarativeWebPage; -}; - -class QDeclarativeWebViewAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) -public: - QDeclarativeWebViewAttached(QObject *parent) - : QObject(parent) - { - } - - QString windowObjectName() const - { - return m_windowObjectName; - } - - void setWindowObjectName(const QString &n) - { - m_windowObjectName = n; - } - -private: - QString m_windowObjectName; -}; - - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeWebView) -QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES) - -QT_END_HEADER - -#endif diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h b/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h deleted file mode 100644 index 258b472..0000000 --- a/src/plugins/qdeclarativemodules/webkitqmlplugin/qdeclarativewebview_p_p.h +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEWEBVIEW_P_H -#define QDECLARATIVEWEBVIEW_P_H - -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeWebSettings : public QObject { - Q_OBJECT - - Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) - Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) - Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) - Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) - Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) - Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) - - Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) - Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) - Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) - Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) - - Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) - Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) - Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) - Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) - Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) - Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) - Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) - Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) - Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) - Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) - Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) - Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) - Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) - Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) - Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) - -public: - QDeclarativeWebSettings() {} - - QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } - void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } - QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } - void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } - QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } - void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } - QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } - void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } - QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } - void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } - QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } - void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } - - int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } - void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } - int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } - void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } - int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } - void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } - int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } - void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } - - bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } - void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } - bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } - void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } - bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } - void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } - bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } - void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } - bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } - void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } - bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } - void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } - bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } - void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } - bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } - void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } - bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } - void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } - bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } - void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } - bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } - void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } - bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } - void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } - bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } - void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } - bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } - void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } - bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } - void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } - - QWebSettings *s; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeWebSettings) - -QT_END_HEADER - -#endif diff --git a/src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro b/src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro deleted file mode 100644 index 37fe37c..0000000 --- a/src/plugins/qdeclarativemodules/webkitqmlplugin/webkitqmlplugin.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = webkitqmlplugin -include(../../qpluginbase.pri) - -contains(QT_CONFIG, webkit) { - QT += webkit declarative - - SOURCES += qdeclarativewebview.cpp plugin.cpp - HEADERS += qdeclarativewebview_p.h - HEADERS += qdeclarativewebview_p_p.h - - QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/org/webkit - target.path = $$[QT_INSTALL_IMPORTS]/org/webkit - - qmldir.files += $$QT_BUILD_TREE/imports/org/webkit/qmldir - qmldir.path += $$[QT_INSTALL_IMPORTS]/org/webkit - - INSTALLS += target qmldir -} diff --git a/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp b/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp deleted file mode 100644 index fc15ad2..0000000 --- a/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "graphicslayouts_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -LinearLayoutAttached::LinearLayoutAttached(QObject *parent) -: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter) -{ -} - -void LinearLayoutAttached::setStretchFactor(int f) -{ - if (_stretch == f) - return; - - _stretch = f; - emit stretchChanged(reinterpret_cast(parent()), _stretch); -} - -void LinearLayoutAttached::setAlignment(Qt::Alignment a) -{ - if (_alignment == a) - return; - - _alignment = a; - emit alignmentChanged(reinterpret_cast(parent()), _alignment); -} - -QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent) - : QObject(parent) -{ -} - -QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const -{ -Q_UNUSED(which); -Q_UNUSED(constraint); -return QSizeF(); -} - - -QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent) -: QObject(parent) -{ -} - -QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject() -{ -} - -void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item) -{ -insertItem(index, item); - -//connect attached properties -if (LinearLayoutAttached *obj = attachedProperties.value(item)) { - setStretchFactor(item, obj->stretchFactor()); - setAlignment(item, obj->alignment()); - QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)), - this, SLOT(updateStretch(QGraphicsLayoutItem*,int))); - QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)), - this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment))); - //### need to disconnect when widget is removed? -} -} - -//### is there a better way to do this? -void QGraphicsLinearLayoutObject::clearChildren() -{ -for (int i = 0; i < count(); ++i) - removeAt(i); -} - -void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch) -{ -QGraphicsLinearLayout::setStretchFactor(item, stretch); -} - -void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment) -{ -QGraphicsLinearLayout::setAlignment(item, alignment); -} - -QHash QGraphicsLinearLayoutObject::attachedProperties; -LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj) -{ -// ### This is not allowed - you must attach to any object -if (!qobject_cast(obj)) - return 0; -LinearLayoutAttached *rv = new LinearLayoutAttached(obj); -attachedProperties.insert(qobject_cast(obj), rv); -return rv; -} - -////////////////////////////////////////////////////////////////////////////////////////////////////// -// QGraphicsGridLayout-related classes -////////////////////////////////////////////////////////////////////////////////////////////////////// -GridLayoutAttached::GridLayoutAttached(QObject *parent) -: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1) -{ -} - -void GridLayoutAttached::setRow(int r) -{ - if (_row == r) - return; - - _row = r; - //emit rowChanged(reinterpret_cast(parent()), _row); -} - -void GridLayoutAttached::setColumn(int c) -{ - if (_column == c) - return; - - _column = c; - //emit columnChanged(reinterpret_cast(parent()), _column); -} - -void GridLayoutAttached::setRowSpan(int rs) -{ - if (_rowspan == rs) - return; - - _rowspan = rs; - //emit rowSpanChanged(reinterpret_cast(parent()), _rowSpan); -} - -void GridLayoutAttached::setColumnSpan(int cs) -{ - if (_colspan == cs) - return; - - _colspan = cs; - //emit columnSpanChanged(reinterpret_cast(parent()), _columnSpan); -} - -void GridLayoutAttached::setAlignment(Qt::Alignment a) -{ - if (_alignment == a) - return; - - _alignment = a; - //emit alignmentChanged(reinterpret_cast(parent()), _alignment); -} - -QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent) -: QObject(parent) -{ -} - -QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject() -{ -} - -void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid) -{ -//use attached properties -if (QObject *obj = attachedProperties.value(qobject_cast(wid))) { - int row = static_cast(obj)->row(); - int column = static_cast(obj)->column(); - int rowSpan = static_cast(obj)->rowSpan(); - int columnSpan = static_cast(obj)->columnSpan(); - if (row == -1 || column == -1) { - qWarning() << "Must set row and column for an item in a grid layout"; - return; - } - addItem(wid, row, column, rowSpan, columnSpan); -} -} - -void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item) -{ -//use attached properties -if (GridLayoutAttached *obj = attachedProperties.value(item)) { - int row = obj->row(); - int column = obj->column(); - int rowSpan = obj->rowSpan(); - int columnSpan = obj->columnSpan(); - Qt::Alignment alignment = obj->alignment(); - if (row == -1 || column == -1) { - qWarning() << "Must set row and column for an item in a grid layout"; - return; - } - addItem(item, row, column, rowSpan, columnSpan); - if (alignment != -1) - setAlignment(item,alignment); -} -} - -//### is there a better way to do this? -void QGraphicsGridLayoutObject::clearChildren() -{ -for (int i = 0; i < count(); ++i) - removeAt(i); -} - -qreal QGraphicsGridLayoutObject::spacing() const -{ -if (verticalSpacing() == horizontalSpacing()) - return verticalSpacing(); -return -1; //### -} - -QHash QGraphicsGridLayoutObject::attachedProperties; -GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj) -{ -// ### This is not allowed - you must attach to any object -if (!qobject_cast(obj)) - return 0; -GridLayoutAttached *rv = new GridLayoutAttached(obj); -attachedProperties.insert(qobject_cast(obj), rv); -return rv; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h b/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h deleted file mode 100644 index f9b9ae8..0000000 --- a/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GRAPHICSLAYOUTS_H -#define GRAPHICSLAYOUTS_H - -#include "graphicswidgets_p.h" - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem -{ - Q_OBJECT - Q_INTERFACES(QGraphicsLayoutItem) -public: - QGraphicsLinearLayoutStretchItemObject(QObject *parent = 0); - - virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const; -}; - -class LinearLayoutAttached; -class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout -{ - Q_OBJECT - Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) - Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsLinearLayoutObject(QObject * = 0); - ~QGraphicsLinearLayoutObject(); - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } - - static LinearLayoutAttached *qmlAttachedProperties(QObject *); - -private Q_SLOTS: - void updateStretch(QGraphicsLayoutItem*,int); - void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment); - -private: - friend class LinearLayoutAttached; - void clearChildren(); - void insertLayoutItem(int, QGraphicsLayoutItem *); - static QHash attachedProperties; - - static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { - static_cast(prop->object)->insertLayoutItem(-1, item); - } - - static void children_clear(QDeclarativeListProperty *prop) { - static_cast(prop->object)->clearChildren(); - } - - static int children_count(QDeclarativeListProperty *prop) { - return static_cast(prop->object)->count(); - } - - static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { - return static_cast(prop->object)->itemAt(index); - } -}; - -class GridLayoutAttached; -class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout -{ - Q_OBJECT - Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) - Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) - Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsGridLayoutObject(QObject * = 0); - ~QGraphicsGridLayoutObject(); - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } - - qreal spacing() const; - - static GridLayoutAttached *qmlAttachedProperties(QObject *); - -private: - friend class GraphicsLayoutAttached; - void addWidget(QGraphicsWidget *); - void clearChildren(); - void addLayoutItem(QGraphicsLayoutItem *); - static QHash attachedProperties; - - static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { - static_cast(prop->object)->addLayoutItem(item); - } - - static void children_clear(QDeclarativeListProperty *prop) { - static_cast(prop->object)->clearChildren(); - } - - static int children_count(QDeclarativeListProperty *prop) { - return static_cast(prop->object)->count(); - } - - static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { - return static_cast(prop->object)->itemAt(index); - } -}; - -class LinearLayoutAttached : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged) - Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) -public: - LinearLayoutAttached(QObject *parent); - - int stretchFactor() const { return _stretch; } - void setStretchFactor(int f); - Qt::Alignment alignment() const { return _alignment; } - void setAlignment(Qt::Alignment a); - -Q_SIGNALS: - void stretchChanged(QGraphicsLayoutItem*,int); - void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment); - -private: - int _stretch; - Qt::Alignment _alignment; -}; - -class GridLayoutAttached : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int row READ row WRITE setRow) - Q_PROPERTY(int column READ column WRITE setColumn) - Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan) - Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan) - Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) -public: - GridLayoutAttached(QObject *parent); - - int row() const { return _row; } - void setRow(int r); - - int column() const { return _column; } - void setColumn(int c); - - int rowSpan() const { return _rowspan; } - void setRowSpan(int rs); - - int columnSpan() const { return _colspan; } - void setColumnSpan(int cs); - - Qt::Alignment alignment() const { return _alignment; } - void setAlignment(Qt::Alignment a); - -private: - int _row; - int _column; - int _rowspan; - int _colspan; - Qt::Alignment _alignment; -}; - -QT_END_NAMESPACE - -QML_DECLARE_INTERFACE(QGraphicsLayoutItem) -QML_DECLARE_INTERFACE(QGraphicsLayout) -QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject) -QML_DECLARE_TYPE(QGraphicsLinearLayoutObject) -QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES) -QML_DECLARE_TYPE(QGraphicsGridLayoutObject) -QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES) - -QT_END_HEADER - -#endif // GRAPHICSLAYOUTS_H diff --git a/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp b/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp deleted file mode 100644 index 062e516..0000000 --- a/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ diff --git a/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h b/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h deleted file mode 100644 index 2c2b707..0000000 --- a/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GRAPHICSWIDGETS_H -#define GRAPHICSWIDGETS_H - -#include - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QGraphicsView) -QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene) -QML_DECLARE_TYPE(QGraphicsWidget) -QML_DECLARE_TYPE(QGraphicsObject) -QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem) - -QT_END_HEADER - -#endif // GRAPHICSWIDGETS_H diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.cpp b/src/plugins/qdeclarativemodules/widgets/widgets.cpp deleted file mode 100644 index ec21cc4..0000000 --- a/src/plugins/qdeclarativemodules/widgets/widgets.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include "graphicslayouts_p.h" -#include "graphicswidgets_p.h" - -QT_BEGIN_NAMESPACE - -class QGraphicsViewDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene) - Q_CLASSINFO("DefaultProperty", "scene") -public: - QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {} - - QGraphicsScene *scene() const { return static_cast(parent())->scene(); } - void setScene(QGraphicsScene *scene) - { - static_cast(parent())->setScene(scene); - } -}; - -class QGraphicsSceneDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this->parent(), 0, children_append); } - -private: - static void children_append(QDeclarativeListProperty *prop, QObject *o) { - if (QGraphicsObject *go = qobject_cast(o)) - static_cast(prop->object)->addItem(go); - } -}; - -class QGraphicsWidgetDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append); } - - QGraphicsLayout *layout() const { return static_cast(parent())->layout(); } - void setLayout(QGraphicsLayout *lo) - { - static_cast(parent())->setLayout(lo); - } - -private: - void setItemParent(QGraphicsItem *wid) - { - wid->setParentItem(static_cast(parent())); - } - - static void children_append(QDeclarativeListProperty *prop, QGraphicsItem *i) { - static_cast(prop->object)->setItemParent(i); - } -}; - -class QWidgetsQmlModule : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets")); - - QML_REGISTER_INTERFACE(QGraphicsLayoutItem); - QML_REGISTER_INTERFACE(QGraphicsLayout); - qmlRegisterType(uri,4,6,"QGraphicsLinearLayoutStretchItem"); - qmlRegisterType(uri,4,6,"QGraphicsLinearLayout"); - qmlRegisterType(uri,4,6,"QGraphicsGridLayout"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsView"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsScene"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsWidget"); - QML_REGISTER_INTERFACE(QGraphicsItem); - } -}; - -QT_END_NAMESPACE - -#include "widgets.moc" - -Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule)); - diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.pro b/src/plugins/qdeclarativemodules/widgets/widgets.pro deleted file mode 100644 index 3ec38da..0000000 --- a/src/plugins/qdeclarativemodules/widgets/widgets.pro +++ /dev/null @@ -1,20 +0,0 @@ -TARGET = widgets -include(../../qpluginbase.pri) - -QT += declarative - -SOURCES += \ - graphicslayouts.cpp \ - widgets.cpp - -HEADERS += \ - graphicswidgets_p.h \ - graphicslayouts_p.h - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/widgets -target.path = $$[QT_INSTALL_IMPORTS]/Qt/widgets - -qmldir.files += $$QT_BUILD_TREE/imports/Qt/widgets/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/widgets - -INSTALLS += target qmldir -- cgit v0.12 From b277a6932c32ce4bae015cce6e1c00c322b4a63b Mon Sep 17 00:00:00 2001 From: mae Date: Tue, 2 Mar 2010 12:13:44 +0100 Subject: Let the 'qml' runtime use its applicationDirPath as importsPath The is analog to the plugin system in Qt. It makes it possible to ship an executable with extra plugins resp. qml import modules without creating a qt.conf. --- tools/qml/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 6339813..a4de339 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -311,8 +311,11 @@ int main(int argc, char ** argv) usage(); } + viewer.addLibraryPath(QCoreApplication::applicationDirPath()); + foreach (QString lib, libraries) viewer.addLibraryPath(lib); + viewer.setNetworkCacheSize(cache); viewer.setRecordFile(recordfile); if (resizeview) -- cgit v0.12 From e0a9e34b6e776be1df3b3fae68d20f242aa07e6a Mon Sep 17 00:00:00 2001 From: mae Date: Tue, 2 Mar 2010 12:39:38 +0100 Subject: Fix qml import modules loading on Windows On windows, when importing a declarative plugin by name, extend with "d.dll" in the debug case, then with ".dll". This is in sync with qmake's behaviour for libraries. --- src/declarative/qml/qdeclarativeengine.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index af75e98..277c602 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1687,6 +1687,7 @@ QString QDeclarativeEngine::offlineStoragePath() const \internal Returns the result of the merge of \a baseName with \a dir, \a suffixes, and \a prefix. + The \a prefix must contain the dot. */ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName, const QStringList &suffixes, @@ -1696,7 +1697,6 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString QString pluginFileName = prefix; pluginFileName += baseName; - pluginFileName += QLatin1Char('.'); pluginFileName += suffix; QFileInfo fileInfo(dir, pluginFileName); @@ -1728,14 +1728,26 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName) { #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) - return resolvePlugin(dir, baseName, QStringList(QLatin1String("dll"))); + return resolvePlugin(dir, baseName, + QStringList() +# ifdef QT_DEBUG + << QLatin1String("d.dll") // try a qmake-style debug build first +# endif + << QLatin1String(".dll"); #elif defined(Q_OS_SYMBIAN) - return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dll") << QLatin1String("qtplugin")); + return resolvePlugin(dir, baseName, + QStringList() + << QLatin1String(".dll") + << QLatin1String(".qtplugin")); #else # if defined(Q_OS_DARWIN) - return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dylib") << QLatin1String("so") << QLatin1String("bundle"), + return resolvePlugin(dir, baseName, + QStringList() + << QLatin1String(".dylib") + << QLatin1String(".so") + << QLatin1String(".bundle"), QLatin1String("lib")); # else // Generic Unix QStringList validSuffixList; @@ -1746,14 +1758,14 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString "In PA-RISC (PA-32 and PA-64) shared libraries are suffixed with .sl. In IPF (32-bit and 64-bit), the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix." */ - validSuffixList << QLatin1String("sl"); + validSuffixList << QLatin1String(".sl"); # if defined __ia64 - validSuffixList << QLatin1String("so"); + validSuffixList << QLatin1String(".so"); # endif # elif defined(Q_OS_AIX) - validSuffixList << QLatin1String("a") << QLatin1String("so"); + validSuffixList << QLatin1String(".a") << QLatin1String(".so"); # elif defined(Q_OS_UNIX) - validSuffixList << QLatin1String("so"); + validSuffixList << QLatin1String(".so"); # endif // Examples of valid library names: -- cgit v0.12 From 3708ff474a987ddb82f7b66d8c686f499b65eeb6 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 2 Mar 2010 13:36:55 +0100 Subject: Updates to changes file Reviewed-by: trustme --- dist/changes-4.7.0 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 013f1ce..4d776ee 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -30,6 +30,12 @@ General Improvements Third party components ---------------------- + - Updated libpng to version 1.4.0 + + - Updated libjpeg to version 8 + + - Updated libtiff to version 3.9.2 + **************************************************************************** * Library * -- cgit v0.12 From 2afda558815bc29c1f54e7b9bcc0312369dd7d79 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 2 Mar 2010 13:41:05 +0100 Subject: Build fix on windows --- src/declarative/qml/qdeclarativeengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 277c602..ecaea61 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1733,7 +1733,7 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString # ifdef QT_DEBUG << QLatin1String("d.dll") // try a qmake-style debug build first # endif - << QLatin1String(".dll"); + << QLatin1String(".dll")); #elif defined(Q_OS_SYMBIAN) return resolvePlugin(dir, baseName, QStringList() -- cgit v0.12 From a140e37fab6a1d028fd1b751a98774dacb4f1a89 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 2 Mar 2010 13:42:05 +0100 Subject: Fix & move QEgl::native* to platform-specific files This should fix build on Symbian & WinCE Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 19 ------------------- src/gui/egl/qegl_qws.cpp | 17 +++++++++++++++++ src/gui/egl/qegl_symbian.cpp | 11 +++++++++++ src/gui/egl/qegl_wince.cpp | 11 +++++++++++ src/gui/egl/qegl_x11.cpp | 11 ++++++++++- 5 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 1bfba10..485bfbf 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -549,25 +549,6 @@ EGLDisplay QEgl::display() return dpy; } -#if !defined(Q_WS_X11) && !defined(Q_WS_WINCE) // WinCE & X11 implement this properly -EGLNativeDisplayType QEgl::nativeDisplay() -{ - return EGL_DEFAULT_DISPLAY; -} -#endif - -#if !defined(Q_OS_SYMBIAN) -EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) -{ - return (EGLNativeWindowType)(widget->winId()); -} -#endif - -EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) -{ - return (EGLNativePixmapType)(pixmap->handle()); -} - #ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp index eb41bcc..56383a5 100644 --- a/src/gui/egl/qegl_qws.cpp +++ b/src/gui/egl/qegl_qws.cpp @@ -92,6 +92,23 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) setPixelFormat(screen->pixelFormat()); } +EGLNativeDisplayType QEgl::nativeDisplay() +{ + return EGL_DEFAULT_DISPLAY; +} + +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) +{ + return (EGLNativeWindowType)(widget->winId()); // Might work +} + +EGLNativePixmapType QEgl::nativePixmap(QPixmap*) +{ + qWarning("QEgl: EGL pixmap surfaces not supported on QWS"); + return (EGLNativePixmapType)0; +} + + QT_END_NAMESPACE #endif // !QT_NO_EGL diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp index 8833b42..9744ed0 100644 --- a/src/gui/egl/qegl_symbian.cpp +++ b/src/gui/egl/qegl_symbian.cpp @@ -50,11 +50,22 @@ QT_BEGIN_NAMESPACE +EGLNativeDisplayType QEgl::nativeDisplay() +{ + return EGL_DEFAULT_DISPLAY; +} + EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) { return (EGLNativeWindowType)(widget->winId()->DrawableWindow()); } +EGLNativePixmapType QEgl::nativePixmap(QPixmap*) +{ + qWarning("QEgl: EGL pixmap surfaces not implemented yet on Symbian"); + return (EGLNativePixmapType)0; +} + // Set pixel format and other properties based on a paint device. void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) { diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index b201153..c07b20b 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -62,6 +62,17 @@ EGLNativeDisplayType QEgl::nativeDisplay() return EGLNativeDisplayType(myDc); } +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) +{ + return (EGLNativeWindowType)(widget->winId()); +} + +EGLNativePixmapType QEgl::nativePixmap(QPixmap*) +{ + qWarning("QEgl: EGL pixmap surfaces not supported on WinCE"); + return (EGLNativePixmapType)0; +} + // Set pixel format and other properties based on a paint device. void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) { diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index a4bfcac..339bd57 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -67,6 +67,16 @@ EGLNativeDisplayType QEgl::nativeDisplay() return EGLNativeDisplayType(xdpy); } +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) +{ + return (EGLNativeWindowType)(widget->winId()); +} + +EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) +{ + return (EGLNativePixmapType)(pixmap->handle()); +} + static int countBits(unsigned long mask) { int count = 0; @@ -399,5 +409,4 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg return EGL_NO_SURFACE; } - QT_END_NAMESPACE -- cgit v0.12 From 8b19712189aa2c7e83030b59cd4b4729e5e113cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 2 Mar 2010 13:50:36 +0100 Subject: Compile. --- tools/qdoc3/node.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 6ad9a6c..7dda824 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -44,6 +44,7 @@ */ #include "node.h" +#include QT_BEGIN_NAMESPACE -- cgit v0.12 From 89429d192dc14044f6d27c9dde06811f1f23b954 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 2 Mar 2010 14:17:08 +0100 Subject: Compile fix on Windows --- src/declarative/qml/qdeclarativelist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativelist.h b/src/declarative/qml/qdeclarativelist.h index 8d59384..eac4967 100644 --- a/src/declarative/qml/qdeclarativelist.h +++ b/src/declarative/qml/qdeclarativelist.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QObject; -class QMetaObject; +struct QMetaObject; template struct QDeclarativeListProperty { typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); -- cgit v0.12 From 03daf059647c0a0222e8774b0a083f58c8e64934 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 2 Mar 2010 11:03:12 +0100 Subject: QMetaType: Now we can register typedefs. Task-number: QTBUG-6833 Task-number: QTBUG-937 Reviewed-by: Brad Reviewed-by: Kent Hansen --- .../snippets/code/src_corelib_kernel_qmetatype.cpp | 5 ++ src/corelib/kernel/qmetatype.cpp | 60 +++++++++++++++++++++- src/corelib/kernel/qmetatype.h | 37 ++++++++++++- tests/auto/qmetaobject/tst_qmetaobject.cpp | 20 ++++++++ tests/auto/qmetatype/tst_qmetatype.cpp | 14 ++++- tests/auto/qobject/tst_qobject.cpp | 16 ++++++ 6 files changed, 146 insertions(+), 6 deletions(-) diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp index bff72a0..19e37ba 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp @@ -108,3 +108,8 @@ int id = qRegisterMetaType(); int id = qMetaTypeId(); // id is now QMetaType::QString id = qMetaTypeId(); // compile error if MyStruct not declared //! [8] + +//! [9] +typedef QString CustomString; +qRegisterMetaType("CustomString"); +//! [9] diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 779b69b..be506b4 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -352,6 +352,7 @@ public: QMetaType::SaveOperator saveOp; QMetaType::LoadOperator loadOp; #endif + int alias; }; Q_DECLARE_TYPEINFO(QCustomTypeInfo, Q_MOVABLE_TYPE); @@ -436,8 +437,11 @@ static int qMetaTypeCustomType_unlocked(const char *typeName, int length) return 0; for (int v = 0; v < ct->count(); ++v) { - if ((length == ct->at(v).typeName.size()) - && !strcmp(typeName, ct->at(v).typeName.constData())) { + const QCustomTypeInfo &customInfo = ct->at(v); + if ((length == customInfo.typeName.size()) + && !strcmp(typeName, customInfo.typeName.constData())) { + if (customInfo.alias >= 0) + return customInfo.alias; return v + QMetaType::User; } } @@ -475,6 +479,7 @@ int QMetaType::registerType(const char *typeName, Destructor destructor, inf.typeName = normalizedTypeName; inf.constr = constructor; inf.destr = destructor; + inf.alias = -1; idx = ct->size() + User; ct->append(inf); } @@ -482,6 +487,51 @@ int QMetaType::registerType(const char *typeName, Destructor destructor, return idx; } +/*! \internal + \since 4.7 + + Registers a user type for marshalling, as an alias of another type (typedef) +*/ +int QMetaType::registerTypedef(const char* typeName, int aliasId) +{ + QVector *ct = customTypes(); + if (!ct || !typeName) + return -1; + +#ifdef QT_NO_QOBJECT + NS(QByteArray) normalizedTypeName = typeName; +#else + NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); +#endif + + int idx = qMetaTypeStaticType(normalizedTypeName.constData(), + normalizedTypeName.size()); + + if (idx) { + Q_ASSERT(idx == aliasId); + return idx; + } + + QWriteLocker locker(customTypesLock()); + idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), + normalizedTypeName.size()); + + if (idx) { + Q_ASSERT(idx == aliasId); + return idx; + } + + if (!idx) { + QCustomTypeInfo inf; + inf.typeName = normalizedTypeName; + inf.alias = aliasId; + inf.constr = 0; + inf.destr = 0; + ct->append(inf); + } + return aliasId; +} + /*! \since 4.4 @@ -507,6 +557,7 @@ void QMetaType::unregisterType(const char *typeName) inf.typeName.clear(); inf.constr = 0; inf.destr = 0; + inf.alias = -1; } } } @@ -1349,6 +1400,11 @@ void QMetaType::destroy(int type, void *data) \snippet doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp 4 + This function is usefull to register typedefs so they can be used + by QMetaProperty, or in QueuedConnections + + \snippet doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp 9 + \sa qRegisterMetaTypeStreamOperators(), QMetaType::isRegistered(), Q_DECLARE_METATYPE() */ diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 33126e8..2ed4a1f 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -113,6 +113,7 @@ public: #endif static int registerType(const char *typeName, Destructor destructor, Constructor constructor); + static int registerTypedef(const char *typeName, int aliasId); static int type(const char *typeName); static const char *typeName(int type); static bool isRegistered(int type); @@ -154,13 +155,31 @@ void qMetaTypeLoadHelper(QDataStream &stream, T *t) } #endif // QT_NO_DATASTREAM +template struct QMetaTypeId2; + +namespace QtPrivate { + template ::Defined> + struct QMetaTypeIdHelper { + static inline int qt_metatype_id() + { return QMetaTypeId2::qt_metatype_id(); } + }; + template struct QMetaTypeIdHelper { + static inline int qt_metatype_id() + { return -1; } + }; +} + template int qRegisterMetaType(const char *typeName #ifndef qdoc - , T * /* dummy */ = 0 + , typename QMetaTypeId2::CustomType * dummy = 0 #endif ) { + const int typedefOf = dummy ? -1 : QtPrivate::QMetaTypeIdHelper::qt_metatype_id(); + if (typedefOf != -1) + return QMetaType::registerTypedef(typeName, typedefOf); + typedef void*(*ConstructPtr)(const T*); ConstructPtr cptr = qMetaTypeConstructHelper; typedef void(*DeletePtr)(T*); @@ -170,6 +189,17 @@ int qRegisterMetaType(const char *typeName reinterpret_cast(cptr)); } +template +int qRegisterMetaType(const char *typeName +#ifndef qdoc + , typename QMetaTypeId2::BuiltinType * /* dummy */ = 0 +#endif +) +{ + return QMetaType::registerTypedef(typeName, QMetaTypeId2::MetaType); +} + + #ifndef QT_NO_DATASTREAM template void qRegisterMetaTypeStreamOperators(const char *typeName @@ -198,6 +228,7 @@ struct QMetaTypeId template struct QMetaTypeId2 { + typedef T CustomType; enum { Defined = QMetaTypeId::Defined }; static inline int qt_metatype_id() { return QMetaTypeId::qt_metatype_id(); } }; @@ -254,7 +285,8 @@ inline int qRegisterMetaTypeStreamOperators() { \ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ if (!metatype_id) \ - metatype_id = qRegisterMetaType< TYPE >(#TYPE); \ + metatype_id = qRegisterMetaType< TYPE >(#TYPE, \ + reinterpret_cast< TYPE *>(quintptr(-1))); \ return metatype_id; \ } \ }; \ @@ -264,6 +296,7 @@ inline int qRegisterMetaTypeStreamOperators() QT_BEGIN_NAMESPACE \ template<> struct QMetaTypeId2 \ { \ + typedef TYPE BuiltinType; \ enum { Defined = 1, MetaType = QMetaType::NAME }; \ static inline int qt_metatype_id() { return QMetaType::NAME; } \ }; \ diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index bd54975..bb4a0d2 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -157,6 +157,7 @@ private slots: void invokeQueuedMetaMember(); void invokeCustomTypes(); void invokeMetaConstructor(); + void invokeTypedefTypes(); void qtMetaObjectInheritance(); void normalizedSignature_data(); void normalizedSignature(); @@ -598,6 +599,8 @@ struct MyType int i1, i2, i3; }; +typedef QString CustomString; + class QtTestCustomObject: public QObject { Q_OBJECT @@ -607,6 +610,9 @@ public: public slots: void sl1(MyType myType); +signals: + void sig_custom(const CustomString &string); + public: int sum; }; @@ -664,6 +670,20 @@ void tst_QMetaObject::invokeMetaConstructor() } } +void tst_QMetaObject::invokeTypedefTypes() +{ + qRegisterMetaType("CustomString"); + QtTestCustomObject obj; + QSignalSpy spy(&obj, SIGNAL(sig_custom(CustomString))); + + QCOMPARE(spy.count(), 0); + CustomString arg("hello"); + QVERIFY(QMetaObject::invokeMethod(&obj, "sig_custom", Q_ARG(CustomString, arg))); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).count(), 1); + QCOMPARE(spy.at(0).at(0), QVariant(arg)); +} + void tst_QMetaObject::normalizedSignature_data() { QTest::addColumn("signature"); diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp index 943b05b..f4e122f 100644 --- a/tests/auto/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/qmetatype/tst_qmetatype.cpp @@ -241,6 +241,9 @@ void tst_QMetaType::construct() QMetaType::destroy(QMetaType::QSize, size); } +typedef QString CustomString; +Q_DECLARE_METATYPE(CustomString) //this line is useless + void tst_QMetaType::typedefs() { QCOMPARE(QMetaType::type("long long"), int(QMetaType::LongLong)); @@ -256,6 +259,13 @@ void tst_QMetaType::typedefs() // make sure the qreal typeId is the type id of the type it's defined to QCOMPARE(QMetaType::type("qreal"), ::qMetaTypeId()); + + qRegisterMetaType("CustomString"); + QCOMPARE(QMetaType::type("CustomString"), ::qMetaTypeId()); + + typedef Whity WhityDouble; + qRegisterMetaType("WhityDouble"); + QCOMPARE(QMetaType::type("WhityDouble"), ::qMetaTypeId()); } class IsRegisteredDummyType { }; @@ -286,9 +296,9 @@ void tst_QMetaType::isRegistered() QCOMPARE(QMetaType::isRegistered(typeId), registered); } -class RegUnreg +class RegUnreg { -public: +public: RegUnreg() {}; RegUnreg(const RegUnreg &) {}; ~RegUnreg() {}; diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 3896d70..c8f846e 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -1112,6 +1112,8 @@ void tst_QObject::streamCustomTypes() QCOMPARE(instanceCount, 0); } +typedef QString CustomString; + class PropertyObject : public QObject { Q_OBJECT @@ -1125,6 +1127,7 @@ class PropertyObject : public QObject Q_PROPERTY(CustomType* custom READ custom WRITE setCustom) Q_PROPERTY(float myFloat READ myFloat WRITE setMyFloat) Q_PROPERTY(qreal myQReal READ myQReal WRITE setMyQReal) + Q_PROPERTY(CustomString customString READ customString WRITE setCustomString ) public: enum Alpha { @@ -1163,6 +1166,9 @@ public: void setMyQReal(qreal value) { m_qreal = value; } qreal myQReal() const { return m_qreal; } + CustomString customString() const { return m_customString; } + void setCustomString(const QString &string) { m_customString = string; } + private: Alpha m_alpha; Priority m_priority; @@ -1172,6 +1178,7 @@ private: CustomType *m_custom; float m_float; qreal m_qreal; + CustomString m_customString; }; Q_DECLARE_METATYPE(PropertyObject::Priority) @@ -1626,6 +1633,15 @@ void tst_QObject::property() QCOMPARE(qVariantValue(object.property("priority")), PropertyObject::Low); object.setProperty("priority", var); QCOMPARE(qVariantValue(object.property("priority")), PropertyObject::High); + + qRegisterMetaType("CustomString"); + QVERIFY(mo->indexOfProperty("customString") != -1); + QCOMPARE(object.property("customString").toString(), QString()); + object.setCustomString("String1"); + QCOMPARE(object.property("customString"), QVariant("String1")); + QVERIFY(object.setProperty("customString", "String2")); + QCOMPARE(object.property("customString"), QVariant("String2")); + QVERIFY(!object.setProperty("customString", QVariant())); } void tst_QObject::metamethod() -- cgit v0.12 From 298aee0577a45dadf8e30b5bea05224f9e3aa52d Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Tue, 2 Mar 2010 13:49:52 +0100 Subject: Added comment about usage of strncpy_s function in VC++ > 14.00 Reviewed-by: Peter Hartmann --- src/corelib/tools/qbytearray.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 3324796..c5f70b0 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -154,6 +154,10 @@ char *qstrcpy(char *dst, const char *src) This function assumes that \a dst is at least \a len characters long. + \note When compiling with Visual C++ compiler version 14.00 + (Visual C++ 2005) or later, internally the function strncpy_s + will be used. + \sa qstrcpy() */ -- cgit v0.12 From a62177874d961e0884e74ba7c7c8899fdb79fb09 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 1 Mar 2010 18:58:06 +0100 Subject: Always run syncqt if using a Git checkout. Reviewed-by: Olivier Goffart --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 2312165..2c7e431 100755 --- a/configure +++ b/configure @@ -4322,7 +4322,7 @@ if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes" if [ "$OPT_SHADOW" = "yes" ]; then "$outpath/bin/syncqt" $SYNCQT_OPTS - elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ]; then + elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ] || [ -d $relpath/.git ]; then QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS fi fi -- cgit v0.12 From 7fd5ade07bd05ff6cb6f4e7cfa7a74081b803809 Mon Sep 17 00:00:00 2001 From: mae Date: Tue, 2 Mar 2010 15:00:23 +0100 Subject: Adapted example to use the import mechanism --- .../imageprovider/ImageProviderCore/qmldir | 2 + .../declarative/imageprovider/imageprovider.cpp | 107 +++++++++++++++++++++ .../declarative/imageprovider/imageprovider.pro | 14 +-- .../declarative/imageprovider/imageprovider.qml | 23 +++++ .../declarative/imageprovider/imageprovider.qrc | 5 - examples/declarative/imageprovider/main.cpp | 98 ------------------- examples/declarative/imageprovider/view.qml | 22 ----- 7 files changed, 140 insertions(+), 131 deletions(-) create mode 100644 examples/declarative/imageprovider/ImageProviderCore/qmldir create mode 100644 examples/declarative/imageprovider/imageprovider.cpp create mode 100644 examples/declarative/imageprovider/imageprovider.qml delete mode 100644 examples/declarative/imageprovider/imageprovider.qrc delete mode 100644 examples/declarative/imageprovider/main.cpp delete mode 100644 examples/declarative/imageprovider/view.qml diff --git a/examples/declarative/imageprovider/ImageProviderCore/qmldir b/examples/declarative/imageprovider/ImageProviderCore/qmldir new file mode 100644 index 0000000..1028590 --- /dev/null +++ b/examples/declarative/imageprovider/ImageProviderCore/qmldir @@ -0,0 +1,2 @@ +plugin imageprovider + diff --git a/examples/declarative/imageprovider/imageprovider.cpp b/examples/declarative/imageprovider/imageprovider.cpp new file mode 100644 index 0000000..253dbf5 --- /dev/null +++ b/examples/declarative/imageprovider/imageprovider.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + This example illustrates using a QDeclarativeImageProvider to serve + images asynchronously. +*/ + +//![0] +class ColorImageProvider : public QDeclarativeImageProvider +{ +public: + // This is run in a low priority thread. + QImage request(const QString &id) { + QImage image(100, 50, QImage::Format_RGB32); + image.fill(QColor(id).rgba()); + QPainter p(&image); + p.setPen(Qt::black); + p.drawText(QRectF(0,0,100,50),Qt::AlignCenter,id); + return image; + } +}; + + +class ImageProviderExtensionPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + void registerTypes(const char *uri) { + Q_UNUSED(uri); + + } + + void initializeEngine(QDeclarativeEngine *engine, const char *uri) { + Q_UNUSED(uri); + + engine->addImageProvider("colors", new ColorImageProvider); + + QStringList dataList; + dataList.append("image://colors/red"); + dataList.append("image://colors/green"); + dataList.append("image://colors/blue"); + dataList.append("image://colors/brown"); + dataList.append("image://colors/orange"); + dataList.append("image://colors/purple"); + dataList.append("image://colors/yellow"); + + QDeclarativeContext *ctxt = engine->rootContext(); + ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); + } + +}; + +#include "imageprovider.moc" + +Q_EXPORT_PLUGIN(ImageProviderExtensionPlugin); + diff --git a/examples/declarative/imageprovider/imageprovider.pro b/examples/declarative/imageprovider/imageprovider.pro index 60423ab..e403bf8 100644 --- a/examples/declarative/imageprovider/imageprovider.pro +++ b/examples/declarative/imageprovider/imageprovider.pro @@ -1,9 +1,11 @@ -TEMPLATE = app -TARGET = imageprovider -DEPENDPATH += . -INCLUDEPATH += . +TEMPLATE = lib +TARGET = imageprovider QT += declarative +CONFIG += qt plugin + +TARGET = $$qtLibraryTarget($$TARGET) +DESTDIR = ImageProviderCore # Input -SOURCES += main.cpp -RESOURCES += imageprovider.qrc +SOURCES += imageprovider.cpp + diff --git a/examples/declarative/imageprovider/imageprovider.qml b/examples/declarative/imageprovider/imageprovider.qml new file mode 100644 index 0000000..a1f2794 --- /dev/null +++ b/examples/declarative/imageprovider/imageprovider.qml @@ -0,0 +1,23 @@ +import Qt 4.6 +import ImageProviderCore 1.0 +//![0] +ListView { + width: 100 + height: 100 + anchors.fill: parent + model: myModel + delegate: Component { + Item { + width: 100 + height: 50 + Text { + text: "Loading..." + anchors.centerIn: parent + } + Image { + source: modelData + } + } + } +} +//![0] diff --git a/examples/declarative/imageprovider/imageprovider.qrc b/examples/declarative/imageprovider/imageprovider.qrc deleted file mode 100644 index 17e9301..0000000 --- a/examples/declarative/imageprovider/imageprovider.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - view.qml - - diff --git a/examples/declarative/imageprovider/main.cpp b/examples/declarative/imageprovider/main.cpp deleted file mode 100644 index d9d4c1a..0000000 --- a/examples/declarative/imageprovider/main.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - This example illustrates using a QDeclarativeImageProvider to serve - images asynchronously. -*/ - -//![0] -class ColorImageProvider : public QDeclarativeImageProvider -{ -public: - // This is run in a low priority thread. - QImage request(const QString &id) { - QImage image(100, 50, QImage::Format_RGB32); - image.fill(QColor(id).rgba()); - QPainter p(&image); - p.setPen(Qt::black); - p.drawText(QRectF(0,0,100,50),Qt::AlignCenter,id); - return image; - } -}; - -int main(int argc, char ** argv) -{ - QApplication app(argc, argv); - - QDeclarativeView view; - - view.engine()->addImageProvider("colors", new ColorImageProvider); - - QStringList dataList; - dataList.append("image://colors/red"); - dataList.append("image://colors/green"); - dataList.append("image://colors/blue"); - dataList.append("image://colors/brown"); - dataList.append("image://colors/orange"); - dataList.append("image://colors/purple"); - dataList.append("image://colors/yellow"); - - QDeclarativeContext *ctxt = view.rootContext(); - ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); - - view.setSource(QUrl("qrc:view.qml")); - view.show(); - - return app.exec(); -} -//![0] diff --git a/examples/declarative/imageprovider/view.qml b/examples/declarative/imageprovider/view.qml deleted file mode 100644 index 2ab729d..0000000 --- a/examples/declarative/imageprovider/view.qml +++ /dev/null @@ -1,22 +0,0 @@ -import Qt 4.6 -//![0] -ListView { - width: 100 - height: 100 - anchors.fill: parent - model: myModel - delegate: Component { - Item { - width: 100 - height: 50 - Text { - text: "Loading..." - anchors.centerIn: parent - } - Image { - source: modelData - } - } - } -} -//![0] -- cgit v0.12 From 67cd8cc97104e38f2e3bae03b2a4c3575c73c461 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 1 Mar 2010 22:12:01 +0100 Subject: Add a template specialisation for QArgument when T is a reference. We can't form references to references, so this is the proper solution. Though apparently GCC figures out somehow to work without it... Task-number: QTBUG-8592 Reviewed-By: Olivier Goffart --- src/corelib/kernel/qobjectdefs.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 8ed7f3f..b045c42 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -271,6 +271,14 @@ public: : QGenericArgument(aName, static_cast(&aData)) {} }; +template +class QArgument: public QGenericArgument +{ +public: + inline QArgument(const char *aName, T &aData) + : QGenericArgument(aName, static_cast(&aData)) + {} +}; template -- cgit v0.12 From f56893bbffd5eb26dd77e56707615cbb11a26c9b Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 2 Mar 2010 15:41:16 +0100 Subject: Rewrite Minehunt demo to use the runtime. --- demos/declarative/minehunt/Description.qml | 34 -- demos/declarative/minehunt/Explosion.qml | 26 -- .../minehunt/MinehuntCore/Explosion.qml | 26 ++ .../MinehuntCore/pics/No-Ones-Laughing-3.jpg | Bin 0 -> 30730 bytes .../minehunt/MinehuntCore/pics/back.png | Bin 0 -> 558 bytes .../minehunt/MinehuntCore/pics/bomb-color.png | Bin 0 -> 284 bytes .../minehunt/MinehuntCore/pics/bomb.png | Bin 0 -> 535 bytes .../minehunt/MinehuntCore/pics/face-sad.png | Bin 0 -> 14844 bytes .../minehunt/MinehuntCore/pics/face-smile-big.png | Bin 0 -> 13810 bytes .../minehunt/MinehuntCore/pics/face-smile.png | Bin 0 -> 15408 bytes .../minehunt/MinehuntCore/pics/flag-color.png | Bin 0 -> 219 bytes .../minehunt/MinehuntCore/pics/flag.png | Bin 0 -> 196 bytes .../minehunt/MinehuntCore/pics/front.png | Bin 0 -> 580 bytes .../minehunt/MinehuntCore/pics/star.png | Bin 0 -> 2677 bytes demos/declarative/minehunt/MinehuntCore/qmldir | 2 + demos/declarative/minehunt/main.cpp | 351 --------------------- demos/declarative/minehunt/minehunt.cpp | 314 ++++++++++++++++++ demos/declarative/minehunt/minehunt.pro | 16 +- demos/declarative/minehunt/minehunt.qml | 24 +- .../minehunt/pics/No-Ones-Laughing-3.jpg | Bin 30730 -> 0 bytes demos/declarative/minehunt/pics/back.png | Bin 558 -> 0 bytes demos/declarative/minehunt/pics/bomb-color.png | Bin 284 -> 0 bytes demos/declarative/minehunt/pics/bomb.png | Bin 535 -> 0 bytes demos/declarative/minehunt/pics/face-sad.png | Bin 14844 -> 0 bytes demos/declarative/minehunt/pics/face-smile-big.png | Bin 13810 -> 0 bytes demos/declarative/minehunt/pics/face-smile.png | Bin 15408 -> 0 bytes demos/declarative/minehunt/pics/flag-color.png | Bin 219 -> 0 bytes demos/declarative/minehunt/pics/flag.png | Bin 196 -> 0 bytes demos/declarative/minehunt/pics/front.png | Bin 580 -> 0 bytes demos/declarative/minehunt/pics/star.png | Bin 2677 -> 0 bytes demos/declarative/minehunt/test.qml | 13 - 31 files changed, 360 insertions(+), 446 deletions(-) delete mode 100644 demos/declarative/minehunt/Description.qml delete mode 100644 demos/declarative/minehunt/Explosion.qml create mode 100644 demos/declarative/minehunt/MinehuntCore/Explosion.qml create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/No-Ones-Laughing-3.jpg create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/back.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/bomb.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/face-sad.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/face-smile.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/flag-color.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/flag.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/front.png create mode 100644 demos/declarative/minehunt/MinehuntCore/pics/star.png create mode 100644 demos/declarative/minehunt/MinehuntCore/qmldir delete mode 100644 demos/declarative/minehunt/main.cpp create mode 100644 demos/declarative/minehunt/minehunt.cpp delete mode 100644 demos/declarative/minehunt/pics/No-Ones-Laughing-3.jpg delete mode 100644 demos/declarative/minehunt/pics/back.png delete mode 100644 demos/declarative/minehunt/pics/bomb-color.png delete mode 100644 demos/declarative/minehunt/pics/bomb.png delete mode 100644 demos/declarative/minehunt/pics/face-sad.png delete mode 100644 demos/declarative/minehunt/pics/face-smile-big.png delete mode 100644 demos/declarative/minehunt/pics/face-smile.png delete mode 100644 demos/declarative/minehunt/pics/flag-color.png delete mode 100644 demos/declarative/minehunt/pics/flag.png delete mode 100644 demos/declarative/minehunt/pics/front.png delete mode 100644 demos/declarative/minehunt/pics/star.png delete mode 100644 demos/declarative/minehunt/test.qml diff --git a/demos/declarative/minehunt/Description.qml b/demos/declarative/minehunt/Description.qml deleted file mode 100644 index cc4d3b2..0000000 --- a/demos/declarative/minehunt/Description.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 - -Item { - id: page - height: myText.height + 20 - property var text - MouseArea { - anchors.fill: parent - drag.target: page - drag.axis: "XandYAxis" - drag.minimumX: 0 - drag.maximumX: 1000 - drag.minimumY: 0 - drag.maximumY: 1000 - } - Rectangle { - radius: 10 - anchors.fill: parent - color: "lightsteelblue" - } - Item { - x: 10 - y: 10 - width: parent.width - 20 - height: parent.height - 20 - Text { - id: myText - text: page.text - width: parent.width - clip: true - wrap: true - } - } -} diff --git a/demos/declarative/minehunt/Explosion.qml b/demos/declarative/minehunt/Explosion.qml deleted file mode 100644 index e337c46..0000000 --- a/demos/declarative/minehunt/Explosion.qml +++ /dev/null @@ -1,26 +0,0 @@ -import Qt 4.6 - -Item { - property bool explode : false - - Particles { - id: particles - width: 40 - height: 40 - lifeSpan: 1000 - lifeSpanDeviation: 0 - source: "pics/star.png" - count: 0 - angle: 270 - angleDeviation: 360 - velocity: 100 - velocityDeviation: 20 - z: 100 - opacity: 1 - } - states: [ State { name: "exploding"; when: explode == true - StateChangeScript {script: particles.burst(200); } - } - ] - -} diff --git a/demos/declarative/minehunt/MinehuntCore/Explosion.qml b/demos/declarative/minehunt/MinehuntCore/Explosion.qml new file mode 100644 index 0000000..e337c46 --- /dev/null +++ b/demos/declarative/minehunt/MinehuntCore/Explosion.qml @@ -0,0 +1,26 @@ +import Qt 4.6 + +Item { + property bool explode : false + + Particles { + id: particles + width: 40 + height: 40 + lifeSpan: 1000 + lifeSpanDeviation: 0 + source: "pics/star.png" + count: 0 + angle: 270 + angleDeviation: 360 + velocity: 100 + velocityDeviation: 20 + z: 100 + opacity: 1 + } + states: [ State { name: "exploding"; when: explode == true + StateChangeScript {script: particles.burst(200); } + } + ] + +} diff --git a/demos/declarative/minehunt/MinehuntCore/pics/No-Ones-Laughing-3.jpg b/demos/declarative/minehunt/MinehuntCore/pics/No-Ones-Laughing-3.jpg new file mode 100644 index 0000000..445567f Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/No-Ones-Laughing-3.jpg differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/back.png b/demos/declarative/minehunt/MinehuntCore/pics/back.png new file mode 100644 index 0000000..f6b3f0b Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/back.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png b/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png new file mode 100644 index 0000000..61ad0a9 Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/bomb.png b/demos/declarative/minehunt/MinehuntCore/pics/bomb.png new file mode 100644 index 0000000..a992575 Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/bomb.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png b/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png new file mode 100644 index 0000000..cf00aaf Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png b/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png new file mode 100644 index 0000000..f9c2335 Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png b/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png new file mode 100644 index 0000000..3d66d72 Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png b/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png new file mode 100644 index 0000000..aadad0f Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/flag.png b/demos/declarative/minehunt/MinehuntCore/pics/flag.png new file mode 100644 index 0000000..39cde4d Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/flag.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/front.png b/demos/declarative/minehunt/MinehuntCore/pics/front.png new file mode 100644 index 0000000..834331b Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/front.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/star.png b/demos/declarative/minehunt/MinehuntCore/pics/star.png new file mode 100644 index 0000000..3772359 Binary files /dev/null and b/demos/declarative/minehunt/MinehuntCore/pics/star.png differ diff --git a/demos/declarative/minehunt/MinehuntCore/qmldir b/demos/declarative/minehunt/MinehuntCore/qmldir new file mode 100644 index 0000000..862c396 --- /dev/null +++ b/demos/declarative/minehunt/MinehuntCore/qmldir @@ -0,0 +1,2 @@ +plugin minehunt +Explosion 1.0 Explosion.qml diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp deleted file mode 100644 index 99856ed..0000000 --- a/demos/declarative/minehunt/main.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qdeclarativeengine.h" -#include "qdeclarativecontext.h" -#include "qdeclarative.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -QString fileName = "minehunt.qml"; - -class Tile : public QObject -{ - Q_OBJECT -public: - Tile() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {} - - Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged); - bool hasFlag() const { return _hasFlag; } - - Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged); - bool hasMine() const { return _hasMine; } - - Q_PROPERTY(int hint READ hint NOTIFY hintChanged); - int hint() const { return _hint; } - - Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged()); - bool flipped() const { return _flipped; } - - void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();} - void setHasMine(bool mine) {if(mine==_hasMine) return; _hasMine = mine; emit hasMineChanged();} - void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); } - void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); } - void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); } - -signals: - void flippedChanged(); - void hasFlagChanged(); - void hintChanged(); - void hasMineChanged(); - -private: - bool _hasFlag; - bool _hasMine; - int _hint; - bool _flipped; -}; - -QML_DECLARE_TYPE(Tile); - -class MyWidget : public QWidget -{ -Q_OBJECT -public: - MyWidget(int = 370, int = 480, QWidget *parent=0, Qt::WindowFlags flags=0); - ~MyWidget(); - - Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT); - QDeclarativeListProperty tiles() { return QDeclarativeListProperty(this, _tiles); } - - Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged); - bool isPlaying() {return playing;} - - Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged); - bool hasWon() {return won;} - - Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged); - int numMines() const{return nMines;} - - Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged); - int numFlags() const{return nFlags;} - -public slots: - Q_INVOKABLE bool flip(int row, int col); - Q_INVOKABLE bool flag(int row, int col); - void setBoard(); - void reset(); - -signals: - void isPlayingChanged(); - void hasWonChanged(); - void numMinesChanged(); - void numFlagsChanged(); - -private: - bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } - Tile *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; } - int getHint(int row, int col); - void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();} - - QDeclarativeView *canvas; - - QList _tiles; - int numCols; - int numRows; - bool playing; - bool won; - int remaining; - int nMines; - int nFlags; -}; - -Q_DECLARE_METATYPE(QList) -MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags) -: QWidget(parent, flags), canvas(0), numCols(9), numRows(9), playing(true), won(false) -{ - setObjectName("mainWidget"); - srand(QTime(0,0,0).secsTo(QTime::currentTime())); - - //initialize array - for(int ii = 0; ii < numRows * numCols; ++ii) { - _tiles << new Tile; - } - reset(); - - QVBoxLayout *vbox = new QVBoxLayout; - vbox->setMargin(0); - setLayout(vbox); - - canvas = new QDeclarativeView(this); - canvas->setFixedSize(width, height); - vbox->addWidget(canvas); - - QDeclarativeContext *ctxt = canvas->rootContext(); - ctxt->addDefaultObject(this); - - canvas->setSource(QUrl::fromLocalFile(fileName)); -} - -MyWidget::~MyWidget() -{ -} - -void MyWidget::setBoard() -{ - foreach(Tile* t, _tiles){ - t->setHasMine(false); - t->setHint(-1); - } - //place mines - int mines = nMines; - remaining = numRows*numCols-mines; - while ( mines ) { - int col = int((double(rand()) / double(RAND_MAX)) * numCols); - int row = int((double(rand()) / double(RAND_MAX)) * numRows); - - Tile* t = tile( row, col ); - - if (t && !t->hasMine()) { - t->setHasMine( true ); - mines--; - } - } - - //set hints - for (int r = 0; r < numRows; r++) - for (int c = 0; c < numCols; c++) { - Tile* t = tile(r, c); - if (t && !t->hasMine()) { - int hint = getHint(r,c); - t->setHint(hint); - } - } - - setPlaying(true); -} - -void MyWidget::reset() -{ - foreach(Tile* t, _tiles){ - t->unflip(); - t->setHasFlag(false); - } - nMines = 12; - nFlags = 0; - setPlaying(false); - QTimer::singleShot(600,this, SLOT(setBoard())); -} - -int MyWidget::getHint(int row, int col) -{ - int hint = 0; - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - Tile* t = tile(r, c); - if (t && t->hasMine()) - hint++; - } - return hint; -} - -bool MyWidget::flip(int row, int col) -{ - if(!playing) - return false; - - Tile *t = tile(row, col); - if (!t || t->hasFlag()) - return false; - - if(t->flipped()){ - int flags = 0; - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - Tile *nearT = tile(r, c); - if(!nearT || nearT == t) - continue; - if(nearT->hasFlag()) - flags++; - } - if(!t->hint() || t->hint() != flags) - return false; - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - Tile *nearT = tile(r, c); - if (nearT && !nearT->flipped() && !nearT->hasFlag()) { - flip( r, c ); - } - } - return true; - } - - t->flip(); - - if (t->hint() == 0) { - for (int c = col-1; c <= col+1; c++) - for (int r = row-1; r <= row+1; r++) { - Tile* t = tile(r, c); - if (t && !t->flipped()) { - flip( r, c ); - } - } - } - - if(t->hasMine()){ - for (int r = 0; r < numRows; r++)//Flip all other mines - for (int c = 0; c < numCols; c++) { - Tile* t = tile(r, c); - if (t && t->hasMine()) { - flip(r, c); - } - } - won = false; - hasWonChanged(); - setPlaying(false); - } - - remaining--; - if(!remaining){ - won = true; - hasWonChanged(); - setPlaying(false); - } - return true; -} - -bool MyWidget::flag(int row, int col) -{ - Tile *t = tile(row, col); - if(!t) - return false; - - t->setHasFlag(!t->hasFlag()); - nFlags += (t->hasFlag()?1:-1); - emit numFlagsChanged(); - return true; -} -///////////////////////////////////////////////////////// - -int main(int argc, char ** argv) -{ -#ifdef Q_WS_X11 - // native on X11 is terrible for this demo. - QApplication::setGraphicsSystem("raster"); -#endif - QApplication app(argc, argv); - - bool frameless = false; - - int width = 370; - int height = 480; - - QML_REGISTER_TYPE(0,0,0,Tile,Tile); - - for (int i = 1; i < argc; ++i) { - QString arg = argv[i]; - if (arg == "-frameless") { - frameless = true; - } else if(arg == "-width" && i < (argc - 1)) { - ++i; - width = ::atoi(argv[i]); - } else if(arg == "-height" && i < (argc - 1)) { - ++i; - height = ::atoi(argv[i]); - } else if (arg[0] != '-') { - fileName = arg; - } - } - - MyWidget wid(width, height, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); - wid.show(); - - return app.exec(); -} - -#include "main.moc" diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp new file mode 100644 index 0000000..89845ef --- /dev/null +++ b/demos/declarative/minehunt/minehunt.cpp @@ -0,0 +1,314 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +class Tile : public QObject +{ + Q_OBJECT +public: + Tile() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {} + + Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged); + bool hasFlag() const { return _hasFlag; } + + Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged); + bool hasMine() const { return _hasMine; } + + Q_PROPERTY(int hint READ hint NOTIFY hintChanged); + int hint() const { return _hint; } + + Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged()); + bool flipped() const { return _flipped; } + + void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();} + void setHasMine(bool mine) {if(mine==_hasMine) return; _hasMine = mine; emit hasMineChanged();} + void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); } + void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); } + void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); } + +signals: + void flippedChanged(); + void hasFlagChanged(); + void hintChanged(); + void hasMineChanged(); + +private: + bool _hasFlag; + bool _hasMine; + int _hint; + bool _flipped; +}; + +class MinehuntGame : public QObject +{ + Q_OBJECT +public: + MinehuntGame(); + + Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT); + QDeclarativeListProperty tiles() { return QDeclarativeListProperty(this, _tiles); } + + Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged); + bool isPlaying() {return playing;} + + Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged); + bool hasWon() {return won;} + + Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged); + int numMines() const{return nMines;} + + Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged); + int numFlags() const{return nFlags;} + +public slots: + Q_INVOKABLE bool flip(int row, int col); + Q_INVOKABLE bool flag(int row, int col); + void setBoard(); + void reset(); + +signals: + void isPlayingChanged(); + void hasWonChanged(); + void numMinesChanged(); + void numFlagsChanged(); + +private: + bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } + Tile *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; } + int getHint(int row, int col); + void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();} + + QList _tiles; + int numCols; + int numRows; + bool playing; + bool won; + int remaining; + int nMines; + int nFlags; +}; + +MinehuntGame::MinehuntGame() +: numCols(9), numRows(9), playing(true), won(false) +{ + setObjectName("mainObject"); + srand(QTime(0,0,0).secsTo(QTime::currentTime())); + + //initialize array + for(int ii = 0; ii < numRows * numCols; ++ii) { + _tiles << new Tile; + } + reset(); + +} + +void MinehuntGame::setBoard() +{ + foreach(Tile* t, _tiles){ + t->setHasMine(false); + t->setHint(-1); + } + //place mines + int mines = nMines; + remaining = numRows*numCols-mines; + while ( mines ) { + int col = int((double(rand()) / double(RAND_MAX)) * numCols); + int row = int((double(rand()) / double(RAND_MAX)) * numRows); + + Tile* t = tile( row, col ); + + if (t && !t->hasMine()) { + t->setHasMine( true ); + mines--; + } + } + + //set hints + for (int r = 0; r < numRows; r++) + for (int c = 0; c < numCols; c++) { + Tile* t = tile(r, c); + if (t && !t->hasMine()) { + int hint = getHint(r,c); + t->setHint(hint); + } + } + + setPlaying(true); +} + +void MinehuntGame::reset() +{ + foreach(Tile* t, _tiles){ + t->unflip(); + t->setHasFlag(false); + } + nMines = 12; + nFlags = 0; + setPlaying(false); + QTimer::singleShot(600,this, SLOT(setBoard())); +} + +int MinehuntGame::getHint(int row, int col) +{ + int hint = 0; + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + Tile* t = tile(r, c); + if (t && t->hasMine()) + hint++; + } + return hint; +} + +bool MinehuntGame::flip(int row, int col) +{ + if(!playing) + return false; + + Tile *t = tile(row, col); + if (!t || t->hasFlag()) + return false; + + if(t->flipped()){ + int flags = 0; + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + Tile *nearT = tile(r, c); + if(!nearT || nearT == t) + continue; + if(nearT->hasFlag()) + flags++; + } + if(!t->hint() || t->hint() != flags) + return false; + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + Tile *nearT = tile(r, c); + if (nearT && !nearT->flipped() && !nearT->hasFlag()) { + flip( r, c ); + } + } + return true; + } + + t->flip(); + + if (t->hint() == 0) { + for (int c = col-1; c <= col+1; c++) + for (int r = row-1; r <= row+1; r++) { + Tile* t = tile(r, c); + if (t && !t->flipped()) { + flip( r, c ); + } + } + } + + if(t->hasMine()){ + for (int r = 0; r < numRows; r++)//Flip all other mines + for (int c = 0; c < numCols; c++) { + Tile* t = tile(r, c); + if (t && t->hasMine()) { + flip(r, c); + } + } + won = false; + hasWonChanged(); + setPlaying(false); + } + + remaining--; + if(!remaining){ + won = true; + hasWonChanged(); + setPlaying(false); + } + return true; +} + +bool MinehuntGame::flag(int row, int col) +{ + Tile *t = tile(row, col); + if(!t) + return false; + + t->setHasFlag(!t->hasFlag()); + nFlags += (t->hasFlag()?1:-1); + emit numFlagsChanged(); + return true; +} + +QML_DECLARE_TYPE(Tile); +QML_DECLARE_TYPE(MinehuntGame); + +class MinehuntExtensionPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + + public: + void registerTypes(const char *uri) { + Q_UNUSED(uri); + QML_REGISTER_TYPE(SameGameCore, 0, 1, Tile, Tile); + QML_REGISTER_TYPE(SameGameCore, 0, 1, Game, MinehuntGame); + } + + void initializeEngine(QDeclarativeEngine *engine, const char *uri) { + Q_UNUSED(uri); + + srand(QTime(0,0,0).secsTo(QTime::currentTime())); + + MinehuntGame* game = new MinehuntGame(); + + engine->rootContext()->addDefaultObject(game); + } +}; + +#include "minehunt.moc" + +Q_EXPORT_PLUGIN(MinehuntExtensionPlugin); + diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index 01791b1..a497b0f 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -1,9 +1,11 @@ -SOURCES = main.cpp +TEMPLATE = lib +TARGET = minehunt +QT += declarative +CONFIG += qt plugin -QT += script declarative -contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1): QT += opengl +TARGET = $$qtLibraryTarget($$TARGET) +DESTDIR = MinehuntCore + +# Input +SOURCES += minehunt.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/declarative/minehunt -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS minehunt.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/minehunt -INSTALLS += target sources diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 456f25b..9e99706 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import MinehuntCore 1.0 Item { id: field @@ -24,13 +25,13 @@ Item { angle: flipable.angle; } front: Image { - source: "pics/front.png" + source: "MinehuntCore/pics/front.png" width: 40 height: 40 Image { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - source: "pics/flag.png" + source: "MinehuntCore/pics/flag.png" opacity: modelData.hasFlag Behavior on opacity { NumberAnimation { @@ -41,7 +42,7 @@ Item { } } back: Image { - source: "pics/back.png" + source: "MinehuntCore/pics/back.png" width: 40 height: 40 Text { @@ -55,7 +56,7 @@ Item { Image { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - source: "pics/bomb.png" + source: "MinehuntCore/pics/bomb.png" opacity: modelData.hasMine } Explosion { @@ -120,16 +121,9 @@ Item { } ] Image { - source: "pics/No-Ones-Laughing-3.jpg" + source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg" fillMode: Image.Tile } - Description { - text: "Use the 'minehunt' executable to run this demo!" - width: 300 - opacity: tiles?0:1 - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - } Repeater { id: repeater model: tiles @@ -156,7 +150,7 @@ Item { Image { // x: 100 // y: 20 - source: "pics/bomb-color.png" + source: "MinehuntCore/pics/bomb-color.png" } Text { // x: 100 @@ -172,7 +166,7 @@ Item { Image { // x: 140 // y: 20 - source: "pics/flag-color.png" + source: "MinehuntCore/pics/flag-color.png" } Text { // x: 140 @@ -187,7 +181,7 @@ Item { y: 390 anchors.right: field.right anchors.rightMargin: 20 - source: isPlaying ? 'pics/face-smile.png' : hasWon ? 'pics/face-smile-big.png': 'pics/face-sad.png' + source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' MouseArea { anchors.fill: parent onPressed: { reset() } diff --git a/demos/declarative/minehunt/pics/No-Ones-Laughing-3.jpg b/demos/declarative/minehunt/pics/No-Ones-Laughing-3.jpg deleted file mode 100644 index 445567f..0000000 Binary files a/demos/declarative/minehunt/pics/No-Ones-Laughing-3.jpg and /dev/null differ diff --git a/demos/declarative/minehunt/pics/back.png b/demos/declarative/minehunt/pics/back.png deleted file mode 100644 index f6b3f0b..0000000 Binary files a/demos/declarative/minehunt/pics/back.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/bomb-color.png b/demos/declarative/minehunt/pics/bomb-color.png deleted file mode 100644 index 61ad0a9..0000000 Binary files a/demos/declarative/minehunt/pics/bomb-color.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/bomb.png b/demos/declarative/minehunt/pics/bomb.png deleted file mode 100644 index a992575..0000000 Binary files a/demos/declarative/minehunt/pics/bomb.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/face-sad.png b/demos/declarative/minehunt/pics/face-sad.png deleted file mode 100644 index cf00aaf..0000000 Binary files a/demos/declarative/minehunt/pics/face-sad.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/face-smile-big.png b/demos/declarative/minehunt/pics/face-smile-big.png deleted file mode 100644 index f9c2335..0000000 Binary files a/demos/declarative/minehunt/pics/face-smile-big.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/face-smile.png b/demos/declarative/minehunt/pics/face-smile.png deleted file mode 100644 index 3d66d72..0000000 Binary files a/demos/declarative/minehunt/pics/face-smile.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/flag-color.png b/demos/declarative/minehunt/pics/flag-color.png deleted file mode 100644 index aadad0f..0000000 Binary files a/demos/declarative/minehunt/pics/flag-color.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/flag.png b/demos/declarative/minehunt/pics/flag.png deleted file mode 100644 index 39cde4d..0000000 Binary files a/demos/declarative/minehunt/pics/flag.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/front.png b/demos/declarative/minehunt/pics/front.png deleted file mode 100644 index 834331b..0000000 Binary files a/demos/declarative/minehunt/pics/front.png and /dev/null differ diff --git a/demos/declarative/minehunt/pics/star.png b/demos/declarative/minehunt/pics/star.png deleted file mode 100644 index 3772359..0000000 Binary files a/demos/declarative/minehunt/pics/star.png and /dev/null differ diff --git a/demos/declarative/minehunt/test.qml b/demos/declarative/minehunt/test.qml deleted file mode 100644 index 11ed182..0000000 --- a/demos/declarative/minehunt/test.qml +++ /dev/null @@ -1,13 +0,0 @@ -import Qt 4.6 - - Image { - source: "pics/front.png" - width: 40 - height: 40 - Image { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - source: "pics/flag.png" - opacity: 1 - } - } -- cgit v0.12 From 115c3214161152c99f488fd4cce39b15b40b3600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 2 Mar 2010 15:34:29 +0100 Subject: Fixed a regression in the syntax highlighter Caused by merging an old version of merge request 481. This patch updates it to the latest version. Merge-request: 481 Reviewed-by: Ritt Konstantin --- src/gui/text/qsyntaxhighlighter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 28af5bb..e594b7e 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -115,6 +115,9 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() formatsChanged = true; } } + } else if (!ranges.isEmpty()) { + ranges.clear(); + formatsChanged = true; } QTextCharFormat emptyFormat; -- cgit v0.12 From e16b33eefa365986f8e0d26c710cb7568bf9abff Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 2 Mar 2010 15:54:38 +0100 Subject: Refactor demos Samegame and Twitter are now trying the new naming convention. --- .../samegame/SamegameCore/BoomBlock.qml | 55 +++++ demos/declarative/samegame/SamegameCore/Button.qml | 25 +++ demos/declarative/samegame/SamegameCore/Dialog.qml | 22 ++ .../samegame/SamegameCore/pics/background.png | Bin 0 -> 313930 bytes .../samegame/SamegameCore/pics/blueStar.png | Bin 0 -> 278 bytes .../samegame/SamegameCore/pics/blueStone.png | Bin 0 -> 3054 bytes .../samegame/SamegameCore/pics/greenStar.png | Bin 0 -> 273 bytes .../samegame/SamegameCore/pics/greenStone.png | Bin 0 -> 2932 bytes .../samegame/SamegameCore/pics/redStar.png | Bin 0 -> 274 bytes .../samegame/SamegameCore/pics/redStone.png | Bin 0 -> 2902 bytes .../samegame/SamegameCore/pics/star.png | Bin 0 -> 262 bytes .../samegame/SamegameCore/pics/yellowStone.png | Bin 0 -> 3056 bytes demos/declarative/samegame/SamegameCore/qmldir | 3 + .../declarative/samegame/SamegameCore/samegame.js | 250 +++++++++++++++++++++ demos/declarative/samegame/content/BoomBlock.qml | 55 ----- demos/declarative/samegame/content/Button.qml | 25 --- demos/declarative/samegame/content/Dialog.qml | 22 -- .../samegame/content/pics/background.png | Bin 313930 -> 0 bytes .../declarative/samegame/content/pics/blueStar.png | Bin 278 -> 0 bytes .../samegame/content/pics/blueStone.png | Bin 3054 -> 0 bytes .../samegame/content/pics/greenStar.png | Bin 273 -> 0 bytes .../samegame/content/pics/greenStone.png | Bin 2932 -> 0 bytes .../declarative/samegame/content/pics/redStar.png | Bin 274 -> 0 bytes .../declarative/samegame/content/pics/redStone.png | Bin 2902 -> 0 bytes demos/declarative/samegame/content/pics/star.png | Bin 262 -> 0 bytes .../samegame/content/pics/yellowStone.png | Bin 3056 -> 0 bytes demos/declarative/samegame/content/qmldir | 3 - demos/declarative/samegame/content/samegame.js | 250 --------------------- demos/declarative/samegame/samegame.qml | 6 +- demos/declarative/twitter/TwitterCore/AuthView.qml | 99 ++++++++ demos/declarative/twitter/TwitterCore/Button.qml | 49 ++++ .../twitter/TwitterCore/FatDelegate.qml | 46 ++++ .../twitter/TwitterCore/HomeTitleBar.qml | 121 ++++++++++ demos/declarative/twitter/TwitterCore/Loading.qml | 8 + .../twitter/TwitterCore/MultiTitleBar.qml | 24 ++ demos/declarative/twitter/TwitterCore/RssModel.qml | 44 ++++ demos/declarative/twitter/TwitterCore/TitleBar.qml | 77 +++++++ demos/declarative/twitter/TwitterCore/ToolBar.qml | 24 ++ .../declarative/twitter/TwitterCore/UserModel.qml | 26 +++ .../twitter/TwitterCore/images/gloss.png | Bin 0 -> 1236 bytes .../twitter/TwitterCore/images/lineedit.png | Bin 0 -> 1415 bytes .../twitter/TwitterCore/images/lineedit.sci | 5 + .../twitter/TwitterCore/images/loading.png | Bin 0 -> 813 bytes .../twitter/TwitterCore/images/stripes.png | Bin 0 -> 257 bytes .../twitter/TwitterCore/images/titlebar.png | Bin 0 -> 1436 bytes .../twitter/TwitterCore/images/titlebar.sci | 5 + .../twitter/TwitterCore/images/toolbutton.png | Bin 0 -> 2550 bytes .../twitter/TwitterCore/images/toolbutton.sci | 5 + demos/declarative/twitter/TwitterCore/qmldir | 10 + demos/declarative/twitter/content/AuthView.qml | 99 -------- demos/declarative/twitter/content/Button.qml | 49 ---- demos/declarative/twitter/content/FatDelegate.qml | 46 ---- demos/declarative/twitter/content/HomeTitleBar.qml | 121 ---------- demos/declarative/twitter/content/Loading.qml | 8 - .../declarative/twitter/content/MultiTitleBar.qml | 24 -- demos/declarative/twitter/content/RssModel.qml | 44 ---- demos/declarative/twitter/content/TitleBar.qml | 77 ------- demos/declarative/twitter/content/ToolBar.qml | 24 -- demos/declarative/twitter/content/UserModel.qml | 26 --- demos/declarative/twitter/content/images/gloss.png | Bin 1236 -> 0 bytes .../twitter/content/images/lineedit.png | Bin 1415 -> 0 bytes .../twitter/content/images/lineedit.sci | 5 - .../declarative/twitter/content/images/loading.png | Bin 813 -> 0 bytes .../declarative/twitter/content/images/stripes.png | Bin 257 -> 0 bytes .../twitter/content/images/titlebar.png | Bin 1436 -> 0 bytes .../twitter/content/images/titlebar.sci | 5 - .../twitter/content/images/toolbutton.png | Bin 2550 -> 0 bytes .../twitter/content/images/toolbutton.sci | 5 - demos/declarative/twitter/twitter.qml | 4 +- 69 files changed, 903 insertions(+), 893 deletions(-) create mode 100644 demos/declarative/samegame/SamegameCore/BoomBlock.qml create mode 100644 demos/declarative/samegame/SamegameCore/Button.qml create mode 100644 demos/declarative/samegame/SamegameCore/Dialog.qml create mode 100644 demos/declarative/samegame/SamegameCore/pics/background.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/blueStar.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/blueStone.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/greenStar.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/greenStone.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/redStar.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/redStone.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/star.png create mode 100644 demos/declarative/samegame/SamegameCore/pics/yellowStone.png create mode 100644 demos/declarative/samegame/SamegameCore/qmldir create mode 100755 demos/declarative/samegame/SamegameCore/samegame.js delete mode 100644 demos/declarative/samegame/content/BoomBlock.qml delete mode 100644 demos/declarative/samegame/content/Button.qml delete mode 100644 demos/declarative/samegame/content/Dialog.qml delete mode 100644 demos/declarative/samegame/content/pics/background.png delete mode 100644 demos/declarative/samegame/content/pics/blueStar.png delete mode 100644 demos/declarative/samegame/content/pics/blueStone.png delete mode 100644 demos/declarative/samegame/content/pics/greenStar.png delete mode 100644 demos/declarative/samegame/content/pics/greenStone.png delete mode 100644 demos/declarative/samegame/content/pics/redStar.png delete mode 100644 demos/declarative/samegame/content/pics/redStone.png delete mode 100644 demos/declarative/samegame/content/pics/star.png delete mode 100644 demos/declarative/samegame/content/pics/yellowStone.png delete mode 100644 demos/declarative/samegame/content/qmldir delete mode 100755 demos/declarative/samegame/content/samegame.js create mode 100644 demos/declarative/twitter/TwitterCore/AuthView.qml create mode 100644 demos/declarative/twitter/TwitterCore/Button.qml create mode 100644 demos/declarative/twitter/TwitterCore/FatDelegate.qml create mode 100644 demos/declarative/twitter/TwitterCore/HomeTitleBar.qml create mode 100644 demos/declarative/twitter/TwitterCore/Loading.qml create mode 100644 demos/declarative/twitter/TwitterCore/MultiTitleBar.qml create mode 100644 demos/declarative/twitter/TwitterCore/RssModel.qml create mode 100644 demos/declarative/twitter/TwitterCore/TitleBar.qml create mode 100644 demos/declarative/twitter/TwitterCore/ToolBar.qml create mode 100644 demos/declarative/twitter/TwitterCore/UserModel.qml create mode 100644 demos/declarative/twitter/TwitterCore/images/gloss.png create mode 100644 demos/declarative/twitter/TwitterCore/images/lineedit.png create mode 100644 demos/declarative/twitter/TwitterCore/images/lineedit.sci create mode 100644 demos/declarative/twitter/TwitterCore/images/loading.png create mode 100644 demos/declarative/twitter/TwitterCore/images/stripes.png create mode 100644 demos/declarative/twitter/TwitterCore/images/titlebar.png create mode 100644 demos/declarative/twitter/TwitterCore/images/titlebar.sci create mode 100644 demos/declarative/twitter/TwitterCore/images/toolbutton.png create mode 100644 demos/declarative/twitter/TwitterCore/images/toolbutton.sci create mode 100644 demos/declarative/twitter/TwitterCore/qmldir delete mode 100644 demos/declarative/twitter/content/AuthView.qml delete mode 100644 demos/declarative/twitter/content/Button.qml delete mode 100644 demos/declarative/twitter/content/FatDelegate.qml delete mode 100644 demos/declarative/twitter/content/HomeTitleBar.qml delete mode 100644 demos/declarative/twitter/content/Loading.qml delete mode 100644 demos/declarative/twitter/content/MultiTitleBar.qml delete mode 100644 demos/declarative/twitter/content/RssModel.qml delete mode 100644 demos/declarative/twitter/content/TitleBar.qml delete mode 100644 demos/declarative/twitter/content/ToolBar.qml delete mode 100644 demos/declarative/twitter/content/UserModel.qml delete mode 100644 demos/declarative/twitter/content/images/gloss.png delete mode 100644 demos/declarative/twitter/content/images/lineedit.png delete mode 100644 demos/declarative/twitter/content/images/lineedit.sci delete mode 100644 demos/declarative/twitter/content/images/loading.png delete mode 100644 demos/declarative/twitter/content/images/stripes.png delete mode 100644 demos/declarative/twitter/content/images/titlebar.png delete mode 100644 demos/declarative/twitter/content/images/titlebar.sci delete mode 100644 demos/declarative/twitter/content/images/toolbutton.png delete mode 100644 demos/declarative/twitter/content/images/toolbutton.sci diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml new file mode 100644 index 0000000..e48194a --- /dev/null +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml @@ -0,0 +1,55 @@ +import Qt 4.6 + +Item { id:block + property bool dying: false + property bool spawned: false + property int type: 0 + property int targetX: 0 + property int targetY: 0 + + SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } + + Image { id: img + source: { + if(type == 0){ + "pics/redStone.png"; + } else if(type == 1) { + "pics/blueStone.png"; + } else { + "pics/greenStone.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.fill: parent + } + + Particles { id: particles + width:1; height:1; anchors.centerIn: parent; + emissionRate: 0; + lifeSpan: 700; lifeSpanDeviation: 600; + angle: 0; angleDeviation: 360; + velocity: 100; velocityDeviation:30; + source: { + if(type == 0){ + "pics/redStar.png"; + } else if (type == 1) { + "pics/blueStar.png"; + } else { + "pics/greenStar.png"; + } + } + } + + states: [ + State{ name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + State{ name: "DeathState"; when: dying == true + StateChangeScript { script: particles.burst(50); } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml new file mode 100644 index 0000000..6629302 --- /dev/null +++ b/demos/declarative/samegame/SamegameCore/Button.qml @@ -0,0 +1,25 @@ +import Qt 4.6 + +Rectangle { + id: container + + signal clicked + property string text: "Button" + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } + + Text { + id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText + } +} diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml new file mode 100644 index 0000000..6d5d6b5 --- /dev/null +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -0,0 +1,22 @@ +import Qt 4.6 + +Rectangle { + id: page + function forceClose() { + page.closed(); + page.opacity = 0; + } + function show(txt) { + myText.text = txt; + page.opacity = 1; + } + signal closed(); + property Item text: myText + color: "white"; border.width: 1; width: myText.width + 20; height: myText.height + 40; + opacity: 0 + Behavior on opacity { + NumberAnimation { duration: 1000 } + } + Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } + MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); } +} diff --git a/demos/declarative/samegame/SamegameCore/pics/background.png b/demos/declarative/samegame/SamegameCore/pics/background.png new file mode 100644 index 0000000..3734a27 Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/background.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/blueStar.png b/demos/declarative/samegame/SamegameCore/pics/blueStar.png new file mode 100644 index 0000000..ff9588f Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/blueStar.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/blueStone.png b/demos/declarative/samegame/SamegameCore/pics/blueStone.png new file mode 100644 index 0000000..20e43c7 Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/blueStone.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/greenStar.png b/demos/declarative/samegame/SamegameCore/pics/greenStar.png new file mode 100644 index 0000000..cd06854 Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/greenStar.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/greenStone.png b/demos/declarative/samegame/SamegameCore/pics/greenStone.png new file mode 100644 index 0000000..b568a19 Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/greenStone.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/redStar.png b/demos/declarative/samegame/SamegameCore/pics/redStar.png new file mode 100644 index 0000000..0a4dffe Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/redStar.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/redStone.png b/demos/declarative/samegame/SamegameCore/pics/redStone.png new file mode 100644 index 0000000..36b09a2 Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/redStone.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/star.png b/demos/declarative/samegame/SamegameCore/pics/star.png new file mode 100644 index 0000000..defbde5 Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/star.png differ diff --git a/demos/declarative/samegame/SamegameCore/pics/yellowStone.png b/demos/declarative/samegame/SamegameCore/pics/yellowStone.png new file mode 100644 index 0000000..b1ce762 Binary files /dev/null and b/demos/declarative/samegame/SamegameCore/pics/yellowStone.png differ diff --git a/demos/declarative/samegame/SamegameCore/qmldir b/demos/declarative/samegame/SamegameCore/qmldir new file mode 100644 index 0000000..a8f8a98 --- /dev/null +++ b/demos/declarative/samegame/SamegameCore/qmldir @@ -0,0 +1,3 @@ +BoomBlock 0.0 BoomBlock.qml +Button 0.0 Button.qml +Dialog 0.0 Dialog.qml diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js new file mode 100755 index 0000000..c0f10bd --- /dev/null +++ b/demos/declarative/samegame/SamegameCore/samegame.js @@ -0,0 +1,250 @@ +/* This script file handles the game logic */ +//Note that X/Y referred to here are in game coordinates +var maxX = 10;//Nums are for gameCanvas.tileSize 40 +var maxY = 15; +var maxIndex = maxX*maxY; +var board = new Array(maxIndex); +var tileSrc = "content/BoomBlock.qml"; +var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; +var scoresURL = ""; +var timer; +var component = createComponent(tileSrc); + +//Index function used instead of a 2D array +function index(xIdx,yIdx) { + return xIdx + (yIdx * maxX); +} + +function timeStr(msecs) { + var secs = Math.floor(msecs/1000); + var m = Math.floor(secs/60); + var ret = "" + m + "m " + (secs%60) + "s"; + return ret; +} + +function getTileSize() +{ + return tileSize; +} + +function initBoard() +{ + for(var i = 0; i= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return; + if(board[index(xIdx, yIdx)] == null) + return; + //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + floodFill(xIdx,yIdx, -1); + if(fillFound <= 0) + return; + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + shuffleDown(); + victoryCheck(); +} + +function floodFill(xIdx,yIdx,type) +{ + if(board[index(xIdx, yIdx)] == null) + return; + var first = false; + if(type == -1){ + first = true; + type = board[index(xIdx,yIdx)].type; + + //Flood fill initialization + fillFound = 0; + floodBoard = new Array(maxIndex); + } + if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return; + if(floodBoard[index(xIdx, yIdx)] == 1 || (!first && type != board[index(xIdx,yIdx)].type)) + return; + floodBoard[index(xIdx, yIdx)] = 1; + floodFill(xIdx+1,yIdx,type); + floodFill(xIdx-1,yIdx,type); + floodFill(xIdx,yIdx+1,type); + floodFill(xIdx,yIdx-1,type); + if(first==true && fillFound == 0) + return;//Can't remove single tiles + board[index(xIdx,yIdx)].dying = true; + board[index(xIdx,yIdx)] = null; + fillFound += 1; +} + +function shuffleDown() +{ + //Fall down + for(var xIdx=0; xIdx=0; yIdx--){ + if(board[index(xIdx,yIdx)] == null){ + fallDist += 1; + }else{ + if(fallDist > 0){ + var obj = board[index(xIdx,yIdx)]; + obj.targetY += fallDist * gameCanvas.tileSize; + board[index(xIdx,yIdx+fallDist)] = obj; + board[index(xIdx,yIdx)] = null; + } + } + } + } + //Fall to the left + fallDist = 0; + for(xIdx=0; xIdx 0){ + for(yIdx=0; yIdx=0; xIdx--) + if(board[index(xIdx, maxY - 1)] != null) + deservesBonus = false; + if(deservesBonus) + gameCanvas.score += 500; + //Checks for game over + if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))){ + timer = new Date() - timer; + //scoreName.show("You won! Please enter your name: "); + scoreName.show("You won! Please enter your name: "); + scoreName.initialWidth = scoreName.text.width + 20; + scoreName.width = scoreName.initialWidth; + scoreName.text.opacity = 0;//Just a spacer + //dialog.show("Game Over. Your score is " + gameCanvas.score); + } +} + +//only floods up and right, to see if it can find adjacent same-typed tiles +function floodMoveCheck(xIdx, yIdx, type) +{ + if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + return false; + if(board[index(xIdx, yIdx)] == null) + return false; + var myType = board[index(xIdx, yIdx)].type; + if(type == myType) + return true; + return floodMoveCheck(xIdx + 1, yIdx, myType) || + floodMoveCheck(xIdx, yIdx - 1, board[index(xIdx,yIdx)].type); +} + +function createBlock(xIdx,yIdx){ + // Note that we don't wait for the component to become ready. This will + // only work if the block QML is a local file. Otherwise the component will + // not be ready immediately. There is a statusChanged signal on the + // component you could use if you want to wait to load remote files. + if(component.isReady){ + var dynamicObject = component.createObject(); + if(dynamicObject == null){ + print("error creating block"); + print(component.errorsString()); + return false; + } + dynamicObject.type = Math.floor(Math.random() * 3); + dynamicObject.parent = gameCanvas; + dynamicObject.x = xIdx*gameCanvas.tileSize; + dynamicObject.targetX = xIdx*gameCanvas.tileSize; + dynamicObject.targetY = yIdx*gameCanvas.tileSize; + dynamicObject.width = gameCanvas.tileSize; + dynamicObject.height = gameCanvas.tileSize; + dynamicObject.spawned = true; + board[index(xIdx,yIdx)] = dynamicObject; + }else{//isError or isLoading + print("error loading block component"); + print(component.errorsString()); + return false; + } + return true; +} + +function saveHighScore(name) { + if(scoresURL!="") + sendHighScore(name); + //OfflineStorage + var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); + var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; + var data = [name, gameCanvas.score, maxX+"x"+maxY ,Math.floor(timer/1000)]; + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + tx.executeSql(dataStr, data); + + //Only show results for the current grid size + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'+maxX+"x"+maxY+'" ORDER BY score desc LIMIT 10'); + var r = "\nHIGH SCORES for this grid size\n\n" + for(var i = 0; i < rs.rows.length; i++){ + r += (i+1)+". " + rs.rows.item(i).name +' got ' + + rs.rows.item(i).score + ' points in ' + + rs.rows.item(i).time + ' seconds.\n'; + } + dialog.show(r); + } + ); +} + +function sendHighScore(name) { + var postman = new XMLHttpRequest() + var postData = "name="+name+"&score="+gameCanvas.score + +"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000); + postman.open("POST", scoresURL, true); + postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + postman.onreadystatechange = function() { + if (postman.readyState == postman.DONE) { + dialog.show("Your score has been uploaded."); + } + } + postman.send(postData); +} diff --git a/demos/declarative/samegame/content/BoomBlock.qml b/demos/declarative/samegame/content/BoomBlock.qml deleted file mode 100644 index e48194a..0000000 --- a/demos/declarative/samegame/content/BoomBlock.qml +++ /dev/null @@ -1,55 +0,0 @@ -import Qt 4.6 - -Item { id:block - property bool dying: false - property bool spawned: false - property int type: 0 - property int targetX: 0 - property int targetY: 0 - - SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } - - Image { id: img - source: { - if(type == 0){ - "pics/redStone.png"; - } else if(type == 1) { - "pics/blueStone.png"; - } else { - "pics/greenStone.png"; - } - } - opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - anchors.fill: parent - } - - Particles { id: particles - width:1; height:1; anchors.centerIn: parent; - emissionRate: 0; - lifeSpan: 700; lifeSpanDeviation: 600; - angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation:30; - source: { - if(type == 0){ - "pics/redStar.png"; - } else if (type == 1) { - "pics/blueStar.png"; - } else { - "pics/greenStar.png"; - } - } - } - - states: [ - State{ name: "AliveState"; when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - State{ name: "DeathState"; when: dying == true - StateChangeScript { script: particles.burst(50); } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] -} diff --git a/demos/declarative/samegame/content/Button.qml b/demos/declarative/samegame/content/Button.qml deleted file mode 100644 index 6629302..0000000 --- a/demos/declarative/samegame/content/Button.qml +++ /dev/null @@ -1,25 +0,0 @@ -import Qt 4.6 - -Rectangle { - id: container - - signal clicked - property string text: "Button" - - color: activePalette.button; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; - - gradient: Gradient { - GradientStop { - id: topGrad; position: 0.0 - color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } - - Text { - id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText - } -} diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/content/Dialog.qml deleted file mode 100644 index 6d5d6b5..0000000 --- a/demos/declarative/samegame/content/Dialog.qml +++ /dev/null @@ -1,22 +0,0 @@ -import Qt 4.6 - -Rectangle { - id: page - function forceClose() { - page.closed(); - page.opacity = 0; - } - function show(txt) { - myText.text = txt; - page.opacity = 1; - } - signal closed(); - property Item text: myText - color: "white"; border.width: 1; width: myText.width + 20; height: myText.height + 40; - opacity: 0 - Behavior on opacity { - NumberAnimation { duration: 1000 } - } - Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } - MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); } -} diff --git a/demos/declarative/samegame/content/pics/background.png b/demos/declarative/samegame/content/pics/background.png deleted file mode 100644 index 3734a27..0000000 Binary files a/demos/declarative/samegame/content/pics/background.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/blueStar.png b/demos/declarative/samegame/content/pics/blueStar.png deleted file mode 100644 index ff9588f..0000000 Binary files a/demos/declarative/samegame/content/pics/blueStar.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/blueStone.png b/demos/declarative/samegame/content/pics/blueStone.png deleted file mode 100644 index 20e43c7..0000000 Binary files a/demos/declarative/samegame/content/pics/blueStone.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/greenStar.png b/demos/declarative/samegame/content/pics/greenStar.png deleted file mode 100644 index cd06854..0000000 Binary files a/demos/declarative/samegame/content/pics/greenStar.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/greenStone.png b/demos/declarative/samegame/content/pics/greenStone.png deleted file mode 100644 index b568a19..0000000 Binary files a/demos/declarative/samegame/content/pics/greenStone.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/redStar.png b/demos/declarative/samegame/content/pics/redStar.png deleted file mode 100644 index 0a4dffe..0000000 Binary files a/demos/declarative/samegame/content/pics/redStar.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/redStone.png b/demos/declarative/samegame/content/pics/redStone.png deleted file mode 100644 index 36b09a2..0000000 Binary files a/demos/declarative/samegame/content/pics/redStone.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/star.png b/demos/declarative/samegame/content/pics/star.png deleted file mode 100644 index defbde5..0000000 Binary files a/demos/declarative/samegame/content/pics/star.png and /dev/null differ diff --git a/demos/declarative/samegame/content/pics/yellowStone.png b/demos/declarative/samegame/content/pics/yellowStone.png deleted file mode 100644 index b1ce762..0000000 Binary files a/demos/declarative/samegame/content/pics/yellowStone.png and /dev/null differ diff --git a/demos/declarative/samegame/content/qmldir b/demos/declarative/samegame/content/qmldir deleted file mode 100644 index a8f8a98..0000000 --- a/demos/declarative/samegame/content/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -BoomBlock 0.0 BoomBlock.qml -Button 0.0 Button.qml -Dialog 0.0 Dialog.qml diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js deleted file mode 100755 index c0f10bd..0000000 --- a/demos/declarative/samegame/content/samegame.js +++ /dev/null @@ -1,250 +0,0 @@ -/* This script file handles the game logic */ -//Note that X/Y referred to here are in game coordinates -var maxX = 10;//Nums are for gameCanvas.tileSize 40 -var maxY = 15; -var maxIndex = maxX*maxY; -var board = new Array(maxIndex); -var tileSrc = "content/BoomBlock.qml"; -var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; -var scoresURL = ""; -var timer; -var component = createComponent(tileSrc); - -//Index function used instead of a 2D array -function index(xIdx,yIdx) { - return xIdx + (yIdx * maxX); -} - -function timeStr(msecs) { - var secs = Math.floor(msecs/1000); - var m = Math.floor(secs/60); - var ret = "" + m + "m " + (secs%60) + "s"; - return ret; -} - -function getTileSize() -{ - return tileSize; -} - -function initBoard() -{ - for(var i = 0; i= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) - return; - if(board[index(xIdx, yIdx)] == null) - return; - //If it's a valid tile, remove it and all connected (does nothing if it's not connected) - floodFill(xIdx,yIdx, -1); - if(fillFound <= 0) - return; - gameCanvas.score += (fillFound - 1) * (fillFound - 1); - shuffleDown(); - victoryCheck(); -} - -function floodFill(xIdx,yIdx,type) -{ - if(board[index(xIdx, yIdx)] == null) - return; - var first = false; - if(type == -1){ - first = true; - type = board[index(xIdx,yIdx)].type; - - //Flood fill initialization - fillFound = 0; - floodBoard = new Array(maxIndex); - } - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) - return; - if(floodBoard[index(xIdx, yIdx)] == 1 || (!first && type != board[index(xIdx,yIdx)].type)) - return; - floodBoard[index(xIdx, yIdx)] = 1; - floodFill(xIdx+1,yIdx,type); - floodFill(xIdx-1,yIdx,type); - floodFill(xIdx,yIdx+1,type); - floodFill(xIdx,yIdx-1,type); - if(first==true && fillFound == 0) - return;//Can't remove single tiles - board[index(xIdx,yIdx)].dying = true; - board[index(xIdx,yIdx)] = null; - fillFound += 1; -} - -function shuffleDown() -{ - //Fall down - for(var xIdx=0; xIdx=0; yIdx--){ - if(board[index(xIdx,yIdx)] == null){ - fallDist += 1; - }else{ - if(fallDist > 0){ - var obj = board[index(xIdx,yIdx)]; - obj.targetY += fallDist * gameCanvas.tileSize; - board[index(xIdx,yIdx+fallDist)] = obj; - board[index(xIdx,yIdx)] = null; - } - } - } - } - //Fall to the left - fallDist = 0; - for(xIdx=0; xIdx 0){ - for(yIdx=0; yIdx=0; xIdx--) - if(board[index(xIdx, maxY - 1)] != null) - deservesBonus = false; - if(deservesBonus) - gameCanvas.score += 500; - //Checks for game over - if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))){ - timer = new Date() - timer; - //scoreName.show("You won! Please enter your name: "); - scoreName.show("You won! Please enter your name: "); - scoreName.initialWidth = scoreName.text.width + 20; - scoreName.width = scoreName.initialWidth; - scoreName.text.opacity = 0;//Just a spacer - //dialog.show("Game Over. Your score is " + gameCanvas.score); - } -} - -//only floods up and right, to see if it can find adjacent same-typed tiles -function floodMoveCheck(xIdx, yIdx, type) -{ - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) - return false; - if(board[index(xIdx, yIdx)] == null) - return false; - var myType = board[index(xIdx, yIdx)].type; - if(type == myType) - return true; - return floodMoveCheck(xIdx + 1, yIdx, myType) || - floodMoveCheck(xIdx, yIdx - 1, board[index(xIdx,yIdx)].type); -} - -function createBlock(xIdx,yIdx){ - // Note that we don't wait for the component to become ready. This will - // only work if the block QML is a local file. Otherwise the component will - // not be ready immediately. There is a statusChanged signal on the - // component you could use if you want to wait to load remote files. - if(component.isReady){ - var dynamicObject = component.createObject(); - if(dynamicObject == null){ - print("error creating block"); - print(component.errorsString()); - return false; - } - dynamicObject.type = Math.floor(Math.random() * 3); - dynamicObject.parent = gameCanvas; - dynamicObject.x = xIdx*gameCanvas.tileSize; - dynamicObject.targetX = xIdx*gameCanvas.tileSize; - dynamicObject.targetY = yIdx*gameCanvas.tileSize; - dynamicObject.width = gameCanvas.tileSize; - dynamicObject.height = gameCanvas.tileSize; - dynamicObject.spawned = true; - board[index(xIdx,yIdx)] = dynamicObject; - }else{//isError or isLoading - print("error loading block component"); - print(component.errorsString()); - return false; - } - return true; -} - -function saveHighScore(name) { - if(scoresURL!="") - sendHighScore(name); - //OfflineStorage - var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); - var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [name, gameCanvas.score, maxX+"x"+maxY ,Math.floor(timer/1000)]; - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - tx.executeSql(dataStr, data); - - //Only show results for the current grid size - var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'+maxX+"x"+maxY+'" ORDER BY score desc LIMIT 10'); - var r = "\nHIGH SCORES for this grid size\n\n" - for(var i = 0; i < rs.rows.length; i++){ - r += (i+1)+". " + rs.rows.item(i).name +' got ' - + rs.rows.item(i).score + ' points in ' - + rs.rows.item(i).time + ' seconds.\n'; - } - dialog.show(r); - } - ); -} - -function sendHighScore(name) { - var postman = new XMLHttpRequest() - var postData = "name="+name+"&score="+gameCanvas.score - +"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000); - postman.open("POST", scoresURL, true); - postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - dialog.show("Your score has been uploaded."); - } - } - postman.send(postData); -} diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index c81f292..3b19cbe 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import "content" +import SamegameCore 1.0 Rectangle { id: screen @@ -12,7 +12,7 @@ Rectangle { Image { id: background - anchors.fill: parent; source: "content/pics/background.png" + anchors.fill: parent; source: "SamegameCore/pics/background.png" fillMode: Image.PreserveAspectCrop smooth: true } @@ -22,7 +22,7 @@ Rectangle { property int score: 0 property int tileSize: 40 - Script { source: "content/samegame.js" } + Script { source: "SamegameCore/samegame.js" } z: 20; anchors.centerIn: parent width: parent.width - (parent.width % getTileSize()); diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml new file mode 100644 index 0000000..bcf4646 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/AuthView.qml @@ -0,0 +1,99 @@ +import Qt 4.6 + +Item { + id: wrapper + Column { + anchors.centerIn: parent + spacing: 20 + Column{ + spacing: 4 + Text { + text: "Screen name:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Item { + width: 220 + height: 28 + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + TextInput{ + id: nameIn + width: parent.width - 8 + anchors.centerIn: parent + maximumLength:21 + font.pixelSize: 16; + font.bold: true + color: "#151515"; selectionColor: "green" + KeyNavigation.down: passIn + focus: true + } + } + } + Column{ + spacing: 4 + Text { + text: "Password:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Item { + width: 220 + height: 28 + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + TextInput{ + id: passIn + width: parent.width - 8 + anchors.centerIn: parent + maximumLength:21 + echoMode: TextInput.Password + font.pixelSize: 16; + font.bold: true + color: "#151515"; selectionColor: "green" + KeyNavigation.down: login + KeyNavigation.up: nameIn + } + } + } + Row{ + spacing: 10 + Button { + width: 100 + height: 32 + id: login + keyUsing: true; + function doLogin(){ + rssModel.authName=nameIn.text; + rssModel.authPass=passIn.text; + rssModel.tags='my timeline'; + screen.focus = true; + } + text: "Log in" + KeyNavigation.right: guest + KeyNavigation.up: passIn + Keys.onReturnPressed: login.doLogin(); + Keys.onSelectPressed: login.doLogin(); + Keys.onSpacePressed: login.doLogin(); + onClicked: login.doLogin(); + } + Button { + width: 100 + height: 32 + id: guest + keyUsing: true; + function doGuest() + { + rssModel.authName='-'; + screen.focus = true; + screen.setMode(true); + } + text: "Guest" + KeyNavigation.left: login + KeyNavigation.up: passIn + Keys.onReturnPressed: guest.doGuest(); + Keys.onSelectPressed: guest.doGuest(); + Keys.onSpacePressed: guest.doGuest(); + onClicked: guest.doGuest(); + } + } + } +} diff --git a/demos/declarative/twitter/TwitterCore/Button.qml b/demos/declarative/twitter/TwitterCore/Button.qml new file mode 100644 index 0000000..4cba8c3 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/Button.qml @@ -0,0 +1,49 @@ +import Qt 4.6 + +Item { + id: container + + signal clicked + + property string text + property bool keyUsing: false + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + BorderImage { + id: pressed + opacity: 0 + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + id: btnText + color: if(container.keyUsing){"#DDDDDD";} else {"#FFFFFF";} + anchors.centerIn: buttonImage; font.bold: true + text: container.text; style: Text.Raised; styleColor: "black" + font.pixelSize: 12 + } + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } + }, + State { + name: "Focused" + when: container.focus == true + PropertyChanges { target: btnText; color: "#FFFFFF" } + } + ] + transitions: Transition { + ColorAnimation { target: btnText; } + } +} diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml new file mode 100644 index 0000000..0f013e6 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -0,0 +1,46 @@ +import Qt 4.6 + +Component { + id: listDelegate + Item { + id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4 + Script { + function handleLink(link){ + if(link.slice(0,3) == 'app'){ + setUser(link.slice(7)); + screen.setMode(true); + }else if(link.slice(0,4) == 'http'){ + Qt.openUrlExternally(link); + } + } + function addTags(str){ + var ret = str.replace(/@[a-zA-Z0-9_]+/g, '$&');//click to jump to user? + var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//surrounds http links with html link tags + return ret2; + } + } + Item { + id: moveMe; height: parent.height + Rectangle { + id: blackRect + color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 + } + Rectangle { + id: whiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true + anchors.verticalCenter: parent.verticalCenter + + Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != 1 } + Image { id: realImage; source: userImage; x: 1; y: 1; width:48; height:48 } + } + Text { id:txt; y:4; x: 56 + text: '' + + ''+userScreenName + " from " +source + + "
" + addTags(statusText) + ""; + textFormat: Qt.RichText + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 + onLinkActivated: handleLink(link) + } + } + } +} diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml new file mode 100644 index 0000000..a206c87 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -0,0 +1,121 @@ +import Qt 4.6 + +Item { + id: titleBar + + signal update() + onYChanged: state="" //When switching titlebars + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + Script { + function accept() { + if(rssModel.authName == '' || rssModel.authPass == '') + return false;//Can't login like that + + var postData = "status=" + editor.text; + var postman = new XMLHttpRequest(); + postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass); + postman.onreadystatechange = function() { + if (postman.readyState == postman.DONE) { + titleBar.update(); + } + } + postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + postman.send(postData); + + editor.text = "" + titleBar.state = "" + } + } + + Rectangle { + x: 6; width: 50; height: 50; color: "white"; smooth: true + anchors.verticalCenter: parent.verticalCenter + + UserModel { user: rssModel.authName; id: userModel } + Component { id: imgDelegate; + Item { + Loading { width:48; height:48; visible: realImage.status != 1 } + Image { source: image; width:48; height:48; id: realImage } + } + } + ListView { model: userModel.model; x:1; y:1; delegate: imgDelegate } + } + + Text { + id: categoryText + anchors.left: parent.left; anchors.right: tagButton.left + anchors.leftMargin: 58; anchors.rightMargin: 10 + anchors.verticalCenter: parent.verticalCenter + elide: Text.ElideLeft + text: "Timeline for " + rssModel.authName + font.pixelSize: 12; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + } + + Button { + id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." + anchors.verticalCenter: parent.verticalCenter; + onClicked: if (titleBar.state == "Posting") accept(); else titleBar.state = "Posting" + } + + Text { + id: charsLeftText; anchors.horizontalCenter: tagButton.horizontalCenter; + anchors.top: tagButton.bottom; anchors.topMargin: 2 + text: {140 - editor.text.length;} visible: titleBar.state == "Posting" + font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + } + Item { + id: txtEdit; + anchors.left: tagButton.right; anchors.leftMargin: 5; y: 4 + anchors.right: parent.right; anchors.rightMargin: 40; height: parent.height - 9 + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + + Binding {//TODO: Can this be a function, which also resets the cursor? And flashes? + when: editor.text.length > 140 + target: editor + property: "text" + value: editor.text.slice(0,140) + } + TextEdit { + id: editor + anchors.left: parent.left; + anchors.leftMargin: 8; + anchors.bottom: parent.bottom + anchors.bottomMargin: 4; + cursorVisible: true; font.bold: true + width: parent.width - 12 + height: parent.height - 8 + font.pointSize: 10 + wrap: true + color: "#151515"; selectionColor: "green" + } + Keys.forwardTo: [(returnKey), (editor)] + Item { + id: returnKey + Keys.onReturnPressed: accept() + Keys.onEscapePressed: titleBar.state = "" + } + } + } + states: [ + State { + name: "Posting" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: titleBar; height: 80 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: tagButton; width: 28 } + PropertyChanges { target: tagButton; height: 24 } + PropertyChanges { target: txtEdit; focus: true } + } + ] + transitions: [ + Transition { + from: "*"; to: "*" + NumberAnimation { properties: "x,y,width,height"; easing.type: "InOutQuad" } + } + ] +} diff --git a/demos/declarative/twitter/TwitterCore/Loading.qml b/demos/declarative/twitter/TwitterCore/Loading.qml new file mode 100644 index 0000000..76bf64b --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/Loading.qml @@ -0,0 +1,8 @@ +import Qt 4.6 + +Image { + id: loading; source: "images/loading.png"; transformOrigin: "Center" + NumberAnimation on rotation { + from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 + } +} diff --git a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml new file mode 100644 index 0000000..e0205b8 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml @@ -0,0 +1,24 @@ +import Qt 4.6 + +Item { + height: homeBar.height + HomeTitleBar { id: homeBar; width: parent.width; height: 60; + onUpdate: rssModel.reload() + } + TitleBar { id: titleBar; width: parent.width; height: 60; + y: -80 + untaggedString: "Latest tweets from everyone" + taggedString: "Latest tweets from " + } + states: [ + State { + name: "search"; when: screen.userView + PropertyChanges { target: titleBar; y: 0 } + PropertyChanges { target: homeBar; y: -80 } + } + ] + transitions: [ + Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } } + ] +} + diff --git a/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml new file mode 100644 index 0000000..9d88bb7 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml @@ -0,0 +1,44 @@ +import Qt 4.6 + +Item { id: wrapper + property var model: xmlModel + property string tags : "" + property string authName : "" + property string authPass : "" + property string mode : "everyone" + property int status: xmlModel.status + function reload() { xmlModel.reload(); } +XmlListModel { + id: xmlModel + + source:{ + if (wrapper.authName == ""){ + ""; //Avoid worthless calls to twitter servers + }else if(wrapper.mode == 'user'){ + "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/user_timeline.xml?screen_name="+wrapper.tags; + }else if(wrapper.mode == 'self'){ + "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/friends_timeline.xml"; + }else{//everyone/public + "http://twitter.com/statuses/public_timeline.xml"; + } + } + query: "/statuses/status" + + XmlRole { name: "statusText"; query: "text/string()" } + XmlRole { name: "timestamp"; query: "created_at/string()" } + XmlRole { name: "source"; query: "source/string()" } + XmlRole { name: "userName"; query: "user/name/string()" } + XmlRole { name: "userScreenName"; query: "user/screen_name/string()" } + XmlRole { name: "userImage"; query: "user/profile_image_url/string()" } + XmlRole { name: "userLocation"; query: "user/location/string()" } + XmlRole { name: "userDescription"; query: "user/description/string()" } + XmlRole { name: "userFollowers"; query: "user/followers_count/string()" } + XmlRole { name: "userStatuses"; query: "user/statuses_count/string()" } + //TODO: Could also get the user's color scheme, timezone and a few other things +} +Binding { + property: "mode" + target: wrapper + value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} +} +} diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml new file mode 100644 index 0000000..149aa82 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml @@ -0,0 +1,77 @@ +import Qt 4.6 + +Item { + id: titleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + Script { + function accept() { + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text + } + } + + Text { + id: categoryText + anchors { + left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) + font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" + font.pixelSize: 12 + } + + Button { + id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." + onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags" + anchors.verticalCenter: parent.verticalCenter + } + + Item { + id: lineEdit + y: 4; height: parent.height - 9 + anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } + + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + + TextInput { + id: editor + anchors { + left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + cursorVisible: true; font.bold: true + color: "#151515"; selectionColor: "Green" + } + + Keys.forwardTo: [ (returnKey), (editor)] + + Item { + id: returnKey + Keys.onReturnPressed: accept() + Keys.onEscapePressed: titleBar.state = "" + } + } + } + + states: State { + name: "Tags" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: lineEdit; focus: true } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: "InOutQuad" } + } +} diff --git a/demos/declarative/twitter/TwitterCore/ToolBar.qml b/demos/declarative/twitter/TwitterCore/ToolBar.qml new file mode 100644 index 0000000..f96c767 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/ToolBar.qml @@ -0,0 +1,24 @@ +import Qt 4.6 + +Item { + id: toolbar + + property alias button1Label: button1.text + property alias button2Label: button2.text + signal button1Clicked + signal button2Clicked + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Button { + id: button1 + anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button1Clicked() + } + + Button { + id: button2 + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button2Clicked() + } +} diff --git a/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml new file mode 100644 index 0000000..c146b84 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml @@ -0,0 +1,26 @@ +import Qt 4.6 + +//This "model" gets the user information about the searched user. Mainly for the icon. +//Copied from RssModel + +Item { id: wrapper + property var model: xmlModel + property string user : "" + property int status: xmlModel.status + function reload() { xmlModel.reload(); } +XmlListModel { + id: xmlModel + + source: {if(user!="") {"http://twitter.com/users/show.xml?screen_name="+user;}else{"";}} + query: "/user" + + XmlRole { name: "name"; query: "name/string()" } + XmlRole { name: "screenName"; query: "screen_name/string()" } + XmlRole { name: "image"; query: "profile_image_url/string()" } + XmlRole { name: "location"; query: "location/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "followers"; query: "followers_count/string()" } + //XmlRole { name: "protected"; query: "protected/bool()" } + //TODO: Could also get the user's color scheme, timezone and a few other things +} +} diff --git a/demos/declarative/twitter/TwitterCore/images/gloss.png b/demos/declarative/twitter/TwitterCore/images/gloss.png new file mode 100644 index 0000000..5d370cd Binary files /dev/null and b/demos/declarative/twitter/TwitterCore/images/gloss.png differ diff --git a/demos/declarative/twitter/TwitterCore/images/lineedit.png b/demos/declarative/twitter/TwitterCore/images/lineedit.png new file mode 100644 index 0000000..2cc38dc Binary files /dev/null and b/demos/declarative/twitter/TwitterCore/images/lineedit.png differ diff --git a/demos/declarative/twitter/TwitterCore/images/lineedit.sci b/demos/declarative/twitter/TwitterCore/images/lineedit.sci new file mode 100644 index 0000000..054bff7 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/images/lineedit.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/demos/declarative/twitter/TwitterCore/images/loading.png b/demos/declarative/twitter/TwitterCore/images/loading.png new file mode 100644 index 0000000..47a1589 Binary files /dev/null and b/demos/declarative/twitter/TwitterCore/images/loading.png differ diff --git a/demos/declarative/twitter/TwitterCore/images/stripes.png b/demos/declarative/twitter/TwitterCore/images/stripes.png new file mode 100644 index 0000000..9f36727 Binary files /dev/null and b/demos/declarative/twitter/TwitterCore/images/stripes.png differ diff --git a/demos/declarative/twitter/TwitterCore/images/titlebar.png b/demos/declarative/twitter/TwitterCore/images/titlebar.png new file mode 100644 index 0000000..51c9008 Binary files /dev/null and b/demos/declarative/twitter/TwitterCore/images/titlebar.png differ diff --git a/demos/declarative/twitter/TwitterCore/images/titlebar.sci b/demos/declarative/twitter/TwitterCore/images/titlebar.sci new file mode 100644 index 0000000..0418d94 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/demos/declarative/twitter/TwitterCore/images/toolbutton.png b/demos/declarative/twitter/TwitterCore/images/toolbutton.png new file mode 100644 index 0000000..1131001 Binary files /dev/null and b/demos/declarative/twitter/TwitterCore/images/toolbutton.png differ diff --git a/demos/declarative/twitter/TwitterCore/images/toolbutton.sci b/demos/declarative/twitter/TwitterCore/images/toolbutton.sci new file mode 100644 index 0000000..9e4f965 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/demos/declarative/twitter/TwitterCore/qmldir b/demos/declarative/twitter/TwitterCore/qmldir new file mode 100644 index 0000000..8b56c56 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/qmldir @@ -0,0 +1,10 @@ +AuthView 1.0 AuthView.qml +Button 1.0 Button.qml +FatDelegate 1.0 FatDelegate.qml +HomeTitleBar 1.0 HomeTitleBar.qml +Loading 1.0 Loading.qml +MultiTitleBar 1.0 MultiTitleBar.qml +TitleBar 1.0 TitleBar.qml +RssModel 1.0 RssModel.qml +UserModel 1.0 UserModel.qml +ToolBar 1.0 ToolBar.qml diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml deleted file mode 100644 index bcf4646..0000000 --- a/demos/declarative/twitter/content/AuthView.qml +++ /dev/null @@ -1,99 +0,0 @@ -import Qt 4.6 - -Item { - id: wrapper - Column { - anchors.centerIn: parent - spacing: 20 - Column{ - spacing: 4 - Text { - text: "Screen name:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Item { - width: 220 - height: 28 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - TextInput{ - id: nameIn - width: parent.width - 8 - anchors.centerIn: parent - maximumLength:21 - font.pixelSize: 16; - font.bold: true - color: "#151515"; selectionColor: "green" - KeyNavigation.down: passIn - focus: true - } - } - } - Column{ - spacing: 4 - Text { - text: "Password:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Item { - width: 220 - height: 28 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - TextInput{ - id: passIn - width: parent.width - 8 - anchors.centerIn: parent - maximumLength:21 - echoMode: TextInput.Password - font.pixelSize: 16; - font.bold: true - color: "#151515"; selectionColor: "green" - KeyNavigation.down: login - KeyNavigation.up: nameIn - } - } - } - Row{ - spacing: 10 - Button { - width: 100 - height: 32 - id: login - keyUsing: true; - function doLogin(){ - rssModel.authName=nameIn.text; - rssModel.authPass=passIn.text; - rssModel.tags='my timeline'; - screen.focus = true; - } - text: "Log in" - KeyNavigation.right: guest - KeyNavigation.up: passIn - Keys.onReturnPressed: login.doLogin(); - Keys.onSelectPressed: login.doLogin(); - Keys.onSpacePressed: login.doLogin(); - onClicked: login.doLogin(); - } - Button { - width: 100 - height: 32 - id: guest - keyUsing: true; - function doGuest() - { - rssModel.authName='-'; - screen.focus = true; - screen.setMode(true); - } - text: "Guest" - KeyNavigation.left: login - KeyNavigation.up: passIn - Keys.onReturnPressed: guest.doGuest(); - Keys.onSelectPressed: guest.doGuest(); - Keys.onSpacePressed: guest.doGuest(); - onClicked: guest.doGuest(); - } - } - } -} diff --git a/demos/declarative/twitter/content/Button.qml b/demos/declarative/twitter/content/Button.qml deleted file mode 100644 index 4cba8c3..0000000 --- a/demos/declarative/twitter/content/Button.qml +++ /dev/null @@ -1,49 +0,0 @@ -import Qt 4.6 - -Item { - id: container - - signal clicked - - property string text - property bool keyUsing: false - - BorderImage { - id: buttonImage - source: "images/toolbutton.sci" - width: container.width; height: container.height - } - BorderImage { - id: pressed - opacity: 0 - source: "images/toolbutton.sci" - width: container.width; height: container.height - } - MouseArea { - id: mouseRegion - anchors.fill: buttonImage - onClicked: { container.clicked(); } - } - Text { - id: btnText - color: if(container.keyUsing){"#DDDDDD";} else {"#FFFFFF";} - anchors.centerIn: buttonImage; font.bold: true - text: container.text; style: Text.Raised; styleColor: "black" - font.pixelSize: 12 - } - states: [ - State { - name: "Pressed" - when: mouseRegion.pressed == true - PropertyChanges { target: pressed; opacity: 1 } - }, - State { - name: "Focused" - when: container.focus == true - PropertyChanges { target: btnText; color: "#FFFFFF" } - } - ] - transitions: Transition { - ColorAnimation { target: btnText; } - } -} diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/content/FatDelegate.qml deleted file mode 100644 index 0f013e6..0000000 --- a/demos/declarative/twitter/content/FatDelegate.qml +++ /dev/null @@ -1,46 +0,0 @@ -import Qt 4.6 - -Component { - id: listDelegate - Item { - id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4 - Script { - function handleLink(link){ - if(link.slice(0,3) == 'app'){ - setUser(link.slice(7)); - screen.setMode(true); - }else if(link.slice(0,4) == 'http'){ - Qt.openUrlExternally(link); - } - } - function addTags(str){ - var ret = str.replace(/@[a-zA-Z0-9_]+/g, '$&');//click to jump to user? - var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//surrounds http links with html link tags - return ret2; - } - } - Item { - id: moveMe; height: parent.height - Rectangle { - id: blackRect - color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 - } - Rectangle { - id: whiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true - anchors.verticalCenter: parent.verticalCenter - - Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != 1 } - Image { id: realImage; source: userImage; x: 1; y: 1; width:48; height:48 } - } - Text { id:txt; y:4; x: 56 - text: '' - + ''+userScreenName + " from " +source - + "
" + addTags(statusText) + ""; - textFormat: Qt.RichText - color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true - anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 - onLinkActivated: handleLink(link) - } - } - } -} diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml deleted file mode 100644 index a206c87..0000000 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ /dev/null @@ -1,121 +0,0 @@ -import Qt 4.6 - -Item { - id: titleBar - - signal update() - onYChanged: state="" //When switching titlebars - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - Item { - id: container - width: (parent.width * 2) - 55 ; height: parent.height - - Script { - function accept() { - if(rssModel.authName == '' || rssModel.authPass == '') - return false;//Can't login like that - - var postData = "status=" + editor.text; - var postman = new XMLHttpRequest(); - postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - titleBar.update(); - } - } - postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.send(postData); - - editor.text = "" - titleBar.state = "" - } - } - - Rectangle { - x: 6; width: 50; height: 50; color: "white"; smooth: true - anchors.verticalCenter: parent.verticalCenter - - UserModel { user: rssModel.authName; id: userModel } - Component { id: imgDelegate; - Item { - Loading { width:48; height:48; visible: realImage.status != 1 } - Image { source: image; width:48; height:48; id: realImage } - } - } - ListView { model: userModel.model; x:1; y:1; delegate: imgDelegate } - } - - Text { - id: categoryText - anchors.left: parent.left; anchors.right: tagButton.left - anchors.leftMargin: 58; anchors.rightMargin: 10 - anchors.verticalCenter: parent.verticalCenter - elide: Text.ElideLeft - text: "Timeline for " + rssModel.authName - font.pixelSize: 12; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - } - - Button { - id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." - anchors.verticalCenter: parent.verticalCenter; - onClicked: if (titleBar.state == "Posting") accept(); else titleBar.state = "Posting" - } - - Text { - id: charsLeftText; anchors.horizontalCenter: tagButton.horizontalCenter; - anchors.top: tagButton.bottom; anchors.topMargin: 2 - text: {140 - editor.text.length;} visible: titleBar.state == "Posting" - font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - } - Item { - id: txtEdit; - anchors.left: tagButton.right; anchors.leftMargin: 5; y: 4 - anchors.right: parent.right; anchors.rightMargin: 40; height: parent.height - 9 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - - Binding {//TODO: Can this be a function, which also resets the cursor? And flashes? - when: editor.text.length > 140 - target: editor - property: "text" - value: editor.text.slice(0,140) - } - TextEdit { - id: editor - anchors.left: parent.left; - anchors.leftMargin: 8; - anchors.bottom: parent.bottom - anchors.bottomMargin: 4; - cursorVisible: true; font.bold: true - width: parent.width - 12 - height: parent.height - 8 - font.pointSize: 10 - wrap: true - color: "#151515"; selectionColor: "green" - } - Keys.forwardTo: [(returnKey), (editor)] - Item { - id: returnKey - Keys.onReturnPressed: accept() - Keys.onEscapePressed: titleBar.state = "" - } - } - } - states: [ - State { - name: "Posting" - PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: titleBar; height: 80 } - PropertyChanges { target: tagButton; text: "OK" } - PropertyChanges { target: tagButton; width: 28 } - PropertyChanges { target: tagButton; height: 24 } - PropertyChanges { target: txtEdit; focus: true } - } - ] - transitions: [ - Transition { - from: "*"; to: "*" - NumberAnimation { properties: "x,y,width,height"; easing.type: "InOutQuad" } - } - ] -} diff --git a/demos/declarative/twitter/content/Loading.qml b/demos/declarative/twitter/content/Loading.qml deleted file mode 100644 index 76bf64b..0000000 --- a/demos/declarative/twitter/content/Loading.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Qt 4.6 - -Image { - id: loading; source: "images/loading.png"; transformOrigin: "Center" - NumberAnimation on rotation { - from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 - } -} diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/content/MultiTitleBar.qml deleted file mode 100644 index e0205b8..0000000 --- a/demos/declarative/twitter/content/MultiTitleBar.qml +++ /dev/null @@ -1,24 +0,0 @@ -import Qt 4.6 - -Item { - height: homeBar.height - HomeTitleBar { id: homeBar; width: parent.width; height: 60; - onUpdate: rssModel.reload() - } - TitleBar { id: titleBar; width: parent.width; height: 60; - y: -80 - untaggedString: "Latest tweets from everyone" - taggedString: "Latest tweets from " - } - states: [ - State { - name: "search"; when: screen.userView - PropertyChanges { target: titleBar; y: 0 } - PropertyChanges { target: homeBar; y: -80 } - } - ] - transitions: [ - Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } } - ] -} - diff --git a/demos/declarative/twitter/content/RssModel.qml b/demos/declarative/twitter/content/RssModel.qml deleted file mode 100644 index 9d88bb7..0000000 --- a/demos/declarative/twitter/content/RssModel.qml +++ /dev/null @@ -1,44 +0,0 @@ -import Qt 4.6 - -Item { id: wrapper - property var model: xmlModel - property string tags : "" - property string authName : "" - property string authPass : "" - property string mode : "everyone" - property int status: xmlModel.status - function reload() { xmlModel.reload(); } -XmlListModel { - id: xmlModel - - source:{ - if (wrapper.authName == ""){ - ""; //Avoid worthless calls to twitter servers - }else if(wrapper.mode == 'user'){ - "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/user_timeline.xml?screen_name="+wrapper.tags; - }else if(wrapper.mode == 'self'){ - "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/friends_timeline.xml"; - }else{//everyone/public - "http://twitter.com/statuses/public_timeline.xml"; - } - } - query: "/statuses/status" - - XmlRole { name: "statusText"; query: "text/string()" } - XmlRole { name: "timestamp"; query: "created_at/string()" } - XmlRole { name: "source"; query: "source/string()" } - XmlRole { name: "userName"; query: "user/name/string()" } - XmlRole { name: "userScreenName"; query: "user/screen_name/string()" } - XmlRole { name: "userImage"; query: "user/profile_image_url/string()" } - XmlRole { name: "userLocation"; query: "user/location/string()" } - XmlRole { name: "userDescription"; query: "user/description/string()" } - XmlRole { name: "userFollowers"; query: "user/followers_count/string()" } - XmlRole { name: "userStatuses"; query: "user/statuses_count/string()" } - //TODO: Could also get the user's color scheme, timezone and a few other things -} -Binding { - property: "mode" - target: wrapper - value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} -} -} diff --git a/demos/declarative/twitter/content/TitleBar.qml b/demos/declarative/twitter/content/TitleBar.qml deleted file mode 100644 index 149aa82..0000000 --- a/demos/declarative/twitter/content/TitleBar.qml +++ /dev/null @@ -1,77 +0,0 @@ -import Qt 4.6 - -Item { - id: titleBar - property string untaggedString: "Uploads from everyone" - property string taggedString: "Recent uploads tagged " - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - - Item { - id: container - width: (parent.width * 2) - 55 ; height: parent.height - - Script { - function accept() { - titleBar.state = "" - background.state = "" - rssModel.tags = editor.text - } - } - - Text { - id: categoryText - anchors { - left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10 - verticalCenter: parent.verticalCenter - } - elide: Text.ElideLeft - text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) - font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" - font.pixelSize: 12 - } - - Button { - id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." - onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags" - anchors.verticalCenter: parent.verticalCenter - } - - Item { - id: lineEdit - y: 4; height: parent.height - 9 - anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } - - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - - TextInput { - id: editor - anchors { - left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 - verticalCenter: parent.verticalCenter - } - cursorVisible: true; font.bold: true - color: "#151515"; selectionColor: "Green" - } - - Keys.forwardTo: [ (returnKey), (editor)] - - Item { - id: returnKey - Keys.onReturnPressed: accept() - Keys.onEscapePressed: titleBar.state = "" - } - } - } - - states: State { - name: "Tags" - PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: tagButton; text: "OK" } - PropertyChanges { target: lineEdit; focus: true } - } - - transitions: Transition { - NumberAnimation { properties: "x"; easing.type: "InOutQuad" } - } -} diff --git a/demos/declarative/twitter/content/ToolBar.qml b/demos/declarative/twitter/content/ToolBar.qml deleted file mode 100644 index f96c767..0000000 --- a/demos/declarative/twitter/content/ToolBar.qml +++ /dev/null @@ -1,24 +0,0 @@ -import Qt 4.6 - -Item { - id: toolbar - - property alias button1Label: button1.text - property alias button2Label: button2.text - signal button1Clicked - signal button2Clicked - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - - Button { - id: button1 - anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 - onClicked: toolbar.button1Clicked() - } - - Button { - id: button2 - anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 - onClicked: toolbar.button2Clicked() - } -} diff --git a/demos/declarative/twitter/content/UserModel.qml b/demos/declarative/twitter/content/UserModel.qml deleted file mode 100644 index c146b84..0000000 --- a/demos/declarative/twitter/content/UserModel.qml +++ /dev/null @@ -1,26 +0,0 @@ -import Qt 4.6 - -//This "model" gets the user information about the searched user. Mainly for the icon. -//Copied from RssModel - -Item { id: wrapper - property var model: xmlModel - property string user : "" - property int status: xmlModel.status - function reload() { xmlModel.reload(); } -XmlListModel { - id: xmlModel - - source: {if(user!="") {"http://twitter.com/users/show.xml?screen_name="+user;}else{"";}} - query: "/user" - - XmlRole { name: "name"; query: "name/string()" } - XmlRole { name: "screenName"; query: "screen_name/string()" } - XmlRole { name: "image"; query: "profile_image_url/string()" } - XmlRole { name: "location"; query: "location/string()" } - XmlRole { name: "description"; query: "description/string()" } - XmlRole { name: "followers"; query: "followers_count/string()" } - //XmlRole { name: "protected"; query: "protected/bool()" } - //TODO: Could also get the user's color scheme, timezone and a few other things -} -} diff --git a/demos/declarative/twitter/content/images/gloss.png b/demos/declarative/twitter/content/images/gloss.png deleted file mode 100644 index 5d370cd..0000000 Binary files a/demos/declarative/twitter/content/images/gloss.png and /dev/null differ diff --git a/demos/declarative/twitter/content/images/lineedit.png b/demos/declarative/twitter/content/images/lineedit.png deleted file mode 100644 index 2cc38dc..0000000 Binary files a/demos/declarative/twitter/content/images/lineedit.png and /dev/null differ diff --git a/demos/declarative/twitter/content/images/lineedit.sci b/demos/declarative/twitter/content/images/lineedit.sci deleted file mode 100644 index 054bff7..0000000 --- a/demos/declarative/twitter/content/images/lineedit.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 10 -border.bottom: 10 -border.right: 10 -source: lineedit.png diff --git a/demos/declarative/twitter/content/images/loading.png b/demos/declarative/twitter/content/images/loading.png deleted file mode 100644 index 47a1589..0000000 Binary files a/demos/declarative/twitter/content/images/loading.png and /dev/null differ diff --git a/demos/declarative/twitter/content/images/stripes.png b/demos/declarative/twitter/content/images/stripes.png deleted file mode 100644 index 9f36727..0000000 Binary files a/demos/declarative/twitter/content/images/stripes.png and /dev/null differ diff --git a/demos/declarative/twitter/content/images/titlebar.png b/demos/declarative/twitter/content/images/titlebar.png deleted file mode 100644 index 51c9008..0000000 Binary files a/demos/declarative/twitter/content/images/titlebar.png and /dev/null differ diff --git a/demos/declarative/twitter/content/images/titlebar.sci b/demos/declarative/twitter/content/images/titlebar.sci deleted file mode 100644 index 0418d94..0000000 --- a/demos/declarative/twitter/content/images/titlebar.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 12 -border.bottom: 12 -border.right: 10 -source: titlebar.png diff --git a/demos/declarative/twitter/content/images/toolbutton.png b/demos/declarative/twitter/content/images/toolbutton.png deleted file mode 100644 index 1131001..0000000 Binary files a/demos/declarative/twitter/content/images/toolbutton.png and /dev/null differ diff --git a/demos/declarative/twitter/content/images/toolbutton.sci b/demos/declarative/twitter/content/images/toolbutton.sci deleted file mode 100644 index 9e4f965..0000000 --- a/demos/declarative/twitter/content/images/toolbutton.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 15 -border.top: 4 -border.bottom: 4 -border.right: 15 -source: toolbutton.png diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 0ea1309..259f79a 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import "content" as Twitter +import TwitterCore 1.0 as Twitter Item { id: screen; width: 320; height: 480 @@ -28,7 +28,7 @@ Item { id: background anchors.fill: parent; color: "#343434"; - Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } Twitter.RssModel { id: rssModel } Twitter.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} -- cgit v0.12 From 4eaa7599be17d0838f98e2bafb0f0c8a0787530e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 2 Mar 2010 15:55:17 +0100 Subject: Add minehunt README --- demos/declarative/minehunt/README | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 demos/declarative/minehunt/README diff --git a/demos/declarative/minehunt/README b/demos/declarative/minehunt/README new file mode 100644 index 0000000..7379dcf --- /dev/null +++ b/demos/declarative/minehunt/README @@ -0,0 +1,3 @@ +To run, simply load the minehunt.qml file with the qml runtime. + +Note that on X11, this demo has problems with the native graphicssystem. If you are using the X11 window system, please pass -graphicssystem raster to the qml binary. -- cgit v0.12 From 95087389919837fef920c6c06ccd34c3136c6b5e Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 1 Mar 2010 17:45:15 +0100 Subject: Help system: Build search index with low priority. Reviewed-by: kh1 --- tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp | 2 +- tools/assistant/lib/qhelpsearchindexwriter_default.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp index d9dcec5..4baa376 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp @@ -586,7 +586,7 @@ void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile, this->m_indexFilesFolder = indexFilesFolder; mutex.unlock(); - start(QThread::NormalPriority); + start(QThread::LowestPriority); } void QHelpSearchIndexWriter::optimizeIndex() diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp index cb3e49c..827d145 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp @@ -191,7 +191,7 @@ void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile, this->m_collectionFile = collectionFile; this->m_indexFilesFolder = indexFilesFolder; - start(QThread::NormalPriority); + start(QThread::LowestPriority); } void QHelpSearchIndexWriter::run() -- cgit v0.12 From fbcfcea9bb5cf0ce39e5ce1fb9b0628930f034d1 Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 2 Mar 2010 15:31:27 +0100 Subject: Assistant: Un-watch files at shutdown. Not strictly needed, but it seems nicer to have a removePath() for every addPath(). Reviewed-by: kh1 --- tools/assistant/tools/assistant/helpenginewrapper.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/assistant/tools/assistant/helpenginewrapper.cpp b/tools/assistant/tools/assistant/helpenginewrapper.cpp index e21e95d..41ad633 100644 --- a/tools/assistant/tools/assistant/helpenginewrapper.cpp +++ b/tools/assistant/tools/assistant/helpenginewrapper.cpp @@ -167,6 +167,13 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile) HelpEngineWrapper::~HelpEngineWrapper() { TRACE_OBJ + const QStringList &namespaces = d->m_helpEngine->registeredDocumentations(); + foreach (const QString &nameSpace, namespaces) { + const QString &docFile + = d->m_helpEngine->documentationFileName(nameSpace); + d->m_qchWatcher->removePath(docFile); + } + delete d; } -- cgit v0.12 From e614e3548bbe505c75e8b3a54f44f07522a6ecf5 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 2 Mar 2010 16:41:16 +0100 Subject: Add and use QGLContextPrivate::eglSurfaceForDevice() The QGLContext only stores the EGLSurface for QWidgets & QGLWidgets, other device types like QPixmap & QGLPixelBuffer store the surface themsselves. With this patch it is possible to create a QGLContext on a QPixmap, make it current and render GL to that QPixmap on X11. Reviewed-By: TrustMe --- src/opengl/qgl_egl.cpp | 33 ++++++++++++++++++++++++++++++--- src/opengl/qgl_p.h | 1 + src/opengl/qgl_x11egl.cpp | 2 +- src/opengl/qglpixelbuffer.h | 1 + 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index f1abab8..7bfcf27 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -40,8 +40,14 @@ ****************************************************************************/ #include +#include #include "qgl_p.h" #include "qgl_egl_p.h" +#include "qglpixelbuffer_p.h" + +#ifdef Q_WS_X11 +#include +#endif QT_BEGIN_NAMESPACE @@ -154,12 +160,12 @@ void QGLContext::reset() void QGLContext::makeCurrent() { Q_D(QGLContext); - if (!d->valid || !d->eglContext || d->eglSurface == EGL_NO_SURFACE) { + if (!d->valid || !d->eglContext || d->eglSurfaceForDevice() == EGL_NO_SURFACE) { qWarning("QGLContext::makeCurrent(): Cannot make invalid context current"); return; } - if (d->eglContext->makeCurrent(d->eglSurface)) + if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) QGLContextPrivate::setCurrentContext(this); } @@ -179,7 +185,7 @@ void QGLContext::swapBuffers() const if (!d->valid || !d->eglContext) return; - d->eglContext->swapBuffers(d->eglSurface); + d->eglContext->swapBuffers(d->eglSurfaceForDevice()); } void QGLContextPrivate::destroyEglSurfaceForDevice() @@ -202,6 +208,27 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() } } +EGLSurface QGLContextPrivate::eglSurfaceForDevice() const +{ + if (paintDevice->devType() == QInternal::Widget) + return eglSurface; + if (paintDevice->devType() == QInternal::Pixmap) { +#ifdef Q_WS_X11 + QPixmapData *pmd = static_cast(paintDevice)->data_ptr().data(); + if (pmd->classId() == QPixmapData::X11Class) { + QX11PixmapData* x11PixmapData = static_cast(pmd); + return (EGLSurface)x11PixmapData->gl_surface; + } else +#endif + return eglSurface; + } + if (paintDevice->devType() == QInternal::Pbuffer) { + QGLPixelBuffer* pbuf = static_cast(paintDevice); + return pbuf->d_func()->pbuf; + } + return EGL_NO_SURFACE; +} + void QGLWidget::setMouseTracking(bool enable) { QWidget::setMouseTracking(enable); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index ecd8b43..b828bea 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -356,6 +356,7 @@ public: QEglContext *eglContext; EGLSurface eglSurface; void destroyEglSurfaceForDevice(); + EGLSurface eglSurfaceForDevice() const; #elif defined(Q_WS_X11) || defined(Q_WS_MAC) void* cx; #endif diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index bcde8c4..ba05e72 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -229,7 +229,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface // QPixmap - yes, create the EGLSurface but store it in QX11PixmapData::gl_surface - // QGLPixelBuffer - no, it creates the surface itself + // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf if (devType == QInternal::Widget) { if (d->eglSurface != EGL_NO_SURFACE) diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h index 3304dd8..d9c7e3e 100644 --- a/src/opengl/qglpixelbuffer.h +++ b/src/opengl/qglpixelbuffer.h @@ -112,6 +112,7 @@ private: friend class QGLWindowSurface; friend class QGLPaintDevice; friend class QGLPBufferGLPaintDevice; + friend class QGLContextPrivate; }; QT_END_NAMESPACE -- cgit v0.12 From ffec21e1e0694972592150c600f2970b6f28dbad Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 2 Mar 2010 17:09:49 +0100 Subject: Assistant: Don't warn for non-existing English to English translations. They usually don't exist, so we'd just be adding noise otherwise. Reviewed-by: kh1 --- tools/assistant/tools/assistant/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 77e5e7c..51ea9f9 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -292,7 +292,7 @@ void setupTranslation(const QString &fileName, const QString &dir) QTranslator *translator = new QTranslator(QCoreApplication::instance()); if (translator->load(fileName, dir)) { QCoreApplication::installTranslator(translator); - } else { + } else if (!fileName.endsWith(QLatin1String("en_US"))) { qWarning("Could not load translation file %s in directory %s.", qPrintable(fileName), qPrintable(dir)); } -- cgit v0.12 From 31e1fb9103e6d6657c1153f5c30e149087568042 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 2 Mar 2010 17:15:32 +0100 Subject: make the value of QMAKE_QMAKE somewhat less magic the generators change the value of QMAKE_QMAKE, so it is unwise to "redirect" it to a hidden builtin which is reset each time. in particular, this fixes qmake generating makefiles without an absolute path to qmake itself - the initial quoting of the filename will make the variable "real", so contains() will start working for it. --- qmake/project.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 951ca33..cf1c365 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3136,7 +3136,6 @@ QStringList &QMakeProject::values(const QString &_var, QMap Date: Tue, 2 Mar 2010 17:56:17 +0100 Subject: Fix build of imports * Fix export macro used in webkit * Fix dependencies on declarative/mutlimedia * Copy qmldir files into the build tree --- imports/Qt/multimedia/qmldir | 1 - imports/Qt/widgets/qmldir | 1 - imports/org/webkit/qmldir | 1 - src/declarative/declarative.pro | 28 +- src/declarative/imports/imports.pro | 7 - src/declarative/imports/multimedia/multimedia.cpp | 63 - src/declarative/imports/multimedia/multimedia.pro | 15 - src/declarative/imports/qimportbase.pri | 16 - src/declarative/imports/webkit/plugin.cpp | 66 - .../imports/webkit/qdeclarativewebview.cpp | 1340 -------------------- .../imports/webkit/qdeclarativewebview_p.h | 285 ----- .../imports/webkit/qdeclarativewebview_p_p.h | 151 --- src/declarative/imports/webkit/webkit.pro | 18 - .../imports/widgets/graphicslayouts.cpp | 260 ---- .../imports/widgets/graphicslayouts_p.h | 226 ---- .../imports/widgets/graphicswidgets.cpp | 40 - .../imports/widgets/graphicswidgets_p.h | 68 - src/declarative/imports/widgets/widgets.cpp | 138 -- src/declarative/imports/widgets/widgets.pro | 20 - src/declarative/libdeclarative.pro | 29 - src/imports/imports.pro | 7 + src/imports/multimedia/multimedia.cpp | 63 + src/imports/multimedia/multimedia.pro | 15 + src/imports/multimedia/qmldir | 1 + src/imports/qimportbase.pri | 33 + src/imports/webkit/plugin.cpp | 66 + src/imports/webkit/qdeclarativewebview.cpp | 1340 ++++++++++++++++++++ src/imports/webkit/qdeclarativewebview_p.h | 287 +++++ src/imports/webkit/qdeclarativewebview_p_p.h | 151 +++ src/imports/webkit/qmldir | 1 + src/imports/webkit/webkit.pro | 19 + src/imports/webkit/webkitqmlplugin_export.h | 53 + src/imports/widgets/graphicslayouts.cpp | 260 ++++ src/imports/widgets/graphicslayouts_p.h | 226 ++++ src/imports/widgets/graphicswidgets.cpp | 40 + src/imports/widgets/graphicswidgets_p.h | 68 + src/imports/widgets/qmldir | 1 + src/imports/widgets/widgets.cpp | 138 ++ src/imports/widgets/widgets.pro | 22 + src/src.pro | 6 + 40 files changed, 2823 insertions(+), 2747 deletions(-) delete mode 100644 imports/Qt/multimedia/qmldir delete mode 100644 imports/Qt/widgets/qmldir delete mode 100644 imports/org/webkit/qmldir delete mode 100644 src/declarative/imports/imports.pro delete mode 100644 src/declarative/imports/multimedia/multimedia.cpp delete mode 100644 src/declarative/imports/multimedia/multimedia.pro delete mode 100644 src/declarative/imports/qimportbase.pri delete mode 100644 src/declarative/imports/webkit/plugin.cpp delete mode 100644 src/declarative/imports/webkit/qdeclarativewebview.cpp delete mode 100644 src/declarative/imports/webkit/qdeclarativewebview_p.h delete mode 100644 src/declarative/imports/webkit/qdeclarativewebview_p_p.h delete mode 100644 src/declarative/imports/webkit/webkit.pro delete mode 100644 src/declarative/imports/widgets/graphicslayouts.cpp delete mode 100644 src/declarative/imports/widgets/graphicslayouts_p.h delete mode 100644 src/declarative/imports/widgets/graphicswidgets.cpp delete mode 100644 src/declarative/imports/widgets/graphicswidgets_p.h delete mode 100644 src/declarative/imports/widgets/widgets.cpp delete mode 100644 src/declarative/imports/widgets/widgets.pro delete mode 100644 src/declarative/libdeclarative.pro create mode 100644 src/imports/imports.pro create mode 100644 src/imports/multimedia/multimedia.cpp create mode 100644 src/imports/multimedia/multimedia.pro create mode 100644 src/imports/multimedia/qmldir create mode 100644 src/imports/qimportbase.pri create mode 100644 src/imports/webkit/plugin.cpp create mode 100644 src/imports/webkit/qdeclarativewebview.cpp create mode 100644 src/imports/webkit/qdeclarativewebview_p.h create mode 100644 src/imports/webkit/qdeclarativewebview_p_p.h create mode 100644 src/imports/webkit/qmldir create mode 100644 src/imports/webkit/webkit.pro create mode 100644 src/imports/webkit/webkitqmlplugin_export.h create mode 100644 src/imports/widgets/graphicslayouts.cpp create mode 100644 src/imports/widgets/graphicslayouts_p.h create mode 100644 src/imports/widgets/graphicswidgets.cpp create mode 100644 src/imports/widgets/graphicswidgets_p.h create mode 100644 src/imports/widgets/qmldir create mode 100644 src/imports/widgets/widgets.cpp create mode 100644 src/imports/widgets/widgets.pro diff --git a/imports/Qt/multimedia/qmldir b/imports/Qt/multimedia/qmldir deleted file mode 100644 index 0e6f656..0000000 --- a/imports/Qt/multimedia/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin multimedia diff --git a/imports/Qt/widgets/qmldir b/imports/Qt/widgets/qmldir deleted file mode 100644 index 6f19878..0000000 --- a/imports/Qt/widgets/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin widgets diff --git a/imports/org/webkit/qmldir b/imports/org/webkit/qmldir deleted file mode 100644 index 258aa2c..0000000 --- a/imports/org/webkit/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin webkitqmlplugin diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index a7ec18e..4287e25 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -1,5 +1,29 @@ -TEMPLATE = subdirs +TARGET = QtDeclarative +QPRO_PWD = $$PWD +QT = core gui xml script network +contains(QT_CONFIG, svg): QT += svg +contains(QT_CONFIG, opengl): QT += opengl +DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING +win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 +solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 -SUBDIRS = libdeclarative.pro imports +unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml +exists("qdeclarative_enable_gcov") { + QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors + LIBS += -lgcov +} +include(../qbase.pri) + +#INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$TARGET +#DESTDIR=. + +#modules +include(3rdparty/3rdparty.pri) +include(util/util.pri) +include(graphicsitems/graphicsitems.pri) +include(qml/qml.pri) +include(debugger/debugger.pri) + +symbian:TARGET.UID3=0x2001E623 diff --git a/src/declarative/imports/imports.pro b/src/declarative/imports/imports.pro deleted file mode 100644 index f874644..0000000 --- a/src/declarative/imports/imports.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += widgets - -contains(QT_CONFIG, multimedia): SUBDIRS += multimedia -contains(QT_CONFIG, webkit): SUBDIRS += webkit - diff --git a/src/declarative/imports/multimedia/multimedia.cpp b/src/declarative/imports/multimedia/multimedia.cpp deleted file mode 100644 index 8becbf3..0000000 --- a/src/declarative/imports/multimedia/multimedia.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QMultimediaQmlModule : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - QtMultimedia::qRegisterDeclarativeElements(uri); - } -}; - -QT_END_NAMESPACE - -#include "multimedia.moc" - -Q_EXPORT_PLUGIN2(qmultimediaqmlmodule, QT_PREPEND_NAMESPACE(QMultimediaQmlModule)); - diff --git a/src/declarative/imports/multimedia/multimedia.pro b/src/declarative/imports/multimedia/multimedia.pro deleted file mode 100644 index d601d2e..0000000 --- a/src/declarative/imports/multimedia/multimedia.pro +++ /dev/null @@ -1,15 +0,0 @@ -TARGET = multimedia -include(../qimportbase.pri) - -QT += multimedia declarative - -SOURCES += multimedia.cpp - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia -target.path = $$[QT_INSTALL_IMPORTS]/Qt/multimedia - -qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/multimedia - -INSTALLS += target qmldir - diff --git a/src/declarative/imports/qimportbase.pri b/src/declarative/imports/qimportbase.pri deleted file mode 100644 index 5b0a4e2..0000000 --- a/src/declarative/imports/qimportbase.pri +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin - -win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release -TARGET = $$qtLibraryTarget($$TARGET) -contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols - -include(../../qt_targets.pri) - -wince*:LIBS += $$QMAKE_LIBS_GUI - -symbian: { - TARGET.EPOCALLOWDLLDATA=1 - TARGET.CAPABILITY = All -Tcb - load(armcc_warnings) -} diff --git a/src/declarative/imports/webkit/plugin.cpp b/src/declarative/imports/webkit/plugin.cpp deleted file mode 100644 index 2f6205d..0000000 --- a/src/declarative/imports/webkit/plugin.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include "qdeclarativewebview_p.h" -#include "qdeclarativewebview_p_p.h" - -QT_BEGIN_NAMESPACE - -class WebKitQmlPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit")); - qmlRegisterType(uri,1,0,"WebView"); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" - -Q_EXPORT_PLUGIN2(webkitqmlplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); - diff --git a/src/declarative/imports/webkit/qdeclarativewebview.cpp b/src/declarative/imports/webkit/qdeclarativewebview.cpp deleted file mode 100644 index 733ac86..0000000 --- a/src/declarative/imports/webkit/qdeclarativewebview.cpp +++ /dev/null @@ -1,1340 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativewebview_p.h" -#include "qdeclarativewebview_p_p.h" - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system - -class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeWebView) - -public: - QDeclarativeWebViewPrivate() - : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0), - progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone), - newWindowComponent(0), newWindowParent(0), - pressTime(400), - rendering(true) - { - } - - QUrl url; // page url might be different if it has not loaded yet - QWebPage *page; - - int preferredwidth, preferredheight; - qreal progress; - QDeclarativeWebView::Status status; - QString statusText; - enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; - QUrl pending_url; - QString pending_string; - QByteArray pending_data; - mutable QDeclarativeWebSettings settings; - QDeclarativeComponent *newWindowComponent; - QDeclarativeItem *newWindowParent; - - QBasicTimer pressTimer; - QPoint pressPoint; - int pressTime; // milliseconds before it's a "hold" - - - static void windowObjects_append(QDeclarativeListProperty *prop, QObject *o) { - static_cast(prop->data)->windowObjects.append(o); - static_cast(prop->data)->updateWindowObjects(); - } - - void updateWindowObjects(); - QObjectList windowObjects; - - bool rendering; -}; - -/*! - \qmlclass WebView QDeclarativeWebView - \since 4.7 - \brief The WebView item allows you to add web content to a canvas. - \inherits Item - - A WebView renders web content based on a URL. - - If the width and height of the item is not set, they will - dynamically adjust to a size appropriate for the content. - This width may be large for typical online web pages. - - If the preferredWidth is set, the width will be this amount or larger, - usually laying out the web content to fit the preferredWidth. - - \qml - import org.webkit 1.0 - - WebView { - url: "http://www.nokia.com" - width: 490 - height: 400 - scale: 0.5 - smooth: false - smoothCache: true - } - \endqml - - \image webview.png - - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. -*/ - -/*! - \internal - \class QDeclarativeWebView - \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView. - - A WebView renders web content base on a URL. - - \image webview.png - - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. - - A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView. -*/ - -QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) - : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent) -{ - init(); -} - -QDeclarativeWebView::~QDeclarativeWebView() -{ - Q_D(QDeclarativeWebView); - delete d->page; -} - -void QDeclarativeWebView::init() -{ - Q_D(QDeclarativeWebView); - - QWebSettings::enablePersistentStorage(); - - setAcceptHoverEvents(true); - setAcceptedMouseButtons(Qt::LeftButton); - setFlag(QGraphicsItem::ItemHasNoContents, false); - - d->page = 0; -} - -void QDeclarativeWebView::componentComplete() -{ - QDeclarativePaintedItem::componentComplete(); - Q_D(QDeclarativeWebView); - switch (d->pending) { - case QDeclarativeWebViewPrivate::PendingUrl: - setUrl(d->pending_url); - break; - case QDeclarativeWebViewPrivate::PendingHtml: - setHtml(d->pending_string, d->pending_url); - break; - case QDeclarativeWebViewPrivate::PendingContent: - setContent(d->pending_data, d->pending_string, d->pending_url); - break; - default: - break; - } - d->pending = QDeclarativeWebViewPrivate::PendingNone; - d->updateWindowObjects(); -} - -QDeclarativeWebView::Status QDeclarativeWebView::status() const -{ - Q_D(const QDeclarativeWebView); - return d->status; -} - - -/*! - \qmlproperty real WebView::progress - This property holds the progress of loading the current URL, from 0 to 1. - - If you just want to know when progress gets to 1, use - WebView::onLoadFinished() or WebView::onLoadFailed() instead. -*/ -qreal QDeclarativeWebView::progress() const -{ - Q_D(const QDeclarativeWebView); - return d->progress; -} - -void QDeclarativeWebView::doLoadStarted() -{ - Q_D(QDeclarativeWebView); - - if (!d->url.isEmpty()) { - d->status = Loading; - emit statusChanged(d->status); - } - emit loadStarted(); -} - -void QDeclarativeWebView::doLoadProgress(int p) -{ - Q_D(QDeclarativeWebView); - if (d->progress == p/100.0) - return; - d->progress = p/100.0; - emit progressChanged(); -} - -void QDeclarativeWebView::pageUrlChanged() -{ - Q_D(QDeclarativeWebView); - - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - expandToWebPage(); - - if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) - || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) - { - d->url = page()->mainFrame()->url(); - if (d->url == QUrl(QLatin1String("about:blank"))) - d->url = QUrl(); - emit urlChanged(); - } -} - -void QDeclarativeWebView::doLoadFinished(bool ok) -{ - Q_D(QDeclarativeWebView); - - if (title().isEmpty()) - pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() - - if (ok) { - d->status = d->url.isEmpty() ? Null : Ready; - emit loadFinished(); - } else { - d->status = Error; - emit loadFailed(); - } - emit statusChanged(d->status); -} - -/*! - \qmlproperty url WebView::url - This property holds the URL to the page displayed in this item. It can be set, - but also can change spontaneously (eg. because of network redirection). - - If the url is empty, the page is blank. - - The url is always absolute (QML will resolve relative URL strings in the context - of the containing QML document). -*/ -QUrl QDeclarativeWebView::url() const -{ - Q_D(const QDeclarativeWebView); - return d->url; -} - -void QDeclarativeWebView::setUrl(const QUrl &url) -{ - Q_D(QDeclarativeWebView); - if (url == d->url) - return; - - if (isComponentComplete()) { - d->url = url; - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - QUrl seturl = url; - if (seturl.isEmpty()) - seturl = QUrl(QLatin1String("about:blank")); - - Q_ASSERT(!seturl.isRelative()); - - page()->mainFrame()->load(seturl); - - emit urlChanged(); - } else { - d->pending = d->PendingUrl; - d->pending_url = url; - } -} - -/*! - \qmlproperty int WebView::preferredWidth - This property holds the ideal width for displaying the current URL. -*/ -int QDeclarativeWebView::preferredWidth() const -{ - Q_D(const QDeclarativeWebView); - return d->preferredwidth; -} - -void QDeclarativeWebView::setPreferredWidth(int iw) -{ - Q_D(QDeclarativeWebView); - if (d->preferredwidth == iw) return; - d->preferredwidth = iw; - //expandToWebPage(); - emit preferredWidthChanged(); -} - -/*! - \qmlproperty int WebView::preferredHeight - This property holds the ideal height for displaying the current URL. - This only affects the area zoomed by heuristicZoom(). -*/ -int QDeclarativeWebView::preferredHeight() const -{ - Q_D(const QDeclarativeWebView); - return d->preferredheight; -} -void QDeclarativeWebView::setPreferredHeight(int ih) -{ - Q_D(QDeclarativeWebView); - if (d->preferredheight == ih) return; - d->preferredheight = ih; - emit preferredHeightChanged(); -} - -/*! - \qmlmethod bool WebView::evaluateJavaScript(string) - - Evaluates the \a scriptSource JavaScript inside the context of the - main web frame, and returns the result of the last executed statement. - - Note that this JavaScript does \e not have any access to QML objects - except as made available as windowObjects. -*/ -QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource) -{ - return this->page()->mainFrame()->evaluateJavaScript(scriptSource); -} - -void QDeclarativeWebView::focusChanged(bool hasFocus) -{ - QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); - page()->event(&e); - QDeclarativeItem::focusChanged(hasFocus); -} - -void QDeclarativeWebView::initialLayout() -{ - // nothing useful to do at this point -} - -void QDeclarativeWebView::noteContentsSizeChanged(const QSize&) -{ - expandToWebPage(); -} - -void QDeclarativeWebView::expandToWebPage() -{ - Q_D(QDeclarativeWebView); - QSize cs = page()->mainFrame()->contentsSize(); - if (cs.width() < d->preferredwidth) - cs.setWidth(d->preferredwidth); - if (cs.height() < d->preferredheight) - cs.setHeight(d->preferredheight); - if (widthValid()) - cs.setWidth(width()); - if (heightValid()) - cs.setHeight(height()); - if (cs != page()->viewportSize()) { - page()->setViewportSize(cs); - } - if (cs != contentsSize()) - setContentsSize(cs); -} - -void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) -{ - if (newGeometry.size() != oldGeometry.size()) - expandToWebPage(); - QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); -} - -void QDeclarativeWebView::paintPage(const QRect& r) -{ - dirtyCache(r); - update(); -} - -/*! - \qmlproperty list WebView::javaScriptWindowObjects - - This property is a list of object that are available from within - the webview's JavaScript context. - - The \a object will be inserted as a child of the frame's window - object, under the name given by the attached property \c WebView.windowObjectName. - - \qml - WebView { - javaScriptWindowObjects: Object { - WebView.windowObjectName: "coordinates" - } - } - \endqml - - Properties of the object will be exposed as JavaScript properties and slots as - JavaScript methods. - - If Javascript is not enabled for this page, then this property does nothing. -*/ -QDeclarativeListProperty QDeclarativeWebView::javaScriptWindowObjects() -{ - Q_D(QDeclarativeWebView); - return QDeclarativeListProperty(this, d, &QDeclarativeWebViewPrivate::windowObjects_append); -} - -QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject *o) -{ - return new QDeclarativeWebViewAttached(o); -} - -void QDeclarativeWebViewPrivate::updateWindowObjects() -{ - Q_Q(QDeclarativeWebView); - if (!q->isComponentComplete() || !page) - return; - - for (int ii = 0; ii < windowObjects.count(); ++ii) { - QObject *object = windowObjects.at(ii); - QDeclarativeWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); - if (attached && !attached->windowObjectName().isEmpty()) { - page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); - } - } -} - -bool QDeclarativeWebView::renderingEnabled() const -{ - Q_D(const QDeclarativeWebView); - return d->rendering; -} - -void QDeclarativeWebView::setRenderingEnabled(bool enabled) -{ - Q_D(QDeclarativeWebView); - if (d->rendering == enabled) - return; - d->rendering = enabled; - emit renderingEnabledChanged(); - - setCacheFrozen(!enabled); - if (enabled) - clearCache(); -} - - -void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r) -{ - Q_D(QDeclarativeWebView); - if (d->rendering) - page()->mainFrame()->render(p,r); -} - -QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) -{ - QEvent::Type t; - switch(e->type()) { - default: - case QEvent::GraphicsSceneMousePress: - t = QEvent::MouseButtonPress; - break; - case QEvent::GraphicsSceneMouseRelease: - t = QEvent::MouseButtonRelease; - break; - case QEvent::GraphicsSceneMouseMove: - t = QEvent::MouseMove; - break; - case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick: - t = QEvent::MouseButtonDblClick; - break; - } - - QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), e->button(), e->buttons(), 0); - return me; -} - -QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) -{ - QEvent::Type t = QEvent::MouseMove; - - QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), Qt::NoButton, Qt::NoButton, 0); - - return me; -} - - -/*! - \qmlsignal WebView::onDoubleClick(clickx,clicky) - - The WebView does not pass double-click events to the web engine, but rather - emits this signals. -*/ - -void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -{ - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - emit doubleClick(me->x(),me->y()); - delete me; -} - -/*! - \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) - - Finds a zoom that: - \list - \i shows a whole item - \i includes (\a clickX, \a clickY) - \i fits into the preferredWidth and preferredHeight - \i zooms by no more than \a maxzoom - \i is more than 10% above the current zoom - \endlist - - If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, - no signal is emitted and returns false. -*/ -bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) -{ - Q_D(QDeclarativeWebView); - if (contentsScale() >= maxzoom/zoomFactor()) - return false; - qreal ozf = contentsScale(); - QRect showarea = elementAreaAt(clickX, clickY, d->preferredwidth/maxzoom, d->preferredheight/maxzoom); - qreal z = qMin(qreal(d->preferredwidth)/showarea.width(),qreal(d->preferredheight)/showarea.height()); - if (z > maxzoom/zoomFactor()) - z = maxzoom/zoomFactor(); - if (z/ozf > 1.2) { - QRectF r(showarea.left()*z, showarea.top()*z, showarea.width()*z, showarea.height()*z); - emit zoomTo(z,r.x()+r.width()/2, r.y()+r.height()/2); - return true; - } else { - return false; - } -} - -/*! - \qmlproperty int WebView::pressGrabTime - - The number of milliseconds the user must press before the WebView - starts passing move events through to the web engine (rather than - letting other QML elements such as a Flickable take them). - - Defaults to 400ms. Set to 0 to always grab and pass move events to - the web engine. -*/ -int QDeclarativeWebView::pressGrabTime() const -{ - Q_D(const QDeclarativeWebView); - return d->pressTime; -} - -void QDeclarativeWebView::setPressGrabTime(int ms) -{ - Q_D(QDeclarativeWebView); - if (d->pressTime == ms) - return; - d->pressTime = ms; - emit pressGrabTimeChanged(); -} - -void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - setFocus (true); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - - d->pressPoint = me->pos(); - if (d->pressTime) { - d->pressTimer.start(d->pressTime,this); - setKeepMouseGrab(false); - } else { - grabMouse(); - setKeepMouseGrab(true); - } - - page()->event(me); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit - Might be a bug in WebKit, though - */ -#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) { - QDeclarativePaintedItem::mousePressEvent(event); - } -} - -void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - page()->event(me); - d->pressTimer.stop(); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send all the events to WebKit - */ -#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) { - QDeclarativePaintedItem::mouseReleaseEvent(event); - } - setKeepMouseGrab(false); - ungrabMouse(); -} - -void QDeclarativeWebView::timerEvent(QTimerEvent *event) -{ - Q_D(QDeclarativeWebView); - if (event->timerId() == d->pressTimer.timerId()) { - d->pressTimer.stop(); - grabMouse(); - setKeepMouseGrab(true); - } -} - -void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - Q_D(QDeclarativeWebView); - - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - if (d->pressTimer.isActive()) { - if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { - d->pressTimer.stop(); - } - } - if (keepMouseGrab()) { - page()->event(me); - event->setAccepted( -/* - It is not correct to send the press event upwards, if it is not accepted by WebKit - e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit - Might be a bug in WebKit, though - */ -#if 1 // QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - } - delete me; - if (!event->isAccepted()) - QDeclarativePaintedItem::mouseMoveEvent(event); - -} -void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) -{ - QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); - page()->event(me); - event->setAccepted( -#if QT_VERSION <= 0x040500 // XXX see bug 230835 - true -#else - me->isAccepted() -#endif - ); - delete me; - if (!event->isAccepted()) - QDeclarativePaintedItem::hoverMoveEvent(event); -} - -void QDeclarativeWebView::keyPressEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyPressEvent(event); -} - -void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event) -{ - page()->event(event); - if (!event->isAccepted()) - QDeclarativePaintedItem::keyReleaseEvent(event); -} - -bool QDeclarativeWebView::sceneEvent(QEvent *event) -{ - if (event->type() == QEvent::KeyPress) { - QKeyEvent *k = static_cast(event); - if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { - if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? - page()->event(event); - if (event->isAccepted()) - return true; - } - } - } - return QDeclarativePaintedItem::sceneEvent(event); -} - - -/*! - \qmlproperty action WebView::back - This property holds the action for causing the previous URL in the history to be displayed. -*/ -QAction *QDeclarativeWebView::backAction() const -{ - return page()->action(QWebPage::Back); -} - -/*! - \qmlproperty action WebView::forward - This property holds the action for causing the next URL in the history to be displayed. -*/ -QAction *QDeclarativeWebView::forwardAction() const -{ - return page()->action(QWebPage::Forward); -} - -/*! - \qmlproperty action WebView::reload - This property holds the action for reloading with the current URL -*/ -QAction *QDeclarativeWebView::reloadAction() const -{ - return page()->action(QWebPage::Reload); -} - -/*! - \qmlproperty action WebView::stop - This property holds the action for stopping loading with the current URL -*/ -QAction *QDeclarativeWebView::stopAction() const -{ - return page()->action(QWebPage::Stop); -} - -/*! - \qmlproperty real WebView::title - This property holds the title of the web page currently viewed - - By default, this property contains an empty string. -*/ -QString QDeclarativeWebView::title() const -{ - return page()->mainFrame()->title(); -} - - - -/*! - \qmlproperty pixmap WebView::icon - This property holds the icon associated with the web page currently viewed -*/ -QPixmap QDeclarativeWebView::icon() const -{ - return page()->mainFrame()->icon().pixmap(QSize(256,256)); -} - - -/*! - \qmlproperty real WebView::zoomFactor - This property holds the multiplier used to scale the contents of a Web page. -*/ -void QDeclarativeWebView::setZoomFactor(qreal factor) -{ - Q_D(QDeclarativeWebView); - if (factor == page()->mainFrame()->zoomFactor()) - return; - - page()->mainFrame()->setZoomFactor(factor); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor, - d->preferredheight>0 ? d->preferredheight*factor : height()*factor)); - expandToWebPage(); - - emit zoomFactorChanged(); -} - -qreal QDeclarativeWebView::zoomFactor() const -{ - return page()->mainFrame()->zoomFactor(); -} - -/*! - \qmlproperty string WebView::statusText - - This property is the current status suggested by the current web page. In a web browser, - such status is often shown in some kind of status bar. -*/ -void QDeclarativeWebView::setStatusText(const QString& s) -{ - Q_D(QDeclarativeWebView); - d->statusText = s; - emit statusTextChanged(); -} - -void QDeclarativeWebView::windowObjectCleared() -{ - Q_D(QDeclarativeWebView); - d->updateWindowObjects(); -} - -QString QDeclarativeWebView::statusText() const -{ - Q_D(const QDeclarativeWebView); - return d->statusText; -} - -QWebPage *QDeclarativeWebView::page() const -{ - Q_D(const QDeclarativeWebView); - - if (!d->page) { - QDeclarativeWebView *self = const_cast(this); - QWebPage *wp = new QDeclarativeWebPage(self); - - // QML items don't default to having a background, - // even though most we pages will set one anyway. - QPalette pal = QApplication::palette(); - pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); - wp->setPalette(pal); - - wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); - - self->setPage(wp); - - return wp; - } - - return d->page; -} - - -// The QObject interface to settings(). -/*! - \qmlproperty string WebView::settings.standardFontFamily - \qmlproperty string WebView::settings.fixedFontFamily - \qmlproperty string WebView::settings.serifFontFamily - \qmlproperty string WebView::settings.sansSerifFontFamily - \qmlproperty string WebView::settings.cursiveFontFamily - \qmlproperty string WebView::settings.fantasyFontFamily - - \qmlproperty int WebView::settings.minimumFontSize - \qmlproperty int WebView::settings.minimumLogicalFontSize - \qmlproperty int WebView::settings.defaultFontSize - \qmlproperty int WebView::settings.defaultFixedFontSize - - \qmlproperty bool WebView::settings.autoLoadImages - \qmlproperty bool WebView::settings.javascriptEnabled - \qmlproperty bool WebView::settings.javaEnabled - \qmlproperty bool WebView::settings.pluginsEnabled - \qmlproperty bool WebView::settings.privateBrowsingEnabled - \qmlproperty bool WebView::settings.javascriptCanOpenWindows - \qmlproperty bool WebView::settings.javascriptCanAccessClipboard - \qmlproperty bool WebView::settings.developerExtrasEnabled - \qmlproperty bool WebView::settings.linksIncludedInFocusChain - \qmlproperty bool WebView::settings.zoomTextOnly - \qmlproperty bool WebView::settings.printElementBackgrounds - \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled - \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled - \qmlproperty bool WebView::settings.localStorageDatabaseEnabled - \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls - - These properties give access to the settings controlling the web view. - - See QWebSettings for details of these properties. - - \qml - WebView { - settings.pluginsEnabled: true - settings.standardFontFamily: "Arial" - ... - } - \endqml -*/ -QObject *QDeclarativeWebView::settingsObject() const -{ - Q_D(const QDeclarativeWebView); - d->settings.s = page()->settings(); - return &d->settings; -} - -void QDeclarativeWebView::setPage(QWebPage *page) -{ - Q_D(QDeclarativeWebView); - if (d->page == page) - return; - if (d->page) { - if (d->page->parent() == this) { - delete d->page; - } else { - d->page->disconnect(this); - } - } - d->page = page; - d->page->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff); - d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); - connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); - connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); - connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); - connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); - connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); - connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); - connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); - - connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted())); - connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int))); - connect(d->page,SIGNAL(loadFinished(bool)),this,SLOT(doLoadFinished(bool))); - connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString))); - - connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared())); -} - -/*! - \qmlsignal WebView::onLoadStarted() - - This handler is called when the web engine begins loading - a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() - will be emitted. -*/ - -/*! - \qmlsignal WebView::onLoadFinished() - - This handler is called when the web engine \e successfully - finishes loading a page, including any component content - (WebView::onLoadFailed() will be emitted otherwise). - - \sa progress -*/ - -/*! - \qmlsignal WebView::onLoadFailed() - - This handler is called when the web engine fails loading - a page or any component content - (WebView::onLoadFinished() will be emitted on success). -*/ - -void QDeclarativeWebView::load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation, - const QByteArray &body) -{ - page()->mainFrame()->load(request, operation, body); -} - -QString QDeclarativeWebView::html() const -{ - return page()->mainFrame()->toHtml(); -} - -/*! - \qmlproperty string WebView::html - This property holds HTML text set directly - - The html property can be set as a string. - - \qml - WebView { - html: "

This is HTML." - } - \endqml -*/ -void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) -{ - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - if (isComponentComplete()) - page()->mainFrame()->setHtml(html, baseUrl); - else { - d->pending = d->PendingHtml; - d->pending_url = baseUrl; - d->pending_string = html; - } - emit htmlChanged(); -} - -void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) -{ - Q_D(QDeclarativeWebView); - page()->setViewportSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - - if (isComponentComplete()) - page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); - else { - d->pending = d->PendingContent; - d->pending_url = baseUrl; - d->pending_string = mimeType; - d->pending_data = data; - } -} - -QWebHistory *QDeclarativeWebView::history() const -{ - return page()->history(); -} - -QWebSettings *QDeclarativeWebView::settings() const -{ - return page()->settings(); -} - -QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) -{ - Q_D(QDeclarativeWebView); - switch (type) { - case QWebPage::WebBrowserWindow: { - if (!d->newWindowComponent && d->newWindowParent) - qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored"); - else if (d->newWindowComponent && !d->newWindowParent) - qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); - else if (d->newWindowComponent && d->newWindowParent) { - QDeclarativeWebView *webview = 0; - QDeclarativeContext *windowContext = new QDeclarativeContext(qmlContext(this)); - - QObject *nobj = d->newWindowComponent->create(windowContext); - if (nobj) { - windowContext->setParent(nobj); - QDeclarativeItem *item = qobject_cast(nobj); - if (!item) { - delete nobj; - } else { - webview = item->findChild(); - if (!webview) { - delete item; - } else { - nobj->setParent(d->newWindowParent); - static_cast(item)->setParentItem(d->newWindowParent); - } - } - } else { - delete windowContext; - } - - return webview; - } - } - break; - case QWebPage::WebModalDialog: { - // Not supported - } - } - return 0; -} - -/*! - \qmlproperty component WebView::newWindowComponent - - This property holds the component to use for new windows. - The component must have a WebView somewhere in its structure. - - When the web engine requests a new window, it will be an instance of - this component. - - The parent of the new window is set by newWindowParent. It must be set. -*/ -QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const -{ - Q_D(const QDeclarativeWebView); - return d->newWindowComponent; -} - -void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow) -{ - Q_D(QDeclarativeWebView); - if (newWindow == d->newWindowComponent) - return; - d->newWindowComponent = newWindow; - emit newWindowComponentChanged(); -} - - -/*! - \qmlproperty item WebView::newWindowParent - - The parent item for new windows. - - \sa newWindowComponent -*/ -QDeclarativeItem *QDeclarativeWebView::newWindowParent() const -{ - Q_D(const QDeclarativeWebView); - return d->newWindowParent; -} - -void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) -{ - Q_D(QDeclarativeWebView); - if (parent == d->newWindowParent) - return; - if (d->newWindowParent && parent) { - QList children = d->newWindowParent->childItems(); - for (int i = 0; i < children.count(); ++i) { - children.at(i)->setParentItem(parent); - } - } - d->newWindowParent = parent; - emit newWindowParentChanged(); -} - -/*! - Returns the area of the largest element at position (\a x,\a y) that is no larger - than \a maxwidth by \a maxheight pixels. - - May return an area larger in the case when no smaller element is at the position. -*/ -QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const -{ - QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y)); - QRect rv = hit.boundingRect(); - QWebElement element = hit.enclosingBlockElement(); - if (maxwidth<=0) maxwidth = INT_MAX; - if (maxheight<=0) maxheight = INT_MAX; - while (!element.parent().isNull() && element.geometry().width() <= maxwidth && element.geometry().height() <= maxheight) { - rv = element.geometry(); - element = element.parent(); - } - return rv; -} - -/*! - \internal - \class QDeclarativeWebPage - \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins. - - \sa QDeclarativeWebView -*/ -QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView *parent) : - QWebPage(parent) -{ -} - -QDeclarativeWebPage::~QDeclarativeWebPage() -{ -} - -void QDeclarativeWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) -{ - qWarning() << sourceID << ':' << lineNumber << ':' << message; -} - -QString QDeclarativeWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(oldFile) - return oldFile; -} - -void QDeclarativeWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) -{ - Q_UNUSED(originatingFrame) - emit viewItem()->alert(msg); -} - -bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - return false; -} - -bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - Q_UNUSED(defaultValue) - Q_UNUSED(result) - return false; -} - - -/* - Qt WebKit does not understand non-QWidget plugins, so dummy widgets - are created, parented to a single dummy tool window. - - The requirements for QML object plugins are input to the Qt WebKit - non-QWidget plugin support, which will obsolete this kludge. -*/ -class QWidget_Dummy_Plugin : public QWidget -{ - Q_OBJECT -public: - static QWidget *dummy_shared_parent() - { - static QWidget *dsp = 0; - if (!dsp) { - dsp = new QWidget(0,Qt::Tool); - dsp->setGeometry(-10000,-10000,0,0); - dsp->show(); - } - return dsp; - } - QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : - QWidget(dummy_shared_parent()), - propertyNames(paramNames), - propertyValues(paramValues), - webview(view) - { - QDeclarativeEngine *engine = qmlEngine(webview); - component = new QDeclarativeComponent(engine, url, this); - item = 0; - if (component->isLoading()) - connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded())); - else - qmlLoaded(); - } - -public Q_SLOTS: - void qmlLoaded() - { - if (component->isError()) { - // ### Could instead give these errors to the WebView to handle. - qWarning() << component->errors(); - return; - } - item = qobject_cast(component->create(qmlContext(webview))); - item->setParent(webview); - QString jsObjName; - for (int i=0; isetProperty(propertyNames[i].toUtf8(),propertyValues[i]); - if (propertyNames[i] == QLatin1String("objectname")) - jsObjName = propertyValues[i]; - } - } - if (!jsObjName.isNull()) { - QWebFrame *f = webview->page()->mainFrame(); - f->addToJavaScriptWindowObject(jsObjName, item); - } - resizeEvent(0); - delete component; - component = 0; - } - void resizeEvent(QResizeEvent*) - { - if (item) { - item->setX(x()); - item->setY(y()); - item->setWidth(width()); - item->setHeight(height()); - } - } - -private: - QDeclarativeComponent *component; - QDeclarativeItem *item; - QStringList propertyNames, propertyValues; - QDeclarativeWebView *webview; -}; - -QDeclarativeWebView *QDeclarativeWebPage::viewItem() -{ - return static_cast(parent()); -} - -QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) -{ - QUrl comp = qmlContext(viewItem())->resolvedUrl(url); - return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); -} - -QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) -{ - QDeclarativeWebView *newView = viewItem()->createWindow(type); - if (newView) - return newView->page(); - return 0; -} - -QT_END_NAMESPACE - -#include diff --git a/src/declarative/imports/webkit/qdeclarativewebview_p.h b/src/declarative/imports/webkit/qdeclarativewebview_p.h deleted file mode 100644 index 0bb5d29..0000000 --- a/src/declarative/imports/webkit/qdeclarativewebview_p.h +++ /dev/null @@ -1,285 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEWEBVIEW_H -#define QDECLARATIVEWEBVIEW_H - -#include - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -class QWebHistory; -class QWebSettings; - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QDeclarativeWebViewPrivate; -class QNetworkRequest; -class QDeclarativeWebView; - -class Q_DECLARATIVE_EXPORT QDeclarativeWebPage : public QWebPage -{ - Q_OBJECT -public: - explicit QDeclarativeWebPage(QDeclarativeWebView *parent); - ~QDeclarativeWebPage(); -protected: - QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); - QWebPage *createWindow(WebWindowType type); - void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); - QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); - void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); - -private: - QDeclarativeWebView *viewItem(); -}; - - -class QDeclarativeWebViewAttached; - -//### TODO: browser plugins - -class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem -{ - Q_OBJECT - - Q_ENUMS(Status SelectionMode) - - Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) - Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) - Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) - - Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) - - Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged) - - Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) - Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - - Q_PROPERTY(QAction* reload READ reloadAction CONSTANT) - Q_PROPERTY(QAction* back READ backAction CONSTANT) - Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) - Q_PROPERTY(QAction* stop READ stopAction CONSTANT) - - Q_PROPERTY(QObject* settings READ settingsObject CONSTANT) - - Q_PROPERTY(QDeclarativeListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) - - Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) - Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) - - Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) - -public: - QDeclarativeWebView(QDeclarativeItem *parent=0); - ~QDeclarativeWebView(); - - QUrl url() const; - void setUrl(const QUrl &); - - QString title() const; - - QPixmap icon() const; - - qreal zoomFactor() const; - void setZoomFactor(qreal); - Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); - QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; - - int pressGrabTime() const; - void setPressGrabTime(int); - - int preferredWidth() const; - void setPreferredWidth(int); - int preferredHeight() const; - void setPreferredHeight(int); - - enum Status { Null, Ready, Loading, Error }; - Status status() const; - qreal progress() const; - QString statusText() const; - - QAction *reloadAction() const; - QAction *backAction() const; - QAction *forwardAction() const; - QAction *stopAction() const; - - QWebPage *page() const; - void setPage(QWebPage *page); - - void load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, - const QByteArray &body = QByteArray()); - - QString html() const; - - void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); - void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); - - QWebHistory *history() const; - QWebSettings *settings() const; - QObject *settingsObject() const; - - bool renderingEnabled() const; - void setRenderingEnabled(bool); - - QDeclarativeListProperty javaScriptWindowObjects(); - - static QDeclarativeWebViewAttached *qmlAttachedProperties(QObject *); - - QDeclarativeComponent *newWindowComponent() const; - void setNewWindowComponent(QDeclarativeComponent *newWindow); - QDeclarativeItem *newWindowParent() const; - void setNewWindowParent(QDeclarativeItem *newWindow); - -Q_SIGNALS: - void preferredWidthChanged(); - void preferredHeightChanged(); - void urlChanged(); - void progressChanged(); - void statusChanged(Status); - void titleChanged(const QString&); - void iconChanged(); - void statusTextChanged(); - void htmlChanged(); - void pressGrabTimeChanged(); - void zoomFactorChanged(); - void newWindowComponentChanged(); - void newWindowParentChanged(); - void renderingEnabledChanged(); - - void loadStarted(); - void loadFinished(); - void loadFailed(); - - void doubleClick(int clickX, int clickY); - - void zoomTo(qreal zoom, int centerX, int centerY); - - void alert(const QString& message); - -public Q_SLOTS: - QVariant evaluateJavaScript(const QString&); - -private Q_SLOTS: - void expandToWebPage(); - void paintPage(const QRect&); - void doLoadStarted(); - void doLoadProgress(int p); - void doLoadFinished(bool ok); - void setStatusText(const QString&); - void windowObjectCleared(); - void pageUrlChanged(); - void noteContentsSizeChanged(const QSize&); - void initialLayout(); - -protected: - void drawContents(QPainter *, const QRect &); - - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void timerEvent(QTimerEvent *event); - void hoverMoveEvent (QGraphicsSceneHoverEvent * event); - void keyPressEvent(QKeyEvent* event); - void keyReleaseEvent(QKeyEvent* event); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - virtual void focusChanged(bool); - virtual bool sceneEvent(QEvent *event); - QDeclarativeWebView *createWindow(QWebPage::WebWindowType type); - -private: - void init(); - virtual void componentComplete(); - Q_DISABLE_COPY(QDeclarativeWebView) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView) - QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *); - QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *); - friend class QDeclarativeWebPage; -}; - -class QDeclarativeWebViewAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) -public: - QDeclarativeWebViewAttached(QObject *parent) - : QObject(parent) - { - } - - QString windowObjectName() const - { - return m_windowObjectName; - } - - void setWindowObjectName(const QString &n) - { - m_windowObjectName = n; - } - -private: - QString m_windowObjectName; -}; - - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeWebView) -QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES) - -QT_END_HEADER - -#endif diff --git a/src/declarative/imports/webkit/qdeclarativewebview_p_p.h b/src/declarative/imports/webkit/qdeclarativewebview_p_p.h deleted file mode 100644 index 258b472..0000000 --- a/src/declarative/imports/webkit/qdeclarativewebview_p_p.h +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEWEBVIEW_P_H -#define QDECLARATIVEWEBVIEW_P_H - -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeWebSettings : public QObject { - Q_OBJECT - - Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) - Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) - Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) - Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) - Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) - Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) - - Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) - Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) - Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) - Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) - - Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) - Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) - Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) - Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) - Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) - Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) - Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) - Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) - Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) - Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) - Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) - Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) - Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) - Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) - Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) - -public: - QDeclarativeWebSettings() {} - - QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } - void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } - QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } - void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } - QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } - void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } - QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } - void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } - QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } - void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } - QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } - void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } - - int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } - void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } - int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } - void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } - int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } - void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } - int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } - void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } - - bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } - void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } - bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } - void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } - bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } - void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } - bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } - void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } - bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } - void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } - bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } - void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } - bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } - void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } - bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } - void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } - bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } - void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } - bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } - void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } - bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } - void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } - bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } - void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } - bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } - void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } - bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } - void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } - bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } - void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } - - QWebSettings *s; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeWebSettings) - -QT_END_HEADER - -#endif diff --git a/src/declarative/imports/webkit/webkit.pro b/src/declarative/imports/webkit/webkit.pro deleted file mode 100644 index 7ad8564..0000000 --- a/src/declarative/imports/webkit/webkit.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = webkitqmlplugin -include(../qimportbase.pri) - -contains(QT_CONFIG, webkit) { - QT += webkit declarative - - SOURCES += qdeclarativewebview.cpp plugin.cpp - HEADERS += qdeclarativewebview_p.h - HEADERS += qdeclarativewebview_p_p.h - - QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/org/webkit - target.path = $$[QT_INSTALL_IMPORTS]/org/webkit - - qmldir.files += $$QT_BUILD_TREE/imports/org/webkit/qmldir - qmldir.path += $$[QT_INSTALL_IMPORTS]/org/webkit - - INSTALLS += target qmldir -} diff --git a/src/declarative/imports/widgets/graphicslayouts.cpp b/src/declarative/imports/widgets/graphicslayouts.cpp deleted file mode 100644 index fc15ad2..0000000 --- a/src/declarative/imports/widgets/graphicslayouts.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "graphicslayouts_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -LinearLayoutAttached::LinearLayoutAttached(QObject *parent) -: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter) -{ -} - -void LinearLayoutAttached::setStretchFactor(int f) -{ - if (_stretch == f) - return; - - _stretch = f; - emit stretchChanged(reinterpret_cast(parent()), _stretch); -} - -void LinearLayoutAttached::setAlignment(Qt::Alignment a) -{ - if (_alignment == a) - return; - - _alignment = a; - emit alignmentChanged(reinterpret_cast(parent()), _alignment); -} - -QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent) - : QObject(parent) -{ -} - -QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const -{ -Q_UNUSED(which); -Q_UNUSED(constraint); -return QSizeF(); -} - - -QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent) -: QObject(parent) -{ -} - -QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject() -{ -} - -void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item) -{ -insertItem(index, item); - -//connect attached properties -if (LinearLayoutAttached *obj = attachedProperties.value(item)) { - setStretchFactor(item, obj->stretchFactor()); - setAlignment(item, obj->alignment()); - QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)), - this, SLOT(updateStretch(QGraphicsLayoutItem*,int))); - QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)), - this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment))); - //### need to disconnect when widget is removed? -} -} - -//### is there a better way to do this? -void QGraphicsLinearLayoutObject::clearChildren() -{ -for (int i = 0; i < count(); ++i) - removeAt(i); -} - -void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch) -{ -QGraphicsLinearLayout::setStretchFactor(item, stretch); -} - -void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment) -{ -QGraphicsLinearLayout::setAlignment(item, alignment); -} - -QHash QGraphicsLinearLayoutObject::attachedProperties; -LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj) -{ -// ### This is not allowed - you must attach to any object -if (!qobject_cast(obj)) - return 0; -LinearLayoutAttached *rv = new LinearLayoutAttached(obj); -attachedProperties.insert(qobject_cast(obj), rv); -return rv; -} - -////////////////////////////////////////////////////////////////////////////////////////////////////// -// QGraphicsGridLayout-related classes -////////////////////////////////////////////////////////////////////////////////////////////////////// -GridLayoutAttached::GridLayoutAttached(QObject *parent) -: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1) -{ -} - -void GridLayoutAttached::setRow(int r) -{ - if (_row == r) - return; - - _row = r; - //emit rowChanged(reinterpret_cast(parent()), _row); -} - -void GridLayoutAttached::setColumn(int c) -{ - if (_column == c) - return; - - _column = c; - //emit columnChanged(reinterpret_cast(parent()), _column); -} - -void GridLayoutAttached::setRowSpan(int rs) -{ - if (_rowspan == rs) - return; - - _rowspan = rs; - //emit rowSpanChanged(reinterpret_cast(parent()), _rowSpan); -} - -void GridLayoutAttached::setColumnSpan(int cs) -{ - if (_colspan == cs) - return; - - _colspan = cs; - //emit columnSpanChanged(reinterpret_cast(parent()), _columnSpan); -} - -void GridLayoutAttached::setAlignment(Qt::Alignment a) -{ - if (_alignment == a) - return; - - _alignment = a; - //emit alignmentChanged(reinterpret_cast(parent()), _alignment); -} - -QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent) -: QObject(parent) -{ -} - -QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject() -{ -} - -void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid) -{ -//use attached properties -if (QObject *obj = attachedProperties.value(qobject_cast(wid))) { - int row = static_cast(obj)->row(); - int column = static_cast(obj)->column(); - int rowSpan = static_cast(obj)->rowSpan(); - int columnSpan = static_cast(obj)->columnSpan(); - if (row == -1 || column == -1) { - qWarning() << "Must set row and column for an item in a grid layout"; - return; - } - addItem(wid, row, column, rowSpan, columnSpan); -} -} - -void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item) -{ -//use attached properties -if (GridLayoutAttached *obj = attachedProperties.value(item)) { - int row = obj->row(); - int column = obj->column(); - int rowSpan = obj->rowSpan(); - int columnSpan = obj->columnSpan(); - Qt::Alignment alignment = obj->alignment(); - if (row == -1 || column == -1) { - qWarning() << "Must set row and column for an item in a grid layout"; - return; - } - addItem(item, row, column, rowSpan, columnSpan); - if (alignment != -1) - setAlignment(item,alignment); -} -} - -//### is there a better way to do this? -void QGraphicsGridLayoutObject::clearChildren() -{ -for (int i = 0; i < count(); ++i) - removeAt(i); -} - -qreal QGraphicsGridLayoutObject::spacing() const -{ -if (verticalSpacing() == horizontalSpacing()) - return verticalSpacing(); -return -1; //### -} - -QHash QGraphicsGridLayoutObject::attachedProperties; -GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj) -{ -// ### This is not allowed - you must attach to any object -if (!qobject_cast(obj)) - return 0; -GridLayoutAttached *rv = new GridLayoutAttached(obj); -attachedProperties.insert(qobject_cast(obj), rv); -return rv; -} - -QT_END_NAMESPACE diff --git a/src/declarative/imports/widgets/graphicslayouts_p.h b/src/declarative/imports/widgets/graphicslayouts_p.h deleted file mode 100644 index f9b9ae8..0000000 --- a/src/declarative/imports/widgets/graphicslayouts_p.h +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GRAPHICSLAYOUTS_H -#define GRAPHICSLAYOUTS_H - -#include "graphicswidgets_p.h" - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem -{ - Q_OBJECT - Q_INTERFACES(QGraphicsLayoutItem) -public: - QGraphicsLinearLayoutStretchItemObject(QObject *parent = 0); - - virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const; -}; - -class LinearLayoutAttached; -class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout -{ - Q_OBJECT - Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) - Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsLinearLayoutObject(QObject * = 0); - ~QGraphicsLinearLayoutObject(); - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } - - static LinearLayoutAttached *qmlAttachedProperties(QObject *); - -private Q_SLOTS: - void updateStretch(QGraphicsLayoutItem*,int); - void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment); - -private: - friend class LinearLayoutAttached; - void clearChildren(); - void insertLayoutItem(int, QGraphicsLayoutItem *); - static QHash attachedProperties; - - static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { - static_cast(prop->object)->insertLayoutItem(-1, item); - } - - static void children_clear(QDeclarativeListProperty *prop) { - static_cast(prop->object)->clearChildren(); - } - - static int children_count(QDeclarativeListProperty *prop) { - return static_cast(prop->object)->count(); - } - - static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { - return static_cast(prop->object)->itemAt(index); - } -}; - -class GridLayoutAttached; -class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout -{ - Q_OBJECT - Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) - Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) - Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsGridLayoutObject(QObject * = 0); - ~QGraphicsGridLayoutObject(); - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } - - qreal spacing() const; - - static GridLayoutAttached *qmlAttachedProperties(QObject *); - -private: - friend class GraphicsLayoutAttached; - void addWidget(QGraphicsWidget *); - void clearChildren(); - void addLayoutItem(QGraphicsLayoutItem *); - static QHash attachedProperties; - - static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { - static_cast(prop->object)->addLayoutItem(item); - } - - static void children_clear(QDeclarativeListProperty *prop) { - static_cast(prop->object)->clearChildren(); - } - - static int children_count(QDeclarativeListProperty *prop) { - return static_cast(prop->object)->count(); - } - - static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { - return static_cast(prop->object)->itemAt(index); - } -}; - -class LinearLayoutAttached : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged) - Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) -public: - LinearLayoutAttached(QObject *parent); - - int stretchFactor() const { return _stretch; } - void setStretchFactor(int f); - Qt::Alignment alignment() const { return _alignment; } - void setAlignment(Qt::Alignment a); - -Q_SIGNALS: - void stretchChanged(QGraphicsLayoutItem*,int); - void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment); - -private: - int _stretch; - Qt::Alignment _alignment; -}; - -class GridLayoutAttached : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int row READ row WRITE setRow) - Q_PROPERTY(int column READ column WRITE setColumn) - Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan) - Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan) - Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) -public: - GridLayoutAttached(QObject *parent); - - int row() const { return _row; } - void setRow(int r); - - int column() const { return _column; } - void setColumn(int c); - - int rowSpan() const { return _rowspan; } - void setRowSpan(int rs); - - int columnSpan() const { return _colspan; } - void setColumnSpan(int cs); - - Qt::Alignment alignment() const { return _alignment; } - void setAlignment(Qt::Alignment a); - -private: - int _row; - int _column; - int _rowspan; - int _colspan; - Qt::Alignment _alignment; -}; - -QT_END_NAMESPACE - -QML_DECLARE_INTERFACE(QGraphicsLayoutItem) -QML_DECLARE_INTERFACE(QGraphicsLayout) -QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject) -QML_DECLARE_TYPE(QGraphicsLinearLayoutObject) -QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES) -QML_DECLARE_TYPE(QGraphicsGridLayoutObject) -QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES) - -QT_END_HEADER - -#endif // GRAPHICSLAYOUTS_H diff --git a/src/declarative/imports/widgets/graphicswidgets.cpp b/src/declarative/imports/widgets/graphicswidgets.cpp deleted file mode 100644 index 062e516..0000000 --- a/src/declarative/imports/widgets/graphicswidgets.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ diff --git a/src/declarative/imports/widgets/graphicswidgets_p.h b/src/declarative/imports/widgets/graphicswidgets_p.h deleted file mode 100644 index 2c2b707..0000000 --- a/src/declarative/imports/widgets/graphicswidgets_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GRAPHICSWIDGETS_H -#define GRAPHICSWIDGETS_H - -#include - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QGraphicsView) -QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene) -QML_DECLARE_TYPE(QGraphicsWidget) -QML_DECLARE_TYPE(QGraphicsObject) -QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem) - -QT_END_HEADER - -#endif // GRAPHICSWIDGETS_H diff --git a/src/declarative/imports/widgets/widgets.cpp b/src/declarative/imports/widgets/widgets.cpp deleted file mode 100644 index ec21cc4..0000000 --- a/src/declarative/imports/widgets/widgets.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include "graphicslayouts_p.h" -#include "graphicswidgets_p.h" - -QT_BEGIN_NAMESPACE - -class QGraphicsViewDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene) - Q_CLASSINFO("DefaultProperty", "scene") -public: - QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {} - - QGraphicsScene *scene() const { return static_cast(parent())->scene(); } - void setScene(QGraphicsScene *scene) - { - static_cast(parent())->setScene(scene); - } -}; - -class QGraphicsSceneDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this->parent(), 0, children_append); } - -private: - static void children_append(QDeclarativeListProperty *prop, QObject *o) { - if (QGraphicsObject *go = qobject_cast(o)) - static_cast(prop->object)->addItem(go); - } -}; - -class QGraphicsWidgetDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append); } - - QGraphicsLayout *layout() const { return static_cast(parent())->layout(); } - void setLayout(QGraphicsLayout *lo) - { - static_cast(parent())->setLayout(lo); - } - -private: - void setItemParent(QGraphicsItem *wid) - { - wid->setParentItem(static_cast(parent())); - } - - static void children_append(QDeclarativeListProperty *prop, QGraphicsItem *i) { - static_cast(prop->object)->setItemParent(i); - } -}; - -class QWidgetsQmlModule : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets")); - - QML_REGISTER_INTERFACE(QGraphicsLayoutItem); - QML_REGISTER_INTERFACE(QGraphicsLayout); - qmlRegisterType(uri,4,6,"QGraphicsLinearLayoutStretchItem"); - qmlRegisterType(uri,4,6,"QGraphicsLinearLayout"); - qmlRegisterType(uri,4,6,"QGraphicsGridLayout"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsView"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsScene"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsWidget"); - QML_REGISTER_INTERFACE(QGraphicsItem); - } -}; - -QT_END_NAMESPACE - -#include "widgets.moc" - -Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule)); - diff --git a/src/declarative/imports/widgets/widgets.pro b/src/declarative/imports/widgets/widgets.pro deleted file mode 100644 index 230d398..0000000 --- a/src/declarative/imports/widgets/widgets.pro +++ /dev/null @@ -1,20 +0,0 @@ -TARGET = widgets -include(../qimportbase.pri) - -QT += declarative - -SOURCES += \ - graphicslayouts.cpp \ - widgets.cpp - -HEADERS += \ - graphicswidgets_p.h \ - graphicslayouts_p.h - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/widgets -target.path = $$[QT_INSTALL_IMPORTS]/Qt/widgets - -qmldir.files += $$QT_BUILD_TREE/imports/Qt/widgets/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/widgets - -INSTALLS += target qmldir diff --git a/src/declarative/libdeclarative.pro b/src/declarative/libdeclarative.pro deleted file mode 100644 index 4287e25..0000000 --- a/src/declarative/libdeclarative.pro +++ /dev/null @@ -1,29 +0,0 @@ -TARGET = QtDeclarative -QPRO_PWD = $$PWD -QT = core gui xml script network -contains(QT_CONFIG, svg): QT += svg -contains(QT_CONFIG, opengl): QT += opengl -DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING -win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 -solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 - -unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml - -exists("qdeclarative_enable_gcov") { - QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors - LIBS += -lgcov -} - -include(../qbase.pri) - -#INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$TARGET -#DESTDIR=. - -#modules -include(3rdparty/3rdparty.pri) -include(util/util.pri) -include(graphicsitems/graphicsitems.pri) -include(qml/qml.pri) -include(debugger/debugger.pri) - -symbian:TARGET.UID3=0x2001E623 diff --git a/src/imports/imports.pro b/src/imports/imports.pro new file mode 100644 index 0000000..8b47043 --- /dev/null +++ b/src/imports/imports.pro @@ -0,0 +1,7 @@ +TEMPLATE = subdirs + +SUBDIRS += widgets + +contains(QT_CONFIG, webkit): SUBDIRS += webkit +contains(QT_CONFIG, multimedia): SUBDIRS += multimedia + diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp new file mode 100644 index 0000000..8becbf3 --- /dev/null +++ b/src/imports/multimedia/multimedia.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QMultimediaQmlModule : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + QtMultimedia::qRegisterDeclarativeElements(uri); + } +}; + +QT_END_NAMESPACE + +#include "multimedia.moc" + +Q_EXPORT_PLUGIN2(qmultimediaqmlmodule, QT_PREPEND_NAMESPACE(QMultimediaQmlModule)); + diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro new file mode 100644 index 0000000..ad2ce1b --- /dev/null +++ b/src/imports/multimedia/multimedia.pro @@ -0,0 +1,15 @@ +TARGET = multimedia +TARGETPATH = $$[QT_INSTALL_IMPORTS]/Qt/multimedia +include(../qimportbase.pri) + +QT += multimedia declarative + +SOURCES += multimedia.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia +target.path = $$TARGETPATH + +qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir +qmldir.path += $$TARGETPATH + +INSTALLS += target qmldir diff --git a/src/imports/multimedia/qmldir b/src/imports/multimedia/qmldir new file mode 100644 index 0000000..0e6f656 --- /dev/null +++ b/src/imports/multimedia/qmldir @@ -0,0 +1 @@ +plugin multimedia diff --git a/src/imports/qimportbase.pri b/src/imports/qimportbase.pri new file mode 100644 index 0000000..363dd88 --- /dev/null +++ b/src/imports/qimportbase.pri @@ -0,0 +1,33 @@ +TEMPLATE = lib +CONFIG += qt plugin + +win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release + +isEmpty(TARGETPATH) { + error("qimportbase.pri: You must provide a TARGETPATH!") +} +isEmpty(TARGET) { + error("qimportbase.pri: You must provide a TARGET!") +} + +QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir +copy2build.input = QMLDIRFILE +copy2build.output = $$TARGETPATH/qmldir +isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS +copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} +copy2build.name = COPY ${QMAKE_FILE_IN} +copy2build.CONFIG += no_link +QMAKE_EXTRA_COMPILERS += copy2build + +TARGET = $$qtLibraryTarget($$TARGET) +contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols + +include(../../qt_targets.pri) + +wince*:LIBS += $$QMAKE_LIBS_GUI + +symbian: { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = All -Tcb + load(armcc_warnings) +} diff --git a/src/imports/webkit/plugin.cpp b/src/imports/webkit/plugin.cpp new file mode 100644 index 0000000..2f6205d --- /dev/null +++ b/src/imports/webkit/plugin.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "qdeclarativewebview_p.h" +#include "qdeclarativewebview_p_p.h" + +QT_BEGIN_NAMESPACE + +class WebKitQmlPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit")); + qmlRegisterType(uri,1,0,"WebView"); + } +}; + +QT_END_NAMESPACE + +#include "plugin.moc" + +Q_EXPORT_PLUGIN2(webkitqmlplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); + diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp new file mode 100644 index 0000000..733ac86 --- /dev/null +++ b/src/imports/webkit/qdeclarativewebview.cpp @@ -0,0 +1,1340 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativewebview_p.h" +#include "qdeclarativewebview_p_p.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system + +class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeWebView) + +public: + QDeclarativeWebViewPrivate() + : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0), + progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone), + newWindowComponent(0), newWindowParent(0), + pressTime(400), + rendering(true) + { + } + + QUrl url; // page url might be different if it has not loaded yet + QWebPage *page; + + int preferredwidth, preferredheight; + qreal progress; + QDeclarativeWebView::Status status; + QString statusText; + enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; + QUrl pending_url; + QString pending_string; + QByteArray pending_data; + mutable QDeclarativeWebSettings settings; + QDeclarativeComponent *newWindowComponent; + QDeclarativeItem *newWindowParent; + + QBasicTimer pressTimer; + QPoint pressPoint; + int pressTime; // milliseconds before it's a "hold" + + + static void windowObjects_append(QDeclarativeListProperty *prop, QObject *o) { + static_cast(prop->data)->windowObjects.append(o); + static_cast(prop->data)->updateWindowObjects(); + } + + void updateWindowObjects(); + QObjectList windowObjects; + + bool rendering; +}; + +/*! + \qmlclass WebView QDeclarativeWebView + \since 4.7 + \brief The WebView item allows you to add web content to a canvas. + \inherits Item + + A WebView renders web content based on a URL. + + If the width and height of the item is not set, they will + dynamically adjust to a size appropriate for the content. + This width may be large for typical online web pages. + + If the preferredWidth is set, the width will be this amount or larger, + usually laying out the web content to fit the preferredWidth. + + \qml + import org.webkit 1.0 + + WebView { + url: "http://www.nokia.com" + width: 490 + height: 400 + scale: 0.5 + smooth: false + smoothCache: true + } + \endqml + + \image webview.png + + The item includes no scrolling, scaling, + toolbars, etc., those must be implemented around WebView. See the WebBrowser example + for a demonstration of this. +*/ + +/*! + \internal + \class QDeclarativeWebView + \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView. + + A WebView renders web content base on a URL. + + \image webview.png + + The item includes no scrolling, scaling, + toolbars, etc., those must be implemented around WebView. See the WebBrowser example + for a demonstration of this. + + A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView. +*/ + +QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) + : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent) +{ + init(); +} + +QDeclarativeWebView::~QDeclarativeWebView() +{ + Q_D(QDeclarativeWebView); + delete d->page; +} + +void QDeclarativeWebView::init() +{ + Q_D(QDeclarativeWebView); + + QWebSettings::enablePersistentStorage(); + + setAcceptHoverEvents(true); + setAcceptedMouseButtons(Qt::LeftButton); + setFlag(QGraphicsItem::ItemHasNoContents, false); + + d->page = 0; +} + +void QDeclarativeWebView::componentComplete() +{ + QDeclarativePaintedItem::componentComplete(); + Q_D(QDeclarativeWebView); + switch (d->pending) { + case QDeclarativeWebViewPrivate::PendingUrl: + setUrl(d->pending_url); + break; + case QDeclarativeWebViewPrivate::PendingHtml: + setHtml(d->pending_string, d->pending_url); + break; + case QDeclarativeWebViewPrivate::PendingContent: + setContent(d->pending_data, d->pending_string, d->pending_url); + break; + default: + break; + } + d->pending = QDeclarativeWebViewPrivate::PendingNone; + d->updateWindowObjects(); +} + +QDeclarativeWebView::Status QDeclarativeWebView::status() const +{ + Q_D(const QDeclarativeWebView); + return d->status; +} + + +/*! + \qmlproperty real WebView::progress + This property holds the progress of loading the current URL, from 0 to 1. + + If you just want to know when progress gets to 1, use + WebView::onLoadFinished() or WebView::onLoadFailed() instead. +*/ +qreal QDeclarativeWebView::progress() const +{ + Q_D(const QDeclarativeWebView); + return d->progress; +} + +void QDeclarativeWebView::doLoadStarted() +{ + Q_D(QDeclarativeWebView); + + if (!d->url.isEmpty()) { + d->status = Loading; + emit statusChanged(d->status); + } + emit loadStarted(); +} + +void QDeclarativeWebView::doLoadProgress(int p) +{ + Q_D(QDeclarativeWebView); + if (d->progress == p/100.0) + return; + d->progress = p/100.0; + emit progressChanged(); +} + +void QDeclarativeWebView::pageUrlChanged() +{ + Q_D(QDeclarativeWebView); + + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + expandToWebPage(); + + if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) + || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) + { + d->url = page()->mainFrame()->url(); + if (d->url == QUrl(QLatin1String("about:blank"))) + d->url = QUrl(); + emit urlChanged(); + } +} + +void QDeclarativeWebView::doLoadFinished(bool ok) +{ + Q_D(QDeclarativeWebView); + + if (title().isEmpty()) + pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() + + if (ok) { + d->status = d->url.isEmpty() ? Null : Ready; + emit loadFinished(); + } else { + d->status = Error; + emit loadFailed(); + } + emit statusChanged(d->status); +} + +/*! + \qmlproperty url WebView::url + This property holds the URL to the page displayed in this item. It can be set, + but also can change spontaneously (eg. because of network redirection). + + If the url is empty, the page is blank. + + The url is always absolute (QML will resolve relative URL strings in the context + of the containing QML document). +*/ +QUrl QDeclarativeWebView::url() const +{ + Q_D(const QDeclarativeWebView); + return d->url; +} + +void QDeclarativeWebView::setUrl(const QUrl &url) +{ + Q_D(QDeclarativeWebView); + if (url == d->url) + return; + + if (isComponentComplete()) { + d->url = url; + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + QUrl seturl = url; + if (seturl.isEmpty()) + seturl = QUrl(QLatin1String("about:blank")); + + Q_ASSERT(!seturl.isRelative()); + + page()->mainFrame()->load(seturl); + + emit urlChanged(); + } else { + d->pending = d->PendingUrl; + d->pending_url = url; + } +} + +/*! + \qmlproperty int WebView::preferredWidth + This property holds the ideal width for displaying the current URL. +*/ +int QDeclarativeWebView::preferredWidth() const +{ + Q_D(const QDeclarativeWebView); + return d->preferredwidth; +} + +void QDeclarativeWebView::setPreferredWidth(int iw) +{ + Q_D(QDeclarativeWebView); + if (d->preferredwidth == iw) return; + d->preferredwidth = iw; + //expandToWebPage(); + emit preferredWidthChanged(); +} + +/*! + \qmlproperty int WebView::preferredHeight + This property holds the ideal height for displaying the current URL. + This only affects the area zoomed by heuristicZoom(). +*/ +int QDeclarativeWebView::preferredHeight() const +{ + Q_D(const QDeclarativeWebView); + return d->preferredheight; +} +void QDeclarativeWebView::setPreferredHeight(int ih) +{ + Q_D(QDeclarativeWebView); + if (d->preferredheight == ih) return; + d->preferredheight = ih; + emit preferredHeightChanged(); +} + +/*! + \qmlmethod bool WebView::evaluateJavaScript(string) + + Evaluates the \a scriptSource JavaScript inside the context of the + main web frame, and returns the result of the last executed statement. + + Note that this JavaScript does \e not have any access to QML objects + except as made available as windowObjects. +*/ +QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource) +{ + return this->page()->mainFrame()->evaluateJavaScript(scriptSource); +} + +void QDeclarativeWebView::focusChanged(bool hasFocus) +{ + QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); + page()->event(&e); + QDeclarativeItem::focusChanged(hasFocus); +} + +void QDeclarativeWebView::initialLayout() +{ + // nothing useful to do at this point +} + +void QDeclarativeWebView::noteContentsSizeChanged(const QSize&) +{ + expandToWebPage(); +} + +void QDeclarativeWebView::expandToWebPage() +{ + Q_D(QDeclarativeWebView); + QSize cs = page()->mainFrame()->contentsSize(); + if (cs.width() < d->preferredwidth) + cs.setWidth(d->preferredwidth); + if (cs.height() < d->preferredheight) + cs.setHeight(d->preferredheight); + if (widthValid()) + cs.setWidth(width()); + if (heightValid()) + cs.setHeight(height()); + if (cs != page()->viewportSize()) { + page()->setViewportSize(cs); + } + if (cs != contentsSize()) + setContentsSize(cs); +} + +void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) +{ + if (newGeometry.size() != oldGeometry.size()) + expandToWebPage(); + QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); +} + +void QDeclarativeWebView::paintPage(const QRect& r) +{ + dirtyCache(r); + update(); +} + +/*! + \qmlproperty list WebView::javaScriptWindowObjects + + This property is a list of object that are available from within + the webview's JavaScript context. + + The \a object will be inserted as a child of the frame's window + object, under the name given by the attached property \c WebView.windowObjectName. + + \qml + WebView { + javaScriptWindowObjects: Object { + WebView.windowObjectName: "coordinates" + } + } + \endqml + + Properties of the object will be exposed as JavaScript properties and slots as + JavaScript methods. + + If Javascript is not enabled for this page, then this property does nothing. +*/ +QDeclarativeListProperty QDeclarativeWebView::javaScriptWindowObjects() +{ + Q_D(QDeclarativeWebView); + return QDeclarativeListProperty(this, d, &QDeclarativeWebViewPrivate::windowObjects_append); +} + +QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject *o) +{ + return new QDeclarativeWebViewAttached(o); +} + +void QDeclarativeWebViewPrivate::updateWindowObjects() +{ + Q_Q(QDeclarativeWebView); + if (!q->isComponentComplete() || !page) + return; + + for (int ii = 0; ii < windowObjects.count(); ++ii) { + QObject *object = windowObjects.at(ii); + QDeclarativeWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); + if (attached && !attached->windowObjectName().isEmpty()) { + page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); + } + } +} + +bool QDeclarativeWebView::renderingEnabled() const +{ + Q_D(const QDeclarativeWebView); + return d->rendering; +} + +void QDeclarativeWebView::setRenderingEnabled(bool enabled) +{ + Q_D(QDeclarativeWebView); + if (d->rendering == enabled) + return; + d->rendering = enabled; + emit renderingEnabledChanged(); + + setCacheFrozen(!enabled); + if (enabled) + clearCache(); +} + + +void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r) +{ + Q_D(QDeclarativeWebView); + if (d->rendering) + page()->mainFrame()->render(p,r); +} + +QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) +{ + QEvent::Type t; + switch(e->type()) { + default: + case QEvent::GraphicsSceneMousePress: + t = QEvent::MouseButtonPress; + break; + case QEvent::GraphicsSceneMouseRelease: + t = QEvent::MouseButtonRelease; + break; + case QEvent::GraphicsSceneMouseMove: + t = QEvent::MouseMove; + break; + case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick: + t = QEvent::MouseButtonDblClick; + break; + } + + QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), e->button(), e->buttons(), 0); + return me; +} + +QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) +{ + QEvent::Type t = QEvent::MouseMove; + + QMouseEvent *me = new QMouseEvent(t, (e->pos()/contentsScale()).toPoint(), Qt::NoButton, Qt::NoButton, 0); + + return me; +} + + +/*! + \qmlsignal WebView::onDoubleClick(clickx,clicky) + + The WebView does not pass double-click events to the web engine, but rather + emits this signals. +*/ + +void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + emit doubleClick(me->x(),me->y()); + delete me; +} + +/*! + \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) + + Finds a zoom that: + \list + \i shows a whole item + \i includes (\a clickX, \a clickY) + \i fits into the preferredWidth and preferredHeight + \i zooms by no more than \a maxzoom + \i is more than 10% above the current zoom + \endlist + + If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, + no signal is emitted and returns false. +*/ +bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) +{ + Q_D(QDeclarativeWebView); + if (contentsScale() >= maxzoom/zoomFactor()) + return false; + qreal ozf = contentsScale(); + QRect showarea = elementAreaAt(clickX, clickY, d->preferredwidth/maxzoom, d->preferredheight/maxzoom); + qreal z = qMin(qreal(d->preferredwidth)/showarea.width(),qreal(d->preferredheight)/showarea.height()); + if (z > maxzoom/zoomFactor()) + z = maxzoom/zoomFactor(); + if (z/ozf > 1.2) { + QRectF r(showarea.left()*z, showarea.top()*z, showarea.width()*z, showarea.height()*z); + emit zoomTo(z,r.x()+r.width()/2, r.y()+r.height()/2); + return true; + } else { + return false; + } +} + +/*! + \qmlproperty int WebView::pressGrabTime + + The number of milliseconds the user must press before the WebView + starts passing move events through to the web engine (rather than + letting other QML elements such as a Flickable take them). + + Defaults to 400ms. Set to 0 to always grab and pass move events to + the web engine. +*/ +int QDeclarativeWebView::pressGrabTime() const +{ + Q_D(const QDeclarativeWebView); + return d->pressTime; +} + +void QDeclarativeWebView::setPressGrabTime(int ms) +{ + Q_D(QDeclarativeWebView); + if (d->pressTime == ms) + return; + d->pressTime = ms; + emit pressGrabTimeChanged(); +} + +void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + setFocus (true); + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + + d->pressPoint = me->pos(); + if (d->pressTime) { + d->pressTimer.start(d->pressTime,this); + setKeepMouseGrab(false); + } else { + grabMouse(); + setKeepMouseGrab(true); + } + + page()->event(me); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit + Might be a bug in WebKit, though + */ +#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) { + QDeclarativePaintedItem::mousePressEvent(event); + } +} + +void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + page()->event(me); + d->pressTimer.stop(); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send all the events to WebKit + */ +#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) { + QDeclarativePaintedItem::mouseReleaseEvent(event); + } + setKeepMouseGrab(false); + ungrabMouse(); +} + +void QDeclarativeWebView::timerEvent(QTimerEvent *event) +{ + Q_D(QDeclarativeWebView); + if (event->timerId() == d->pressTimer.timerId()) { + d->pressTimer.stop(); + grabMouse(); + setKeepMouseGrab(true); + } +} + +void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeWebView); + + QMouseEvent *me = sceneMouseEventToMouseEvent(event); + if (d->pressTimer.isActive()) { + if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { + d->pressTimer.stop(); + } + } + if (keepMouseGrab()) { + page()->event(me); + event->setAccepted( +/* + It is not correct to send the press event upwards, if it is not accepted by WebKit + e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit + Might be a bug in WebKit, though + */ +#if 1 // QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + } + delete me; + if (!event->isAccepted()) + QDeclarativePaintedItem::mouseMoveEvent(event); + +} +void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) +{ + QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); + page()->event(me); + event->setAccepted( +#if QT_VERSION <= 0x040500 // XXX see bug 230835 + true +#else + me->isAccepted() +#endif + ); + delete me; + if (!event->isAccepted()) + QDeclarativePaintedItem::hoverMoveEvent(event); +} + +void QDeclarativeWebView::keyPressEvent(QKeyEvent* event) +{ + page()->event(event); + if (!event->isAccepted()) + QDeclarativePaintedItem::keyPressEvent(event); +} + +void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event) +{ + page()->event(event); + if (!event->isAccepted()) + QDeclarativePaintedItem::keyReleaseEvent(event); +} + +bool QDeclarativeWebView::sceneEvent(QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *k = static_cast(event); + if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { + if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? + page()->event(event); + if (event->isAccepted()) + return true; + } + } + } + return QDeclarativePaintedItem::sceneEvent(event); +} + + +/*! + \qmlproperty action WebView::back + This property holds the action for causing the previous URL in the history to be displayed. +*/ +QAction *QDeclarativeWebView::backAction() const +{ + return page()->action(QWebPage::Back); +} + +/*! + \qmlproperty action WebView::forward + This property holds the action for causing the next URL in the history to be displayed. +*/ +QAction *QDeclarativeWebView::forwardAction() const +{ + return page()->action(QWebPage::Forward); +} + +/*! + \qmlproperty action WebView::reload + This property holds the action for reloading with the current URL +*/ +QAction *QDeclarativeWebView::reloadAction() const +{ + return page()->action(QWebPage::Reload); +} + +/*! + \qmlproperty action WebView::stop + This property holds the action for stopping loading with the current URL +*/ +QAction *QDeclarativeWebView::stopAction() const +{ + return page()->action(QWebPage::Stop); +} + +/*! + \qmlproperty real WebView::title + This property holds the title of the web page currently viewed + + By default, this property contains an empty string. +*/ +QString QDeclarativeWebView::title() const +{ + return page()->mainFrame()->title(); +} + + + +/*! + \qmlproperty pixmap WebView::icon + This property holds the icon associated with the web page currently viewed +*/ +QPixmap QDeclarativeWebView::icon() const +{ + return page()->mainFrame()->icon().pixmap(QSize(256,256)); +} + + +/*! + \qmlproperty real WebView::zoomFactor + This property holds the multiplier used to scale the contents of a Web page. +*/ +void QDeclarativeWebView::setZoomFactor(qreal factor) +{ + Q_D(QDeclarativeWebView); + if (factor == page()->mainFrame()->zoomFactor()) + return; + + page()->mainFrame()->setZoomFactor(factor); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor, + d->preferredheight>0 ? d->preferredheight*factor : height()*factor)); + expandToWebPage(); + + emit zoomFactorChanged(); +} + +qreal QDeclarativeWebView::zoomFactor() const +{ + return page()->mainFrame()->zoomFactor(); +} + +/*! + \qmlproperty string WebView::statusText + + This property is the current status suggested by the current web page. In a web browser, + such status is often shown in some kind of status bar. +*/ +void QDeclarativeWebView::setStatusText(const QString& s) +{ + Q_D(QDeclarativeWebView); + d->statusText = s; + emit statusTextChanged(); +} + +void QDeclarativeWebView::windowObjectCleared() +{ + Q_D(QDeclarativeWebView); + d->updateWindowObjects(); +} + +QString QDeclarativeWebView::statusText() const +{ + Q_D(const QDeclarativeWebView); + return d->statusText; +} + +QWebPage *QDeclarativeWebView::page() const +{ + Q_D(const QDeclarativeWebView); + + if (!d->page) { + QDeclarativeWebView *self = const_cast(this); + QWebPage *wp = new QDeclarativeWebPage(self); + + // QML items don't default to having a background, + // even though most we pages will set one anyway. + QPalette pal = QApplication::palette(); + pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); + wp->setPalette(pal); + + wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); + + self->setPage(wp); + + return wp; + } + + return d->page; +} + + +// The QObject interface to settings(). +/*! + \qmlproperty string WebView::settings.standardFontFamily + \qmlproperty string WebView::settings.fixedFontFamily + \qmlproperty string WebView::settings.serifFontFamily + \qmlproperty string WebView::settings.sansSerifFontFamily + \qmlproperty string WebView::settings.cursiveFontFamily + \qmlproperty string WebView::settings.fantasyFontFamily + + \qmlproperty int WebView::settings.minimumFontSize + \qmlproperty int WebView::settings.minimumLogicalFontSize + \qmlproperty int WebView::settings.defaultFontSize + \qmlproperty int WebView::settings.defaultFixedFontSize + + \qmlproperty bool WebView::settings.autoLoadImages + \qmlproperty bool WebView::settings.javascriptEnabled + \qmlproperty bool WebView::settings.javaEnabled + \qmlproperty bool WebView::settings.pluginsEnabled + \qmlproperty bool WebView::settings.privateBrowsingEnabled + \qmlproperty bool WebView::settings.javascriptCanOpenWindows + \qmlproperty bool WebView::settings.javascriptCanAccessClipboard + \qmlproperty bool WebView::settings.developerExtrasEnabled + \qmlproperty bool WebView::settings.linksIncludedInFocusChain + \qmlproperty bool WebView::settings.zoomTextOnly + \qmlproperty bool WebView::settings.printElementBackgrounds + \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled + \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled + \qmlproperty bool WebView::settings.localStorageDatabaseEnabled + \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls + + These properties give access to the settings controlling the web view. + + See QWebSettings for details of these properties. + + \qml + WebView { + settings.pluginsEnabled: true + settings.standardFontFamily: "Arial" + ... + } + \endqml +*/ +QObject *QDeclarativeWebView::settingsObject() const +{ + Q_D(const QDeclarativeWebView); + d->settings.s = page()->settings(); + return &d->settings; +} + +void QDeclarativeWebView::setPage(QWebPage *page) +{ + Q_D(QDeclarativeWebView); + if (d->page == page) + return; + if (d->page) { + if (d->page->parent() == this) { + delete d->page; + } else { + d->page->disconnect(this); + } + } + d->page = page; + d->page->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff); + d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff); + connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); + connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); + connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); + connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); + connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); + + connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted())); + connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int))); + connect(d->page,SIGNAL(loadFinished(bool)),this,SLOT(doLoadFinished(bool))); + connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString))); + + connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared())); +} + +/*! + \qmlsignal WebView::onLoadStarted() + + This handler is called when the web engine begins loading + a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() + will be emitted. +*/ + +/*! + \qmlsignal WebView::onLoadFinished() + + This handler is called when the web engine \e successfully + finishes loading a page, including any component content + (WebView::onLoadFailed() will be emitted otherwise). + + \sa progress +*/ + +/*! + \qmlsignal WebView::onLoadFailed() + + This handler is called when the web engine fails loading + a page or any component content + (WebView::onLoadFinished() will be emitted on success). +*/ + +void QDeclarativeWebView::load(const QNetworkRequest &request, + QNetworkAccessManager::Operation operation, + const QByteArray &body) +{ + page()->mainFrame()->load(request, operation, body); +} + +QString QDeclarativeWebView::html() const +{ + return page()->mainFrame()->toHtml(); +} + +/*! + \qmlproperty string WebView::html + This property holds HTML text set directly + + The html property can be set as a string. + + \qml + WebView { + html: "

This is HTML." + } + \endqml +*/ +void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl) +{ + Q_D(QDeclarativeWebView); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + if (isComponentComplete()) + page()->mainFrame()->setHtml(html, baseUrl); + else { + d->pending = d->PendingHtml; + d->pending_url = baseUrl; + d->pending_string = html; + } + emit htmlChanged(); +} + +void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) +{ + Q_D(QDeclarativeWebView); + page()->setViewportSize(QSize( + d->preferredwidth>0 ? d->preferredwidth : width(), + d->preferredheight>0 ? d->preferredheight : height())); + + if (isComponentComplete()) + page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl)); + else { + d->pending = d->PendingContent; + d->pending_url = baseUrl; + d->pending_string = mimeType; + d->pending_data = data; + } +} + +QWebHistory *QDeclarativeWebView::history() const +{ + return page()->history(); +} + +QWebSettings *QDeclarativeWebView::settings() const +{ + return page()->settings(); +} + +QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) +{ + Q_D(QDeclarativeWebView); + switch (type) { + case QWebPage::WebBrowserWindow: { + if (!d->newWindowComponent && d->newWindowParent) + qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored"); + else if (d->newWindowComponent && !d->newWindowParent) + qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); + else if (d->newWindowComponent && d->newWindowParent) { + QDeclarativeWebView *webview = 0; + QDeclarativeContext *windowContext = new QDeclarativeContext(qmlContext(this)); + + QObject *nobj = d->newWindowComponent->create(windowContext); + if (nobj) { + windowContext->setParent(nobj); + QDeclarativeItem *item = qobject_cast(nobj); + if (!item) { + delete nobj; + } else { + webview = item->findChild(); + if (!webview) { + delete item; + } else { + nobj->setParent(d->newWindowParent); + static_cast(item)->setParentItem(d->newWindowParent); + } + } + } else { + delete windowContext; + } + + return webview; + } + } + break; + case QWebPage::WebModalDialog: { + // Not supported + } + } + return 0; +} + +/*! + \qmlproperty component WebView::newWindowComponent + + This property holds the component to use for new windows. + The component must have a WebView somewhere in its structure. + + When the web engine requests a new window, it will be an instance of + this component. + + The parent of the new window is set by newWindowParent. It must be set. +*/ +QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const +{ + Q_D(const QDeclarativeWebView); + return d->newWindowComponent; +} + +void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow) +{ + Q_D(QDeclarativeWebView); + if (newWindow == d->newWindowComponent) + return; + d->newWindowComponent = newWindow; + emit newWindowComponentChanged(); +} + + +/*! + \qmlproperty item WebView::newWindowParent + + The parent item for new windows. + + \sa newWindowComponent +*/ +QDeclarativeItem *QDeclarativeWebView::newWindowParent() const +{ + Q_D(const QDeclarativeWebView); + return d->newWindowParent; +} + +void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent) +{ + Q_D(QDeclarativeWebView); + if (parent == d->newWindowParent) + return; + if (d->newWindowParent && parent) { + QList children = d->newWindowParent->childItems(); + for (int i = 0; i < children.count(); ++i) { + children.at(i)->setParentItem(parent); + } + } + d->newWindowParent = parent; + emit newWindowParentChanged(); +} + +/*! + Returns the area of the largest element at position (\a x,\a y) that is no larger + than \a maxwidth by \a maxheight pixels. + + May return an area larger in the case when no smaller element is at the position. +*/ +QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const +{ + QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y)); + QRect rv = hit.boundingRect(); + QWebElement element = hit.enclosingBlockElement(); + if (maxwidth<=0) maxwidth = INT_MAX; + if (maxheight<=0) maxheight = INT_MAX; + while (!element.parent().isNull() && element.geometry().width() <= maxwidth && element.geometry().height() <= maxheight) { + rv = element.geometry(); + element = element.parent(); + } + return rv; +} + +/*! + \internal + \class QDeclarativeWebPage + \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins. + + \sa QDeclarativeWebView +*/ +QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView *parent) : + QWebPage(parent) +{ +} + +QDeclarativeWebPage::~QDeclarativeWebPage() +{ +} + +void QDeclarativeWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) +{ + qWarning() << sourceID << ':' << lineNumber << ':' << message; +} + +QString QDeclarativeWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(oldFile) + return oldFile; +} + +void QDeclarativeWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) +{ + Q_UNUSED(originatingFrame) + emit viewItem()->alert(msg); +} + +bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(msg) + return false; +} + +bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) +{ + // Not supported (it's modal) + Q_UNUSED(originatingFrame) + Q_UNUSED(msg) + Q_UNUSED(defaultValue) + Q_UNUSED(result) + return false; +} + + +/* + Qt WebKit does not understand non-QWidget plugins, so dummy widgets + are created, parented to a single dummy tool window. + + The requirements for QML object plugins are input to the Qt WebKit + non-QWidget plugin support, which will obsolete this kludge. +*/ +class QWidget_Dummy_Plugin : public QWidget +{ + Q_OBJECT +public: + static QWidget *dummy_shared_parent() + { + static QWidget *dsp = 0; + if (!dsp) { + dsp = new QWidget(0,Qt::Tool); + dsp->setGeometry(-10000,-10000,0,0); + dsp->show(); + } + return dsp; + } + QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : + QWidget(dummy_shared_parent()), + propertyNames(paramNames), + propertyValues(paramValues), + webview(view) + { + QDeclarativeEngine *engine = qmlEngine(webview); + component = new QDeclarativeComponent(engine, url, this); + item = 0; + if (component->isLoading()) + connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded())); + else + qmlLoaded(); + } + +public Q_SLOTS: + void qmlLoaded() + { + if (component->isError()) { + // ### Could instead give these errors to the WebView to handle. + qWarning() << component->errors(); + return; + } + item = qobject_cast(component->create(qmlContext(webview))); + item->setParent(webview); + QString jsObjName; + for (int i=0; isetProperty(propertyNames[i].toUtf8(),propertyValues[i]); + if (propertyNames[i] == QLatin1String("objectname")) + jsObjName = propertyValues[i]; + } + } + if (!jsObjName.isNull()) { + QWebFrame *f = webview->page()->mainFrame(); + f->addToJavaScriptWindowObject(jsObjName, item); + } + resizeEvent(0); + delete component; + component = 0; + } + void resizeEvent(QResizeEvent*) + { + if (item) { + item->setX(x()); + item->setY(y()); + item->setWidth(width()); + item->setHeight(height()); + } + } + +private: + QDeclarativeComponent *component; + QDeclarativeItem *item; + QStringList propertyNames, propertyValues; + QDeclarativeWebView *webview; +}; + +QDeclarativeWebView *QDeclarativeWebPage::viewItem() +{ + return static_cast(parent()); +} + +QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) +{ + QUrl comp = qmlContext(viewItem())->resolvedUrl(url); + return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); +} + +QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) +{ + QDeclarativeWebView *newView = viewItem()->createWindow(type); + if (newView) + return newView->page(); + return 0; +} + +QT_END_NAMESPACE + +#include diff --git a/src/imports/webkit/qdeclarativewebview_p.h b/src/imports/webkit/qdeclarativewebview_p.h new file mode 100644 index 0000000..5efc3b5 --- /dev/null +++ b/src/imports/webkit/qdeclarativewebview_p.h @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEWEBVIEW_H +#define QDECLARATIVEWEBVIEW_H + +#include "webkitqmlplugin_export.h" + +#include + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +class QWebHistory; +class QWebSettings; + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) +class QDeclarativeWebViewPrivate; +class QNetworkRequest; +class QDeclarativeWebView; + +class WEBKITQMLPLUGIN_EXPORT QDeclarativeWebPage : public QWebPage +{ + Q_OBJECT +public: + explicit QDeclarativeWebPage(QDeclarativeWebView *parent); + ~QDeclarativeWebPage(); +protected: + QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); + QWebPage *createWindow(WebWindowType type); + void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); + QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); + void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); + +private: + QDeclarativeWebView *viewItem(); +}; + + +class QDeclarativeWebViewAttached; + +//### TODO: browser plugins + +class WEBKITQMLPLUGIN_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem +{ + Q_OBJECT + + Q_ENUMS(Status SelectionMode) + + Q_PROPERTY(QString title READ title NOTIFY titleChanged) + Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) + Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) + + Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) + + Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged) + + Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) + Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + + Q_PROPERTY(QAction* reload READ reloadAction CONSTANT) + Q_PROPERTY(QAction* back READ backAction CONSTANT) + Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) + Q_PROPERTY(QAction* stop READ stopAction CONSTANT) + + Q_PROPERTY(QObject* settings READ settingsObject CONSTANT) + + Q_PROPERTY(QDeclarativeListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) + + Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) + Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) + + Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) + +public: + QDeclarativeWebView(QDeclarativeItem *parent=0); + ~QDeclarativeWebView(); + + QUrl url() const; + void setUrl(const QUrl &); + + QString title() const; + + QPixmap icon() const; + + qreal zoomFactor() const; + void setZoomFactor(qreal); + Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); + QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; + + int pressGrabTime() const; + void setPressGrabTime(int); + + int preferredWidth() const; + void setPreferredWidth(int); + int preferredHeight() const; + void setPreferredHeight(int); + + enum Status { Null, Ready, Loading, Error }; + Status status() const; + qreal progress() const; + QString statusText() const; + + QAction *reloadAction() const; + QAction *backAction() const; + QAction *forwardAction() const; + QAction *stopAction() const; + + QWebPage *page() const; + void setPage(QWebPage *page); + + void load(const QNetworkRequest &request, + QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, + const QByteArray &body = QByteArray()); + + QString html() const; + + void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); + void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); + + QWebHistory *history() const; + QWebSettings *settings() const; + QObject *settingsObject() const; + + bool renderingEnabled() const; + void setRenderingEnabled(bool); + + QDeclarativeListProperty javaScriptWindowObjects(); + + static QDeclarativeWebViewAttached *qmlAttachedProperties(QObject *); + + QDeclarativeComponent *newWindowComponent() const; + void setNewWindowComponent(QDeclarativeComponent *newWindow); + QDeclarativeItem *newWindowParent() const; + void setNewWindowParent(QDeclarativeItem *newWindow); + +Q_SIGNALS: + void preferredWidthChanged(); + void preferredHeightChanged(); + void urlChanged(); + void progressChanged(); + void statusChanged(Status); + void titleChanged(const QString&); + void iconChanged(); + void statusTextChanged(); + void htmlChanged(); + void pressGrabTimeChanged(); + void zoomFactorChanged(); + void newWindowComponentChanged(); + void newWindowParentChanged(); + void renderingEnabledChanged(); + + void loadStarted(); + void loadFinished(); + void loadFailed(); + + void doubleClick(int clickX, int clickY); + + void zoomTo(qreal zoom, int centerX, int centerY); + + void alert(const QString& message); + +public Q_SLOTS: + QVariant evaluateJavaScript(const QString&); + +private Q_SLOTS: + void expandToWebPage(); + void paintPage(const QRect&); + void doLoadStarted(); + void doLoadProgress(int p); + void doLoadFinished(bool ok); + void setStatusText(const QString&); + void windowObjectCleared(); + void pageUrlChanged(); + void noteContentsSizeChanged(const QSize&); + void initialLayout(); + +protected: + void drawContents(QPainter *, const QRect &); + + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void timerEvent(QTimerEvent *event); + void hoverMoveEvent (QGraphicsSceneHoverEvent * event); + void keyPressEvent(QKeyEvent* event); + void keyReleaseEvent(QKeyEvent* event); + virtual void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry); + virtual void focusChanged(bool); + virtual bool sceneEvent(QEvent *event); + QDeclarativeWebView *createWindow(QWebPage::WebWindowType type); + +private: + void init(); + virtual void componentComplete(); + Q_DISABLE_COPY(QDeclarativeWebView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView) + QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *); + QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *); + friend class QDeclarativeWebPage; +}; + +class QDeclarativeWebViewAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) +public: + QDeclarativeWebViewAttached(QObject *parent) + : QObject(parent) + { + } + + QString windowObjectName() const + { + return m_windowObjectName; + } + + void setWindowObjectName(const QString &n) + { + m_windowObjectName = n; + } + +private: + QString m_windowObjectName; +}; + + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeWebView) +QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES) + +QT_END_HEADER + +#endif diff --git a/src/imports/webkit/qdeclarativewebview_p_p.h b/src/imports/webkit/qdeclarativewebview_p_p.h new file mode 100644 index 0000000..258b472 --- /dev/null +++ b/src/imports/webkit/qdeclarativewebview_p_p.h @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEWEBVIEW_P_H +#define QDECLARATIVEWEBVIEW_P_H + +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeWebSettings : public QObject { + Q_OBJECT + + Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) + Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) + Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) + Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) + Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) + Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) + + Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) + Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) + Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) + Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) + + Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) + Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) + Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) + Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) + Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) + Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) + Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) + Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) + Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) + Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) + Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) + Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) + Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) + Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) + Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) + +public: + QDeclarativeWebSettings() {} + + QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } + void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } + QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } + void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont,f); } + QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } + void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont,f); } + QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } + void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont,f); } + QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } + void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont,f); } + QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } + void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont,f); } + + int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } + void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize,size); } + int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } + void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize,size); } + int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } + void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize,size); } + int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } + void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize,size); } + + bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } + void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } + bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } + void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } + bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } + void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } + bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } + void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } + bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } + void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } + bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } + void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } + bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } + void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } + bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } + void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } + bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } + void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } + bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } + void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } + bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } + void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } + bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } + void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } + bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } + void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } + bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } + void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } + bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } + void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } + + QWebSettings *s; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeWebSettings) + +QT_END_HEADER + +#endif diff --git a/src/imports/webkit/qmldir b/src/imports/webkit/qmldir new file mode 100644 index 0000000..258aa2c --- /dev/null +++ b/src/imports/webkit/qmldir @@ -0,0 +1 @@ +plugin webkitqmlplugin diff --git a/src/imports/webkit/webkit.pro b/src/imports/webkit/webkit.pro new file mode 100644 index 0000000..76b46f1 --- /dev/null +++ b/src/imports/webkit/webkit.pro @@ -0,0 +1,19 @@ +TARGET = webkitqmlplugin +TARGETPATH = $$[QT_INSTALL_IMPORTS]/org/webkit +include(../qimportbase.pri) + +QT += webkit declarative +DEFINES += WEBKITQMLPLUGIN_EXPORTS + +SOURCES += qdeclarativewebview.cpp plugin.cpp +HEADERS += qdeclarativewebview_p.h \ + qdeclarativewebview_p_p.h \ + webkitqmlplugin_export.h + +QTDIR_build:DESTDIR = $$TARGETPATH +target.path = $$TARGETPATH + +qmldir.files += $$QT_BUILD_TREE/imports/org/webkit/qmldir +qmldir.path += $$TARGETPATH + +INSTALLS += target qmldir diff --git a/src/imports/webkit/webkitqmlplugin_export.h b/src/imports/webkit/webkitqmlplugin_export.h new file mode 100644 index 0000000..974fd24 --- /dev/null +++ b/src/imports/webkit/webkitqmlplugin_export.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WEBKITQMLPLUGIN_EXPORT_H +#define WEBKITQMLPLUGIN_EXPORT_H + +#include + +#if defined WEBKITQMLPLUGIN_EXPORTS +# define WEBKITQMLPLUGIN_EXPORT Q_DECL_EXPORT +#else +# define WEBKITQMLPLUGIN_EXPORT Q_DECL_IMPORT +#endif + +#endif // WEBKITQMLPLUGIN_EXPORT_H diff --git a/src/imports/widgets/graphicslayouts.cpp b/src/imports/widgets/graphicslayouts.cpp new file mode 100644 index 0000000..fc15ad2 --- /dev/null +++ b/src/imports/widgets/graphicslayouts.cpp @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "graphicslayouts_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +LinearLayoutAttached::LinearLayoutAttached(QObject *parent) +: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter) +{ +} + +void LinearLayoutAttached::setStretchFactor(int f) +{ + if (_stretch == f) + return; + + _stretch = f; + emit stretchChanged(reinterpret_cast(parent()), _stretch); +} + +void LinearLayoutAttached::setAlignment(Qt::Alignment a) +{ + if (_alignment == a) + return; + + _alignment = a; + emit alignmentChanged(reinterpret_cast(parent()), _alignment); +} + +QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent) + : QObject(parent) +{ +} + +QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ +Q_UNUSED(which); +Q_UNUSED(constraint); +return QSizeF(); +} + + +QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent) +: QObject(parent) +{ +} + +QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject() +{ +} + +void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item) +{ +insertItem(index, item); + +//connect attached properties +if (LinearLayoutAttached *obj = attachedProperties.value(item)) { + setStretchFactor(item, obj->stretchFactor()); + setAlignment(item, obj->alignment()); + QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)), + this, SLOT(updateStretch(QGraphicsLayoutItem*,int))); + QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)), + this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment))); + //### need to disconnect when widget is removed? +} +} + +//### is there a better way to do this? +void QGraphicsLinearLayoutObject::clearChildren() +{ +for (int i = 0; i < count(); ++i) + removeAt(i); +} + +void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch) +{ +QGraphicsLinearLayout::setStretchFactor(item, stretch); +} + +void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment) +{ +QGraphicsLinearLayout::setAlignment(item, alignment); +} + +QHash QGraphicsLinearLayoutObject::attachedProperties; +LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj) +{ +// ### This is not allowed - you must attach to any object +if (!qobject_cast(obj)) + return 0; +LinearLayoutAttached *rv = new LinearLayoutAttached(obj); +attachedProperties.insert(qobject_cast(obj), rv); +return rv; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// QGraphicsGridLayout-related classes +////////////////////////////////////////////////////////////////////////////////////////////////////// +GridLayoutAttached::GridLayoutAttached(QObject *parent) +: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1) +{ +} + +void GridLayoutAttached::setRow(int r) +{ + if (_row == r) + return; + + _row = r; + //emit rowChanged(reinterpret_cast(parent()), _row); +} + +void GridLayoutAttached::setColumn(int c) +{ + if (_column == c) + return; + + _column = c; + //emit columnChanged(reinterpret_cast(parent()), _column); +} + +void GridLayoutAttached::setRowSpan(int rs) +{ + if (_rowspan == rs) + return; + + _rowspan = rs; + //emit rowSpanChanged(reinterpret_cast(parent()), _rowSpan); +} + +void GridLayoutAttached::setColumnSpan(int cs) +{ + if (_colspan == cs) + return; + + _colspan = cs; + //emit columnSpanChanged(reinterpret_cast(parent()), _columnSpan); +} + +void GridLayoutAttached::setAlignment(Qt::Alignment a) +{ + if (_alignment == a) + return; + + _alignment = a; + //emit alignmentChanged(reinterpret_cast(parent()), _alignment); +} + +QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent) +: QObject(parent) +{ +} + +QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject() +{ +} + +void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid) +{ +//use attached properties +if (QObject *obj = attachedProperties.value(qobject_cast(wid))) { + int row = static_cast(obj)->row(); + int column = static_cast(obj)->column(); + int rowSpan = static_cast(obj)->rowSpan(); + int columnSpan = static_cast(obj)->columnSpan(); + if (row == -1 || column == -1) { + qWarning() << "Must set row and column for an item in a grid layout"; + return; + } + addItem(wid, row, column, rowSpan, columnSpan); +} +} + +void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item) +{ +//use attached properties +if (GridLayoutAttached *obj = attachedProperties.value(item)) { + int row = obj->row(); + int column = obj->column(); + int rowSpan = obj->rowSpan(); + int columnSpan = obj->columnSpan(); + Qt::Alignment alignment = obj->alignment(); + if (row == -1 || column == -1) { + qWarning() << "Must set row and column for an item in a grid layout"; + return; + } + addItem(item, row, column, rowSpan, columnSpan); + if (alignment != -1) + setAlignment(item,alignment); +} +} + +//### is there a better way to do this? +void QGraphicsGridLayoutObject::clearChildren() +{ +for (int i = 0; i < count(); ++i) + removeAt(i); +} + +qreal QGraphicsGridLayoutObject::spacing() const +{ +if (verticalSpacing() == horizontalSpacing()) + return verticalSpacing(); +return -1; //### +} + +QHash QGraphicsGridLayoutObject::attachedProperties; +GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj) +{ +// ### This is not allowed - you must attach to any object +if (!qobject_cast(obj)) + return 0; +GridLayoutAttached *rv = new GridLayoutAttached(obj); +attachedProperties.insert(qobject_cast(obj), rv); +return rv; +} + +QT_END_NAMESPACE diff --git a/src/imports/widgets/graphicslayouts_p.h b/src/imports/widgets/graphicslayouts_p.h new file mode 100644 index 0000000..f9b9ae8 --- /dev/null +++ b/src/imports/widgets/graphicslayouts_p.h @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GRAPHICSLAYOUTS_H +#define GRAPHICSLAYOUTS_H + +#include "graphicswidgets_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem +{ + Q_OBJECT + Q_INTERFACES(QGraphicsLayoutItem) +public: + QGraphicsLinearLayoutStretchItemObject(QObject *parent = 0); + + virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const; +}; + +class LinearLayoutAttached; +class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout +{ + Q_OBJECT + Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) + Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsLinearLayoutObject(QObject * = 0); + ~QGraphicsLinearLayoutObject(); + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } + + static LinearLayoutAttached *qmlAttachedProperties(QObject *); + +private Q_SLOTS: + void updateStretch(QGraphicsLayoutItem*,int); + void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment); + +private: + friend class LinearLayoutAttached; + void clearChildren(); + void insertLayoutItem(int, QGraphicsLayoutItem *); + static QHash attachedProperties; + + static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { + static_cast(prop->object)->insertLayoutItem(-1, item); + } + + static void children_clear(QDeclarativeListProperty *prop) { + static_cast(prop->object)->clearChildren(); + } + + static int children_count(QDeclarativeListProperty *prop) { + return static_cast(prop->object)->count(); + } + + static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { + return static_cast(prop->object)->itemAt(index); + } +}; + +class GridLayoutAttached; +class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout +{ + Q_OBJECT + Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem) + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing) + Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) + Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsGridLayoutObject(QObject * = 0); + ~QGraphicsGridLayoutObject(); + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append, children_count, children_at, children_clear); } + + qreal spacing() const; + + static GridLayoutAttached *qmlAttachedProperties(QObject *); + +private: + friend class GraphicsLayoutAttached; + void addWidget(QGraphicsWidget *); + void clearChildren(); + void addLayoutItem(QGraphicsLayoutItem *); + static QHash attachedProperties; + + static void children_append(QDeclarativeListProperty *prop, QGraphicsLayoutItem *item) { + static_cast(prop->object)->addLayoutItem(item); + } + + static void children_clear(QDeclarativeListProperty *prop) { + static_cast(prop->object)->clearChildren(); + } + + static int children_count(QDeclarativeListProperty *prop) { + return static_cast(prop->object)->count(); + } + + static QGraphicsLayoutItem *children_at(QDeclarativeListProperty *prop, int index) { + return static_cast(prop->object)->itemAt(index); + } +}; + +class LinearLayoutAttached : public QObject +{ + Q_OBJECT + + Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) +public: + LinearLayoutAttached(QObject *parent); + + int stretchFactor() const { return _stretch; } + void setStretchFactor(int f); + Qt::Alignment alignment() const { return _alignment; } + void setAlignment(Qt::Alignment a); + +Q_SIGNALS: + void stretchChanged(QGraphicsLayoutItem*,int); + void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment); + +private: + int _stretch; + Qt::Alignment _alignment; +}; + +class GridLayoutAttached : public QObject +{ + Q_OBJECT + + Q_PROPERTY(int row READ row WRITE setRow) + Q_PROPERTY(int column READ column WRITE setColumn) + Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan) + Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) +public: + GridLayoutAttached(QObject *parent); + + int row() const { return _row; } + void setRow(int r); + + int column() const { return _column; } + void setColumn(int c); + + int rowSpan() const { return _rowspan; } + void setRowSpan(int rs); + + int columnSpan() const { return _colspan; } + void setColumnSpan(int cs); + + Qt::Alignment alignment() const { return _alignment; } + void setAlignment(Qt::Alignment a); + +private: + int _row; + int _column; + int _rowspan; + int _colspan; + Qt::Alignment _alignment; +}; + +QT_END_NAMESPACE + +QML_DECLARE_INTERFACE(QGraphicsLayoutItem) +QML_DECLARE_INTERFACE(QGraphicsLayout) +QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject) +QML_DECLARE_TYPE(QGraphicsLinearLayoutObject) +QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QGraphicsGridLayoutObject) +QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES) + +QT_END_HEADER + +#endif // GRAPHICSLAYOUTS_H diff --git a/src/imports/widgets/graphicswidgets.cpp b/src/imports/widgets/graphicswidgets.cpp new file mode 100644 index 0000000..062e516 --- /dev/null +++ b/src/imports/widgets/graphicswidgets.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ diff --git a/src/imports/widgets/graphicswidgets_p.h b/src/imports/widgets/graphicswidgets_p.h new file mode 100644 index 0000000..2c2b707 --- /dev/null +++ b/src/imports/widgets/graphicswidgets_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GRAPHICSWIDGETS_H +#define GRAPHICSWIDGETS_H + +#include + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QGraphicsView) +QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene) +QML_DECLARE_TYPE(QGraphicsWidget) +QML_DECLARE_TYPE(QGraphicsObject) +QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem) + +QT_END_HEADER + +#endif // GRAPHICSWIDGETS_H diff --git a/src/imports/widgets/qmldir b/src/imports/widgets/qmldir new file mode 100644 index 0000000..6f19878 --- /dev/null +++ b/src/imports/widgets/qmldir @@ -0,0 +1 @@ +plugin widgets diff --git a/src/imports/widgets/widgets.cpp b/src/imports/widgets/widgets.cpp new file mode 100644 index 0000000..ec21cc4 --- /dev/null +++ b/src/imports/widgets/widgets.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "graphicslayouts_p.h" +#include "graphicswidgets_p.h" + +QT_BEGIN_NAMESPACE + +class QGraphicsViewDeclarativeUI : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene) + Q_CLASSINFO("DefaultProperty", "scene") +public: + QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {} + + QGraphicsScene *scene() const { return static_cast(parent())->scene(); } + void setScene(QGraphicsScene *scene) + { + static_cast(parent())->setScene(scene); + } +}; + +class QGraphicsSceneDeclarativeUI : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {} + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this->parent(), 0, children_append); } + +private: + static void children_append(QDeclarativeListProperty *prop, QObject *o) { + if (QGraphicsObject *go = qobject_cast(o)) + static_cast(prop->object)->addItem(go); + } +}; + +class QGraphicsWidgetDeclarativeUI : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QDeclarativeListProperty children READ children) + Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout) + Q_CLASSINFO("DefaultProperty", "children") +public: + QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {} + + QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append); } + + QGraphicsLayout *layout() const { return static_cast(parent())->layout(); } + void setLayout(QGraphicsLayout *lo) + { + static_cast(parent())->setLayout(lo); + } + +private: + void setItemParent(QGraphicsItem *wid) + { + wid->setParentItem(static_cast(parent())); + } + + static void children_append(QDeclarativeListProperty *prop, QGraphicsItem *i) { + static_cast(prop->object)->setItemParent(i); + } +}; + +class QWidgetsQmlModule : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets")); + + QML_REGISTER_INTERFACE(QGraphicsLayoutItem); + QML_REGISTER_INTERFACE(QGraphicsLayout); + qmlRegisterType(uri,4,6,"QGraphicsLinearLayoutStretchItem"); + qmlRegisterType(uri,4,6,"QGraphicsLinearLayout"); + qmlRegisterType(uri,4,6,"QGraphicsGridLayout"); + qmlRegisterExtendedType(uri,4,6,"QGraphicsView"); + qmlRegisterExtendedType(uri,4,6,"QGraphicsScene"); + qmlRegisterExtendedType(uri,4,6,"QGraphicsWidget"); + QML_REGISTER_INTERFACE(QGraphicsItem); + } +}; + +QT_END_NAMESPACE + +#include "widgets.moc" + +Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule)); + diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro new file mode 100644 index 0000000..b98be59 --- /dev/null +++ b/src/imports/widgets/widgets.pro @@ -0,0 +1,22 @@ +TARGET = widgets +TARGETPATH = $$[QT_INSTALL_IMPORTS]/Qt/widgets +include(../qimportbase.pri) + +QT += declarative + +SOURCES += \ + graphicslayouts.cpp \ + widgets.cpp + +HEADERS += \ + graphicswidgets_p.h \ + graphicslayouts_p.h + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/widgets +target.path = $$TARGETPATH + +# install qmldir file +qmldir.files += qmldir +qmldir.path = $$TARGETPATH + +INSTALLS += target qmldir diff --git a/src/src.pro b/src/src.pro index 2b9dc30..7bb731e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -29,6 +29,7 @@ contains(QT_CONFIG, scripttools): SRC_SUBDIRS += src_scripttools contains(QT_CONFIG, declarative): SRC_SUBDIRS += src_declarative contains(QT_CONFIG, multimedia): SRC_SUBDIRS += src_multimedia SRC_SUBDIRS += src_plugins +contains(QT_CONFIG, declarative): SRC_SUBDIRS += src_imports src_s60main.subdir = $$QT_SOURCE_TREE/src/s60main src_s60main.target = sub-s60main @@ -70,6 +71,8 @@ src_activeqt.subdir = $$QT_SOURCE_TREE/src/activeqt src_activeqt.target = sub-activeqt src_plugins.subdir = $$QT_SOURCE_TREE/src/plugins src_plugins.target = sub-plugins +src_imports.subdir = $$QT_SOURCE_TREE/src/imports +src_imports.target = sub-imports src_testlib.subdir = $$QT_SOURCE_TREE/src/testlib src_testlib.target = sub-testlib src_javascriptcore.subdir = $$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore @@ -103,11 +106,13 @@ src_declarative.target = sub-declarative src_tools_activeqt.depends = src_tools_idc src_gui src_declarative.depends = src_xml src_gui src_script src_network src_svg src_plugins.depends = src_gui src_sql src_svg src_multimedia + src_imports.depends = src_gui src_declarative contains(QT_CONFIG, webkit) { src_webkit.depends = src_gui src_sql src_network src_xml contains(QT_CONFIG, phonon):src_webkit.depends += src_phonon contains(QT_CONFIG, xmlpatterns): src_webkit.depends += src_xmlpatterns contains(QT_CONFIG, declarative):src_declarative.depends += src_webkit + src_imports.depends += webkit #exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore } contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support @@ -117,6 +122,7 @@ src_declarative.target = sub-declarative } contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): src_plugins.depends += src_opengl contains(QT_CONFIG, declarative): src_multimedia.depends += src_declarative + contains(QT_CONFIG, multimedia): src_imports += src_multimedia } !symbian { -- cgit v0.12 From d88f9fbe1522c48dfef153eef768f9eec123ec9e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Mar 2010 09:35:00 +1000 Subject: Make test more reliable. --- .../qdeclarativeanimations/tst_qdeclarativeanimations.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 0c166df..f5e15fb 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -217,11 +217,11 @@ void tst_qdeclarativeanimations::resume() animation.setProperty("x"); animation.setFrom(10); animation.setTo(200); - animation.setDuration(500); + animation.setDuration(1000); QVERIFY(animation.from() == 10); animation.start(); - QTest::qWait(200); + QTest::qWait(400); animation.pause(); qreal x = rect.x(); QVERIFY(x != qreal(200) && x != qreal(10)); @@ -231,7 +231,7 @@ void tst_qdeclarativeanimations::resume() animation.resume(); QVERIFY(animation.isRunning()); QVERIFY(!animation.isPaused()); - QTest::qWait(200); + QTest::qWait(400); animation.stop(); QVERIFY(rect.x() > x); } -- cgit v0.12 From eaf436568b2e6870a72e97baf2837d320f5d8ec8 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Mar 2010 09:35:50 +1000 Subject: Initialize variable before use. --- src/declarative/util/qdeclarativeanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index ebf1a20..7f4f1c0 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2225,7 +2225,7 @@ struct PropertyUpdater : public QDeclarativeBulkValueUpdater bool fromSourced; bool fromDefined; bool *wasDeleted; - PropertyUpdater() : wasDeleted(0) {} + PropertyUpdater() : prevInterpolatorType(0), wasDeleted(0) {} ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; } void setValue(qreal v) { -- cgit v0.12 From 398f97c90f52a8927ac1efe3d7e272da900d6be3 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 10:08:38 +1000 Subject: /src/imports/ now also contains plugins, so treat the same. --- tests/auto/headers/tst_headers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 3745767..12c5843 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -271,6 +271,7 @@ void tst_Headers::macros() if (header.endsWith("_p.h") || header.endsWith("_pch.h") || header.contains("global/qconfig-") || header.endsWith("/qconfig.h") || header.contains("/src/tools/") || header.contains("/src/plugins/") + || header.contains("/src/imports/") || header.endsWith("/qiconset.h") || header.endsWith("/qfeatures.h") || header.endsWith("qt_windows.h")) return; -- cgit v0.12 From c131c4d922bd381b44164673085fb83547375fd0 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 3 Mar 2010 11:04:07 +1000 Subject: Add WorkerScript docs and tests. Task-number: QT-2807 --- src/declarative/qml/qdeclarativeworkerscript.cpp | 83 +++++++++- tests/auto/declarative/declarative.pro | 1 + .../qdeclarativeworkerscript/data/script.js | 5 + .../qdeclarativeworkerscript/data/worker.qml | 27 +++ .../qdeclarativeworkerscript.pro | 9 + .../tst_qdeclarativeworkerscript.cpp | 184 +++++++++++++++++++++ 6 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/script.js create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index c1d090e..784353a 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -365,6 +365,8 @@ void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) workerEngine->evaluate(script); workerEngine->popContext(); + } else { + qWarning().nospace() << "WorkerScript: Cannot find source file " << url.toString(); } } @@ -382,7 +384,7 @@ QVariant QDeclarativeWorkerScriptEnginePrivate::scriptValueToVariant(const QScri quint32 length = (quint32)value.property(QLatin1String("length")).toNumber(); for (quint32 ii = 0; ii < length; ++ii) { - QVariant v = scriptValueToVariant(ii); + QVariant v = scriptValueToVariant(value.property(ii)); list << v; } @@ -561,6 +563,65 @@ void QDeclarativeWorkerScriptEngine::run() delete d->workerEngine; d->workerEngine = 0; } + +/*! + \qmlclass WorkerScript QDeclarativeWorkerScript + \brief The WorkerScript element enables the use of threads in QML. + + Use WorkerScript to run operations in a new thread. + This is useful for running operations in the background so + that the main GUI thread is not blocked. + + Messages can be passed between the new thread and the parent thread + using sendMessage() and the onMessage() handler. + + Here is an example: + + \qml + import Qt 4.6 + + Rectangle { + width: 300 + height: 300 + + Text { + id: myText + text: 'Click anywhere' + } + + WorkerScript { + id: myWorker + source: "script.js" + + onMessage: { + myText.text = messageObject.reply + } + } + + MouseArea { + anchors.fill: parent + onClicked: myWorker.sendMessage( {'x': mouse.x, 'y': mouse.y} ); + } + } + \endqml + + The above worker script specifies a javascript file, "script.js", that handles + the operations to be performed in the new thread: + + \qml + WorkerScript.onMessage = function(message) { + // ... long-running operations and calculations are done here + WorkerScript.sendMessage( {'reply': 'Mouse is at ' + message.x + ',' + message.y} ); + } + \endqml + + When the user clicks anywhere within the rectangle, \c sendMessage() is + called, triggering the \tt WorkerScript.onMessage() handler in + \tt source.js. This in turn sends a reply message that is then received + by the \tt onMessage() handler of \tt myWorker. + + \sa WorkerListModel +*/ QDeclarativeWorkerScript::QDeclarativeWorkerScript(QObject *parent) : QObject(parent), m_engine(0), m_scriptId(-1) { @@ -571,6 +632,12 @@ QDeclarativeWorkerScript::~QDeclarativeWorkerScript() if (m_scriptId != -1) m_engine->removeWorkerScript(m_scriptId); } +/*! + \qmlproperty url WorkerScript::source + + This holds the url of the javascript file that implements the + \tt WorkerScript.onMessage() handler for threaded operations. +*/ QUrl QDeclarativeWorkerScript::source() const { return m_source; @@ -589,6 +656,13 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source) emit sourceChanged(); } +/* + \qmlmethod WorkerScript::sendMessage(jsobject message) + + Sends the given \a message to a worker script handler in another + thread. The other worker script handler can receive this message + through the onMessage() handler. +*/ void QDeclarativeWorkerScript::sendMessage(const QScriptValue &message) { if (!m_engine) { @@ -616,6 +690,13 @@ void QDeclarativeWorkerScript::componentComplete() } } +/*! + \qmlsignal WorkerScript::onMessage(jsobject msg) + + This handler is called when a message \a msg is received from a worker + script in another thread through a call to sendMessage(). +*/ + bool QDeclarativeWorkerScript::event(QEvent *event) { if (event->type() == (QEvent::Type)WorkerDataEvent::WorkerData) { diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 38c75a8..200d831 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -55,6 +55,7 @@ SUBDIRS += \ qdeclarativexmllistmodel \ # Cover qpacketprotocol \ # Cover qdeclarativerepeater \ # Cover + qdeclarativeworkerscript \ # Cover qdeclarativeworkerlistmodel \ # Cover qdeclarativevaluetypes \ # Cover qdeclarativexmlhttprequest \ # Cover diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js new file mode 100644 index 0000000..09199de --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js @@ -0,0 +1,5 @@ +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage(msg) +} + + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml new file mode 100644 index 0000000..2982010 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -0,0 +1,27 @@ +import Qt 4.6 + +WorkerScript { + id: worker + source: "script.js" + + property bool done : false + property var response + + function testSend(value) { + worker.sendMessage(value) + } + + function testSendLiteral(value) { + eval('worker.sendMessage(' + value +')') + } + + function compareLiteralResponse(expected) { + var e = eval('(' + expected + ')') + return worker.response == e + } + + onMessage: { + worker.done = true + worker.response = messageObject + } +} diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro new file mode 100644 index 0000000..0543ff6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += script +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeworkerscript.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp new file mode 100644 index 0000000..841a0ee --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +#include +#include +#include + +#include +#include "../../../shared/util.h" + +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QScriptValue) + +class tst_QDeclarativeWorkerScript : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeWorkerScript() {} +private slots: + void source(); + void source_data(); + void messaging(); + void messaging_data(); + void messaging_sendQObjectList(); + void messaging_sendJsObject(); + +private: + void waitForEchoMessage(QDeclarativeWorkerScript *worker) { + const QMetaObject *mo = worker->metaObject(); + int index = mo->indexOfProperty("done"); + QVERIFY(index >= 0); + QTRY_COMPARE(mo->property(index).read(worker).toBool(), true); + QTRY_COMPARE(mo->property(mo->indexOfProperty("done")).read(worker).toBool(), true); + } + + QDeclarativeEngine m_engine; +}; + +void tst_QDeclarativeWorkerScript::source() +{ + QFETCH(QUrl, source); + QFETCH(bool, valid); + + QDeclarativeComponent component(&m_engine); + component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); + + if (!valid) { + QByteArray w = "WorkerScript: Cannot find source file \"" + source.toString().toUtf8() + "\""; + QTest::ignoreMessage(QtWarningMsg, w.constData()); + } + QDeclarativeWorkerScript *item = qobject_cast(component.create()); + QVERIFY(item != 0); + + QCOMPARE(item->source(), source); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerScript::source_data() +{ + QTest::addColumn("source"); + QTest::addColumn("valid"); + + QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/worker.qml") << true; + QTest::newRow("invalid") << QUrl("file:///asdjfk.js") << false; +} + +void tst_QDeclarativeWorkerScript::messaging() +{ + QFETCH(QVariant, value); + + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeWorkerScript *worker = qobject_cast(component.create()); + QVERIFY(worker != 0); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + + const QMetaObject *mo = worker->metaObject(); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value(), value); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerScript::messaging_data() +{ + QTest::addColumn("value"); + + QTest::newRow("invalid") << QVariant(); + QTest::newRow("bool") << qVariantFromValue(true); + QTest::newRow("int") << qVariantFromValue(1001); + QTest::newRow("real") << qVariantFromValue(10334.323); + QTest::newRow("string") << qVariantFromValue(QString("More cheeeese, Gromit!")); + QTest::newRow("variant list") << qVariantFromValue((QVariantList() << "a" << "b" << "c")); +} + +void tst_QDeclarativeWorkerScript::messaging_sendQObjectList() +{ + // Not allowed to send QObjects other than QDeclarativeWorkerListModelAgent + // instances. If objects are sent in a list, they will be sent as 'undefined' + // js values. + + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeWorkerScript *worker = qobject_cast(component.create()); + QVERIFY(worker != 0); + + QVariantList objects; + for (int i=0; i<3; i++) + objects << qVariantFromValue(new QObject(this)); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(objects)))); + waitForEchoMessage(worker); + + const QMetaObject *mo = worker->metaObject(); + QVariantList result = mo->property(mo->indexOfProperty("response")).read(worker).value(); + QCOMPARE(result, (QVariantList() << QVariant() << QVariant() << QVariant())); + + qApp->processEvents(); +} + +void tst_QDeclarativeWorkerScript::messaging_sendJsObject() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeWorkerScript *worker = qobject_cast(component.create()); + QVERIFY(worker != 0); + + QString jsObject = "{'spell power': 3101, 'haste': 1125}"; + + QVERIFY(QMetaObject::invokeMethod(worker, "testSendLiteral", Q_ARG(QVariant, jsObject))); + waitForEchoMessage(worker); + + QVariant result = qVariantFromValue(false); + QVERIFY(QMetaObject::invokeMethod(worker, "compareLiteralResponse", Qt::DirectConnection, + Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, jsObject))); + QVERIFY(result.toBool()); + + qApp->processEvents(); +} + +QTEST_MAIN(tst_QDeclarativeWorkerScript) + +#include "tst_qdeclarativeworkerscript.moc" + -- cgit v0.12 From d2f456c8e94b6c7752818a9e3c819784e18237f0 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 2 Mar 2010 11:12:34 +1000 Subject: Fixed compiler warnings when compiling multimedia module. Reviewed-by:Andrew den Exter --- src/multimedia/base/qmediaserviceprovider.cpp | 14 +++++++++----- src/multimedia/qml/qsoundeffect_qsound_p.cpp | 2 +- src/multimedia/qml/wavedecoder_p.cpp | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp index eb6505c..d51d682 100644 --- a/src/multimedia/base/qmediaserviceprovider.cpp +++ b/src/multimedia/base/qmediaserviceprovider.cpp @@ -268,7 +268,7 @@ class QPluginServiceProvider : public QMediaServiceProvider public: QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint) { - QString key(type); + QString key(QString::fromLatin1(type.constData(),type.length())); QListplugins; foreach (QObject *obj, loader()->instances(key)) { @@ -383,7 +383,8 @@ public: const QStringList& codecs, int flags) const { - QList instances = loader()->instances(serviceType); + QList instances = loader()->instances( + QString::fromLatin1(serviceType.constData(),serviceType.length())); if (instances.isEmpty()) return QtMultimedia::NotSupported; @@ -424,7 +425,8 @@ public: QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const { - QList instances = loader()->instances(serviceType); + QList instances = loader()->instances( + QString::fromLatin1(serviceType.constData(),serviceType.length())); QStringList supportedTypes; @@ -457,7 +459,8 @@ public: { QList res; - foreach(QObject *obj, loader()->instances(serviceType)) { + foreach(QObject *obj, loader()->instances( + QString::fromLatin1(serviceType.constData(),serviceType.length()))) { QMediaServiceSupportedDevicesInterface *iface = qobject_cast(obj); @@ -471,7 +474,8 @@ public: QString deviceDescription(const QByteArray &serviceType, const QByteArray &device) { - foreach(QObject *obj, loader()->instances(serviceType)) { + foreach(QObject *obj, loader()->instances( + QString::fromLatin1(serviceType.constData(),serviceType.length()))) { QMediaServiceSupportedDevicesInterface *iface = qobject_cast(obj); diff --git a/src/multimedia/qml/qsoundeffect_qsound_p.cpp b/src/multimedia/qml/qsoundeffect_qsound_p.cpp index 0292d26..df160a9 100644 --- a/src/multimedia/qml/qsoundeffect_qsound_p.cpp +++ b/src/multimedia/qml/qsoundeffect_qsound_p.cpp @@ -157,7 +157,7 @@ void QSoundEffectPrivate::setMedia(const QMediaContent &media) { m_queued = false; - if (media.isNull() || media.canonicalUrl().scheme() != "file") { + if (media.isNull() || media.canonicalUrl().scheme() != QLatin1String("file")) { m_media = QMediaContent(); return; } diff --git a/src/multimedia/qml/wavedecoder_p.cpp b/src/multimedia/qml/wavedecoder_p.cpp index b7d6101..f2277ae 100644 --- a/src/multimedia/qml/wavedecoder_p.cpp +++ b/src/multimedia/qml/wavedecoder_p.cpp @@ -122,7 +122,7 @@ void WaveDecoder::handleData() else { int bps = qFromLittleEndian(header.wave.bitsPerSample); - format.setCodec("audio/pcm"); + format.setCodec(QLatin1String("audio/pcm")); format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt); format.setByteOrder(QAudioFormat::LittleEndian); format.setFrequency(qFromLittleEndian(header.wave.sampleRate)); -- cgit v0.12 From fa23a63af230f0c917cc56e6c652c01e6695ef63 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 3 Mar 2010 12:56:07 +1000 Subject: Fix mouse stealing in nested flickables. Set intent to steal mouse, but don't steal the initiating event. This allows other, higher Flickables to override lower. Task-number: QTBUG-5292 --- .../graphicsitems/qdeclarativeflickable.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index c54ddd0..2fdd720 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -682,7 +682,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent else rejectY = true; } - if (!rejectY) { + if (!rejectY && stealMouse) { _moveY.setValue(newY); moved = true; } @@ -709,7 +709,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent else rejectX = true; } - if (!rejectX) { + if (!rejectX && stealMouse) { _moveX.setValue(newX); moved = true; } @@ -752,6 +752,8 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_Q(QDeclarativeFlickable); + stealMouse = false; + q->setKeepMouseGrab(false); pressed = false; if (lastPosTime.isNull()) return; @@ -781,7 +783,6 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv fixupX(); } - stealMouse = false; lastPosTime = QTime(); if (!timeline.isActive()) @@ -804,6 +805,8 @@ void QDeclarativeFlickable::mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_D(QDeclarativeFlickable); if (d->interactive) { d->handleMouseMoveEvent(event); + if (d->stealMouse) + setKeepMouseGrab(true); event->accept(); } else { QDeclarativeItem::mouseMoveEvent(event); @@ -1141,7 +1144,8 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) QGraphicsScene *s = scene(); QDeclarativeItem *grabber = s ? qobject_cast(s->mouseGrabberItem()) : 0; - if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { + bool stealThisEvent = d->stealMouse; + if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { mouseEvent.setAccepted(false); for (int i = 0x1; i <= 0x10; i <<= 1) { if (event->buttons() & i) { @@ -1176,17 +1180,19 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) break; } grabber = qobject_cast(s->mouseGrabberItem()); - if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this) { + if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) { d->clearDelayedPress(); grabMouse(); } - return d->stealMouse || d->delayedPressEvent; + return stealThisEvent || d->delayedPressEvent; } else if (!d->lastPosTime.isNull()) { d->lastPosTime = QTime(); } - if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) + if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { d->clearDelayedPress(); + d->stealMouse = false; + } return false; } -- cgit v0.12 From a2bddc74ca9d0c09f7c79077e0fbd981f1e9eccb Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 13:05:28 +1000 Subject: Ensure error is received - the root object is INITIALLY zero. --- .../auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index b677fec..dea88c4 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -663,10 +663,12 @@ void tst_qdeclarativetextedit::delegateLoading() QVERIFY(delegate); view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml")); view->show(); + QTRY_VERIFY(view->status()==QDeclarativeView::Error); view->setFocus(); QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); view->show(); + QTRY_VERIFY(view->status()==QDeclarativeView::Error); view->setFocus(); QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test //ErrorB should get a component which is ready but component.create() returns null -- cgit v0.12 From 2623211c0cd47a08b0acbd17b5ba42c2222a9e25 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 13:13:09 +1000 Subject: runnable from elsewhere --- .../declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 3a8a892..d23d74c 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -365,7 +365,7 @@ void tst_QDeclarativePositioners::test_grid_animated() } void tst_QDeclarativePositioners::test_propertychanges() { - QDeclarativeView *canvas = createView("data/propertychanges.qml"); + QDeclarativeView *canvas = createView(SRCDIR "/data/propertychanges.qml"); QDeclarativeGrid *grid = qobject_cast(canvas->rootObject()); QDeclarativeTransition *rowTransition = canvas->rootObject()->findChild("rowTransition"); -- cgit v0.12 From c92b1da931a56f97bf1812db922d43c8f692de8f Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Wed, 3 Mar 2010 13:13:45 +1000 Subject: Gstreamer playback backend: Start loading media on setMedia(), without waiting for play() or pause(). To keep behaviour consisten with the rest of backends. Reviewed-by: Andrew den Exter --- .../mediaplayer/qgstreamerplayercontrol.cpp | 133 ++++++++++++++++++--- .../mediaplayer/qgstreamerplayercontrol.h | 7 ++ .../mediaplayer/qgstreamerplayersession.cpp | 94 +++++++++------ .../mediaplayer/qgstreamerplayersession.h | 11 +- 4 files changed, 186 insertions(+), 59 deletions(-) diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index 2d7aaa8..e646693 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -59,6 +59,9 @@ QT_BEGIN_NAMESPACE QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent) : QMediaPlayerControl(parent) , m_session(session) + , m_state(QMediaPlayer::StoppedState) + , m_mediaStatus(QMediaPlayer::NoMedia) + , m_bufferProgress(-1) , m_stream(0) , m_fifoNotifier(0) , m_fifoCanWrite(false) @@ -77,11 +80,11 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio connect(m_session, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int))); connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)), - this, SIGNAL(stateChanged(QMediaPlayer::State))); - connect(m_session, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), - this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); + this, SLOT(updateState(QMediaPlayer::State))); connect(m_session,SIGNAL(bufferingProgressChanged(int)), - this, SIGNAL(bufferStatusChanged(int))); + this, SLOT(setBufferProgress(int))); + connect(m_session, SIGNAL(playbackFinished()), + this, SLOT(processEOS())); connect(m_session, SIGNAL(audioAvailableChanged(bool)), this, SIGNAL(audioAvailableChanged(bool))); connect(m_session, SIGNAL(videoAvailableChanged(bool)), @@ -114,17 +117,20 @@ qint64 QGstreamerPlayerControl::duration() const QMediaPlayer::State QGstreamerPlayerControl::state() const { - return m_session->state(); + return m_state; } QMediaPlayer::MediaStatus QGstreamerPlayerControl::mediaStatus() const { - return m_session->mediaStatus(); + return m_mediaStatus; } int QGstreamerPlayerControl::bufferStatus() const { - return 100; + if (m_bufferProgress == -1) { + return m_session->state() == QMediaPlayer::StoppedState ? 0 : 100; + } else + return m_bufferProgress; } int QGstreamerPlayerControl::volume() const @@ -169,23 +175,33 @@ void QGstreamerPlayerControl::setPosition(qint64 pos) void QGstreamerPlayerControl::play() { - m_session->play(); - - if (m_fifoFd[1] >= 0) { - m_fifoCanWrite = true; - - writeFifo(); + if (m_session->play()) { + if (m_state != QMediaPlayer::PlayingState) + emit stateChanged(m_state = QMediaPlayer::PlayingState); } } void QGstreamerPlayerControl::pause() { - m_session->pause(); + if (m_session->pause()) { + if (m_state != QMediaPlayer::PausedState) + emit stateChanged(m_state = QMediaPlayer::PausedState); + } } void QGstreamerPlayerControl::stop() { - m_session->stop(); + if (m_state != QMediaPlayer::StoppedState) { + m_session->pause(); + if (!m_session->seek(0)) { + m_bufferProgress = -1; + m_session->stop(); + m_session->pause(); + } + emit positionChanged(0); + if (m_state != QMediaPlayer::StoppedState) + emit stateChanged(m_state = QMediaPlayer::StoppedState); + } } void QGstreamerPlayerControl::setVolume(int volume) @@ -210,8 +226,15 @@ const QIODevice *QGstreamerPlayerControl::mediaStream() const void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *stream) { + QMediaPlayer::State oldState = m_state; + m_state = QMediaPlayer::StoppedState; m_session->stop(); + if (m_bufferProgress != -1) { + m_bufferProgress = -1; + emit bufferStatusChanged(0); + } + if (m_stream) { closeFifo(); @@ -234,7 +257,25 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice * m_session->load(url); + if (m_fifoFd[1] >= 0) { + m_fifoCanWrite = true; + + writeFifo(); + } + + if (!url.isEmpty()) { + if (m_mediaStatus != QMediaPlayer::LoadingMedia) + emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::LoadingMedia); + m_session->pause(); + } else { + if (m_mediaStatus != QMediaPlayer::NoMedia) + emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::NoMedia); + setBufferProgress(0); + } + emit mediaChanged(m_currentResource); + if (m_state != oldState) + emit stateChanged(m_state); } void QGstreamerPlayerControl::setVideoOutput(QObject *output) @@ -252,6 +293,68 @@ bool QGstreamerPlayerControl::isVideoAvailable() const return m_session->isVideoAvailable(); } +void QGstreamerPlayerControl::updateState(QMediaPlayer::State state) +{ + QMediaPlayer::MediaStatus oldStatus = m_mediaStatus; + + switch (state) { + case QMediaPlayer::StoppedState: + if (m_state != QMediaPlayer::StoppedState) + emit stateChanged(m_state = QMediaPlayer::StoppedState); + break; + + case QMediaPlayer::PlayingState: + case QMediaPlayer::PausedState: + if (m_state == QMediaPlayer::StoppedState) + m_mediaStatus = QMediaPlayer::LoadedMedia; + else { + if (m_bufferProgress == -1) + m_mediaStatus = QMediaPlayer::BufferedMedia; + } + break; + } + + if (m_mediaStatus != oldStatus) + emit mediaStatusChanged(m_mediaStatus); +} + +void QGstreamerPlayerControl::processEOS() +{ + m_mediaStatus = QMediaPlayer::EndOfMedia; + m_state = QMediaPlayer::StoppedState; + + emit stateChanged(m_state); + emit mediaStatusChanged(m_mediaStatus); +} + +void QGstreamerPlayerControl::setBufferProgress(int progress) +{ + if (m_bufferProgress == progress || m_mediaStatus == QMediaPlayer::NoMedia) + return; + + QMediaPlayer::MediaStatus oldStatus = m_mediaStatus; + + m_bufferProgress = progress; + + if (m_state == QMediaPlayer::StoppedState) { + m_mediaStatus = QMediaPlayer::LoadedMedia; + } else { + if (m_bufferProgress < 100) { + m_mediaStatus = QMediaPlayer::StalledMedia; + m_session->pause(); + } else { + m_mediaStatus = QMediaPlayer::BufferedMedia; + if (m_state == QMediaPlayer::PlayingState) + m_session->play(); + } + } + + if (m_mediaStatus != oldStatus) + emit mediaStatusChanged(m_mediaStatus); + + emit bufferStatusChanged(m_bufferProgress); +} + void QGstreamerPlayerControl::writeFifo() { if (m_fifoCanWrite) { diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h index ae0f8b6..0c53945 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h @@ -107,11 +107,18 @@ private Q_SLOTS: void writeFifo(); void fifoReadyWrite(int socket); + void updateState(QMediaPlayer::State); + void processEOS(); + void setBufferProgress(int progress); + private: bool openFifo(); void closeFifo(); QGstreamerPlayerSession *m_session; + QMediaPlayer::State m_state; + QMediaPlayer::MediaStatus m_mediaStatus; + int m_bufferProgress; QMediaContent m_currentResource; QIODevice *m_stream; QSocketNotifier *m_fifoNotifier; diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 600621e..e80e820 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) :QObject(parent), m_state(QMediaPlayer::StoppedState), - m_mediaStatus(QMediaPlayer::UnknownMediaStatus), m_busHelper(0), m_playbin(0), m_nullVideoOutput(0), @@ -115,6 +114,7 @@ QGstreamerPlayerSession::~QGstreamerPlayerSession() void QGstreamerPlayerSession::load(const QUrl &url) { m_url = url; + if (m_playbin) { m_tags.clear(); emit tagsChanged(); @@ -259,26 +259,36 @@ bool QGstreamerPlayerSession::isSeekable() const return m_seekable; } -void QGstreamerPlayerSession::play() +bool QGstreamerPlayerSession::play() { if (m_playbin) { if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { qWarning() << "GStreamer; Unable to play -" << m_url.toString(); - m_state = QMediaPlayer::StoppedState; - m_mediaStatus = QMediaPlayer::InvalidMedia; + m_state = QMediaPlayer::StoppedState; emit stateChanged(m_state); - emit mediaStatusChanged(m_mediaStatus); - emit error(int(QMediaPlayer::ResourceError), tr("Unable to play %1").arg(m_url.path())); - } + } else + return true; } + + return false; } -void QGstreamerPlayerSession::pause() +bool QGstreamerPlayerSession::pause() { - if (m_playbin) - gst_element_set_state(m_playbin, GST_STATE_PAUSED); + if (m_playbin) { + if (gst_element_set_state(m_playbin, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) { + qWarning() << "GStreamer; Unable to play -" << m_url.toString(); + m_state = QMediaPlayer::StoppedState; + + emit stateChanged(m_state); + emit error(int(QMediaPlayer::ResourceError), tr("Unable to play %1").arg(m_url.path())); + } else + return true; + } + + return false; } void QGstreamerPlayerSession::stop() @@ -292,12 +302,14 @@ void QGstreamerPlayerSession::stop() } } -void QGstreamerPlayerSession::seek(qint64 ms) +bool QGstreamerPlayerSession::seek(qint64 ms) { if (m_playbin && m_state != QMediaPlayer::StoppedState) { gint64 position = (gint64)ms * 1000000; - gst_element_seek_simple(m_playbin, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, position); + return gst_element_seek_simple(m_playbin, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, position); } + + return false; } void QGstreamerPlayerSession::setVolume(int volume) @@ -388,14 +400,6 @@ void QGstreamerPlayerSession::setSeekable(bool seekable) } } -void QGstreamerPlayerSession::setMediaStatus(QMediaPlayer::MediaStatus status) -{ - if (m_mediaStatus != status) { - m_mediaStatus = status; - emit mediaStatusChanged(status); - } -} - bool QGstreamerPlayerSession::processSyncMessage(const QGstreamerMessage &message) { GstMessage* gm = message.rawMessage(); @@ -440,9 +444,6 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message) if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_playbin)) { switch (GST_MESSAGE_TYPE(gm)) { - case GST_MESSAGE_DURATION: - break; - case GST_MESSAGE_STATE_CHANGED: { GstState oldState; @@ -462,24 +463,19 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message) switch (newState) { case GST_STATE_VOID_PENDING: case GST_STATE_NULL: - setMediaStatus(QMediaPlayer::UnknownMediaStatus); setSeekable(false); if (m_state != QMediaPlayer::StoppedState) emit stateChanged(m_state = QMediaPlayer::StoppedState); break; case GST_STATE_READY: - setMediaStatus(QMediaPlayer::LoadedMedia); setSeekable(false); if (m_state != QMediaPlayer::StoppedState) emit stateChanged(m_state = QMediaPlayer::StoppedState); break; case GST_STATE_PAUSED: - //don't emit state changes for intermediate states - if (m_state != QMediaPlayer::PausedState && pending == GST_STATE_VOID_PENDING) + if (m_state != QMediaPlayer::PausedState) emit stateChanged(m_state = QMediaPlayer::PausedState); - setMediaStatus(QMediaPlayer::LoadedMedia); - //check for seekable if (oldState == GST_STATE_READY) { /* @@ -513,17 +509,13 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message) if (m_state != QMediaPlayer::PlayingState) emit stateChanged(m_state = QMediaPlayer::PlayingState); + break; } } break; case GST_MESSAGE_EOS: - if (m_state != QMediaPlayer::StoppedState) - emit stateChanged(m_state = QMediaPlayer::StoppedState); - - setMediaStatus(QMediaPlayer::EndOfMedia); - emit playbackFinished(); break; @@ -546,7 +538,11 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message) case GST_MESSAGE_INFO: break; case GST_MESSAGE_BUFFERING: - setMediaStatus(QMediaPlayer::BufferingMedia); + { + int progress = 0; + gst_message_parse_buffering(gm, &progress); + emit bufferingProgressChanged(progress); + } break; case GST_MESSAGE_STATE_DIRTY: case GST_MESSAGE_STEP_DONE: @@ -556,8 +552,32 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message) case GST_MESSAGE_STRUCTURE_CHANGE: case GST_MESSAGE_APPLICATION: case GST_MESSAGE_ELEMENT: + break; case GST_MESSAGE_SEGMENT_START: + { + const GstStructure *structure = gst_message_get_structure(gm); + qint64 position = g_value_get_int64(gst_structure_get_value(structure, "position")); + position /= 1000000; + m_lastPosition = position; + emit positionChanged(position); + } + break; case GST_MESSAGE_SEGMENT_DONE: + break; + case GST_MESSAGE_DURATION: + { + GstFormat format = GST_FORMAT_TIME; + gint64 duration = 0; + + if (gst_element_query_duration(m_playbin, &format, &duration)) { + int newDuration = duration / 1000000; + if (m_duration != newDuration) { + m_duration = newDuration; + emit durationChanged(m_duration); + } + } + } + break; case GST_MESSAGE_LATENCY: #if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 13) case GST_MESSAGE_ASYNC_START: @@ -604,7 +624,7 @@ void QGstreamerPlayerSession::getStreamsInfo() haveAudio = audioStreamsCount > 0; haveVideo = videoStreamsCount > 0; - m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0; + /*m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0; m_playbin2StreamOffset[QMediaStreamsControl::VideoStream] = audioStreamsCount; m_playbin2StreamOffset[QMediaStreamsControl::SubPictureStream] = audioStreamsCount+videoStreamsCount; @@ -648,7 +668,9 @@ void QGstreamerPlayerSession::getStreamsInfo() } m_streamProperties.append(streamProperties); + } + */ #else enum { diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h index d650ec7..edfec5b 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h @@ -71,7 +71,6 @@ public: QUrl url() const; QMediaPlayer::State state() const { return m_state; } - QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; } qint64 duration() const; qint64 position() const; @@ -105,11 +104,11 @@ public: public slots: void load(const QUrl &url); - void play(); - void pause(); + bool play(); + bool pause(); void stop(); - void seek(qint64 pos); + bool seek(qint64 pos); void setVolume(int volume); void setMuted(bool muted); @@ -118,7 +117,6 @@ signals: void durationChanged(qint64 duration); void positionChanged(qint64 position); void stateChanged(QMediaPlayer::State state); - void mediaStatusChanged(QMediaPlayer::MediaStatus mediaStatus); void volumeChanged(int volume); void mutedStateChanged(bool muted); void audioAvailableChanged(bool audioAvailable); @@ -137,11 +135,8 @@ private slots: void setSeekable(bool); private: - void setMediaStatus(QMediaPlayer::MediaStatus); - QUrl m_url; QMediaPlayer::State m_state; - QMediaPlayer::MediaStatus m_mediaStatus; QGstreamerBusHelper* m_busHelper; GstElement* m_playbin; GstElement* m_nullVideoOutput; -- cgit v0.12 From e6e7dd15ca71d071ad3be5a0a5b300c44ca3070a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 13:14:37 +1000 Subject: remove debugger --- .../qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index f3caa7f..92f7aef 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -50,7 +50,6 @@ class tst_qdeclarativemoduleplugin : public QObject public: tst_qdeclarativemoduleplugin() { QCoreApplication::addLibraryPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin")); -qDebug() << QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin"); } private slots: -- cgit v0.12 From 991398a5a921e1f01bb8966d3a6bf4f636a1fa62 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 13:35:44 +1000 Subject: make runnable from elsewhere --- .../qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index 37d48fa..7dec0ee 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -1168,7 +1168,7 @@ void tst_qdeclarativexmlhttprequest::redirects() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html"); - server.serveDirectory("data"); + server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine, TEST_FILE("redirects.qml")); QObject *object = component.beginCreate(engine.rootContext()); @@ -1187,7 +1187,7 @@ void tst_qdeclarativexmlhttprequest::redirects() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html"); - server.serveDirectory("data"); + server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine, TEST_FILE("redirectError.qml")); QObject *object = component.beginCreate(engine.rootContext()); @@ -1206,7 +1206,7 @@ void tst_qdeclarativexmlhttprequest::redirects() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html"); - server.serveDirectory("data"); + server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine, TEST_FILE("redirectRecur.qml")); QObject *object = component.beginCreate(engine.rootContext()); -- cgit v0.12 From fdc857a176cf86970981e6d3c814725ca674b307 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 3 Mar 2010 14:06:35 +1000 Subject: Add import Qt.widgets 4.6 to layout.qml example --- examples/declarative/layouts/layouts.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/layouts/layouts.qml b/examples/declarative/layouts/layouts.qml index accd969..4b2a3f8 100644 --- a/examples/declarative/layouts/layouts.qml +++ b/examples/declarative/layouts/layouts.qml @@ -1,5 +1,5 @@ import Qt 4.6 - +import Qt.widgets 4.6 Item { id: resizable width:400 -- cgit v0.12 From 24a695673cc53b224dd3fac44e924a41f8ea20a5 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 14:22:45 +1000 Subject: Fix settings (was not exported type). --- src/imports/webkit/plugin.cpp | 1 + src/imports/webkit/qdeclarativewebview.cpp | 2 +- src/imports/webkit/qdeclarativewebview_p.h | 5 +++-- src/imports/webkit/qdeclarativewebview_p_p.h | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/imports/webkit/plugin.cpp b/src/imports/webkit/plugin.cpp index 2f6205d..799fe9e 100644 --- a/src/imports/webkit/plugin.cpp +++ b/src/imports/webkit/plugin.cpp @@ -54,6 +54,7 @@ public: virtual void registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit")); + QML_REGISTER_NOCREATE_TYPE(QDeclarativeWebSettings); qmlRegisterType(uri,1,0,"WebView"); } }; diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp index 733ac86..d78ba28 100644 --- a/src/imports/webkit/qdeclarativewebview.cpp +++ b/src/imports/webkit/qdeclarativewebview.cpp @@ -931,7 +931,7 @@ QWebPage *QDeclarativeWebView::page() const } \endqml */ -QObject *QDeclarativeWebView::settingsObject() const +QDeclarativeWebSettings *QDeclarativeWebView::settingsObject() const { Q_D(const QDeclarativeWebView); d->settings.s = page()->settings(); diff --git a/src/imports/webkit/qdeclarativewebview_p.h b/src/imports/webkit/qdeclarativewebview_p.h index 5efc3b5..145e74b 100644 --- a/src/imports/webkit/qdeclarativewebview_p.h +++ b/src/imports/webkit/qdeclarativewebview_p.h @@ -59,6 +59,7 @@ class QWebSettings; QT_BEGIN_NAMESPACE QT_MODULE(Declarative) +class QDeclarativeWebSettings; class QDeclarativeWebViewPrivate; class QNetworkRequest; class QDeclarativeWebView; @@ -113,7 +114,7 @@ class WEBKITQMLPLUGIN_EXPORT QDeclarativeWebView : public QDeclarativePaintedIte Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) Q_PROPERTY(QAction* stop READ stopAction CONSTANT) - Q_PROPERTY(QObject* settings READ settingsObject CONSTANT) + Q_PROPERTY(QDeclarativeWebSettings* settings READ settingsObject CONSTANT) Q_PROPERTY(QDeclarativeListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) @@ -170,7 +171,7 @@ public: QWebHistory *history() const; QWebSettings *settings() const; - QObject *settingsObject() const; + QDeclarativeWebSettings *settingsObject() const; bool renderingEnabled() const; void setRenderingEnabled(bool); diff --git a/src/imports/webkit/qdeclarativewebview_p_p.h b/src/imports/webkit/qdeclarativewebview_p_p.h index 258b472..3ad9e9a 100644 --- a/src/imports/webkit/qdeclarativewebview_p_p.h +++ b/src/imports/webkit/qdeclarativewebview_p_p.h @@ -42,6 +42,8 @@ #ifndef QDECLARATIVEWEBVIEW_P_H #define QDECLARATIVEWEBVIEW_P_H +#include "webkitqmlplugin_export.h" + #include #include @@ -52,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeWebSettings : public QObject { +class WEBKITQMLPLUGIN_EXPORT QDeclarativeWebSettings : public QObject { Q_OBJECT Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) -- cgit v0.12 From 0994b819f6cbf550c067146324f24489d0b4fa1d Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Wed, 3 Mar 2010 14:22:54 +1000 Subject: Use mute property instead of setting volume to 0 if playbin2 is used. Task-number: QTMOBILITY-67 Reviewed-by: Andrew den Exter --- .../mediaplayer/qgstreamerplayersession.cpp | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp index e80e820..be2273b 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -314,21 +314,33 @@ bool QGstreamerPlayerSession::seek(qint64 ms) void QGstreamerPlayerSession::setVolume(int volume) { - m_volume = volume; - emit volumeChanged(m_volume); + if (m_volume != volume) { + m_volume = volume; - if (!m_muted && m_playbin) - g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL); + if (m_playbin) { +#ifndef USE_PLAYBIN2 + if(!m_muted) +#endif + g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL); + } + + emit volumeChanged(m_volume); + } } void QGstreamerPlayerSession::setMuted(bool muted) { - m_muted = muted; + if (m_muted != muted) { + m_muted = muted; - g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL); - - emit mutedStateChanged(m_muted); +#ifdef USE_PLAYBIN2 + g_object_set(G_OBJECT(m_playbin), "mute", m_muted, NULL); +#else + g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL); +#endif + emit mutedStateChanged(m_muted); + } } static void addTagToMap(const GstTagList *list, -- cgit v0.12 From 61e29b6b4b1f96fecad1ad105cd190beed6621e6 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Wed, 3 Mar 2010 14:24:22 +1000 Subject: Gstreamer media backend: ensure the null video output is not deleted during player session lifetime Reviewed-by: Andrew den Exter --- .../mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp index be2273b..392a7a8 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -91,6 +91,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) m_busHelper->installSyncEventFilter(this); m_nullVideoOutput = gst_element_factory_make("fakesink", NULL); + gst_object_ref(GST_OBJECT(m_nullVideoOutput)); g_object_set(G_OBJECT(m_playbin), "video-sink", m_nullVideoOutput, NULL); // Initial volume @@ -108,6 +109,7 @@ QGstreamerPlayerSession::~QGstreamerPlayerSession() delete m_busHelper; gst_object_unref(GST_OBJECT(m_bus)); gst_object_unref(GST_OBJECT(m_playbin)); + gst_object_unref(GST_OBJECT(m_nullVideoOutput)); } } -- cgit v0.12 From 4e5cf3f0936ed921973e451e23414059e1a9fc6b Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 3 Mar 2010 14:36:48 +1000 Subject: add colorbrowser qml example This example shows how to use qml packages to animate between pathview, gridview and listview. --- examples/declarative/colorbrowser/colorbrowser.qml | 101 ++++++++++++++++++ .../colorbrowser/dummydata/ColorsModel.qml | 96 +++++++++++++++++ .../declarative/colorbrowser/qml/ColorDelegate.qml | 114 +++++++++++++++++++++ .../declarative/colorbrowser/qml/box-shadow.png | Bin 0 -> 871 bytes examples/declarative/colorbrowser/qml/box.png | Bin 0 -> 765 bytes 5 files changed, 311 insertions(+) create mode 100644 examples/declarative/colorbrowser/colorbrowser.qml create mode 100644 examples/declarative/colorbrowser/dummydata/ColorsModel.qml create mode 100644 examples/declarative/colorbrowser/qml/ColorDelegate.qml create mode 100644 examples/declarative/colorbrowser/qml/box-shadow.png create mode 100644 examples/declarative/colorbrowser/qml/box.png diff --git a/examples/declarative/colorbrowser/colorbrowser.qml b/examples/declarative/colorbrowser/colorbrowser.qml new file mode 100644 index 0000000..ebd49c6 --- /dev/null +++ b/examples/declarative/colorbrowser/colorbrowser.qml @@ -0,0 +1,101 @@ +import Qt 4.6 +import 'qml' + +Rectangle { + id: mainWindow + width: 800; height: 480; color: '#454545' + + VisualDataModel { id: colorsVisualModel; delegate: colorsDelegate; model: ColorsModel } + + Component { + id: colorsDelegate + Package { + + Item { + Package.name: 'grid' + GridView { + id: gridView; model: visualModel.parts.grid; width: mainWindow.width; height: mainWindow.height + cellWidth: 160; cellHeight: 160; interactive: false + onCurrentIndexChanged: listView.positionViewAtIndex(currentIndex) + } + } + + Item { + Package.name: 'fullscreen' + ListView { + id: listView; model: visualModel.parts.list; orientation: Qt.Horizontal + width: mainWindow.width; height: mainWindow.height; interactive: false + onCurrentIndexChanged: gridView.positionViewAtIndex(currentIndex) + highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem + } + } + + Item { + Package.name: 'stack' + id: wrapper + width: 260; height: 240 + + VisualDataModel { id: visualModel; model: colors; delegate: ColorDelegate {} } + + PathView { + id: pathView; model: visualModel.parts.stack; anchors.centerIn: parent + pathItemCount: 3 + path: Path { + PathAttribute { name: 'z'; value: 9999.0 } + PathLine { x: 1; y: 1 } + PathAttribute { name: 'z'; value: 0.0 } + } + } + + Item { + anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.bottomMargin: 20 + width: albumTitle.width + 20 ; height: albumTitle.height + 4 + Text { id: albumTitle; text: name; color: 'white'; font.bold: true; anchors.centerIn: parent } + } + + MouseRegion { anchors.fill: parent; onClicked: wrapper.state = 'inGrid' } + + states: [ + State { + name: 'inGrid' + PropertyChanges { target: gridView; interactive: true } + PropertyChanges { target: shade; opacity: 1 } + }, + State { + name: 'fullscreen'; extend: 'inGrid' + PropertyChanges { target: gridView; interactive: false } + PropertyChanges { target: listView; interactive: true } + PropertyChanges { target: infobox; opacity: 1 } + } + ] + + transitions: [ + Transition { + from: ''; to: 'inGrid'; reversible: true + NumberAnimation { target: shade; properties: 'opacity'; duration: 300 } + }, + Transition { + from: 'inGrid'; to: 'fullscreen'; reversible: true + SequentialAnimation { + PauseAnimation { duration: 300 } + NumberAnimation { target: infobox; properties: 'opacity'; duration: 300 } + } + } + ] + } + } + } + + GridView { width: parent.width; height: parent.height; cellWidth: 260; cellHeight: 240; model: colorsVisualModel.parts.stack } + Rectangle { id: shade; color: '#454545'; width: parent.width; height: parent.height; opacity: 0 } + ListView { anchors.fill: parent; model: colorsVisualModel.parts.grid; interactive: false } + ListView { anchors.fill: parent; model: colorsVisualModel.parts.fullscreen; interactive: false } + Item { id: foreground; anchors.fill: parent } + + Column { + id: infobox; opacity: 0 + anchors { left: parent.left; leftMargin: 20; bottom: parent.bottom; bottomMargin: 20 } + Text { id: infoColorName; color: '#eeeeee'; style: Text.Outline; styleColor: '#222222'; font.pointSize: 18 } + Text { id: infoColorHex; color: '#eeeeee'; style: Text.Outline; styleColor: '#222222'; font.pointSize: 14 } + } +} diff --git a/examples/declarative/colorbrowser/dummydata/ColorsModel.qml b/examples/declarative/colorbrowser/dummydata/ColorsModel.qml new file mode 100644 index 0000000..eefbcfe --- /dev/null +++ b/examples/declarative/colorbrowser/dummydata/ColorsModel.qml @@ -0,0 +1,96 @@ +import Qt 4.6 + +ListModel { + id: colorsModel + + ListElement { + name: "Reds" + colors: [ + ListElement { name: "Fire Brick"; hex: "#B22222" }, + ListElement { name: "Fire Brick 1"; hex: "#FF3030" }, + ListElement { name: "Fire Brick 2"; hex: "#EE2C2C" }, + ListElement { name: "Fire Brick 3"; hex: "#CD2626" }, + ListElement { name: "Fire Brick 4"; hex: "#8B1A1A" }, + ListElement { name: "Red"; hex: "#FF0000" }, + ListElement { name: "Red 2"; hex: "#EE0000" }, + ListElement { name: "Red 3"; hex: "#CD0000" }, + ListElement { name: "Red 4"; hex: "#8B0000" }, + ListElement { name: "Tomato"; hex: "#FF6347" }, + ListElement { name: "Tomato 2"; hex: "#EE5C42" }, + ListElement { name: "Tomato 3"; hex: "#CD4F39" }, + ListElement { name: "Tomato 4"; hex: "#8B3626" }, + ListElement { name: "Orange Red"; hex: "#FF4500" }, + ListElement { name: "Orange Red 2"; hex: "#EE4000" }, + ListElement { name: "Orange Red 3"; hex: "#CD3700" }, + ListElement { name: "Orange Red 4"; hex: "#8B2500" }, + ListElement { name: "Indian Red 2"; hex: "#EE6363" }, + ListElement { name: "Indian Red 3"; hex: "#CD5555" }, + ListElement { name: "Indian Red 4"; hex: "#8B3A3A" }, + ListElement { name: "Brown"; hex: "#A52A2A" }, + ListElement { name: "Brown 1"; hex: "#FF4040" }, + ListElement { name: "Brown 2"; hex: "#EE3B3B" }, + ListElement { name: "Brown 3"; hex: "#CD3333" }, + ListElement { name: "Brown 4"; hex: "#8B2323" } + ] + } + ListElement { + name: "Greens" + colors: [ + ListElement { name: "Green"; hex: "#008000" }, + ListElement { name: "Green 2"; hex: "#00EE00" }, + ListElement { name: "Green 3"; hex: "#00CD00" }, + ListElement { name: "Green 4"; hex: "#008B00" }, + ListElement { name: "Dark Green"; hex: "#006400" }, + ListElement { name: "Sap Green"; hex: "#308014" }, + ListElement { name: "Medium Spring Green"; hex: "#00FA9A" }, + ListElement { name: "Spring Green"; hex: "#00FF7F" }, + ListElement { name: "Spring Green 1"; hex: "#00EE76" }, + ListElement { name: "Spring Green 2"; hex: "#00CD66" }, + ListElement { name: "Spring Green 3"; hex: "#008B45" }, + ListElement { name: "Medium Sea Green"; hex: "#3CB371" }, + ListElement { name: "Sea Green 1"; hex: "#54FF9F" }, + ListElement { name: "Sea Green 2"; hex: "#4EEE94" }, + ListElement { name: "Sea Green 3"; hex: "#43CD80" }, + ListElement { name: "Sea Green 4"; hex: "#2E8B57" }, + ListElement { name: "Emerald Green"; hex: "#00C957" }, + ListElement { name: "Mint"; hex: "#BDFCC9" }, + ListElement { name: "Cobalt Green"; hex: "#3D9140" }, + ListElement { name: "Dark Sea Green"; hex: "#8FBC8F" }, + ListElement { name: "Dark Sea Green 1"; hex: "#C1FFC1" }, + ListElement { name: "Dark Sea Green 2"; hex: "#B4EEB4" }, + ListElement { name: "Dark Sea Green 3"; hex: "#9BCD9B" }, + ListElement { name: "Dark Sea Green 4"; hex: "#698B69" }, + ListElement { name: "Lime Green"; hex: "#00FF00" } + ] + } + ListElement { + name: "Blues" + colors: [ + ListElement { name: "Dark Slate Blue"; hex: "#483D8B" }, + ListElement { name: "Light Slate Blue"; hex: "#8470FF" }, + ListElement { name: "Medium Slate Blue"; hex: "#7B68EE" }, + ListElement { name: "Slate Blue"; hex: "#6A5ACD" }, + ListElement { name: "Blue"; hex: "#0000FF" }, + ListElement { name: "Midnight Blue"; hex: "#191970" }, + ListElement { name: "Cobalt"; hex: "#3D59AB" }, + ListElement { name: "Royal Blue"; hex: "#4169E1" }, + ListElement { name: "Corn Flower Blue"; hex: "#6495ED" }, + ListElement { name: "Light Steel Blue"; hex: "#B0C4DE" }, + ListElement { name: "Light Steel Blue 1"; hex: "#CAE1FF" }, + ListElement { name: "Light Steel Blue 2"; hex: "#BCD2EE" }, + ListElement { name: "Light Steel Blue 3"; hex: "#A2B5CD" }, + ListElement { name: "Dodger Blue"; hex: "#1E90FF" }, + ListElement { name: "Dodger Blue 2"; hex: "#1C86EE" }, + ListElement { name: "Dodger Blue 3"; hex: "#1874CD" }, + ListElement { name: "Dodger Blue 4"; hex: "#104E8B" }, + ListElement { name: "Steel Blue"; hex: "#4682B4" }, + ListElement { name: "Light Sky Blue"; hex: "#87CEFA" }, + ListElement { name: "Sky Blue"; hex: "#87CEEB" }, + ListElement { name: "Peacock"; hex: "#33A1C9" }, + ListElement { name: "Light Blue"; hex: "#ADD8E6" }, + ListElement { name: "Powder Blue"; hex: "#B0E0E6" }, + ListElement { name: "Cadet Blue"; hex: "#5F9EA0" }, + ListElement { name: "Cyan"; hex: "#00FFFF" } + ] + } +} diff --git a/examples/declarative/colorbrowser/qml/ColorDelegate.qml b/examples/declarative/colorbrowser/qml/ColorDelegate.qml new file mode 100644 index 0000000..605e45b --- /dev/null +++ b/examples/declarative/colorbrowser/qml/ColorDelegate.qml @@ -0,0 +1,114 @@ +import Qt 4.6 + +Package { + Item { id: stack; Package.name: 'stack'; width: 110; height: 110; z: stack.PathView.z } + Item { id: list; Package.name: 'list'; width: mainWindow.width + 4; height: 110 } + Item { id: grid; Package.name: 'grid'; width: 110; height: 110 } + + Item { + id: delegate + + property double randomAngle: Math.random() * (2 * 8 + 1) - 8 + property bool open: false + + width: 110; height: 110; z: stack.PathView.z + + Image { x: -6; y: -5; source: 'box-shadow.png'; smooth: true; } + Rectangle { color: hex; anchors.fill: parent; smooth: true } + Image { id: box; source: 'box.png'; smooth: true; anchors.fill: parent } + + Binding { + target: infoColorName; property: 'text' + value: name; when: delegate.open && list.ListView.isCurrentItem + } + + Binding { + target: infoColorHex; property: 'text' + value: hex; when: delegate.open && list.ListView.isCurrentItem + } + + MouseRegion { + anchors.fill: parent + acceptedButtons: Qt.RightButton | Qt.LeftButton + onClicked: { + if (wrapper.state == 'inGrid' && mouse.button == Qt.RightButton) { + wrapper.state = '' + } else if (wrapper.state == 'inGrid') { + grid.GridView.view.currentIndex = index; + wrapper.state = 'fullscreen' + } else { + grid.GridView.view.currentIndex = index; + wrapper.state = 'inGrid' + } + } + } + + states: [ + State { + name: 'stacked'; when: wrapper.state == '' + ParentChange { target: delegate; parent: stack; x: 0; y: 0; rotation: delegate.randomAngle } + PropertyChanges { target: delegate; visible: stack.PathView.onPath ? 1.0 : 0.0 } + }, + State { + name: 'inGrid'; when: wrapper.state == 'inGrid' + ParentChange { target: delegate; parent: grid; x: 24; y: 24 } + PropertyChanges { target: delegate; open: true } + }, + State { + name: 'fullscreen'; when: wrapper.state == 'fullscreen' + ParentChange { target: delegate; parent: list; x: 0; y: 0; width: mainWindow.width; height: mainWindow.height } + PropertyChanges { target: box; opacity: 0 } + PropertyChanges { target: delegate; open: true } + } + ] + + transitions: [ + Transition { + from: 'stacked'; to: 'inGrid' + SequentialAnimation { + PauseAnimation { duration: 20 * index } + ParentAnimation { + target: delegate; via: foreground + NumberAnimation { targets: delegate; properties: 'x,y,width,height,rotation'; duration: 600; easing.type: 'OutBack' } + } + } + }, + Transition { + from: 'inGrid'; to: 'stacked' + ParentAnimation { + target: delegate; via: foreground + NumberAnimation { properties: 'x,y,width,height,rotation'; duration: 300; easing.type: 'InOutQuad' } + } + }, + Transition { + from: 'inGrid'; to: 'fullscreen' + SequentialAnimation { + PauseAnimation { duration: grid.GridView.isCurrentItem ? 0 : 300 } + ParentAnimation { + target: delegate; via: foreground + NumberAnimation { + properties: 'x,y,width,height,opacity' + duration: grid.GridView.isCurrentItem ? 300 : 1; easing.type: 'InOutQuad' + } + } + } + }, + Transition { + from: 'fullscreen'; to: 'inGrid' + SequentialAnimation { + PauseAnimation { duration: grid.GridView.isCurrentItem ? 3 : 0 } + ParallelAnimation { + ParentAnimation { + target: delegate; via: foreground + NumberAnimation { + properties: 'x,y,width,height' + duration: grid.GridView.isCurrentItem ? 300 : 1; easing.type: 'InOutQuad' + } + } + NumberAnimation { properties: 'opacity'; duration: grid.GridView.isCurrentItem ? 300 : 1; easing.type: 'InOutQuad' } + } + } + } + ] + } +} diff --git a/examples/declarative/colorbrowser/qml/box-shadow.png b/examples/declarative/colorbrowser/qml/box-shadow.png new file mode 100644 index 0000000..3281a37 Binary files /dev/null and b/examples/declarative/colorbrowser/qml/box-shadow.png differ diff --git a/examples/declarative/colorbrowser/qml/box.png b/examples/declarative/colorbrowser/qml/box.png new file mode 100644 index 0000000..86538aa Binary files /dev/null and b/examples/declarative/colorbrowser/qml/box.png differ -- cgit v0.12 From 7d4000b8df8792d286a50a3fac45ce638d943fd7 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 14:39:17 +1000 Subject: silence debuggery --- .../qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp index 26ff3d5..a9a0077 100644 --- a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp +++ b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp @@ -172,9 +172,11 @@ tst_qdeclarativenumberformatter::tst_qdeclarativenumberformatter() << "00,000,001.0000" << "00,000,001.0100"; // end + /* qDebug() << "strings.size()" << strings.size() << "\nformats.size()" << formats.size() << "texts.size()" << texts.size(); + */ } void tst_qdeclarativenumberformatter::text_data() -- cgit v0.12 From 6e486bdd5cc8370df7752eda2fa9f75b0a962124 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 14:43:38 +1000 Subject: Disable until plugin objects problem resolved. --- tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index 1d6bedc..f2ea076 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -181,6 +181,8 @@ void tst_qdeclarativewebview::settings() QVERIFY(wv != 0); QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); + qWarning("Need to test settings"); + /* QObject *s = qvariant_cast(wv->property("settings")); // merely tests that setting gets stored (in QWebSettings) @@ -236,6 +238,7 @@ void tst_qdeclarativewebview::settings() QVERIFY(s->property("privateBrowsingEnabled") == on); QVERIFY(s->property("zoomTextOnly") == on); } + */ } void tst_qdeclarativewebview::historyNav() -- cgit v0.12 From ca88b39490ef09b56cab5f933c9e33e5a2f5a498 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 3 Mar 2010 14:46:03 +1000 Subject: fix connecting to an ID. --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 598d2f0..a758a4b 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -170,7 +170,7 @@ void QCoreWlanEngine::connectToId(const QString &id) while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile - if(id == nsstringToQString([wProfile ssid])) { + if(id == QString::number(qHash(QLatin1String("corewlan:") + nsstringToQString([wProfile ssid])))) { user8021XProfile = nil; user8021XProfile = [ wProfile user8021XProfile]; -- cgit v0.12 From a2c2a287e6c405200ef990f3dddae9d229aac722 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Mar 2010 14:36:17 +1000 Subject: Fix incorrect scope resolution for script in a script block. Make sure global variables in a script file are searched before component properties. Task-number: QTBUG-8641 --- src/declarative/qml/qdeclarativecontext.cpp | 1 + .../declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index b244cd8..57ef90c 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -78,6 +78,7 @@ void QDeclarativeContextPrivate::addScript(const QDeclarativeParser::Object::Scr QScriptValue scope = scriptEngine->newObject(); scriptContext->setActivationObject(scope); + scriptContext->pushScope(scope); for (int ii = 0; ii < script.codes.count(); ++ii) { scriptEngine->evaluate(script.codes.at(ii), script.files.at(ii), script.lineNumbers.at(ii)); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 8e7944d..85a3ef3 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1678,7 +1678,6 @@ void tst_qdeclarativeecmascript::scriptScope() MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); emit object->basicSignal(); - QEXPECT_FAIL("", "QTBUG-8641", Continue); QCOMPARE(object->property("result").toString(), QLatin1String("world")); delete object; -- cgit v0.12 From a40a5fde406855473ba5f4cfa78208ee5efd9cb1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 14:58:55 +1000 Subject: fix crash, re-enable settings test --- .../declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index f2ea076..b63e14b 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -181,9 +181,8 @@ void tst_qdeclarativewebview::settings() QVERIFY(wv != 0); QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - qWarning("Need to test settings"); - /* - QObject *s = qvariant_cast(wv->property("settings")); + QObject *s = QDeclarativeProperty(wv,"settings").object(); + QVERIFY(s != 0); // merely tests that setting gets stored (in QWebSettings) // behavioural tests are in WebKit. @@ -238,7 +237,6 @@ void tst_qdeclarativewebview::settings() QVERIFY(s->property("privateBrowsingEnabled") == on); QVERIFY(s->property("zoomTextOnly") == on); } - */ } void tst_qdeclarativewebview::historyNav() -- cgit v0.12 From 004f77f8ab4d07499116d151d6f2b015b57effac Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 14:59:18 +1000 Subject: OS-friendlier, less noisy. --- tests/auto/declarative/runall.sh | 81 ++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/tests/auto/declarative/runall.sh b/tests/auto/declarative/runall.sh index 39485d3..62e03e3 100755 --- a/tests/auto/declarative/runall.sh +++ b/tests/auto/declarative/runall.sh @@ -41,37 +41,60 @@ ## ############################################################################/ -Xnest :7 2>/dev/null & -sleep 1 -trap "kill $!" EXIT -export DISPLAY=:7 +if [ "$(uname)" = Linux ] +then + Xnest :7 2>/dev/null & + sleep 1 + trap "kill $!" EXIT + export DISPLAY=:7 + export LANG=en_US + kwin 2>/dev/null & + sleep 1 +fi -( make -k -j1 install 2>&1; - for exe in $(make install | sed -n 's/^install .* "\([^"]*qt4\/tst_[^"]*\)".*/\1/p') - do - $exe - done -) | +function filter +{ + exe=$1 + skip=0 while read line do - case "$line" in - make*Error) echo "$line";; - make*Stop) echo "$line";; - make*) ;; - install*) ;; - */qmake*) ;; - */bin/moc*) ;; - *targ.debug*) ;; - g++*) ;; - cd*) ;; - PASS*) ;; - QDEBUG*) ;; - Makefile*) ;; - Config*) ;; - Totals*) ;; - \**) ;; - ./*) ;; - *) echo "$line" - esac + if [ $skip != 0 ] + then + let skip=skip-1 + else + case "$line" in + make*Error) echo "$line";; + make*Stop) echo "$line";; + /*/bin/make*) ;; + make*) ;; + install*) ;; + QDeclarativeDebugServer:*Waiting*) ;; + QDeclarativeDebugServer:*Connection*) ;; + */qmake*) ;; + */bin/moc*) ;; + *targ.debug*) ;; + g++*) ;; + cd*) ;; + XFAIL*) skip=1;; + SKIP*) skip=1;; + PASS*) ;; + QDEBUG*) ;; + Makefile*) ;; + Config*) ;; + Totals*) ;; + \**) ;; + ./*) ;; + *tst_*) echo "$line" ;; + *) echo "$exe: $line" + esac + fi done +} + +make -k -j1 install 2>&1 | filter build +for exe in $(make install | sed -n 's/^install .* "\([^"]*qt4\/tst_[^"]*\)".*/\1/p') +do + echo $exe + $exe 2>&1 | filter $exe +done -- cgit v0.12 From 2ef17050f740b4e0debc43f66f26f419b317b7ab Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 3 Mar 2010 15:15:47 +1000 Subject: QDeclarativeGuard should handle objects being deleted --- src/declarative/qml/qdeclarativedeclarativedata_p.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h index a7a73bc..ae40130 100644 --- a/src/declarative/qml/qdeclarativedeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h @@ -120,6 +120,11 @@ public: template void QDeclarativeGuard::addGuard() { + if (QObjectPrivate::get(o)->wasDeleted) { + if (prev) remGuard(); + return; + } + QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(o, true); next = data->guards; if (next) reinterpret_cast *>(next)->prev = &next; -- cgit v0.12 From 55cec1c8e73f90f968ce181c3310e5e16f2d5bd8 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 3 Mar 2010 15:22:25 +1000 Subject: Fixed compile of some tests with `-qtnamespace' --- tests/auto/declarative/qdeclarativelanguage/testtypes.h | 3 +++ tests/auto/qmediaservice/tst_qmediaservice.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index 8ac7aa6..09cddcb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -62,7 +62,10 @@ public: MyInterface() : id(913) {} int id; }; + +QT_BEGIN_NAMESPACE Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface"); +QT_END_NAMESPACE QML_DECLARE_INTERFACE(MyInterface); struct MyCustomVariantType diff --git a/tests/auto/qmediaservice/tst_qmediaservice.cpp b/tests/auto/qmediaservice/tst_qmediaservice.cpp index 35f661d..a0cb69d 100644 --- a/tests/auto/qmediaservice/tst_qmediaservice.cpp +++ b/tests/auto/qmediaservice/tst_qmediaservice.cpp @@ -69,7 +69,9 @@ class QtTestMediaControlA : public QMediaControl #define QtTestMediaControlA_iid "com.nokia.QtTestMediaControlA" +QT_BEGIN_NAMESPACE Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlA, QtTestMediaControlA_iid) +QT_END_NAMESPACE class QtTestMediaControlB : public QMediaControl @@ -78,7 +80,9 @@ class QtTestMediaControlB : public QMediaControl }; #define QtTestMediaControlB_iid "com.nokia.QtTestMediaControlB" +QT_BEGIN_NAMESPACE Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlB, QtTestMediaControlB_iid) +QT_END_NAMESPACE class QtTestMediaControlC : public QMediaControl @@ -87,7 +91,9 @@ class QtTestMediaControlC : public QMediaControl }; #define QtTestMediaControlC_iid "com.nokia.QtTestMediaControlC" +QT_BEGIN_NAMESPACE Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlC, QtTestMediaControlA_iid) // Yes A. +QT_END_NAMESPACE class QtTestMediaControlD : public QMediaControl { @@ -95,7 +101,9 @@ class QtTestMediaControlD : public QMediaControl }; #define QtTestMediaControlD_iid "com.nokia.QtTestMediaControlD" +QT_BEGIN_NAMESPACE Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlD, QtTestMediaControlD_iid) +QT_END_NAMESPACE class QtTestMediaControlE : public QMediaControl { -- cgit v0.12 From 0b44693aec2eed33cb54876edb7641e981aa883c Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 3 Mar 2010 16:16:43 +1000 Subject: 4.6.x compat --- src/declarative/graphicsitems/qdeclarativeparticles.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativeparticles.cpp b/src/declarative/graphicsitems/qdeclarativeparticles.cpp index 1a58d3f..deabdd6 100644 --- a/src/declarative/graphicsitems/qdeclarativeparticles.cpp +++ b/src/declarative/graphicsitems/qdeclarativeparticles.cpp @@ -1260,7 +1260,11 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics const int myX = x() + parentItem()->x(); const int myY = y() + parentItem()->y(); +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QVarLengthArray pixmapData; +#else + QVarLengthArray pixmapData; +#endif pixmapData.resize(d->particles.count()); const QRectF sourceRect = d->image.rect(); @@ -1268,20 +1272,32 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics qreal halfPHeight = sourceRect.height()/2.; for (int i = 0; i < d->particles.count(); ++i) { const QDeclarativeParticle &particle = d->particles.at(i); +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) pixmapData[i].x = particle.x - myX + halfPWidth; pixmapData[i].y = particle.y - myY + halfPHeight; +#else + pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight); +#endif pixmapData[i].opacity = particle.opacity; //these never change pixmapData[i].rotation = 0; pixmapData[i].scaleX = 1; pixmapData[i].scaleY = 1; +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) pixmapData[i].sourceLeft = sourceRect.left(); pixmapData[i].sourceTop = sourceRect.top(); pixmapData[i].width = sourceRect.width(); pixmapData[i].height = sourceRect.height(); +#else + pixmapData[i].source = sourceRect; +#endif } +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image); +#else + qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image); +#endif } void QDeclarativeParticles::componentComplete() -- cgit v0.12 From 7d2471e3beba5745fb5ea4dade3188e643f6b562 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 3 Mar 2010 16:25:21 +1000 Subject: Auto test for QTBUG-8677 --- .../declarative/qdeclarativelanguage/data/attachedProperties.qml | 2 ++ tests/auto/declarative/qdeclarativelanguage/testtypes.h | 7 +++++-- .../declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml index b46ec34..aecb3c3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml @@ -3,6 +3,8 @@ import Test 1.0 as Namespace import Qt 4.6 QtObject { + property int value2: 8 MyQmlObject.value: 10 Namespace.MyQmlObject.value2: 13 + MyQmlObject.onValueChanged: value2 = MyQmlObject.value } diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index ec2c5f7..08d6d96 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -75,17 +75,20 @@ Q_DECLARE_METATYPE(MyCustomVariantType); class MyAttachedObject : public QObject { Q_OBJECT - Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY(int value2 READ value2 WRITE setValue2) public: MyAttachedObject(QObject *parent) : QObject(parent), m_value(0), m_value2(0) {} int value() const { return m_value; } - void setValue(int v) { m_value = v; } + void setValue(int v) { if (m_value != v) { m_value = v; emit valueChanged(); } } int value2() const { return m_value2; } void setValue2(int v) { m_value2 = v; } +signals: + void valueChanged(); + private: int m_value; int m_value2; diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 39f5223..870f3fe 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -713,6 +713,11 @@ void tst_qdeclarativelanguage::attachedProperties() QVERIFY(attached != 0); QCOMPARE(attached->property("value"), QVariant(10)); QCOMPARE(attached->property("value2"), QVariant(13)); + + QEXPECT_FAIL("", "QTBUG-8677", Abort); + attached->setProperty("value", QVariant(12)); + int val = object->property("value2").toInt(); + QCOMPARE(val, 12); } // Tests non-static object properties -- cgit v0.12 From dba7eb104f7788fda36e8a2ecffc8f4c08ec1fae Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 3 Mar 2010 16:59:04 +1000 Subject: Add documentation for the 'when' property of Binding. --- src/declarative/util/qdeclarativebind.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp index e95a03e..26baa38 100644 --- a/src/declarative/util/qdeclarativebind.cpp +++ b/src/declarative/util/qdeclarativebind.cpp @@ -72,7 +72,7 @@ public: /*! \qmlclass Binding QDeclarativeBind - \since 4.7 + \since 4.7 \brief The Binding element allows arbitrary property bindings to be created. Sometimes it is necessary to bind to a property of an object that wasn't @@ -114,6 +114,19 @@ QDeclarativeBind::~QDeclarativeBind() { } +/*! + \qmlproperty bool Binding::when + + This property holds when the binding is active. + This should be set to an expression that evaluates to true when you want the binding to be active. + + \code + Binding { + target: contactName; property: 'text' + value: name; when: list.ListView.isCurrentItem + } + \endcode +*/ bool QDeclarativeBind::when() const { Q_D(const QDeclarativeBind); -- cgit v0.12 From f68389023cb8f0365c51fdc1fca06910f36dda2d Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 3 Mar 2010 15:07:34 +1000 Subject: Remove dependency on declarative from multimedia. Move all declarative related classes into the multimedia declarative module. Reviewed-by: Andrew den Exter --- src/multimedia/effects/effects.pri | 24 + src/multimedia/effects/qsoundeffect.cpp | 255 ++++++ src/multimedia/effects/qsoundeffect_p.h | 123 +++ src/multimedia/effects/qsoundeffect_pulse_p.cpp | 509 +++++++++++ src/multimedia/effects/qsoundeffect_pulse_p.h | 138 +++ src/multimedia/effects/qsoundeffect_qmedia_p.cpp | 167 ++++ src/multimedia/effects/qsoundeffect_qmedia_p.h | 109 +++ src/multimedia/effects/qsoundeffect_qsound_p.cpp | 225 +++++ src/multimedia/effects/qsoundeffect_qsound_p.h | 129 +++ src/multimedia/effects/wavedecoder_p.cpp | 140 +++ src/multimedia/effects/wavedecoder_p.h | 134 +++ src/multimedia/multimedia.pro | 2 +- src/multimedia/qml/multimediadeclarative.cpp | 70 -- src/multimedia/qml/multimediadeclarative.h | 60 -- src/multimedia/qml/qdeclarativeaudio.cpp | 327 ------- src/multimedia/qml/qdeclarativeaudio_p.h | 173 ---- src/multimedia/qml/qdeclarativemediabase.cpp | 413 --------- src/multimedia/qml/qdeclarativemediabase_p.h | 168 ---- src/multimedia/qml/qdeclarativevideo.cpp | 945 --------------------- src/multimedia/qml/qdeclarativevideo_p.h | 204 ----- src/multimedia/qml/qmetadatacontrolmetaobject.cpp | 362 -------- src/multimedia/qml/qmetadatacontrolmetaobject_p.h | 92 -- src/multimedia/qml/qml.pri | 37 - src/multimedia/qml/qsoundeffect.cpp | 255 ------ src/multimedia/qml/qsoundeffect_p.h | 126 --- src/multimedia/qml/qsoundeffect_pulse_p.cpp | 509 ----------- src/multimedia/qml/qsoundeffect_pulse_p.h | 138 --- src/multimedia/qml/qsoundeffect_qmedia_p.cpp | 167 ---- src/multimedia/qml/qsoundeffect_qmedia_p.h | 109 --- src/multimedia/qml/qsoundeffect_qsound_p.cpp | 225 ----- src/multimedia/qml/qsoundeffect_qsound_p.h | 129 --- src/multimedia/qml/wavedecoder_p.cpp | 140 --- src/multimedia/qml/wavedecoder_p.h | 134 --- .../qdeclarativemodules/multimedia/multimedia.cpp | 19 +- .../qdeclarativemodules/multimedia/multimedia.pro | 13 +- .../multimedia/qdeclarativeaudio.cpp | 327 +++++++ .../multimedia/qdeclarativeaudio_p.h | 173 ++++ .../multimedia/qdeclarativemediabase.cpp | 413 +++++++++ .../multimedia/qdeclarativemediabase_p.h | 168 ++++ .../multimedia/qdeclarativevideo.cpp | 945 +++++++++++++++++++++ .../multimedia/qdeclarativevideo_p.h | 204 +++++ .../multimedia/qmetadatacontrolmetaobject.cpp | 362 ++++++++ .../multimedia/qmetadatacontrolmetaobject_p.h | 92 ++ src/src.pro | 1 - tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro | 12 +- .../qdeclarativeaudio/tst_qdeclarativeaudio.cpp | 2 +- tests/auto/qdeclarativevideo/qdeclarativevideo.pro | 12 +- .../qdeclarativevideo/tst_qdeclarativevideo.cpp | 2 +- 48 files changed, 4689 insertions(+), 4794 deletions(-) create mode 100644 src/multimedia/effects/effects.pri create mode 100644 src/multimedia/effects/qsoundeffect.cpp create mode 100644 src/multimedia/effects/qsoundeffect_p.h create mode 100644 src/multimedia/effects/qsoundeffect_pulse_p.cpp create mode 100644 src/multimedia/effects/qsoundeffect_pulse_p.h create mode 100644 src/multimedia/effects/qsoundeffect_qmedia_p.cpp create mode 100644 src/multimedia/effects/qsoundeffect_qmedia_p.h create mode 100644 src/multimedia/effects/qsoundeffect_qsound_p.cpp create mode 100644 src/multimedia/effects/qsoundeffect_qsound_p.h create mode 100644 src/multimedia/effects/wavedecoder_p.cpp create mode 100644 src/multimedia/effects/wavedecoder_p.h delete mode 100644 src/multimedia/qml/multimediadeclarative.cpp delete mode 100644 src/multimedia/qml/multimediadeclarative.h delete mode 100644 src/multimedia/qml/qdeclarativeaudio.cpp delete mode 100644 src/multimedia/qml/qdeclarativeaudio_p.h delete mode 100644 src/multimedia/qml/qdeclarativemediabase.cpp delete mode 100644 src/multimedia/qml/qdeclarativemediabase_p.h delete mode 100644 src/multimedia/qml/qdeclarativevideo.cpp delete mode 100644 src/multimedia/qml/qdeclarativevideo_p.h delete mode 100644 src/multimedia/qml/qmetadatacontrolmetaobject.cpp delete mode 100644 src/multimedia/qml/qmetadatacontrolmetaobject_p.h delete mode 100644 src/multimedia/qml/qml.pri delete mode 100644 src/multimedia/qml/qsoundeffect.cpp delete mode 100644 src/multimedia/qml/qsoundeffect_p.h delete mode 100644 src/multimedia/qml/qsoundeffect_pulse_p.cpp delete mode 100644 src/multimedia/qml/qsoundeffect_pulse_p.h delete mode 100644 src/multimedia/qml/qsoundeffect_qmedia_p.cpp delete mode 100644 src/multimedia/qml/qsoundeffect_qmedia_p.h delete mode 100644 src/multimedia/qml/qsoundeffect_qsound_p.cpp delete mode 100644 src/multimedia/qml/qsoundeffect_qsound_p.h delete mode 100644 src/multimedia/qml/wavedecoder_p.cpp delete mode 100644 src/multimedia/qml/wavedecoder_p.h create mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp create mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h create mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp create mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h create mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp create mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h create mode 100644 src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp create mode 100644 src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h diff --git a/src/multimedia/effects/effects.pri b/src/multimedia/effects/effects.pri new file mode 100644 index 0000000..5edd452 --- /dev/null +++ b/src/multimedia/effects/effects.pri @@ -0,0 +1,24 @@ + + + +system(pkg-config --exists \'libpulse >= 0.9.10\') { + DEFINES += QT_MULTIMEDIA_PULSEAUDIO + HEADERS += $$PWD/qsoundeffect_pulse_p.h + SOURCES += $$PWD/qsoundeffect_pulse_p.cpp + LIBS += -lpulse +} else:x11 { + DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER + HEADERS += $$PWD/qsoundeffect_qmedia_p.h + SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp +} else { + HEADERS += $$PWD/qsoundeffect_qsound_p.h + SOURCES += $$PWD/qsoundeffect_qsound_p.cpp +} + +HEADERS += \ + $$PWD/qsoundeffect_p.h \ + $$PWD/wavedecoder_p.h + +SOURCES += \ + $$PWD/qsoundeffect.cpp \ + $$PWD/wavedecoder_p.cpp diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp new file mode 100644 index 0000000..541e6c9 --- /dev/null +++ b/src/multimedia/effects/qsoundeffect.cpp @@ -0,0 +1,255 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmediacontent.h" +#include "qmediaplayer.h" + +#include "qsoundeffect_p.h" + +#if defined(QT_MULTIMEDIA_PULSEAUDIO) +#include "qsoundeffect_pulse_p.h" +#elif(QT_MULTIMEDIA_QMEDIAPLAYER) +#include "qsoundeffect_qmedia_p.h" +#else +#include "qsoundeffect_qsound_p.h" +#endif + +QT_BEGIN_NAMESPACE + +/*! + \qmlclass SoundEffect QSoundEffect + \since 4.7 + \brief The SoundEffect element provides a way to play sound effects in qml. + + The following example plays a wav file on mouse click. + + \qml + SoundEffect { + id: playSound + source: "test.wav" + } + MouseRegion { + id: playArea + anchors.fill: parent + onPressed: { + playSound.play() + } + } + \endqml + + \sa SoundEffect +*/ + +/*! + \qmlproperty QUrl SoundEffect::source + + This property provides a way to control the sound to play. +*/ + +/*! + \qmlproperty int SoundEffect::loopCount + + This property provides a way to control the number of times to repeat the sound on each play(). +*/ + +/*! + \qmlproperty int SoundEffect::volume + + This property provides a way to control the volume for playback. +*/ + +/*! + \qmlproperty bool SoundEffect::muted + + This property provides a way to control muting. +*/ + +/*! + \qmlproperty int SoundEffect::duration + + This property holds the duration in milliseconds of the current source audio. +*/ + +/*! + \qmlsignal SoundEffect::sourceChanged() + + This handler is called when the source has changed. +*/ + +/*! + \qmlsignal SoundEffect::loopCountChanged() + + This handler is called when the number of loops has changes. +*/ + +/*! + \qmlsignal SoundEffect::volumeChanged() + + This handler is called when the volume has changed. +*/ + +/*! + \qmlsignal SoundEffect::mutedChanged() + + This handler is called when the mute state has changed. +*/ + +/*! + \qmlsignal SoundEffect::durationChanged() + + This handler is called when the duration has changed. +*/ + +QSoundEffect::QSoundEffect(QObject *parent) : + QObject(parent), + m_loopCount(1), + m_vol(100), + m_muted(false), + m_runningCount(0) +{ + d = new QSoundEffectPrivate(this); + connect(d, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged())); + connect(d, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged())); + connect(d, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged())); + connect(d, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(repeat())); +} + +QSoundEffect::~QSoundEffect() +{ + delete d; +} + +QUrl QSoundEffect::source() const +{ + return d != 0 ? d->media().canonicalUrl() : QUrl(); +} + +void QSoundEffect::setSource(const QUrl &url) +{ + if (d != 0 && d->media().canonicalUrl() == url) + return; + + d->setVolume(m_vol); + d->setMuted(m_muted); + d->setMedia(url); + + if (url.isEmpty()) + return; + + emit sourceChanged(); +} + +int QSoundEffect::loopCount() const +{ + return m_loopCount; +} + +void QSoundEffect::setLoopCount(int loopCount) +{ + if (m_loopCount == loopCount) + return; + + m_loopCount = loopCount; + emit loopCountChanged(); +} + +int QSoundEffect::volume() const +{ + return d != 0 ? d->volume() : m_vol; +} + +void QSoundEffect::setVolume(int volume) +{ + if (m_vol == volume) + return; + + m_vol = volume; + if (d != 0) + d->setVolume(volume); + else + emit volumeChanged(); +} + +bool QSoundEffect::isMuted() const +{ + return d != 0 ? d->isMuted() : m_muted; +} + +void QSoundEffect::setMuted(bool muted) +{ + if (m_muted == muted) + return; + + m_muted = muted; + if (d != 0) + d->setMuted(muted); + else + emit mutedChanged(); +} + +int QSoundEffect::duration() const +{ + return d != 0 ? d->duration() : 0; +} + +void QSoundEffect::play() +{ + m_runningCount = 0; + + if (d != 0) + d->play(); +} + +void QSoundEffect::stop() +{ + if (d != 0) + d->stop(); +} + +void QSoundEffect::repeat() +{ + if (d->state() == QMediaPlayer::StoppedState) { + if (++m_runningCount < m_loopCount) + d->play(); + } +} + +QT_END_NAMESPACE diff --git a/src/multimedia/effects/qsoundeffect_p.h b/src/multimedia/effects/qsoundeffect_p.h new file mode 100644 index 0000000..c5554bf --- /dev/null +++ b/src/multimedia/effects/qsoundeffect_p.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOUNDEFFECT_H +#define QSOUNDEFFECT_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + + +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSoundEffectPrivate; +class Q_MULTIMEDIA_EXPORT QSoundEffect : public QObject +{ + Q_OBJECT + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount NOTIFY loopCountChanged) + Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged) + Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) + Q_PROPERTY(int duration READ duration NOTIFY durationChanged) + +public: + explicit QSoundEffect(QObject *parent = 0); + ~QSoundEffect(); + + QUrl source() const; + void setSource(const QUrl &url); + + int loopCount() const; + void setLoopCount(int loopCount); + + int volume() const; + void setVolume(int volume); + + bool isMuted() const; + void setMuted(bool muted); + + int duration() const; + +signals: + void sourceChanged(); + void loopCountChanged(); + void volumeChanged(); + void mutedChanged(); + void durationChanged(); + +public slots: + void play(); + void stop(); + +private slots: + void repeat(); + +private: + Q_DISABLE_COPY(QSoundEffect) + + int m_loopCount; + int m_vol; + bool m_muted; + int m_runningCount; + + QSoundEffectPrivate* d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QSOUNDEFFECT_H diff --git a/src/multimedia/effects/qsoundeffect_pulse_p.cpp b/src/multimedia/effects/qsoundeffect_pulse_p.cpp new file mode 100644 index 0000000..7e9a25c --- /dev/null +++ b/src/multimedia/effects/qsoundeffect_pulse_p.cpp @@ -0,0 +1,509 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include + +#include "qmediacontent.h" +#include "qmediaplayer.h" +#include "qsoundeffect_p.h" + +#include "wavedecoder_p.h" + +#include "qsoundeffect_pulse_p.h" + +#if(Q_WS_MAEMO_5) +#include +#endif + +#include + +// Less than ideal +#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16) + +QT_BEGIN_NAMESPACE + +namespace +{ +inline pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format) +{ + pa_sample_spec spec; + + spec.rate = format.frequency(); + spec.channels = format.channels(); + + if (format.sampleSize() == 8) + spec.format = PA_SAMPLE_U8; + else if (format.sampleSize() == 16) { + switch (format.byteOrder()) { + case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S16BE; break; + case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S16LE; break; + } + } + else if (format.sampleSize() == 32) { + switch (format.byteOrder()) { + case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S32BE; break; + case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S32LE; break; + } + } + + return spec; +} + +class PulseDaemon +{ +public: + PulseDaemon():m_prepared(false) + { + prepare(); + } + + ~PulseDaemon() + { + if (m_prepared) + release(); + } + + inline void lock() + { + pa_threaded_mainloop_lock(m_mainLoop); + } + + inline void unlock() + { + pa_threaded_mainloop_unlock(m_mainLoop); + } + + inline pa_context *context() const + { + return m_context; + } + + int volume() + { + return m_vol; + } + +private: + void prepare() + { + m_vol = 100; + + m_mainLoop = pa_threaded_mainloop_new(); + if (m_mainLoop == 0) { + qWarning("PulseAudioService: unable to create pulseaudio mainloop"); + return; + } + + if (pa_threaded_mainloop_start(m_mainLoop) != 0) { + qWarning("PulseAudioService: unable to start pulseaudio mainloop"); + pa_threaded_mainloop_free(m_mainLoop); + return; + } + + m_mainLoopApi = pa_threaded_mainloop_get_api(m_mainLoop); + + lock(); + m_context = pa_context_new(m_mainLoopApi, QString(QLatin1String("QtPulseAudio:%1")).arg(::getpid()).toAscii().constData()); + +#if(Q_WS_MAEMO_5) + pa_context_set_state_callback(m_context, context_state_callback, this); +#endif + if (m_context == 0) { + qWarning("PulseAudioService: Unable to create new pulseaudio context"); + pa_threaded_mainloop_free(m_mainLoop); + return; + } + + if (pa_context_connect(m_context, NULL, (pa_context_flags_t)0, NULL) < 0) { + qWarning("PulseAudioService: pa_context_connect() failed"); + pa_context_unref(m_context); + pa_threaded_mainloop_free(m_mainLoop); + return; + } + unlock(); + + m_prepared = true; + } + + void release() + { + if (!m_prepared) return; + pa_threaded_mainloop_stop(m_mainLoop); + pa_threaded_mainloop_free(m_mainLoop); + m_prepared = false; + } + +#if(Q_WS_MAEMO_5) + static void context_state_callback(pa_context *c, void *userdata) + { + PulseDaemon *self = reinterpret_cast(userdata); + switch (pa_context_get_state(c)) { + case PA_CONTEXT_CONNECTING: + case PA_CONTEXT_AUTHORIZING: + case PA_CONTEXT_SETTING_NAME: + break; + case PA_CONTEXT_READY: + pa_ext_stream_restore_set_subscribe_cb(c, &stream_restore_monitor_callback, self); + pa_ext_stream_restore_subscribe(c, 1, NULL, self); + break; + default: + break; + } + } + static void stream_restore_monitor_callback(pa_context *c, void *userdata) + { + PulseDaemon *self = reinterpret_cast(userdata); + pa_ext_stream_restore2_read(c, &stream_restore_info_callback, self); + } + static void stream_restore_info_callback(pa_context *c, const pa_ext_stream_restore2_info *info, + int eol, void *userdata) + { + Q_UNUSED(c) + + PulseDaemon *self = reinterpret_cast(userdata); + + if (!eol) { + if (QString(info->name).startsWith(QLatin1String("sink-input-by-media-role:x-maemo"))) { + const unsigned str_length = 256; + char str[str_length]; + pa_cvolume_snprint(str, str_length, &info->volume); + self->m_vol = QString(str).replace(" ","").replace("%","").mid(2).toInt(); + } + } + } +#endif + + int m_vol; + bool m_prepared; + pa_context *m_context; + pa_threaded_mainloop *m_mainLoop; + pa_mainloop_api *m_mainLoopApi; +}; +} + +Q_GLOBAL_STATIC(PulseDaemon, daemon) + + +QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent): + QObject(parent), + m_muted(false), + m_playQueued(false), + m_vol(100), + m_duration(0), + m_dataUploaded(0), + m_state(QMediaPlayer::StoppedState), + m_status(QMediaPlayer::NoMedia), + m_reply(0), + m_stream(0), + m_networkAccessManager(0) +{ +} + +QSoundEffectPrivate::~QSoundEffectPrivate() +{ + delete m_reply; + unloadSample(); +} + +qint64 QSoundEffectPrivate::duration() const +{ + return m_duration; +} + +int QSoundEffectPrivate::volume() const +{ + return m_vol; +} + +bool QSoundEffectPrivate::isMuted() const +{ + return m_muted; +} + +QMediaContent QSoundEffectPrivate::media() const +{ + return m_media; +} + +QMediaPlayer::State QSoundEffectPrivate::state() const +{ + return m_state; +} + +QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const +{ + return m_status; +} + +void QSoundEffectPrivate::play() +{ + if (m_status == QMediaPlayer::LoadingMedia) { + m_playQueued = true; + return; + } + + if (m_status != QMediaPlayer::BufferedMedia || + m_state == QMediaPlayer::PlayingState) + return; + + pa_volume_t m_vol = PA_VOLUME_NORM; + + daemon()->lock(); +#if(Q_WS_MAEMO_5) + m_vol = PA_VOLUME_NORM/100*((daemon()->volume()+m_vol)/2); +#endif + pa_operation_unref( + pa_context_play_sample(daemon()->context(), + m_name.constData(), + 0, + m_vol, + play_callback, + this) + ); + daemon()->unlock(); + + m_playbackTime.start(); + + emit stateChanged(m_state = QMediaPlayer::PlayingState); +} + +void QSoundEffectPrivate::stop() +{ + emit stateChanged(m_state = QMediaPlayer::StoppedState); +} + +void QSoundEffectPrivate::setVolume(int volume) +{ + m_vol = volume; +} + +void QSoundEffectPrivate::setMuted(bool muted) +{ + m_muted = muted; +} + +void QSoundEffectPrivate::setMedia(const QMediaContent &media) +{ + if (media.isNull()) { + m_media = QMediaContent(); + unloadSample(); + return; + } + if (m_media == media) + return; + m_media = media; + + if (m_networkAccessManager == 0) + m_networkAccessManager = new QNetworkAccessManager(this); + + m_stream = m_networkAccessManager->get(QNetworkRequest(m_media.canonicalUrl())); + + unloadSample(); + loadSample(); + + emit mediaChanged(m_media); +} + +void QSoundEffectPrivate::decoderReady() +{ + if (m_waveDecoder->size() >= PA_SCACHE_ENTRY_SIZE_MAX) { + m_status = QMediaPlayer::InvalidMedia; + emit mediaStatusChanged(m_status); + qWarning("QtPulseAudio: attempting to load to large a sample"); + return; + } + + if (m_name.isNull()) + m_name = QString(QLatin1String("QtPulseSample-%1-%2")).arg(::getpid()).arg(quintptr(this)).toUtf8(); + + pa_sample_spec spec = audioFormatToSampleSpec(m_waveDecoder->audioFormat()); + + daemon()->lock(); + pa_stream *stream = pa_stream_new(daemon()->context(), m_name.constData(), &spec, 0); + pa_stream_set_state_callback(stream, stream_state_callback, this); + pa_stream_set_write_callback(stream, stream_write_callback, this); + pa_stream_connect_upload(stream, (size_t)m_waveDecoder->size()); + daemon()->unlock(); +} + +void QSoundEffectPrivate::decoderError() +{ + emit mediaStatusChanged(m_status = QMediaPlayer::InvalidMedia); +} + +void QSoundEffectPrivate::checkPlayTime() +{ + int elapsed = m_playbackTime.elapsed(); + + if (elapsed >= m_duration) { + m_state = QMediaPlayer::StoppedState; + emit stateChanged(m_state); + } + else + startTimer(m_duration - elapsed); +} + +void QSoundEffectPrivate::loadSample() +{ + m_waveDecoder = new WaveDecoder(m_stream); + connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady())); + connect(m_waveDecoder, SIGNAL(invalidFormat()), SLOT(decoderError())); + + m_status = QMediaPlayer::LoadingMedia; + emit mediaStatusChanged(m_status); +} + +void QSoundEffectPrivate::unloadSample() +{ + if (m_status != QMediaPlayer::BufferedMedia) + return; + + m_status = QMediaPlayer::NoMedia; + + daemon()->lock(); + pa_context_remove_sample(daemon()->context(), m_name.constData(), NULL, NULL); + daemon()->unlock(); + + m_duration = 0; + m_dataUploaded = 0; +} + +void QSoundEffectPrivate::timerEvent(QTimerEvent *event) +{ + if (m_state == QMediaPlayer::PlayingState) { + m_state = QMediaPlayer::StoppedState; + emit stateChanged(m_state); + } + + killTimer(event->timerId()); +} + +void QSoundEffectPrivate::stream_write_callback(pa_stream *s, size_t length, void *userdata) +{ + Q_UNUSED(length); + + QSoundEffectPrivate *self = reinterpret_cast(userdata); + + size_t bufferSize = qMin(pa_stream_writable_size(s), + size_t(self->m_waveDecoder->bytesAvailable())); + char buffer[bufferSize]; + + size_t len = 0; + while (len < length) { + qint64 read = self->m_waveDecoder->read(buffer, qMin(bufferSize, length -len)); + if (read > 0) { + if (pa_stream_write(s, buffer, size_t(read), 0, 0, PA_SEEK_RELATIVE) == 0) + len += size_t(read); + else + break; + } + } + self->m_dataUploaded += len; + + if (self->m_waveDecoder->size() == self->m_dataUploaded) { + pa_stream_finish_upload(s); + + self->m_duration = self->m_waveDecoder->duration(); + emit self->durationChanged(self->m_duration); + + self->m_status = QMediaPlayer::BufferedMedia; + emit self->mediaStatusChanged(self->m_status); + + self->m_waveDecoder->deleteLater(); + if (!self->m_media.isNull()) + self->m_stream->deleteLater(); + + if (self->m_playQueued) { + self->m_playQueued = false; + QMetaObject::invokeMethod(self, "play"); + } + } +} + +void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata) +{ + QSoundEffectPrivate *self = reinterpret_cast(userdata); + + switch (pa_stream_get_state(s)) { + case PA_STREAM_CREATING: + case PA_STREAM_READY: + case PA_STREAM_TERMINATED: + break; + + case PA_STREAM_FAILED: + default: + self->m_status = QMediaPlayer::InvalidMedia; + emit self->mediaStatusChanged(self->m_status); + break; + } +} + +void QSoundEffectPrivate::play_callback(pa_context *c, int success, void *userdata) +{ + Q_UNUSED(c); + + QSoundEffectPrivate *self = reinterpret_cast(userdata); + + if (success == 1) + QMetaObject::invokeMethod(self, "checkPlayTime", Qt::QueuedConnection); + else { + self->m_state = QMediaPlayer::StoppedState; + emit self->stateChanged(self->m_state); + } +} + +QT_END_NAMESPACE + + diff --git a/src/multimedia/effects/qsoundeffect_pulse_p.h b/src/multimedia/effects/qsoundeffect_pulse_p.h new file mode 100644 index 0000000..247f8a3 --- /dev/null +++ b/src/multimedia/effects/qsoundeffect_pulse_p.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOUNDEFFECT_PULSE_H +#define QSOUNDEFFECT_PULSE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + + +#include "qsoundeffect_p.h" + +#include +#include +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QNetworkReply; +class QNetworkAccessManager; +class WaveDecoder; + +class QSoundEffectPrivate : public QObject +{ + Q_OBJECT +public: + explicit QSoundEffectPrivate(QObject* parent); + ~QSoundEffectPrivate(); + + qint64 duration() const; + int volume() const; + bool isMuted() const; + QMediaContent media() const; + QMediaPlayer::State state() const; + QMediaPlayer::MediaStatus mediaStatus() const; + +public Q_SLOTS: + void play(); + void stop(); + void setVolume(int volume); + void setMuted(bool muted); + void setMedia(const QMediaContent &media); + +Q_SIGNALS: + void mediaChanged(const QMediaContent &media); + void mediaStatusChanged(QMediaPlayer::MediaStatus status); + void stateChanged(QMediaPlayer::State newState); + void durationChanged(qint64 duration); + void volumeChanged(int volume); + void mutedChanged(bool muted); + void error(QMediaPlayer::Error error); + +private slots: + void decoderReady(); + void decoderError(); + void checkPlayTime(); + +private: + void loadSample(); + void unloadSample(); + + void timerEvent(QTimerEvent *event); + + static void stream_write_callback(pa_stream *s, size_t length, void *userdata); + static void stream_state_callback(pa_stream *s, void *userdata); + static void play_callback(pa_context *c, int success, void *userdata); + + bool m_muted; + bool m_playQueued; + int m_vol; + int m_duration; + int m_dataUploaded; + QTime m_playbackTime; + QMediaPlayer::State m_state; + QMediaPlayer::MediaStatus m_status; + QByteArray m_name; + QMediaContent m_media; + QNetworkReply *m_reply; + WaveDecoder *m_waveDecoder; + QIODevice *m_stream; + QNetworkAccessManager *m_networkAccessManager; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSOUNDEFFECT_PULSE_H diff --git a/src/multimedia/effects/qsoundeffect_qmedia_p.cpp b/src/multimedia/effects/qsoundeffect_qmedia_p.cpp new file mode 100644 index 0000000..48fb257 --- /dev/null +++ b/src/multimedia/effects/qsoundeffect_qmedia_p.cpp @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include "qmediacontent.h" +#include "qmediaplayer.h" + +#include "qsoundeffect_p.h" +#include "qsoundeffect_qmedia_p.h" + + +QT_BEGIN_NAMESPACE + +QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent): + QObject(parent), + m_muted(false), + m_vol(100), + m_player(0) +{ +} + +QSoundEffectPrivate::~QSoundEffectPrivate() +{ + if (m_player) delete m_player; +} + +qint64 QSoundEffectPrivate::duration() const +{ + if (m_player) return m_player->duration(); + + return 0; +} + +int QSoundEffectPrivate::volume() const +{ + if (m_player) return m_player->volume(); + + return m_vol; +} + +bool QSoundEffectPrivate::isMuted() const +{ + if (m_player) return m_player->isMuted(); + + return m_muted; +} + +QMediaContent QSoundEffectPrivate::media() const +{ + if (m_player) return m_player->media(); + + return QMediaContent(); +} + +QMediaPlayer::State QSoundEffectPrivate::state() const +{ + if (m_player) return m_player->state(); + + return QMediaPlayer::StoppedState; +} + +QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const +{ + if (m_player) return m_player->mediaStatus(); + + return QMediaPlayer::UnknownMediaStatus; +} + +void QSoundEffectPrivate::play() +{ + if (m_player && !m_player->isMuted()) + m_player->play(); +} + +void QSoundEffectPrivate::stop() +{ + if (m_player) + m_player->stop(); +} + +void QSoundEffectPrivate::setVolume(int volume) +{ + m_vol = volume; + + if (m_player) + m_player->setVolume(volume); +} + +void QSoundEffectPrivate::setMuted(bool muted) +{ + m_muted = muted; + + if (m_player) + m_player->setMuted(muted); +} + +void QSoundEffectPrivate::setMedia(const QMediaContent &media) +{ + if (media.isNull()) + return; + + if (m_player == 0) { + m_player = new QMediaPlayer(this, QMediaPlayer::LowLatency); + m_player->setVolume(m_vol); + m_player->setMuted(m_muted); + + connect(m_player, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int))); + connect(m_player, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool))); + connect(m_player, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); + connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), SIGNAL(stateChanged(QMediaPlayer::State))); + } + + m_player->setMedia(media.canonicalUrl()); +} + +QT_END_NAMESPACE + diff --git a/src/multimedia/effects/qsoundeffect_qmedia_p.h b/src/multimedia/effects/qsoundeffect_qmedia_p.h new file mode 100644 index 0000000..8267f79 --- /dev/null +++ b/src/multimedia/effects/qsoundeffect_qmedia_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOUNDEFFECT_QMEDIA_H +#define QSOUNDEFFECT_QMEDIA_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + + +#include +#include +#include +#include "qsoundeffect_p.h" + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class WaveDecoder; + +class QSoundEffectPrivate : public QObject +{ + Q_OBJECT +public: + explicit QSoundEffectPrivate(QObject* parent); + ~QSoundEffectPrivate(); + + qint64 duration() const; + int volume() const; + bool isMuted() const; + QMediaContent media() const; + QMediaPlayer::State state() const; + QMediaPlayer::MediaStatus mediaStatus() const; + +public Q_SLOTS: + void play(); + void stop(); + void setVolume(int volume); + void setMuted(bool muted); + void setMedia(const QMediaContent &media); + +Q_SIGNALS: + void mediaChanged(const QMediaContent &media); + void mediaStatusChanged(QMediaPlayer::MediaStatus status); + void stateChanged(QMediaPlayer::State newState); + void durationChanged(qint64 duration); + void volumeChanged(int volume); + void mutedChanged(bool muted); + void error(QMediaPlayer::Error error); + +private: + bool m_muted; + int m_vol; + QMediaPlayer *m_player; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSOUNDEFFECT_QMEDIA_H diff --git a/src/multimedia/effects/qsoundeffect_qsound_p.cpp b/src/multimedia/effects/qsoundeffect_qsound_p.cpp new file mode 100644 index 0000000..df160a9 --- /dev/null +++ b/src/multimedia/effects/qsoundeffect_qsound_p.cpp @@ -0,0 +1,225 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include +#include + +#include "qmediacontent.h" +#include "qmediaplayer.h" +#include "qsoundeffect_p.h" + +#include "wavedecoder_p.h" + +#include "qsoundeffect_qsound_p.h" + +QT_BEGIN_NAMESPACE + +QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent): + QObject(parent), + m_queued(false), + m_muted(false), + m_state(QMediaPlayer::StoppedState), + m_status(QMediaPlayer::NoMedia), + m_file(0), + m_sound(0) +{ + m_timer = new QTimer(this); + connect(m_timer,SIGNAL(timeout()),SLOT(checkPlayTime())); + m_media = QMediaContent(); +} + +QSoundEffectPrivate::~QSoundEffectPrivate() +{ + if (m_sound) delete m_sound; + if (m_waveDecoder) delete m_waveDecoder; + m_file->close(); +} + +qint64 QSoundEffectPrivate::duration() const +{ + if (m_waveDecoder) + return m_waveDecoder->size(); + + return 0; +} + +int QSoundEffectPrivate::volume() const +{ + return 100; +} + +bool QSoundEffectPrivate::isMuted() const +{ + return m_muted; +} + +QMediaContent QSoundEffectPrivate::media() const +{ + return m_media; +} + +QMediaPlayer::State QSoundEffectPrivate::state() const +{ + return m_state; +} + +QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const +{ + return m_status; +} + +void QSoundEffectPrivate::play() +{ + if (m_sound && !m_muted) { + m_queued = false; + m_timer->start(20); + m_playbackTime.start(); + m_sound->play(); + emit stateChanged(m_state = QMediaPlayer::PlayingState); + } else if (m_status == QMediaPlayer::LoadingMedia) + m_queued = true; +} + +void QSoundEffectPrivate::stop() +{ + m_timer->stop(); + + if (m_sound) { + m_sound->stop(); + emit stateChanged(m_state = QMediaPlayer::StoppedState); + } +} + +void QSoundEffectPrivate::setVolume(int volume) +{ + Q_UNUSED(volume) +} + +void QSoundEffectPrivate::setMuted(bool muted) +{ + m_muted = muted; +} + +void QSoundEffectPrivate::setMedia(const QMediaContent &media) +{ + m_queued = false; + + if (media.isNull() || media.canonicalUrl().scheme() != QLatin1String("file")) { + m_media = QMediaContent(); + return; + } + if (m_media == media) + return; + + m_media = media; + m_file = new QFile(m_media.canonicalUrl().toLocalFile()); + m_file->open(QIODevice::ReadOnly|QIODevice::Unbuffered); + + unloadSample(); + loadSample(); + + emit mediaChanged(m_media); +} + +void QSoundEffectPrivate::decoderReady() +{ + m_file->close(); + m_sound = new QSound(m_media.canonicalUrl().toLocalFile()); + emit mediaStatusChanged(m_status = QMediaPlayer::LoadedMedia); + + if (m_queued) + play(); +} + +void QSoundEffectPrivate::decoderError() +{ + m_file->close(); + emit mediaStatusChanged(m_status = QMediaPlayer::InvalidMedia); +} + +void QSoundEffectPrivate::checkPlayTime() +{ + if (m_sound->isFinished()) { + m_timer->stop(); + m_state = QMediaPlayer::StoppedState; + emit stateChanged(m_state); + } +} + +void QSoundEffectPrivate::loadSample() +{ + m_waveDecoder = new WaveDecoder(m_file); + connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady())); + connect(m_waveDecoder, SIGNAL(invalidFormat()), SLOT(decoderError())); + + m_status = QMediaPlayer::LoadingMedia; + emit mediaStatusChanged(m_status); +} + +void QSoundEffectPrivate::unloadSample() +{ + if (m_sound == 0) + return; + + m_status = QMediaPlayer::NoMedia; + + if (m_sound) + delete m_sound; + + m_sound = 0; +} + +QT_END_NAMESPACE diff --git a/src/multimedia/effects/qsoundeffect_qsound_p.h b/src/multimedia/effects/qsoundeffect_qsound_p.h new file mode 100644 index 0000000..45c0888 --- /dev/null +++ b/src/multimedia/effects/qsoundeffect_qsound_p.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOUNDEFFECT_QSOUND_H +#define QSOUNDEFFECT_QSOUND_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + + +#include +#include +#include + +#include "qsoundeffect_p.h" + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QTimer; +class QSound; +class QFile; +class WaveDecoder; + +class QSoundEffectPrivate : public QObject +{ + Q_OBJECT +public: + explicit QSoundEffectPrivate(QObject* parent); + ~QSoundEffectPrivate(); + + qint64 duration() const; + int volume() const; + bool isMuted() const; + QMediaContent media() const; + QMediaPlayer::State state() const; + QMediaPlayer::MediaStatus mediaStatus() const; + +public Q_SLOTS: + void play(); + void stop(); + void setVolume(int volume); + void setMuted(bool muted); + void setMedia(const QMediaContent &media); + +Q_SIGNALS: + void mediaChanged(const QMediaContent &media); + void mediaStatusChanged(QMediaPlayer::MediaStatus status); + void stateChanged(QMediaPlayer::State newState); + void durationChanged(qint64 duration); + void volumeChanged(int volume); + void mutedChanged(bool muted); + void error(QMediaPlayer::Error error); + +private slots: + void decoderReady(); + void decoderError(); + void checkPlayTime(); + +private: + void loadSample(); + void unloadSample(); + + bool m_queued; + bool m_muted; + QTime m_playbackTime; + QMediaPlayer::State m_state; + QMediaPlayer::MediaStatus m_status; + QFile *m_file; + QByteArray m_name; + QMediaContent m_media; + WaveDecoder *m_waveDecoder; + QSound *m_sound; + QTimer *m_timer; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSOUNDEFFECT_QSOUND_H diff --git a/src/multimedia/effects/wavedecoder_p.cpp b/src/multimedia/effects/wavedecoder_p.cpp new file mode 100644 index 0000000..f2277ae --- /dev/null +++ b/src/multimedia/effects/wavedecoder_p.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "wavedecoder_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +WaveDecoder::WaveDecoder(QIODevice *s, QObject *parent): + QIODevice(parent), + haveFormat(false), + dataSize(0), + remaining(0), + source(s) +{ + open(QIODevice::ReadOnly | QIODevice::Unbuffered); + + if (source->bytesAvailable() >= sizeof(CombinedHeader)) + QTimer::singleShot(0, this, SLOT(handleData())); + else + connect(source, SIGNAL(readyRead()), SLOT(handleData())); +} + +WaveDecoder::~WaveDecoder() +{ +} + +QAudioFormat WaveDecoder::audioFormat() const +{ + return format; +} + +int WaveDecoder::duration() const +{ + return size() * 1000 / (format.sampleSize() / 8) / format.channels() / format.frequency(); +} + +qint64 WaveDecoder::size() const +{ + return haveFormat ? dataSize : 0; +} + +bool WaveDecoder::isSequential() const +{ + return source->isSequential(); +} + +qint64 WaveDecoder::bytesAvailable() const +{ + return haveFormat ? source->bytesAvailable() : 0; +} + +qint64 WaveDecoder::readData(char *data, qint64 maxlen) +{ + return haveFormat ? source->read(data, maxlen) : 0; +} + +qint64 WaveDecoder::writeData(const char *data, qint64 len) +{ + Q_UNUSED(data); + Q_UNUSED(len); + + return -1; +} + +void WaveDecoder::handleData() +{ + if (source->bytesAvailable() < sizeof(CombinedHeader)) + return; + + source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); + source->read((char*)&header, sizeof(CombinedHeader)); + + if (qstrncmp(header.riff.descriptor.id, "RIFF", 4) != 0 || + qstrncmp(header.riff.type, "WAVE", 4) != 0 || + qstrncmp(header.wave.descriptor.id, "fmt ", 4) != 0 || + (header.wave.audioFormat != 0 && header.wave.audioFormat != 1) || + qstrncmp(header.data.descriptor.id, "data", 4) != 0) { + + emit invalidFormat(); + } + else { + int bps = qFromLittleEndian(header.wave.bitsPerSample); + + format.setCodec(QLatin1String("audio/pcm")); + format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt); + format.setByteOrder(QAudioFormat::LittleEndian); + format.setFrequency(qFromLittleEndian(header.wave.sampleRate)); + format.setSampleSize(bps); + format.setChannels(qFromLittleEndian(header.wave.numChannels)); + + dataSize = qFromLittleEndian(header.data.descriptor.size); + + haveFormat = true; + connect(source, SIGNAL(readyRead()), SIGNAL(readyRead())); + emit formatKnown(); + } +} + +QT_END_NAMESPACE diff --git a/src/multimedia/effects/wavedecoder_p.h b/src/multimedia/effects/wavedecoder_p.h new file mode 100644 index 0000000..00aa14e --- /dev/null +++ b/src/multimedia/effects/wavedecoder_p.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WAVEDECODER_H +#define WAVEDECODER_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + + +class WaveDecoder : public QIODevice +{ + Q_OBJECT + +public: + explicit WaveDecoder(QIODevice *source, QObject *parent = 0); + ~WaveDecoder(); + + QAudioFormat audioFormat() const; + int duration() const; + + qint64 size() const; + bool isSequential() const; + qint64 bytesAvailable() const; + +signals: + void formatKnown(); + void invalidFormat(); + +private slots: + void handleData(); + +private: + qint64 readData(char *data, qint64 maxlen); + qint64 writeData(const char *data, qint64 len); + + struct chunk + { + char id[4]; + quint32 size; + }; + struct RIFFHeader + { + chunk descriptor; + char type[4]; + }; + struct WAVEHeader + { + chunk descriptor; + quint16 audioFormat; + quint16 numChannels; + quint32 sampleRate; + quint32 byteRate; + quint16 blockAlign; + quint16 bitsPerSample; + }; + struct DATAHeader + { + chunk descriptor; + }; + struct CombinedHeader + { + RIFFHeader riff; + WAVEHeader wave; + DATAHeader data; + }; + + bool haveFormat; + qint64 dataSize; + qint64 remaining; + QAudioFormat format; + QIODevice *source; + CombinedHeader header; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // WAVEDECODER_H diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index 106d3ab..500aff7 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -12,6 +12,6 @@ include(audio/audio.pri) include(video/video.pri) include(base/base.pri) include(playback/playback.pri) -include(qml/qml.pri) +include(effects/effects.pri) symbian: TARGET.UID3 = 0x2001E627 diff --git a/src/multimedia/qml/multimediadeclarative.cpp b/src/multimedia/qml/multimediadeclarative.cpp deleted file mode 100644 index 7f5298f..0000000 --- a/src/multimedia/qml/multimediadeclarative.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - - -QT_BEGIN_NAMESPACE - -namespace QtMultimedia -{ - -/*! - Register the Multimedia QML elements. - \internal -*/ - -void qRegisterDeclarativeElements(const char *uri) -{ - Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); - - qmlRegisterType(uri, 4, 7, "SoundEffect"); - qmlRegisterType(uri, 4, 7, "Audio"); - qmlRegisterType(uri, 4, 7, "Video"); -} - -} - -QT_END_NAMESPACE - diff --git a/src/multimedia/qml/multimediadeclarative.h b/src/multimedia/qml/multimediadeclarative.h deleted file mode 100644 index 29af65a..0000000 --- a/src/multimedia/qml/multimediadeclarative.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTMULTIMEDIA_QML_H -#define QTMULTIMEDIA_QML_H - -#include - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Multimedia) - -namespace QtMultimedia -{ -extern void Q_MULTIMEDIA_EXPORT qRegisterDeclarativeElements(const char *uri); -} - -QT_END_NAMESPACE -QT_END_HEADER - -#endif // ifndef QTMULTIMEDIA_QML_H diff --git a/src/multimedia/qml/qdeclarativeaudio.cpp b/src/multimedia/qml/qdeclarativeaudio.cpp deleted file mode 100644 index 1cbf594..0000000 --- a/src/multimedia/qml/qdeclarativeaudio.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativeaudio_p.h" - -#include - -QT_BEGIN_NAMESPACE - - -/*! - \qmlclass Audio QDeclarativeAudio - \since 4.7 - \brief The Audio element allows you to add audio playback to a scene. - - \qml - Audio { source: "audio/song.mp3" } - \endqml - - \sa Video -*/ - -/*! - \internal - \class QDeclarativeAudio - \brief The QDeclarativeAudio class provides an audio item that you can add to a QDeclarativeView. -*/ - -void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString) -{ - m_error = QMediaPlayer::Error(errorCode); - m_errorString = errorString; - - emit error(Error(errorCode), errorString); - emit errorChanged(); -} - - -QDeclarativeAudio::QDeclarativeAudio(QObject *parent) - : QObject(parent) -{ - setObject(this); -} - -QDeclarativeAudio::~QDeclarativeAudio() -{ - shutdown(); -} - -/*! - \qmlmethod Audio::play() - - Starts playback of the media. - - Sets the \l playing property to true, and the \l paused property to false. -*/ - -void QDeclarativeAudio::play() -{ - m_playerControl->play(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Audio::pause() - - Pauses playback of the media. - - Sets the \l playing and \l paused properties to true. -*/ - -void QDeclarativeAudio::pause() -{ - m_playerControl->pause(); - - if (!m_paused && m_state == QMediaPlayer::PausedState) { - m_paused = true; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Audio::stop() - - Stops playback of the media. - - Sets the \l playing and \l paused properties to false. -*/ - -void QDeclarativeAudio::stop() -{ - m_playerControl->stop(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -/*! - \qmlproperty url Audio::source - - This property holds the source URL of the media. -*/ - -/*! - \qmlproperty bool Audio::playing - - This property holds whether the media is playing. - - Defaults to false, and can be set to true to start playback. -*/ - -/*! - \qmlproperty bool Audio::paused - - This property holds whether the media is paused. - - Defaults to false, and can be set to true to pause playback. -*/ - -/*! - \qmlsignal Audio::onStarted() - - This handler is called when playback is started. -*/ - -/*! - \qmlsignal Audio::onResumed() - - This handler is called when playback is resumed from the paused state. -*/ - -/*! - \qmlsignal Audio::onPaused() - - This handler is called when playback is paused. -*/ - -/*! - \qmlsignal Audio::onStopped() - - This handler is called when playback is stopped. -*/ - -/*! - \qmlproperty enum Audio::status - - This property holds the status of media loading. It can be one of: - - \list - \o NoMedia - no media has been set. - \o Loading - the media is currently being loaded. - \o Loaded - the media has been loaded. - \o Buffering - the media is buffering data. - \o Stalled - playback has been interrupted while the media is buffering data. - \o Buffered - the media has buffered data. - \o EndOfMedia - the media has played to the end. - \o InvalidMedia - the media cannot be played. - \o UnknownStatus - the status of the media is unknown. - \endlist -*/ - -QDeclarativeAudio::Status QDeclarativeAudio::status() const -{ - return Status(m_status); -} - -/*! - \qmlsignal Audio::onLoaded() - - This handler is called when the media source has been loaded. -*/ - -/*! - \qmlsignal Audio::onBuffering() - - This handler is called when the media starts buffering. -*/ - -/*! - \qmlsignal Audio::onStalled() - - This handler is called when playback has stalled while the media buffers. -*/ - -/*! - \qmlsignal Audio::onBuffered() - - This handler is called when the media has finished buffering. -*/ - -/*! - \qmlsignal Audio::onEndOfMedia() - - This handler is called when playback stops because end of the media has been reached. -*/ -/*! - \qmlproperty int Audio::duration - - This property holds the duration of the media in milliseconds. - - If the media doesn't have a fixed duration (a live stream for example) this will be 0. -*/ - -/*! - \qmlproperty int Audio::position - - This property holds the current playback position in milliseconds. - - If the \l seekable property is true, this property can be set to seek to a new position. -*/ - -/*! - \qmlproperty qreal Audio::volume - - This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). -*/ - -/*! - \qmlproperty bool Audio::muted - - This property holds whether the audio output is muted. -*/ - -/*! - \qmlproperty qreal Audio::bufferProgress - - This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 - (full). -*/ - -/*! - \qmlproperty bool Audio::seekable - - This property holds whether position of the audio can be changed. - - If true; setting a \l position value will cause playback to seek to the new position. -*/ - -/*! - \qmlproperty qreal Audio::playbackRate - - This property holds the rate at which audio is played at as a multiple of the normal rate. -*/ - -/*! - \qmlproperty enum Audio::error - - This property holds the error state of the audio. It can be one of: - - \list - \o NoError - there is no current error. - \o ResourceError - the audio cannot be played due to a problem allocating resources. - \o FormatError - the audio format is not supported. - \o NetworkError - the audio cannot be played due to network issues. - \o AccessDenied - the audio cannot be played due to insufficient permissions. - \o ServiceMissing - the audio cannot be played because the media service could not be - instantiated. - \endlist -*/ - -QDeclarativeAudio::Error QDeclarativeAudio::error() const -{ - return Error(m_error); -} - -/*! - \qmlproperty string Audio::errorString - - This property holds a string describing the current error condition in more detail. -*/ - -/*! - \qmlsignal Audio::onError(error, errorString) - - This handler is called when an \l {Error}{error} has occurred. The errorString parameter - may contain more detailed information about the error. -*/ - -QT_END_NAMESPACE - -#include "moc_qdeclarativeaudio_p.cpp" - - diff --git a/src/multimedia/qml/qdeclarativeaudio_p.h b/src/multimedia/qml/qdeclarativeaudio_p.h deleted file mode 100644 index d1fb275..0000000 --- a/src/multimedia/qml/qdeclarativeaudio_p.h +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEAUDIO_P_H -#define QDECLARATIVEAUDIO_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTimerEvent; - -class Q_AUTOTEST_EXPORT QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(int duration READ duration NOTIFY durationChanged) - Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) - Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) - Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) - Q_PROPERTY(Error error READ error NOTIFY errorChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - Q_ENUMS(Status) - Q_ENUMS(Error) - Q_INTERFACES(QDeclarativeParserStatus) -public: - enum Status - { - UnknownStatus = QMediaPlayer::UnknownMediaStatus, - NoMedia = QMediaPlayer::NoMedia, - Loading = QMediaPlayer::LoadingMedia, - Loaded = QMediaPlayer::LoadedMedia, - Stalled = QMediaPlayer::StalledMedia, - Buffering = QMediaPlayer::BufferingMedia, - Buffered = QMediaPlayer::BufferedMedia, - EndOfMedia = QMediaPlayer::EndOfMedia, - InvalidMedia = QMediaPlayer::InvalidMedia - }; - - enum Error - { - NoError = QMediaPlayer::NoError, - ResourceError = QMediaPlayer::ResourceError, - FormatError = QMediaPlayer::FormatError, - NetworkError = QMediaPlayer::NetworkError, - AccessDenied = QMediaPlayer::AccessDeniedError, - ServiceMissing = QMediaPlayer::ServiceMissingError - }; - - QDeclarativeAudio(QObject *parent = 0); - ~QDeclarativeAudio(); - - Status status() const; - Error error() const; - -public Q_SLOTS: - void play(); - void pause(); - void stop(); - -Q_SIGNALS: - void sourceChanged(); - - void playingChanged(); - void pausedChanged(); - - void started(); - void resumed(); - void paused(); - void stopped(); - - void statusChanged(); - - void loaded(); - void buffering(); - void stalled(); - void buffered(); - void endOfMedia(); - - void durationChanged(); - void positionChanged(); - - void volumeChanged(); - void mutedChanged(); - - void bufferProgressChanged(); - - void seekableChanged(); - void playbackRateChanged(); - - void errorChanged(); - void error(QDeclarativeAudio::Error error, const QString &errorString); - -private Q_SLOTS: - void _q_error(int, const QString &); - -private: - Q_DISABLE_COPY(QDeclarativeAudio) - Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) - Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) - Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) - - inline QDeclarativeMediaBase *mediaBase() { return this; } -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio)) - -QT_END_HEADER - -#endif diff --git a/src/multimedia/qml/qdeclarativemediabase.cpp b/src/multimedia/qml/qdeclarativemediabase.cpp deleted file mode 100644 index e054cb2..0000000 --- a/src/multimedia/qml/qdeclarativemediabase.cpp +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "QtMultimedia/private/qdeclarativemediabase_p.h" - -#include -#include - -#include -#include -#include -#include -#include - - - -QT_BEGIN_NAMESPACE - - -class QDeclarativeMediaBaseObject : public QMediaObject -{ -public: - QDeclarativeMediaBaseObject(QMediaService *service) - : QMediaObject(0, service) - { - } -}; - -class QDeclarativeMediaBasePlayerControl : public QMediaPlayerControl -{ -public: - QDeclarativeMediaBasePlayerControl(QObject *parent) - : QMediaPlayerControl(parent) - { - } - - QMediaPlayer::State state() const { return QMediaPlayer::StoppedState; } - QMediaPlayer::MediaStatus mediaStatus() const { return QMediaPlayer::NoMedia; } - - qint64 duration() const { return 0; } - qint64 position() const { return 0; } - void setPosition(qint64) {} - int volume() const { return 0; } - void setVolume(int) {} - bool isMuted() const { return false; } - void setMuted(bool) {} - int bufferStatus() const { return 0; } - bool isAudioAvailable() const { return false; } - bool isVideoAvailable() const { return false; } - bool isSeekable() const { return false; } - QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } - qreal playbackRate() const { return 1; } - void setPlaybackRate(qreal) {} - QMediaContent media() const { return QMediaContent(); } - const QIODevice *mediaStream() const { return 0; } - void setMedia(const QMediaContent &, QIODevice *) {} - - void play() {} - void pause() {} - void stop() {} -}; - -class QDeclarativeMediaBaseAnimation : public QObject -{ -public: - QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase *media) - : m_media(media) - { - } - - void start() { if (!m_timer.isActive()) m_timer.start(500, this); } - void stop() { m_timer.stop(); } - -protected: - void timerEvent(QTimerEvent *event) - { - if (event->timerId() == m_timer.timerId()) { - event->accept(); - - if (m_media->m_state == QMediaPlayer::PlayingState) - emit m_media->positionChanged(); - if (m_media->m_status == QMediaPlayer::BufferingMedia || QMediaPlayer::StalledMedia) - emit m_media->bufferProgressChanged(); - } else { - QObject::timerEvent(event); - } - } - -private: - QDeclarativeMediaBase *m_media; - QBasicTimer m_timer; -}; - -void QDeclarativeMediaBase::_q_stateChanged(QMediaPlayer::State state) -{ - if (state != m_state) { - QMediaPlayer::State oldState = m_state; - - m_state = state; - - if (state == QMediaPlayer::StoppedState) { - emit stopped(); - emit playingChanged(); - } else if (oldState == QMediaPlayer::StoppedState) { - emit started(); - emit playingChanged(); - } else if (oldState == QMediaPlayer::PausedState) { - m_paused = false; - - emit resumed(); - emit pausedChanged(); - } - - if (state == m_state && state == QMediaPlayer::PausedState) { - bool wasPaused = m_paused; - - m_paused = true; - - emit paused(); - - if (!wasPaused) - emit pausedChanged(); - } - - if (m_state == QMediaPlayer::PlayingState - || m_status == QMediaPlayer::BufferingMedia - || m_status == QMediaPlayer::StalledMedia) { - m_animation->start(); - } else { - m_animation->stop(); - } - } -} - -void QDeclarativeMediaBase::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status) -{ - if (status != m_status) { - m_status = status; - - switch (status) { - case QMediaPlayer::LoadedMedia: - emit loaded(); - break; - case QMediaPlayer::BufferingMedia: - emit buffering(); - break; - case QMediaPlayer::BufferedMedia: - emit buffered(); - break; - case QMediaPlayer::StalledMedia: - emit stalled(); - break; - case QMediaPlayer::EndOfMedia: - emit endOfMedia(); - break; - default: - break; - } - - emit statusChanged(); - - if (m_state == QMediaPlayer::PlayingState - || m_status == QMediaPlayer::BufferingMedia - || m_status == QMediaPlayer::StalledMedia) { - m_animation->start(); - } else { - m_animation->stop(); - } - } -} - -void QDeclarativeMediaBase::_q_metaDataChanged() -{ - m_metaObject->metaDataChanged(); -} - -QDeclarativeMediaBase::QDeclarativeMediaBase() - : m_mediaService(0) - , m_playerControl(0) - , m_mediaObject(0) - , m_mediaProvider(0) - , m_metaDataControl(0) - , m_metaObject(0) - , m_animation(0) - , m_state(QMediaPlayer::StoppedState) - , m_status(QMediaPlayer::NoMedia) - , m_error(QMediaPlayer::NoError) - , m_paused(false) -{ -} - -QDeclarativeMediaBase::~QDeclarativeMediaBase() -{ -} - -void QDeclarativeMediaBase::shutdown() -{ - delete m_metaObject; - delete m_mediaObject; - - if (m_mediaProvider) - m_mediaProvider->releaseService(m_mediaService); - - delete m_animation; - -} - -void QDeclarativeMediaBase::setObject(QObject *object) -{ - if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider())) { - if ((m_mediaService = m_mediaProvider->requestService(Q_MEDIASERVICE_MEDIAPLAYER))) { - m_playerControl = qobject_cast( - m_mediaService->control(QMediaPlayerControl_iid)); - m_metaDataControl = qobject_cast( - m_mediaService->control(QMetaDataControl_iid)); - m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService); - } - } - - if (m_playerControl) { - QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)), - object, SLOT(_q_stateChanged(QMediaPlayer::State))); - QObject::connect(m_playerControl, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), - object, SLOT(_q_mediaStatusChanged(QMediaPlayer::MediaStatus))); - QObject::connect(m_playerControl, SIGNAL(mediaChanged(QMediaContent)), - object, SIGNAL(sourceChanged())); - QObject::connect(m_playerControl, SIGNAL(durationChanged(qint64)), - object, SIGNAL(durationChanged())); - QObject::connect(m_playerControl, SIGNAL(positionChanged(qint64)), - object, SIGNAL(positionChanged())); - QObject::connect(m_playerControl, SIGNAL(volumeChanged(int)), - object, SIGNAL(volumeChanged())); - QObject::connect(m_playerControl, SIGNAL(mutedChanged(bool)), - object, SIGNAL(mutedChanged())); - QObject::connect(m_playerControl, SIGNAL(bufferStatusChanged(int)), - object, SIGNAL(bufferProgressChanged())); - QObject::connect(m_playerControl, SIGNAL(seekableChanged(bool)), - object, SIGNAL(seekableChanged())); - QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)), - object, SIGNAL(playbackRateChanged())); - QObject::connect(m_playerControl, SIGNAL(error(int,QString)), - object, SLOT(_q_error(int,QString))); - - m_animation = new QDeclarativeMediaBaseAnimation(this); - } else { - m_error = QMediaPlayer::ServiceMissingError; - - m_playerControl = new QDeclarativeMediaBasePlayerControl(object); - } - - if (m_metaDataControl) { - m_metaObject = new QMetaDataControlMetaObject(m_metaDataControl, object); - - QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()), - object, SLOT(_q_metaDataChanged())); - } -} - -QUrl QDeclarativeMediaBase::source() const -{ - return m_playerControl->media().canonicalUrl(); -} - -void QDeclarativeMediaBase::setSource(const QUrl &url) -{ - if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) { - m_error = QMediaPlayer::NoError; - m_errorString = QString(); - - emit errorChanged(); - } - - m_playerControl->setMedia(QMediaContent(url), 0); -} - -bool QDeclarativeMediaBase::isPlaying() const -{ - return m_state != QMediaPlayer::StoppedState; -} - -void QDeclarativeMediaBase::setPlaying(bool playing) -{ - if (playing && m_state == QMediaPlayer::StoppedState) { - if (m_paused) - m_playerControl->pause(); - else - m_playerControl->play(); - } else if (!playing) { - m_playerControl->stop(); - } -} - -bool QDeclarativeMediaBase::isPaused() const -{ - return m_paused; -} - -void QDeclarativeMediaBase::setPaused(bool paused) -{ - if (m_paused != paused) { - if (paused && m_state == QMediaPlayer::PlayingState) { - m_playerControl->pause(); - } else if (!paused && m_state == QMediaPlayer::PausedState) { - m_playerControl->play(); - } else { - m_paused = paused; - - emit pausedChanged(); - } - } -} - -int QDeclarativeMediaBase::duration() const -{ - return m_playerControl->duration(); -} - -int QDeclarativeMediaBase::position() const -{ - return m_playerControl->position(); - -} - -void QDeclarativeMediaBase::setPosition(int position) -{ - m_playerControl->setPosition(position); -} - -qreal QDeclarativeMediaBase::volume() const -{ - return qreal(m_playerControl->volume()) / 100; -} - -void QDeclarativeMediaBase::setVolume(qreal volume) -{ - m_playerControl->setVolume(qRound(volume * 100)); -} - -bool QDeclarativeMediaBase::isMuted() const -{ - return m_playerControl->isMuted(); -} - -void QDeclarativeMediaBase::setMuted(bool muted) -{ - m_playerControl->setMuted(muted); -} - -qreal QDeclarativeMediaBase::bufferProgress() const -{ - return qreal(m_playerControl->bufferStatus()) / 100; -} - -bool QDeclarativeMediaBase::isSeekable() const -{ - return m_playerControl->isSeekable(); -} - -qreal QDeclarativeMediaBase::playbackRate() const -{ - return m_playerControl->playbackRate(); -} - -void QDeclarativeMediaBase::setPlaybackRate(qreal rate) -{ - m_playerControl->setPlaybackRate(rate); -} - -QString QDeclarativeMediaBase::errorString() const -{ - return m_errorString; -} - -QT_END_NAMESPACE - diff --git a/src/multimedia/qml/qdeclarativemediabase_p.h b/src/multimedia/qml/qdeclarativemediabase_p.h deleted file mode 100644 index 2fc48db..0000000 --- a/src/multimedia/qml/qdeclarativemediabase_p.h +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEMEDIABASE_P_H -#define QDECLARATIVEMEDIABASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QMediaPlayerControl; -class QMediaService; -class QMediaServiceProvider; -class QMetaDataControl; -class QMetaDataControlMetaObject; -class QDeclarativeMediaBaseAnimation; - -class Q_AUTOTEST_EXPORT QDeclarativeMediaBase -{ -public: - QDeclarativeMediaBase(); - virtual ~QDeclarativeMediaBase(); - - QUrl source() const; - void setSource(const QUrl &url); - - bool isPlaying() const; - void setPlaying(bool playing); - - bool isPaused() const; - void setPaused(bool paused); - - int duration() const; - - int position() const; - void setPosition(int position); - - qreal volume() const; - void setVolume(qreal volume); - - bool isMuted() const; - void setMuted(bool muted); - - qreal bufferProgress() const; - - bool isSeekable() const; - - qreal playbackRate() const; - void setPlaybackRate(qreal rate); - - QString errorString() const; - - void _q_stateChanged(QMediaPlayer::State state); - void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status); - - void _q_metaDataChanged(); - -protected: - void shutdown(); - - void setObject(QObject *object); - - virtual void sourceChanged() = 0; - - virtual void playingChanged() = 0; - virtual void pausedChanged() = 0; - - virtual void started() = 0; - virtual void resumed() = 0; - virtual void paused() = 0; - virtual void stopped() = 0; - - virtual void statusChanged() = 0; - - virtual void loaded() = 0; - virtual void buffering() = 0; - virtual void stalled() = 0; - virtual void buffered() = 0; - virtual void endOfMedia() = 0; - - virtual void durationChanged() = 0; - virtual void positionChanged() = 0; - - virtual void volumeChanged() = 0; - virtual void mutedChanged() = 0; - - virtual void bufferProgressChanged() = 0; - - virtual void seekableChanged() = 0; - virtual void playbackRateChanged() = 0; - - virtual void errorChanged() = 0; - - QMediaService *m_mediaService; - QMediaPlayerControl *m_playerControl; - - QMediaObject *m_mediaObject; - QMediaServiceProvider *m_mediaProvider; - QMetaDataControl *m_metaDataControl; - QMetaDataControlMetaObject *m_metaObject; - QDeclarativeMediaBaseAnimation *m_animation; - - QMediaPlayer::State m_state; - QMediaPlayer::MediaStatus m_status; - QMediaPlayer::Error m_error; - bool m_paused; - QString m_errorString; - - friend class QDeclarativeMediaBaseAnimation; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/multimedia/qml/qdeclarativevideo.cpp b/src/multimedia/qml/qdeclarativevideo.cpp deleted file mode 100644 index 7f62075..0000000 --- a/src/multimedia/qml/qdeclarativevideo.cpp +++ /dev/null @@ -1,945 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativevideo_p.h" - -#include -#include -#include -#include -#include - - -QT_BEGIN_NAMESPACE - - -void QDeclarativeVideo::_q_nativeSizeChanged(const QSizeF &size) -{ - setImplicitWidth(size.width()); - setImplicitHeight(size.height()); -} - -void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) -{ - m_error = QMediaPlayer::Error(errorCode); - m_errorString = errorString; - - emit error(Error(errorCode), errorString); - emit errorChanged(); -} - - -/*! - \qmlclass Video QDeclarativeVideo - \since 4.7 - \brief The Video element allows you to add videos to a scene. - \inherits Item - - \qml - Video { source: "video/movie.mpg" } - \endqml - - The video item supports untransformed, stretched, and uniformly scaled video presentation. - For a description of stretched uniformly scaled presentation, see the \l fillMode property - description. - - The video item is only visible when the \l hasVideo property is true and the video is playing. - - \sa Audio -*/ - -/*! - \internal - \class QDeclarativeVideo - \brief The QDeclarativeVideo class provides a video item that you can add to a QDeclarativeView. -*/ - -QDeclarativeVideo::QDeclarativeVideo(QDeclarativeItem *parent) - : QDeclarativeItem(parent) - , m_graphicsItem(0) - -{ - m_graphicsItem = new QGraphicsVideoItem(this); - connect(m_graphicsItem, SIGNAL(nativeSizeChanged(QSizeF)), - this, SLOT(_q_nativeSizeChanged(QSizeF))); - - setObject(this); - - if (m_mediaService) { - connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)), - this, SIGNAL(hasAudioChanged())); - connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)), - this, SIGNAL(hasVideoChanged())); - - m_graphicsItem->setMediaObject(m_mediaObject); - } -} - -QDeclarativeVideo::~QDeclarativeVideo() -{ - shutdown(); - - delete m_graphicsItem; -} - -/*! - \qmlproperty url Video::source - - This property holds the source URL of the media. -*/ - -/*! - \qmlproperty bool Video::playing - - This property holds whether the media is playing. - - Defaults to false, and can be set to true to start playback. -*/ - -/*! - \qmlproperty bool Video::paused - - This property holds whether the media is paused. - - Defaults to false, and can be set to true to pause playback. -*/ - -/*! - \qmlsignal Video::onStarted() - - This handler is called when playback is started. -*/ - -/*! - \qmlsignal Video::onResumed() - - This handler is called when playback is resumed from the paused state. -*/ - -/*! - \qmlsignal Video::onPaused() - - This handler is called when playback is paused. -*/ - -/*! - \qmlsignal Video::onStopped() - - This handler is called when playback is stopped. -*/ - -/*! - \qmlproperty enum Video::status - - This property holds the status of media loading. It can be one of: - - \list - \o NoMedia - no media has been set. - \o Loading - the media is currently being loaded. - \o Loaded - the media has been loaded. - \o Buffering - the media is buffering data. - \o Stalled - playback has been interrupted while the media is buffering data. - \o Buffered - the media has buffered data. - \o EndOfMedia - the media has played to the end. - \o InvalidMedia - the media cannot be played. - \o UnknownStatus - the status of the media is cannot be determined. - \endlist -*/ - -QDeclarativeVideo::Status QDeclarativeVideo::status() const -{ - return Status(m_status); -} - -/*! - \qmlsignal Video::onLoaded() - - This handler is called when the media source has been loaded. -*/ - -/*! - \qmlsignal Video::onBuffering() - - This handler is called when the media starts buffering. -*/ - -/*! - \qmlsignal Video::onStalled() - - This handler is called when playback has stalled while the media buffers. -*/ - -/*! - \qmlsignal Video::onBuffered() - - This handler is called when the media has finished buffering. -*/ - -/*! - \qmlsignal Video::onEndOfMedia() - - This handler is called when playback stops because end of the media has been reached. -*/ - -/*! - \qmlproperty int Video::duration - - This property holds the duration of the media in milliseconds. - - If the media doesn't have a fixed duration (a live stream for example) this will be 0. -*/ - -/*! - \qmlproperty int Video::position - - This property holds the current playback position in milliseconds. -*/ - -/*! - \qmlproperty qreal Video::volume - - This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). -*/ - -/*! - \qmlproperty bool Video::muted - - This property holds whether the audio output is muted. -*/ - -/*! - \qmlproperty bool Video::hasAudio - - This property holds whether the media contains audio. -*/ - -bool QDeclarativeVideo::hasAudio() const -{ - return m_playerControl->isAudioAvailable(); -} - -/*! - \qmlproperty bool Video::hasVideo - - This property holds whether the media contains video. -*/ - -bool QDeclarativeVideo::hasVideo() const -{ - return m_playerControl->isVideoAvailable(); -} - -/*! - \qmlproperty qreal Video::bufferProgress - - This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 - (full). -*/ - -/*! - \qmlproperty bool Video::seekable - - This property holds whether position of the video can be changed. -*/ - -/*! - \qmlproperty qreal Video::playbackRate - - This property holds the rate at which video is played at as a multiple of the normal rate. -*/ - -/*! - \qmlproperty enum Video::error - - This property holds the error state of the video. It can be one of: - - \list - \o NoError - there is no current error. - \o ResourceError - the video cannot be played due to a problem allocating resources. - \o FormatError - the video format is not supported. - \o NetworkError - the video cannot be played due to network issues. - \o AccessDenied - the video cannot be played due to insufficient permissions. - \o ServiceMissing - the video cannot be played because the media service could not be - instantiated. - \endlist -*/ - - -QDeclarativeVideo::Error QDeclarativeVideo::error() const -{ - return Error(m_error); -} - -/*! - \qmlproperty string Video::errorString - - This property holds a string describing the current error condition in more detail. -*/ - -/*! - \qmlsignal Video::onError(error, errorString) - - This handler is called when an \l {Error}{error} has occurred. The errorString parameter - may contain more detailed information about the error. -*/ - -/*! - \qmlproperty enum Video::fillMode - - Set this property to define how the video is scaled to fit the target area. - - \list - \o Stretch - the video is scaled to fit. - \o PreserveAspectFit - the video is scaled uniformly to fit without cropping - \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary - \endlist - - The default fill mode is PreserveAspectFit. -*/ - -QDeclarativeVideo::FillMode QDeclarativeVideo::fillMode() const -{ - return FillMode(m_graphicsItem->aspectRatioMode()); -} - -void QDeclarativeVideo::setFillMode(FillMode mode) -{ - m_graphicsItem->setAspectRatioMode(Qt::AspectRatioMode(mode)); -} - -/*! - \qmlmethod Video::play() - - Starts playback of the media. - - Sets the \l playing property to true, and the \l paused property to false. -*/ - -void QDeclarativeVideo::play() -{ - m_playerControl->play(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Video::pause() - - Pauses playback of the media. - - Sets the \l playing and \l paused properties to true. -*/ - -void QDeclarativeVideo::pause() -{ - m_playerControl->pause(); - - if (!m_paused && m_state == QMediaPlayer::PausedState) { - m_paused = true; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Video::stop() - - Stops playback of the media. - - Sets the \l playing and \l paused properties to false. -*/ - -void QDeclarativeVideo::stop() -{ - m_playerControl->stop(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -void QDeclarativeVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) -{ -} - -void QDeclarativeVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - m_graphicsItem->setSize(newGeometry.size()); - - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); -} - -QT_END_NAMESPACE - -// *************************************** -// Documentation for meta-data properties. -// *************************************** - -/*! - \qmlproperty variant Video::title - - This property holds the tile of the media. - - \sa {QtMultimedia::Title} -*/ - -/*! - \qmlproperty variant Video::subTitle - - This property holds the sub-title of the media. - - \sa {QtMultimedia::SubTitle} -*/ - -/*! - \qmlproperty variant Video::author - - This property holds the author of the media. - - \sa {QtMultimedia::Author} -*/ - -/*! - \qmlproperty variant Video::comment - - This property holds a user comment about the media. - - \sa {QtMultimedia::Comment} -*/ - -/*! - \qmlproperty variant Video::description - - This property holds a description of the media. - - \sa {QtMultimedia::Description} -*/ - -/*! - \qmlproperty variant Video::category - - This property holds the category of the media - - \sa {QtMultimedia::Category} -*/ - -/*! - \qmlproperty variant Video::genre - - This property holds the genre of the media. - - \sa {QtMultimedia::Genre} -*/ - -/*! - \qmlproperty variant Video::year - - This property holds the year of release of the media. - - \sa {QtMultimedia::Year} -*/ - -/*! - \qmlproperty variant Video::date - - This property holds the date of the media. - - \sa {QtMultimedia::Date} -*/ - -/*! - \qmlproperty variant Video::userRating - - This property holds a user rating of the media in the range of 0 to 100. - - \sa {QtMultimedia::UserRating} -*/ - -/*! - \qmlproperty variant Video::keywords - - This property holds a list of keywords describing the media. - - \sa {QtMultimedia::Keywords} -*/ - -/*! - \qmlproperty variant Video::language - - This property holds the language of the media, as an ISO 639-2 code. - - \sa {QtMultimedia::Language} -*/ - -/*! - \qmlproperty variant Video::publisher - - This property holds the publisher of the media. - - \sa {QtMultimedia::Publisher} -*/ - -/*! - \qmlproperty variant Video::copyright - - This property holds the media's copyright notice. - - \sa {QtMultimedia::Copyright} -*/ - -/*! - \qmlproperty variant Video::parentalRating - - This property holds the parental rating of the media. - - \sa {QtMultimedia::ParentalRating} -*/ - -/*! - \qmlproperty variant Video::ratingOrganisation - - This property holds the name of the rating organisation responsible for the - parental rating of the media. - - \sa {QtMultimedia::RatingOrganisation} -*/ - -/*! - \qmlproperty variant Video::size - - This property property holds the size of the media in bytes. - - \sa {QtMultimedia::Size} -*/ - -/*! - \qmlproperty variant Video::mediaType - - This property holds the type of the media. - - \sa {QtMultimedia::MediaType} -*/ - -/*! - \qmlproperty variant Video::audioBitRate - - This property holds the bit rate of the media's audio stream ni bits per - second. - - \sa {QtMultimedia::AudioBitRate} -*/ - -/*! - \qmlproperty variant Video::audioCodec - - This property holds the encoding of the media audio stream. - - \sa {QtMultimedia::AudioCodec} -*/ - -/*! - \qmlproperty variant Video::averageLevel - - This property holds the average volume level of the media. - - \sa {QtMultimedia::AverageLevel} -*/ - -/*! - \qmlproperty variant Video::channelCount - - This property holds the number of channels in the media's audio stream. - - \sa {QtMultimedia::ChannelCount} -*/ - -/*! - \qmlproperty variant Video::peakValue - - This property holds the peak volume of media's audio stream. - - \sa {QtMultimedia::PeakValue} -*/ - -/*! - \qmlproperty variant Video::sampleRate - - This property holds the sample rate of the media's audio stream in hertz. - - \sa {QtMultimedia::SampleRate} -*/ - -/*! - \qmlproperty variant Video::albumTitle - - This property holds the title of the album the media belongs to. - - \sa {QtMultimedia::AlbumTitle} -*/ - -/*! - \qmlproperty variant Video::albumArtist - - This property holds the name of the principal artist of the album the media - belongs to. - - \sa {QtMultimedia::AlbumArtist} -*/ - -/*! - \qmlproperty variant Video::contributingArtist - - This property holds the names of artists contributing to the media. - - \sa {QtMultimedia::ContributingArtist} -*/ - -/*! - \qmlproperty variant Video::composer - - This property holds the composer of the media. - - \sa {QtMultimedia::Composer} -*/ - -/*! - \qmlproperty variant Video::conductor - - This property holds the conductor of the media. - - \sa {QtMultimedia::Conductor} -*/ - -/*! - \qmlproperty variant Video::lyrics - - This property holds the lyrics to the media. - - \sa {QtMultimedia::Lyrics} -*/ - -/*! - \qmlproperty variant Video::mood - - This property holds the mood of the media. - - \sa {QtMultimedia::Mood} -*/ - -/*! - \qmlproperty variant Video::trackNumber - - This property holds the track number of the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Video::trackCount - - This property holds the number of track on the album containing the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Video::coverArtUrlSmall - - This property holds the URL of a small cover art image. - - \sa {QtMultimedia::CoverArtUrlSmall} -*/ - -/*! - \qmlproperty variant Video::coverArtUrlLarge - - This property holds the URL of a large cover art image. - - \sa {QtMultimedia::CoverArtUrlLarge} -*/ - -/*! - \qmlproperty variant Video::resolution - - This property holds the dimension of an image or video. - - \sa {QtMultimedia::Resolution} -*/ - -/*! - \qmlproperty variant Video::pixelAspectRatio - - This property holds the pixel aspect ratio of an image or video. - - \sa {QtMultimedia::PixelAspectRatio} -*/ - -/*! - \qmlproperty variant Video::videoFrameRate - - This property holds the frame rate of the media's video stream. - - \sa {QtMultimedia::VideoFrameRate} -*/ - -/*! - \qmlproperty variant Video::videoBitRate - - This property holds the bit rate of the media's video stream in bits per - second. - - \sa {QtMultimedia::VideoBitRate} -*/ - -/*! - \qmlproperty variant Video::videoCodec - - This property holds the encoding of the media's video stream. - - \sa {QtMultimedia::VideoCodec} -*/ - -/*! - \qmlproperty variant Video::posterUrl - - This property holds the URL of a poster image. - - \sa {QtMultimedia::PosterUrl} -*/ - -/*! - \qmlproperty variant Video::chapterNumber - - This property holds the chapter number of the media. - - \sa {QtMultimedia::ChapterNumber} -*/ - -/*! - \qmlproperty variant Video::director - - This property holds the director of the media. - - \sa {QtMultimedia::Director} -*/ - -/*! - \qmlproperty variant Video::leadPerformer - - This property holds the lead performer in the media. - - \sa {QtMultimedia::LeadPerformer} -*/ - -/*! - \qmlproperty variant Video::writer - - This property holds the writer of the media. - - \sa {QtMultimedia::Writer} -*/ - -// The remaining properties are related to photos, and are technically -// available but will certainly never have values. -#ifndef Q_QDOC - -/*! - \qmlproperty variant Video::cameraManufacturer - - \sa {QtMultimedia::CameraManufacturer} -*/ - -/*! - \qmlproperty variant Video::cameraModel - - \sa {QtMultimedia::CameraModel} -*/ - -/*! - \qmlproperty variant Video::event - - \sa {QtMultimedia::Event} -*/ - -/*! - \qmlproperty variant Video::subject - - \sa {QtMultimedia::Subject} -*/ - -/*! - \qmlproperty variant Video::orientation - - \sa {QtMultimedia::Orientation} -*/ - -/*! - \qmlproperty variant Video::exposureTime - - \sa {QtMultimedia::ExposureTime} -*/ - -/*! - \qmlproperty variant Video::fNumber - - \sa {QtMultimedia::FNumber} -*/ - -/*! - \qmlproperty variant Video::exposureProgram - - \sa {QtMultimedia::ExposureProgram} -*/ - -/*! - \qmlproperty variant Video::isoSpeedRatings - - \sa {QtMultimedia::ISOSpeedRatings} -*/ - -/*! - \qmlproperty variant Video::exposureBiasValue - - \sa {QtMultimedia::ExposureBiasValue} -*/ - -/*! - \qmlproperty variant Video::dateTimeDigitized - - \sa {QtMultimedia::DateTimeDigitized} -*/ - -/*! - \qmlproperty variant Video::subjectDistance - - \sa {QtMultimedia::SubjectDistance} -*/ - -/*! - \qmlproperty variant Video::meteringMode - - \sa {QtMultimedia::MeteringMode} -*/ - -/*! - \qmlproperty variant Video::lightSource - - \sa {QtMultimedia::LightSource} -*/ - -/*! - \qmlproperty variant Video::flash - - \sa {QtMultimedia::Flash} -*/ - -/*! - \qmlproperty variant Video::focalLength - - \sa {QtMultimedia::FocalLength} -*/ - -/*! - \qmlproperty variant Video::exposureMode - - \sa {QtMultimedia::ExposureMode} -*/ - -/*! - \qmlproperty variant Video::whiteBalance - - \sa {QtMultimedia::WhiteBalance} -*/ - -/*! - \qmlproperty variant Video::DigitalZoomRatio - - \sa {QtMultimedia::DigitalZoomRatio} -*/ - -/*! - \qmlproperty variant Video::focalLengthIn35mmFilm - - \sa {QtMultimedia::FocalLengthIn35mmFile} -*/ - -/*! - \qmlproperty variant Video::sceneCaptureType - - \sa {QtMultimedia::SceneCaptureType} -*/ - -/*! - \qmlproperty variant Video::gainControl - - \sa {QtMultimedia::GainControl} -*/ - -/*! - \qmlproperty variant Video::contrast - - \sa {QtMultimedia::contrast} -*/ - -/*! - \qmlproperty variant Video::saturation - - \sa {QtMultimedia::Saturation} -*/ - -/*! - \qmlproperty variant Video::sharpness - - \sa {QtMultimedia::Sharpness} -*/ - -/*! - \qmlproperty variant Video::deviceSettingDescription - - \sa {QtMultimedia::DeviceSettingDescription} -*/ - -#endif - -#include "moc_qdeclarativevideo_p.cpp" diff --git a/src/multimedia/qml/qdeclarativevideo_p.h b/src/multimedia/qml/qdeclarativevideo_p.h deleted file mode 100644 index d5ebde1..0000000 --- a/src/multimedia/qml/qdeclarativevideo_p.h +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIDEO_H -#define QDECLARATIVEVIDEO_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTimerEvent; -class QVideoSurfaceFormat; - - -class Q_AUTOTEST_EXPORT QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(int duration READ duration NOTIFY durationChanged) - Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(bool hasAudio READ hasAudio NOTIFY hasAudioChanged) - Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged) - Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) - Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) - Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) - Q_PROPERTY(Error error READ error NOTIFY errorChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode) - Q_ENUMS(FillMode) - Q_ENUMS(Status) - Q_ENUMS(Error) -public: - enum FillMode - { - Stretch = Qt::IgnoreAspectRatio, - PreserveAspectFit = Qt::KeepAspectRatio, - PreserveAspectCrop = Qt::KeepAspectRatioByExpanding - }; - - enum Status - { - UnknownStatus = QMediaPlayer::UnknownMediaStatus, - NoMedia = QMediaPlayer::NoMedia, - Loading = QMediaPlayer::LoadingMedia, - Loaded = QMediaPlayer::LoadedMedia, - Stalled = QMediaPlayer::StalledMedia, - Buffering = QMediaPlayer::BufferingMedia, - Buffered = QMediaPlayer::BufferedMedia, - EndOfMedia = QMediaPlayer::EndOfMedia, - InvalidMedia = QMediaPlayer::InvalidMedia - }; - - enum Error - { - NoError = QMediaPlayer::NoError, - ResourceError = QMediaPlayer::ResourceError, - FormatError = QMediaPlayer::FormatError, - NetworkError = QMediaPlayer::NetworkError, - AccessDenied = QMediaPlayer::AccessDeniedError, - ServiceMissing = QMediaPlayer::ServiceMissingError - }; - - QDeclarativeVideo(QDeclarativeItem *parent = 0); - ~QDeclarativeVideo(); - - bool hasAudio() const; - bool hasVideo() const; - - FillMode fillMode() const; - void setFillMode(FillMode mode); - - Status status() const; - Error error() const; - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - -public Q_SLOTS: - void play(); - void pause(); - void stop(); - -Q_SIGNALS: - void sourceChanged(); - - void playingChanged(); - void pausedChanged(); - - void started(); - void resumed(); - void paused(); - void stopped(); - - void statusChanged(); - - void loaded(); - void buffering(); - void stalled(); - void buffered(); - void endOfMedia(); - - void durationChanged(); - void positionChanged(); - - void volumeChanged(); - void mutedChanged(); - void hasAudioChanged(); - void hasVideoChanged(); - - void bufferProgressChanged(); - - void seekableChanged(); - void playbackRateChanged(); - - void errorChanged(); - void error(QDeclarativeVideo::Error error, const QString &errorString); - -protected: - void geometryChanged(const QRectF &geometry, const QRectF &); - -private Q_SLOTS: - void _q_nativeSizeChanged(const QSizeF &size); - void _q_error(int, const QString &); - -private: - Q_DISABLE_COPY(QDeclarativeVideo) - - QGraphicsVideoItem *m_graphicsItem; - - Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) - Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) - Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) - - inline QDeclarativeMediaBase *mediaBase() { return this; } -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeVideo)) - -QT_END_HEADER - -#endif diff --git a/src/multimedia/qml/qmetadatacontrolmetaobject.cpp b/src/multimedia/qml/qmetadatacontrolmetaobject.cpp deleted file mode 100644 index 47b6382..0000000 --- a/src/multimedia/qml/qmetadatacontrolmetaobject.cpp +++ /dev/null @@ -1,362 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - - -QT_BEGIN_NAMESPACE - -// copied from qmetaobject.cpp -// do not touch without touching the moc as well -enum PropertyFlags { - Invalid = 0x00000000, - Readable = 0x00000001, - Writable = 0x00000002, - Resettable = 0x00000004, - EnumOrFlag = 0x00000008, - StdCppSet = 0x00000100, -// Override = 0x00000200, - Designable = 0x00001000, - ResolveDesignable = 0x00002000, - Scriptable = 0x00004000, - ResolveScriptable = 0x00008000, - Stored = 0x00010000, - ResolveStored = 0x00020000, - Editable = 0x00040000, - ResolveEditable = 0x00080000, - User = 0x00100000, - ResolveUser = 0x00200000, - Notify = 0x00400000, - Dynamic = 0x00800000 -}; - -enum MethodFlags { - AccessPrivate = 0x00, - AccessProtected = 0x01, - AccessPublic = 0x02, - AccessMask = 0x03, //mask - - MethodMethod = 0x00, - MethodSignal = 0x04, - MethodSlot = 0x08, - MethodConstructor = 0x0c, - MethodTypeMask = 0x0c, - - MethodCompatibility = 0x10, - MethodCloned = 0x20, - MethodScriptable = 0x40 -}; - -struct QMetaObjectPrivate -{ - int revision; - int className; - int classInfoCount, classInfoData; - int methodCount, methodData; - int propertyCount, propertyData; - int enumeratorCount, enumeratorData; - int constructorCount, constructorData; - int flags; -}; - -static inline const QMetaObjectPrivate *priv(const uint* m_data) -{ return reinterpret_cast(m_data); } -// end of copied lines from qmetaobject.cpp - -namespace -{ - struct MetaDataKey - { - QtMultimedia::MetaData key; - const char *name; - }; - - const MetaDataKey qt_metaDataKeys[] = - { - { QtMultimedia::Title, "title" }, - { QtMultimedia::SubTitle, "subTitle" }, - { QtMultimedia::Author, "author" }, - { QtMultimedia::Comment, "comment" }, - { QtMultimedia::Description, "description" }, - { QtMultimedia::Category, "category" }, - { QtMultimedia::Genre, "genre" }, - { QtMultimedia::Year, "year" }, - { QtMultimedia::Date, "date" }, - { QtMultimedia::UserRating, "userRating" }, - { QtMultimedia::Keywords, "keywords" }, - { QtMultimedia::Language, "language" }, - { QtMultimedia::Publisher, "publisher" }, - { QtMultimedia::Copyright, "copyright" }, - { QtMultimedia::ParentalRating, "parentalRating" }, - { QtMultimedia::RatingOrganisation, "ratingOrganisation" }, - - // Media - { QtMultimedia::Size, "size" }, - { QtMultimedia::MediaType, "mediaType" }, -// { QtMultimedia::Duration, "duration" }, - - // Audio - { QtMultimedia::AudioBitRate, "audioBitRate" }, - { QtMultimedia::AudioCodec, "audioCodec" }, - { QtMultimedia::AverageLevel, "averageLevel" }, - { QtMultimedia::ChannelCount, "channelCount" }, - { QtMultimedia::PeakValue, "peakValue" }, - { QtMultimedia::SampleRate, "sampleRate" }, - - // Music - { QtMultimedia::AlbumTitle, "albumTitle" }, - { QtMultimedia::AlbumArtist, "albumArtist" }, - { QtMultimedia::ContributingArtist, "contributingArtist" }, - { QtMultimedia::Composer, "composer" }, - { QtMultimedia::Conductor, "conductor" }, - { QtMultimedia::Lyrics, "lyrics" }, - { QtMultimedia::Mood, "mood" }, - { QtMultimedia::TrackNumber, "trackNumber" }, - { QtMultimedia::TrackCount, "trackCount" }, - - { QtMultimedia::CoverArtUrlSmall, "coverArtUrlSmall" }, - { QtMultimedia::CoverArtUrlLarge, "coverArtUrlLarge" }, - - // Image/Video - { QtMultimedia::Resolution, "resolution" }, - { QtMultimedia::PixelAspectRatio, "pixelAspectRatio" }, - - // Video - { QtMultimedia::VideoFrameRate, "videoFrameRate" }, - { QtMultimedia::VideoBitRate, "videoBitRate" }, - { QtMultimedia::VideoCodec, "videoCodec" }, - - { QtMultimedia::PosterUrl, "posterUrl" }, - - // Movie - { QtMultimedia::ChapterNumber, "chapterNumber" }, - { QtMultimedia::Director, "director" }, - { QtMultimedia::LeadPerformer, "leadPerformer" }, - { QtMultimedia::Writer, "writer" }, - - // Photos - { QtMultimedia::CameraManufacturer, "cameraManufacturer" }, - { QtMultimedia::CameraModel, "cameraModel" }, - { QtMultimedia::Event, "event" }, - { QtMultimedia::Subject, "subject" }, - { QtMultimedia::Orientation, "orientation" }, - { QtMultimedia::ExposureTime, "exposureTime" }, - { QtMultimedia::FNumber, "fNumber" }, - { QtMultimedia::ExposureProgram, "exposureProgram" }, - { QtMultimedia::ISOSpeedRatings, "isoSpeedRatings" }, - { QtMultimedia::ExposureBiasValue, "exposureBiasValue" }, - { QtMultimedia::DateTimeOriginal, "dateTimeOriginal" }, - { QtMultimedia::DateTimeDigitized, "dateTimeDigitized" }, - { QtMultimedia::SubjectDistance, "subjectDistance" }, - { QtMultimedia::MeteringMode, "meteringMode" }, - { QtMultimedia::LightSource, "lightSource" }, - { QtMultimedia::Flash, "flash" }, - { QtMultimedia::FocalLength, "focalLength" }, - { QtMultimedia::ExposureMode, "exposureMode" }, - { QtMultimedia::WhiteBalance, "whiteBalance" }, - { QtMultimedia::DigitalZoomRatio, "digitalZoomRatio" }, - { QtMultimedia::FocalLengthIn35mmFilm, "focalLengthIn35mmFilm" }, - { QtMultimedia::SceneCaptureType, "sceneCaptureType" }, - { QtMultimedia::GainControl, "gainControl" }, - { QtMultimedia::Contrast, "contrast" }, - { QtMultimedia::Saturation, "saturation" }, - { QtMultimedia::Sharpness, "sharpness" }, - { QtMultimedia::DeviceSettingDescription, "deviceSettingDescription" } - }; - - class QMetaDataControlObject : public QObject - { - public: - inline QObjectData *data() { return d_ptr.data(); } - }; -} - -QMetaDataControlMetaObject::QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object) - : m_control(control) - , m_object(object) - , m_string(0) - , m_data(0) - , m_propertyOffset(0) - , m_signalOffset(0) -{ - const QMetaObject *superClass = m_object->metaObject(); - - const int propertyCount = sizeof(qt_metaDataKeys) / sizeof(MetaDataKey); - const int dataSize = sizeof(uint) - * (13 // QMetaObjectPrivate members. - + 5 // 5 members per signal. - + 4 * propertyCount // 3 members per property + 1 notify signal per property. - + 1); // Terminating value. - - m_data = reinterpret_cast(qMalloc(dataSize)); - - QMetaObjectPrivate *pMeta = reinterpret_cast(m_data); - - pMeta->revision = 3; - pMeta->className = 0; - pMeta->classInfoCount = 0; - pMeta->classInfoData = 0; - pMeta->methodCount = 1; - pMeta->methodData = 13; - pMeta->propertyCount = propertyCount; - pMeta->propertyData = 18; - pMeta->enumeratorCount = 0; - pMeta->enumeratorData = 0; - pMeta->constructorCount = 0; - pMeta->constructorData = 0; - pMeta->flags = 0x01; // Dynamic meta object flag. - - const int classNameSize = qstrlen(superClass->className()) + 1; - - int stringIndex = classNameSize + 1; - - // __metaDataChanged() signal. - static const char *changeSignal = "__metaDataChanged()"; - const int changeSignalSize = qstrlen(changeSignal) + 1; - - m_data[13] = stringIndex; // Signature. - m_data[14] = classNameSize; // Parameters. - m_data[15] = classNameSize; // Type. - m_data[16] = classNameSize; // Tag. - m_data[17] = MethodSignal | AccessProtected; // Flags. - - stringIndex += changeSignalSize; - - const char *qvariantName = "QVariant"; - const int qvariantSize = qstrlen(qvariantName) + 1; - const int qvariantIndex = stringIndex; - - stringIndex += qvariantSize; - - // Properties. - for (int i = 0; i < propertyCount; ++i) { - m_data[18 + 3 * i] = stringIndex; // Name. - m_data[19 + 3 * i] = qvariantIndex; // Type. - m_data[20 + 3 * i] - = Readable | Writable | Notify | Dynamic | (0xffffffff << 24); // Flags. - m_data[18 + propertyCount * 3 + i] = 0; // Notify signal. - - stringIndex += qstrlen(qt_metaDataKeys[i].name) + 1; - } - - // Terminating value. - m_data[18 + propertyCount * 4] = 0; - - // Build string. - m_string = reinterpret_cast(qMalloc(stringIndex + 1)); - - // Class name. - qMemCopy(m_string, superClass->className(), classNameSize); - - stringIndex = classNameSize; - - // Null m_string. - m_string[stringIndex] = '\0'; - stringIndex += 1; - - // __metaDataChanged() signal. - qMemCopy(m_string + stringIndex, changeSignal, changeSignalSize); - stringIndex += changeSignalSize; - - qMemCopy(m_string + stringIndex, qvariantName, qvariantSize); - stringIndex += qvariantSize; - - // Properties. - for (int i = 0; i < propertyCount; ++i) { - const int propertyNameSize = qstrlen(qt_metaDataKeys[i].name) + 1; - - qMemCopy(m_string + stringIndex, qt_metaDataKeys[i].name, propertyNameSize); - stringIndex += propertyNameSize; - } - - // Terminating character. - m_string[stringIndex] = '\0'; - - d.superdata = superClass; - d.stringdata = m_string; - d.data = m_data; - d.extradata = 0; - - static_cast(m_object)->data()->metaObject = this; - - m_propertyOffset = propertyOffset(); - m_signalOffset = methodOffset(); -} - -QMetaDataControlMetaObject::~QMetaDataControlMetaObject() -{ - static_cast(m_object)->data()->metaObject = 0; - - qFree(m_data); - qFree(m_string); -} - -int QMetaDataControlMetaObject::metaCall(QMetaObject::Call c, int id, void **a) -{ - if (c == QMetaObject::ReadProperty && id >= m_propertyOffset) { - int propId = id - m_propertyOffset; - - *reinterpret_cast(a[0]) = m_control->metaData(qt_metaDataKeys[propId].key); - - return -1; - } else if (c == QMetaObject::WriteProperty && id >= m_propertyOffset) { - int propId = id - m_propertyOffset; - - m_control->setMetaData(qt_metaDataKeys[propId].key, *reinterpret_cast(a[0])); - - return -1; - } else { - return m_object->qt_metacall(c, id, a); - } -} - -int QMetaDataControlMetaObject::createProperty(const char *, const char *) -{ - return -1; -} - -void QMetaDataControlMetaObject::metaDataChanged() -{ - activate(m_object, m_signalOffset, 0); -} - -QT_END_NAMESPACE diff --git a/src/multimedia/qml/qmetadatacontrolmetaobject_p.h b/src/multimedia/qml/qmetadatacontrolmetaobject_p.h deleted file mode 100644 index ec4df05..0000000 --- a/src/multimedia/qml/qmetadatacontrolmetaobject_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMETADATACONTROLMETAOBJECT_P_H -#define QMETADATACONTROLMETAOJBECT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QMetaDataControl; - -class QMetaDataControlMetaObject : public QAbstractDynamicMetaObject -{ -public: - QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object); - ~QMetaDataControlMetaObject(); - - int metaCall(QMetaObject::Call call, int _id, void **arguments); - int createProperty(const char *, const char *); - - void metaDataChanged(); - -private: - QMetaDataControl *m_control; - QObject *m_object; - char *m_string; - uint *m_data; - - int m_propertyOffset; - int m_signalOffset; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/multimedia/qml/qml.pri b/src/multimedia/qml/qml.pri deleted file mode 100644 index d0ff71d..0000000 --- a/src/multimedia/qml/qml.pri +++ /dev/null @@ -1,37 +0,0 @@ - -contains(QT_CONFIG, declarative) { - QT += declarative - - system(pkg-config --exists \'libpulse >= 0.9.10\') { - DEFINES += QT_MULTIMEDIA_PULSEAUDIO - HEADERS += $$PWD/qsoundeffect_pulse_p.h - SOURCES += $$PWD/qsoundeffect_pulse_p.cpp - LIBS += -lpulse - } else:x11 { - DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER - HEADERS += $$PWD/qsoundeffect_qmedia_p.h - SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp - } else { - HEADERS += $$PWD/qsoundeffect_qsound_p.h - SOURCES += $$PWD/qsoundeffect_qsound_p.cpp - } - - HEADERS += \ - $$PWD/multimediadeclarative.h \ - $$PWD/qmetadatacontrolmetaobject_p.h \ - $$PWD/qdeclarativeaudio_p.h \ - $$PWD/qdeclarativevideo_p.h \ - $$PWD/qdeclarativemediabase_p.h \ - $$PWD/qsoundeffect_p.h \ - $$PWD/wavedecoder_p.h - - SOURCES += \ - $$PWD/multimediadeclarative.cpp \ - $$PWD/qmetadatacontrolmetaobject.cpp \ - $$PWD/qdeclarativeaudio.cpp \ - $$PWD/qdeclarativevideo.cpp \ - $$PWD/qdeclarativemediabase.cpp \ - $$PWD/qsoundeffect.cpp \ - $$PWD/wavedecoder_p.cpp -} - diff --git a/src/multimedia/qml/qsoundeffect.cpp b/src/multimedia/qml/qsoundeffect.cpp deleted file mode 100644 index 541e6c9..0000000 --- a/src/multimedia/qml/qsoundeffect.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmediacontent.h" -#include "qmediaplayer.h" - -#include "qsoundeffect_p.h" - -#if defined(QT_MULTIMEDIA_PULSEAUDIO) -#include "qsoundeffect_pulse_p.h" -#elif(QT_MULTIMEDIA_QMEDIAPLAYER) -#include "qsoundeffect_qmedia_p.h" -#else -#include "qsoundeffect_qsound_p.h" -#endif - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass SoundEffect QSoundEffect - \since 4.7 - \brief The SoundEffect element provides a way to play sound effects in qml. - - The following example plays a wav file on mouse click. - - \qml - SoundEffect { - id: playSound - source: "test.wav" - } - MouseRegion { - id: playArea - anchors.fill: parent - onPressed: { - playSound.play() - } - } - \endqml - - \sa SoundEffect -*/ - -/*! - \qmlproperty QUrl SoundEffect::source - - This property provides a way to control the sound to play. -*/ - -/*! - \qmlproperty int SoundEffect::loopCount - - This property provides a way to control the number of times to repeat the sound on each play(). -*/ - -/*! - \qmlproperty int SoundEffect::volume - - This property provides a way to control the volume for playback. -*/ - -/*! - \qmlproperty bool SoundEffect::muted - - This property provides a way to control muting. -*/ - -/*! - \qmlproperty int SoundEffect::duration - - This property holds the duration in milliseconds of the current source audio. -*/ - -/*! - \qmlsignal SoundEffect::sourceChanged() - - This handler is called when the source has changed. -*/ - -/*! - \qmlsignal SoundEffect::loopCountChanged() - - This handler is called when the number of loops has changes. -*/ - -/*! - \qmlsignal SoundEffect::volumeChanged() - - This handler is called when the volume has changed. -*/ - -/*! - \qmlsignal SoundEffect::mutedChanged() - - This handler is called when the mute state has changed. -*/ - -/*! - \qmlsignal SoundEffect::durationChanged() - - This handler is called when the duration has changed. -*/ - -QSoundEffect::QSoundEffect(QObject *parent) : - QObject(parent), - m_loopCount(1), - m_vol(100), - m_muted(false), - m_runningCount(0) -{ - d = new QSoundEffectPrivate(this); - connect(d, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged())); - connect(d, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged())); - connect(d, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged())); - connect(d, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(repeat())); -} - -QSoundEffect::~QSoundEffect() -{ - delete d; -} - -QUrl QSoundEffect::source() const -{ - return d != 0 ? d->media().canonicalUrl() : QUrl(); -} - -void QSoundEffect::setSource(const QUrl &url) -{ - if (d != 0 && d->media().canonicalUrl() == url) - return; - - d->setVolume(m_vol); - d->setMuted(m_muted); - d->setMedia(url); - - if (url.isEmpty()) - return; - - emit sourceChanged(); -} - -int QSoundEffect::loopCount() const -{ - return m_loopCount; -} - -void QSoundEffect::setLoopCount(int loopCount) -{ - if (m_loopCount == loopCount) - return; - - m_loopCount = loopCount; - emit loopCountChanged(); -} - -int QSoundEffect::volume() const -{ - return d != 0 ? d->volume() : m_vol; -} - -void QSoundEffect::setVolume(int volume) -{ - if (m_vol == volume) - return; - - m_vol = volume; - if (d != 0) - d->setVolume(volume); - else - emit volumeChanged(); -} - -bool QSoundEffect::isMuted() const -{ - return d != 0 ? d->isMuted() : m_muted; -} - -void QSoundEffect::setMuted(bool muted) -{ - if (m_muted == muted) - return; - - m_muted = muted; - if (d != 0) - d->setMuted(muted); - else - emit mutedChanged(); -} - -int QSoundEffect::duration() const -{ - return d != 0 ? d->duration() : 0; -} - -void QSoundEffect::play() -{ - m_runningCount = 0; - - if (d != 0) - d->play(); -} - -void QSoundEffect::stop() -{ - if (d != 0) - d->stop(); -} - -void QSoundEffect::repeat() -{ - if (d->state() == QMediaPlayer::StoppedState) { - if (++m_runningCount < m_loopCount) - d->play(); - } -} - -QT_END_NAMESPACE diff --git a/src/multimedia/qml/qsoundeffect_p.h b/src/multimedia/qml/qsoundeffect_p.h deleted file mode 100644 index 51ebe52..0000000 --- a/src/multimedia/qml/qsoundeffect_p.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSOUNDEFFECT_H -#define QSOUNDEFFECT_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - - -#include -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QSoundEffectPrivate; -class Q_AUTOTEST_EXPORT QSoundEffect : public QObject -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount NOTIFY loopCountChanged) - Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(int duration READ duration NOTIFY durationChanged) - -public: - explicit QSoundEffect(QObject *parent = 0); - ~QSoundEffect(); - - QUrl source() const; - void setSource(const QUrl &url); - - int loopCount() const; - void setLoopCount(int loopCount); - - int volume() const; - void setVolume(int volume); - - bool isMuted() const; - void setMuted(bool muted); - - int duration() const; - -signals: - void sourceChanged(); - void loopCountChanged(); - void volumeChanged(); - void mutedChanged(); - void durationChanged(); - -public slots: - void play(); - void stop(); - -private slots: - void repeat(); - -private: - Q_DISABLE_COPY(QSoundEffect) - - int m_loopCount; - int m_vol; - bool m_muted; - int m_runningCount; - - QSoundEffectPrivate* d; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QSoundEffect)) - -QT_END_HEADER - - -#endif // QSOUNDEFFECT_H diff --git a/src/multimedia/qml/qsoundeffect_pulse_p.cpp b/src/multimedia/qml/qsoundeffect_pulse_p.cpp deleted file mode 100644 index 7e9a25c..0000000 --- a/src/multimedia/qml/qsoundeffect_pulse_p.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include - -#include "qmediacontent.h" -#include "qmediaplayer.h" -#include "qsoundeffect_p.h" - -#include "wavedecoder_p.h" - -#include "qsoundeffect_pulse_p.h" - -#if(Q_WS_MAEMO_5) -#include -#endif - -#include - -// Less than ideal -#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16) - -QT_BEGIN_NAMESPACE - -namespace -{ -inline pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format) -{ - pa_sample_spec spec; - - spec.rate = format.frequency(); - spec.channels = format.channels(); - - if (format.sampleSize() == 8) - spec.format = PA_SAMPLE_U8; - else if (format.sampleSize() == 16) { - switch (format.byteOrder()) { - case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S16BE; break; - case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S16LE; break; - } - } - else if (format.sampleSize() == 32) { - switch (format.byteOrder()) { - case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S32BE; break; - case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S32LE; break; - } - } - - return spec; -} - -class PulseDaemon -{ -public: - PulseDaemon():m_prepared(false) - { - prepare(); - } - - ~PulseDaemon() - { - if (m_prepared) - release(); - } - - inline void lock() - { - pa_threaded_mainloop_lock(m_mainLoop); - } - - inline void unlock() - { - pa_threaded_mainloop_unlock(m_mainLoop); - } - - inline pa_context *context() const - { - return m_context; - } - - int volume() - { - return m_vol; - } - -private: - void prepare() - { - m_vol = 100; - - m_mainLoop = pa_threaded_mainloop_new(); - if (m_mainLoop == 0) { - qWarning("PulseAudioService: unable to create pulseaudio mainloop"); - return; - } - - if (pa_threaded_mainloop_start(m_mainLoop) != 0) { - qWarning("PulseAudioService: unable to start pulseaudio mainloop"); - pa_threaded_mainloop_free(m_mainLoop); - return; - } - - m_mainLoopApi = pa_threaded_mainloop_get_api(m_mainLoop); - - lock(); - m_context = pa_context_new(m_mainLoopApi, QString(QLatin1String("QtPulseAudio:%1")).arg(::getpid()).toAscii().constData()); - -#if(Q_WS_MAEMO_5) - pa_context_set_state_callback(m_context, context_state_callback, this); -#endif - if (m_context == 0) { - qWarning("PulseAudioService: Unable to create new pulseaudio context"); - pa_threaded_mainloop_free(m_mainLoop); - return; - } - - if (pa_context_connect(m_context, NULL, (pa_context_flags_t)0, NULL) < 0) { - qWarning("PulseAudioService: pa_context_connect() failed"); - pa_context_unref(m_context); - pa_threaded_mainloop_free(m_mainLoop); - return; - } - unlock(); - - m_prepared = true; - } - - void release() - { - if (!m_prepared) return; - pa_threaded_mainloop_stop(m_mainLoop); - pa_threaded_mainloop_free(m_mainLoop); - m_prepared = false; - } - -#if(Q_WS_MAEMO_5) - static void context_state_callback(pa_context *c, void *userdata) - { - PulseDaemon *self = reinterpret_cast(userdata); - switch (pa_context_get_state(c)) { - case PA_CONTEXT_CONNECTING: - case PA_CONTEXT_AUTHORIZING: - case PA_CONTEXT_SETTING_NAME: - break; - case PA_CONTEXT_READY: - pa_ext_stream_restore_set_subscribe_cb(c, &stream_restore_monitor_callback, self); - pa_ext_stream_restore_subscribe(c, 1, NULL, self); - break; - default: - break; - } - } - static void stream_restore_monitor_callback(pa_context *c, void *userdata) - { - PulseDaemon *self = reinterpret_cast(userdata); - pa_ext_stream_restore2_read(c, &stream_restore_info_callback, self); - } - static void stream_restore_info_callback(pa_context *c, const pa_ext_stream_restore2_info *info, - int eol, void *userdata) - { - Q_UNUSED(c) - - PulseDaemon *self = reinterpret_cast(userdata); - - if (!eol) { - if (QString(info->name).startsWith(QLatin1String("sink-input-by-media-role:x-maemo"))) { - const unsigned str_length = 256; - char str[str_length]; - pa_cvolume_snprint(str, str_length, &info->volume); - self->m_vol = QString(str).replace(" ","").replace("%","").mid(2).toInt(); - } - } - } -#endif - - int m_vol; - bool m_prepared; - pa_context *m_context; - pa_threaded_mainloop *m_mainLoop; - pa_mainloop_api *m_mainLoopApi; -}; -} - -Q_GLOBAL_STATIC(PulseDaemon, daemon) - - -QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent): - QObject(parent), - m_muted(false), - m_playQueued(false), - m_vol(100), - m_duration(0), - m_dataUploaded(0), - m_state(QMediaPlayer::StoppedState), - m_status(QMediaPlayer::NoMedia), - m_reply(0), - m_stream(0), - m_networkAccessManager(0) -{ -} - -QSoundEffectPrivate::~QSoundEffectPrivate() -{ - delete m_reply; - unloadSample(); -} - -qint64 QSoundEffectPrivate::duration() const -{ - return m_duration; -} - -int QSoundEffectPrivate::volume() const -{ - return m_vol; -} - -bool QSoundEffectPrivate::isMuted() const -{ - return m_muted; -} - -QMediaContent QSoundEffectPrivate::media() const -{ - return m_media; -} - -QMediaPlayer::State QSoundEffectPrivate::state() const -{ - return m_state; -} - -QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const -{ - return m_status; -} - -void QSoundEffectPrivate::play() -{ - if (m_status == QMediaPlayer::LoadingMedia) { - m_playQueued = true; - return; - } - - if (m_status != QMediaPlayer::BufferedMedia || - m_state == QMediaPlayer::PlayingState) - return; - - pa_volume_t m_vol = PA_VOLUME_NORM; - - daemon()->lock(); -#if(Q_WS_MAEMO_5) - m_vol = PA_VOLUME_NORM/100*((daemon()->volume()+m_vol)/2); -#endif - pa_operation_unref( - pa_context_play_sample(daemon()->context(), - m_name.constData(), - 0, - m_vol, - play_callback, - this) - ); - daemon()->unlock(); - - m_playbackTime.start(); - - emit stateChanged(m_state = QMediaPlayer::PlayingState); -} - -void QSoundEffectPrivate::stop() -{ - emit stateChanged(m_state = QMediaPlayer::StoppedState); -} - -void QSoundEffectPrivate::setVolume(int volume) -{ - m_vol = volume; -} - -void QSoundEffectPrivate::setMuted(bool muted) -{ - m_muted = muted; -} - -void QSoundEffectPrivate::setMedia(const QMediaContent &media) -{ - if (media.isNull()) { - m_media = QMediaContent(); - unloadSample(); - return; - } - if (m_media == media) - return; - m_media = media; - - if (m_networkAccessManager == 0) - m_networkAccessManager = new QNetworkAccessManager(this); - - m_stream = m_networkAccessManager->get(QNetworkRequest(m_media.canonicalUrl())); - - unloadSample(); - loadSample(); - - emit mediaChanged(m_media); -} - -void QSoundEffectPrivate::decoderReady() -{ - if (m_waveDecoder->size() >= PA_SCACHE_ENTRY_SIZE_MAX) { - m_status = QMediaPlayer::InvalidMedia; - emit mediaStatusChanged(m_status); - qWarning("QtPulseAudio: attempting to load to large a sample"); - return; - } - - if (m_name.isNull()) - m_name = QString(QLatin1String("QtPulseSample-%1-%2")).arg(::getpid()).arg(quintptr(this)).toUtf8(); - - pa_sample_spec spec = audioFormatToSampleSpec(m_waveDecoder->audioFormat()); - - daemon()->lock(); - pa_stream *stream = pa_stream_new(daemon()->context(), m_name.constData(), &spec, 0); - pa_stream_set_state_callback(stream, stream_state_callback, this); - pa_stream_set_write_callback(stream, stream_write_callback, this); - pa_stream_connect_upload(stream, (size_t)m_waveDecoder->size()); - daemon()->unlock(); -} - -void QSoundEffectPrivate::decoderError() -{ - emit mediaStatusChanged(m_status = QMediaPlayer::InvalidMedia); -} - -void QSoundEffectPrivate::checkPlayTime() -{ - int elapsed = m_playbackTime.elapsed(); - - if (elapsed >= m_duration) { - m_state = QMediaPlayer::StoppedState; - emit stateChanged(m_state); - } - else - startTimer(m_duration - elapsed); -} - -void QSoundEffectPrivate::loadSample() -{ - m_waveDecoder = new WaveDecoder(m_stream); - connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady())); - connect(m_waveDecoder, SIGNAL(invalidFormat()), SLOT(decoderError())); - - m_status = QMediaPlayer::LoadingMedia; - emit mediaStatusChanged(m_status); -} - -void QSoundEffectPrivate::unloadSample() -{ - if (m_status != QMediaPlayer::BufferedMedia) - return; - - m_status = QMediaPlayer::NoMedia; - - daemon()->lock(); - pa_context_remove_sample(daemon()->context(), m_name.constData(), NULL, NULL); - daemon()->unlock(); - - m_duration = 0; - m_dataUploaded = 0; -} - -void QSoundEffectPrivate::timerEvent(QTimerEvent *event) -{ - if (m_state == QMediaPlayer::PlayingState) { - m_state = QMediaPlayer::StoppedState; - emit stateChanged(m_state); - } - - killTimer(event->timerId()); -} - -void QSoundEffectPrivate::stream_write_callback(pa_stream *s, size_t length, void *userdata) -{ - Q_UNUSED(length); - - QSoundEffectPrivate *self = reinterpret_cast(userdata); - - size_t bufferSize = qMin(pa_stream_writable_size(s), - size_t(self->m_waveDecoder->bytesAvailable())); - char buffer[bufferSize]; - - size_t len = 0; - while (len < length) { - qint64 read = self->m_waveDecoder->read(buffer, qMin(bufferSize, length -len)); - if (read > 0) { - if (pa_stream_write(s, buffer, size_t(read), 0, 0, PA_SEEK_RELATIVE) == 0) - len += size_t(read); - else - break; - } - } - self->m_dataUploaded += len; - - if (self->m_waveDecoder->size() == self->m_dataUploaded) { - pa_stream_finish_upload(s); - - self->m_duration = self->m_waveDecoder->duration(); - emit self->durationChanged(self->m_duration); - - self->m_status = QMediaPlayer::BufferedMedia; - emit self->mediaStatusChanged(self->m_status); - - self->m_waveDecoder->deleteLater(); - if (!self->m_media.isNull()) - self->m_stream->deleteLater(); - - if (self->m_playQueued) { - self->m_playQueued = false; - QMetaObject::invokeMethod(self, "play"); - } - } -} - -void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata) -{ - QSoundEffectPrivate *self = reinterpret_cast(userdata); - - switch (pa_stream_get_state(s)) { - case PA_STREAM_CREATING: - case PA_STREAM_READY: - case PA_STREAM_TERMINATED: - break; - - case PA_STREAM_FAILED: - default: - self->m_status = QMediaPlayer::InvalidMedia; - emit self->mediaStatusChanged(self->m_status); - break; - } -} - -void QSoundEffectPrivate::play_callback(pa_context *c, int success, void *userdata) -{ - Q_UNUSED(c); - - QSoundEffectPrivate *self = reinterpret_cast(userdata); - - if (success == 1) - QMetaObject::invokeMethod(self, "checkPlayTime", Qt::QueuedConnection); - else { - self->m_state = QMediaPlayer::StoppedState; - emit self->stateChanged(self->m_state); - } -} - -QT_END_NAMESPACE - - diff --git a/src/multimedia/qml/qsoundeffect_pulse_p.h b/src/multimedia/qml/qsoundeffect_pulse_p.h deleted file mode 100644 index 247f8a3..0000000 --- a/src/multimedia/qml/qsoundeffect_pulse_p.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSOUNDEFFECT_PULSE_H -#define QSOUNDEFFECT_PULSE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - - -#include "qsoundeffect_p.h" - -#include -#include -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QNetworkReply; -class QNetworkAccessManager; -class WaveDecoder; - -class QSoundEffectPrivate : public QObject -{ - Q_OBJECT -public: - explicit QSoundEffectPrivate(QObject* parent); - ~QSoundEffectPrivate(); - - qint64 duration() const; - int volume() const; - bool isMuted() const; - QMediaContent media() const; - QMediaPlayer::State state() const; - QMediaPlayer::MediaStatus mediaStatus() const; - -public Q_SLOTS: - void play(); - void stop(); - void setVolume(int volume); - void setMuted(bool muted); - void setMedia(const QMediaContent &media); - -Q_SIGNALS: - void mediaChanged(const QMediaContent &media); - void mediaStatusChanged(QMediaPlayer::MediaStatus status); - void stateChanged(QMediaPlayer::State newState); - void durationChanged(qint64 duration); - void volumeChanged(int volume); - void mutedChanged(bool muted); - void error(QMediaPlayer::Error error); - -private slots: - void decoderReady(); - void decoderError(); - void checkPlayTime(); - -private: - void loadSample(); - void unloadSample(); - - void timerEvent(QTimerEvent *event); - - static void stream_write_callback(pa_stream *s, size_t length, void *userdata); - static void stream_state_callback(pa_stream *s, void *userdata); - static void play_callback(pa_context *c, int success, void *userdata); - - bool m_muted; - bool m_playQueued; - int m_vol; - int m_duration; - int m_dataUploaded; - QTime m_playbackTime; - QMediaPlayer::State m_state; - QMediaPlayer::MediaStatus m_status; - QByteArray m_name; - QMediaContent m_media; - QNetworkReply *m_reply; - WaveDecoder *m_waveDecoder; - QIODevice *m_stream; - QNetworkAccessManager *m_networkAccessManager; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSOUNDEFFECT_PULSE_H diff --git a/src/multimedia/qml/qsoundeffect_qmedia_p.cpp b/src/multimedia/qml/qsoundeffect_qmedia_p.cpp deleted file mode 100644 index 48fb257..0000000 --- a/src/multimedia/qml/qsoundeffect_qmedia_p.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include "qmediacontent.h" -#include "qmediaplayer.h" - -#include "qsoundeffect_p.h" -#include "qsoundeffect_qmedia_p.h" - - -QT_BEGIN_NAMESPACE - -QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent): - QObject(parent), - m_muted(false), - m_vol(100), - m_player(0) -{ -} - -QSoundEffectPrivate::~QSoundEffectPrivate() -{ - if (m_player) delete m_player; -} - -qint64 QSoundEffectPrivate::duration() const -{ - if (m_player) return m_player->duration(); - - return 0; -} - -int QSoundEffectPrivate::volume() const -{ - if (m_player) return m_player->volume(); - - return m_vol; -} - -bool QSoundEffectPrivate::isMuted() const -{ - if (m_player) return m_player->isMuted(); - - return m_muted; -} - -QMediaContent QSoundEffectPrivate::media() const -{ - if (m_player) return m_player->media(); - - return QMediaContent(); -} - -QMediaPlayer::State QSoundEffectPrivate::state() const -{ - if (m_player) return m_player->state(); - - return QMediaPlayer::StoppedState; -} - -QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const -{ - if (m_player) return m_player->mediaStatus(); - - return QMediaPlayer::UnknownMediaStatus; -} - -void QSoundEffectPrivate::play() -{ - if (m_player && !m_player->isMuted()) - m_player->play(); -} - -void QSoundEffectPrivate::stop() -{ - if (m_player) - m_player->stop(); -} - -void QSoundEffectPrivate::setVolume(int volume) -{ - m_vol = volume; - - if (m_player) - m_player->setVolume(volume); -} - -void QSoundEffectPrivate::setMuted(bool muted) -{ - m_muted = muted; - - if (m_player) - m_player->setMuted(muted); -} - -void QSoundEffectPrivate::setMedia(const QMediaContent &media) -{ - if (media.isNull()) - return; - - if (m_player == 0) { - m_player = new QMediaPlayer(this, QMediaPlayer::LowLatency); - m_player->setVolume(m_vol); - m_player->setMuted(m_muted); - - connect(m_player, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int))); - connect(m_player, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool))); - connect(m_player, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); - connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), SIGNAL(stateChanged(QMediaPlayer::State))); - } - - m_player->setMedia(media.canonicalUrl()); -} - -QT_END_NAMESPACE - diff --git a/src/multimedia/qml/qsoundeffect_qmedia_p.h b/src/multimedia/qml/qsoundeffect_qmedia_p.h deleted file mode 100644 index 8267f79..0000000 --- a/src/multimedia/qml/qsoundeffect_qmedia_p.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSOUNDEFFECT_QMEDIA_H -#define QSOUNDEFFECT_QMEDIA_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - - -#include -#include -#include -#include "qsoundeffect_p.h" - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class WaveDecoder; - -class QSoundEffectPrivate : public QObject -{ - Q_OBJECT -public: - explicit QSoundEffectPrivate(QObject* parent); - ~QSoundEffectPrivate(); - - qint64 duration() const; - int volume() const; - bool isMuted() const; - QMediaContent media() const; - QMediaPlayer::State state() const; - QMediaPlayer::MediaStatus mediaStatus() const; - -public Q_SLOTS: - void play(); - void stop(); - void setVolume(int volume); - void setMuted(bool muted); - void setMedia(const QMediaContent &media); - -Q_SIGNALS: - void mediaChanged(const QMediaContent &media); - void mediaStatusChanged(QMediaPlayer::MediaStatus status); - void stateChanged(QMediaPlayer::State newState); - void durationChanged(qint64 duration); - void volumeChanged(int volume); - void mutedChanged(bool muted); - void error(QMediaPlayer::Error error); - -private: - bool m_muted; - int m_vol; - QMediaPlayer *m_player; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSOUNDEFFECT_QMEDIA_H diff --git a/src/multimedia/qml/qsoundeffect_qsound_p.cpp b/src/multimedia/qml/qsoundeffect_qsound_p.cpp deleted file mode 100644 index df160a9..0000000 --- a/src/multimedia/qml/qsoundeffect_qsound_p.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include -#include -#include - -#include "qmediacontent.h" -#include "qmediaplayer.h" -#include "qsoundeffect_p.h" - -#include "wavedecoder_p.h" - -#include "qsoundeffect_qsound_p.h" - -QT_BEGIN_NAMESPACE - -QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent): - QObject(parent), - m_queued(false), - m_muted(false), - m_state(QMediaPlayer::StoppedState), - m_status(QMediaPlayer::NoMedia), - m_file(0), - m_sound(0) -{ - m_timer = new QTimer(this); - connect(m_timer,SIGNAL(timeout()),SLOT(checkPlayTime())); - m_media = QMediaContent(); -} - -QSoundEffectPrivate::~QSoundEffectPrivate() -{ - if (m_sound) delete m_sound; - if (m_waveDecoder) delete m_waveDecoder; - m_file->close(); -} - -qint64 QSoundEffectPrivate::duration() const -{ - if (m_waveDecoder) - return m_waveDecoder->size(); - - return 0; -} - -int QSoundEffectPrivate::volume() const -{ - return 100; -} - -bool QSoundEffectPrivate::isMuted() const -{ - return m_muted; -} - -QMediaContent QSoundEffectPrivate::media() const -{ - return m_media; -} - -QMediaPlayer::State QSoundEffectPrivate::state() const -{ - return m_state; -} - -QMediaPlayer::MediaStatus QSoundEffectPrivate::mediaStatus() const -{ - return m_status; -} - -void QSoundEffectPrivate::play() -{ - if (m_sound && !m_muted) { - m_queued = false; - m_timer->start(20); - m_playbackTime.start(); - m_sound->play(); - emit stateChanged(m_state = QMediaPlayer::PlayingState); - } else if (m_status == QMediaPlayer::LoadingMedia) - m_queued = true; -} - -void QSoundEffectPrivate::stop() -{ - m_timer->stop(); - - if (m_sound) { - m_sound->stop(); - emit stateChanged(m_state = QMediaPlayer::StoppedState); - } -} - -void QSoundEffectPrivate::setVolume(int volume) -{ - Q_UNUSED(volume) -} - -void QSoundEffectPrivate::setMuted(bool muted) -{ - m_muted = muted; -} - -void QSoundEffectPrivate::setMedia(const QMediaContent &media) -{ - m_queued = false; - - if (media.isNull() || media.canonicalUrl().scheme() != QLatin1String("file")) { - m_media = QMediaContent(); - return; - } - if (m_media == media) - return; - - m_media = media; - m_file = new QFile(m_media.canonicalUrl().toLocalFile()); - m_file->open(QIODevice::ReadOnly|QIODevice::Unbuffered); - - unloadSample(); - loadSample(); - - emit mediaChanged(m_media); -} - -void QSoundEffectPrivate::decoderReady() -{ - m_file->close(); - m_sound = new QSound(m_media.canonicalUrl().toLocalFile()); - emit mediaStatusChanged(m_status = QMediaPlayer::LoadedMedia); - - if (m_queued) - play(); -} - -void QSoundEffectPrivate::decoderError() -{ - m_file->close(); - emit mediaStatusChanged(m_status = QMediaPlayer::InvalidMedia); -} - -void QSoundEffectPrivate::checkPlayTime() -{ - if (m_sound->isFinished()) { - m_timer->stop(); - m_state = QMediaPlayer::StoppedState; - emit stateChanged(m_state); - } -} - -void QSoundEffectPrivate::loadSample() -{ - m_waveDecoder = new WaveDecoder(m_file); - connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady())); - connect(m_waveDecoder, SIGNAL(invalidFormat()), SLOT(decoderError())); - - m_status = QMediaPlayer::LoadingMedia; - emit mediaStatusChanged(m_status); -} - -void QSoundEffectPrivate::unloadSample() -{ - if (m_sound == 0) - return; - - m_status = QMediaPlayer::NoMedia; - - if (m_sound) - delete m_sound; - - m_sound = 0; -} - -QT_END_NAMESPACE diff --git a/src/multimedia/qml/qsoundeffect_qsound_p.h b/src/multimedia/qml/qsoundeffect_qsound_p.h deleted file mode 100644 index 45c0888..0000000 --- a/src/multimedia/qml/qsoundeffect_qsound_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSOUNDEFFECT_QSOUND_H -#define QSOUNDEFFECT_QSOUND_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - - -#include -#include -#include - -#include "qsoundeffect_p.h" - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTimer; -class QSound; -class QFile; -class WaveDecoder; - -class QSoundEffectPrivate : public QObject -{ - Q_OBJECT -public: - explicit QSoundEffectPrivate(QObject* parent); - ~QSoundEffectPrivate(); - - qint64 duration() const; - int volume() const; - bool isMuted() const; - QMediaContent media() const; - QMediaPlayer::State state() const; - QMediaPlayer::MediaStatus mediaStatus() const; - -public Q_SLOTS: - void play(); - void stop(); - void setVolume(int volume); - void setMuted(bool muted); - void setMedia(const QMediaContent &media); - -Q_SIGNALS: - void mediaChanged(const QMediaContent &media); - void mediaStatusChanged(QMediaPlayer::MediaStatus status); - void stateChanged(QMediaPlayer::State newState); - void durationChanged(qint64 duration); - void volumeChanged(int volume); - void mutedChanged(bool muted); - void error(QMediaPlayer::Error error); - -private slots: - void decoderReady(); - void decoderError(); - void checkPlayTime(); - -private: - void loadSample(); - void unloadSample(); - - bool m_queued; - bool m_muted; - QTime m_playbackTime; - QMediaPlayer::State m_state; - QMediaPlayer::MediaStatus m_status; - QFile *m_file; - QByteArray m_name; - QMediaContent m_media; - WaveDecoder *m_waveDecoder; - QSound *m_sound; - QTimer *m_timer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSOUNDEFFECT_QSOUND_H diff --git a/src/multimedia/qml/wavedecoder_p.cpp b/src/multimedia/qml/wavedecoder_p.cpp deleted file mode 100644 index f2277ae..0000000 --- a/src/multimedia/qml/wavedecoder_p.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "wavedecoder_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -WaveDecoder::WaveDecoder(QIODevice *s, QObject *parent): - QIODevice(parent), - haveFormat(false), - dataSize(0), - remaining(0), - source(s) -{ - open(QIODevice::ReadOnly | QIODevice::Unbuffered); - - if (source->bytesAvailable() >= sizeof(CombinedHeader)) - QTimer::singleShot(0, this, SLOT(handleData())); - else - connect(source, SIGNAL(readyRead()), SLOT(handleData())); -} - -WaveDecoder::~WaveDecoder() -{ -} - -QAudioFormat WaveDecoder::audioFormat() const -{ - return format; -} - -int WaveDecoder::duration() const -{ - return size() * 1000 / (format.sampleSize() / 8) / format.channels() / format.frequency(); -} - -qint64 WaveDecoder::size() const -{ - return haveFormat ? dataSize : 0; -} - -bool WaveDecoder::isSequential() const -{ - return source->isSequential(); -} - -qint64 WaveDecoder::bytesAvailable() const -{ - return haveFormat ? source->bytesAvailable() : 0; -} - -qint64 WaveDecoder::readData(char *data, qint64 maxlen) -{ - return haveFormat ? source->read(data, maxlen) : 0; -} - -qint64 WaveDecoder::writeData(const char *data, qint64 len) -{ - Q_UNUSED(data); - Q_UNUSED(len); - - return -1; -} - -void WaveDecoder::handleData() -{ - if (source->bytesAvailable() < sizeof(CombinedHeader)) - return; - - source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); - source->read((char*)&header, sizeof(CombinedHeader)); - - if (qstrncmp(header.riff.descriptor.id, "RIFF", 4) != 0 || - qstrncmp(header.riff.type, "WAVE", 4) != 0 || - qstrncmp(header.wave.descriptor.id, "fmt ", 4) != 0 || - (header.wave.audioFormat != 0 && header.wave.audioFormat != 1) || - qstrncmp(header.data.descriptor.id, "data", 4) != 0) { - - emit invalidFormat(); - } - else { - int bps = qFromLittleEndian(header.wave.bitsPerSample); - - format.setCodec(QLatin1String("audio/pcm")); - format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt); - format.setByteOrder(QAudioFormat::LittleEndian); - format.setFrequency(qFromLittleEndian(header.wave.sampleRate)); - format.setSampleSize(bps); - format.setChannels(qFromLittleEndian(header.wave.numChannels)); - - dataSize = qFromLittleEndian(header.data.descriptor.size); - - haveFormat = true; - connect(source, SIGNAL(readyRead()), SIGNAL(readyRead())); - emit formatKnown(); - } -} - -QT_END_NAMESPACE diff --git a/src/multimedia/qml/wavedecoder_p.h b/src/multimedia/qml/wavedecoder_p.h deleted file mode 100644 index 00aa14e..0000000 --- a/src/multimedia/qml/wavedecoder_p.h +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WAVEDECODER_H -#define WAVEDECODER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - -class WaveDecoder : public QIODevice -{ - Q_OBJECT - -public: - explicit WaveDecoder(QIODevice *source, QObject *parent = 0); - ~WaveDecoder(); - - QAudioFormat audioFormat() const; - int duration() const; - - qint64 size() const; - bool isSequential() const; - qint64 bytesAvailable() const; - -signals: - void formatKnown(); - void invalidFormat(); - -private slots: - void handleData(); - -private: - qint64 readData(char *data, qint64 maxlen); - qint64 writeData(const char *data, qint64 len); - - struct chunk - { - char id[4]; - quint32 size; - }; - struct RIFFHeader - { - chunk descriptor; - char type[4]; - }; - struct WAVEHeader - { - chunk descriptor; - quint16 audioFormat; - quint16 numChannels; - quint32 sampleRate; - quint32 byteRate; - quint16 blockAlign; - quint16 bitsPerSample; - }; - struct DATAHeader - { - chunk descriptor; - }; - struct CombinedHeader - { - RIFFHeader riff; - WAVEHeader wave; - DATAHeader data; - }; - - bool haveFormat; - qint64 dataSize; - qint64 remaining; - QAudioFormat format; - QIODevice *source; - CombinedHeader header; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // WAVEDECODER_H diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp index 8becbf3..e03d8f3 100644 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp +++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp @@ -41,17 +41,28 @@ #include #include -#include +#include + +#include "qdeclarativevideo_p.h" +#include "qdeclarativeaudio_p.h" + + QT_BEGIN_NAMESPACE -class QMultimediaQmlModule : public QDeclarativeExtensionPlugin +QML_DECLARE_TYPE(QSoundEffect) + +class QMultimediaDeclarativeModule : public QDeclarativeExtensionPlugin { Q_OBJECT public: virtual void registerTypes(const char *uri) { - QtMultimedia::qRegisterDeclarativeElements(uri); + Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); + + qmlRegisterType(uri, 4, 7, "SoundEffect"); + qmlRegisterType(uri, 4, 7, "Audio"); + qmlRegisterType(uri, 4, 7, "Video"); } }; @@ -59,5 +70,5 @@ QT_END_NAMESPACE #include "multimedia.moc" -Q_EXPORT_PLUGIN2(qmultimediaqmlmodule, QT_PREPEND_NAMESPACE(QMultimediaQmlModule)); +Q_EXPORT_PLUGIN2(qmultimediadeclarativemodule, QT_PREPEND_NAMESPACE(QMultimediaDeclarativeModule)); diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro index d8ad18e..7b63e7c 100644 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro +++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro @@ -3,7 +3,18 @@ include(../../qpluginbase.pri) QT += multimedia declarative -SOURCES += multimedia.cpp +HEADERS += \ + qdeclarativeaudio_p.h \ + qdeclarativemediabase_p.h \ + qdeclarativevideo_p.h \ + qmetadatacontrolmetaobject_p.h \ + +SOURCES += \ + multimedia.cpp \ + qdeclarativeaudio.cpp \ + qdeclarativemediabase.cpp \ + qdeclarativevideo.cpp \ + qmetadatacontrolmetaobject.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia target.path = $$[QT_INSTALL_IMPORTS]/Qt/multimedia diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp b/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp new file mode 100644 index 0000000..df2888c --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp @@ -0,0 +1,327 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativeaudio_p.h" + +#include + +QT_BEGIN_NAMESPACE + + +/*! + \qmlclass Audio QDeclarativeAudio + \since 4.7 + \brief The Audio element allows you to add audio playback to a scene. + + \qml + Audio { source: "audio/song.mp3" } + \endqml + + \sa Video +*/ + +/*! + \internal + \class QDeclarativeAudio + \brief The QDeclarativeAudio class provides an audio item that you can add to a QDeclarativeView. +*/ + +void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString) +{ + m_error = QMediaPlayer::Error(errorCode); + m_errorString = errorString; + + emit error(Error(errorCode), errorString); + emit errorChanged(); +} + + +QDeclarativeAudio::QDeclarativeAudio(QObject *parent) + : QObject(parent) +{ + setObject(this); +} + +QDeclarativeAudio::~QDeclarativeAudio() +{ + shutdown(); +} + +/*! + \qmlmethod Audio::play() + + Starts playback of the media. + + Sets the \l playing property to true, and the \l paused property to false. +*/ + +void QDeclarativeAudio::play() +{ + m_playerControl->play(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Audio::pause() + + Pauses playback of the media. + + Sets the \l playing and \l paused properties to true. +*/ + +void QDeclarativeAudio::pause() +{ + m_playerControl->pause(); + + if (!m_paused && m_state == QMediaPlayer::PausedState) { + m_paused = true; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Audio::stop() + + Stops playback of the media. + + Sets the \l playing and \l paused properties to false. +*/ + +void QDeclarativeAudio::stop() +{ + m_playerControl->stop(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +/*! + \qmlproperty url Audio::source + + This property holds the source URL of the media. +*/ + +/*! + \qmlproperty bool Audio::playing + + This property holds whether the media is playing. + + Defaults to false, and can be set to true to start playback. +*/ + +/*! + \qmlproperty bool Audio::paused + + This property holds whether the media is paused. + + Defaults to false, and can be set to true to pause playback. +*/ + +/*! + \qmlsignal Audio::onStarted() + + This handler is called when playback is started. +*/ + +/*! + \qmlsignal Audio::onResumed() + + This handler is called when playback is resumed from the paused state. +*/ + +/*! + \qmlsignal Audio::onPaused() + + This handler is called when playback is paused. +*/ + +/*! + \qmlsignal Audio::onStopped() + + This handler is called when playback is stopped. +*/ + +/*! + \qmlproperty enum Audio::status + + This property holds the status of media loading. It can be one of: + + \list + \o NoMedia - no media has been set. + \o Loading - the media is currently being loaded. + \o Loaded - the media has been loaded. + \o Buffering - the media is buffering data. + \o Stalled - playback has been interrupted while the media is buffering data. + \o Buffered - the media has buffered data. + \o EndOfMedia - the media has played to the end. + \o InvalidMedia - the media cannot be played. + \o UnknownStatus - the status of the media is unknown. + \endlist +*/ + +QDeclarativeAudio::Status QDeclarativeAudio::status() const +{ + return Status(m_status); +} + +/*! + \qmlsignal Audio::onLoaded() + + This handler is called when the media source has been loaded. +*/ + +/*! + \qmlsignal Audio::onBuffering() + + This handler is called when the media starts buffering. +*/ + +/*! + \qmlsignal Audio::onStalled() + + This handler is called when playback has stalled while the media buffers. +*/ + +/*! + \qmlsignal Audio::onBuffered() + + This handler is called when the media has finished buffering. +*/ + +/*! + \qmlsignal Audio::onEndOfMedia() + + This handler is called when playback stops because end of the media has been reached. +*/ +/*! + \qmlproperty int Audio::duration + + This property holds the duration of the media in milliseconds. + + If the media doesn't have a fixed duration (a live stream for example) this will be 0. +*/ + +/*! + \qmlproperty int Audio::position + + This property holds the current playback position in milliseconds. + + If the \l seekable property is true, this property can be set to seek to a new position. +*/ + +/*! + \qmlproperty qreal Audio::volume + + This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). +*/ + +/*! + \qmlproperty bool Audio::muted + + This property holds whether the audio output is muted. +*/ + +/*! + \qmlproperty qreal Audio::bufferProgress + + This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 + (full). +*/ + +/*! + \qmlproperty bool Audio::seekable + + This property holds whether position of the audio can be changed. + + If true; setting a \l position value will cause playback to seek to the new position. +*/ + +/*! + \qmlproperty qreal Audio::playbackRate + + This property holds the rate at which audio is played at as a multiple of the normal rate. +*/ + +/*! + \qmlproperty enum Audio::error + + This property holds the error state of the audio. It can be one of: + + \list + \o NoError - there is no current error. + \o ResourceError - the audio cannot be played due to a problem allocating resources. + \o FormatError - the audio format is not supported. + \o NetworkError - the audio cannot be played due to network issues. + \o AccessDenied - the audio cannot be played due to insufficient permissions. + \o ServiceMissing - the audio cannot be played because the media service could not be + instantiated. + \endlist +*/ + +QDeclarativeAudio::Error QDeclarativeAudio::error() const +{ + return Error(m_error); +} + +/*! + \qmlproperty string Audio::errorString + + This property holds a string describing the current error condition in more detail. +*/ + +/*! + \qmlsignal Audio::onError(error, errorString) + + This handler is called when an \l {Error}{error} has occurred. The errorString parameter + may contain more detailed information about the error. +*/ + +QT_END_NAMESPACE + +#include "moc_qdeclarativeaudio_p.cpp" + + diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h b/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h new file mode 100644 index 0000000..9881dbc --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEAUDIO_P_H +#define QDECLARATIVEAUDIO_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qdeclarativemediabase_p.h" + +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QTimerEvent; + +class QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus +{ + Q_OBJECT + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) + Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(int duration READ duration NOTIFY durationChanged) + Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) + Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) + Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) + Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) + Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) + Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) + Q_PROPERTY(Error error READ error NOTIFY errorChanged) + Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) + Q_ENUMS(Status) + Q_ENUMS(Error) + Q_INTERFACES(QDeclarativeParserStatus) +public: + enum Status + { + UnknownStatus = QMediaPlayer::UnknownMediaStatus, + NoMedia = QMediaPlayer::NoMedia, + Loading = QMediaPlayer::LoadingMedia, + Loaded = QMediaPlayer::LoadedMedia, + Stalled = QMediaPlayer::StalledMedia, + Buffering = QMediaPlayer::BufferingMedia, + Buffered = QMediaPlayer::BufferedMedia, + EndOfMedia = QMediaPlayer::EndOfMedia, + InvalidMedia = QMediaPlayer::InvalidMedia + }; + + enum Error + { + NoError = QMediaPlayer::NoError, + ResourceError = QMediaPlayer::ResourceError, + FormatError = QMediaPlayer::FormatError, + NetworkError = QMediaPlayer::NetworkError, + AccessDenied = QMediaPlayer::AccessDeniedError, + ServiceMissing = QMediaPlayer::ServiceMissingError + }; + + QDeclarativeAudio(QObject *parent = 0); + ~QDeclarativeAudio(); + + Status status() const; + Error error() const; + +public Q_SLOTS: + void play(); + void pause(); + void stop(); + +Q_SIGNALS: + void sourceChanged(); + + void playingChanged(); + void pausedChanged(); + + void started(); + void resumed(); + void paused(); + void stopped(); + + void statusChanged(); + + void loaded(); + void buffering(); + void stalled(); + void buffered(); + void endOfMedia(); + + void durationChanged(); + void positionChanged(); + + void volumeChanged(); + void mutedChanged(); + + void bufferProgressChanged(); + + void seekableChanged(); + void playbackRateChanged(); + + void errorChanged(); + void error(QDeclarativeAudio::Error error, const QString &errorString); + +private Q_SLOTS: + void _q_error(int, const QString &); + +private: + Q_DISABLE_COPY(QDeclarativeAudio) + Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) + Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) + Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) + + inline QDeclarativeMediaBase *mediaBase() { return this; } +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio)) + +QT_END_HEADER + +#endif diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp b/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp new file mode 100644 index 0000000..8e87e44 --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativemediabase_p.h" + +#include +#include + +#include +#include +#include +#include +#include "qmetadatacontrolmetaobject_p.h" + + + +QT_BEGIN_NAMESPACE + + +class QDeclarativeMediaBaseObject : public QMediaObject +{ +public: + QDeclarativeMediaBaseObject(QMediaService *service) + : QMediaObject(0, service) + { + } +}; + +class QDeclarativeMediaBasePlayerControl : public QMediaPlayerControl +{ +public: + QDeclarativeMediaBasePlayerControl(QObject *parent) + : QMediaPlayerControl(parent) + { + } + + QMediaPlayer::State state() const { return QMediaPlayer::StoppedState; } + QMediaPlayer::MediaStatus mediaStatus() const { return QMediaPlayer::NoMedia; } + + qint64 duration() const { return 0; } + qint64 position() const { return 0; } + void setPosition(qint64) {} + int volume() const { return 0; } + void setVolume(int) {} + bool isMuted() const { return false; } + void setMuted(bool) {} + int bufferStatus() const { return 0; } + bool isAudioAvailable() const { return false; } + bool isVideoAvailable() const { return false; } + bool isSeekable() const { return false; } + QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } + qreal playbackRate() const { return 1; } + void setPlaybackRate(qreal) {} + QMediaContent media() const { return QMediaContent(); } + const QIODevice *mediaStream() const { return 0; } + void setMedia(const QMediaContent &, QIODevice *) {} + + void play() {} + void pause() {} + void stop() {} +}; + +class QDeclarativeMediaBaseAnimation : public QObject +{ +public: + QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase *media) + : m_media(media) + { + } + + void start() { if (!m_timer.isActive()) m_timer.start(500, this); } + void stop() { m_timer.stop(); } + +protected: + void timerEvent(QTimerEvent *event) + { + if (event->timerId() == m_timer.timerId()) { + event->accept(); + + if (m_media->m_state == QMediaPlayer::PlayingState) + emit m_media->positionChanged(); + if (m_media->m_status == QMediaPlayer::BufferingMedia || QMediaPlayer::StalledMedia) + emit m_media->bufferProgressChanged(); + } else { + QObject::timerEvent(event); + } + } + +private: + QDeclarativeMediaBase *m_media; + QBasicTimer m_timer; +}; + +void QDeclarativeMediaBase::_q_stateChanged(QMediaPlayer::State state) +{ + if (state != m_state) { + QMediaPlayer::State oldState = m_state; + + m_state = state; + + if (state == QMediaPlayer::StoppedState) { + emit stopped(); + emit playingChanged(); + } else if (oldState == QMediaPlayer::StoppedState) { + emit started(); + emit playingChanged(); + } else if (oldState == QMediaPlayer::PausedState) { + m_paused = false; + + emit resumed(); + emit pausedChanged(); + } + + if (state == m_state && state == QMediaPlayer::PausedState) { + bool wasPaused = m_paused; + + m_paused = true; + + emit paused(); + + if (!wasPaused) + emit pausedChanged(); + } + + if (m_state == QMediaPlayer::PlayingState + || m_status == QMediaPlayer::BufferingMedia + || m_status == QMediaPlayer::StalledMedia) { + m_animation->start(); + } else { + m_animation->stop(); + } + } +} + +void QDeclarativeMediaBase::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status) +{ + if (status != m_status) { + m_status = status; + + switch (status) { + case QMediaPlayer::LoadedMedia: + emit loaded(); + break; + case QMediaPlayer::BufferingMedia: + emit buffering(); + break; + case QMediaPlayer::BufferedMedia: + emit buffered(); + break; + case QMediaPlayer::StalledMedia: + emit stalled(); + break; + case QMediaPlayer::EndOfMedia: + emit endOfMedia(); + break; + default: + break; + } + + emit statusChanged(); + + if (m_state == QMediaPlayer::PlayingState + || m_status == QMediaPlayer::BufferingMedia + || m_status == QMediaPlayer::StalledMedia) { + m_animation->start(); + } else { + m_animation->stop(); + } + } +} + +void QDeclarativeMediaBase::_q_metaDataChanged() +{ + m_metaObject->metaDataChanged(); +} + +QDeclarativeMediaBase::QDeclarativeMediaBase() + : m_mediaService(0) + , m_playerControl(0) + , m_mediaObject(0) + , m_mediaProvider(0) + , m_metaDataControl(0) + , m_metaObject(0) + , m_animation(0) + , m_state(QMediaPlayer::StoppedState) + , m_status(QMediaPlayer::NoMedia) + , m_error(QMediaPlayer::NoError) + , m_paused(false) +{ +} + +QDeclarativeMediaBase::~QDeclarativeMediaBase() +{ +} + +void QDeclarativeMediaBase::shutdown() +{ + delete m_metaObject; + delete m_mediaObject; + + if (m_mediaProvider) + m_mediaProvider->releaseService(m_mediaService); + + delete m_animation; + +} + +void QDeclarativeMediaBase::setObject(QObject *object) +{ + if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider())) { + if ((m_mediaService = m_mediaProvider->requestService(Q_MEDIASERVICE_MEDIAPLAYER))) { + m_playerControl = qobject_cast( + m_mediaService->control(QMediaPlayerControl_iid)); + m_metaDataControl = qobject_cast( + m_mediaService->control(QMetaDataControl_iid)); + m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService); + } + } + + if (m_playerControl) { + QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)), + object, SLOT(_q_stateChanged(QMediaPlayer::State))); + QObject::connect(m_playerControl, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), + object, SLOT(_q_mediaStatusChanged(QMediaPlayer::MediaStatus))); + QObject::connect(m_playerControl, SIGNAL(mediaChanged(QMediaContent)), + object, SIGNAL(sourceChanged())); + QObject::connect(m_playerControl, SIGNAL(durationChanged(qint64)), + object, SIGNAL(durationChanged())); + QObject::connect(m_playerControl, SIGNAL(positionChanged(qint64)), + object, SIGNAL(positionChanged())); + QObject::connect(m_playerControl, SIGNAL(volumeChanged(int)), + object, SIGNAL(volumeChanged())); + QObject::connect(m_playerControl, SIGNAL(mutedChanged(bool)), + object, SIGNAL(mutedChanged())); + QObject::connect(m_playerControl, SIGNAL(bufferStatusChanged(int)), + object, SIGNAL(bufferProgressChanged())); + QObject::connect(m_playerControl, SIGNAL(seekableChanged(bool)), + object, SIGNAL(seekableChanged())); + QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)), + object, SIGNAL(playbackRateChanged())); + QObject::connect(m_playerControl, SIGNAL(error(int,QString)), + object, SLOT(_q_error(int,QString))); + + m_animation = new QDeclarativeMediaBaseAnimation(this); + } else { + m_error = QMediaPlayer::ServiceMissingError; + + m_playerControl = new QDeclarativeMediaBasePlayerControl(object); + } + + if (m_metaDataControl) { + m_metaObject = new QMetaDataControlMetaObject(m_metaDataControl, object); + + QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()), + object, SLOT(_q_metaDataChanged())); + } +} + +QUrl QDeclarativeMediaBase::source() const +{ + return m_playerControl->media().canonicalUrl(); +} + +void QDeclarativeMediaBase::setSource(const QUrl &url) +{ + if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) { + m_error = QMediaPlayer::NoError; + m_errorString = QString(); + + emit errorChanged(); + } + + m_playerControl->setMedia(QMediaContent(url), 0); +} + +bool QDeclarativeMediaBase::isPlaying() const +{ + return m_state != QMediaPlayer::StoppedState; +} + +void QDeclarativeMediaBase::setPlaying(bool playing) +{ + if (playing && m_state == QMediaPlayer::StoppedState) { + if (m_paused) + m_playerControl->pause(); + else + m_playerControl->play(); + } else if (!playing) { + m_playerControl->stop(); + } +} + +bool QDeclarativeMediaBase::isPaused() const +{ + return m_paused; +} + +void QDeclarativeMediaBase::setPaused(bool paused) +{ + if (m_paused != paused) { + if (paused && m_state == QMediaPlayer::PlayingState) { + m_playerControl->pause(); + } else if (!paused && m_state == QMediaPlayer::PausedState) { + m_playerControl->play(); + } else { + m_paused = paused; + + emit pausedChanged(); + } + } +} + +int QDeclarativeMediaBase::duration() const +{ + return m_playerControl->duration(); +} + +int QDeclarativeMediaBase::position() const +{ + return m_playerControl->position(); + +} + +void QDeclarativeMediaBase::setPosition(int position) +{ + m_playerControl->setPosition(position); +} + +qreal QDeclarativeMediaBase::volume() const +{ + return qreal(m_playerControl->volume()) / 100; +} + +void QDeclarativeMediaBase::setVolume(qreal volume) +{ + m_playerControl->setVolume(qRound(volume * 100)); +} + +bool QDeclarativeMediaBase::isMuted() const +{ + return m_playerControl->isMuted(); +} + +void QDeclarativeMediaBase::setMuted(bool muted) +{ + m_playerControl->setMuted(muted); +} + +qreal QDeclarativeMediaBase::bufferProgress() const +{ + return qreal(m_playerControl->bufferStatus()) / 100; +} + +bool QDeclarativeMediaBase::isSeekable() const +{ + return m_playerControl->isSeekable(); +} + +qreal QDeclarativeMediaBase::playbackRate() const +{ + return m_playerControl->playbackRate(); +} + +void QDeclarativeMediaBase::setPlaybackRate(qreal rate) +{ + m_playerControl->setPlaybackRate(rate); +} + +QString QDeclarativeMediaBase::errorString() const +{ + return m_errorString; +} + +QT_END_NAMESPACE + diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h b/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h new file mode 100644 index 0000000..b40e84e --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEMEDIABASE_P_H +#define QDECLARATIVEMEDIABASE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QMediaPlayerControl; +class QMediaService; +class QMediaServiceProvider; +class QMetaDataControl; +class QMetaDataControlMetaObject; +class QDeclarativeMediaBaseAnimation; + +class QDeclarativeMediaBase +{ +public: + QDeclarativeMediaBase(); + virtual ~QDeclarativeMediaBase(); + + QUrl source() const; + void setSource(const QUrl &url); + + bool isPlaying() const; + void setPlaying(bool playing); + + bool isPaused() const; + void setPaused(bool paused); + + int duration() const; + + int position() const; + void setPosition(int position); + + qreal volume() const; + void setVolume(qreal volume); + + bool isMuted() const; + void setMuted(bool muted); + + qreal bufferProgress() const; + + bool isSeekable() const; + + qreal playbackRate() const; + void setPlaybackRate(qreal rate); + + QString errorString() const; + + void _q_stateChanged(QMediaPlayer::State state); + void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status); + + void _q_metaDataChanged(); + +protected: + void shutdown(); + + void setObject(QObject *object); + + virtual void sourceChanged() = 0; + + virtual void playingChanged() = 0; + virtual void pausedChanged() = 0; + + virtual void started() = 0; + virtual void resumed() = 0; + virtual void paused() = 0; + virtual void stopped() = 0; + + virtual void statusChanged() = 0; + + virtual void loaded() = 0; + virtual void buffering() = 0; + virtual void stalled() = 0; + virtual void buffered() = 0; + virtual void endOfMedia() = 0; + + virtual void durationChanged() = 0; + virtual void positionChanged() = 0; + + virtual void volumeChanged() = 0; + virtual void mutedChanged() = 0; + + virtual void bufferProgressChanged() = 0; + + virtual void seekableChanged() = 0; + virtual void playbackRateChanged() = 0; + + virtual void errorChanged() = 0; + + QMediaService *m_mediaService; + QMediaPlayerControl *m_playerControl; + + QMediaObject *m_mediaObject; + QMediaServiceProvider *m_mediaProvider; + QMetaDataControl *m_metaDataControl; + QMetaDataControlMetaObject *m_metaObject; + QDeclarativeMediaBaseAnimation *m_animation; + + QMediaPlayer::State m_state; + QMediaPlayer::MediaStatus m_status; + QMediaPlayer::Error m_error; + bool m_paused; + QString m_errorString; + + friend class QDeclarativeMediaBaseAnimation; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp b/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp new file mode 100644 index 0000000..064f242 --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp @@ -0,0 +1,945 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativevideo_p.h" + +#include +#include +#include +#include +#include + + +QT_BEGIN_NAMESPACE + + +void QDeclarativeVideo::_q_nativeSizeChanged(const QSizeF &size) +{ + setImplicitWidth(size.width()); + setImplicitHeight(size.height()); +} + +void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) +{ + m_error = QMediaPlayer::Error(errorCode); + m_errorString = errorString; + + emit error(Error(errorCode), errorString); + emit errorChanged(); +} + + +/*! + \qmlclass Video QDeclarativeVideo + \since 4.7 + \brief The Video element allows you to add videos to a scene. + \inherits Item + + \qml + Video { source: "video/movie.mpg" } + \endqml + + The video item supports untransformed, stretched, and uniformly scaled video presentation. + For a description of stretched uniformly scaled presentation, see the \l fillMode property + description. + + The video item is only visible when the \l hasVideo property is true and the video is playing. + + \sa Audio +*/ + +/*! + \internal + \class QDeclarativeVideo + \brief The QDeclarativeVideo class provides a video item that you can add to a QDeclarativeView. +*/ + +QDeclarativeVideo::QDeclarativeVideo(QDeclarativeItem *parent) + : QDeclarativeItem(parent) + , m_graphicsItem(0) + +{ + m_graphicsItem = new QGraphicsVideoItem(this); + connect(m_graphicsItem, SIGNAL(nativeSizeChanged(QSizeF)), + this, SLOT(_q_nativeSizeChanged(QSizeF))); + + setObject(this); + + if (m_mediaService) { + connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)), + this, SIGNAL(hasAudioChanged())); + connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)), + this, SIGNAL(hasVideoChanged())); + + m_graphicsItem->setMediaObject(m_mediaObject); + } +} + +QDeclarativeVideo::~QDeclarativeVideo() +{ + shutdown(); + + delete m_graphicsItem; +} + +/*! + \qmlproperty url Video::source + + This property holds the source URL of the media. +*/ + +/*! + \qmlproperty bool Video::playing + + This property holds whether the media is playing. + + Defaults to false, and can be set to true to start playback. +*/ + +/*! + \qmlproperty bool Video::paused + + This property holds whether the media is paused. + + Defaults to false, and can be set to true to pause playback. +*/ + +/*! + \qmlsignal Video::onStarted() + + This handler is called when playback is started. +*/ + +/*! + \qmlsignal Video::onResumed() + + This handler is called when playback is resumed from the paused state. +*/ + +/*! + \qmlsignal Video::onPaused() + + This handler is called when playback is paused. +*/ + +/*! + \qmlsignal Video::onStopped() + + This handler is called when playback is stopped. +*/ + +/*! + \qmlproperty enum Video::status + + This property holds the status of media loading. It can be one of: + + \list + \o NoMedia - no media has been set. + \o Loading - the media is currently being loaded. + \o Loaded - the media has been loaded. + \o Buffering - the media is buffering data. + \o Stalled - playback has been interrupted while the media is buffering data. + \o Buffered - the media has buffered data. + \o EndOfMedia - the media has played to the end. + \o InvalidMedia - the media cannot be played. + \o UnknownStatus - the status of the media is cannot be determined. + \endlist +*/ + +QDeclarativeVideo::Status QDeclarativeVideo::status() const +{ + return Status(m_status); +} + +/*! + \qmlsignal Video::onLoaded() + + This handler is called when the media source has been loaded. +*/ + +/*! + \qmlsignal Video::onBuffering() + + This handler is called when the media starts buffering. +*/ + +/*! + \qmlsignal Video::onStalled() + + This handler is called when playback has stalled while the media buffers. +*/ + +/*! + \qmlsignal Video::onBuffered() + + This handler is called when the media has finished buffering. +*/ + +/*! + \qmlsignal Video::onEndOfMedia() + + This handler is called when playback stops because end of the media has been reached. +*/ + +/*! + \qmlproperty int Video::duration + + This property holds the duration of the media in milliseconds. + + If the media doesn't have a fixed duration (a live stream for example) this will be 0. +*/ + +/*! + \qmlproperty int Video::position + + This property holds the current playback position in milliseconds. +*/ + +/*! + \qmlproperty qreal Video::volume + + This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). +*/ + +/*! + \qmlproperty bool Video::muted + + This property holds whether the audio output is muted. +*/ + +/*! + \qmlproperty bool Video::hasAudio + + This property holds whether the media contains audio. +*/ + +bool QDeclarativeVideo::hasAudio() const +{ + return m_playerControl->isAudioAvailable(); +} + +/*! + \qmlproperty bool Video::hasVideo + + This property holds whether the media contains video. +*/ + +bool QDeclarativeVideo::hasVideo() const +{ + return m_playerControl->isVideoAvailable(); +} + +/*! + \qmlproperty qreal Video::bufferProgress + + This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 + (full). +*/ + +/*! + \qmlproperty bool Video::seekable + + This property holds whether position of the video can be changed. +*/ + +/*! + \qmlproperty qreal Video::playbackRate + + This property holds the rate at which video is played at as a multiple of the normal rate. +*/ + +/*! + \qmlproperty enum Video::error + + This property holds the error state of the video. It can be one of: + + \list + \o NoError - there is no current error. + \o ResourceError - the video cannot be played due to a problem allocating resources. + \o FormatError - the video format is not supported. + \o NetworkError - the video cannot be played due to network issues. + \o AccessDenied - the video cannot be played due to insufficient permissions. + \o ServiceMissing - the video cannot be played because the media service could not be + instantiated. + \endlist +*/ + + +QDeclarativeVideo::Error QDeclarativeVideo::error() const +{ + return Error(m_error); +} + +/*! + \qmlproperty string Video::errorString + + This property holds a string describing the current error condition in more detail. +*/ + +/*! + \qmlsignal Video::onError(error, errorString) + + This handler is called when an \l {Error}{error} has occurred. The errorString parameter + may contain more detailed information about the error. +*/ + +/*! + \qmlproperty enum Video::fillMode + + Set this property to define how the video is scaled to fit the target area. + + \list + \o Stretch - the video is scaled to fit. + \o PreserveAspectFit - the video is scaled uniformly to fit without cropping + \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary + \endlist + + The default fill mode is PreserveAspectFit. +*/ + +QDeclarativeVideo::FillMode QDeclarativeVideo::fillMode() const +{ + return FillMode(m_graphicsItem->aspectRatioMode()); +} + +void QDeclarativeVideo::setFillMode(FillMode mode) +{ + m_graphicsItem->setAspectRatioMode(Qt::AspectRatioMode(mode)); +} + +/*! + \qmlmethod Video::play() + + Starts playback of the media. + + Sets the \l playing property to true, and the \l paused property to false. +*/ + +void QDeclarativeVideo::play() +{ + m_playerControl->play(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Video::pause() + + Pauses playback of the media. + + Sets the \l playing and \l paused properties to true. +*/ + +void QDeclarativeVideo::pause() +{ + m_playerControl->pause(); + + if (!m_paused && m_state == QMediaPlayer::PausedState) { + m_paused = true; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Video::stop() + + Stops playback of the media. + + Sets the \l playing and \l paused properties to false. +*/ + +void QDeclarativeVideo::stop() +{ + m_playerControl->stop(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +void QDeclarativeVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) +{ +} + +void QDeclarativeVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + m_graphicsItem->setSize(newGeometry.size()); + + QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); +} + +QT_END_NAMESPACE + +// *************************************** +// Documentation for meta-data properties. +// *************************************** + +/*! + \qmlproperty variant Video::title + + This property holds the tile of the media. + + \sa {QtMultimedia::Title} +*/ + +/*! + \qmlproperty variant Video::subTitle + + This property holds the sub-title of the media. + + \sa {QtMultimedia::SubTitle} +*/ + +/*! + \qmlproperty variant Video::author + + This property holds the author of the media. + + \sa {QtMultimedia::Author} +*/ + +/*! + \qmlproperty variant Video::comment + + This property holds a user comment about the media. + + \sa {QtMultimedia::Comment} +*/ + +/*! + \qmlproperty variant Video::description + + This property holds a description of the media. + + \sa {QtMultimedia::Description} +*/ + +/*! + \qmlproperty variant Video::category + + This property holds the category of the media + + \sa {QtMultimedia::Category} +*/ + +/*! + \qmlproperty variant Video::genre + + This property holds the genre of the media. + + \sa {QtMultimedia::Genre} +*/ + +/*! + \qmlproperty variant Video::year + + This property holds the year of release of the media. + + \sa {QtMultimedia::Year} +*/ + +/*! + \qmlproperty variant Video::date + + This property holds the date of the media. + + \sa {QtMultimedia::Date} +*/ + +/*! + \qmlproperty variant Video::userRating + + This property holds a user rating of the media in the range of 0 to 100. + + \sa {QtMultimedia::UserRating} +*/ + +/*! + \qmlproperty variant Video::keywords + + This property holds a list of keywords describing the media. + + \sa {QtMultimedia::Keywords} +*/ + +/*! + \qmlproperty variant Video::language + + This property holds the language of the media, as an ISO 639-2 code. + + \sa {QtMultimedia::Language} +*/ + +/*! + \qmlproperty variant Video::publisher + + This property holds the publisher of the media. + + \sa {QtMultimedia::Publisher} +*/ + +/*! + \qmlproperty variant Video::copyright + + This property holds the media's copyright notice. + + \sa {QtMultimedia::Copyright} +*/ + +/*! + \qmlproperty variant Video::parentalRating + + This property holds the parental rating of the media. + + \sa {QtMultimedia::ParentalRating} +*/ + +/*! + \qmlproperty variant Video::ratingOrganisation + + This property holds the name of the rating organisation responsible for the + parental rating of the media. + + \sa {QtMultimedia::RatingOrganisation} +*/ + +/*! + \qmlproperty variant Video::size + + This property property holds the size of the media in bytes. + + \sa {QtMultimedia::Size} +*/ + +/*! + \qmlproperty variant Video::mediaType + + This property holds the type of the media. + + \sa {QtMultimedia::MediaType} +*/ + +/*! + \qmlproperty variant Video::audioBitRate + + This property holds the bit rate of the media's audio stream ni bits per + second. + + \sa {QtMultimedia::AudioBitRate} +*/ + +/*! + \qmlproperty variant Video::audioCodec + + This property holds the encoding of the media audio stream. + + \sa {QtMultimedia::AudioCodec} +*/ + +/*! + \qmlproperty variant Video::averageLevel + + This property holds the average volume level of the media. + + \sa {QtMultimedia::AverageLevel} +*/ + +/*! + \qmlproperty variant Video::channelCount + + This property holds the number of channels in the media's audio stream. + + \sa {QtMultimedia::ChannelCount} +*/ + +/*! + \qmlproperty variant Video::peakValue + + This property holds the peak volume of media's audio stream. + + \sa {QtMultimedia::PeakValue} +*/ + +/*! + \qmlproperty variant Video::sampleRate + + This property holds the sample rate of the media's audio stream in hertz. + + \sa {QtMultimedia::SampleRate} +*/ + +/*! + \qmlproperty variant Video::albumTitle + + This property holds the title of the album the media belongs to. + + \sa {QtMultimedia::AlbumTitle} +*/ + +/*! + \qmlproperty variant Video::albumArtist + + This property holds the name of the principal artist of the album the media + belongs to. + + \sa {QtMultimedia::AlbumArtist} +*/ + +/*! + \qmlproperty variant Video::contributingArtist + + This property holds the names of artists contributing to the media. + + \sa {QtMultimedia::ContributingArtist} +*/ + +/*! + \qmlproperty variant Video::composer + + This property holds the composer of the media. + + \sa {QtMultimedia::Composer} +*/ + +/*! + \qmlproperty variant Video::conductor + + This property holds the conductor of the media. + + \sa {QtMultimedia::Conductor} +*/ + +/*! + \qmlproperty variant Video::lyrics + + This property holds the lyrics to the media. + + \sa {QtMultimedia::Lyrics} +*/ + +/*! + \qmlproperty variant Video::mood + + This property holds the mood of the media. + + \sa {QtMultimedia::Mood} +*/ + +/*! + \qmlproperty variant Video::trackNumber + + This property holds the track number of the media. + + \sa {QtMultimedia::TrackNumber} +*/ + +/*! + \qmlproperty variant Video::trackCount + + This property holds the number of track on the album containing the media. + + \sa {QtMultimedia::TrackNumber} +*/ + +/*! + \qmlproperty variant Video::coverArtUrlSmall + + This property holds the URL of a small cover art image. + + \sa {QtMultimedia::CoverArtUrlSmall} +*/ + +/*! + \qmlproperty variant Video::coverArtUrlLarge + + This property holds the URL of a large cover art image. + + \sa {QtMultimedia::CoverArtUrlLarge} +*/ + +/*! + \qmlproperty variant Video::resolution + + This property holds the dimension of an image or video. + + \sa {QtMultimedia::Resolution} +*/ + +/*! + \qmlproperty variant Video::pixelAspectRatio + + This property holds the pixel aspect ratio of an image or video. + + \sa {QtMultimedia::PixelAspectRatio} +*/ + +/*! + \qmlproperty variant Video::videoFrameRate + + This property holds the frame rate of the media's video stream. + + \sa {QtMultimedia::VideoFrameRate} +*/ + +/*! + \qmlproperty variant Video::videoBitRate + + This property holds the bit rate of the media's video stream in bits per + second. + + \sa {QtMultimedia::VideoBitRate} +*/ + +/*! + \qmlproperty variant Video::videoCodec + + This property holds the encoding of the media's video stream. + + \sa {QtMultimedia::VideoCodec} +*/ + +/*! + \qmlproperty variant Video::posterUrl + + This property holds the URL of a poster image. + + \sa {QtMultimedia::PosterUrl} +*/ + +/*! + \qmlproperty variant Video::chapterNumber + + This property holds the chapter number of the media. + + \sa {QtMultimedia::ChapterNumber} +*/ + +/*! + \qmlproperty variant Video::director + + This property holds the director of the media. + + \sa {QtMultimedia::Director} +*/ + +/*! + \qmlproperty variant Video::leadPerformer + + This property holds the lead performer in the media. + + \sa {QtMultimedia::LeadPerformer} +*/ + +/*! + \qmlproperty variant Video::writer + + This property holds the writer of the media. + + \sa {QtMultimedia::Writer} +*/ + +// The remaining properties are related to photos, and are technically +// available but will certainly never have values. +#ifndef Q_QDOC + +/*! + \qmlproperty variant Video::cameraManufacturer + + \sa {QtMultimedia::CameraManufacturer} +*/ + +/*! + \qmlproperty variant Video::cameraModel + + \sa {QtMultimedia::CameraModel} +*/ + +/*! + \qmlproperty variant Video::event + + \sa {QtMultimedia::Event} +*/ + +/*! + \qmlproperty variant Video::subject + + \sa {QtMultimedia::Subject} +*/ + +/*! + \qmlproperty variant Video::orientation + + \sa {QtMultimedia::Orientation} +*/ + +/*! + \qmlproperty variant Video::exposureTime + + \sa {QtMultimedia::ExposureTime} +*/ + +/*! + \qmlproperty variant Video::fNumber + + \sa {QtMultimedia::FNumber} +*/ + +/*! + \qmlproperty variant Video::exposureProgram + + \sa {QtMultimedia::ExposureProgram} +*/ + +/*! + \qmlproperty variant Video::isoSpeedRatings + + \sa {QtMultimedia::ISOSpeedRatings} +*/ + +/*! + \qmlproperty variant Video::exposureBiasValue + + \sa {QtMultimedia::ExposureBiasValue} +*/ + +/*! + \qmlproperty variant Video::dateTimeDigitized + + \sa {QtMultimedia::DateTimeDigitized} +*/ + +/*! + \qmlproperty variant Video::subjectDistance + + \sa {QtMultimedia::SubjectDistance} +*/ + +/*! + \qmlproperty variant Video::meteringMode + + \sa {QtMultimedia::MeteringMode} +*/ + +/*! + \qmlproperty variant Video::lightSource + + \sa {QtMultimedia::LightSource} +*/ + +/*! + \qmlproperty variant Video::flash + + \sa {QtMultimedia::Flash} +*/ + +/*! + \qmlproperty variant Video::focalLength + + \sa {QtMultimedia::FocalLength} +*/ + +/*! + \qmlproperty variant Video::exposureMode + + \sa {QtMultimedia::ExposureMode} +*/ + +/*! + \qmlproperty variant Video::whiteBalance + + \sa {QtMultimedia::WhiteBalance} +*/ + +/*! + \qmlproperty variant Video::DigitalZoomRatio + + \sa {QtMultimedia::DigitalZoomRatio} +*/ + +/*! + \qmlproperty variant Video::focalLengthIn35mmFilm + + \sa {QtMultimedia::FocalLengthIn35mmFile} +*/ + +/*! + \qmlproperty variant Video::sceneCaptureType + + \sa {QtMultimedia::SceneCaptureType} +*/ + +/*! + \qmlproperty variant Video::gainControl + + \sa {QtMultimedia::GainControl} +*/ + +/*! + \qmlproperty variant Video::contrast + + \sa {QtMultimedia::contrast} +*/ + +/*! + \qmlproperty variant Video::saturation + + \sa {QtMultimedia::Saturation} +*/ + +/*! + \qmlproperty variant Video::sharpness + + \sa {QtMultimedia::Sharpness} +*/ + +/*! + \qmlproperty variant Video::deviceSettingDescription + + \sa {QtMultimedia::DeviceSettingDescription} +*/ + +#endif + +#include "moc_qdeclarativevideo_p.cpp" diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h b/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h new file mode 100644 index 0000000..fb13519 --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEVIDEO_H +#define QDECLARATIVEVIDEO_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qdeclarativemediabase_p.h" + +#include + +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QTimerEvent; +class QVideoSurfaceFormat; + + +class QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase +{ + Q_OBJECT + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) + Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(int duration READ duration NOTIFY durationChanged) + Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) + Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) + Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) + Q_PROPERTY(bool hasAudio READ hasAudio NOTIFY hasAudioChanged) + Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged) + Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) + Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) + Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) + Q_PROPERTY(Error error READ error NOTIFY errorChanged) + Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) + Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode) + Q_ENUMS(FillMode) + Q_ENUMS(Status) + Q_ENUMS(Error) +public: + enum FillMode + { + Stretch = Qt::IgnoreAspectRatio, + PreserveAspectFit = Qt::KeepAspectRatio, + PreserveAspectCrop = Qt::KeepAspectRatioByExpanding + }; + + enum Status + { + UnknownStatus = QMediaPlayer::UnknownMediaStatus, + NoMedia = QMediaPlayer::NoMedia, + Loading = QMediaPlayer::LoadingMedia, + Loaded = QMediaPlayer::LoadedMedia, + Stalled = QMediaPlayer::StalledMedia, + Buffering = QMediaPlayer::BufferingMedia, + Buffered = QMediaPlayer::BufferedMedia, + EndOfMedia = QMediaPlayer::EndOfMedia, + InvalidMedia = QMediaPlayer::InvalidMedia + }; + + enum Error + { + NoError = QMediaPlayer::NoError, + ResourceError = QMediaPlayer::ResourceError, + FormatError = QMediaPlayer::FormatError, + NetworkError = QMediaPlayer::NetworkError, + AccessDenied = QMediaPlayer::AccessDeniedError, + ServiceMissing = QMediaPlayer::ServiceMissingError + }; + + QDeclarativeVideo(QDeclarativeItem *parent = 0); + ~QDeclarativeVideo(); + + bool hasAudio() const; + bool hasVideo() const; + + FillMode fillMode() const; + void setFillMode(FillMode mode); + + Status status() const; + Error error() const; + + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + +public Q_SLOTS: + void play(); + void pause(); + void stop(); + +Q_SIGNALS: + void sourceChanged(); + + void playingChanged(); + void pausedChanged(); + + void started(); + void resumed(); + void paused(); + void stopped(); + + void statusChanged(); + + void loaded(); + void buffering(); + void stalled(); + void buffered(); + void endOfMedia(); + + void durationChanged(); + void positionChanged(); + + void volumeChanged(); + void mutedChanged(); + void hasAudioChanged(); + void hasVideoChanged(); + + void bufferProgressChanged(); + + void seekableChanged(); + void playbackRateChanged(); + + void errorChanged(); + void error(QDeclarativeVideo::Error error, const QString &errorString); + +protected: + void geometryChanged(const QRectF &geometry, const QRectF &); + +private Q_SLOTS: + void _q_nativeSizeChanged(const QSizeF &size); + void _q_error(int, const QString &); + +private: + Q_DISABLE_COPY(QDeclarativeVideo) + + QGraphicsVideoItem *m_graphicsItem; + + Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) + Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) + Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) + + inline QDeclarativeMediaBase *mediaBase() { return this; } +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeVideo)) + +QT_END_HEADER + +#endif diff --git a/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp b/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp new file mode 100644 index 0000000..e90cbd6 --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp @@ -0,0 +1,362 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmetadatacontrolmetaobject_p.h" +#include + + +QT_BEGIN_NAMESPACE + +// copied from qmetaobject.cpp +// do not touch without touching the moc as well +enum PropertyFlags { + Invalid = 0x00000000, + Readable = 0x00000001, + Writable = 0x00000002, + Resettable = 0x00000004, + EnumOrFlag = 0x00000008, + StdCppSet = 0x00000100, +// Override = 0x00000200, + Designable = 0x00001000, + ResolveDesignable = 0x00002000, + Scriptable = 0x00004000, + ResolveScriptable = 0x00008000, + Stored = 0x00010000, + ResolveStored = 0x00020000, + Editable = 0x00040000, + ResolveEditable = 0x00080000, + User = 0x00100000, + ResolveUser = 0x00200000, + Notify = 0x00400000, + Dynamic = 0x00800000 +}; + +enum MethodFlags { + AccessPrivate = 0x00, + AccessProtected = 0x01, + AccessPublic = 0x02, + AccessMask = 0x03, //mask + + MethodMethod = 0x00, + MethodSignal = 0x04, + MethodSlot = 0x08, + MethodConstructor = 0x0c, + MethodTypeMask = 0x0c, + + MethodCompatibility = 0x10, + MethodCloned = 0x20, + MethodScriptable = 0x40 +}; + +struct QMetaObjectPrivate +{ + int revision; + int className; + int classInfoCount, classInfoData; + int methodCount, methodData; + int propertyCount, propertyData; + int enumeratorCount, enumeratorData; + int constructorCount, constructorData; + int flags; +}; + +static inline const QMetaObjectPrivate *priv(const uint* m_data) +{ return reinterpret_cast(m_data); } +// end of copied lines from qmetaobject.cpp + +namespace +{ + struct MetaDataKey + { + QtMultimedia::MetaData key; + const char *name; + }; + + const MetaDataKey qt_metaDataKeys[] = + { + { QtMultimedia::Title, "title" }, + { QtMultimedia::SubTitle, "subTitle" }, + { QtMultimedia::Author, "author" }, + { QtMultimedia::Comment, "comment" }, + { QtMultimedia::Description, "description" }, + { QtMultimedia::Category, "category" }, + { QtMultimedia::Genre, "genre" }, + { QtMultimedia::Year, "year" }, + { QtMultimedia::Date, "date" }, + { QtMultimedia::UserRating, "userRating" }, + { QtMultimedia::Keywords, "keywords" }, + { QtMultimedia::Language, "language" }, + { QtMultimedia::Publisher, "publisher" }, + { QtMultimedia::Copyright, "copyright" }, + { QtMultimedia::ParentalRating, "parentalRating" }, + { QtMultimedia::RatingOrganisation, "ratingOrganisation" }, + + // Media + { QtMultimedia::Size, "size" }, + { QtMultimedia::MediaType, "mediaType" }, +// { QtMultimedia::Duration, "duration" }, + + // Audio + { QtMultimedia::AudioBitRate, "audioBitRate" }, + { QtMultimedia::AudioCodec, "audioCodec" }, + { QtMultimedia::AverageLevel, "averageLevel" }, + { QtMultimedia::ChannelCount, "channelCount" }, + { QtMultimedia::PeakValue, "peakValue" }, + { QtMultimedia::SampleRate, "sampleRate" }, + + // Music + { QtMultimedia::AlbumTitle, "albumTitle" }, + { QtMultimedia::AlbumArtist, "albumArtist" }, + { QtMultimedia::ContributingArtist, "contributingArtist" }, + { QtMultimedia::Composer, "composer" }, + { QtMultimedia::Conductor, "conductor" }, + { QtMultimedia::Lyrics, "lyrics" }, + { QtMultimedia::Mood, "mood" }, + { QtMultimedia::TrackNumber, "trackNumber" }, + { QtMultimedia::TrackCount, "trackCount" }, + + { QtMultimedia::CoverArtUrlSmall, "coverArtUrlSmall" }, + { QtMultimedia::CoverArtUrlLarge, "coverArtUrlLarge" }, + + // Image/Video + { QtMultimedia::Resolution, "resolution" }, + { QtMultimedia::PixelAspectRatio, "pixelAspectRatio" }, + + // Video + { QtMultimedia::VideoFrameRate, "videoFrameRate" }, + { QtMultimedia::VideoBitRate, "videoBitRate" }, + { QtMultimedia::VideoCodec, "videoCodec" }, + + { QtMultimedia::PosterUrl, "posterUrl" }, + + // Movie + { QtMultimedia::ChapterNumber, "chapterNumber" }, + { QtMultimedia::Director, "director" }, + { QtMultimedia::LeadPerformer, "leadPerformer" }, + { QtMultimedia::Writer, "writer" }, + + // Photos + { QtMultimedia::CameraManufacturer, "cameraManufacturer" }, + { QtMultimedia::CameraModel, "cameraModel" }, + { QtMultimedia::Event, "event" }, + { QtMultimedia::Subject, "subject" }, + { QtMultimedia::Orientation, "orientation" }, + { QtMultimedia::ExposureTime, "exposureTime" }, + { QtMultimedia::FNumber, "fNumber" }, + { QtMultimedia::ExposureProgram, "exposureProgram" }, + { QtMultimedia::ISOSpeedRatings, "isoSpeedRatings" }, + { QtMultimedia::ExposureBiasValue, "exposureBiasValue" }, + { QtMultimedia::DateTimeOriginal, "dateTimeOriginal" }, + { QtMultimedia::DateTimeDigitized, "dateTimeDigitized" }, + { QtMultimedia::SubjectDistance, "subjectDistance" }, + { QtMultimedia::MeteringMode, "meteringMode" }, + { QtMultimedia::LightSource, "lightSource" }, + { QtMultimedia::Flash, "flash" }, + { QtMultimedia::FocalLength, "focalLength" }, + { QtMultimedia::ExposureMode, "exposureMode" }, + { QtMultimedia::WhiteBalance, "whiteBalance" }, + { QtMultimedia::DigitalZoomRatio, "digitalZoomRatio" }, + { QtMultimedia::FocalLengthIn35mmFilm, "focalLengthIn35mmFilm" }, + { QtMultimedia::SceneCaptureType, "sceneCaptureType" }, + { QtMultimedia::GainControl, "gainControl" }, + { QtMultimedia::Contrast, "contrast" }, + { QtMultimedia::Saturation, "saturation" }, + { QtMultimedia::Sharpness, "sharpness" }, + { QtMultimedia::DeviceSettingDescription, "deviceSettingDescription" } + }; + + class QMetaDataControlObject : public QObject + { + public: + inline QObjectData *data() { return d_ptr.data(); } + }; +} + +QMetaDataControlMetaObject::QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object) + : m_control(control) + , m_object(object) + , m_string(0) + , m_data(0) + , m_propertyOffset(0) + , m_signalOffset(0) +{ + const QMetaObject *superClass = m_object->metaObject(); + + const int propertyCount = sizeof(qt_metaDataKeys) / sizeof(MetaDataKey); + const int dataSize = sizeof(uint) + * (13 // QMetaObjectPrivate members. + + 5 // 5 members per signal. + + 4 * propertyCount // 3 members per property + 1 notify signal per property. + + 1); // Terminating value. + + m_data = reinterpret_cast(qMalloc(dataSize)); + + QMetaObjectPrivate *pMeta = reinterpret_cast(m_data); + + pMeta->revision = 3; + pMeta->className = 0; + pMeta->classInfoCount = 0; + pMeta->classInfoData = 0; + pMeta->methodCount = 1; + pMeta->methodData = 13; + pMeta->propertyCount = propertyCount; + pMeta->propertyData = 18; + pMeta->enumeratorCount = 0; + pMeta->enumeratorData = 0; + pMeta->constructorCount = 0; + pMeta->constructorData = 0; + pMeta->flags = 0x01; // Dynamic meta object flag. + + const int classNameSize = qstrlen(superClass->className()) + 1; + + int stringIndex = classNameSize + 1; + + // __metaDataChanged() signal. + static const char *changeSignal = "__metaDataChanged()"; + const int changeSignalSize = qstrlen(changeSignal) + 1; + + m_data[13] = stringIndex; // Signature. + m_data[14] = classNameSize; // Parameters. + m_data[15] = classNameSize; // Type. + m_data[16] = classNameSize; // Tag. + m_data[17] = MethodSignal | AccessProtected; // Flags. + + stringIndex += changeSignalSize; + + const char *qvariantName = "QVariant"; + const int qvariantSize = qstrlen(qvariantName) + 1; + const int qvariantIndex = stringIndex; + + stringIndex += qvariantSize; + + // Properties. + for (int i = 0; i < propertyCount; ++i) { + m_data[18 + 3 * i] = stringIndex; // Name. + m_data[19 + 3 * i] = qvariantIndex; // Type. + m_data[20 + 3 * i] + = Readable | Writable | Notify | Dynamic | (0xffffffff << 24); // Flags. + m_data[18 + propertyCount * 3 + i] = 0; // Notify signal. + + stringIndex += qstrlen(qt_metaDataKeys[i].name) + 1; + } + + // Terminating value. + m_data[18 + propertyCount * 4] = 0; + + // Build string. + m_string = reinterpret_cast(qMalloc(stringIndex + 1)); + + // Class name. + qMemCopy(m_string, superClass->className(), classNameSize); + + stringIndex = classNameSize; + + // Null m_string. + m_string[stringIndex] = '\0'; + stringIndex += 1; + + // __metaDataChanged() signal. + qMemCopy(m_string + stringIndex, changeSignal, changeSignalSize); + stringIndex += changeSignalSize; + + qMemCopy(m_string + stringIndex, qvariantName, qvariantSize); + stringIndex += qvariantSize; + + // Properties. + for (int i = 0; i < propertyCount; ++i) { + const int propertyNameSize = qstrlen(qt_metaDataKeys[i].name) + 1; + + qMemCopy(m_string + stringIndex, qt_metaDataKeys[i].name, propertyNameSize); + stringIndex += propertyNameSize; + } + + // Terminating character. + m_string[stringIndex] = '\0'; + + d.superdata = superClass; + d.stringdata = m_string; + d.data = m_data; + d.extradata = 0; + + static_cast(m_object)->data()->metaObject = this; + + m_propertyOffset = propertyOffset(); + m_signalOffset = methodOffset(); +} + +QMetaDataControlMetaObject::~QMetaDataControlMetaObject() +{ + static_cast(m_object)->data()->metaObject = 0; + + qFree(m_data); + qFree(m_string); +} + +int QMetaDataControlMetaObject::metaCall(QMetaObject::Call c, int id, void **a) +{ + if (c == QMetaObject::ReadProperty && id >= m_propertyOffset) { + int propId = id - m_propertyOffset; + + *reinterpret_cast(a[0]) = m_control->metaData(qt_metaDataKeys[propId].key); + + return -1; + } else if (c == QMetaObject::WriteProperty && id >= m_propertyOffset) { + int propId = id - m_propertyOffset; + + m_control->setMetaData(qt_metaDataKeys[propId].key, *reinterpret_cast(a[0])); + + return -1; + } else { + return m_object->qt_metacall(c, id, a); + } +} + +int QMetaDataControlMetaObject::createProperty(const char *, const char *) +{ + return -1; +} + +void QMetaDataControlMetaObject::metaDataChanged() +{ + activate(m_object, m_signalOffset, 0); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h b/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h new file mode 100644 index 0000000..c381f2d --- /dev/null +++ b/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMETADATACONTROLMETAOBJECT_P_H +#define QMETADATACONTROLMETAOJBECT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QMetaDataControl; + +class QMetaDataControlMetaObject : public QAbstractDynamicMetaObject +{ +public: + QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object); + ~QMetaDataControlMetaObject(); + + int metaCall(QMetaObject::Call call, int _id, void **arguments); + int createProperty(const char *, const char *); + + void metaDataChanged(); + +private: + QMetaDataControl *m_control; + QObject *m_object; + char *m_string; + uint *m_data; + + int m_propertyOffset; + int m_signalOffset; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/src.pro b/src/src.pro index 2b9dc30..ebfd44b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -116,7 +116,6 @@ src_declarative.target = sub-declarative src_phonon.depends += src_dbus } contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): src_plugins.depends += src_opengl - contains(QT_CONFIG, declarative): src_multimedia.depends += src_declarative } !symbian { diff --git a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro index 13bf606..bfc2223 100644 --- a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro +++ b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro @@ -1,4 +1,14 @@ load(qttest_p4) -SOURCES += tst_qdeclarativeaudio.cpp + +HEADERS += \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h + +SOURCES += \ + tst_qdeclarativeaudio.cpp \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp QT += multimedia declarative diff --git a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp index 11439ce..55c7135 100644 --- a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp +++ b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp @@ -41,7 +41,7 @@ #include -#include +#include "../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h" #include #include diff --git a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro index d946bb0..497ee0e 100644 --- a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro +++ b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro @@ -1,4 +1,14 @@ load(qttest_p4) -SOURCES += tst_qdeclarativevideo.cpp + +HEADERS += \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h + +SOURCES += \ + tst_qdeclarativevideo.cpp \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp \ + $$PWD/../../../src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp QT += multimedia declarative diff --git a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp index 9fc1e70..d3bfc38 100644 --- a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp +++ b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp @@ -41,7 +41,7 @@ #include -#include +#include "../../../src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h" #include #include -- cgit v0.12 From 399858f133819eac1d7a71029cc132c76a6e0bbc Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 3 Mar 2010 15:18:00 +1000 Subject: Undo a doc revert. Reviewed-by: Dmytro Poplavskiy --- src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp index 863b6d4..d52aa75 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp @@ -50,7 +50,7 @@ static int wuchi = qRegisterMetaType(); /*! - \class gstreamer::QGstreamerMessage + \class QGstreamerMessage \internal */ -- cgit v0.12 From a8d10340dce323030e6e3b197eb1849af303f4d0 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 3 Mar 2010 16:03:26 +1000 Subject: QT7 mediaservice; Fix memory leak Reviewed-by: Dmytro Poplavskiy --- src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm index b046672..59d01a2 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm @@ -251,6 +251,7 @@ void QT7PlayerMetaDataControl::updateTags() readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap); } #else + AutoReleasePool pool; NSString *name = [movie attributeForKey:@"QTMovieDisplayNameAttribute"]; metaMap.insert(QLatin1String("nam"), QString::fromUtf8([name UTF8String])); #endif // QUICKTIME_C_API_AVAILABLE -- cgit v0.12 From 4690084e9f3fbf3635aa3fb6a8025ae046672aea Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 3 Mar 2010 17:14:07 +1000 Subject: Move JS global scope to top of the QML scope chain QT-2787 --- src/declarative/qml/qdeclarativecompiler.cpp | 62 +++++++++++----------- src/declarative/qml/qdeclarativecompiler_p.h | 2 +- src/declarative/qml/qdeclarativecontext.cpp | 3 ++ src/declarative/qml/qdeclarativeexpression.cpp | 5 ++ .../qml/qdeclarativeglobalscriptclass.cpp | 15 ++++-- .../qml/qdeclarativeglobalscriptclass_p.h | 7 ++- .../qdeclarativeecmascript/data/scope.3.qml | 13 +++++ .../tst_qdeclarativeecmascript.cpp | 10 ++++ .../data/invalidID.2.errors.txt | 2 +- .../data/invalidID.6.errors.txt | 2 +- .../data/invalidID.7.errors.txt | 1 + .../qdeclarativelanguage/data/invalidID.7.qml | 5 ++ .../data/invalidID.8.errors.txt | 1 + .../qdeclarativelanguage/data/invalidID.8.qml | 5 ++ .../data/invalidID.9.errors.txt | 1 + .../qdeclarativelanguage/data/invalidID.9.qml | 5 ++ .../qdeclarativelanguage/data/invalidID.errors.txt | 2 +- .../tst_qdeclarativelanguage.cpp | 6 +-- 18 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index a9809c0..1eea012 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -65,6 +65,7 @@ #include "qdeclarativescriptparser_p.h" #include "qdeclarativebinding_p.h" #include "qdeclarativecompiledbindings_p.h" +#include "qdeclarativeglobalscriptclass_p.h" #include @@ -113,32 +114,6 @@ QList QDeclarativeCompiler::errors() const } /*! - Returns true if \a val is a legal object id, false otherwise. - - Legal ids must start with a lower-case letter or underscore, and contain only - letters, numbers and underscores. -*/ -bool QDeclarativeCompiler::isValidId(const QString &val) -{ - if (val.isEmpty()) - return false; - - if (val.at(0).isLetter() && !val.at(0).isLower()) { - qWarning().nospace() << "id " << val << " is invalid: ids cannot start with uppercase letters"; - return false; - } - - QChar u(QLatin1Char('_')); - for (int ii = 0; ii < val.count(); ++ii) - if (val.at(ii) != u && - ((ii == 0 && !val.at(ii).isLetter()) || - (ii != 0 && !val.at(ii).isLetterOrNumber())) ) - return false; - - return true; -} - -/*! Returns true if \a name refers to an attached property, false otherwise. Attached property names are those that start with a capital letter. @@ -1140,10 +1115,11 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj, if (obj->properties.count()) idProp = *obj->properties.begin(); - if (idProp && (idProp->value || idProp->values.count() > 1 || !isValidId(idProp->values.first()->primitive()))) - COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid component id specification")); - if (idProp) { + if (idProp->value || idProp->values.count() > 1 || idProp->values.at(0)->object) + COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid component id specification")); + COMPILE_CHECK(checkValidId(idProp->values.first(), idProp->values.first()->primitive())); + QString idVal = idProp->values.first()->primitive(); if (compileState.ids.contains(idVal)) @@ -1726,8 +1702,7 @@ bool QDeclarativeCompiler::buildIdProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Value *idValue = prop->values.at(0); QString val = idValue->primitive(); - if (!isValidId(val)) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" is not a valid object id").arg(val)); + COMPILE_CHECK(checkValidId(idValue, val)); // We disallow id's that conflict with import prefixes and types QDeclarativeEnginePrivate::ImportedNamespace *ns = 0; @@ -2476,6 +2451,31 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn return true; } +bool QDeclarativeCompiler::checkValidId(QDeclarativeParser::Value *v, const QString &val) +{ + if (val.isEmpty()) + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "Invalid empty ID")); + + if (val.at(0).isLetter() && !val.at(0).isLower()) + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs cannot start with an uppercase letter")); + + QChar u(QLatin1Char('_')); + for (int ii = 0; ii < val.count(); ++ii) { + + if (ii == 0 && !val.at(ii).isLetter() && val.at(ii) != u) { + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs must start with a letter or underscore")); + } else if (ii != 0 && !val.at(ii).isLetterOrNumber() && val.at(ii) != u) { + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs must contain only letters, numbers, and underscores")); + } + + } + + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(val)) + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "ID illegally masks global JavaScript property")); + + return true; +} + #include static QStringList astNodeToStringList(QDeclarativeJS::AST::Node *node) diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 93a3f83..f8ada95 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -155,7 +155,6 @@ public: bool isError() const; QList errors() const; - static bool isValidId(const QString &); static bool isAttachedPropertyName(const QByteArray &); static bool isSignalPropertyName(const QByteArray &); @@ -247,6 +246,7 @@ private: QDeclarativeParser::Object *obj, const QDeclarativeParser::Object::DynamicProperty &); bool completeComponentBuild(); + bool checkValidId(QDeclarativeParser::Value *, const QString &); void genObject(QDeclarativeParser::Object *obj); diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 57ef90c..35e7a77 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -47,6 +47,7 @@ #include "qdeclarativeengine.h" #include "qdeclarativecompiledbindings_p.h" #include "qdeclarativeinfo.h" +#include "qdeclarativeglobalscriptclass_p.h" #include #include @@ -74,7 +75,9 @@ void QDeclarativeContextPrivate::addScript(const QDeclarativeParser::Object::Scr QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); + scriptContext->pushScope(enginePriv->contextClass->newContext(q, scopeObject)); + scriptContext->pushScope(enginePriv->globalClass->globalObject()); QScriptValue scope = scriptEngine->newObject(); scriptContext->setActivationObject(scope); diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index ae1e790..0030615 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -46,6 +46,7 @@ #include "qdeclarativecontext_p.h" #include "qdeclarativerewrite_p.h" #include "qdeclarativecompiler_p.h" +#include "qdeclarativeglobalscriptclass_p.h" #include #include @@ -135,6 +136,7 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, void *expr, if (!dd->cachedClosures.at(progIdx)) { QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); scriptContext->pushScope(ep->contextClass->newSharedContext()); + scriptContext->pushScope(ep->globalClass->globalObject()); dd->cachedClosures[progIdx] = new QScriptValue(scriptEngine->evaluate(data->expression, data->url, data->line)); scriptEngine->popContext(); } @@ -169,6 +171,7 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine()); QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine); scriptContext->pushScope(ep->contextClass->newContext(context, object)); + scriptContext->pushScope(ep->globalClass->globalObject()); QScriptValue rv = ep->scriptEngine.evaluate(program); ep->scriptEngine.popContext(); return rv; @@ -180,6 +183,7 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine()); QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine); scriptContext->pushScope(ep->contextClass->newContext(context, object)); + scriptContext->pushScope(ep->globalClass->globalObject()); QScriptValue rv = ep->scriptEngine.evaluate(program); ep->scriptEngine.popContext(); return rv; @@ -335,6 +339,7 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); scriptContext->pushScope(ep->contextClass->newContext(data->context(), data->me)); + scriptContext->pushScope(ep->globalClass->globalObject()); if (data->expressionRewritten) { data->expressionFunction = scriptEngine->evaluate(data->expression, diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp index 5b06b42..9ee2fe5 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp @@ -53,15 +53,17 @@ QT_BEGIN_NAMESPACE QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engine) : QScriptClass(engine) { - QScriptValue v = engine->newObject(); - globalObject = engine->globalObject(); + QScriptValue globalObject = engine->globalObject(); + m_globalObject = engine->newObject(); QScriptValueIterator iter(globalObject); while (iter.hasNext()) { iter.next(); - v.setProperty(iter.scriptName(), iter.value()); + m_globalObject.setProperty(iter.scriptName(), iter.value()); + m_illegalNames.insert(iter.name()); } + QScriptValue v = engine->newObject(); v.setScriptClass(this); engine->setGlobalObject(v); } @@ -101,12 +103,14 @@ void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object, engine()->currentContext()->throwError(error); } +/* This method is for the use of tst_qdeclarativeecmascript::callQtInvokables() only */ void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value) { + QScriptValue globalObject = engine()->globalObject(); + QScriptValue v = engine()->newObject(); - globalObject = engine()->globalObject(); - QScriptValueIterator iter(globalObject); + QScriptValueIterator iter(v); while (iter.hasNext()) { iter.next(); v.setProperty(iter.scriptName(), iter.value()); @@ -114,6 +118,7 @@ void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, con v.setProperty(name, value); v.setScriptClass(this); + engine()->setGlobalObject(v); } diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h index a33cf5e..1b34aee 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h @@ -54,6 +54,7 @@ // #include +#include QT_BEGIN_NAMESPACE @@ -74,8 +75,12 @@ public: void explicitSetProperty(const QString &, const QScriptValue &); + const QScriptValue &globalObject() const { return m_globalObject; } + const QSet &illegalNames() const { return m_illegalNames; } + private: - QScriptValue globalObject; + QSet m_illegalNames; + QScriptValue m_globalObject; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml new file mode 100644 index 0000000..4ad7f34 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +Item { + id: root + + property int foo: 12 + property int console: 11 + + property bool test1: foo == 12 + property bool test2: console != 11 + property bool test3: root.console == 11 +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 85a3ef3..e45f0fa 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -729,6 +729,16 @@ void tst_qdeclarativeecmascript::scope() QCOMPARE(object->property("test5").toInt(), 24); QCOMPARE(object->property("test6").toInt(), 24); } + + { + QDeclarativeComponent component(&engine, TEST_FILE("scope.3.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + QCOMPARE(object->property("test3").toBool(), true); + } } /* diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt index 56e3eeb..2c6b8bf 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt @@ -1,2 +1,2 @@ -3:5:"" is not a valid object id +3:9:Invalid empty ID diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt index 160e8b5..7251de1 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt @@ -1 +1 @@ -3:5:"StartsWithUpperCase" is not a valid object id +3:9:IDs cannot start with an uppercase letter diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt new file mode 100644 index 0000000..e4fd1db --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt @@ -0,0 +1 @@ +3:9:ID illegally masks global JavaScript property diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml new file mode 100644 index 0000000..d4bc539 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: gc +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt new file mode 100644 index 0000000..b03ec6c --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt @@ -0,0 +1 @@ +3:9:IDs must contain only letters, numbers, and underscores diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml new file mode 100644 index 0000000..1ea615c --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: hello.world +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt new file mode 100644 index 0000000..c010e79 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt @@ -0,0 +1 @@ +3:9:IDs must start with a letter or underscore diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml new file mode 100644 index 0000000..57474b7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: "3hello" +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt index 1ca678c..c010e79 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt @@ -1 +1 @@ -3:5:"1" is not a valid object id +3:9:IDs must start with a letter or underscore diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 870f3fe..5d480fa 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -232,6 +232,9 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidID.4") << "invalidID.4.qml" << "invalidID.4.errors.txt" << false; QTest::newRow("invalidID.5") << "invalidID.5.qml" << "invalidID.5.errors.txt" << false; QTest::newRow("invalidID.6") << "invalidID.6.qml" << "invalidID.6.errors.txt" << false; + QTest::newRow("invalidID.7") << "invalidID.7.qml" << "invalidID.7.errors.txt" << false; + QTest::newRow("invalidID.8") << "invalidID.8.qml" << "invalidID.8.errors.txt" << false; + QTest::newRow("invalidID.9") << "invalidID.9.qml" << "invalidID.9.errors.txt" << false; QTest::newRow("unsupportedProperty") << "unsupportedProperty.qml" << "unsupportedProperty.errors.txt" << false; QTest::newRow("nullDotProperty") << "nullDotProperty.qml" << "nullDotProperty.errors.txt" << true; @@ -327,9 +330,6 @@ void tst_qdeclarativelanguage::errors() QFETCH(QString, errorFile); QFETCH(bool, create); - if (file == "invalidID.6.qml") - QTest::ignoreMessage(QtWarningMsg, "id \"StartsWithUpperCase\" is invalid: ids cannot start with uppercase letters"); - QDeclarativeComponent component(&engine, TEST_FILE(file)); if(create) { -- cgit v0.12 From ef785f047adf6f559c282d67e627b78b75a7b9ef Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 3 Mar 2010 17:53:05 +1000 Subject: QDeclarativeProperty::read() returns a QObjectStar when accessing a QObject property QT-2793 --- src/declarative/qml/qdeclarativeproperty.cpp | 11 +++++-- .../qdeclarativeproperty/data/TestType.qml | 6 ++++ .../data/readSynthesizedObject.qml | 9 ++++++ .../qdeclarativeproperty/qdeclarativeproperty.pro | 2 ++ .../tst_qdeclarativeproperty.cpp | 37 ++++++++++++++++++++++ 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeproperty/data/TestType.qml create mode 100644 tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index e1ec2cd..521c241 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -793,7 +793,7 @@ QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDecla QVariant QDeclarativePropertyPrivate::readValueProperty() { - if(isValueType()) { + if (isValueType()) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context); QDeclarativeValueType *valueType = 0; @@ -809,13 +809,20 @@ QVariant QDeclarativePropertyPrivate::readValueProperty() if (!ep) delete valueType; return rv; - } else if(core.flags & QDeclarativePropertyCache::Data::IsQList) { + } else if (core.flags & QDeclarativePropertyCache::Data::IsQList) { QDeclarativeListProperty prop; void *args[] = { &prop, 0 }; QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args); return QVariant::fromValue(QDeclarativeListReferencePrivate::init(prop, core.propType, engine)); + } else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) { + + QObject *rv = 0; + void *args[] = { &rv, 0 }; + QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args); + return QVariant::fromValue(rv); + } else { return object->metaObject()->property(core.coreIndex).read(object.data()); diff --git a/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml new file mode 100644 index 0000000..1dfb3e1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +QtObject { + property int a: 10 +} + diff --git a/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml new file mode 100644 index 0000000..8085db2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml @@ -0,0 +1,9 @@ +import Qt 4.6 + +QtObject { + property TestType test + + test: TestType { + property int b: 19 + } +} diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index 22e50cc..af1e1b6 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -3,3 +3,5 @@ contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 0333d98..9b8a643 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -46,6 +46,14 @@ #include #include #include +#include +#include + +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename)); +} class MyQmlObject : public QObject { @@ -181,6 +189,7 @@ class PropertyObject : public QObject Q_PROPERTY(QUrl url READ url WRITE setUrl); Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty); Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) + Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject); Q_CLASSINFO("DefaultProperty", "defaultProperty"); public: @@ -202,6 +211,7 @@ public: int propertyWithNotify() const { return m_propertyWithNotify; } void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } + MyQmlObject *qmlObject() { return &m_qmlObject; } signals: void clicked(); void oddlyNamedNotifySignal(); @@ -211,6 +221,7 @@ private: QRect m_rect; QUrl m_url; int m_propertyWithNotify; + MyQmlObject m_qmlObject; }; QML_DECLARE_TYPE(PropertyObject); @@ -953,6 +964,32 @@ void tst_qdeclarativeproperty::read() QCOMPARE(p.read(), QVariant()); } + // Object property + { + PropertyObject o; + QDeclarativeProperty p(&o, "qmlObject"); + QCOMPARE(p.propertyTypeCategory(), QDeclarativeProperty::Object); + QCOMPARE(p.propertyType(), qMetaTypeId()); + QVariant v = p.read(); + QVERIFY(v.userType() == QMetaType::QObjectStar); + QVERIFY(qvariant_cast(v) == o.qmlObject()); + } + { + QDeclarativeComponent component(&engine, TEST_FILE("readSynthesizedObject.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QDeclarativeProperty p(object, "test", &engine); + + QCOMPARE(p.propertyTypeCategory(), QDeclarativeProperty::Object); + QVERIFY(p.propertyType() != QMetaType::QObjectStar); + + QVariant v = p.read(); + QVERIFY(v.userType() == QMetaType::QObjectStar); + QCOMPARE(qvariant_cast(v)->property("a").toInt(), 10); + QCOMPARE(qvariant_cast(v)->property("b").toInt(), 19); + } + // Attached property { QDeclarativeComponent component(&engine); -- cgit v0.12 From 07bd4f61caaa61866fcfa7847eeeb905d4fa2b38 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 3 Mar 2010 17:54:43 +1000 Subject: 'on' syntax fixes --- .../graphicsitems/qdeclarativegridview.cpp | 6 ++-- .../graphicsitems/qdeclarativelistview.cpp | 2 +- src/declarative/qml/qdeclarativedom.cpp | 8 ++--- src/declarative/util/qdeclarativeanimation.cpp | 18 ++++++------ src/declarative/util/qdeclarativebehavior.cpp | 6 ++-- src/declarative/util/qdeclarativeeasefollow.cpp | 34 +++++++++++----------- src/declarative/util/qdeclarativespringfollow.cpp | 6 ++-- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 090c46d..5b313be 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -744,7 +744,7 @@ QDeclarativeGridView::~QDeclarativeGridView() id: myDelegate Item { id: wrapper - GridView.onRemove: SequentialAnimation { + SequentialAnimation on GridView.onRemove { PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: true } NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: false } @@ -989,8 +989,8 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight) id: myHighlight Rectangle { id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60 - y: SpringFollow { source: Wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 } - x: SpringFollow { source: Wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 } + SpringFollow on y { source: Wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 } + SpringFollow on x { source: Wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 } } } \endcode diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index a05e638..eb5315d 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1431,7 +1431,7 @@ QDeclarativeListView::~QDeclarativeListView() id: myDelegate Item { id: wrapper - ListView.onRemove: SequentialAnimation { + SequentialAnimation on ListView.onRemove { PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: true } NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: false } diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 5b43109..cb56ead 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -374,7 +374,7 @@ QDeclarativeDomValue QDeclarativeDomProperty::value() const QDeclarativeDomValue rv; if (d->property) { rv.d->property = d->property; - if (d->property->values.count()) + if (d->property->values.count()) rv.d->value = d->property->values.at(0); else rv.d->value = d->property->onValues.at(0); @@ -508,7 +508,7 @@ int QDeclarativeDomDynamicProperty::propertyType() const QByteArray QDeclarativeDomDynamicProperty::propertyTypeName() const { - if (isValid()) + if (isValid()) return d->property.customType; return QByteArray(); @@ -1184,7 +1184,7 @@ QDeclarativeDomObject QDeclarativeDomValueValueSource::object() const \qml Rectangle { - x: Behavior { NumberAnimation { duration: 500 } } + Behavior on x { NumberAnimation { duration: 500 } } } \endqml */ @@ -1228,7 +1228,7 @@ QDeclarativeDomValueValueInterceptor &QDeclarativeDomValueValueInterceptor::oper returned. \qml Rectangle { - x: Behavior { NumberAnimation { duration: 500 } } + Behavior on x { NumberAnimation { duration: 500 } } } \endqml */ diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 7f4f1c0..b14de19 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -110,7 +110,7 @@ QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(QDeclarativeAbstrac \code Rectangle { width: 100; height: 100 - x: NumberAnimation { + NumberAnimation on x { running: myMouse.pressed from: 0; to: 100 } @@ -310,7 +310,7 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f) \code Rectangle { - rotation: NumberAnimation { running: true; repeat: true; from: 0 to: 360 } + NumberAnimation on rotation { running: true; repeat: true; from: 0 to: 360 } } \endcode */ @@ -412,7 +412,7 @@ void QDeclarativeAbstractAnimation::resume() no further influence on property values. In this example animation \code Rectangle { - x: NumberAnimation { from: 0; to: 100; duration: 500 } + NumberAnimation on x { from: 0; to: 100; duration: 500 } } \endcode was stopped at time 250ms, the \c x property will have a value of 50. @@ -450,7 +450,7 @@ void QDeclarativeAbstractAnimation::restart() its end. In the following example, \code Rectangle { - x: NumberAnimation { from: 0; to: 100; duration: 500 } + NumberAnimation on x { from: 0; to: 100; duration: 500 } } \endcode calling \c stop() at time 250ms will result in the \c x property having @@ -1292,7 +1292,7 @@ QDeclarativeVector3dAnimation::QDeclarativeVector3dAnimation(QObject *parent) Q_D(QDeclarativePropertyAnimation); d->interpolatorType = QMetaType::QVector3D; d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType); - d->defaultToInterpolatorType = true; + d->defaultToInterpolatorType = true; } QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation() @@ -1741,7 +1741,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int Animate all changes to a rectangle's x property. \qml Rectangle { - x: Behavior { PropertyAnimation {} } + Behavior on x { PropertyAnimation {} } } \endqml \o As a property value source @@ -1749,7 +1749,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int Repeatedly animate the rectangle's x property. \qml Rectangle { - x: SequentialAnimation { + SequentialAnimation on x { repeat: true PropertyAnimation { to: 50 } PropertyAnimation { to: 0 } @@ -2140,8 +2140,8 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) id: theRect width: 100; height: 100 color: Qt.rgba(0,0,1) - x: NumberAnimation { to: 500; repeat: true } //animate theRect's x property - y: Behavior { NumberAnimation {} } //animate theRect's y property + NumberAnimation on x { to: 500; repeat: true } //animate theRect's x property + Behavior on y { NumberAnimation {} } //animate theRect's y property } \endqml \row diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index 5352341..dea2c02 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -75,13 +75,13 @@ public: Behaviors provide one way to specify \l{qdeclarativeanimation.html}{animations} in QML. - In the example below, the rect will use a bounce easing curve over 200 millisecond for any changes to its y property: + In the example below, the rectangle will use a bounce easing curve over 200 millisecond for any changes to its y property: \code Rectangle { width: 20; height: 20 color: "#00ff00" - y: 200 //initial value - y: Behavior { + y: 200 // initial value + Behavior on y { NumberAnimation { easing: "easeOutBounce(amplitude:100)" duration: 200 diff --git a/src/declarative/util/qdeclarativeeasefollow.cpp b/src/declarative/util/qdeclarativeeasefollow.cpp index 3fa9866..ee181dd 100644 --- a/src/declarative/util/qdeclarativeeasefollow.cpp +++ b/src/declarative/util/qdeclarativeeasefollow.cpp @@ -59,10 +59,10 @@ class QDeclarativeEaseFollowPrivate : public QObjectPrivate public: QDeclarativeEaseFollowPrivate() : source(0), velocity(200), duration(-1), maximumEasingTime(-1), - reversingMode(QDeclarativeEaseFollow::Eased), initialVelocity(0), + reversingMode(QDeclarativeEaseFollow::Eased), initialVelocity(0), initialValue(0), invert(false), enabled(true), trackVelocity(0), clockOffset(0), lastTick(0), clock(this) - {} + {} qreal source; qreal velocity; @@ -173,7 +173,7 @@ bool QDeclarativeEaseFollowPrivate::recalc() } /* - qWarning() << "a:" << a << "tf:" << tf << "tp:" << tp << "vp:" + qWarning() << "a:" << a << "tf:" << tf << "tp:" << tp << "vp:" << vp << "sp:" << sp << "vi:" << vi << "invert:" << invert; */ return true; @@ -254,19 +254,19 @@ void QDeclarativeEaseFollowPrivate::tick(int t) \since 4.7 \brief The EaseFollow element allows a property to smoothly track a value. - The EaseFollow smoothly animates a property's value to a set target value + The EaseFollow smoothly animates a property's value to a set target value using an ease in/out quad easing curve. If the target value changes while - the animation is in progress, the easing curves used to animate to the old + the animation is in progress, the easing curves used to animate to the old and the new target values are spliced together to avoid any obvious visual glitches. The property animation is configured by setting the velocity at which the - animation should occur, or the duration that the animation should take. + animation should occur, or the duration that the animation should take. If both a velocity and a duration are specified, the one that results in the quickest animation is chosen for each change in the target value. For example, animating from 0 to 800 will take 4 seconds if a velocity - of 200 is set, will take 8 seconds with a duration of 8000 set, and will + of 200 is set, will take 8 seconds with a duration of 8000 set, and will take 4 seconds with both a velocity of 200 and a duration of 8000 set. Animating from 0 to 20000 will take 10 seconds if a velocity of 200 is set, will take 8 seconds with a duration of 8000 set, and will take 8 seconds @@ -283,8 +283,8 @@ Rectangle { color: "green" width: 60; height: 60; x: -5; y: -5; - x: EaseFollow { source: rect1.x - 5; velocity: 200 } - y: EaseFollow { source: rect1.y - 5; velocity: 200 } + EaseFollow on x { source: rect1.x - 5; velocity: 200 } + EaseFollow on y { source: rect1.y - 5; velocity: 200 } } Rectangle { @@ -338,8 +338,8 @@ qreal QDeclarativeEaseFollow::sourceValue() const Sets how the EaseFollow behaves if an animation direction is reversed. If reversing mode is \c Eased, the animation will smoothly decelerate, and - then reverse direction. If the reversing mode is \c Immediate, the - animation will immediately begin accelerating in the reverse direction, + then reverse direction. If the reversing mode is \c Immediate, the + animation will immediately begin accelerating in the reverse direction, begining with a velocity of 0. If the reversing mode is \c Sync, the property is immediately set to the target value. */ @@ -373,7 +373,7 @@ void QDeclarativeEaseFollowPrivate::restart() return; } - bool hasReversed = trackVelocity != 0. && + bool hasReversed = trackVelocity != 0. && ((trackVelocity > 0) == ((initialValue - source) > 0)); if (hasReversed) { @@ -440,7 +440,7 @@ void QDeclarativeEaseFollow::setDuration(qreal v) d->duration = v; d->trackVelocity = 0; - if (d->clock.state() == QAbstractAnimation::Running) + if (d->clock.state() == QAbstractAnimation::Running) d->restart(); emit durationChanged(); @@ -470,7 +470,7 @@ void QDeclarativeEaseFollow::setVelocity(qreal v) d->velocity = v; d->trackVelocity = 0; - if (d->clock.state() == QAbstractAnimation::Running) + if (d->clock.state() == QAbstractAnimation::Running) d->restart(); emit velocityChanged(); @@ -511,8 +511,8 @@ void QDeclarativeEaseFollow::setTarget(const QDeclarativeProperty &t) \qmlproperty qreal EaseFollow::maximumEasingTime This property specifies the maximum time an "eases" during the follow should take. -Setting this property causes the velocity to "level out" after at a time. Setting -a negative value reverts to the normal mode of easing over the entire animation +Setting this property causes the velocity to "level out" after at a time. Setting +a negative value reverts to the normal mode of easing over the entire animation duration. The default value is -1. @@ -528,7 +528,7 @@ void QDeclarativeEaseFollow::setMaximumEasingTime(qreal v) Q_D(QDeclarativeEaseFollow); d->maximumEasingTime = v; - if (d->clock.state() == QAbstractAnimation::Running) + if (d->clock.state() == QAbstractAnimation::Running) d->restart(); emit maximumEasingTimeChanged(); diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp index 6205ab9..1d69dd3 100644 --- a/src/declarative/util/qdeclarativespringfollow.cpp +++ b/src/declarative/util/qdeclarativespringfollow.cpp @@ -222,8 +222,8 @@ void QDeclarativeSpringFollowPrivate::stop() id: rect1 width: 20; height: 20 color: "#00ff00" - y: 200 //initial value - y: SequentialAnimation { + y: 200 // initial value + SequentialAnimation on y { running: true repeat: true NumberAnimation { @@ -239,7 +239,7 @@ void QDeclarativeSpringFollowPrivate::stop() x: rect1.width width: 20; height: 20 color: "#ff0000" - y: SpringFollow { source: rect1.y; velocity: 200 } + SpringFollow on y { source: rect1.y; velocity: 200 } } \endcode -- cgit v0.12 From 9b0747af7e6c456c4215879ece86f2f0dc9b7478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 3 Mar 2010 09:33:28 +0100 Subject: Mac: Select Carbon when using the 10.4u SDK. --- configure | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure b/configure index 2c7e431..5aaf347 100755 --- a/configure +++ b/configure @@ -6074,6 +6074,15 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi fi +# select Carbon when using the 10.4u SDK +if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "TEST$CFG_SDK" = "TEST/Developer/SDKs/MacOSX10.4u.sdk/" ]; then + echo "Carbon on"; + CFG_MAC_COCOA="no"; + CFG_MAC_CARBON="yes"; + fi +fi + # set the global Mac deployment target. This is overridden on an arch-by-arch basis # in some cases, see code further down case "$PLATFORM,$CFG_MAC_COCOA" in -- cgit v0.12 From 64a4b25fac94fc5c9b75ab31690c658e95189797 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 3 Mar 2010 18:33:44 +1000 Subject: Save secondary scope inside the expression's scope object This prevents the secondary scope from contaminating scopes outside itself when used as a signal expression. QTBUG-8641 --- .../qml/qdeclarativecontextscriptclass.cpp | 30 ++++++++++++++-- .../qml/qdeclarativecontextscriptclass_p.h | 1 + src/declarative/qml/qdeclarativeexpression.cpp | 41 +++++++++++++--------- src/declarative/qml/qdeclarativeexpression_p.h | 5 +-- .../tst_qdeclarativeecmascript.cpp | 3 +- 5 files changed, 58 insertions(+), 22 deletions(-) diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp index 7deed0b..d6305d8 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp +++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp @@ -50,10 +50,11 @@ QT_BEGIN_NAMESPACE struct ContextData : public QScriptDeclarativeClass::Object { - ContextData() : isSharedContext(true) {} - ContextData(QDeclarativeContext *c, QObject *o) : context(c), scopeObject(o), isSharedContext(false) {} + ContextData() : overrideObject(0), isSharedContext(true) {} + ContextData(QDeclarativeContext *c, QObject *o) : context(c), scopeObject(o), overrideObject(0), isSharedContext(false) {} QDeclarativeGuard context; QDeclarativeGuard scopeObject; + QObject *overrideObject; bool isSharedContext; QDeclarativeContext *getContext(QDeclarativeEngine *engine) { @@ -110,6 +111,17 @@ QDeclarativeContext *QDeclarativeContextScriptClass::contextFromValue(const QScr return data->getContext(engine); } +QObject *QDeclarativeContextScriptClass::setOverrideObject(QScriptValue &v, QObject *override) +{ + if (scriptClass(v) != this) + return 0; + + ContextData *data = (ContextData *)object(v); + QObject *rv = data->overrideObject; + data->overrideObject = override; + return rv; +} + QScriptClass::QueryFlags QDeclarativeContextScriptClass::queryProperty(Object *object, const Identifier &name, QScriptClass::QueryFlags flags) @@ -127,6 +139,20 @@ QDeclarativeContextScriptClass::queryProperty(Object *object, const Identifier & if (!bindContext) return 0; + QObject *overrideObject = ((ContextData *)object)->overrideObject; + if (overrideObject) { + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + QScriptClass::QueryFlags rv = + ep->objectClass->queryProperty(overrideObject, name, flags, bindContext, + QDeclarativeObjectScriptClass::ImplicitObject | + QDeclarativeObjectScriptClass::SkipAttachedProperties); + if (rv) { + lastScopeObject = overrideObject; + lastContext = bindContext; + return rv; + } + } + bool includeTypes = true; while (bindContext) { QScriptClass::QueryFlags rv = diff --git a/src/declarative/qml/qdeclarativecontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h index 26086ec..4b0dca0 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass_p.h +++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h @@ -70,6 +70,7 @@ public: QScriptValue newSharedContext(); QDeclarativeContext *contextFromValue(const QScriptValue &); + QObject *setOverrideObject(QScriptValue &, QObject *); protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 0030615..e528e9e 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -153,9 +153,11 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, void *expr, new QScriptProgram(data->expression, data->url, data->line); } - data->expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx)); + data->expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx), + &data->expressionContext); #else - data->expressionFunction = evalInObjectScope(ctxt, me, data->expression); + data->expressionFunction = evalInObjectScope(ctxt, me, data->expression, + &data->expressionContext); #endif data->expressionFunctionValid = true; @@ -166,11 +168,16 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, void *expr, } QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContext *context, QObject *object, - const QString &program) + const QString &program, QScriptValue *contextObject) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine()); QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine); - scriptContext->pushScope(ep->contextClass->newContext(context, object)); + if (contextObject) { + *contextObject = ep->contextClass->newContext(context, object); + scriptContext->pushScope(*contextObject); + } else { + scriptContext->pushScope(ep->contextClass->newContext(context, object)); + } scriptContext->pushScope(ep->globalClass->globalObject()); QScriptValue rv = ep->scriptEngine.evaluate(program); ep->scriptEngine.popContext(); @@ -178,11 +185,16 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex } QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContext *context, QObject *object, - const QScriptProgram &program) + const QScriptProgram &program, QScriptValue *contextObject) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine()); QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine); - scriptContext->pushScope(ep->contextClass->newContext(context, object)); + if (contextObject) { + *contextObject = ep->contextClass->newContext(context, object); + scriptContext->pushScope(*contextObject); + } else { + scriptContext->pushScope(ep->contextClass->newContext(context, object)); + } scriptContext->pushScope(ep->globalClass->globalObject()); QScriptValue rv = ep->scriptEngine.evaluate(program); ep->scriptEngine.popContext(); @@ -330,15 +342,13 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo QDeclarativeEngine *engine = data->context()->engine(); QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - if (secondaryScope) - ctxtPriv->defaultObjects.append(secondaryScope); - QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); if (!data->expressionFunctionValid) { QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); - scriptContext->pushScope(ep->contextClass->newContext(data->context(), data->me)); + data->expressionContext = ep->contextClass->newContext(data->context(), data->me); + scriptContext->pushScope(data->expressionContext); scriptContext->pushScope(ep->globalClass->globalObject()); if (data->expressionRewritten) { @@ -362,11 +372,14 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo QDeclarativeContext *oldSharedContext = 0; QObject *oldSharedScope = 0; + QObject *oldOverride = 0; if (data->isShared) { oldSharedContext = ep->sharedContext; oldSharedScope = ep->sharedScope; ep->sharedContext = data->context(); ep->sharedScope = data->me; + } else { + oldOverride = ep->contextClass->setOverrideObject(data->expressionContext, secondaryScope); } QScriptValue svalue = data->expressionFunction.call(); @@ -374,6 +387,8 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo if (data->isShared) { ep->sharedContext = oldSharedContext; ep->sharedScope = oldSharedScope; + } else { + ep->contextClass->setOverrideObject(data->expressionContext, oldOverride); } if (isUndefined) @@ -388,12 +403,6 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo data->error = QDeclarativeError(); } - if (secondaryScope) { - QObject *last = ctxtPriv->defaultObjects.takeLast(); - Q_ASSERT(last == secondaryScope); - Q_UNUSED(last); - } - QVariant rv; if (svalue.isArray()) { diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h index 91ac4c0..cd1729d 100644 --- a/src/declarative/qml/qdeclarativeexpression_p.h +++ b/src/declarative/qml/qdeclarativeexpression_p.h @@ -119,6 +119,7 @@ public: bool expressionFunctionValid:1; bool expressionRewritten:1; QScriptValue expressionFunction; + QScriptValue expressionContext; QObject *me; bool trackChange; @@ -180,8 +181,8 @@ public: virtual void emitValueChanged(); static void exceptionToError(QScriptEngine *, QDeclarativeError &); - static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QString &); - static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QScriptProgram &); + static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QString &, QScriptValue * = 0); + static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QScriptProgram &, QScriptValue * = 0); }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index e45f0fa..75ee7ce 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1676,8 +1676,7 @@ void tst_qdeclarativeecmascript::scriptScope() MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); emit object->argumentSignal(19, "Hello world!", 10.3); - QEXPECT_FAIL("", "QTBUG-8641", Continue); - QCOMPARE(object->property("result").toString(), QLatin1String("undefined")); + QCOMPARE(object->property("result").toString(), QString()); delete object; } -- cgit v0.12 From 5c1496d8839010653a9273586c10d99e0eeb66b2 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 3 Mar 2010 18:36:44 +1000 Subject: More renaming: MouseRegion -> MouseArea --- doc/src/declarative/tutorial.qdoc | 6 +++--- examples/declarative/colorbrowser/colorbrowser.qml | 2 +- examples/declarative/colorbrowser/qml/ColorDelegate.qml | 2 +- examples/declarative/package/Delegate.qml | 2 +- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index 98efe12..310b776 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -173,10 +173,10 @@ In this case the rectangle will have the same size as its parent (see \l{anchor- \snippet examples/declarative/tutorials/helloworld/Cell.qml 3 -In order to change the color of the text when clicking on a cell, we create a \l MouseRegion element with +In order to change the color of the text when clicking on a cell, we create a \l MouseArea element with the same size as its parent. -A \l MouseRegion defines a signal called \e clicked. +A \l MouseArea defines a signal called \e clicked. When this signal is triggered we want to emit our own \e clicked signal with the color as parameter. \section2 The main QML file @@ -214,7 +214,7 @@ Here is the QML code: \snippet examples/declarative/tutorials/helloworld/tutorial3.qml 2 First, we create a new \e down state for our text element. -This state will be activated when the \l MouseRegion is pressed, and deactivated when it is released. +This state will be activated when the \l MouseArea is pressed, and deactivated when it is released. The \e down state includes a set of property changes from our implicit \e {default state} (the items as they were initially defined in the QML). diff --git a/examples/declarative/colorbrowser/colorbrowser.qml b/examples/declarative/colorbrowser/colorbrowser.qml index ebd49c6..421ae07 100644 --- a/examples/declarative/colorbrowser/colorbrowser.qml +++ b/examples/declarative/colorbrowser/colorbrowser.qml @@ -53,7 +53,7 @@ Rectangle { Text { id: albumTitle; text: name; color: 'white'; font.bold: true; anchors.centerIn: parent } } - MouseRegion { anchors.fill: parent; onClicked: wrapper.state = 'inGrid' } + MouseArea { anchors.fill: parent; onClicked: wrapper.state = 'inGrid' } states: [ State { diff --git a/examples/declarative/colorbrowser/qml/ColorDelegate.qml b/examples/declarative/colorbrowser/qml/ColorDelegate.qml index 605e45b..c123d12 100644 --- a/examples/declarative/colorbrowser/qml/ColorDelegate.qml +++ b/examples/declarative/colorbrowser/qml/ColorDelegate.qml @@ -27,7 +27,7 @@ Package { value: hex; when: delegate.open && list.ListView.isCurrentItem } - MouseRegion { + MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton | Qt.LeftButton onClicked: { diff --git a/examples/declarative/package/Delegate.qml b/examples/declarative/package/Delegate.qml index 62198d0..f35314f 100644 --- a/examples/declarative/package/Delegate.qml +++ b/examples/declarative/package/Delegate.qml @@ -11,7 +11,7 @@ Package { color: 'lightsteelblue' Text { text: display; anchors.centerIn: parent } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { if (wrapper.state == 'inList') diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index a0aed46..55f1c89 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -144,7 +144,7 @@ QDeclarativeVisualItemModel::QDeclarativeVisualItemModel() QDeclarativeListProperty QDeclarativeVisualItemModel::children() { Q_D(QDeclarativeVisualItemModel); - return QDeclarativeListProperty(this, d, d->children_append, + return QDeclarativeListProperty(this, d, d->children_append, d->children_count, d->children_at); } @@ -483,7 +483,7 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId) QDeclarativeVisualDataModelData::QDeclarativeVisualDataModelData(int index, QDeclarativeVisualDataModel *model) -: m_index(index), m_model(model), +: m_index(index), m_model(model), m_meta(new QDeclarativeVisualDataModelDataMetaObject(this, QDeclarativeVisualDataModelPrivate::get(model)->m_delegateDataType)) { QDeclarativeVisualDataModelPrivate *modelPriv = QDeclarativeVisualDataModelPrivate::get(model); @@ -550,7 +550,7 @@ QVariant QDeclarativeVisualDataModelPartsMetaObject::initialValue(int id) } QDeclarativeVisualDataModelParts::QDeclarativeVisualDataModelParts(QDeclarativeVisualDataModel *parent) -: QObject(parent), model(parent) +: QObject(parent), model(parent) { new QDeclarativeVisualDataModelPartsMetaObject(this); } @@ -840,7 +840,7 @@ void QDeclarativeVisualDataModel::setDelegate(QDeclarativeComponent *delegate) Rectangle { height: 25; width: 100 Text { text: path } - MouseRegion { + MouseArea { anchors.fill: parent; onClicked: myModel.setRoot(path) } @@ -969,7 +969,7 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q QObject *QDeclarativeVisualDataModel::parts() { Q_D(QDeclarativeVisualDataModel); - if (!d->m_parts) + if (!d->m_parts) d->m_parts = new QDeclarativeVisualDataModelParts(this); return d->m_parts; } -- cgit v0.12 From 6e0565eaa293b84f7583947822fe5939cb47af89 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 2 Mar 2010 15:39:28 +0100 Subject: remove a warning on windows and simplify a bit the code --- src/gui/dialogs/qfontdialog.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index a4bf15d..b987611 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -988,13 +988,10 @@ void QFontDialog::open(QObject *receiver, const char *member) */ void QFontDialog::setVisible(bool visible) { - Q_D(QFontDialog); - if (visible) { - if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) - return; - } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) + if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden) != visible) return; #ifdef Q_WS_MAC + Q_D(QFontDialog); if (d->canBeNativeDialog()){ if (d->setVisible_sys(visible)){ d->nativeDialogInUse = true; -- cgit v0.12 From 60324267fbb8a8554e62aaf9ef01360709292320 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 2 Mar 2010 16:27:46 +0100 Subject: Make the sub-menu accessible via its shortcut even if it is the current Task-number: QTBUG-7411 Reviewed-by: ogoffart --- src/gui/widgets/qmenu.cpp | 12 ++---------- tests/auto/qmenu/tst_qmenu.cpp | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index e2cf25b..5db14b8 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -487,7 +487,7 @@ void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst) if (action && action->isEnabled()) { if (!delay) q->internalDelayedPopup(); - else + else if (!QMenuPrivate::menuDelayTimer.isActive() && (!action->menu() || !action->menu()->isVisible())) QMenuPrivate::menuDelayTimer.start(delay, q); if (activateFirst && action->menu()) action->menu()->d_func()->setFirstActionActive(); @@ -543,15 +543,6 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason { Q_Q(QMenu); tearoffHighlighted = 0; - if (action == currentAction) { - if (!action || !action->menu() || action->menu() == activeMenu) { - if(QMenu *menu = qobject_cast(causedPopup.widget)) { - if(causedPopup.action && menu->d_func()->activeMenu == q) - menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false); - } - } - return; - } if (currentAction) q->update(actionRect(currentAction)); @@ -565,6 +556,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason #ifdef QT3_SUPPORT emitHighlighted = action; #endif + currentAction = action; if (action) { if (!action->isSeparator()) { diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 3559b15..e10d7ee 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -105,6 +105,7 @@ private slots: void deleteActionInTriggered(); void pushButtonPopulateOnAboutToShow(); void QTBUG7907_submenus_autoselect(); + void QTBUG7411_submenus_activate(); protected slots: void onActivated(QAction*); void onHighlighted(QAction*); @@ -948,6 +949,25 @@ void tst_QMenu::QTBUG7907_submenus_autoselect() QVERIFY(!subset.isVisible()); } +void tst_QMenu::QTBUG7411_submenus_activate() +{ + QMenu menu("Test Menu"); + QAction *act = menu.addAction("foo"); + QMenu sub1("&sub1"); + sub1.addAction("foo"); + sub1.setTitle("&sub1"); + QAction *act1 = menu.addMenu(&sub1); + menu.show(); + QTest::qWaitForWindowShown(&menu); + menu.setActiveAction(act); + QTest::keyPress(&menu, Qt::Key_Down); + QCOMPARE(menu.activeAction(), act1); + QVERIFY(!sub1.isVisible()); + QTest::keyPress(&menu, Qt::Key_S); + QTRY_VERIFY(sub1.isVisible()); +} + + QTEST_MAIN(tst_QMenu) #include "tst_qmenu.moc" -- cgit v0.12 From 97b8727635a73197fac4f5edb8a1122733933db4 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 2 Mar 2010 16:38:42 +0100 Subject: Application menu is not translated in Mac OS X Cocoa The application menu is loaded from the qt_menu.nib which only has English strings. These will now be translated using Qt's own translation mechanism. Every time a new translator is installed, the menu will now try to get the new string. Modification of qt_xx.ts files are done in a different patch. Task-number: QTBUG-4463 Reviewed-by: MortenS --- src/gui/kernel/qapplication.cpp | 16 ++++++++++++++++ src/gui/kernel/qcocoamenuloader_mac.mm | 20 ++++++++++++++++++++ src/gui/kernel/qcocoamenuloader_mac_p.h | 4 +++- src/gui/kernel/qt_cocoa_helpers_mac.mm | 8 ++++++++ src/gui/kernel/qt_cocoa_helpers_mac_p.h | 2 ++ src/gui/widgets/qmenu_mac.mm | 30 ++++++++++++++++++++++-------- 6 files changed, 71 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 203f637..fea8c37 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2309,6 +2309,19 @@ static bool qt_detectRTLLanguage() " languages or to 'RTL' in right-to-left languages (such as Hebrew" " and Arabic) to get proper widget layout.") == QLatin1String("RTL")); } +#if defined(QT_MAC_USE_COCOA) +static const char *application_menu_strings[] = { + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All") + }; +QString qt_mac_applicationmenu_string(int type) +{ + return qApp->translate("MAC_APPLICATION_MENU", + application_menu_strings[type]); +} +#endif #endif /*!\reimp @@ -2337,6 +2350,9 @@ bool QApplication::event(QEvent *e) #ifndef QT_NO_TRANSLATION setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); #endif +#if defined(QT_MAC_USE_COCOA) + qt_mac_post_retranslateAppMenu(); +#endif QWidgetList list = topLevelWidgets(); for (int i = 0; i < list.size(); ++i) { QWidget *w = list.at(i); diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 573b763..35d156a 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -48,6 +48,7 @@ #include #include #include +#include QT_FORWARD_DECLARE_CLASS(QCFString) QT_FORWARD_DECLARE_CLASS(QString) @@ -58,6 +59,10 @@ QT_USE_NAMESPACE - (void)awakeFromNib { + servicesItem = [[appMenu itemWithTitle:@"Services"] retain]; + hideAllOthersItem = [[appMenu itemWithTitle:@"Hide Others"] retain]; + showAllItem = [[appMenu itemWithTitle:@"Show All"] retain]; + // Get the names in the nib to match the app name set by Qt. NSString *appName = reinterpret_cast(QCFString::toCFStringRef(qAppName())); [quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication" @@ -119,6 +124,10 @@ QT_USE_NAMESPACE - (void)dealloc { + [servicesItem release]; + [hideAllOthersItem release]; + [showAllItem release]; + [lastAppSpecificItem release]; [theMenu release]; [appMenu release]; @@ -214,6 +223,17 @@ QT_USE_NAMESPACE QMenuBarPrivate::macUpdateMenuBarImmediatly(); } +- (void)qtTranslateApplicationMenu +{ +#ifndef QT_NO_TRANSLATION + extern QString qt_mac_applicationmenu_string(int type); + [servicesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(0))]; + [hideItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(1).arg(qAppName()))]; + [hideAllOthersItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(2))]; + [showAllItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(3))]; +#endif +} + - (IBAction)qtDispatcherToQAction:(id)sender { QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData); diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h index 2504b8c..a75ad0a 100644 --- a/src/gui/kernel/qcocoamenuloader_mac_p.h +++ b/src/gui/kernel/qcocoamenuloader_mac_p.h @@ -67,7 +67,9 @@ IBOutlet NSMenuItem *aboutQtItem; IBOutlet NSMenuItem *hideItem; NSMenuItem *lastAppSpecificItem; - + NSMenuItem *servicesItem; + NSMenuItem *hideAllOthersItem; + NSMenuItem *showAllItem; } - (void)ensureAppMenuInMenu:(NSMenu *)menu; - (void)removeActionsFromAppMenu; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 19bae5a..4f4aec0 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1386,4 +1386,12 @@ QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() [(NSAutoreleasePool*)pool release]; } +void qt_mac_post_retranslateAppMenu() +{ +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; + qt_cocoaPostMessage([NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu)); +#endif +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index c43ea55..3fd62a4 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -208,4 +208,6 @@ bool qt_cocoaPostMessage(id target, SEL selector); #endif +void qt_mac_post_retranslateAppMenu(); + QT_END_NAMESPACE diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 99c550f..2570cb5 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -924,14 +924,27 @@ static QString qt_mac_menu_merge_text(QMacMenuAction *action) else if (action->command == kHICommandQuit) ret = QMenuBar::tr("Quit %1").arg(qAppName()); #else - else if (action->menuItem == [loader aboutMenuItem]) - ret = QMenuBar::tr("About %1").arg(qAppName()); - else if (action->menuItem == [loader aboutQtMenuItem]) - ret = QMenuBar::tr("About Qt"); - else if (action->menuItem == [loader preferencesMenuItem]) - ret = QMenuBar::tr("Preferences"); - else if (action->menuItem == [loader quitMenuItem]) - ret = QMenuBar::tr("Quit %1").arg(qAppName()); + else if (action->menuItem == [loader aboutMenuItem]) { + if (action->action->text() == QString("About %1").arg(qAppName())) + ret = QMenuBar::tr("About %1").arg(qAppName()); + else + ret = action->action->text(); + } else if (action->menuItem == [loader aboutQtMenuItem]) { + if (action->action->text() == QString("About Qt")) + ret = QMenuBar::tr("About Qt"); + else + ret = action->action->text(); + } else if (action->menuItem == [loader preferencesMenuItem]) { + if (action->action->text() == QString("Preferences")) + ret = QMenuBar::tr("Preferences"); + else + ret = action->action->text(); + } else if (action->menuItem == [loader quitMenuItem]) { + if (action->action->text() == QString("Quit %1").arg(qAppName())) + ret = QMenuBar::tr("About %1").arg(qAppName()); + else + ret = action->action->text(); + } #endif return ret; } @@ -2180,3 +2193,4 @@ static OSMenuRef qt_mac_create_menu(QWidget *w) QT_END_NAMESPACE + -- cgit v0.12 From f006691acc45a57e011e5827163c0b3759864bf7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 2 Mar 2010 17:18:26 +0100 Subject: make the fallback value of QMAKE_QMAKE absolute inspired by the pbx generator. currently this has no effect, as all generators build their own fallbacks anyway. Reviewed-by: mariusSO --- qmake/project.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index cf1c365..9e6db10 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3139,7 +3139,8 @@ QStringList &QMakeProject::values(const QString &_var, QMap Date: Tue, 2 Mar 2010 17:10:46 +0100 Subject: don't have every generator duplicate the QMAKE_QMAKE logic Reviewed-by: mariusSO --- qmake/generators/mac/pbuilder_pbx.cpp | 4 +--- qmake/generators/makefile.cpp | 12 +++++------- qmake/generators/symbian/symmake_abld.cpp | 2 +- qmake/generators/symbian/symmake_sbsv2.cpp | 2 +- qmake/generators/unix/unixmake.cpp | 2 -- qmake/generators/unix/unixmake2.cpp | 4 ++-- qmake/generators/win32/borland_bmake.cpp | 2 -- qmake/generators/win32/mingw_make.cpp | 4 +--- qmake/generators/win32/msvc_nmake.cpp | 2 -- qmake/generators/win32/winmakefile.cpp | 3 +-- 10 files changed, 12 insertions(+), 25 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index ac9fa99..1a7391b 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -523,9 +523,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); QTextStream mkt(&mkf); writeHeader(mkt); - mkt << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? - QString((QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake")) : - var("QMAKE_QMAKE")) << endl; + mkt << "QMAKE = " << var("QMAKE_QMAKE") << endl; writeMakeQmake(mkt); mkt.flush(); mkf.close(); diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index a8c1c3c..b9d2445 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -806,9 +806,8 @@ MakefileGenerator::init() } // escape qmake command - if (!project->isEmpty("QMAKE_QMAKE")) { - project->values("QMAKE_QMAKE") = escapeFilePaths(project->values("QMAKE_QMAKE")); - } + QStringList &qmk = project->values("QMAKE_QMAKE"); + qmk = escapeFilePaths(qmk); } bool @@ -2097,7 +2096,7 @@ MakefileGenerator::writeExtraVariables(QTextStream &t) bool MakefileGenerator::writeStubMakefile(QTextStream &t) { - t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << endl; QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; @@ -2212,8 +2211,7 @@ MakefileGenerator::writeHeader(QTextStream &t) t << "# Project: " << fileFixify(project->projectFile()) << endl; t << "# Template: " << var("TEMPLATE") << endl; if(!project->isActiveConfig("build_pass")) - t << "# Command: " << build_args().replace("$(QMAKE)", - (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE"))) << endl; + t << "# Command: " << build_args().replace("$(QMAKE)", var("QMAKE_QMAKE")) << endl; t << "#############################################################################" << endl; t << endl; } @@ -2346,7 +2344,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListisEmpty("MAKEFILE")) project->values("MAKEFILE").append("Makefile"); - if(project->isEmpty("QMAKE_QMAKE")) - project->values("QMAKE_QMAKE").append("qmake"); if(project->values("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1) project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all"); return; /* subdirs is done */ diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 025882e..5def030 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -81,7 +81,7 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) writeHeader(t); if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { - t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << endl; QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; @@ -154,7 +154,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "AR = " << var("QMAKE_AR") << endl; t << "RANLIB = " << var("QMAKE_RANLIB") << endl; - t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << endl; t << "TAR = " << var("QMAKE_TAR") << endl; t << "COMPRESS = " << var("QMAKE_GZIP") << endl; if(project->isActiveConfig("compile_libtool")) diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index 9208e1d..b5c33c4 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp @@ -115,8 +115,6 @@ BorlandMakefileGenerator::init() project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)"); if(project->values("MAKEFILE").isEmpty()) project->values("MAKEFILE").append("Makefile"); - if(project->values("QMAKE_QMAKE").isEmpty()) - project->values("QMAKE_QMAKE").append("qmake"); return; } diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index e1f502f..fd43145 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -143,7 +143,7 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") { if(Option::mkfile::do_stub_makefile) { - t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << endl; QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; @@ -248,8 +248,6 @@ void MingwMakefileGenerator::init() project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)"); if(project->values("MAKEFILE").isEmpty()) project->values("MAKEFILE").append("Makefile"); - if(project->values("QMAKE_QMAKE").isEmpty()) - project->values("QMAKE_QMAKE").append("qmake"); return; } diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 7566b23..92e8aeb 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -156,8 +156,6 @@ void NmakeMakefileGenerator::init() MakefileGenerator::init(); if(project->values("MAKEFILE").isEmpty()) project->values("MAKEFILE").append("Makefile"); - if(project->values("QMAKE_QMAKE").isEmpty()) - project->values("QMAKE_QMAKE").append("qmake"); if(project->isEmpty("QMAKE_COPY_FILE")) project->values("QMAKE_COPY_FILE").append("$(COPY)"); if(project->isEmpty("QMAKE_COPY_DIR")) diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 9998c1f..44fef5d 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -591,8 +591,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) writeIncPart(t); writeLibsPart(t); - t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : - Option::fixPathToTargetOS(var("QMAKE_QMAKE"), false)) << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << endl; t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : Option::fixPathToTargetOS(var("QMAKE_IDC"), false)) << endl; t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : -- cgit v0.12 From 509ac7e069bf17f2725dcebdeb8e9520b98b0e15 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 3 Mar 2010 11:35:33 +0100 Subject: qdoc3: Trying to find a bug that causes a crash. It doesn't crash on OS X, but it does on some other platforms. If you run into this crash running qdoc3, you can work around it by commenting out line 1539 in tools/qdoc3/htmlgenerator.cpp The line to comment out is: generateQmlInheritedBy(qml_cn, marker); --- tools/qdoc3/generator.cpp | 10 +++------- tools/qdoc3/node.cpp | 5 ++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 0ef5156..c8a39ef 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1190,19 +1190,15 @@ void Generator::appendSortedQmlNames(Text& text, const NodeList& subs, CodeMarker *marker) { - NodeList::ConstIterator r; QMap classMap; int index = 0; qDebug() << "Generator::appendSortedQmlNames():" << base->name() << "is inherited by..."; - - r = subs.begin(); - while (r != subs.end()) { + for (int i = 0; i < subs.size(); ++i) { Text t; - qDebug() << " " << (*r)->name(); - appendFullName(t, (*r), base, marker); + qDebug() << " " << subs[i]->name(); + appendFullName(t, subs[i], base, marker); classMap[t.toString().toLower()] = t; - ++r; } QStringList names = classMap.keys(); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 7dda824..5415559 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1315,8 +1315,11 @@ void QmlClassNode::addInheritedBy(const QString& base, Node* sub) void QmlClassNode::subclasses(const QString& base, NodeList& subs) { subs.clear(); - if (inheritedBy.contains(base)) + if (inheritedBy.count(base) > 0) { subs = inheritedBy.values(base); + qDebug() << "QmlClassNode::subclasses():" << inheritedBy.count(base) << base + << "subs:" << subs.size(); + } } /*! -- cgit v0.12 From a4af046157c7ef94990f9520c4611597ff271c57 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 3 Mar 2010 11:42:12 +0100 Subject: fixed a memory leak when restoring a state in QMainWindow Task-number: QTBUG-8631 --- src/gui/widgets/qdockarealayout.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index c1b1ea3..f44858a 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1985,7 +1985,10 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList emit widget->dockLocationChanged(toDockWidgetArea(dockPos)); } } - + if (testing) { + //was it is not really added to the layout, we need to delete the object here + delete item.widgetItem; + } } } else if (nextMarker == SequenceMarker) { int dummy; -- cgit v0.12 From 24cf789b68f21b2d1ea31580e55c91a2cae25a12 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 3 Mar 2010 11:02:11 +0100 Subject: Fix compilation of Q_DECLARE_METATYPE(QVariant) by introducing QMetaType::QVariant After 03daf059647c0a0222e8774b0a083f58c8e64934 With the recent change in QMetaType, qRegisterMetaType instantiates QMetaTypeId2, which itself instantiates QMetaTypeId if T is not builtin into QMetaType. But qRegisterMetaType is called in qvariant.h which makes further call to Q_DECLARE_METATYPE(QVariant) to fail as QMetaTypeId would have been instantied before The solution is to make QVariant a builtin type. Reviewed-by: Thierry --- src/corelib/kernel/qmetatype.cpp | 15 +++++++++++++++ src/corelib/kernel/qmetatype.h | 5 ++++- src/corelib/kernel/qvariant.h | 3 +-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index be506b4..8f2d025 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -133,6 +133,7 @@ QT_BEGIN_NAMESPACE \value Float \c float \value QObjectStar QObject * \value QWidgetStar QWidget * + \value QVariant QVariant \value QColorGroup QColorGroup \value QCursor QCursor @@ -300,6 +301,7 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ QT_ADD_STATIC_METATYPE("float", QMetaType::Float), QT_ADD_STATIC_METATYPE("QObject*", QMetaType::QObjectStar), QT_ADD_STATIC_METATYPE("QWidget*", QMetaType::QWidgetStar), + QT_ADD_STATIC_METATYPE("QVariant", QMetaType::QVariant), /* Type aliases - order doesn't matter */ QT_ADD_STATIC_METATYPE("unsigned long", QMetaType::ULong), @@ -686,6 +688,9 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) case QMetaType::QVariantList: stream << *static_cast(data); break; + case QMetaType::QVariant: + stream << *static_cast(data); + break; #endif case QMetaType::QByteArray: stream << *static_cast(data); @@ -888,6 +893,9 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) case QMetaType::QVariantList: stream >> *static_cast< NS(QVariantList)*>(data); break; + case QMetaType::QVariant: + stream >> *static_cast< NS(QVariant)*>(data); + break; #endif case QMetaType::QByteArray: stream >> *static_cast< NS(QByteArray)*>(data); @@ -1055,6 +1063,8 @@ void *QMetaType::construct(int type, const void *copy) return new NS(QVariantHash)(*static_cast(copy)); case QMetaType::QVariantList: return new NS(QVariantList)(*static_cast(copy)); + case QMetaType::QVariant: + return new NS(QVariant)(*static_cast(copy)); #endif case QMetaType::QByteArray: return new NS(QByteArray)(*static_cast(copy)); @@ -1150,6 +1160,8 @@ void *QMetaType::construct(int type, const void *copy) return new NS(QVariantHash); case QMetaType::QVariantList: return new NS(QVariantList); + case QMetaType::QVariant: + return new NS(QVariant); #endif case QMetaType::QByteArray: return new NS(QByteArray); @@ -1291,6 +1303,9 @@ void QMetaType::destroy(int type, void *data) case QMetaType::QVariantList: delete static_cast< NS(QVariantList)* >(data); break; + case QMetaType::QVariant: + delete static_cast< NS(QVariant)* >(data); + break; #endif case QMetaType::QByteArray: delete static_cast< NS(QByteArray)* >(data); diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 2ed4a1f..98ed4bd 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -86,7 +86,8 @@ public: FirstCoreExtType = 128 /* VoidStar */, VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, - LastCoreExtType = QWidgetStar, + QVariant = 138, + LastCoreExtType = QVariant, // This logic must match the one in qglobal.h #if defined(QT_COORD_TYPE) @@ -353,6 +354,7 @@ class QVector2D; class QVector3D; class QVector4D; class QQuaternion; +class QVariant; QT_END_NAMESPACE @@ -421,6 +423,7 @@ Q_DECLARE_BUILTIN_METATYPE(QVector2D, QVector2D) Q_DECLARE_BUILTIN_METATYPE(QVector3D, QVector3D) Q_DECLARE_BUILTIN_METATYPE(QVector4D, QVector4D) Q_DECLARE_BUILTIN_METATYPE(QQuaternion, QQuaternion) +Q_DECLARE_BUILTIN_METATYPE(QVariant, QVariant) QT_END_HEADER diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 9628dbf..cb2825c 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -589,8 +589,7 @@ template inline T qvariant_cast(const QVariant &v) template<> inline QVariant qvariant_cast(const QVariant &v) { - static const int vid = qRegisterMetaType("QVariant"); - if (vid == v.userType()) + if (v.userType() == QMetaType::QVariant) return *reinterpret_cast(v.constData()); return v; } -- cgit v0.12 From 7a6f492a6dcf9140eda309dcdff6e0f8d321df19 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 3 Mar 2010 11:07:26 +0100 Subject: Fix QVariant autotest After 03daf059647c0a0222e8774b0a083f58c8e64934, typedef of int are just aliases to int, and therefor we need to use a real custom type for the test now Reviewed-by: Thierry --- tests/auto/qvariant/tst_qvariant.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index a316dda..1a4182f 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -2518,15 +2518,23 @@ void tst_QVariant::variant_to() QCOMPARE(qVariantFromValue(0.25f).toDouble(), 0.25); } +struct Blah { int i; }; + +QDataStream& operator>>(QDataStream& s, Blah& c) +{ return (s >> c.i); } + +QDataStream& operator<<(QDataStream& s, const Blah& c) +{ return (s << c.i); } + void tst_QVariant::saveLoadCustomTypes() { QByteArray data; - int i = 42; - int tp = qRegisterMetaType("Blah"); + Blah i = { 42 }; + int tp = qRegisterMetaType("Blah"); QVariant v = QVariant(tp, &i); - qRegisterMetaTypeStreamOperators("Blah"); + qRegisterMetaTypeStreamOperators("Blah"); QCOMPARE(v.userType(), tp); QVERIFY(v.type() == QVariant::UserType); -- cgit v0.12 From 9957e85e37345e946ecc67196d65fbca867a2001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 3 Mar 2010 10:34:44 +0100 Subject: Add config.test for multimedia/qml using pkg-config from pri file is not good for cross-compiling Reviewed-by: paul --- config.tests/unix/pulseaudio/pulseaudio.pro | 4 ++ config.tests/unix/pulseaudio/pulseaudiotest.cpp | 49 +++++++++++++++++++++++++ configure | 15 ++++++++ src/multimedia/qml/qml.pri | 20 +++++----- 4 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 config.tests/unix/pulseaudio/pulseaudio.pro create mode 100644 config.tests/unix/pulseaudio/pulseaudiotest.cpp diff --git a/config.tests/unix/pulseaudio/pulseaudio.pro b/config.tests/unix/pulseaudio/pulseaudio.pro new file mode 100644 index 0000000..698a35f --- /dev/null +++ b/config.tests/unix/pulseaudio/pulseaudio.pro @@ -0,0 +1,4 @@ +SOURCES = pulseaudiotest.cpp +LIBS+=-lpulse +CONFIG -= qt dylib +mac:CONFIG -= app_bundle diff --git a/config.tests/unix/pulseaudio/pulseaudiotest.cpp b/config.tests/unix/pulseaudio/pulseaudiotest.cpp new file mode 100644 index 0000000..eed88da --- /dev/null +++ b/config.tests/unix/pulseaudio/pulseaudiotest.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +int main(int ,char **) +{ + pa_threaded_mainloop *mainloop = pa_threaded_mainloop_new(); + return 0; +} + diff --git a/configure b/configure index 2312165..7ac4ff0 100755 --- a/configure +++ b/configure @@ -784,6 +784,7 @@ OPT_HELP= CFG_SILENT=no CFG_GRAPHICS_SYSTEM=default CFG_ALSA=auto +CFG_PULSEAUDIO=auto CFG_NETWORKMANAGER=auto CFG_COREWLAN=auto @@ -5945,6 +5946,14 @@ if [ "$CFG_ALSA" = "auto" ]; then fi fi +if [ "$CFG_PULSEAUDIO" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pulseaudio "pulseaudio" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_PULSEAUDIO=yes + else + CFG_PULSEAUDIO=no + fi +fi + if [ "$CFG_NETWORKMANAGER" = "auto" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/networkmanager "NetworkManager" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_NETWORKMANAGER=yes @@ -6439,6 +6448,10 @@ if [ "$CFG_ALSA" = "yes" ]; then QT_CONFIG="$QT_CONFIG alsa" fi +if [ "$CFG_PULSEAUDIO" = "yes" ]; then + QT_CONFIG="$QT_CONFIG pulseaudio" +fi + if [ "$CFG_NETWORKMANAGER" = "yes" ]; then QT_CONFIG="$QT_CONFIG networkmanager" fi @@ -7154,6 +7167,7 @@ fi [ "$CFG_XRANDR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR" [ "$CFG_XINPUT" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT" [ "$CFG_ALSA" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA" +[ "$CFG_PULSEAUDIO" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO" [ "$CFG_NETWORKMANAGER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NETWORKMANAGER" [ "$CFG_COREWLAN" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN" @@ -7657,6 +7671,7 @@ elif [ "$CFG_OPENSSL" = "linked" ]; then fi echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE" echo "Alsa support ........... $CFG_ALSA" +echo "Pulse Audio support .... $CFG_PULSEAUDIO" echo "NetworkManager support . $CFG_NETWORKMANAGER" if [ "$PLATFORM_MAC" = "yes" ]; then echo "CoreWlan support ....... $CFG_COREWLAN" diff --git a/src/multimedia/qml/qml.pri b/src/multimedia/qml/qml.pri index d0ff71d..d7aef1a 100644 --- a/src/multimedia/qml/qml.pri +++ b/src/multimedia/qml/qml.pri @@ -2,15 +2,17 @@ contains(QT_CONFIG, declarative) { QT += declarative - system(pkg-config --exists \'libpulse >= 0.9.10\') { - DEFINES += QT_MULTIMEDIA_PULSEAUDIO - HEADERS += $$PWD/qsoundeffect_pulse_p.h - SOURCES += $$PWD/qsoundeffect_pulse_p.cpp - LIBS += -lpulse - } else:x11 { - DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER - HEADERS += $$PWD/qsoundeffect_qmedia_p.h - SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp + unix { + unix:contains(QT_CONFIG, pulseaudio) { + DEFINES += QT_MULTIMEDIA_PULSEAUDIO + HEADERS += $$PWD/qsoundeffect_pulse_p.h + SOURCES += $$PWD/qsoundeffect_pulse_p.cpp + LIBS += -lpulse + } else { + DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER + HEADERS += $$PWD/qsoundeffect_qmedia_p.h + SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp + } } else { HEADERS += $$PWD/qsoundeffect_qsound_p.h SOURCES += $$PWD/qsoundeffect_qsound_p.cpp -- cgit v0.12 From 388bd11da343f5e7bc9928bc1151de18bc01fe7f Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 3 Mar 2010 11:56:56 +0100 Subject: Revert "Fixes crash when destroying a QGraphicsItem." The patch was wrong. The new one is pushed into 4.6. The old one is reverted to avoid merge conflicts. This reverts commit a7ef2d899d711d750238a8d69284da808188b407. --- src/gui/graphicsview/qgraphicsitem.cpp | 5 +-- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 57 -------------------------- 2 files changed, 2 insertions(+), 60 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 5735cd6..4f06f80 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3179,9 +3179,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim */ void QGraphicsItem::clearFocus() { - // Pass focus to the closest parent focus scope when clearing focus - // from a focus scope. - if (!d_ptr->inDestructor && (d_ptr->flags & ItemIsFocusScope)) { + // Pass focus to the closest parent focus scope. + if (!d_ptr->inDestructor) { QGraphicsItem *p = d_ptr->parent; while (p) { if (p->flags() & ItemIsFocusScope) { diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 269ec24..7c1b97e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -438,7 +438,6 @@ private slots: void QTBUG_6738_missingUpdateWithSetParent(); void QTBUG_7714_fullUpdateDiscardingOpacityUpdate2(); void QT_2653_fullUpdateDiscardingOpacityUpdate(); - void QT_2649_focusScope(); private: QList paintedItems; @@ -10003,61 +10002,5 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2() QTRY_COMPARE(view.repaints, 1); } -void tst_QGraphicsItem::QT_2649_focusScope() -{ - QGraphicsScene *scene = new QGraphicsScene; - - QGraphicsRectItem *subFocusItem = new QGraphicsRectItem; - subFocusItem->setFlags(QGraphicsItem::ItemIsFocusable); - subFocusItem->setFocus(); - QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - - QGraphicsRectItem *scope = new QGraphicsRectItem; - scope->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); - scope->setFocus(); - subFocusItem->setParentItem(scope); - QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); - QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); - - QGraphicsRectItem *rootItem = new QGraphicsRectItem; - rootItem->setFlags(QGraphicsItem::ItemIsFocusable); - scope->setParentItem(rootItem); - QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0); - QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); - QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); - - scene->addItem(rootItem); - - QEvent windowActivate(QEvent::WindowActivate); - qApp->sendEvent(scene, &windowActivate); - scene->setFocus(); - - QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0); - QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); - QVERIFY(subFocusItem->hasFocus()); - - //If we hide the focusScope, the entire subFocus chain should be cleared - scope->hide(); - - QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)0); - QCOMPARE(scope->focusItem(), (QGraphicsItem *)0); - QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)0); - QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0); - QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem); - QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0); - QVERIFY(!subFocusItem->hasFocus()); - - delete scene; -} - QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From 4a5eaccce02dbabfd81e8809d453fc268cdba644 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 2 Mar 2010 14:38:39 +0100 Subject: Some cleanup of outdated src/3rdparty stuff Reviewed-by: trustme --- src/3rdparty/README | 34 +- src/3rdparty/patches/freetype-2.3.5-config.patch | 265 --------------- src/3rdparty/patches/freetype-2.3.6-ascii.patch | 174 ---------- src/3rdparty/patches/freetype-2.3.6-vxworks.patch | 35 -- src/3rdparty/patches/libjpeg-6b-config.patch | 50 --- src/3rdparty/patches/libjpeg-6b-vxworks.patch | 23 -- .../patches/libpng-1.2.20-elf-visibility.patch | 17 - src/3rdparty/patches/libpng-1.2.20-vxworks.patch | 13 - src/3rdparty/patches/libtiff-3.8.2-config.patch | 374 --------------------- src/3rdparty/patches/libtiff-3.8.2-vxworks.patch | 11 - src/3rdparty/patches/sqlite-3.5.6-config.patch | 38 --- src/3rdparty/patches/sqlite-3.5.6-vxworks.patch | 68 ---- src/3rdparty/patches/sqlite-3.5.6-wince.patch | 19 -- 13 files changed, 15 insertions(+), 1106 deletions(-) delete mode 100644 src/3rdparty/patches/freetype-2.3.5-config.patch delete mode 100644 src/3rdparty/patches/freetype-2.3.6-ascii.patch delete mode 100644 src/3rdparty/patches/freetype-2.3.6-vxworks.patch delete mode 100644 src/3rdparty/patches/libjpeg-6b-config.patch delete mode 100644 src/3rdparty/patches/libjpeg-6b-vxworks.patch delete mode 100644 src/3rdparty/patches/libpng-1.2.20-elf-visibility.patch delete mode 100644 src/3rdparty/patches/libpng-1.2.20-vxworks.patch delete mode 100644 src/3rdparty/patches/libtiff-3.8.2-config.patch delete mode 100644 src/3rdparty/patches/libtiff-3.8.2-vxworks.patch delete mode 100644 src/3rdparty/patches/sqlite-3.5.6-config.patch delete mode 100644 src/3rdparty/patches/sqlite-3.5.6-vxworks.patch delete mode 100644 src/3rdparty/patches/sqlite-3.5.6-wince.patch diff --git a/src/3rdparty/README b/src/3rdparty/README index ef05674..0248db1 100644 --- a/src/3rdparty/README +++ b/src/3rdparty/README @@ -1,26 +1,22 @@ The libraries included here are the original packages, unpacked, and with their version number removed from the directory name (for version -information, see the README files in the directories). The following -have been removed: - - libjpeg - some source files, images, Makefiles, manual pages - libpng/contrib - a collection of examples and test-suite - libmng/bcb - a collection of files for the Borland compiler - libmng/contrib - a collection of projects that use libmng - libmng/special - configuration file for Mozilla integration - libtiff/contrib - a collection of additions to libtiff - libtiff/man - manual pages - libtiff/tools - a collection of command-line tools based on libtiff - zlib/contrib - a collection of non-zlib code - zlib/amiga - zlib for a platform not supported by Qt - zlib/as400 - zlib for a platform not supported by Qt - zlib/msdos - zlib for a platform not supported by Qt - zlib/old - zlib for a platform not supported by Qt - zlib/qnx - zlib packaging +information, see the README files in the directories). -Some patches are applied from time to time. Recent patches can be -found in the patches subdirectory. +Certain files and subdirectories of the original library packages that +are irrelevant to Qt may not be included here. Typically, those are +the standalone library configuration and make files, tools, test +files, contribs, documentation, and similar. +Patches may have been applied, typically for configuration and build +issues in the Qt framework. Such patches can be reviewed in the the +public git repository; they will appear in the commit logs of each +library directory, following the latest clean version update commit. + +The 'patches' subdirectory contains certain patches applied prior to +the start of the public git history, where the library has not been +updated since. + +-- The pvr2d.h & wsegl.h in the powervr directory are required for building the PowerVR plugin on Qt for Embedded Linux. These headers are for SGX diff --git a/src/3rdparty/patches/freetype-2.3.5-config.patch b/src/3rdparty/patches/freetype-2.3.5-config.patch deleted file mode 100644 index 2653467..0000000 --- a/src/3rdparty/patches/freetype-2.3.5-config.patch +++ /dev/null @@ -1,265 +0,0 @@ ---- builds/unix/ftconfig.h 1970-01-01 01:00:00.000000000 +0100 -+++ builds/unix/ftconfig.h 2007-07-15 00:00:00.000000000 +0200 -@@ -0,0 +1,262 @@ -+/* ftconfig.h. Generated by configure. */ -+/***************************************************************************/ -+/* */ -+/* ftconfig.in */ -+/* */ -+/* UNIX-specific configuration file (specification only). */ -+/* */ -+/* Copyright 1996-2000, 2002 by */ -+/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -+/* */ -+/* This file is part of the FreeType project, and may only be used, */ -+/* modified, and distributed under the terms of the FreeType project */ -+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -+/* this file you indicate that you have read the license and */ -+/* understand and accept it fully. */ -+/* */ -+/***************************************************************************/ -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* This header file contains a number of macro definitions that are used */ -+ /* by the rest of the engine. Most of the macros here are automatically */ -+ /* determined at compile time, and you should not need to change it to */ -+ /* port FreeType, except to compile the library with a non-ANSI */ -+ /* compiler. */ -+ /* */ -+ /* Note however that if some specific modifications are needed, we */ -+ /* advise you to place a modified copy in your build directory. */ -+ /* */ -+ /* The build directory is usually `freetype/builds/', and */ -+ /* contains system-specific files that are always included first when */ -+ /* building the library. */ -+ /* */ -+ /*************************************************************************/ -+ -+ -+#ifndef __FTCONFIG_H__ -+#define __FTCONFIG_H__ -+ -+#include -+#include FT_CONFIG_OPTIONS_H -+#include FT_CONFIG_STANDARD_LIBRARY_H -+ -+ -+FT_BEGIN_HEADER -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ -+ /* */ -+ /* These macros can be toggled to suit a specific system. The current */ -+ /* ones are defaults used to compile FreeType in an ANSI C environment */ -+ /* (16bit compilers are also supported). Copy this file to your own */ -+ /* `freetype/builds/' directory, and edit it to port the engine. */ -+ /* */ -+ /*************************************************************************/ -+ -+ -+#define HAVE_UNISTD_H 1 -+#define HAVE_FCNTL_H 1 -+ -+#define SIZEOF_INT 4 -+#define SIZEOF_LONG 4 -+ -+#define FT_SIZEOF_INT SIZEOF_INT -+#define FT_SIZEOF_LONG SIZEOF_LONG -+ -+ -+ /* Preferred alignment of data */ -+#define FT_ALIGNMENT 8 -+ -+ -+ /* FT_UNUSED is a macro used to indicate that a given parameter is not */ -+ /* used -- this is only used to get rid of unpleasant compiler warnings */ -+#ifndef FT_UNUSED -+#define FT_UNUSED( arg ) ( (arg) = (arg) ) -+#endif -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* AUTOMATIC CONFIGURATION MACROS */ -+ /* */ -+ /* These macros are computed from the ones defined above. Don't touch */ -+ /* their definition, unless you know precisely what you are doing. No */ -+ /* porter should need to mess with them. */ -+ /* */ -+ /*************************************************************************/ -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* IntN types */ -+ /* */ -+ /* Used to guarantee the size of some specific integers. */ -+ /* */ -+ typedef signed short FT_Int16; -+ typedef unsigned short FT_UInt16; -+ -+#if FT_SIZEOF_INT == 4 -+ -+ typedef signed int FT_Int32; -+ typedef unsigned int FT_UInt32; -+ -+#elif FT_SIZEOF_LONG == 4 -+ -+ typedef signed long FT_Int32; -+ typedef unsigned long FT_UInt32; -+ -+#else -+#error "no 32bit type found -- please check your configuration files" -+#endif -+ -+#if FT_SIZEOF_LONG == 8 -+ -+ /* FT_LONG64 must be defined if a 64-bit type is available */ -+#define FT_LONG64 -+#define FT_INT64 long -+ -+#else -+ -+ /*************************************************************************/ -+ /* */ -+ /* Many compilers provide the non-ANSI `long long' 64-bit type. You can */ -+ /* activate it by defining the FTCALC_USE_LONG_LONG macro in */ -+ /* `ftoption.h'. */ -+ /* */ -+ /* Note that this will produce many -ansi warnings during library */ -+ /* compilation, and that in many cases, the generated code will be */ -+ /* neither smaller nor faster! */ -+ /* */ -+#ifdef FTCALC_USE_LONG_LONG -+ -+#define FT_LONG64 -+#define FT_INT64 long long -+ -+#endif /* FTCALC_USE_LONG_LONG */ -+#endif /* FT_SIZEOF_LONG == 8 */ -+ -+ -+#ifdef FT_MAKE_OPTION_SINGLE_OBJECT -+ -+#define FT_LOCAL( x ) static x -+#define FT_LOCAL_DEF( x ) static x -+ -+#else -+ -+#ifdef __cplusplus -+#define FT_LOCAL( x ) extern "C" x -+#define FT_LOCAL_DEF( x ) extern "C" x -+#else -+#define FT_LOCAL( x ) extern x -+#define FT_LOCAL_DEF( x ) extern x -+#endif -+ -+#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ -+ -+ -+#ifndef FT_BASE -+ -+#ifdef __cplusplus -+#define FT_BASE( x ) extern "C" x -+#else -+#define FT_BASE( x ) extern x -+#endif -+ -+#endif /* !FT_BASE */ -+ -+ -+#ifndef FT_BASE_DEF -+ -+#ifdef __cplusplus -+#define FT_BASE_DEF( x ) extern "C" x -+#else -+#define FT_BASE_DEF( x ) extern x -+#endif -+ -+#endif /* !FT_BASE_DEF */ -+ -+ -+#ifndef FT_EXPORT -+ -+#ifdef __cplusplus -+#define FT_EXPORT( x ) extern "C" x -+#else -+#define FT_EXPORT( x ) extern x -+#endif -+ -+#endif /* !FT_EXPORT */ -+ -+ -+#ifndef FT_EXPORT_DEF -+ -+#ifdef __cplusplus -+#define FT_EXPORT_DEF( x ) extern "C" x -+#else -+#define FT_EXPORT_DEF( x ) extern x -+#endif -+ -+#endif /* !FT_EXPORT_DEF */ -+ -+ -+#ifndef FT_EXPORT_VAR -+ -+#ifdef __cplusplus -+#define FT_EXPORT_VAR( x ) extern "C" x -+#else -+#define FT_EXPORT_VAR( x ) extern x -+#endif -+ -+#endif /* !FT_EXPORT_VAR */ -+ -+ /* The following macros are needed to compile the library with a */ -+ /* C++ compiler and with 16bit compilers. */ -+ /* */ -+ -+ /* This is special. Within C++, you must specify `extern "C"' for */ -+ /* functions which are used via function pointers, and you also */ -+ /* must do that for structures which contain function pointers to */ -+ /* assure C linkage -- it's not possible to have (local) anonymous */ -+ /* functions which are accessed by (global) function pointers. */ -+ /* */ -+ /* */ -+ /* FT_CALLBACK_DEF is used to _define_ a callback function. */ -+ /* */ -+ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ -+ /* contains pointers to callback functions. */ -+ /* */ -+ /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ -+ /* that contains pointers to callback functions. */ -+ /* */ -+ /* */ -+ /* Some 16bit compilers have to redefine these macros to insert */ -+ /* the infamous `_cdecl' or `__fastcall' declarations. */ -+ /* */ -+#ifndef FT_CALLBACK_DEF -+#ifdef __cplusplus -+#define FT_CALLBACK_DEF( x ) extern "C" x -+#else -+#define FT_CALLBACK_DEF( x ) static x -+#endif -+#endif /* FT_CALLBACK_DEF */ -+ -+#ifndef FT_CALLBACK_TABLE -+#ifdef __cplusplus -+#define FT_CALLBACK_TABLE extern "C" -+#define FT_CALLBACK_TABLE_DEF extern "C" -+#else -+#define FT_CALLBACK_TABLE extern -+#define FT_CALLBACK_TABLE_DEF /* nothing */ -+#endif -+#endif /* FT_CALLBACK_TABLE */ -+ -+ -+FT_END_HEADER -+ -+#endif /* __FTCONFIG_H__ */ -+ -+ -+/* END */ diff --git a/src/3rdparty/patches/freetype-2.3.6-ascii.patch b/src/3rdparty/patches/freetype-2.3.6-ascii.patch deleted file mode 100644 index cc46296..0000000 --- a/src/3rdparty/patches/freetype-2.3.6-ascii.patch +++ /dev/null @@ -1,174 +0,0 @@ ---- include/freetype/ftbbox.h.orig 2007-10-20 15:27:57.000000000 +0200 -+++ include/freetype/ftbbox.h 2008-06-15 00:00:00.000000000 +0200 -@@ -61,7 +61,7 @@ - /* Computes the exact bounding box of an outline. This is slower */ - /* than computing the control box. However, it uses an advanced */ - /* algorithm which returns _very_ quickly when the two boxes */ -- /* coincide. Otherwise, the outline Bézier arcs are traversed to */ -+ /* coincide. Otherwise, the outline Bezier arcs are traversed to */ - /* extract their extrema. */ - /* */ - /* */ ---- include/freetype/ftglyph.h.orig 2008-04-13 23:58:59.000000000 +0200 -+++ include/freetype/ftglyph.h 2008-06-15 00:00:00.000000000 +0200 -@@ -354,10 +354,10 @@ - /* */ - /* */ - /* Return a glyph's `control box'. The control box encloses all the */ -- /* outline's points, including Bézier control points. Though it */ -+ /* outline's points, including Bezier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ -- /* which contains Bézier outside arcs). */ -+ /* which contains Bezier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ ---- include/freetype/ftimage.h.orig 2008-05-31 08:46:38.000000000 +0200 -+++ include/freetype/ftimage.h 2008-06-15 00:00:00.000000000 +0200 -@@ -318,11 +318,11 @@ - /* */ - /* tags :: A pointer to an array of `n_points' chars, giving */ - /* each outline point's type. If bit 0 is unset, the */ -- /* point is `off' the curve, i.e., a Bézier control */ -+ /* point is `off' the curve, i.e., a Bezier control */ - /* point, while it is `on' when set. */ - /* */ - /* Bit 1 is meaningful for `off' points only. If set, */ -- /* it indicates a third-order Bézier arc control point; */ -+ /* it indicates a third-order Bezier arc control point; */ - /* and a second-order control point if unset. */ - /* */ - /* contours :: An array of `n_contours' shorts, giving the end */ -@@ -528,7 +528,7 @@ - /* A function pointer type use to describe the signature of a `conic */ - /* to' function during outline walking/decomposition. */ - /* */ -- /* A `conic to' is emitted to indicate a second-order Bézier arc in */ -+ /* A `conic to' is emitted to indicate a second-order Bezier arc in */ - /* the outline. */ - /* */ - /* */ -@@ -560,12 +560,12 @@ - /* A function pointer type used to describe the signature of a `cubic */ - /* to' function during outline walking/decomposition. */ - /* */ -- /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ -+ /* A `cubic to' is emitted to indicate a third-order Bezier arc. */ - /* */ - /* */ -- /* control1 :: A pointer to the first Bézier control point. */ -+ /* control1 :: A pointer to the first Bezier control point. */ - /* */ -- /* control2 :: A pointer to the second Bézier control point. */ -+ /* control2 :: A pointer to the second Bezier control point. */ - /* */ - /* to :: A pointer to the target end point. */ - /* */ -@@ -591,7 +591,7 @@ - /* */ - /* */ - /* A structure to hold various function pointers used during outline */ -- /* decomposition in order to emit segments, conic, and cubic Béziers, */ -+ /* decomposition in order to emit segments, conic, and cubic Beziers, */ - /* as well as `move to' and `close to' operations. */ - /* */ - /* */ -@@ -599,9 +599,9 @@ - /* */ - /* line_to :: The segment emitter. */ - /* */ -- /* conic_to :: The second-order Bézier arc emitter. */ -+ /* conic_to :: The second-order Bezier arc emitter. */ - /* */ -- /* cubic_to :: The third-order Bézier arc emitter. */ -+ /* cubic_to :: The third-order Bezier arc emitter. */ - /* */ - /* shift :: The shift that is applied to coordinates before they */ - /* are sent to the emitter. */ -@@ -698,7 +698,7 @@ - /* */ - /* FT_GLYPH_FORMAT_OUTLINE :: */ - /* The glyph image is a vectorial outline made of line segments */ -- /* and Bézier arcs; it can be described as an @FT_Outline; you */ -+ /* and Bezier arcs; it can be described as an @FT_Outline; you */ - /* generally want to access the `outline' field of the */ - /* @FT_GlyphSlotRec structure to read it. */ - /* */ ---- include/freetype/ftoutln.h.orig 2008-05-29 00:05:07.000000000 +0200 -+++ include/freetype/ftoutln.h 2008-06-15 00:00:00.000000000 +0200 -@@ -85,7 +85,7 @@ - /* */ - /* */ - /* Walks over an outline's structure to decompose it into individual */ -- /* segments and Bézier arcs. This function is also able to emit */ -+ /* segments and Bezier arcs. This function is also able to emit */ - /* `move to' and `close to' operations to indicate the start and end */ - /* of new contours in the outline. */ - /* */ -@@ -213,10 +213,10 @@ - /* */ - /* */ - /* Returns an outline's `control box'. The control box encloses all */ -- /* the outline's points, including Bézier control points. Though it */ -+ /* the outline's points, including Bezier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ -- /* which contains Bézier outside arcs). */ -+ /* which contains Bezier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ ---- include/freetype/ftstroke.h.orig 2008-05-29 00:06:54.000000000 +0200 -+++ include/freetype/ftstroke.h 2008-06-15 00:00:00.000000000 +0200 -@@ -407,7 +407,7 @@ - * FT_Stroker_ConicTo - * - * @description: -- * `Draw' a single quadratic Bézier in the stroker's current sub-path, -+ * `Draw' a single quadratic Bezier in the stroker's current sub-path, - * from the last position. - * - * @input: -@@ -415,7 +415,7 @@ - * The target stroker handle. - * - * control :: -- * A pointer to a Bézier control point. -+ * A pointer to a Bezier control point. - * - * to :: - * A pointer to the destination point. -@@ -439,7 +439,7 @@ - * FT_Stroker_CubicTo - * - * @description: -- * `Draw' a single cubic Bézier in the stroker's current sub-path, -+ * `Draw' a single cubic Bezier in the stroker's current sub-path, - * from the last position. - * - * @input: -@@ -447,10 +447,10 @@ - * The target stroker handle. - * - * control1 :: -- * A pointer to the first Bézier control point. -+ * A pointer to the first Bezier control point. - * - * control2 :: -- * A pointer to second Bézier control point. -+ * A pointer to second Bezier control point. - * - * to :: - * A pointer to the destination point. ---- include/freetype/ftwinfnt.h.orig 2008-05-28 23:27:19.000000000 +0200 -+++ include/freetype/ftwinfnt.h 2008-06-15 00:00:00.000000000 +0200 -@@ -77,7 +77,7 @@ - * Mac Roman encoding. - * - * FT_WinFNT_ID_OEM :: -- * From Michael Pöttgen : -+ * From Michael Poettgen : - * - * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM - * is used for the charset of vector fonts, like `modern.fon', diff --git a/src/3rdparty/patches/freetype-2.3.6-vxworks.patch b/src/3rdparty/patches/freetype-2.3.6-vxworks.patch deleted file mode 100644 index 21e884c..0000000 --- a/src/3rdparty/patches/freetype-2.3.6-vxworks.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git builds/unix/ftsystem.c builds/unix/ftsystem.c -index 3a740fd..40fa8d0 100644 ---- builds/unix/ftsystem.c -+++ builds/unix/ftsystem.c -@@ -69,6 +69,9 @@ - #include - #include - -+#ifdef VXWORKS -+#include -+#endif - - /*************************************************************************/ - /* */ -@@ -238,7 +241,7 @@ - return FT_Err_Invalid_Stream_Handle; - - /* open the file */ -- file = open( filepathname, O_RDONLY ); -+ file = open( filepathname, O_RDONLY, 0); - if ( file < 0 ) - { - FT_ERROR(( "FT_Stream_Open:" )); -@@ -317,7 +320,11 @@ - - - read_count = read( file, -+#ifndef VXWORKS - stream->base + total_read_count, -+#else -+ (char *) stream->base + total_read_count, -+#endif - stream->size - total_read_count ); - - if ( read_count <= 0 ) diff --git a/src/3rdparty/patches/libjpeg-6b-config.patch b/src/3rdparty/patches/libjpeg-6b-config.patch deleted file mode 100644 index 3012b8f..0000000 --- a/src/3rdparty/patches/libjpeg-6b-config.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- jconfig.h.orig 1970-01-01 01:00:00.000000000 +0100 -+++ jconfig.h 2006-06-15 00:00:00.000000000 +0200 -@@ -0,0 +1,47 @@ -+/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ -+/* see jconfig.doc for explanations */ -+ -+#define HAVE_PROTOTYPES -+#define HAVE_UNSIGNED_CHAR -+#define HAVE_UNSIGNED_SHORT -+/* #define void char */ -+/* #define const */ -+#undef CHAR_IS_UNSIGNED -+#define HAVE_STDDEF_H -+#define HAVE_STDLIB_H -+#undef NEED_BSD_STRINGS -+#undef NEED_SYS_TYPES_H -+#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ -+#undef NEED_SHORT_EXTERNAL_NAMES -+#undef INCOMPLETE_TYPES_BROKEN -+ -+#if defined(_WIN32) -+/* Define "boolean" as unsigned char, not int, per Windows custom */ -+#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ -+typedef unsigned char boolean; -+#endif -+#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ -+#endif -+ -+ -+#ifdef JPEG_INTERNALS -+ -+#undef RIGHT_SHIFT_IS_UNSIGNED -+ -+#endif /* JPEG_INTERNALS */ -+ -+#ifdef JPEG_CJPEG_DJPEG -+ -+#define BMP_SUPPORTED /* BMP image file format */ -+#define GIF_SUPPORTED /* GIF image file format */ -+#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -+#undef RLE_SUPPORTED /* Utah RLE image file format */ -+#define TARGA_SUPPORTED /* Targa image file format */ -+ -+#define TWO_FILE_COMMANDLINE /* optional */ -+#define USE_SETMODE /* Microsoft has setmode() */ -+#undef NEED_SIGNAL_CATCHER -+#undef DONT_USE_B_MODE -+#undef PROGRESS_REPORT /* optional */ -+ -+#endif /* JPEG_CJPEG_DJPEG */ diff --git a/src/3rdparty/patches/libjpeg-6b-vxworks.patch b/src/3rdparty/patches/libjpeg-6b-vxworks.patch deleted file mode 100644 index 263c8d0..0000000 --- a/src/3rdparty/patches/libjpeg-6b-vxworks.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git jmorecfg.h jmorecfg.h -index 54a7d1c..b0b5870 100644 ---- jmorecfg.h -+++ jmorecfg.h -@@ -157,7 +157,7 @@ typedef short INT16; - - /* INT32 must hold at least signed 32-bit values. */ - --#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ -+#if !defined(XMD_H) && !defined(VXWORKS) /* X11/xmd.h correctly defines INT32 */ - typedef long INT32; - #endif - -@@ -183,6 +183,9 @@ typedef unsigned int JDIMENSION; - /* a function called through method pointers: */ - #define METHODDEF(type) static type - /* a function used only in its module: */ -+#if defined(VXWORKS) && defined(LOCAL) -+# undef LOCAL -+#endif - #define LOCAL(type) static type - /* a function referenced thru EXTERNs: */ - #define GLOBAL(type) type diff --git a/src/3rdparty/patches/libpng-1.2.20-elf-visibility.patch b/src/3rdparty/patches/libpng-1.2.20-elf-visibility.patch deleted file mode 100644 index a374cbf..0000000 --- a/src/3rdparty/patches/libpng-1.2.20-elf-visibility.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- pngconf.h.orig 2007-09-08 05:22:56.000000000 +0200 -+++ pngconf.h 2007-09-09 00:00:00.000000000 +0200 -@@ -1375,6 +1375,14 @@ - # if 0 /* ... other platforms, with other meanings */ - # endif - # endif -+ -+# if !defined(PNG_IMPEXP) -+# include -+# if defined(QT_VISIBILITY_AVAILABLE) -+# define PNG_IMPEXP __attribute__((visibility("default"))) -+# endif -+# endif -+ - #endif - - #ifndef PNGAPI diff --git a/src/3rdparty/patches/libpng-1.2.20-vxworks.patch b/src/3rdparty/patches/libpng-1.2.20-vxworks.patch deleted file mode 100644 index 4c49b3f..0000000 --- a/src/3rdparty/patches/libpng-1.2.20-vxworks.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git pngconf.h pngconf.h -index 19e4732..8eb7d35 100644 ---- pngconf.h -+++ pngconf.h -@@ -344,7 +344,7 @@ - # endif /* __linux__ */ - #endif /* PNG_SETJMP_SUPPORTED */ - --#ifdef BSD -+#if defined(BSD) && !defined(VXWORKS) - # include - #else - # include diff --git a/src/3rdparty/patches/libtiff-3.8.2-config.patch b/src/3rdparty/patches/libtiff-3.8.2-config.patch deleted file mode 100644 index 44230ea..0000000 --- a/src/3rdparty/patches/libtiff-3.8.2-config.patch +++ /dev/null @@ -1,374 +0,0 @@ ---- libtiff/tif_config.h 1970-01-01 01:00:00.000000000 +0100 -+++ libtiff/tif_config.h 2008-05-25 00:00:00.000000000 +0200 -@@ -0,0 +1,296 @@ -+/* -+ Configuration defines by Trolltech. -+*/ -+ -+#include -+#if defined(Q_OS_WINCE) -+# include -+#endif -+ -+/* Support CCITT Group 3 & 4 algorithms */ -+#define CCITT_SUPPORT 1 -+ -+/* Pick up YCbCr subsampling info from the JPEG data stream to support files -+ lacking the tag (default enabled). */ -+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1 -+ -+/* Support C++ stream API (requires C++ compiler) */ -+/* #undef CXX_SUPPORT */ -+ -+/* Treat extra sample as alpha (default enabled). The RGBA interface will -+ treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many -+ packages produce RGBA files but don't mark the alpha properly. */ -+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 -+ -+/* Use the Apple OpenGL framework. */ -+/* #undef HAVE_APPLE_OPENGL_FRAMEWORK */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_ASSERT_H 1 -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_DLFCN_H */ -+ -+/* Define to 1 if you have the header file. */ -+#if !defined(Q_OS_WINCE) -+#define HAVE_FCNTL_H 1 -+#endif -+ -+/* Define to 1 if you have the `floor' function. */ -+/* #undef HAVE_FLOOR */ -+ -+/* Define to 1 if you have the `getopt' function. */ -+/* #undef HAVE_GETOPT */ -+ -+/* Define as 0 or 1 according to the floating point format suported by the -+ machine */ -+#define HAVE_IEEEFP 1 -+ -+/* Define to 1 if the system has the type `int16'. */ -+/* #undef HAVE_INT16 */ -+#ifdef Q_OS_AIX -+#define HAVE_INT16 1 -+#endif -+ -+/* Define to 1 if the system has the type `int32'. */ -+/* #undef HAVE_INT32 */ -+#ifdef Q_OS_AIX -+#define HAVE_INT32 1 -+#endif -+ -+/* Define to 1 if the system has the type `int8'. */ -+/* #undef HAVE_INT8 */ -+#ifdef Q_OS_AIX -+#define HAVE_INT8 1 -+#endif -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_INTTYPES_H */ -+ -+/* Define to 1 if you have the `isascii' function. */ -+/* #undef HAVE_ISASCII */ -+ -+/* Define to 1 if you have the `lfind' function. */ -+/* #undef HAVE_LFIND */ -+ -+/* Define to 1 if you have the `c' library (-lc). */ -+/* #undef HAVE_LIBC */ -+ -+/* Define to 1 if you have the `m' library (-lm). */ -+/* #undef HAVE_LIBM */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_LIMITS_H */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_MALLOC_H */ -+ -+/* Define to 1 if you have the `memmove' function. */ -+/* #undef HAVE_MEMMOVE */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_MEMORY_H */ -+ -+/* Define to 1 if you have the `memset' function. */ -+/* #undef HAVE_MEMSET */ -+ -+/* Define to 1 if you have the `mmap' function. */ -+/* #undef HAVE_MMAP */ -+ -+/* Define to 1 if you have the `pow' function. */ -+/* #undef HAVE_POW */ -+ -+/* Define if you have POSIX threads libraries and header files. */ -+/* #undef HAVE_PTHREAD */ -+ -+/* Define to 1 if you have the header file. */ -+#if !defined(Q_OS_WINCE) -+#define HAVE_SEARCH_H 1 -+#endif -+ -+/* Define to 1 if you have the `sqrt' function. */ -+/* #undef HAVE_SQRT */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_STDINT_H */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_STDLIB_H */ -+ -+/* Define to 1 if you have the `strcasecmp' function. */ -+/* #undef HAVE_STRCASECMP */ -+ -+/* Define to 1 if you have the `strchr' function. */ -+/* #undef HAVE_STRCHR */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_STRINGS_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_STRING_H 1 -+ -+/* Define to 1 if you have the `strrchr' function. */ -+/* #undef HAVE_STRRCHR */ -+ -+/* Define to 1 if you have the `strstr' function. */ -+/* #undef HAVE_STRSTR */ -+ -+/* Define to 1 if you have the `strtol' function. */ -+/* #undef HAVE_STRTOL */ -+ -+/* Define to 1 if you have the `strtoul' function. */ -+/* #undef HAVE_STRTOUL */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_SYS_STAT_H */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_SYS_TIME_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_SYS_TYPES_H 1 -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_UNISTD_H 1 -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_WINDOWS_H */ -+#ifdef Q_OS_WIN -+#define TIF_PLATFORM_CONSOLE -+#endif -+ -+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian -+ (Intel) */ -+#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) -+#define HOST_BIGENDIAN 1 -+#else -+#define HOST_BIGENDIAN 0 -+#endif -+ -+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ -+#define HOST_FILLORDER FILLORDER_LSB2MSB -+ -+/* Support JPEG compression (requires IJG JPEG library) */ -+/* #undef JPEG_SUPPORT */ -+ -+/* Support LogLuv high dynamic range encoding */ -+#define LOGLUV_SUPPORT 1 -+ -+/* Define to the sub-directory in which libtool stores uninstalled libraries. -+ */ -+/* #undef LT_OBJDIR */ -+ -+/* Support LZW algorithm */ -+#define LZW_SUPPORT 1 -+ -+/* Support Microsoft Document Imaging format */ -+#define MDI_SUPPORT 1 -+ -+/* Support NeXT 2-bit RLE algorithm */ -+#define NEXT_SUPPORT 1 -+ -+/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -+/* #undef NO_MINUS_C_MINUS_O */ -+ -+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation -+ fails with unpatched IJG JPEG library) */ -+/* #undef OJPEG_SUPPORT */ -+ -+/* Name of package */ -+/* #undef PACKAGE */ -+ -+/* Define to the address where bug reports for this package should be sent. */ -+/* #undef PACKAGE_BUGREPORT */ -+ -+/* Define to the full name of this package. */ -+/* #undef PACKAGE_NAME */ -+ -+/* Define to the full name and version of this package. */ -+/* #undef PACKAGE_STRING */ -+ -+/* Define to the one symbol short name of this package. */ -+/* #undef PACKAGE_TARNAME */ -+ -+/* Define to the version of this package. */ -+/* #undef PACKAGE_VERSION */ -+ -+/* Support Macintosh PackBits algorithm */ -+#define PACKBITS_SUPPORT 1 -+ -+/* Support Pixar log-format algorithm (requires Zlib) */ -+#define PIXARLOG_SUPPORT 1 -+ -+/* Define to necessary symbol if this constant uses a non-standard name on -+ your system. */ -+/* #undef PTHREAD_CREATE_JOINABLE */ -+ -+/* The size of a `int', as computed by sizeof. */ -+#define SIZEOF_INT 4 -+ -+/* The size of a `long', as computed by sizeof. */ -+#if (QT_POINTER_SIZE == 8) && !defined(Q_OS_WIN64) -+#define SIZEOF_LONG 8 -+#else -+#define SIZEOF_LONG 4 -+#endif -+ -+/* Define to 1 if you have the ANSI C header files. */ -+/* #undef STDC_HEADERS */ -+ -+/* Support strip chopping (whether or not to convert single-strip uncompressed -+ images to mutiple strips of specified size to reduce memory usage) */ -+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP -+ -+/* Default size of the strip in bytes (when strip chopping enabled) */ -+/* #undef STRIP_SIZE_DEFAULT */ -+ -+/* Enable SubIFD tag (330) support */ -+#define SUBIFD_SUPPORT 1 -+ -+/* Support ThunderScan 4-bit RLE algorithm */ -+#define THUNDER_SUPPORT 1 -+ -+/* Define to 1 if you can safely include both and . */ -+/* #undef TIME_WITH_SYS_TIME */ -+ -+/* Define to 1 if your declares `struct tm'. */ -+/* #undef TM_IN_SYS_TIME */ -+ -+/* Version number of package */ -+/* #undef VERSION */ -+ -+/* Define to 1 if your processor stores words with the most significant byte -+ first (like Motorola and SPARC, unlike Intel and VAX). */ -+#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) -+#define WORDS_BIGENDIAN 1 -+#else -+/* #undef WORDS_BIGENDIAN */ -+#endif -+ -+/* Define to 1 if the X Window System is missing or not being used. */ -+/* #undef X_DISPLAY_MISSING */ -+ -+/* Support Deflate compression */ -+#define ZIP_SUPPORT 1 -+ -+/* Number of bits in a file offset, on hosts where this is settable. */ -+/* #undef _FILE_OFFSET_BITS */ -+ -+/* Define for large files, on AIX-style hosts. */ -+/* #undef _LARGE_FILES */ -+ -+/* Define to empty if `const' does not conform to ANSI C. */ -+/* #undef const */ -+ -+/* Define to `__inline__' or `__inline' if that's what the C compiler -+ calls it, or to nothing if 'inline' is not supported under any name. */ -+#ifndef __cplusplus -+#undef inline -+#define inline -+#endif -+ -+/* Define to `long' if does not define. */ -+/* #undef off_t */ -+ -+/* Define to `unsigned' if does not define. */ -+/* #undef size_t */ ---- libtiff/tiffconf.h 2006-03-23 15:55:22.000000000 +0100 -+++ libtiff/tiffconf.h 2008-05-25 00:00:00.000000000 +0200 -@@ -1,6 +1,5 @@ --/* libtiff/tiffconf.h. Generated by configure. */ - /* -- Configuration defines for installed libtiff. -+ Configuration defines by Trolltech. - This file maintained for backward compatibility. Do not use definitions - from this file in your programs. - */ -@@ -8,6 +7,8 @@ - #ifndef _TIFFCONF_ - #define _TIFFCONF_ - -+#include -+ - /* Define to 1 if the system has the type `int16'. */ - /* #undef HAVE_INT16 */ - -@@ -21,7 +22,11 @@ - #define SIZEOF_INT 4 - - /* The size of a `long', as computed by sizeof. */ -+#if (QT_POINTER_SIZE == 8) && !defined(Q_OS_WIN64) -+#define SIZEOF_LONG 8 -+#else - #define SIZEOF_LONG 4 -+#endif - - /* Compatibility stuff. */ - -@@ -34,13 +39,17 @@ - - /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian - (Intel) */ -+#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) -+#define HOST_BIGENDIAN 1 -+#else - #define HOST_BIGENDIAN 0 -+#endif - - /* Support CCITT Group 3 & 4 algorithms */ - #define CCITT_SUPPORT 1 - - /* Support JPEG compression (requires IJG JPEG library) */ --#define JPEG_SUPPORT 1 -+/* #undef JPEG_SUPPORT */ - - /* Support LogLuv high dynamic range encoding */ - #define LOGLUV_SUPPORT 1 ---- libtiff/tiffiop.h 2006-03-21 17:42:50.000000000 +0100 -+++ libtiff/tiffiop.h 2008-05-25 00:00:00.000000000 +0200 -@@ -37,7 +37,12 @@ - #endif - - #ifdef HAVE_SYS_TYPES_H -+#if !defined(Q_OS_WINCE) - # include -+#else -+# include -+# include -+#endif - #endif - - #ifdef HAVE_STRING_H ---- libtiff/tif_win32.c 2006-02-07 14:51:03.000000000 +0100 -+++ libtiff/tif_win32.c 2008-05-25 00:00:00.000000000 +0200 -@@ -29,6 +29,7 @@ - * Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA - */ - #include "tiffiop.h" -+#include - - static tsize_t - _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) diff --git a/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch b/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch deleted file mode 100644 index b1b725e..0000000 --- a/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libtiff/tif_config.h.orig -+++ libtiff/tif_config.h -@@ -104,7 +104,7 @@ - /* #undef HAVE_PTHREAD */ - - /* Define to 1 if you have the header file. */ --#if !defined(Q_OS_WINCE) -+#if !defined(Q_OS_WINCE) && !defined(Q_OS_VXWORKS) - #define HAVE_SEARCH_H 1 - #endif - diff --git a/src/3rdparty/patches/sqlite-3.5.6-config.patch b/src/3rdparty/patches/sqlite-3.5.6-config.patch deleted file mode 100644 index cf158ea..0000000 --- a/src/3rdparty/patches/sqlite-3.5.6-config.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- sqlite3.c.orig 2008-02-06 16:03:28.000000000 +0100 -+++ sqlite3.c 2008-02-13 00:00:00.000000000 +0100 -@@ -16823,6 +16823,8 @@ - */ - #if OS_UNIX /* This file is used on unix only */ - -+#include -+ - /* #define SQLITE_ENABLE_LOCKING_STYLE 0 */ - - /* -@@ -16865,7 +16867,7 @@ - ** If we are to be thread-safe, include the pthreads header and define - ** the SQLITE_UNIX_THREADS macro. - */ --#if SQLITE_THREADSAFE -+#ifndef QT_NO_THREAD - # define SQLITE_UNIX_THREADS 1 - #endif - -@@ -19739,6 +19741,8 @@ - ** desktops but not so well in embedded systems. - */ - -+#include -+ - #include - - #ifdef __CYGWIN__ -@@ -19748,7 +19752,7 @@ - /* - ** Macros used to determine whether or not to use threads. - */ --#if defined(THREADSAFE) && THREADSAFE -+#ifndef QT_NO_THREAD - # define SQLITE_W32_THREADS 1 - #endif - diff --git a/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch b/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch deleted file mode 100644 index 6ae65fd..0000000 --- a/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- sqlite3.c.orig -+++ sqlite3.c -@@ -383,7 +383,7 @@ SQLITE_PRIVATE void sqlite3Coverage(int); - ** - ** See also ticket #2741. - */ --#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE -+#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE && !defined(VXWORKS) - # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ - #endif - -@@ -440,6 +440,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int); - */ - #ifndef _SQLITE3_H_ - #define _SQLITE3_H_ -+ -+#ifdef VXWORKS -+# define SQLITE_HOMEGROWN_RECURSIVE_MUTEX -+# define NO_GETTOD -+# include -+#endif -+ - #include /* Needed for the definition of va_list */ - - /* -@@ -18792,7 +18799,11 @@ SQLITE_PRIVATE sqlite3_vfs *sqlite3OsDefaultVfs(void){ - #include - #include - #include --#include -+#ifdef VXWORKS -+# include -+#else -+# include -+#endif - #include - #ifdef SQLITE_ENABLE_LOCKING_STYLE - #include -@@ -19728,7 +19739,11 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){ - if( newOffset!=offset ){ - return -1; - } -+# ifndef VXWORKS - got = write(id->h, pBuf, cnt); -+# else -+ got = write(id->h, (char *)pBuf, cnt); -+# endif - #endif - TIMER_END; - OSTRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, offset, TIMER_ELAPSED); -@@ -21554,12 +21569,16 @@ static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ - #if !defined(SQLITE_TEST) - { - int pid, fd; -- fd = open("/dev/urandom", O_RDONLY); -+ fd = open("/dev/urandom", O_RDONLY, 0); - if( fd<0 ){ - time_t t; - time(&t); - memcpy(zBuf, &t, sizeof(t)); -+#ifndef VXWORKS - pid = getpid(); -+#else -+ pid = (int)taskIdCurrent(); -+#endif - memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); - }else{ - read(fd, zBuf, nBuf); diff --git a/src/3rdparty/patches/sqlite-3.5.6-wince.patch b/src/3rdparty/patches/sqlite-3.5.6-wince.patch deleted file mode 100644 index 02965f8..0000000 --- a/src/3rdparty/patches/sqlite-3.5.6-wince.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- sqlite3.c.orig 2008-02-06 16:03:28.000000000 +0100 -+++ sqlite3.c 2008-02-13 00:00:00.000000000 +0100 -@@ -8837,6 +8837,16 @@ - } - - /* -+** Windows CE does not declare the localtime -+** function as it is not defined anywhere. -+** Anyway we need the forward-declaration to be -+** able to define it later on. -+*/ -+#if defined(_WIN32_WCE) && (_WIN32_WCE >= 0x600) -+struct tm *__cdecl localtime(const time_t *t); -+#endif -+ -+/* - ** Compute the difference (in days) between localtime and UTC (a.k.a. GMT) - ** for the time value p where p is in UTC. - */ -- cgit v0.12 From 3335721dcf72cda957ba0e507608d795cab3f1ab Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 3 Mar 2010 12:45:14 +0100 Subject: Fix focus behavior bug on Mac OS X. With the Full Access Keyboard enabled, the focus could sometimes be stolen by the window. --- src/gui/kernel/qcocoaview_mac.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index a1dcc2a..f7cb21f 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1028,7 +1028,10 @@ static int qCocoaViewCount = 0; { if (!qwidget) return NO; - if (qwidget->isWindow()) + // Before accepting the focus for a window, we check that + // the focusWidget (if any) is not contained in the same window. + if (qwidget->isWindow() && (!qApp->focusWidget() + || qApp->focusWidget()->window() != qwidget)) return YES; // Always do it, so that windows can accept key press events. return qwidget->focusPolicy() != Qt::NoFocus; } -- cgit v0.12 From 66586707ae875bd1caa802fd7ca88a29727396e5 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 3 Mar 2010 13:51:35 +0100 Subject: Stabilize QWidget Fix for some corner cases observed on Maemo 5 Reviewed-by: Robert Griebl --- src/gui/kernel/qwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index b19d541..7fdee2b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1122,7 +1122,8 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) qFatal("QWidget: Cannot create a QWidget when no GUI is being used"); Q_ASSERT(allWidgets); - allWidgets->insert(q); + if (allWidgets) + allWidgets->insert(q); QWidget *desktopWidget = 0; if (parentWidget && parentWidget->windowType() == Qt::Desktop) { @@ -6500,7 +6501,7 @@ void QWidget::setTabOrder(QWidget* first, QWidget *second) // QWidget *fp = first->d_func()->focus_prev; QWidget *fn = first->d_func()->focus_next; - if (fn == second) + if (fn == second || first == second) return; QWidget *sp = second->d_func()->focus_prev; -- cgit v0.12 From af430b618a196a45e45c87afca446d60b4a3552d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 3 Mar 2010 13:29:29 +0100 Subject: Don't print a warning when passing an empty string to QColor Qt 4.6 didn't used to warn about this, and it should be a valid way of setting a color to invalid. QColor::isValidColor has been adapted to still return false when passed an empty string. Reviewed-by: Erik Verbruggen --- src/gui/painting/qcolor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 0b735a2..cd448a7 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -548,14 +548,14 @@ void QColor::setNamedColor(const QString &name) */ bool QColor::isValidColor(const QString &name) { - return QColor().setColorFromString(name); + return !name.isEmpty() && QColor().setColorFromString(name); } bool QColor::setColorFromString(const QString &name) { if (name.isEmpty()) { invalidate(); - return false; + return true; } if (name.startsWith(QLatin1Char('#'))) { -- cgit v0.12 From 69acbc34d5413e1e7642f1d533e39a8f0137051b Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 3 Mar 2010 14:36:31 +0100 Subject: fix include --- src/gui/widgets/qlabel_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h index 21eb128..fba7224 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/gui/widgets/qlabel_p.h @@ -55,7 +55,7 @@ #include "qlabel.h" -#include "../text/qtextdocumentlayout_p.h" +#include "private/qtextdocumentlayout_p.h" #include "private/qtextcontrol_p.h" #include "qtextdocumentfragment.h" #include "qframe_p.h" -- cgit v0.12 From 6f07f0a2b9df84302348e290f22de13514f81d50 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 3 Mar 2010 14:48:37 +0100 Subject: test qlist some more --- tests/auto/qlist/tst_qlist.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp index a590fca..e2944cc 100644 --- a/tests/auto/qlist/tst_qlist.cpp +++ b/tests/auto/qlist/tst_qlist.cpp @@ -60,6 +60,7 @@ private slots: void length() const; void lengthSignature() const; void append() const; + void prepend() const; void mid() const; }; @@ -130,6 +131,39 @@ void tst_QList::append() const } +void tst_QList::prepend() const +{ + QList list; + QString *str1 = new QString; + list.prepend(str1); + QVERIFY(list.size() == 1); + QVERIFY(list.at(0) == str1); + QString *str2 = new QString; + list.prepend(str2); + QVERIFY(list.size() == 2); + QVERIFY(list.at(0) == str2); + QVERIFY(list.at(1) == str1); + QString *str3 = new QString; + list.prepend(str3); + QVERIFY(list.size() == 3); + QVERIFY(list.at(0) == str3); + QVERIFY(list.at(1) == str2); + QVERIFY(list.at(2) == str1); + list.removeAll(str2); + delete str2; + QVERIFY(list.size() == 2); + QVERIFY(list.at(0) == str3); + QVERIFY(list.at(1) == str1); + QString *str4 = new QString; + list.prepend(str4); + QVERIFY(list.size() == 3); + QVERIFY(list.at(0) == str4); + QVERIFY(list.at(1) == str3); + QVERIFY(list.at(2) == str1); + qDeleteAll(list); + list.clear(); +} + void tst_QList::mid() const { QList list; -- cgit v0.12 From a1b0dba9971ef88dc1e079d1ea49230a4dd3c514 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 3 Mar 2010 14:48:27 +0100 Subject: fix qmake -project mode the mode is a big hack, and consequently needs hacks to get started as well ... Reviewed-by: mariusSO --- qmake/option.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/qmake/option.cpp b/qmake/option.cpp index 6f0f46b..b41e39d 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -525,6 +525,17 @@ Option::init(int argc, char **argv) } #endif } + } else if (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { +#if defined(Q_OS_MAC) + Option::host_mode = Option::HOST_MACX_MODE; + Option::target_mode = Option::TARG_MACX_MODE; +#elif defined(Q_OS_UNIX) + Option::host_mode = Option::HOST_UNIX_MODE; + Option::target_mode = Option::TARG_UNIX_MODE; +#else + Option::host_mode = Option::HOST_WIN_MODE; + Option::target_mode = Option::TARG_WIN_MODE; +#endif } //defaults for globals -- cgit v0.12 From 515f6a8c3dbe382bbb4f84f758a61c719143d8a6 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 3 Mar 2010 14:53:16 +0100 Subject: sizeHint of checkbox/radiobutton without text is not correct Reviewed-by: Jens Bache-Wiig --- src/gui/styles/qcommonstyle.cpp | 2 +- src/gui/widgets/qcheckbox.cpp | 2 +- src/gui/widgets/qradiobutton.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index f8464cc..b0e2d37 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -4760,7 +4760,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, int margins = 0; // we add 4 pixels for label margins - if (btn->icon.isNull() || !btn->text.isEmpty()) + if (!btn->icon.isNull() || !btn->text.isEmpty()) margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, opt, widget); sz += QSize(w + margins, 4); diff --git a/src/gui/widgets/qcheckbox.cpp b/src/gui/widgets/qcheckbox.cpp index 4e0ff66..bc0900e 100644 --- a/src/gui/widgets/qcheckbox.cpp +++ b/src/gui/widgets/qcheckbox.cpp @@ -291,7 +291,7 @@ QSize QCheckBox::sizeHint() const QFontMetrics fm = fontMetrics(); QStyleOptionButton opt; initStyleOption(&opt); - QSize sz = style()->itemTextRect(fm, QRect(0, 0, 1, 1), Qt::TextShowMnemonic, false, + QSize sz = style()->itemTextRect(fm, QRect(), Qt::TextShowMnemonic, false, text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); diff --git a/src/gui/widgets/qradiobutton.cpp b/src/gui/widgets/qradiobutton.cpp index d73ff2f..20b6c720 100644 --- a/src/gui/widgets/qradiobutton.cpp +++ b/src/gui/widgets/qradiobutton.cpp @@ -195,7 +195,7 @@ QSize QRadioButton::sizeHint() const ensurePolished(); QStyleOptionButton opt; initStyleOption(&opt); - QSize sz = style()->itemTextRect(fontMetrics(), QRect(0, 0, 1, 1), Qt::TextShowMnemonic, + QSize sz = style()->itemTextRect(fontMetrics(), QRect(), Qt::TextShowMnemonic, false, text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); -- cgit v0.12 From 5d1735d6cf1820107145e7fdfe41ac502d0020f9 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 29 Jan 2010 16:06:06 +0100 Subject: Optimize QGtkStyle Use latin1 literals instead of QString to prevent one malloc/memcpy/free per rendered table cell. Reviewed-By: Robert Griebl --- src/gui/styles/qgtkpainter.cpp | 2 +- src/gui/styles/qgtkstyle.cpp | 203 +++++++++++++++++++++++------------------ src/gui/styles/qgtkstyle_p.cpp | 103 +++++++++++++++------ src/gui/styles/qgtkstyle_p.h | 73 +++++++++++++-- 4 files changed, 252 insertions(+), 129 deletions(-) diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp index 6cc7455..1f68f2f 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/gui/styles/qgtkpainter.cpp @@ -142,7 +142,7 @@ QPixmap QGtkPainter::renderTheme(uchar *bdata, uchar *wdata, const QRect &rect) } QGtkPainter::QGtkPainter(QPainter *_painter) - : m_window(QGtkStylePrivate::gtkWidget(QLatin1String("GtkWindow"))) + : m_window(QGtkStylePrivate::gtkWidget("GtkWindow")) , m_painter(_painter) , m_alpha(true) , m_hflipped(false) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index b5f052b..e2de43a 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -222,7 +222,7 @@ QPalette QGtkStyle::standardPalette() const QPalette palette = QCleanlooksStyle::standardPalette(); if (d->isThemeAvailable()) { GtkStyle *style = d->gtkStyle(); - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkButton"); GtkWidget *gtkEntry = d->getTextColorWidget(); GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg; @@ -253,7 +253,7 @@ QPalette QGtkStyle::standardPalette() const palette.setColor(QPalette::Base, base); QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box - GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView")); + GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); GdkColor *gtkAltBase = NULL; d->gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); if (gtkAltBase) { @@ -421,14 +421,14 @@ int QGtkStyle::pixelMetric(PixelMetric metric, return 0; case PM_ButtonShiftHorizontal: { - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkButton"); guint horizontal_shift; d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); return horizontal_shift; } case PM_ButtonShiftVertical: { - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkButton"); guint vertical_shift; d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); return vertical_shift; @@ -438,7 +438,7 @@ int QGtkStyle::pixelMetric(PixelMetric metric, return 0; case PM_MenuPanelWidth: { - GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu")); + GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); guint horizontal_padding = 0; // horizontal-padding is used by Maemo to get thicker borders if (!d->gtk_check_version(2, 10, 0)) @@ -495,7 +495,7 @@ int QGtkStyle::pixelMetric(PixelMetric metric, case PM_SliderThickness: case PM_SliderControlThickness: { - GtkWidget *gtkScale = d->gtkWidget(QLS("GtkHScale")); + GtkWidget *gtkScale = d->gtkWidget("GtkHScale"); gint val; d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); if (metric == PM_SliderControlThickness) @@ -506,7 +506,7 @@ int QGtkStyle::pixelMetric(PixelMetric metric, case PM_ScrollBarExtent: { gint sliderLength; gint trough_border; - GtkWidget *hScrollbar = d->gtkWidget(QLS("GtkHScrollbar")); + GtkWidget *hScrollbar = d->gtkWidget("GtkHScrollbar"); d->gtk_widget_style_get(hScrollbar, "trough-border", &trough_border, "slider-width", &sliderLength, @@ -519,34 +519,34 @@ int QGtkStyle::pixelMetric(PixelMetric metric, case PM_SliderLength: gint val; - d->gtk_widget_style_get(d->gtkWidget(QLS("GtkHScale")), "slider-length", &val, NULL); + d->gtk_widget_style_get(d->gtkWidget("GtkHScale"), "slider-length", &val, NULL); return val; case PM_ExclusiveIndicatorWidth: case PM_ExclusiveIndicatorHeight: case PM_IndicatorWidth: case PM_IndicatorHeight: { - GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); gint size, spacing; d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); return size + 2 * spacing; } case PM_MenuBarVMargin: { - GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); return qMax(0, gtkMenubar->style->ythickness); } case PM_ScrollView_ScrollBarSpacing: { gint spacing = 3; - GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow")); + GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); Q_ASSERT(gtkScrollWindow); d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); return spacing; } case PM_SubMenuOverlap: { gint offset = 0; - GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu")); + GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); return offset; } @@ -587,7 +587,7 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg { if (d->isKDE4Session()) return QCleanlooksStyle::styleHint(hint, option, widget, returnData); - GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar")); + GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS; g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL); switch (toolbar_style) { @@ -610,7 +610,7 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg return int(false); case SH_ComboBox_Popup: { - GtkWidget *gtkComboBox = d->gtkWidget(QLS("GtkComboBox")); + GtkWidget *gtkComboBox = d->gtkWidget("GtkComboBox"); gboolean appears_as_list; d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); return appears_as_list ? 0 : 1; @@ -634,7 +634,7 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg if (widget && widget->isWindow()) scrollbars_within_bevel = true; else if (!d->gtk_check_version(2, 12, 0)) { - GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow")); + GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); } return !scrollbars_within_bevel; @@ -712,7 +712,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, GtkStyle *style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type()); if (style) - gtkFramePainter.paintShadow(d->gtkWidget(QLS("GtkFrame")), "viewport", pmRect, + gtkFramePainter.paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, shadow_type, style); QPixmapCache::insert(pmKey, pixmap); @@ -739,7 +739,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_PanelTipLabel: { - GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed + GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", d->gtk_window_get_type()); gtkPainter.paintFlatBox(gtkWindow, "tooltip", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, style); @@ -754,7 +754,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; } GtkShadowType shadow_type; - GtkWidget *gtkStatusbarFrame = d->gtkWidget(QLS("GtkStatusbar.GtkFrame")); + GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame"); d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL); gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL, shadow_type, gtkStatusbarFrame->style); @@ -763,7 +763,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_IndicatorHeaderArrow: if (const QStyleOptionHeader *header = qstyleoption_cast(option)) { - GtkWidget *gtkTreeHeader = d->gtkWidget(QLS("GtkTreeView.GtkButton")); + GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton"); GtkStateType state = gtkPainter.gtkState(option); style = gtkTreeHeader->style; GtkArrowType type = GTK_ARROW_UP; @@ -801,7 +801,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, rect.translate(2, 0); GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED; GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED; - GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView")); + GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); GtkStateType state = GTK_STATE_NORMAL; if (!(option->state & State_Enabled)) @@ -837,7 +837,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_IndicatorToolBarSeparator: { const int margin = 6; - GtkWidget *gtkSeparator = d->gtkWidget(QLS("GtkToolbar.GtkSeparatorToolItem")); + GtkWidget *gtkSeparator = d->gtkWidget("GtkToolbar.GtkSeparatorToolItem"); if (option->state & State_Horizontal) { const int offset = option->rect.width()/2; QRect rect = option->rect.adjusted(offset, margin, 0, -margin); @@ -857,7 +857,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_IndicatorToolBarHandle: { - GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar")); + GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); GtkShadowType shadow_type; d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); //Note when the toolbar is horizontal, the handle is vertical @@ -905,7 +905,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, GtkStateType state = gtkPainter.gtkState(option); QColor arrowColor = option->palette.buttonText().color(); - GtkWidget *gtkArrow = d->gtkWidget(QLS("GtkArrow")); + GtkWidget *gtkArrow = d->gtkWidget("GtkArrow"); GdkColor color = fromQColor(arrowColor); d->gtk_widget_modify_fg (gtkArrow, state, &color); gtkPainter.paintArrow(gtkArrow, "button", arrowRect, @@ -921,7 +921,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_PanelMenu: { - GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu")); + GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString()); } @@ -933,7 +933,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, // This is only used by floating tool bars if (qobject_cast(widget)) { - GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); gtkPainter.paintBox( gtkMenubar, "toolbar", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style); gtkPainter.paintBox( gtkMenubar, "menu", option->rect, @@ -942,7 +942,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, break; case PE_FrameLineEdit: { - GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry")); + GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); gboolean interior_focus; @@ -976,7 +976,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_PanelLineEdit: if (const QStyleOptionFrame *panel = qstyleoption_cast(option)) { - GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry")); + GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); if (panel->lineWidth > 0) proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); uint resolve_mask = option->palette.resolve(); @@ -994,7 +994,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast(option)) { - GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook")); + GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); style = gtkPainter.getStyle(gtkNotebook); gtkPainter.setAlphaSupport(false); GtkShadowType shadow = GTK_SHADOW_OUT; @@ -1042,7 +1042,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, GtkStateType state = gtkPainter.gtkState(option); if (option->state & State_On || option->state & State_Sunken) state = GTK_STATE_ACTIVE; - GtkWidget *gtkButton = d->gtkWidget(isTool ? QLS("GtkToolButton.GtkButton") : QLS("GtkButton")); + GtkWidget *gtkButton = isTool ? d->gtkWidget("GtkToolButton.GtkButton") : d->gtkWidget("GtkButton"); gint focusWidth, focusPad; gboolean interiorFocus = false; d->gtk_widget_style_get (gtkButton, @@ -1098,14 +1098,14 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, else shadow = GTK_SHADOW_OUT; - GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton")); + GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); gint spacing; d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); QRect buttonRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); gtkPainter.setClipRect(option->rect); // ### Note: Ubuntulooks breaks when the proper widget is passed // Murrine engine requires a widget not to get RGBA check - warnings - GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); QString key(QLS("radiobutton")); if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag key += QLatin1Char('f'); @@ -1133,7 +1133,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, int spacing; - GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); QString key(QLS("checkbutton")); if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag key += QLatin1Char('f'); @@ -1275,7 +1275,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { // Draw prelight background - GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); + GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); if (option->state & State_MouseOver) { QRect bgRect = textRect | checkBoxRect; @@ -1348,7 +1348,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ? GTK_SHADOW_IN : GTK_SHADOW_OUT; - QString comboBoxPath = QLS(comboBox->editable ? "GtkComboBoxEntry" : "GtkComboBox"); + const QHashableLatin1Literal comboBoxPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox"); // We use the gtk widget to position arrows and separators for us GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath); @@ -1356,7 +1356,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); d->gtk_widget_size_allocate(gtkCombo, &geometry); - QString buttonPath = comboBoxPath + QLS(".GtkToggleButton"); + QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") + : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath); d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); if (gtkToggleButton && (appears_as_list || comboBox->editable)) { @@ -1365,7 +1366,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom // Draw the combo box as a line edit with a button next to it if (comboBox->editable || appears_as_list) { GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state; - QString entryPath = QLS(comboBox->editable ? "GtkComboBoxEntry.GtkEntry" : "GtkComboBox.GtkFrame"); + QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame"); GtkWidget *gtkEntry = d->gtkWidget(entryPath); d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); QRect frameRect = option->rect; @@ -1391,11 +1392,11 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else { gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, - GTK_SHADOW_NONE, gtkEntry->style, entryPath + QString::number(focus)); + GTK_SHADOW_NONE, gtkEntry->style, entryPath.toString() + QString::number(focus)); } gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState, - GTK_SHADOW_IN, gtkEntry->style, entryPath + + GTK_SHADOW_IN, gtkEntry->style, entryPath.toString() + QString::number(focus) + QString::number(comboBox->editable) + QString::number(option->direction)); if (focus) @@ -1416,7 +1417,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom Q_ASSERT(gtkToggleButton); gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState, - shadow, gtkToggleButton->style, buttonPath + + shadow, gtkToggleButton->style, buttonPath.toString() + QString::number(focus) + QString::number(option->direction)); if (focus) GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); @@ -1429,12 +1430,17 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gtkCachedPainter.paintBox(gtkToggleButton, "button", buttonRect, state, shadow, gtkToggleButton->style, - buttonPath + QString::number(focus)); + buttonPath.toString() + QString::number(focus)); if (focus) GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); + QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") + : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); + // Draw the separator between label and arrows - QString vSeparatorPath = buttonPath + QLS(".GtkHBox.GtkVSeparator"); + QHashableLatin1Literal vSeparatorPath = comboBox->editable + ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkVSeparator") + : QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator"); if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) { QRect vLineRect(gtkVSeparator->allocation.x, @@ -1444,7 +1450,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gtkCachedPainter.paintVline( gtkVSeparator, "vseparator", vLineRect, state, gtkVSeparator->style, - 0, vLineRect.height(), 0, vSeparatorPath); + 0, vLineRect.height(), 0, vSeparatorPath.toString()); gint interiorFocus = true; @@ -1469,8 +1475,18 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else state = GTK_STATE_NORMAL; - QString arrowPath = comboBoxPath + QLS(appears_as_list ? ".GtkToggleButton.GtkArrow" - : ".GtkToggleButton.GtkHBox.GtkArrow"); + QHashableLatin1Literal arrowPath(""); + if (comboBox->editable) { + if (appears_as_list) + arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkArrow"); + else + arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkArrow"); + } else { + if (appears_as_list) + arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkArrow"); + else + arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"); + } GtkWidget *gtkArrow = d->gtkWidget(arrowPath); gfloat scale = 0.7; @@ -1497,7 +1513,11 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (sunken) { int xoff, yoff; - GtkWidget *gtkButton = d->gtkWidget(comboBoxPath + QLS(".GtkToggleButton")); + const QHashableLatin1Literal toggleButtonPath = comboBox->editable + ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") + : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); + + GtkWidget *gtkButton = d->gtkWidget(toggleButtonPath); d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); arrowRect = arrowRect.adjusted(xoff, yoff, xoff, yoff); @@ -1509,7 +1529,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gtkCachedPainter.setClipRect(option->rect); gtkCachedPainter.paintArrow( gtkArrow, "arrow", arrowRect, GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, TRUE, - style, arrowPath + QString::number(option->direction)); + style, arrowPath.toString() + QString::number(option->direction)); } } END_STYLE_PIXMAPCACHE; @@ -1570,7 +1590,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QStyleOptionToolButton label = *toolbutton; label.state = bflags; - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); QPalette pal = toolbutton->palette; if (option->state & State_Enabled && option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) { @@ -1605,8 +1625,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_ScrollBar: if (const QStyleOptionSlider *scrollBar = qstyleoption_cast(option)) { - GtkWidget *gtkHScrollBar = d->gtkWidget(QLS("GtkHScrollbar")); - GtkWidget *gtkVScrollBar = d->gtkWidget(QLS("GtkVScrollbar")); + GtkWidget *gtkHScrollBar = d->gtkWidget("GtkHScrollbar"); + GtkWidget *gtkVScrollBar = d->gtkWidget("GtkVScrollbar"); // Fill background in case the scrollbar is partially transparent painter->fillRect(option->rect, option->palette.background()); @@ -1751,10 +1771,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { - GtkWidget *gtkSpinButton = d->gtkWidget( - spinBox->buttonSymbols == QAbstractSpinBox::NoButtons ? - QLS("GtkEntry") : - QLS("GtkSpinButton")); + GtkWidget *gtkSpinButton = spinBox->buttonSymbols == QAbstractSpinBox::NoButtons + ? d->gtkWidget("GtkEntry") + : d->gtkWidget("GtkSpinButton"); bool isEnabled = (spinBox->state & State_Enabled); bool hover = isEnabled && (spinBox->state & State_MouseOver); bool sunken = (spinBox->state & State_Sunken); @@ -1906,8 +1925,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { - GtkWidget *hScaleWidget = d->gtkWidget(QLS("GtkHScale")); - GtkWidget *vScaleWidget = d->gtkWidget(QLS("GtkVScale")); + GtkWidget *hScaleWidget = d->gtkWidget("GtkHScale"); + GtkWidget *vScaleWidget = d->gtkWidget("GtkVScale"); QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); @@ -2097,7 +2116,7 @@ void QGtkStyle::drawControl(ControlElement element, switch (element) { case CE_ProgressBarLabel: if (const QStyleOptionProgressBar *bar = qstyleoption_cast(option)) { - GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar")); + GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); if (!gtkProgressBar) return; @@ -2200,7 +2219,7 @@ void QGtkStyle::drawControl(ControlElement element, if (button->features & QStyleOptionButton::HasMenu) ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkButton"); QPalette pal = button->palette; int labelState = GTK_STATE_INSENSITIVE; if (option->state & State_Enabled) @@ -2221,7 +2240,7 @@ void QGtkStyle::drawControl(ControlElement element, bool isRadio = (element == CE_RadioButton); // Draw prelight background - GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton")); + GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); if (option->state & State_MouseOver) { gtkPainter.paintFlatBox(gtkRadioButton, "checkbutton", option->rect, @@ -2289,7 +2308,7 @@ void QGtkStyle::drawControl(ControlElement element, } if (!cb->currentText.isEmpty() && !cb->editable) { - GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox")); + GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); QPalette pal = cb->palette; int labelState = GTK_STATE_INSENSITIVE; @@ -2366,7 +2385,7 @@ void QGtkStyle::drawControl(ControlElement element, // Draws the header in tables. if (const QStyleOptionHeader *header = qstyleoption_cast(option)) { Q_UNUSED(header); - GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView")); + GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); // Get the middle column GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); Q_ASSERT(column); @@ -2387,7 +2406,7 @@ void QGtkStyle::drawControl(ControlElement element, #ifndef QT_NO_SIZEGRIP case CE_SizeGrip: { - GtkWidget *gtkStatusbar = d->gtkWidget(QLS("GtkStatusbar.GtkFrame")); + GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame"); QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness); gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, QApplication::isRightToLeft() ? @@ -2399,7 +2418,7 @@ void QGtkStyle::drawControl(ControlElement element, #endif // QT_NO_SIZEGRIP case CE_MenuBarEmptyArea: { - GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); if (widget) { // See CE_MenuBarItem @@ -2422,8 +2441,8 @@ void QGtkStyle::drawControl(ControlElement element, painter->save(); if (const QStyleOptionMenuItem *mbi = qstyleoption_cast(option)) { - GtkWidget *gtkMenubarItem = d->gtkWidget(QLS("GtkMenuBar.GtkMenuItem")); - GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar")); + GtkWidget *gtkMenubarItem = d->gtkWidget("GtkMenuBar.GtkMenuItem"); + GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); style = gtkMenubarItem->style; @@ -2479,7 +2498,7 @@ void QGtkStyle::drawControl(ControlElement element, break; case CE_Splitter: { - GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed + GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed gtkPainter.paintHandle(gtkWindow, "splitter", option->rect, gtkPainter.gtkState(option), GTK_SHADOW_NONE, !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, style); @@ -2499,7 +2518,7 @@ void QGtkStyle::drawControl(ControlElement element, if (toolbar->positionWithinLine != QStyleOptionToolBar::End) rect.adjust(0, 0, 1, 0); - GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar")); + GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); GtkShadowType shadow_type = GTK_SHADOW_NONE; d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); gtkPainter.paintBox( gtkToolbar, "toolbar", rect, @@ -2518,15 +2537,15 @@ void QGtkStyle::drawControl(ControlElement element, const int windowsItemHMargin = 3; // menu item hor text margin const int windowsItemVMargin = 26; // menu item ver text margin const int windowsRightBorder = 15; // right border on windows - GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")) : - d->gtkWidget(QLS("GtkMenu.GtkMenuItem")); + GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget("GtkMenu.GtkCheckMenuItem") : + d->gtkWidget("GtkMenu.GtkMenuItem"); style = gtkPainter.getStyle(gtkMenuItem); QColor borderColor = option->palette.background().color().darker(160); QColor shadow = option->palette.dark().color(); if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { - GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem")); + GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); painter->setPen(shadow.lighter(106)); gboolean wide_separators = 0; gint separator_height = 0; @@ -2570,7 +2589,7 @@ void QGtkStyle::drawControl(ControlElement element, bool ignoreCheckMark = false; gint checkSize; - d->gtk_widget_style_get(d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL); + d->gtk_widget_style_get(d->gtkWidget("GtkMenu.GtkCheckMenuItem"), "indicator-size", &checkSize, NULL); int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize)); @@ -2781,7 +2800,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast(option)) { - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkButton"); proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); @@ -2807,7 +2826,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast(option)) { - GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook")); + GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); style = gtkPainter.getStyle(gtkNotebook); QRect rect = option->rect; @@ -2874,7 +2893,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_ProgressBarGroove: if (const QStyleOptionProgressBar *bar = qstyleoption_cast(option)) { Q_UNUSED(bar); - GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar")); + GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); GtkStateType state = gtkPainter.gtkState(option); gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style); } @@ -2884,7 +2903,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_ProgressBarContents: if (const QStyleOptionProgressBar *bar = qstyleoption_cast(option)) { GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; - GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar")); + GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); style = gtkProgressBar->style; gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style); int xt = style->xthickness; @@ -3042,7 +3061,7 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple case CC_SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(option)) { - GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton")); + GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton"); int center = spinbox->rect.height() / 2; int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0; int yt = spinbox->frame ? gtkSpinButton->style->ythickness : 0; @@ -3096,15 +3115,19 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple if (const QStyleOptionComboBox *box = qstyleoption_cast(option)) { // We employ the gtk widget to position arrows and separators for us QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox"); - GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath); + GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry") + : d->gtkWidget("GtkComboBox"); d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; d->gtk_widget_size_allocate(gtkCombo, &geometry); int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); - QString arrowPath = comboBoxPath + QLS(".GtkToggleButton"); - - if (!box->editable && !appears_as_list) - arrowPath += QLS(".GtkHBox.GtkArrow"); + QHashableLatin1Literal arrowPath("GtkComboBoxEntry.GtkToggleButton"); + if (!box->editable) { + if (appears_as_list) + arrowPath = "GtkComboBox.GtkToggleButton"; + else + arrowPath = "GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"; + } GtkWidget *arrowWidget = d->gtkWidget(arrowPath); if (!arrowWidget) @@ -3163,7 +3186,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, case CT_ToolButton: if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast(option)) { - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness); if (widget && qobject_cast(widget->parentWidget())) { QSize minSize(0, 25); @@ -3181,14 +3204,14 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, int textMargin = 8; if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { - GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem")); + GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); GtkRequisition sizeReq = {0, 0}; d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq); newSize = QSize(size.width(), sizeReq.height); break; } - GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")); + GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem"); GtkStyle* style = gtkMenuItem->style; // Note we get the perfect height for the default font since we @@ -3210,12 +3233,12 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, case CT_SpinBox: // QSpinBox does some nasty things that depends on CT_LineEdit - newSize = size + QSize(0, -d->gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2); + newSize = size + QSize(0, -d->gtkWidget("GtkSpinButton")->style->ythickness * 2); break; case CT_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast(option)) { - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkButton"); gint focusPadding, focusWidth; d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); d->gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL); @@ -3223,7 +3246,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, newSize += QSize(2*gtkButton->style->xthickness + 4, 2*gtkButton->style->ythickness); newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding)); - GtkWidget *gtkButtonBox = d->gtkWidget(QLS("GtkHButtonBox")); + GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox"); gint minWidth = 85, minHeight = 0; d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, "child-min-height", &minHeight, NULL); @@ -3236,13 +3259,13 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, break; case CT_Slider: { - GtkWidget *gtkSlider = d->gtkWidget(QLS("GtkHScale")); + GtkWidget *gtkSlider = d->gtkWidget("GtkHScale"); newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness); } break; case CT_LineEdit: { - GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry")); + GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness); } break; @@ -3253,7 +3276,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, case CT_ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast(option)) { - GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox")); + GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness); @@ -3405,7 +3428,7 @@ QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, return option->rect; case SE_PushButtonContents: if (!d->gtk_check_version(2, 10, 0)) { - GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton")); + GtkWidget *gtkButton = d->gtkWidget("GtkButton"); GtkBorder *border = 0; d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL); if (border) { diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp index a033407..6916c02 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -60,6 +60,7 @@ #include #include #include +#include #include #include @@ -233,17 +234,22 @@ static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *, gpointer) } } -static QString classPath(GtkWidget *widget) +static QHashableLatin1Literal classPath(GtkWidget *widget) { - char* class_path; + char *class_path; QGtkStylePrivate::gtk_widget_path (widget, NULL, &class_path, NULL); - QString path = QLS(class_path); + + char *copy = class_path; + if (strncmp(copy, "GtkWindow.", 10) == 0) + copy += 10; + if (strncmp(copy, "GtkFixed.", 9) == 0) + copy += 9; + + copy = strdup(copy); + g_free(class_path); - // Remove the prefixes - path.remove(QLS("GtkWindow.")); - path.remove(QLS("GtkFixed.")); - return path; + return QHashableLatin1Literal::fromData(copy); } @@ -261,6 +267,7 @@ bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e) } QList QGtkStylePrivate::instances; +QGtkStylePrivate::WidgetMap *QGtkStylePrivate::widgetMap = 0; QGtkStylePrivate::QGtkStylePrivate() : QCleanlooksStylePrivate() @@ -282,7 +289,7 @@ void QGtkStylePrivate::init() qApp->installEventFilter(&filter); } -GtkWidget* QGtkStylePrivate::gtkWidget(const QString &path) +GtkWidget* QGtkStylePrivate::gtkWidget(const QHashableLatin1Literal &path) { GtkWidget *widget = gtkWidgetMap()->value(path); if (!widget) { @@ -292,10 +299,10 @@ GtkWidget* QGtkStylePrivate::gtkWidget(const QString &path) return widget; } -GtkStyle* QGtkStylePrivate::gtkStyle(const QString &path) +GtkStyle* QGtkStylePrivate::gtkStyle(const QHashableLatin1Literal &path) { - if (gtkWidgetMap()->contains(path)) - return gtkWidgetMap()->value(path)->style; + if (GtkWidget *w = gtkWidgetMap()->value(path)) + return w->style; return 0; } @@ -497,7 +504,7 @@ void QGtkStylePrivate::initGtkWidgets() const } static QString themeName; - if (!gtkWidgetMap()->contains(QLS("GtkWindow")) && themeName.isEmpty()) { + if (!gtkWidgetMap()->contains("GtkWindow") && themeName.isEmpty()) { themeName = getThemeName(); if (themeName.isEmpty()) { @@ -522,14 +529,14 @@ void QGtkStylePrivate::initGtkWidgets() const QGtkStylePrivate::gtk_widget_realize(gtkWindow); if (displayDepth == -1) displayDepth = QGtkStylePrivate::gdk_drawable_get_depth(gtkWindow->window); - gtkWidgetMap()->insert(QLS("GtkWindow"), gtkWindow); + gtkWidgetMap()->insert(QHashableLatin1Literal::fromData(strdup("GtkWindow")), gtkWindow); // Make all other widgets. respect the text direction if (qApp->layoutDirection() == Qt::RightToLeft) QGtkStylePrivate::gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); - if (!gtkWidgetMap()->contains(QLS("GtkButton"))) { + if (!gtkWidgetMap()->contains("GtkButton")) { GtkWidget *gtkButton = QGtkStylePrivate::gtk_button_new(); addWidget(gtkButton); g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), 0); @@ -566,12 +573,12 @@ void QGtkStylePrivate::initGtkWidgets() const // When styles change subwidgets can get rearranged // as with the combo box. We need to update the widget map // to reflect this; - QHash oldMap = *gtkWidgetMap(); + QHash oldMap = *gtkWidgetMap(); gtkWidgetMap()->clear(); - QHashIterator it(oldMap); + QHashIterator it(oldMap); while (it.hasNext()) { it.next(); - if (!it.key().contains(QLatin1Char('.'))) { + if (!strchr(it.key().data(), '.')) { addAllSubWidgets(it.value()); } } @@ -586,8 +593,13 @@ void QGtkStylePrivate::initGtkWidgets() const */ void QGtkStylePrivate::cleanupGtkWidgets() { - if (gtkWidgetMap()->contains(QLS("GtkWindow"))) // Gtk will destroy all children - gtk_widget_destroy(gtkWidgetMap()->value(QLS("GtkWindow"))); + if (!widgetMap) + return; + if (widgetMap->contains("GtkWindow")) // Gtk will destroy all children + gtk_widget_destroy(widgetMap->value("GtkWindow")); + for (QHash::const_iterator it = widgetMap->constBegin(); + it != widgetMap->constEnd(); ++it) + free(const_cast(it.key().data())); } static bool resolveGConf() @@ -678,7 +690,7 @@ QString QGtkStylePrivate::getThemeName() int QGtkStylePrivate::getSpinboxArrowSize() const { const int MIN_ARROW_WIDTH = 6; - GtkWidget *spinButton = gtkWidget(QLS("GtkSpinButton")); + GtkWidget *spinButton = gtkWidget("GtkSpinButton"); GtkStyle *style = spinButton->style; gint size = pango_font_description_get_size (style->font_desc); gint arrow_size; @@ -698,17 +710,17 @@ bool QGtkStylePrivate::isKDE4Session() void QGtkStylePrivate::applyCustomPaletteHash() { - QPalette menuPal = gtkWidgetPalette(QLS("GtkMenu")); - GdkColor gdkBg = gtkWidget(QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL]; + QPalette menuPal = gtkWidgetPalette("GtkMenu"); + GdkColor gdkBg = gtkWidget("GtkMenu")->style->bg[GTK_STATE_NORMAL]; QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); menuPal.setBrush(QPalette::Base, bgColor); menuPal.setBrush(QPalette::Window, bgColor); qApp->setPalette(menuPal, "QMenu"); - QPalette toolbarPal = gtkWidgetPalette(QLS("GtkToolbar")); + QPalette toolbarPal = gtkWidgetPalette("GtkToolbar"); qApp->setPalette(toolbarPal, "QToolBar"); - QPalette menuBarPal = gtkWidgetPalette(QLS("GtkMenuBar")); + QPalette menuBarPal = gtkWidgetPalette("GtkMenuBar"); qApp->setPalette(menuBarPal, "QMenuBar"); } @@ -717,7 +729,7 @@ void QGtkStylePrivate::applyCustomPaletteHash() */ GtkWidget* QGtkStylePrivate::getTextColorWidget() const { - return gtkWidget(QLS("GtkEntry")); + return gtkWidget("GtkEntry"); } void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget) @@ -726,7 +738,7 @@ void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget) static GtkWidget* protoLayout = 0; if (!protoLayout) { protoLayout = QGtkStylePrivate::gtk_fixed_new(); - QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value(QLS("GtkWindow"))), protoLayout); + QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value("GtkWindow")), protoLayout); } Q_ASSERT(protoLayout); @@ -739,8 +751,19 @@ void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget) void QGtkStylePrivate::addWidgetToMap(GtkWidget *widget) { if (Q_GTK_IS_WIDGET(widget)) { - gtk_widget_realize(widget); - gtkWidgetMap()->insert(classPath(widget), widget); + gtk_widget_realize(widget); + QHashableLatin1Literal widgetPath = classPath(widget); + + WidgetMap *map = gtkWidgetMap(); + WidgetMap::iterator it = map->find(widgetPath); + if (it != map->end()) { + free(const_cast(it.key().data())); + map->erase(it); + } + map->insert(widgetPath, widget); +#ifdef DUMP_GTK_WIDGET_TREE + qWarning("Inserted Gtk Widget: %s", widgetPath.data()); +#endif } } @@ -753,7 +776,7 @@ void QGtkStylePrivate::addAllSubWidgets(GtkWidget *widget, gpointer v) } // Updates window/windowtext palette based on the indicated gtk widget -QPalette QGtkStylePrivate::gtkWidgetPalette(const QString >kWidgetName) const +QPalette QGtkStylePrivate::gtkWidgetPalette(const QHashableLatin1Literal >kWidgetName) const { GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName); Q_ASSERT(gtkWidget); @@ -1089,6 +1112,28 @@ QIcon QGtkStylePrivate::getFilesystemIcon(const QFileInfo &info) return icon; } +bool operator==(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) +{ + return l1.size() == l2.size() || qstrcmp(l1.data(), l2.data()) == 0; +} + +// copied from qHash.cpp +uint qHash(const QHashableLatin1Literal &key) +{ + int n = key.size(); + const uchar *p = reinterpret_cast(key.data()); + uint h = 0; + uint g; + + while (n--) { + h = (h << 4) + *p++; + if ((g = (h & 0xf0000000)) != 0) + h ^= g >> 23; + h &= ~g; + } + return h; +} + QT_END_NAMESPACE #endif // !defined(QT_NO_STYLE_GTK) diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h index db5b9b9..5ded4dd 100644 --- a/src/gui/styles/qgtkstyle_p.h +++ b/src/gui/styles/qgtkstyle_p.h @@ -56,6 +56,9 @@ #include #if !defined(QT_NO_STYLE_GTK) +#include +#include + #include #include @@ -72,6 +75,50 @@ typedef unsigned long XID; #define QLS(x) QLatin1String(x) +// ### Qt 4.7 - merge with QLatin1Literal +class QHashableLatin1Literal +{ +public: + int size() const { return m_size; } + const char *data() const { return m_data; } + + template + QHashableLatin1Literal(const char (&str)[N]) + : m_size(N - 1), m_data(str) {} + + QHashableLatin1Literal(const QHashableLatin1Literal &other) + : m_size(other.m_size), m_data(other.m_data) + {} + + QHashableLatin1Literal &operator=(const QHashableLatin1Literal &other) + { + if (this == &other) + return *this; + *const_cast(&m_size) = other.m_size; + *const_cast(&m_data) = const_cast(other.m_data); + return *this; + } + + QString toString() const { return QString::fromLatin1(m_data, m_size); } + + static QHashableLatin1Literal fromData(const char *str) + { + return QHashableLatin1Literal(str, qstrlen(str)); + } + +private: + QHashableLatin1Literal(const char *str, int length) + : m_size(length), m_data(str) + {} + + const int m_size; + const char *m_data; +}; + +bool operator==(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2); +inline bool operator!=(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) { return !operator==(l1, l2); } +uint qHash(const QHashableLatin1Literal &key); + class GConf; class GConfClient; @@ -252,7 +299,6 @@ typedef char* (*Ptr_gnome_icon_lookup_sync) ( GnomeIconLookupFlags flags, GnomeIconLookupResultFlags *result); - class QGtkStylePrivate : public QCleanlooksStylePrivate { Q_DECLARE_PUBLIC(QGtkStyle) @@ -262,8 +308,8 @@ public: QGtkStyleFilter filter; - static GtkWidget* gtkWidget(const QString &path); - static GtkStyle* gtkStyle(const QString &path = QLatin1String("GtkWindow")); + static GtkWidget* gtkWidget(const QHashableLatin1Literal &path); + static GtkStyle* gtkStyle(const QHashableLatin1Literal &path = QHashableLatin1Literal("GtkWindow")); virtual void resolveGtk() const; virtual void initGtkMenu() const; @@ -418,17 +464,25 @@ public: static Ptr_gnome_icon_lookup_sync gnome_icon_lookup_sync; static Ptr_gnome_vfs_init gnome_vfs_init; - virtual QPalette gtkWidgetPalette(const QString >kWidgetName) const; + virtual QPalette gtkWidgetPalette(const QHashableLatin1Literal >kWidgetName) const; protected: - typedef QHash WidgetMap; + typedef QHash WidgetMap; + + static inline void destroyWidgetMap() + { + cleanupGtkWidgets(); + delete widgetMap; + widgetMap = 0; + } static inline WidgetMap *gtkWidgetMap() { - static WidgetMap *map = 0; - if (!map) - map = new WidgetMap(); - return map; + if (!widgetMap) { + widgetMap = new WidgetMap(); + qAddPostRoutine(destroyWidgetMap); + } + return widgetMap; } static QStringList extract_filter(const QString &rawFilter); @@ -443,6 +497,7 @@ protected: private: static QList instances; + static WidgetMap *widgetMap; friend class QGtkStyleUpdateScheduler; }; -- cgit v0.12 From aee5766de0ab6c942ae3e3747162871651a4ab74 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 11 Feb 2010 17:31:30 +0100 Subject: Speed up creation of the pixmap cache key As discussed with Jens and Joao Reviewed-by: Robert Griebl --- src/gui/styles/qstylehelper.cpp | 64 +++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index 071ec23..359e7e1 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -56,22 +57,67 @@ QT_BEGIN_NAMESPACE +// internal helper. Converts an integer value to an unique string token +template +struct HexString +{ + inline HexString(const T t) + : val(t) + {} + + inline void write(QChar *&dest) const + { + const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + const char *c = reinterpret_cast(&val); + for (uint i = 0; i < sizeof(T); ++i) { + *dest++ = hexChars[*c & 0xf]; + *dest++ = hexChars[(*c & 0xf0) >> 4]; + ++c; + } + } + + const T val; +}; + +// specialization to enable fast concatenating of our string tokens to a string +template +struct QConcatenable > +{ + typedef HexString type; + enum { ExactSize = true }; + static int size(const HexString &str) { return sizeof(str.val) * 2; } + static inline void appendTo(const HexString &str, QChar *&out) { str.write(out); } +}; + namespace QStyleHelper { QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size) { const QStyleOptionComplex *complexOption = qstyleoption_cast(option); - QString tmp = QString::fromLatin1("%1-%2-%3-%4-%5-%6x%7").arg(key).arg(uint(option->state)).arg(option->direction) - .arg(complexOption ? uint(complexOption->activeSubControls) : uint(0)) - .arg(option->palette.cacheKey()).arg(size.width()).arg(size.height()); + + QString tmp = key + % QLatin1Char('-') + % HexString(option->state) + % QLatin1Char('-') + % HexString(option->direction) + % QLatin1Char('-') + % HexString(complexOption ? uint(complexOption->activeSubControls) : 0u) + % QLatin1Char('-') + % HexString(option->palette.cacheKey()) + % QLatin1Char('-') + % HexString(size.width()) + % QLatin1Char('x') + % HexString(size.height()); + #ifndef QT_NO_SPINBOX if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { - tmp.append(QLatin1Char('-')); - tmp.append(QString::number(spinBox->buttonSymbols)); - tmp.append(QLatin1Char('-')); - tmp.append(QString::number(spinBox->stepEnabled)); - tmp.append(QLatin1Char('-')); - tmp.append(QLatin1Char(spinBox->frame ? '1' : '0')); + tmp = tmp + % QLatin1Char('-') + % HexString(spinBox->buttonSymbols) + % QLatin1Char('-') + % HexString(spinBox->stepEnabled) + % QLatin1Char('-') + % QLatin1Char(spinBox->frame ? '1' : '0'); } #endif // QT_NO_SPINBOX return tmp; -- cgit v0.12 From d4bae0d0e96138d913bfc7ec9fa86b887043787f Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 3 Mar 2010 15:44:46 +0100 Subject: Fix for QRadioButtons and QCheckBoxes drawn incorrectly when a style sheet is set. Maemo 5 draws these controls very differently, so we can't rely on QWindowStyle handling CE_RadioButton/CE_CheckBox. Task-number: QTBUG-8356 Reviewed-by: ogoffart --- src/gui/styles/qstylesheetstyle.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index bc1bece..5376386 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3457,10 +3457,17 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q case CE_RadioButton: case CE_CheckBox: - rule.drawRule(p, opt->rect); - ParentStyle::drawControl(ce, opt, p, w); - return; - + if (rule.hasBox() || !rule.hasNativeBorder() || rule.hasDrawable() || hasStyleRule(w, PseudoElement_Indicator)) { + rule.drawRule(p, opt->rect); + ParentStyle::drawControl(ce, opt, p, w); + return; + } else if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { + QStyleOptionButton butOpt(*btn); + rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button); + baseStyle()->drawControl(ce, &butOpt, p, w); + return; + } + break; case CE_RadioButtonLabel: case CE_CheckBoxLabel: if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { -- cgit v0.12 From f3dab146f231398455e52ff99d4c6f8365c8d412 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 18 Feb 2010 16:07:27 +0100 Subject: Do not reset state too early on RMB click When long-tapping on a spin box, a context menu event would stop incrementing the spin box since we called reset() too early. Call reset only if it's clear that there's a context menu. Also don't crash if menu is 0. Reviewed-by: Robert Griebl --- src/gui/widgets/qabstractspinbox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 4a6235c..7e2f20d 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -1248,8 +1248,11 @@ void QAbstractSpinBox::contextMenuEvent(QContextMenuEvent *event) #else Q_D(QAbstractSpinBox); - d->reset(); QPointer menu = d->edit->createStandardContextMenu(); + if (!menu) + return; + + d->reset(); QAction *selAll = new QAction(tr("&Select All"), menu); menu->insertAction(d->edit->d_func()->selectAllAction, -- cgit v0.12 From 6ecee3c9790678d34b6d159a10d509d0f9244bc8 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 3 Mar 2010 15:38:43 +0100 Subject: Introduce a setAttribute_internal helper This allows to switch certain attributes on or off without copy/pasting lots of code. Used to switch off mutually exclusive attributes, e.g. the Mac*Size attributes, or Maemo's portrait/landscape attributes. Reviewed-by: Robert Griebl --- src/gui/kernel/qwidget.cpp | 50 +++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7fdee2b..14fecb0 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -10294,6 +10294,29 @@ const QPixmap *QWidget::icon() const #endif // QT3_SUPPORT + /*! + \internal + + This just sets the corresponding attribute bit to 1 or 0 + */ +static void setAttribute_internal(Qt::WidgetAttribute attribute, bool on, QWidgetData *data, + QWidgetPrivate *d) +{ + if (attribute < int(8*sizeof(uint))) { + if (on) + data->widget_attributes |= (1<widget_attributes &= ~(1<high_attributes[int_off] |= (1<<(x-(int_off*8*sizeof(uint)))); + else + d->high_attributes[int_off] &= ~(1<<(x-(int_off*8*sizeof(uint)))); + } +} + /*! Sets the attribute \a attribute on this widget if \a on is true; otherwise clears the attribute. @@ -10320,19 +10343,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } #endif - if (attribute < int(8*sizeof(uint))) { - if (on) - data->widget_attributes |= (1<widget_attributes &= ~(1<high_attributes[int_off] |= (1<<(x-(int_off*8*sizeof(uint)))); - else - d->high_attributes[int_off] &= ~(1<<(x-(int_off*8*sizeof(uint)))); - } + setAttribute_internal(attribute, on, data, d); switch (attribute) { @@ -10391,14 +10402,11 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) #ifdef Q_WS_MAC { // We can only have one of these set at a time - static const int MacSizes[] = { Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, - Qt::WA_MacMiniSize, 0 }; - for (int i = 0; MacSizes[i] != 0; ++i) { - if (MacSizes[i] == attribute) - continue; - int macsize_x = MacSizes[i] - 8*sizeof(uint); - int macsize_int_off = macsize_x / (8*sizeof(uint)); - d->high_attributes[macsize_int_off] &= ~(1<<(macsize_x-(macsize_int_off*8*sizeof(uint)))); + const Qt::WidgetAttribute MacSizes[] = { Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, + Qt::WA_MacMiniSize }; + for (int i = 0; i < 3; ++i) { + if (MacSizes[i] != attribute) + setAttribute_internal(MacSizes[i], false, data, d); } d->macUpdateSizeAttribute(); } -- cgit v0.12 From 4a961ad412846af126ece6d9e2385e3ebe009d72 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 16 Dec 2009 14:43:43 +0100 Subject: be more verbose when warning about incompatible libraries --- src/corelib/kernel/qobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 761b31f..8e4ec7c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -132,7 +132,8 @@ QObjectPrivate::QObjectPrivate(int version) : threadData(0), connectionLists(0), senders(0), currentSender(0), currentChildBeingDeleted(0) { if (version != QObjectPrivateVersion) - qFatal("Cannot mix incompatible Qt libraries"); + qFatal("Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)", + version, QObjectPrivateVersion); // QObjectData initialization q_ptr = 0; -- cgit v0.12 From a2af08f9793b3884bdb770f89edd4754c0411654 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 4 Mar 2010 00:54:06 +1000 Subject: Clairify a comment in one of the auto tests. --- .../declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index dea88c4..b1935df 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -671,9 +671,9 @@ void tst_qdeclarativetextedit::delegateLoading() QTRY_VERIFY(view->status()==QDeclarativeView::Error); view->setFocus(); QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test - //ErrorB should get a component which is ready but component.create() returns null + //A test should be added here with a component which is ready but component.create() returns null //Not sure how to accomplish this with QDeclarativeTextEdits cursor delegate - //###This could be a case of overzealous defensive programming + //###This was only needed for code coverage, and could be a case of overzealous defensive programming //delegate = view->rootObject()->findChild("delegateErrorB"); //QVERIFY(!delegate); } -- cgit v0.12 From 48dc16b34586f7dca8bf513f6447c97543801814 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 3 Mar 2010 15:58:18 +0100 Subject: Block the Maemo5 window attribute values from being assigned to something else on other platforms. Reviewed-By: Harald Fernengel --- src/corelib/global/qnamespace.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 6ee8ae9..d2546a7 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -500,6 +500,14 @@ public: WA_MergeSoftkeys = 124, WA_MergeSoftkeysRecursively = 125, +#if 0 // these values are reserved for Maemo5 - do not re-use them + WA_Maemo5NonComposited = 126, + WA_Maemo5StackedWindow = 127, + WA_Maemo5PortraitOrientation = 128, + WA_Maemo5LandscapeOrientation = 129, + WA_Maemo5AutoOrientation = 130, + WA_Maemo5ShowProgressIndicator = 131, +#endif // Add new attributes before this line WA_AttributeCount }; -- cgit v0.12 From 5b97c515ea574c1ac23c8595af34de406db2536d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 3 Mar 2010 15:58:02 +0100 Subject: Updating documentation for how to build QWS with tslib Reviewed-by: David Boddie --- doc/src/platforms/emb-pointer.qdoc | 6 +++--- doc/src/snippets/code/doc_src_emb-pointer.qdoc | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/src/platforms/emb-pointer.qdoc b/doc/src/platforms/emb-pointer.qdoc index 34510da..3c37b63 100644 --- a/doc/src/platforms/emb-pointer.qdoc +++ b/doc/src/platforms/emb-pointer.qdoc @@ -154,9 +154,9 @@ in the build environment. The tslib sources can be downloaded from \l - http://tslib.berlios.de. Use the \c configure script's -L and - -I options to explicitly specify the location of the library and - its headers: + http://tslib.berlios.de. Specify the location of the library and + its headers using -L and -I options in the \c qmake.conf file in + your \c mkspec. Also it can be helpful to add a -rpath-link: \snippet doc/src/snippets/code/doc_src_emb-pointer.qdoc 7 diff --git a/doc/src/snippets/code/doc_src_emb-pointer.qdoc b/doc/src/snippets/code/doc_src_emb-pointer.qdoc index 9661ae5..0d66e18 100644 --- a/doc/src/snippets/code/doc_src_emb-pointer.qdoc +++ b/doc/src/snippets/code/doc_src_emb-pointer.qdoc @@ -77,7 +77,10 @@ export QWS_MOUSE_PROTO="Vr41xx:press=500:/dev/misc/ts" //! [7] -./configure -L -I +.... +QMAKE_CFLAGS += -I +QMAKE_LFLAGS += -L -Wl,-rpath-link= +.... //! [7] -- cgit v0.12 From bfd0d6557dc54c0fd0270de6c138ea1031ea092c Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 3 Mar 2010 16:52:41 +0100 Subject: Fix warnings on MSVC --- src/gui/graphicsview/qgraphicslinearlayout.cpp | 2 ++ src/gui/image/qpixmapfilter.cpp | 4 ++-- src/gui/kernel/qwidget.cpp | 1 - src/gui/painting/qdrawhelper.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 6a9eb29..9722683 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -554,6 +554,8 @@ void QGraphicsLinearLayout::dump(int indent) const d->orientation == Qt::Horizontal ? "Horizontal" : "Vertical"); d->engine.dump(indent + 1); } +#else + Q_UNUSED(indent); #endif } diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 2792e45..0abf51f 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -726,7 +726,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp int img_height = img.height(); for (int row = 0; row < img_height; ++row) { - for (int i = 0; i <= improvedQuality; ++i) + for (int i = 0; i <= int(improvedQuality); ++i) qt_blurrow(img, row, alpha); } @@ -759,7 +759,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp img_height = temp.height(); for (int row = 0; row < img_height; ++row) { - for (int i = 0; i <= improvedQuality; ++i) + for (int i = 0; i <= int(improvedQuality); ++i) qt_blurrow(temp, row, alpha); } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2f6ec6b..aa5d259 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5339,7 +5339,6 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender) { - Q_Q(QWidget); if (!target) { qWarning("QWidget::render: null pointer to paint device"); return; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 891f4c2..acd286a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7813,7 +7813,6 @@ static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userD void qInitDrawhelperAsm() { - const uint features = qDetectCPUFeatures(); qt_memfill32 = qt_memfill_template; qt_memfill16 = qt_memfill_quint16; //qt_memfill_template; @@ -7822,6 +7821,7 @@ void qInitDrawhelperAsm() CompositionFunctionSolid *functionForModeSolidAsm = 0; #ifdef QT_NO_DEBUG + const uint features = qDetectCPUFeatures(); if (false) { #ifdef QT_HAVE_SSE2 } else if (features & SSE2) { -- cgit v0.12 From f57521e4c658cf239f4691efed66e49c41f22bd5 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 3 Mar 2010 17:15:47 +0100 Subject: Fix compile --- src/gui/styles/qgtkstyle_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h index 5ded4dd..e8b0be7 100644 --- a/src/gui/styles/qgtkstyle_p.h +++ b/src/gui/styles/qgtkstyle_p.h @@ -56,6 +56,7 @@ #include #if !defined(QT_NO_STYLE_GTK) +#include #include #include -- cgit v0.12 From b489394e695f78d78db9bf08bc985219f8fb9bb2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 3 Mar 2010 17:14:45 +0100 Subject: Fix compilation: include QString in order to use QString. It doesn't happen on my system, but the CI system complains, so I guess it's a namespace issue. --- src/gui/styles/qgtkstyle_p.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h index e8b0be7..6ee7904 100644 --- a/src/gui/styles/qgtkstyle_p.h +++ b/src/gui/styles/qgtkstyle_p.h @@ -76,6 +76,8 @@ typedef unsigned long XID; #define QLS(x) QLatin1String(x) +QT_BEGIN_NAMESPACE + // ### Qt 4.7 - merge with QLatin1Literal class QHashableLatin1Literal { @@ -120,6 +122,8 @@ bool operator==(const QHashableLatin1Literal &l1, const QHashableLatin1Literal & inline bool operator!=(const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2) { return !operator==(l1, l2); } uint qHash(const QHashableLatin1Literal &key); +QT_END_NAMESPACE + class GConf; class GConfClient; -- cgit v0.12 From c7f2181a25243ed07f1406c7023dfdd5fb75d77d Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 3 Mar 2010 17:25:07 +0100 Subject: Make sure not to crash if createStandardContextMenu() returns 0 (e.g. on Maemo5) Reviewed-by: Harald Fernengel --- src/gui/widgets/qlineedit.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 0ba8b9f..595f552 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2038,9 +2038,10 @@ void QLineEdit::dropEvent(QDropEvent* e) */ void QLineEdit::contextMenuEvent(QContextMenuEvent *event) { - QMenu *menu = createStandardContextMenu(); - menu->setAttribute(Qt::WA_DeleteOnClose); - menu->popup(event->globalPos()); + if (QMenu *menu = createStandardContextMenu()) { + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->popup(event->globalPos()); + } } #if defined(Q_WS_WIN) -- cgit v0.12 From 65e7400babb0625f4d7616ec5d71490a2dcd3c6f Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 27 Jan 2010 15:54:25 +0100 Subject: Always redraw the complete control when an input event comes in. The problem here is that a pre-edit string won't be detected by updateDisplayText(), so the control thinks nothing has changed when a new pre-edit string is set. Reviewed-By: Simon Hausmann (cherry picked from commit 16f30906f6eea3e00351478555f153697a6e186d) --- src/gui/widgets/qlinecontrol.cpp | 6 +++--- src/gui/widgets/qlinecontrol_p.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index db099e8..9ec0feb 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE Updates the display text based of the current edit text If the text has changed will emit displayTextChanged() */ -void QLineControl::updateDisplayText() +void QLineControl::updateDisplayText(bool forceUpdate) { QString orig = m_textLayout.text(); QString str; @@ -102,7 +102,7 @@ void QLineControl::updateDisplayText() m_textLayout.endLayout(); m_ascent = qRound(l.ascent()); - if (str != orig) + if (str != orig || forceUpdate) emit displayTextChanged(str); } @@ -476,7 +476,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) } } m_textLayout.setAdditionalFormats(formats); - updateDisplayText(); + updateDisplayText(/*force*/ true); if (cursorPositionChanged) emitCursorPositionChanged(); if (isGettingInput) diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index d6f2705..3f1bc2c 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -239,7 +239,7 @@ private: void init(const QString &txt); void removeSelectedText(); void internalSetText(const QString &txt, int pos = -1, bool edited = true); - void updateDisplayText(); + void updateDisplayText(bool forceUpdate = false); void internalInsert(const QString &s); void internalDelete(bool wasBackspace = false); -- cgit v0.12 From 97728e94e199017204d9c70f042ccb62e4eacc90 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 3 Mar 2010 17:48:34 +0100 Subject: Remove the Qt 4.7 #if guards that were needed for 4.6 Reviewed-by: TrustMe --- src/gui/widgets/qlineedit.cpp | 3 --- src/gui/widgets/qlineedit.h | 6 ------ 2 files changed, 9 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 595f552..7ccced6 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -383,8 +383,6 @@ void QLineEdit::setText(const QString& text) d->control->setText(text); } -// ### Qt 4.7: remove this #if guard -#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) /*! \since 4.7 @@ -414,7 +412,6 @@ void QLineEdit::setPlaceholderText(const QString& placeholderText) update(); } } -#endif /*! \property QLineEdit::displayText diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index fa04bfc..94e0dbe 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -83,10 +83,7 @@ class Q_GUI_EXPORT QLineEdit : public QWidget Q_PROPERTY(bool undoAvailable READ isUndoAvailable) Q_PROPERTY(bool redoAvailable READ isRedoAvailable) Q_PROPERTY(bool acceptableInput READ hasAcceptableInput) -// ### Qt 4.7: remove this #if guard -#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText) -#endif public: explicit QLineEdit(QWidget* parent=0); @@ -102,11 +99,8 @@ public: QString displayText() const; -// ### Qt 4.7: remove this #if guard -#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) QString placeholderText() const; void setPlaceholderText(const QString &); -#endif int maxLength() const; void setMaxLength(int); -- cgit v0.12 From c9c1ae3030bff8b8e64d1c4e02f28faba1a8eb68 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 3 Mar 2010 17:31:40 +0100 Subject: Avoid QString reallocation in QTextEngine::itemize() Calling QString::utf16() will cause reallocation (for null-termination) if the string was created via fromRawData(). Reviewed-by: Benjamin Poulain --- src/gui/text/qtextengine.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 02eae98..2291138 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1434,9 +1434,7 @@ void QTextEngine::itemize() const layoutData->hasBidi = bidiItemize(const_cast(this), analysis, control); } - const ushort *unicode = layoutData->string.utf16(); - // correctly assign script, isTab and isObject to the script analysis - const ushort *uc = unicode; + const ushort *uc = reinterpret_cast(layoutData->string.unicode()); const ushort *e = uc + length; int lastScript = QUnicodeTables::Common; while (uc < e) { -- cgit v0.12 From 9b60566af57543310a7b5bec03b5de1e24c7f746 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 3 Mar 2010 18:30:51 +0100 Subject: Fix source compatibility of qRegisterMetaType ActiveQt is having construct like qRegisterMetaType("Foo*", (Foo*)0 ); instead of qRegisterMetaType("Foo*"); Which the compiler could not disambiguate anymore since commit 03daf059647c0a0222e8774b0a083f58c8e64934 Reviewed-by: Thierry --- src/corelib/kernel/qmetatype.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 98ed4bd..2108b92 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -173,7 +173,7 @@ namespace QtPrivate { template int qRegisterMetaType(const char *typeName #ifndef qdoc - , typename QMetaTypeId2::CustomType * dummy = 0 + , T * dummy = 0 #endif ) { @@ -190,17 +190,6 @@ int qRegisterMetaType(const char *typeName reinterpret_cast(cptr)); } -template -int qRegisterMetaType(const char *typeName -#ifndef qdoc - , typename QMetaTypeId2::BuiltinType * /* dummy */ = 0 -#endif -) -{ - return QMetaType::registerTypedef(typeName, QMetaTypeId2::MetaType); -} - - #ifndef QT_NO_DATASTREAM template void qRegisterMetaTypeStreamOperators(const char *typeName @@ -229,7 +218,6 @@ struct QMetaTypeId template struct QMetaTypeId2 { - typedef T CustomType; enum { Defined = QMetaTypeId::Defined }; static inline int qt_metatype_id() { return QMetaTypeId::qt_metatype_id(); } }; @@ -297,7 +285,6 @@ inline int qRegisterMetaTypeStreamOperators() QT_BEGIN_NAMESPACE \ template<> struct QMetaTypeId2 \ { \ - typedef TYPE BuiltinType; \ enum { Defined = 1, MetaType = QMetaType::NAME }; \ static inline int qt_metatype_id() { return QMetaType::NAME; } \ }; \ -- cgit v0.12 From 1a7df5ef1fc81fbf2d548c40e3feeb8ef3bb5a8c Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 3 Mar 2010 19:39:45 +0100 Subject: make example work again The code is now a bit on the imperative side, but that was the only working solution to remove the binding loops. --- examples/declarative/dynamic/qml/Sun.qml | 8 ++++---- examples/declarative/imageprovider/imageprovider.qml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/declarative/dynamic/qml/Sun.qml b/examples/declarative/dynamic/qml/Sun.qml index 796a370..81b6e9b 100644 --- a/examples/declarative/dynamic/qml/Sun.qml +++ b/examples/declarative/dynamic/qml/Sun.qml @@ -11,14 +11,14 @@ Image { //x and y get set when instantiated //head offscreen - y: NumberAnimation { - to: parent.height; - duration: 10000; + NumberAnimation on y { + to: window.height / 2; running: created + onRunningChanged: if (running) duration = (window.height - sun.y) * 10; else state = "OffScreen"; } states: State { - name: "OffScreen"; when: created && y > window.height / 2;//Below the ground + name: "OffScreen"; StateChangeScript { script: { sun.created = false; sun.destroy() } } } } diff --git a/examples/declarative/imageprovider/imageprovider.qml b/examples/declarative/imageprovider/imageprovider.qml index a1f2794..f899b1e 100644 --- a/examples/declarative/imageprovider/imageprovider.qml +++ b/examples/declarative/imageprovider/imageprovider.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import ImageProviderCore 1.0 +import "ImageProviderCore" //![0] ListView { width: 100 -- cgit v0.12 From f3c016b8d69612e1e7e5c59ad66b639059c6e246 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 3 Mar 2010 17:54:23 +0100 Subject: Disable auto-uppercasing and predictive text for password line edits. Reviewed-by: axis --- src/gui/widgets/qlineedit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 7ccced6..94ee4b3 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -544,6 +544,11 @@ void QLineEdit::setEchoMode(EchoMode mode) } else { imHints &= ~Qt::ImhHiddenText; } + if (mode != Normal) { + imHints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); + } else { + imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); + } setInputMethodHints(imHints); d->control->setEchoMode(mode); update(); -- cgit v0.12 From 24c1173aac92e9a4e14da072b5aa62c8289d810d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 08:54:40 +1000 Subject: Fix painting Rectangle with radius < side/2. Falls back to using standard QPainter. Also avoid painting odd width borders between pixels, i.e. pixel align painting. Task-number: QTBUG-6675, QTBUG-8317, QTBUG-6786 --- .../graphicsitems/qdeclarativerectangle.cpp | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index d534f21..05fe0f7 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -393,9 +393,10 @@ void QDeclarativeRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, void QDeclarativeRectangle::drawRect(QPainter &p) { Q_D(QDeclarativeRectangle); - if (d->gradient && d->gradient->gradient()) { + if ((d->gradient && d->gradient->gradient()) + || d->radius > width()/2 || d->radius > height()/2) { // XXX This path is still slower than the image path - // Image path won't work for gradients though + // Image path won't work for gradients or invalid radius though bool oldAA = p.testRenderHint(QPainter::Antialiasing); if (d->smooth) p.setRenderHint(QPainter::Antialiasing); @@ -405,11 +406,23 @@ void QDeclarativeRectangle::drawRect(QPainter &p) } else { p.setPen(Qt::NoPen); } - p.setBrush(*d->gradient->gradient()); - if (d->radius > 0.) - p.drawRoundedRect(0, 0, width(), height(), d->radius, d->radius); + if (d->gradient && d->gradient->gradient()) + p.setBrush(*d->gradient->gradient()); else - p.drawRect(0, 0, width(), height()); + p.setBrush(d->color); + const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; + QRectF rect; + if (pw%2) + rect = QRectF(0.5, 0.5, width()-1, height()-1); + else + rect = QRectF(0, 0, width(), height()); + qreal radius = d->radius; + if (radius > width()/2 || radius > height()/2) + radius = qMin(width()/2, height()/2); + if (radius > 0.) + p.drawRoundedRect(rect, radius, radius); + else + p.drawRect(rect); if (d->smooth) p.setRenderHint(QPainter::Antialiasing, oldAA); } else { -- cgit v0.12 From 89e29d1f7a61f5cfa15cbce9b225a9d9ee9b4b7f Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 4 Mar 2010 08:59:06 +1000 Subject: Fix url in source() test. --- .../qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 841a0ee..de11fe2 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -103,7 +103,7 @@ void tst_QDeclarativeWorkerScript::source_data() QTest::addColumn("valid"); QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/worker.qml") << true; - QTest::newRow("invalid") << QUrl("file:///asdjfk.js") << false; + QTest::newRow("invalid") << QUrl::fromLocalFile("asdjfk.js") << false; } void tst_QDeclarativeWorkerScript::messaging() -- cgit v0.12 From f53ac4f7617bfdefcb62e9b27ee6bf1a91a7ed13 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 4 Mar 2010 09:37:04 +1000 Subject: Fix test to listen for signal instead of try-waiting for property. --- .../declarative/qdeclarativeworkerscript/data/worker.qml | 5 +++-- .../tst_qdeclarativeworkerscript.cpp | 13 ++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml index 2982010..bb4028f 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -4,9 +4,10 @@ WorkerScript { id: worker source: "script.js" - property bool done : false property var response + signal done() + function testSend(value) { worker.sendMessage(value) } @@ -21,7 +22,7 @@ WorkerScript { } onMessage: { - worker.done = true worker.response = messageObject + worker.done() } } diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 841a0ee..b0fc212 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include #include +#include #include #include @@ -67,11 +68,13 @@ private slots: private: void waitForEchoMessage(QDeclarativeWorkerScript *worker) { - const QMetaObject *mo = worker->metaObject(); - int index = mo->indexOfProperty("done"); - QVERIFY(index >= 0); - QTRY_COMPARE(mo->property(index).read(worker).toBool(), true); - QTRY_COMPARE(mo->property(mo->indexOfProperty("done")).read(worker).toBool(), true); + QEventLoop loop; + QVERIFY(connect(worker, SIGNAL(done()), &loop, SLOT(quit()))); + QTimer timer; + connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.start(1000); + loop.exec(); + QVERIFY(timer.isActive()); } QDeclarativeEngine m_engine; -- cgit v0.12 From e8916f0b69abad1de5767ac6ca1a555f40e3f675 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 4 Mar 2010 09:46:25 +1000 Subject: Increase test timer --- .../qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 15caea6..9957b50 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -71,8 +71,9 @@ private: QEventLoop loop; QVERIFY(connect(worker, SIGNAL(done()), &loop, SLOT(quit()))); QTimer timer; + timer.setSingleShot(true); connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - timer.start(1000); + timer.start(10000); loop.exec(); QVERIFY(timer.isActive()); } -- cgit v0.12 From 89a478c8c747b2f572deb88d028715e88c16853e Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 09:53:28 +1000 Subject: Make sure currentIndex is updated when view is flicked. Task-number: QTBUG-8396 --- examples/declarative/parallax/qml/ParallaxView.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml index 5e58100..08193ae 100644 --- a/examples/declarative/parallax/qml/ParallaxView.qml +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -25,6 +25,7 @@ Item { anchors.fill: parent model: VisualItemModel { id: visualModel } + highlightRangeMode: ListView.StrictlyEnforceRange snapMode: ListView.SnapOneItem } -- cgit v0.12 From 06e61382f0d6f07798f7db3049f3e185be54efc1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 4 Mar 2010 09:54:16 +1000 Subject: system import path not supported with Qt 4.6. --- src/declarative/qml/qdeclarativeengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index ecaea61..bd67b0b 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1383,7 +1383,11 @@ public: paths += QFileInfo(base.toLocalFile()).path(); paths += importPath; paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath; +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath); +#else + QString builtinPath; +#endif if (!builtinPath.isEmpty()) paths += builtinPath; -- cgit v0.12 From b67d5d90a306534a1ea2fcb333981c6b1126105c Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 4 Mar 2010 09:54:42 +1000 Subject: Fix visibility of classes in private headers upon which Bauhaus/Creator relies. Author: Erik Verbruggen --- src/declarative/qml/qdeclarativebinding_p.h | 4 ++-- src/declarative/qml/qdeclarativeproperty_p.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index ec5809d..1a714f0 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE -class Q_AUTOTEST_EXPORT QDeclarativeAbstractBinding +class Q_DECLARATIVE_EXPORT QDeclarativeAbstractBinding { public: QDeclarativeAbstractBinding(); @@ -101,7 +101,7 @@ private: class QDeclarativeContext; class QDeclarativeBindingPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeBinding : public QDeclarativeExpression, public QDeclarativeAbstractBinding +class Q_DECLARATIVE_EXPORT QDeclarativeBinding : public QDeclarativeExpression, public QDeclarativeAbstractBinding { Q_OBJECT public: diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h index 1fda7f4..c31e2d3 100644 --- a/src/declarative/qml/qdeclarativeproperty_p.h +++ b/src/declarative/qml/qdeclarativeproperty_p.h @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeContext; class QDeclarativeEnginePrivate; class QDeclarativeExpression; -class Q_AUTOTEST_EXPORT QDeclarativePropertyPrivate +class Q_DECLARATIVE_EXPORT QDeclarativePropertyPrivate { public: enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 }; -- cgit v0.12 From 7ab3b4d96a0cedb50d2c1ce5bfe9eed315548c4f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Mar 2010 09:56:03 +1000 Subject: Fix Samegame. --- demos/declarative/samegame/SamegameCore/samegame.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js index c0f10bd..1214b79 100755 --- a/demos/declarative/samegame/SamegameCore/samegame.js +++ b/demos/declarative/samegame/SamegameCore/samegame.js @@ -4,7 +4,7 @@ var maxX = 10;//Nums are for gameCanvas.tileSize 40 var maxY = 15; var maxIndex = maxX*maxY; var board = new Array(maxIndex); -var tileSrc = "content/BoomBlock.qml"; +var tileSrc = "SamegameCore/BoomBlock.qml"; var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; var scoresURL = ""; var timer; -- cgit v0.12 From 8f031e9c1dc4dd3b8caea646c9ea108b04f36b3c Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 4 Mar 2010 10:20:21 +1000 Subject: remove non wifi interfaces from being handled. handled by generic engine. also fix release crash --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index a758a4b..2d33d36 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -201,7 +201,6 @@ void QCoreWlanEngine::connectToId(const QString &id) return; } } - [apNetwork release]; } } } @@ -292,7 +291,7 @@ void QCoreWlanEngine::doRequestUpdate() if (!interface.addressEntries().isEmpty()) state = QNetworkConfiguration::Active; - if (accessPointConfigurations.contains(id)) { + if (accessPointConfigurations.contains(id)) { //handle only scanned AP's QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); bool changed = false; @@ -319,20 +318,6 @@ void QCoreWlanEngine::doRequestUpdate() if (changed) emit configurationChanged(ptr); - } else { - QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); - - ptr->name = name; - ptr->isValid = true; - ptr->id = id; - ptr->state = state; - ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = qGetInterfaceType(interface.name()); - - accessPointConfigurations.insert(id, ptr); - configurationInterface.insert(id, interface.name()); - - emit configurationAdded(ptr); } } @@ -496,12 +481,6 @@ bool QCoreWlanEngine::getAllScInterfaces() CFStringRef type = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)thisInterface); if ( CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) { typeStr = "WLAN"; -// } else if (CFEqual(type, kSCNetworkInterfaceTypeBluetooth)) { -// typeStr = "Bluetooth"; - } else if(CFEqual(type, kSCNetworkInterfaceTypeEthernet)) { - typeStr = "Ethernet"; - } else if(CFEqual(type, kSCNetworkInterfaceTypeFireWire)) { - typeStr = "Ethernet"; //ok a bit fudged } if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) { networkInterfaces.insert(interfaceName,typeStr); -- cgit v0.12 From 26d28b39504d1c55690985deb52646114b6cf710 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Mar 2010 10:43:33 +1000 Subject: Fix benchmarks. Get them all running again after renames, etc. --- tests/benchmarks/declarative/binding/binding.pro | 3 +++ tests/benchmarks/declarative/binding/data/idproperty.txt | 2 +- .../declarative/binding/data/objectproperty.txt | 2 +- tests/benchmarks/declarative/binding/testtypes.h | 6 +++--- tests/benchmarks/declarative/binding/tst_binding.cpp | 16 ++++++++-------- tests/benchmarks/declarative/creation/tst_creation.cpp | 5 +++-- .../qdeclarativecomponent/data/samegame/BoomBlock.qml | 6 +++--- .../qdeclarativecomponent/qdeclarativecomponent.pro | 3 +++ .../declarative/qdeclarativecomponent/testtypes.h | 6 +++--- .../qdeclarativecomponent/tst_qdeclarativecomponent.cpp | 14 +++++++------- .../qdeclarativemetaproperty.pro | 2 ++ .../tst_qdeclarativemetaproperty.cpp | 8 ++++---- tests/benchmarks/declarative/script/tst_script.cpp | 11 ++++++----- 13 files changed, 47 insertions(+), 37 deletions(-) diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro index aa4cc41..5ceaf34 100644 --- a/tests/benchmarks/declarative/binding/binding.pro +++ b/tests/benchmarks/declarative/binding/binding.pro @@ -7,6 +7,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_binding.cpp testtypes.cpp HEADERS += testtypes.h +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" + symbian* { data.sources = data/* data.path = data diff --git a/tests/benchmarks/declarative/binding/data/idproperty.txt b/tests/benchmarks/declarative/binding/data/idproperty.txt index 71e3c4e..4e474ba 100644 --- a/tests/benchmarks/declarative/binding/data/idproperty.txt +++ b/tests/benchmarks/declarative/binding/data/idproperty.txt @@ -1,7 +1,7 @@ import Test 1.0 MyQmlObject { - id: MyObject + id: myObject MyQmlObject { result: ### diff --git a/tests/benchmarks/declarative/binding/data/objectproperty.txt b/tests/benchmarks/declarative/binding/data/objectproperty.txt index 63fa74d..6133dd6 100644 --- a/tests/benchmarks/declarative/binding/data/objectproperty.txt +++ b/tests/benchmarks/declarative/binding/data/objectproperty.txt @@ -1,7 +1,7 @@ import Test 1.0 MyQmlObject { - id: MyObject + id: myObject result: ### } diff --git a/tests/benchmarks/declarative/binding/testtypes.h b/tests/benchmarks/declarative/binding/testtypes.h index 4b103ce..523f94d 100644 --- a/tests/benchmarks/declarative/binding/testtypes.h +++ b/tests/benchmarks/declarative/binding/testtypes.h @@ -50,7 +50,7 @@ class MyQmlObject : public QObject Q_PROPERTY(int result READ result WRITE setResult); Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged); Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged); - Q_PROPERTY(QDeclarativeList *data READ data); + Q_PROPERTY(QDeclarativeListProperty data READ data); Q_CLASSINFO("DefaultProperty", "data"); public: MyQmlObject() : m_result(0), m_value(0), m_object(0) {} @@ -61,7 +61,7 @@ public: int value() const { return m_value; } void setValue(int v) { m_value = v; emit valueChanged(); } - QDeclarativeList *data() { return &m_data; } + QDeclarativeListProperty data() { return QDeclarativeListProperty(this, m_data); } MyQmlObject *object() const { return m_object; } void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); } @@ -71,7 +71,7 @@ signals: void objectChanged(); private: - QDeclarativeConcreteList m_data; + QList m_data; int m_result; int m_value; MyQmlObject *m_object; diff --git a/tests/benchmarks/declarative/binding/tst_binding.cpp b/tests/benchmarks/declarative/binding/tst_binding.cpp index ee529a7..dbddac3 100644 --- a/tests/benchmarks/declarative/binding/tst_binding.cpp +++ b/tests/benchmarks/declarative/binding/tst_binding.cpp @@ -103,8 +103,8 @@ void tst_binding::objectproperty_data() QTest::addColumn("file"); QTest::addColumn("binding"); - QTest::newRow("object.value") << "data/objectproperty.txt" << "object.value"; - QTest::newRow("object.value + 10") << "data/objectproperty.txt" << "object.value + 10"; + QTest::newRow("object.value") << SRCDIR "/data/objectproperty.txt" << "object.value"; + QTest::newRow("object.value + 10") << SRCDIR "/data/objectproperty.txt" << "object.value + 10"; } void tst_binding::objectproperty() @@ -132,13 +132,13 @@ void tst_binding::basicproperty_data() QTest::addColumn("file"); QTest::addColumn("binding"); - QTest::newRow("value") << "data/localproperty.txt" << "value"; - QTest::newRow("value + 10") << "data/localproperty.txt" << "value + 10"; - QTest::newRow("value + value + 10") << "data/localproperty.txt" << "value + value + 10"; + QTest::newRow("value") << SRCDIR "/data/localproperty.txt" << "value"; + QTest::newRow("value + 10") << SRCDIR "/data/localproperty.txt" << "value + 10"; + QTest::newRow("value + value + 10") << SRCDIR "/data/localproperty.txt" << "value + value + 10"; - QTest::newRow("MyObject.value") << "data/idproperty.txt" << "MyObject.value"; - QTest::newRow("MyObject.value + 10") << "data/idproperty.txt" << "MyObject.value + 10"; - QTest::newRow("MyObject.value + MyObject.value + 10") << "data/idproperty.txt" << "MyObject.value + MyObject.value + 10"; + QTest::newRow("myObject.value") << SRCDIR "/data/idproperty.txt" << "myObject.value"; + QTest::newRow("myObject.value + 10") << SRCDIR "/data/idproperty.txt" << "myObject.value + 10"; + QTest::newRow("myObject.value + myObject.value + 10") << SRCDIR "/data/idproperty.txt" << "myObject.value + myObject.value + 10"; } void tst_binding::basicproperty() diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 9c0fd27..4319208 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include @@ -339,7 +339,8 @@ void tst_creation::itemtree_data_cpp() for (int i = 0; i < 30; ++i) { QDeclarativeItem *child = new QDeclarativeItem; QDeclarativeGraphics_setParent_noEvent(child,item); - item->data()->append(child); + QDeclarativeListReference ref(item, "data"); + ref.append(child); } delete item; } diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml index 723e62a..e48194a 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml @@ -7,8 +7,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } Image { id: img source: { @@ -21,7 +21,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } anchors.fill: parent } diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index 12fa9f4..30ef235 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -7,6 +7,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativecomponent.cpp testtypes.cpp HEADERS += testtypes.h +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" + symbian* { data.sources = data/* data.path = data diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h index 4b103ce..523f94d 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h +++ b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h @@ -50,7 +50,7 @@ class MyQmlObject : public QObject Q_PROPERTY(int result READ result WRITE setResult); Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged); Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged); - Q_PROPERTY(QDeclarativeList *data READ data); + Q_PROPERTY(QDeclarativeListProperty data READ data); Q_CLASSINFO("DefaultProperty", "data"); public: MyQmlObject() : m_result(0), m_value(0), m_object(0) {} @@ -61,7 +61,7 @@ public: int value() const { return m_value; } void setValue(int v) { m_value = v; emit valueChanged(); } - QDeclarativeList *data() { return &m_data; } + QDeclarativeListProperty data() { return QDeclarativeListProperty(this, m_data); } MyQmlObject *object() const { return m_object; } void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); } @@ -71,7 +71,7 @@ signals: void objectChanged(); private: - QDeclarativeConcreteList m_data; + QList m_data; int m_result; int m_value; MyQmlObject *m_object; diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp index 7065303..4b1456e 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp +++ b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -90,13 +90,13 @@ void tst_qmlcomponent::creation_data() { QTest::addColumn("file"); - QTest::newRow("Object") << "data/object.qml"; - QTest::newRow("Object - Id") << "data/object_id.qml"; - QTest::newRow("MyQmlObject") << "data/myqmlobject.qml"; - QTest::newRow("MyQmlObject: basic binding") << "data/myqmlobject_binding.qml"; - QTest::newRow("Synthesized properties") << "data/synthesized_properties.qml"; - QTest::newRow("Synthesized properties.2") << "data/synthesized_properties.2.qml"; - QTest::newRow("SameGame - BoomBlock") << "data/samegame/BoomBlock.qml"; + QTest::newRow("Object") << SRCDIR "/data/object.qml"; + QTest::newRow("Object - Id") << SRCDIR "/data/object_id.qml"; + QTest::newRow("MyQmlObject") << SRCDIR "/data/myqmlobject.qml"; + QTest::newRow("MyQmlObject: basic binding") << SRCDIR "/data/myqmlobject_binding.qml"; + QTest::newRow("Synthesized properties") << SRCDIR "/data/synthesized_properties.qml"; + QTest::newRow("Synthesized properties.2") << SRCDIR "/data/synthesized_properties.2.qml"; + QTest::newRow("SameGame - BoomBlock") << SRCDIR "/data/samegame/BoomBlock.qml"; } void tst_qmlcomponent::creation() diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro index 8070768..79fdd26 100644 --- a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro @@ -6,3 +6,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativemetaproperty.cpp +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index dae1751..8a5f4ae 100644 --- a/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include @@ -89,8 +89,8 @@ void tst_qmlmetaproperty::lookup_data() { QTest::addColumn("file"); - QTest::newRow("Simple Object") << "data/object.qml"; - QTest::newRow("Synthesized Object") << "data/synthesized_object.qml"; + QTest::newRow("Simple Object") << SRCDIR "/data/object.qml"; + QTest::newRow("Synthesized Object") << SRCDIR "/data/synthesized_object.qml"; } void tst_qmlmetaproperty::lookup() @@ -103,7 +103,7 @@ void tst_qmlmetaproperty::lookup() QObject *obj = c.create(); QBENCHMARK { - QDeclarativeMetaProperty p(obj, "x"); + QDeclarativeProperty p(obj, "x"); } delete obj; diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp index 61f5fc8..9dd4076 100644 --- a/tests/benchmarks/declarative/script/tst_script.cpp +++ b/tests/benchmarks/declarative/script/tst_script.cpp @@ -96,11 +96,6 @@ private slots: private: }; -void tst_script::initTestCase() -{ - QML_REGISTER_TYPE(Qt.test, 1, 0, TestObject, TestObject); -} - inline QUrl TEST_FILE(const QString &filename) { return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); @@ -147,6 +142,12 @@ int TestObject::x() return m_x++; } +void tst_script::initTestCase() +{ + QML_REGISTER_TYPE(Qt.test, 1, 0, TestObject, TestObject); +} + + #define PROPERTY_PROGRAM \ "(function(testObject) { return (function() { " \ " var test = 0; " \ -- cgit v0.12 From 1c21463aca94051a5c5e293bd9d5f6da8c491bf9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 10:45:55 +1000 Subject: Set StrongFocus on QDeclarativeView so that elements can get focus. Task-number: QTBUG-8637 --- src/declarative/util/qdeclarativeview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index f08e634..cd67aeb 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -194,6 +194,7 @@ void QDeclarativeViewPrivate::execute() \o Initializes QGraphicsView for QML key handling: \list \o QGraphicsView::viewport()->setFocusPolicy(Qt::NoFocus); + \o QGraphicsView::setFocusPolicy(Qt::StrongFocus); \o QGraphicsScene::setStickyFocus(true); \endlist \endlist @@ -268,6 +269,7 @@ void QDeclarativeViewPrivate::init() q->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); scene.setItemIndexMethod(QGraphicsScene::NoIndex); q->viewport()->setFocusPolicy(Qt::NoFocus); + q->setFocusPolicy(Qt::StrongFocus); scene.setStickyFocus(true); //### needed for correct focus handling } -- cgit v0.12 From 4164a11032b64fe5a557515f283fa0e4c6d0260d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Mar 2010 12:18:36 +1000 Subject: Fix test. --- tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml index 69114af..dc29f15 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml @@ -1,6 +1,6 @@ import Qt 4.6 QtObject { - id: Blah + id: blah } -- cgit v0.12 From 984625e5788900c96507b773193f519295d0be80 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 4 Mar 2010 12:00:06 +1000 Subject: Namespace fixes. Reviewed-by: Rohan McGovern --- src/corelib/tools/qsimd_p.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 724f3e0..21f308d 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -47,9 +47,6 @@ QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) #if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) // Disable MMX and SSE on Mac/PPC builds, or if the compiler @@ -103,6 +100,10 @@ QT_MODULE(Core) #include #endif +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + enum CPUFeatures { None = 0, MMX = 0x1, -- cgit v0.12 From 6ed01163b4de5e51f760b3627a6271796cbed212 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 4 Mar 2010 12:00:47 +1000 Subject: Cocoa namespace fixes. Reviewed-by: Rohan McGovern --- src/gui/kernel/qt_cocoa_helpers_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 9560952..c776b2a 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -373,7 +373,7 @@ QMacTabletHash *qt_mac_tablet_hash() // Clears the QWidget pointer that each QCocoaView holds. void qt_mac_clearCocoaViewQWidgetPointers(QWidget *widget) { - QCocoaView *cocoaView = reinterpret_cast(qt_mac_nativeview_for(widget)); + QT_MANGLE_NAMESPACE(QCocoaView) *cocoaView = reinterpret_cast(qt_mac_nativeview_for(widget)); if (cocoaView && [cocoaView respondsToSelector:@selector(qt_qwidget)]) { [cocoaView qt_clearQWidget]; } -- cgit v0.12 From 1cc9c745f09c3399aeccc0f9b8ca07bbbfaf143b Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 4 Mar 2010 12:01:06 +1000 Subject: Fix namespace qml decleration. Reviewed-by: Andrew den Exter --- src/plugins/qdeclarativemodules/multimedia/multimedia.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp index e03d8f3..a2e74f4 100644 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp +++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp @@ -47,11 +47,10 @@ #include "qdeclarativeaudio_p.h" +QML_DECLARE_TYPE(QSoundEffect) QT_BEGIN_NAMESPACE -QML_DECLARE_TYPE(QSoundEffect) - class QMultimediaDeclarativeModule : public QDeclarativeExtensionPlugin { Q_OBJECT -- cgit v0.12 From 1287332bfc1dfb85c59c309d9f2bf37b970013c9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 12:58:13 +1000 Subject: Document that the views do not set clip: true. Task-number: QT-2942 --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 5 +++++ src/declarative/graphicsitems/qdeclarativelistview.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 5b313be..7b97dcc 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -697,6 +697,11 @@ void QDeclarativeGridViewPrivate::updateCurrent(int modelIndex) In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. + + Note that views do not enabel \e clip automatically. If the view + is not clipped by another item or the screen, it will be necessary + to set \e {clip: true} in order to have the out of view items clipped + nicely. */ QDeclarativeGridView::QDeclarativeGridView(QDeclarativeItem *parent) : QDeclarativeFlickable(*(new QDeclarativeGridViewPrivate), parent) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index eb5315d..09f8162 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1359,6 +1359,11 @@ void QDeclarativeListViewPrivate::flickY(qreal velocity) In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. + + Note that views do not enabel \e clip automatically. If the view + is not clipped by another item or the screen, it will be necessary + to set \e {clip: true} in order to have the out of view items clipped + nicely. */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) -- cgit v0.12 From 08cf6561c4ad2288e385e63d941b60b268cc484e Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 13:05:17 +1000 Subject: Fix spelling. --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 +- src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 7b97dcc..a6f3d8f 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -698,7 +698,7 @@ void QDeclarativeGridViewPrivate::updateCurrent(int modelIndex) In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. - Note that views do not enabel \e clip automatically. If the view + Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped nicely. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 09f8162..a5da424 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1360,7 +1360,7 @@ void QDeclarativeListViewPrivate::flickY(qreal velocity) In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. - Note that views do not enabel \e clip automatically. If the view + Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped nicely. -- cgit v0.12 From afbfc2907b417034a98cf17f5787e0dfe467f737 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 13:29:37 +1000 Subject: Remove unnecessary additional hash of QDeclarativeGridViewAttached --- .../graphicsitems/qdeclarativegridview.cpp | 9 ++++----- .../graphicsitems/qdeclarativegridview_p.h | 19 +++---------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index a6f3d8f..b3c5577 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE -QHash QDeclarativeGridViewAttached::attachedProperties; - //---------------------------------------------------------------------------- @@ -61,8 +59,9 @@ class FxGridItem { public: FxGridItem(QDeclarativeItem *i, QDeclarativeGridView *v) : item(i), view(v) { - attached = QDeclarativeGridViewAttached::properties(item); - attached->m_view = view; + attached = static_cast(qmlAttachedPropertiesObject(item)); + if (attached) + attached->m_view = view; } ~FxGridItem() {} @@ -1748,7 +1747,7 @@ void QDeclarativeGridView::refill() QDeclarativeGridViewAttached *QDeclarativeGridView::qmlAttachedProperties(QObject *obj) { - return QDeclarativeGridViewAttached::properties(obj); + return new QDeclarativeGridViewAttached(obj); } QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index d463a46..22fcef6 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -167,9 +167,7 @@ class QDeclarativeGridViewAttached : public QObject public: QDeclarativeGridViewAttached(QObject *parent) : QObject(parent), m_isCurrent(false), m_delayRemove(false) {} - ~QDeclarativeGridViewAttached() { - attachedProperties.remove(parent()); - } + ~QDeclarativeGridViewAttached() {} Q_PROPERTY(QDeclarativeGridView *view READ view CONSTANT) QDeclarativeGridView *view() { return m_view; } @@ -192,15 +190,6 @@ public: } } - static QDeclarativeGridViewAttached *properties(QObject *obj) { - QDeclarativeGridViewAttached *rv = attachedProperties.value(obj); - if (!rv) { - rv = new QDeclarativeGridViewAttached(obj); - attachedProperties.insert(obj, rv); - } - return rv; - } - void emitAdd() { emit add(); } void emitRemove() { emit remove(); } @@ -212,10 +201,8 @@ Q_SIGNALS: public: QDeclarativeGridView *m_view; - bool m_isCurrent; - bool m_delayRemove; - - static QHash attachedProperties; + bool m_isCurrent : 1; + bool m_delayRemove : 1; }; -- cgit v0.12 From c425733907910ad04ed3abdefb5108d682858b12 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 4 Mar 2010 13:31:33 +1000 Subject: Fix tests failing due to javascript eval errors. --- .../qdeclarativeworkerscript/data/worker.qml | 4 ---- .../tst_qdeclarativeworkerscript.cpp | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml index bb4028f..1fce155 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -12,10 +12,6 @@ WorkerScript { worker.sendMessage(value) } - function testSendLiteral(value) { - eval('worker.sendMessage(' + value +')') - } - function compareLiteralResponse(expected) { var e = eval('(' + expected + ')') return worker.response == e diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 9957b50..27ecef4 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -48,9 +48,9 @@ #include #include +#include #include "../../../shared/util.h" -Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QScriptValue) class tst_QDeclarativeWorkerScript : public QObject @@ -86,13 +86,14 @@ void tst_QDeclarativeWorkerScript::source() QFETCH(QUrl, source); QFETCH(bool, valid); - QDeclarativeComponent component(&m_engine); - component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); - if (!valid) { QByteArray w = "WorkerScript: Cannot find source file \"" + source.toString().toUtf8() + "\""; QTest::ignoreMessage(QtWarningMsg, w.constData()); } + + QDeclarativeComponent component(&m_engine); + component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); + QDeclarativeWorkerScript *item = qobject_cast(component.create()); QVERIFY(item != 0); @@ -169,9 +170,15 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject() QDeclarativeWorkerScript *worker = qobject_cast(component.create()); QVERIFY(worker != 0); - QString jsObject = "{'spell power': 3101, 'haste': 1125}"; + QString jsObject = "{'name': 'zyz', 'spell power': 3101, 'haste': 1125}"; - QVERIFY(QMetaObject::invokeMethod(worker, "testSendLiteral", Q_ARG(QVariant, jsObject))); + QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(worker)); + QScriptValue sv = engine->newObject(); + sv.setProperty("name", "zyz"); + sv.setProperty("spell power", 3101); + sv.setProperty("haste", 1125); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(sv)))); waitForEchoMessage(worker); QVariant result = qVariantFromValue(false); @@ -185,4 +192,3 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject() QTEST_MAIN(tst_QDeclarativeWorkerScript) #include "tst_qdeclarativeworkerscript.moc" - -- cgit v0.12 From 8047d8f2e63df60b5ea3f6fd02568658c3d19fc6 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 14:39:18 +1000 Subject: Documented view behavior when items are removed from start of view. Task-number: QTBUG-7694 --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 12 ++++++++++++ src/declarative/graphicsitems/qdeclarativelistview.cpp | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index b3c5577..463b238 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1340,6 +1340,18 @@ void QDeclarativeGridView::moveCurrentIndexRight() } } +/*! + \qmlmethod GridView::positionViewAtIndex(int index) + + Positions the view such that the \a index is at the top (or left for horizontal orientation) of the view. + If positioning the view at the index would cause empty space to be displayed at + the end of the view, the view will be positioned at the end. + + It is not recommended to use contentX or contentY to position the view + at a particular index. This is unreliable since removing items from the start + of the list does not cause all other items to be repositioned. + The correct way to bring an item into view is with positionViewAtIndex. +*/ void QDeclarativeGridView::positionViewAtIndex(int index) { Q_D(QDeclarativeGridView); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index a5da424..32627da 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2286,6 +2286,12 @@ void QDeclarativeListView::decrementCurrentIndex() Positions the view such that the \a index is at the top (or left for horizontal orientation) of the view. If positioning the view at the index would cause empty space to be displayed at the end of the view, the view will be positioned at the end. + + It is not recommended to use contentX or contentY to position the view + at a particular index. This is unreliable since removing items from the start + of the list does not cause all other items to be repositioned, and because + the actual start of the view can vary based on the size of the delegates. + The correct way to bring an item into view is with positionViewAtIndex. */ void QDeclarativeListView::positionViewAtIndex(int index) { -- cgit v0.12 From eda079761194a96783cdb8d49c79eb2c9c0b7dac Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 4 Mar 2010 14:49:20 +1000 Subject: Compile without QVariant::EasingCurve in Qt 4.6.2. --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- src/declarative/qml/qdeclarativeenginedebug.cpp | 4 +-- .../qml/qdeclarativeobjectscriptclass.cpp | 2 +- src/declarative/qml/qdeclarativeproperty.cpp | 6 ++-- src/declarative/qml/qdeclarativevaluetype.cpp | 41 ++++++++++++++++++++++ src/declarative/qml/qdeclarativevaluetype_p.h | 9 ++++- src/declarative/util/qdeclarativeanimation.cpp | 8 +++-- 7 files changed, 61 insertions(+), 11 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 1eea012..b07a85a 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1792,7 +1792,7 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr if (prop->values.count()) COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler", "Invalid value in grouped property")); - if (prop->type < (int)QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType(prop->type)) { QDeclarativeEnginePrivate *ep = static_cast(QObjectPrivate::get(engine)); if (prop->type >= 0 /* QVariant == -1 */ && ep->valueTypes[prop->type]) { diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 09882cb..3e4acbe 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -117,7 +117,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) QVariant value = prop.read(obj); rv.value = valueContents(value); - if (QVariant::Type(prop.userType()) < QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType(prop.userType())) { rv.type = QDeclarativeObjectProperty::Basic; } else if (QDeclarativeMetaType::isQObject(prop.userType())) { rv.type = QDeclarativeObjectProperty::Object; @@ -131,7 +131,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) const { int userType = value.userType(); - if (QVariant::Type(userType) < QVariant::UserType) + if (QDeclarativeValueTypeFactory::isValueType(userType)) return value; /* diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 542f417..2e4ffa7 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -232,7 +232,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) QDeclarativeEnginePrivate::CapturedProperty(obj, lastData->coreIndex, lastData->notifyIndex); } - if ((uint)lastData->propType < QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType((uint)lastData->propType)) { QDeclarativeValueType *valueType = enginePriv->valueTypes[lastData->propType]; if (valueType) return Value(scriptEngine, enginePriv->valueTypeClass->newObject(obj, lastData->coreIndex, valueType)); diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 521c241..4f73b89 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -238,10 +238,10 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name if (property->flags & QDeclarativePropertyCache::Data::IsFunction) return; // Not an object property - if (ii == (path.count() - 2) && property->propType < (int)QVariant::UserType) { + if (ii == (path.count() - 2) && QDeclarativeValueTypeFactory::isValueType(property->propType)) { // We're now at a value type property. We can use a global valuetypes array as we // never actually use the objects, just look up their properties. - QObject *typeObject = qmlValueTypes()->valueTypes[property->propType]; + QObject *typeObject = (*qmlValueTypes())[property->propType]; if (!typeObject) return; // Not a value type int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData()); @@ -346,7 +346,7 @@ QDeclarativePropertyPrivate::propertyTypeCategory() const int type = propertyType(); if (type == QVariant::Invalid) return QDeclarativeProperty::InvalidCategory; - else if ((uint)type < QVariant::UserType) + else if (QDeclarativeValueTypeFactory::isValueType((uint)type)) return QDeclarativeProperty::Normal; else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) return QDeclarativeProperty::Object; diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index 01fa214..34d3795 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -45,19 +45,50 @@ QT_BEGIN_NAMESPACE +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) +Q_DECLARE_METATYPE(QEasingCurve); +#endif + QDeclarativeValueTypeFactory::QDeclarativeValueTypeFactory() { // ### Optimize for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii) valueTypes[ii] = valueType(ii); +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + easingType = qMetaTypeId(); + easingValueType = valueType(easingType); +#endif } QDeclarativeValueTypeFactory::~QDeclarativeValueTypeFactory() { for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii) delete valueTypes[ii]; +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + delete easingValueType; +#endif +} + +bool QDeclarativeValueTypeFactory::isValueType(int idx) +{ + if ((uint)idx < QVariant::UserType) + return true; +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + if (idx == qMetaTypeId()) + return true; +#endif + return false; } +QDeclarativeValueType *QDeclarativeValueTypeFactory::operator[](int idx) const +{ +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + if (idx == easingType) return easingValueType; +#endif + return valueTypes[idx]; +} + + QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t) { switch (t) { @@ -75,11 +106,17 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t) return new QDeclarativeRectFValueType; case QVariant::Vector3D: return new QDeclarativeVector3DValueType; +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) case QVariant::EasingCurve: return new QDeclarativeEasingValueType; +#endif case QVariant::Font: return new QDeclarativeFontValueType; default: +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + if (t == qMetaTypeId()) + return new QDeclarativeEasingValueType; +#endif return 0; } } @@ -495,7 +532,11 @@ void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativePrope QVariant QDeclarativeEasingValueType::value() { +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) return QVariant(easing); +#else + return QVariant::fromValue(easing); +#endif } void QDeclarativeEasingValueType::setValue(QVariant value) diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index cb153be..e69f161 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -81,10 +81,17 @@ class Q_DECLARATIVE_EXPORT QDeclarativeValueTypeFactory public: QDeclarativeValueTypeFactory(); ~QDeclarativeValueTypeFactory(); + static bool isValueType(int); static QDeclarativeValueType *valueType(int); + QDeclarativeValueType *operator[](int idx) const; + +private: QDeclarativeValueType *valueTypes[QVariant::UserType - 1]; - QDeclarativeValueType *operator[](int idx) const { return valueTypes[idx]; } +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + int easingType; + QDeclarativeValueType *easingValueType; +#endif }; class Q_AUTOTEST_EXPORT QDeclarativePointFValueType : public QDeclarativeValueType diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index b14de19..f33d7c7 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -1710,12 +1711,13 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int break; } default: - if ((uint)type >= QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType((uint)type)) { + variant.convert((QVariant::Type)type); + } else { QDeclarativeMetaType::StringConverter converter = QDeclarativeMetaType::customStringConverter(type); if (converter) variant = converter(variant.toString()); - } else - variant.convert((QVariant::Type)type); + } break; } } -- cgit v0.12 From c24280aef0962c4a45f9fa6c927b2df3a5f34245 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 4 Mar 2010 14:57:43 +1000 Subject: Added QMediaPlayer::StreamPlayback flag to query/select backend capable of playing from QIODevice based stream. --- src/multimedia/base/qmediaserviceprovider.cpp | 43 ++++++++++--- src/multimedia/base/qmediaserviceprovider.h | 3 +- src/multimedia/playback/qmediaplayer.cpp | 18 +++++- src/multimedia/playback/qmediaplayer.h | 3 +- .../tst_qmediaserviceprovider.cpp | 72 ++++++++++++++++++++++ 5 files changed, 125 insertions(+), 14 deletions(-) diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp index d51d682..6e11079 100644 --- a/src/multimedia/base/qmediaserviceprovider.cpp +++ b/src/multimedia/base/qmediaserviceprovider.cpp @@ -102,6 +102,9 @@ public: \value RecordingSupport The service provides audio or video recording functions. + + \value StreamPlayback + The service is capable of playing QIODevice based streams. */ /*! @@ -396,14 +399,25 @@ public: QMediaServiceSupportedFormatsInterface *iface = qobject_cast(obj); - //if low latency playback was asked, skip services known - //not to provide low latency playback - if (flags & QMediaPlayer::LowLatency) { + + if (flags) { QMediaServiceFeaturesInterface *iface = qobject_cast(obj); - if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback)) - continue; + if (iface) { + QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType); + + //if low latency playback was asked, skip services known + //not to provide low latency playback + if ((flags & QMediaPlayer::LowLatency) && + !(features & QMediaServiceProviderHint::LowLatencyPlayback)) + continue; + + //the same for QIODevice based streams support + if ((flags & QMediaPlayer::StreamPlayback) && + !(features & QMediaServiceProviderHint::StreamPlayback)) + continue; + } } if (iface) @@ -434,14 +448,25 @@ public: QMediaServiceSupportedFormatsInterface *iface = qobject_cast(obj); - // If low latency playback was asked for, skip MIME types from services known - // not to provide low latency playback + if (flags & QMediaPlayer::LowLatency) { QMediaServiceFeaturesInterface *iface = qobject_cast(obj); - if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback)) - continue; + if (iface) { + QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType); + + // If low latency playback was asked for, skip MIME types from services known + // not to provide low latency playback + if ((flags & QMediaPlayer::LowLatency) && + !(features & QMediaServiceProviderHint::LowLatencyPlayback)) + continue; + + //the same for QIODevice based streams support + if ((flags & QMediaPlayer::StreamPlayback) && + !(features & QMediaServiceProviderHint::StreamPlayback)) + continue; + } } if (iface) { diff --git a/src/multimedia/base/qmediaserviceprovider.h b/src/multimedia/base/qmediaserviceprovider.h index 2ee0ae4..6e31493 100644 --- a/src/multimedia/base/qmediaserviceprovider.h +++ b/src/multimedia/base/qmediaserviceprovider.h @@ -64,7 +64,8 @@ public: enum Feature { LowLatencyPlayback = 0x01, - RecordingSupport = 0x02 + RecordingSupport = 0x02, + StreamPlayback = 0x04 }; Q_DECLARE_FLAGS(Features, Feature) diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 27bff02..8056878 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -243,10 +243,17 @@ void QMediaPlayerPrivate::_q_playlistDestroyed() static QMediaService *playerService(QMediaPlayer::Flags flags, QMediaServiceProvider *provider) { - if (flags && QMediaPlayer::LowLatency) + if (flags) { + QMediaServiceProviderHint::Features features = 0; + if (flags & QMediaPlayer::LowLatency) + features |= QMediaServiceProviderHint::LowLatencyPlayback; + + if (flags & QMediaPlayer::StreamPlayback) + features |= QMediaServiceProviderHint::StreamPlayback; + return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER, - QMediaServiceProviderHint(QMediaServiceProviderHint::LowLatencyPlayback)); - else + QMediaServiceProviderHint(features)); + } else return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER); } @@ -945,6 +952,11 @@ QStringList QMediaPlayer::supportedMimeTypes(Flags flags) The player is expected to be used with simple audio formats, but playback should start without significant delay. Such playback service can be used for beeps, ringtones, etc. + + \value StreamPlayback + The player is expected to play QIODevice based streams. + If passed to QMediaPlayer constructor, the service supporting + streams playback will be choosen. */ QT_END_NAMESPACE diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h index 1b761ce..129b244 100644 --- a/src/multimedia/playback/qmediaplayer.h +++ b/src/multimedia/playback/qmediaplayer.h @@ -99,7 +99,8 @@ public: enum Flag { - LowLatency = 0x01 + LowLatency = 0x01, + StreamPlayback = 0x02 }; Q_DECLARE_FLAGS(Flags, Flag) diff --git a/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp b/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp index 9bca189..d839fe5 100644 --- a/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp +++ b/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp @@ -213,6 +213,57 @@ public: } }; +class MockServicePlugin4 : public QMediaServiceProviderPlugin, + public QMediaServiceSupportedFormatsInterface, + public QMediaServiceFeaturesInterface +{ + Q_OBJECT + Q_INTERFACES(QMediaServiceSupportedFormatsInterface) + Q_INTERFACES(QMediaServiceFeaturesInterface) +public: + QStringList keys() const + { + return QStringList() << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER); + } + + QMediaService* create(QString const& key) + { + if (keys().contains(key)) + return new MockMediaService("MockServicePlugin4"); + else + return 0; + } + + void release(QMediaService *service) + { + delete service; + } + + QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const + { + if (codecs.contains(QLatin1String("jpeg2000"))) + return QtMultimedia::NotSupported; + + if (supportedMimeTypes().contains(mimeType)) + return QtMultimedia::ProbablySupported; + + return QtMultimedia::MaybeSupported; + } + + QStringList supportedMimeTypes() const + { + return QStringList() << "video/mp4" << "video/quicktime"; + } + + QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const + { + if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)) + return QMediaServiceProviderHint::StreamPlayback; + else + return 0; + } +}; + class MockMediaServiceProvider : public QMediaServiceProvider @@ -253,6 +304,7 @@ void tst_QMediaServiceProvider::initTestCase() plugins << new MockServicePlugin1; plugins << new MockServicePlugin2; plugins << new MockServicePlugin3; + plugins << new MockServicePlugin4; QMediaPluginLoader::setStaticPlugins(QLatin1String("/mediaservices"), plugins); } @@ -312,12 +364,32 @@ void tst_QMediaServiceProvider::testHasSupport() QCOMPARE(QMediaPlayer::hasSupport("audio/ogg"), QtMultimedia::ProbablySupported); QCOMPARE(QMediaPlayer::hasSupport("audio/wav"), QtMultimedia::ProbablySupported); + //test low latency flag support + QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::LowLatency), + QtMultimedia::ProbablySupported); + //plugin1 probably supports audio/ogg, it checked because it doesn't provide features iface + QCOMPARE(QMediaPlayer::hasSupport("audio/ogg", QStringList(), QMediaPlayer::LowLatency), + QtMultimedia::ProbablySupported); + //Plugin4 is not checked here, sine it's known not support low latency + QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::LowLatency), + QtMultimedia::MaybeSupported); + + //test streaming flag support + QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::StreamPlayback), + QtMultimedia::ProbablySupported); + //Plugin2 is not checked here, sine it's known not support streaming + QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::StreamPlayback), + QtMultimedia::MaybeSupported); + //ensure the correct media player plugin is choosen for mime type QMediaPlayer simplePlayer(0, QMediaPlayer::LowLatency); QCOMPARE(simplePlayer.service()->objectName(), QLatin1String("MockServicePlugin2")); QMediaPlayer mediaPlayer; QVERIFY(mediaPlayer.service()->objectName() != QLatin1String("MockServicePlugin2")); + + QMediaPlayer streamPlayer(0, QMediaPlayer::StreamPlayback); + QCOMPARE(streamPlayer.service()->objectName(), QLatin1String("MockServicePlugin4")); } void tst_QMediaServiceProvider::testSupportedMimeTypes() -- cgit v0.12 From e86dc3cbc40824353688db52d9933af26a30aaa0 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 4 Mar 2010 15:19:09 +1000 Subject: QDeclarativeContext::contextProperty() should also access ids QT-2800 --- src/declarative/qml/qdeclarativecontext.cpp | 5 ++++- .../qdeclarativecontext/tst_qdeclarativecontext.cpp | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 35e7a77..f70e143 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -484,7 +484,10 @@ QVariant QDeclarativeContext::contextProperty(const QString &name) const if (!value.isValid() && parentContext()) value = parentContext()->contextProperty(name); } else { - value = d->propertyValues[idx]; + if (idx >= d->propertyValues.count()) + value = QVariant::fromValue(d->idValues[idx - d->propertyValues.count()].data()); + else + value = d->propertyValues[idx]; } return value; diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index 5f03989..f0117f5 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -60,6 +60,7 @@ private slots: void setContextProperty(); void addDefaultObject(); void destruction(); + void idAsContextProperty(); private: QDeclarativeEngine engine; @@ -429,6 +430,25 @@ void tst_qdeclarativecontext::destruction() QCOMPARE(ctxt, expr.context()); } +void tst_qdeclarativecontext::idAsContextProperty() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; QtObject { property var a; a: QtObject { id: myObject } }", QUrl()); + + QObject *obj = component.create(); + QVERIFY(obj); + + QVariant a = obj->property("a"); + QVERIFY(a.userType() == QMetaType::QObjectStar); + + QVariant ctxt = qmlContext(obj)->contextProperty("myObject"); + QVERIFY(ctxt.userType() == QMetaType::QObjectStar); + + QVERIFY(a == ctxt); + + delete obj; +} + QTEST_MAIN(tst_qdeclarativecontext) #include "tst_qdeclarativecontext.moc" -- cgit v0.12 From 0559b8d2af9f1f9277ff3bedd9a33cca7e255abb Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Mar 2010 13:54:23 +1000 Subject: Signal handler requires exactly one value. Don't crash on invalid "PropertyAnimation on onClicked" --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b07a85a..7a3dde9 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1342,7 +1342,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl } else { - if (prop->value || prop->values.count() > 1) + if (prop->value || prop->values.count() != 1) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Incorrectly specified signal")); prop->index = sigIdx; -- cgit v0.12 From 78254634c87f8e1b9c79841d87c530d3af8c9734 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Mar 2010 14:57:40 +1000 Subject: Add formatting functions to QML's global Qt object. The plan is for these to replace DateTimeFormatter. --- doc/src/declarative/globalobject.qdoc | 76 ++++++++++++++++++++++ src/declarative/qml/qdeclarativeengine.cpp | 65 ++++++++++++++++++ src/declarative/qml/qdeclarativeengine_p.h | 4 ++ .../declarative/qdeclarativeqt/data/formatting.qml | 19 ++++++ .../qdeclarativeqt/tst_qdeclarativeqt.cpp | 29 +++++++++ 5 files changed, 193 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeqt/data/formatting.qml diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index c718a6d..a8a07d2 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -87,6 +87,82 @@ This function returns a Point with the specified \c x and \c y coordinates. This function returns as Size with the specified \c width and \c height. \section3 Qt.vector3d(real x, real y, real z) This function returns a Vector3D with the specified \c x, \c y and \c z. + +\section2 Formatters +The Qt object contains several functions for formatting dates and times. + +\section3 Qt.formatDate(datetime date, variant format) +This function returns the string representation of \c date, formatted according to \c format. +\section3 Qt.formatTime(datetime time, variant format) +This function returns the string representation of \c time, formatted according to \c format. +\section3 Qt.formatDateTime(datetime dateTime, variant format) +This function returns the string representation of \c dateTime, formatted according to \c format. + +\c format for the above formatting functions can be specified as follows. + + These expressions may be used for the date: + + \table + \header \i Expression \i Output + \row \i d \i the day as number without a leading zero (1 to 31) + \row \i dd \i the day as number with a leading zero (01 to 31) + \row \i ddd + \i the abbreviated localized day name (e.g. 'Mon' to 'Sun'). + Uses QDate::shortDayName(). + \row \i dddd + \i the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). + Uses QDate::longDayName(). + \row \i M \i the month as number without a leading zero (1-12) + \row \i MM \i the month as number with a leading zero (01-12) + \row \i MMM + \i the abbreviated localized month name (e.g. 'Jan' to 'Dec'). + Uses QDate::shortMonthName(). + \row \i MMMM + \i the long localized month name (e.g. 'January' to 'December'). + Uses QDate::longMonthName(). + \row \i yy \i the year as two digit number (00-99) + \row \i yyyy \i the year as four digit number + \endtable + + These expressions may be used for the time: + + \table + \header \i Expression \i Output + \row \i h + \i the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display) + \row \i hh + \i the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) + \row \i m \i the minute without a leading zero (0 to 59) + \row \i mm \i the minute with a leading zero (00 to 59) + \row \i s \i the second without a leading zero (0 to 59) + \row \i ss \i the second with a leading zero (00 to 59) + \row \i z \i the milliseconds without leading zeroes (0 to 999) + \row \i zzz \i the milliseconds with leading zeroes (000 to 999) + \row \i AP + \i use AM/PM display. \e AP will be replaced by either "AM" or "PM". + \row \i ap + \i use am/pm display. \e ap will be replaced by either "am" or "pm". + \endtable + + All other input characters will be ignored. Any sequence of characters that + are enclosed in singlequotes will be treated as text and not be used as an + expression. Two consecutive singlequotes ("''") are replaced by a singlequote + in the output. + + Example format strings (assumed that the date and time is 21 May 2001 + 14:13:09): + + \table + \header \i Format \i Result + \row \i dd.MM.yyyy \i 21.05.2001 + \row \i ddd MMMM d yy \i Tue May 21 01 + \row \i hh:mm:ss.zzz \i 14:13:09.042 + \row \i h:m:s ap \i 2:13:9 pm + \endtable + +If no format is specified the locale's short format is used. Alternatively, you can specify +\c Qt.DefaultLocaleLongDate to get the locale's long format. + \section2 Functions The Qt object also contains the following miscellaneous functions which expose Qt functionality for use in QML. diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index bd67b0b..20bbf86 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -236,6 +236,11 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr qtObject.setProperty(QLatin1String("tint"), newFunction(QDeclarativeEnginePrivate::tint, 2)); } + //date/time formatting + qtObject.setProperty(QLatin1String("formatDate"),newFunction(QDeclarativeEnginePrivate::formatDate, 2)); + qtObject.setProperty(QLatin1String("formatTime"),newFunction(QDeclarativeEnginePrivate::formatTime, 2)); + qtObject.setProperty(QLatin1String("formatDateTime"),newFunction(QDeclarativeEnginePrivate::formatDateTime, 2)); + //misc methods qtObject.setProperty(QLatin1String("closestAngle"), newFunction(QDeclarativeEnginePrivate::closestAngle, 2)); qtObject.setProperty(QLatin1String("playSound"), newFunction(QDeclarativeEnginePrivate::playSound, 1)); @@ -936,6 +941,66 @@ QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngi return engine->newVariant(qVariantFromValue(QVector3D(x, y, z))); } +QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptEngine*engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount == 0 || argCount > 2) + return engine->nullValue(); + + QDate date = ctxt->argument(0).toDateTime().date(); + Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate; + if (argCount == 2) { + if (ctxt->argument(1).isString()) { + QString format = ctxt->argument(1).toString(); + return engine->newVariant(qVariantFromValue(date.toString(format))); + } else if (ctxt->argument(1).isNumber()) { + enumFormat = Qt::DateFormat(ctxt->argument(1).toInteger()); + } else + return engine->nullValue(); + } + return engine->newVariant(qVariantFromValue(date.toString(enumFormat))); +} + +QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptEngine*engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount == 0 || argCount > 2) + return engine->nullValue(); + + QTime date = ctxt->argument(0).toDateTime().time(); + Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate; + if (argCount == 2) { + if (ctxt->argument(1).isString()) { + QString format = ctxt->argument(1).toString(); + return engine->newVariant(qVariantFromValue(date.toString(format))); + } else if (ctxt->argument(1).isNumber()) { + enumFormat = Qt::DateFormat(ctxt->argument(1).toInteger()); + } else + return engine->nullValue(); + } + return engine->newVariant(qVariantFromValue(date.toString(enumFormat))); +} + +QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScriptEngine*engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount == 0 || argCount > 2) + return engine->nullValue(); + + QDateTime date = ctxt->argument(0).toDateTime(); + Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate; + if (argCount == 2) { + if (ctxt->argument(1).isString()) { + QString format = ctxt->argument(1).toString(); + return engine->newVariant(qVariantFromValue(date.toString(format))); + } else if (ctxt->argument(1).isNumber()) { + enumFormat = Qt::DateFormat(ctxt->argument(1).toInteger()); + } else + return engine->nullValue(); + } + return engine->newVariant(qVariantFromValue(date.toString(enumFormat))); +} + QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine) { int argCount = ctxt->argumentCount(); diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index d3eb583..a9ba73a 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -327,6 +327,10 @@ public: static QScriptValue consoleLog(QScriptContext*, QScriptEngine*); static QScriptValue quit(QScriptContext*, QScriptEngine*); + static QScriptValue formatDate(QScriptContext*, QScriptEngine*); + static QScriptValue formatTime(QScriptContext*, QScriptEngine*); + static QScriptValue formatDateTime(QScriptContext*, QScriptEngine*); + static QScriptEngine *getScriptEngine(QDeclarativeEngine *e) { return &e->d_func()->scriptEngine; } static QDeclarativeEngine *getEngine(QScriptEngine *e) { return static_cast(e)->p->q_func(); } static QDeclarativeEnginePrivate *get(QDeclarativeEngine *e) { return e->d_func(); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml new file mode 100644 index 0000000..e62749a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml @@ -0,0 +1,19 @@ +import Qt 4.6 + +QtObject { + property date date1: "2008-12-24" + property string test1: Qt.formatDate(date1) + property string test2: Qt.formatDate(date1, Qt.DefaultLocaleLongDate) + property string test3: Qt.formatDate(date1, "ddd MMMM d yy") + + property var time1: new Date(0,0,0,14,15,38,200) + property string test4: Qt.formatTime(time1) + property string test5: Qt.formatTime(time1, Qt.DefaultLocaleLongDate) + property string test6: Qt.formatTime(time1, "H:m:s a") + property string test7: Qt.formatTime(time1, "hh:mm:ss.zzz") + + property var dateTime1: new Date(1978,2,4,9,13,54) + property string test8: Qt.formatDateTime(dateTime1) + property string test9: Qt.formatDateTime(dateTime1, Qt.DefaultLocaleLongDate) + property string test10: Qt.formatDateTime(dateTime1, "M/d/yy H:m:s a") +} diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 9ec6872..484cbd4 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -73,6 +73,7 @@ private slots: void createComponent(); void createQmlObject(); void consoleLog(); + void formatting(); private: QDeclarativeEngine engine; @@ -364,6 +365,34 @@ void tst_qdeclarativeqt::consoleLog() delete object; } +void tst_qdeclarativeqt::formatting() +{ + QDeclarativeComponent component(&engine, TEST_FILE("formatting.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QDate date1(2008,12,24); + QCOMPARE(object->property("date1").toDate(), date1); + QCOMPARE(object->property("test1").toString(), date1.toString(Qt::DefaultLocaleShortDate)); + QCOMPARE(object->property("test2").toString(), date1.toString(Qt::DefaultLocaleLongDate)); + QCOMPARE(object->property("test3").toString(), date1.toString("ddd MMMM d yy")); + + QTime time1(14,15,38,200); + QCOMPARE(object->property("time1").toTime(), time1); + QCOMPARE(object->property("test4").toString(), time1.toString(Qt::DefaultLocaleShortDate)); + QCOMPARE(object->property("test5").toString(), time1.toString(Qt::DefaultLocaleLongDate)); + QCOMPARE(object->property("test6").toString(), time1.toString("H:m:s a")); + QCOMPARE(object->property("test7").toString(), time1.toString("hh:mm:ss.zzz")); + + QDateTime dateTime1(QDate(1978,03,04),QTime(9,13,54)); + QCOMPARE(object->property("dateTime1").toDateTime(),dateTime1); + QCOMPARE(object->property("test8").toString(), dateTime1.toString(Qt::DefaultLocaleShortDate)); + QCOMPARE(object->property("test9").toString(), dateTime1.toString(Qt::DefaultLocaleLongDate)); + QCOMPARE(object->property("test10").toString(), dateTime1.toString("M/d/yy H:m:s a")); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeqt) #include "tst_qdeclarativeqt.moc" -- cgit v0.12 From ce5b682b481e2da6fe12e2c57c4780edbfb2fb54 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Mar 2010 15:19:45 +1000 Subject: Remove Qt.playSound() Use SoundEffect instead. --- doc/src/declarative/globalobject.qdoc | 3 --- examples/declarative/tvtennis/tvtennis.qml | 12 +++++++---- src/declarative/QmlChanges.txt | 1 + src/declarative/qml/qdeclarativeengine.cpp | 25 ---------------------- src/declarative/qml/qdeclarativeengine_p.h | 1 - .../qdeclarativeqt/tst_qdeclarativeqt.cpp | 7 ------ 6 files changed, 9 insertions(+), 40 deletions(-) diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index a8a07d2..4b1c7d3 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -195,9 +195,6 @@ while the following would rotate myItem clockwise from 350 degrees to 370 degree NumberAnimation { target: myItem; property: "rotation"; from: 350; to: Qt.closetAngle(350, 10) } \endqml -\section3 Qt.playSound(url soundLocation) -This function plays the audio file located at \c soundLocation. Only .wav files are supported. - \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/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index 1585c7b..6022a15 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.multimedia 4.7 Rectangle { id: page @@ -15,14 +16,17 @@ Rectangle { color: "Lime" x: 20; width: 20; height: 20; z: 1 + SoundEffect { id: paddle; source: "paddle.wav" } + SoundEffect { id: wall; source: "click.wav" } + // Move the ball to the right and back to the left repeatedly SequentialAnimation on x { repeat: true NumberAnimation { to: page.width - 40; duration: 2000 } - ScriptAction { script: Qt.playSound('paddle.wav') } + ScriptAction { script: paddle.play() } PropertyAction { target: ball; property: "direction"; value: "left" } NumberAnimation { to: 20; duration: 2000 } - ScriptAction { script: Qt.playSound('paddle.wav') } + ScriptAction { script: paddle.play() } PropertyAction { target: ball; property: "direction"; value: "right" } } @@ -32,10 +36,10 @@ Rectangle { // Detect the ball hitting the top or bottom of the view and bounce it onYChanged: { if (y <= 0) { - Qt.playSound('click.wav'); + wall.play(); targetY = page.height - 20; } else if (y >= page.height - 20) { - Qt.playSound('click.wav'); + wall.play(); targetY = 0; } } diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 4951cb3..6e77abf 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -6,6 +6,7 @@ Flickable: renamed viewportHeight -> contentHeight Flickable: renamed viewportX -> contentX Flickable: renamed viewportY -> contentY Removed Flickable.reportedVelocitySmoothing +Removed Qt.playSound (replaced by SoundEffect element) Renamed MouseRegion -> MouseArea Connection: syntax and rename: Connection { sender: a; signal: foo(); script: xxx } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 20bbf86..1711cf1 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -243,7 +243,6 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr //misc methods qtObject.setProperty(QLatin1String("closestAngle"), newFunction(QDeclarativeEnginePrivate::closestAngle, 2)); - qtObject.setProperty(QLatin1String("playSound"), newFunction(QDeclarativeEnginePrivate::playSound, 1)); qtObject.setProperty(QLatin1String("openUrlExternally"),newFunction(QDeclarativeEnginePrivate::desktopOpenUrl, 1)); qtObject.setProperty(QLatin1String("md5"),newFunction(QDeclarativeEnginePrivate::md5, 1)); qtObject.setProperty(QLatin1String("btoa"),newFunction(QDeclarativeEnginePrivate::btoa, 1)); @@ -1105,30 +1104,6 @@ QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngi return qScriptValueFromValue(engine, qVariantFromValue(color)); } -QScriptValue QDeclarativeEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *engine) -{ - if (ctxt->argumentCount() != 1) - return engine->undefinedValue(); - - QUrl url(ctxt->argument(0).toString()); - - QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); - if (url.isRelative()) { - QDeclarativeContext *context = enginePriv->getContext(ctxt); - if (!context) - return engine->undefinedValue(); - - url = context->resolvedUrl(url); - } - - if (url.scheme() == QLatin1String("file")) { - - QSound::play(url.toLocalFile()); - - } - return engine->undefinedValue(); -} - QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e) { if(ctxt->argumentCount() < 1) diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index a9ba73a..459a325 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -319,7 +319,6 @@ public: static QScriptValue tint(QScriptContext*, QScriptEngine*); static QScriptValue closestAngle(QScriptContext*, QScriptEngine*); - static QScriptValue playSound(QScriptContext*, QScriptEngine*); static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*); static QScriptValue md5(QScriptContext*, QScriptEngine*); static QScriptValue btoa(QScriptContext*, QScriptEngine*); diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 484cbd4..90afd4e 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -67,7 +67,6 @@ private slots: void darker(); void tint(); void closestAngle(); - void playSound(); void openUrlExternally(); void md5(); void createComponent(); @@ -280,12 +279,6 @@ void tst_qdeclarativeqt::closestAngle() delete object; } -void tst_qdeclarativeqt::playSound() -{ - QEXPECT_FAIL("", "How do we test this?", Abort); - QVERIFY(false); -} - void tst_qdeclarativeqt::openUrlExternally() { QEXPECT_FAIL("", "How do we test this?", Abort); -- cgit v0.12 From 84709f178dde24d4926f0222b6ce0ab692eeba67 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 15:29:43 +1000 Subject: Fix ListView contentHeight calculation. Task-number: QT-2630 --- src/declarative/graphicsitems/qdeclarativelistview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 32627da..18d3661 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -223,7 +223,7 @@ public: if (!visibleItems.isEmpty()) { pos = (*visibleItems.constBegin())->position(); if (visibleIndex > 0) - pos -= visibleIndex * (averageSize + spacing) - spacing; + pos -= visibleIndex * (averageSize + spacing); } return pos; } @@ -2414,7 +2414,8 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) int i = d->visibleItems.count() - 1; while (i > 0 && d->visibleItems.at(i)->index == -1) --i; - if (d->visibleItems.at(i)->index + 1 == modelIndex) { + if (d->visibleItems.at(i)->index + 1 == modelIndex + && d->visibleItems.at(i)->endPosition() < d->buffer+d->position()+d->size()-1) { // Special case of appending an item to the model. modelIndex = d->visibleIndex + d->visibleItems.count(); } else { -- cgit v0.12 From 5599ddd113fe1385e7a6aff708e12af419b8de87 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 15:41:00 +1000 Subject: Don't mess with highlight size if highlightFollowsCurrentItem is false. Task-number: QT-2630 --- src/declarative/graphicsitems/qdeclarativelistview.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 18d3661..cd8d143 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -799,10 +799,13 @@ void QDeclarativeListViewPrivate::createHighlight() if (item) { item->setParent(q->viewport()); highlight = new FxListItem(item, q); - if (orient == QDeclarativeListView::Vertical) - highlight->item->setHeight(currentItem->item->height()); - else - highlight->item->setWidth(currentItem->item->width()); + if (currentItem && autoHighlight) { + if (orient == QDeclarativeListView::Vertical) { + highlight->item->setHeight(currentItem->item->height()); + } else { + highlight->item->setWidth(currentItem->item->width()); + } + } const QLatin1String posProp(orient == QDeclarativeListView::Vertical ? "y" : "x"); highlightPosAnimator = new QDeclarativeEaseFollow(q); highlightPosAnimator->setTarget(QDeclarativeProperty(highlight->item, posProp)); -- cgit v0.12 From 57d68b06c15f8426c25e357f97b9154056969e0f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 4 Mar 2010 16:04:15 +1000 Subject: Improve grouped property error messages QT-2579 --- src/declarative/qml/qdeclarativecompiler.cpp | 15 ++++++++++++--- src/declarative/qml/qdeclarativeparser.cpp | 4 ++-- src/declarative/qml/qdeclarativeparser_p.h | 7 ++++++- src/declarative/qml/qdeclarativescriptparser.cpp | 4 ++-- .../qdeclarativelanguage/data/defaultGrouped.errors.txt | 2 +- .../data/invalidGroupedProperty.10.errors.txt | 1 + .../data/invalidGroupedProperty.10.qml | 7 +++++++ .../data/invalidGroupedProperty.8.errors.txt | 1 + .../data/invalidGroupedProperty.8.qml | 6 ++++++ .../data/invalidGroupedProperty.9.errors.txt | 1 + .../data/invalidGroupedProperty.9.qml | 6 ++++++ .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 3 +++ 12 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 7a3dde9..32c746f 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1789,13 +1789,19 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr Q_ASSERT(prop->type != 0); Q_ASSERT(prop->index != -1); - if (prop->values.count()) - COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler", "Invalid value in grouped property")); - if (QDeclarativeValueTypeFactory::isValueType(prop->type)) { QDeclarativeEnginePrivate *ep = static_cast(QObjectPrivate::get(engine)); if (prop->type >= 0 /* QVariant == -1 */ && ep->valueTypes[prop->type]) { + + if (prop->values.count()) { + if (prop->values.at(0)->location < prop->value->location) { + COMPILE_EXCEPTION(prop->value, QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value")); + } else { + COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value")); + } + } + COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type], prop->value, obj, ctxt.incr())); obj->addValueTypeProperty(prop); @@ -1810,6 +1816,9 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr if (!prop->value->metatype) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid grouped property access")); + if (prop->values.count()) + COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Cannot assign a value directly to a grouped property")); + obj->addGroupedProperty(prop); COMPILE_CHECK(buildSubObject(prop->value, ctxt.incr())); diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp index 0e3d856..b0599ad 100644 --- a/src/declarative/qml/qdeclarativeparser.cpp +++ b/src/declarative/qml/qdeclarativeparser.cpp @@ -226,9 +226,9 @@ QDeclarativeParser::Property::~Property() if (value) value->release(); } -Object *QDeclarativeParser::Property::getValue() +Object *QDeclarativeParser::Property::getValue(const LocationSpan &l) { - if (!value) value = new Object; + if (!value) { value = new Object; value->location = l; } return value; } diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index d0d7de1..5bf4b68 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -104,6 +104,11 @@ namespace QDeclarativeParser Location start; Location end; LocationRange range; + + bool operator<(LocationSpan &o) const { + return (start.line < o.start.line) || + (start.line == o.start.line && start.column < o.start.column); + } }; class Property; @@ -318,7 +323,7 @@ namespace QDeclarativeParser // The Object to which this property is attached Object *parent; - Object *getValue(); + Object *getValue(const LocationSpan &); void addValue(Value *v); void addOnValue(Value *v); diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index a4b3668..fe516c5 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -85,8 +85,8 @@ class ProcessAST: protected AST::Visitor { const State &state = top(); if (state.property) { - State s(state.property->getValue(), - state.property->getValue()->getProperty(name.toUtf8())); + State s(state.property->getValue(location), + state.property->getValue(location)->getProperty(name.toUtf8())); s.property->location = location; push(s); } else { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt index 945d51b..32055f6 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt @@ -1 +1 @@ -7:9:Invalid value in grouped property +7:9:Cannot assign a value directly to a grouped property diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt new file mode 100644 index 0000000..1fcb1b6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.errors.txt @@ -0,0 +1 @@ +4:14:Cannot assign a value directly to a grouped property diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml new file mode 100644 index 0000000..41aa3e2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.10.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + grouped: "10x10" + grouped.value: 10 +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt new file mode 100644 index 0000000..fa0da21 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.errors.txt @@ -0,0 +1 @@ +5:19:Property has already been assigned a value diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml new file mode 100644 index 0000000..56fca9b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.8.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + pointProperty: "10x10" + pointProperty.x: 10 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt new file mode 100644 index 0000000..6d837a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.errors.txt @@ -0,0 +1 @@ +5:20:Property has already been assigned a value diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml new file mode 100644 index 0000000..982ab26 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.9.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + pointProperty.x: 10 + pointProperty: "10x10" +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 5d480fa..28daf29 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -255,6 +255,9 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidGroupedProperty.5") << "invalidGroupedProperty.5.qml" << "invalidGroupedProperty.5.errors.txt" << false; QTest::newRow("invalidGroupedProperty.6") << "invalidGroupedProperty.6.qml" << "invalidGroupedProperty.6.errors.txt" << false; QTest::newRow("invalidGroupedProperty.7") << "invalidGroupedProperty.7.qml" << "invalidGroupedProperty.7.errors.txt" << true; + QTest::newRow("invalidGroupedProperty.8") << "invalidGroupedProperty.8.qml" << "invalidGroupedProperty.8.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.9") << "invalidGroupedProperty.9.qml" << "invalidGroupedProperty.9.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.10") << "invalidGroupedProperty.10.qml" << "invalidGroupedProperty.10.errors.txt" << false; QTest::newRow("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false; QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false; -- cgit v0.12 From c329db551237906cc659f3276c679d0e573edff2 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 4 Mar 2010 16:31:06 +1000 Subject: Fix grammar stringifying "on" as "readonly" QTBUG-8676 --- src/declarative/qml/parser/qdeclarativejs.g | 2 +- src/declarative/qml/parser/qdeclarativejsgrammar.cpp | 2 +- src/declarative/qml/parser/qdeclarativejsgrammar_p.h | 4 ++-- src/declarative/qml/parser/qdeclarativejsparser.cpp | 2 +- .../qdeclarativelanguage/data/customOnProperty.qml | 7 +++++++ .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 15 +++++++++++++++ 6 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index 7cf81b2..493ad25 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -1020,7 +1020,7 @@ case $rule_number: { JsIdentifier: T_ON ; /. case $rule_number: { - QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); + QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_ON]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp index 0677bc5..89493ff 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp +++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h index 2b2e3d1..32bb12b 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h +++ b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeJSGrammar { public: - enum { + enum VariousConstants { EOF_SYMBOL = 0, REDUCE_HERE = 100, SHIFT_THERE = 99, diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index fd9e690..c86e047 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -516,7 +516,7 @@ case 66: { } case 67: { - QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); + QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_ON]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml new file mode 100644 index 0000000..7cd6a83 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml @@ -0,0 +1,7 @@ +import Qt 4.6 + +QtObject { + property int on + + Component.onCompleted: on = 10 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 28daf29..a339a6d 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -128,6 +128,8 @@ private slots: void qmlAttachedPropertiesObjectMethod(); + void customOnProperty(); + // regression tests for crashes void crash1(); void crash2(); @@ -1397,6 +1399,19 @@ void tst_qdeclarativelanguage::crash2() QDeclarativeComponent component(&engine, TEST_FILE("crash2.qml")); } +// QTBUG-8676 +void tst_qdeclarativelanguage::customOnProperty() +{ + QDeclarativeComponent component(&engine, TEST_FILE("customOnProperty.qml")); + + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("on").toInt(), 10); + + delete object; +} void tst_qdeclarativelanguage::initTestCase() { -- cgit v0.12 From ff40702d547088266a09adb2d1b5d9a270334d21 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 16:54:38 +1000 Subject: Move the multimedia files to the correct place. --- src/imports/multimedia/qdeclarativeaudio.cpp | 327 +++++++ src/imports/multimedia/qdeclarativeaudio_p.h | 173 ++++ src/imports/multimedia/qdeclarativemediabase.cpp | 413 +++++++++ src/imports/multimedia/qdeclarativemediabase_p.h | 168 ++++ src/imports/multimedia/qdeclarativevideo.cpp | 945 +++++++++++++++++++++ src/imports/multimedia/qdeclarativevideo_p.h | 204 +++++ .../multimedia/qmetadatacontrolmetaobject.cpp | 362 ++++++++ .../multimedia/qmetadatacontrolmetaobject_p.h | 92 ++ .../multimedia/qdeclarativeaudio.cpp | 327 ------- .../multimedia/qdeclarativeaudio_p.h | 173 ---- .../multimedia/qdeclarativemediabase.cpp | 413 --------- .../multimedia/qdeclarativemediabase_p.h | 168 ---- .../multimedia/qdeclarativevideo.cpp | 945 --------------------- .../multimedia/qdeclarativevideo_p.h | 204 ----- .../multimedia/qmetadatacontrolmetaobject.cpp | 362 -------- .../multimedia/qmetadatacontrolmetaobject_p.h | 92 -- 16 files changed, 2684 insertions(+), 2684 deletions(-) create mode 100644 src/imports/multimedia/qdeclarativeaudio.cpp create mode 100644 src/imports/multimedia/qdeclarativeaudio_p.h create mode 100644 src/imports/multimedia/qdeclarativemediabase.cpp create mode 100644 src/imports/multimedia/qdeclarativemediabase_p.h create mode 100644 src/imports/multimedia/qdeclarativevideo.cpp create mode 100644 src/imports/multimedia/qdeclarativevideo_p.h create mode 100644 src/imports/multimedia/qmetadatacontrolmetaobject.cpp create mode 100644 src/imports/multimedia/qmetadatacontrolmetaobject_p.h delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp delete mode 100644 src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp new file mode 100644 index 0000000..df2888c --- /dev/null +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -0,0 +1,327 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativeaudio_p.h" + +#include + +QT_BEGIN_NAMESPACE + + +/*! + \qmlclass Audio QDeclarativeAudio + \since 4.7 + \brief The Audio element allows you to add audio playback to a scene. + + \qml + Audio { source: "audio/song.mp3" } + \endqml + + \sa Video +*/ + +/*! + \internal + \class QDeclarativeAudio + \brief The QDeclarativeAudio class provides an audio item that you can add to a QDeclarativeView. +*/ + +void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString) +{ + m_error = QMediaPlayer::Error(errorCode); + m_errorString = errorString; + + emit error(Error(errorCode), errorString); + emit errorChanged(); +} + + +QDeclarativeAudio::QDeclarativeAudio(QObject *parent) + : QObject(parent) +{ + setObject(this); +} + +QDeclarativeAudio::~QDeclarativeAudio() +{ + shutdown(); +} + +/*! + \qmlmethod Audio::play() + + Starts playback of the media. + + Sets the \l playing property to true, and the \l paused property to false. +*/ + +void QDeclarativeAudio::play() +{ + m_playerControl->play(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Audio::pause() + + Pauses playback of the media. + + Sets the \l playing and \l paused properties to true. +*/ + +void QDeclarativeAudio::pause() +{ + m_playerControl->pause(); + + if (!m_paused && m_state == QMediaPlayer::PausedState) { + m_paused = true; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Audio::stop() + + Stops playback of the media. + + Sets the \l playing and \l paused properties to false. +*/ + +void QDeclarativeAudio::stop() +{ + m_playerControl->stop(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +/*! + \qmlproperty url Audio::source + + This property holds the source URL of the media. +*/ + +/*! + \qmlproperty bool Audio::playing + + This property holds whether the media is playing. + + Defaults to false, and can be set to true to start playback. +*/ + +/*! + \qmlproperty bool Audio::paused + + This property holds whether the media is paused. + + Defaults to false, and can be set to true to pause playback. +*/ + +/*! + \qmlsignal Audio::onStarted() + + This handler is called when playback is started. +*/ + +/*! + \qmlsignal Audio::onResumed() + + This handler is called when playback is resumed from the paused state. +*/ + +/*! + \qmlsignal Audio::onPaused() + + This handler is called when playback is paused. +*/ + +/*! + \qmlsignal Audio::onStopped() + + This handler is called when playback is stopped. +*/ + +/*! + \qmlproperty enum Audio::status + + This property holds the status of media loading. It can be one of: + + \list + \o NoMedia - no media has been set. + \o Loading - the media is currently being loaded. + \o Loaded - the media has been loaded. + \o Buffering - the media is buffering data. + \o Stalled - playback has been interrupted while the media is buffering data. + \o Buffered - the media has buffered data. + \o EndOfMedia - the media has played to the end. + \o InvalidMedia - the media cannot be played. + \o UnknownStatus - the status of the media is unknown. + \endlist +*/ + +QDeclarativeAudio::Status QDeclarativeAudio::status() const +{ + return Status(m_status); +} + +/*! + \qmlsignal Audio::onLoaded() + + This handler is called when the media source has been loaded. +*/ + +/*! + \qmlsignal Audio::onBuffering() + + This handler is called when the media starts buffering. +*/ + +/*! + \qmlsignal Audio::onStalled() + + This handler is called when playback has stalled while the media buffers. +*/ + +/*! + \qmlsignal Audio::onBuffered() + + This handler is called when the media has finished buffering. +*/ + +/*! + \qmlsignal Audio::onEndOfMedia() + + This handler is called when playback stops because end of the media has been reached. +*/ +/*! + \qmlproperty int Audio::duration + + This property holds the duration of the media in milliseconds. + + If the media doesn't have a fixed duration (a live stream for example) this will be 0. +*/ + +/*! + \qmlproperty int Audio::position + + This property holds the current playback position in milliseconds. + + If the \l seekable property is true, this property can be set to seek to a new position. +*/ + +/*! + \qmlproperty qreal Audio::volume + + This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). +*/ + +/*! + \qmlproperty bool Audio::muted + + This property holds whether the audio output is muted. +*/ + +/*! + \qmlproperty qreal Audio::bufferProgress + + This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 + (full). +*/ + +/*! + \qmlproperty bool Audio::seekable + + This property holds whether position of the audio can be changed. + + If true; setting a \l position value will cause playback to seek to the new position. +*/ + +/*! + \qmlproperty qreal Audio::playbackRate + + This property holds the rate at which audio is played at as a multiple of the normal rate. +*/ + +/*! + \qmlproperty enum Audio::error + + This property holds the error state of the audio. It can be one of: + + \list + \o NoError - there is no current error. + \o ResourceError - the audio cannot be played due to a problem allocating resources. + \o FormatError - the audio format is not supported. + \o NetworkError - the audio cannot be played due to network issues. + \o AccessDenied - the audio cannot be played due to insufficient permissions. + \o ServiceMissing - the audio cannot be played because the media service could not be + instantiated. + \endlist +*/ + +QDeclarativeAudio::Error QDeclarativeAudio::error() const +{ + return Error(m_error); +} + +/*! + \qmlproperty string Audio::errorString + + This property holds a string describing the current error condition in more detail. +*/ + +/*! + \qmlsignal Audio::onError(error, errorString) + + This handler is called when an \l {Error}{error} has occurred. The errorString parameter + may contain more detailed information about the error. +*/ + +QT_END_NAMESPACE + +#include "moc_qdeclarativeaudio_p.cpp" + + diff --git a/src/imports/multimedia/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h new file mode 100644 index 0000000..9881dbc --- /dev/null +++ b/src/imports/multimedia/qdeclarativeaudio_p.h @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEAUDIO_P_H +#define QDECLARATIVEAUDIO_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qdeclarativemediabase_p.h" + +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QTimerEvent; + +class QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus +{ + Q_OBJECT + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) + Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(int duration READ duration NOTIFY durationChanged) + Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) + Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) + Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) + Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) + Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) + Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) + Q_PROPERTY(Error error READ error NOTIFY errorChanged) + Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) + Q_ENUMS(Status) + Q_ENUMS(Error) + Q_INTERFACES(QDeclarativeParserStatus) +public: + enum Status + { + UnknownStatus = QMediaPlayer::UnknownMediaStatus, + NoMedia = QMediaPlayer::NoMedia, + Loading = QMediaPlayer::LoadingMedia, + Loaded = QMediaPlayer::LoadedMedia, + Stalled = QMediaPlayer::StalledMedia, + Buffering = QMediaPlayer::BufferingMedia, + Buffered = QMediaPlayer::BufferedMedia, + EndOfMedia = QMediaPlayer::EndOfMedia, + InvalidMedia = QMediaPlayer::InvalidMedia + }; + + enum Error + { + NoError = QMediaPlayer::NoError, + ResourceError = QMediaPlayer::ResourceError, + FormatError = QMediaPlayer::FormatError, + NetworkError = QMediaPlayer::NetworkError, + AccessDenied = QMediaPlayer::AccessDeniedError, + ServiceMissing = QMediaPlayer::ServiceMissingError + }; + + QDeclarativeAudio(QObject *parent = 0); + ~QDeclarativeAudio(); + + Status status() const; + Error error() const; + +public Q_SLOTS: + void play(); + void pause(); + void stop(); + +Q_SIGNALS: + void sourceChanged(); + + void playingChanged(); + void pausedChanged(); + + void started(); + void resumed(); + void paused(); + void stopped(); + + void statusChanged(); + + void loaded(); + void buffering(); + void stalled(); + void buffered(); + void endOfMedia(); + + void durationChanged(); + void positionChanged(); + + void volumeChanged(); + void mutedChanged(); + + void bufferProgressChanged(); + + void seekableChanged(); + void playbackRateChanged(); + + void errorChanged(); + void error(QDeclarativeAudio::Error error, const QString &errorString); + +private Q_SLOTS: + void _q_error(int, const QString &); + +private: + Q_DISABLE_COPY(QDeclarativeAudio) + Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) + Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) + Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) + + inline QDeclarativeMediaBase *mediaBase() { return this; } +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio)) + +QT_END_HEADER + +#endif diff --git a/src/imports/multimedia/qdeclarativemediabase.cpp b/src/imports/multimedia/qdeclarativemediabase.cpp new file mode 100644 index 0000000..8e87e44 --- /dev/null +++ b/src/imports/multimedia/qdeclarativemediabase.cpp @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativemediabase_p.h" + +#include +#include + +#include +#include +#include +#include +#include "qmetadatacontrolmetaobject_p.h" + + + +QT_BEGIN_NAMESPACE + + +class QDeclarativeMediaBaseObject : public QMediaObject +{ +public: + QDeclarativeMediaBaseObject(QMediaService *service) + : QMediaObject(0, service) + { + } +}; + +class QDeclarativeMediaBasePlayerControl : public QMediaPlayerControl +{ +public: + QDeclarativeMediaBasePlayerControl(QObject *parent) + : QMediaPlayerControl(parent) + { + } + + QMediaPlayer::State state() const { return QMediaPlayer::StoppedState; } + QMediaPlayer::MediaStatus mediaStatus() const { return QMediaPlayer::NoMedia; } + + qint64 duration() const { return 0; } + qint64 position() const { return 0; } + void setPosition(qint64) {} + int volume() const { return 0; } + void setVolume(int) {} + bool isMuted() const { return false; } + void setMuted(bool) {} + int bufferStatus() const { return 0; } + bool isAudioAvailable() const { return false; } + bool isVideoAvailable() const { return false; } + bool isSeekable() const { return false; } + QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } + qreal playbackRate() const { return 1; } + void setPlaybackRate(qreal) {} + QMediaContent media() const { return QMediaContent(); } + const QIODevice *mediaStream() const { return 0; } + void setMedia(const QMediaContent &, QIODevice *) {} + + void play() {} + void pause() {} + void stop() {} +}; + +class QDeclarativeMediaBaseAnimation : public QObject +{ +public: + QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase *media) + : m_media(media) + { + } + + void start() { if (!m_timer.isActive()) m_timer.start(500, this); } + void stop() { m_timer.stop(); } + +protected: + void timerEvent(QTimerEvent *event) + { + if (event->timerId() == m_timer.timerId()) { + event->accept(); + + if (m_media->m_state == QMediaPlayer::PlayingState) + emit m_media->positionChanged(); + if (m_media->m_status == QMediaPlayer::BufferingMedia || QMediaPlayer::StalledMedia) + emit m_media->bufferProgressChanged(); + } else { + QObject::timerEvent(event); + } + } + +private: + QDeclarativeMediaBase *m_media; + QBasicTimer m_timer; +}; + +void QDeclarativeMediaBase::_q_stateChanged(QMediaPlayer::State state) +{ + if (state != m_state) { + QMediaPlayer::State oldState = m_state; + + m_state = state; + + if (state == QMediaPlayer::StoppedState) { + emit stopped(); + emit playingChanged(); + } else if (oldState == QMediaPlayer::StoppedState) { + emit started(); + emit playingChanged(); + } else if (oldState == QMediaPlayer::PausedState) { + m_paused = false; + + emit resumed(); + emit pausedChanged(); + } + + if (state == m_state && state == QMediaPlayer::PausedState) { + bool wasPaused = m_paused; + + m_paused = true; + + emit paused(); + + if (!wasPaused) + emit pausedChanged(); + } + + if (m_state == QMediaPlayer::PlayingState + || m_status == QMediaPlayer::BufferingMedia + || m_status == QMediaPlayer::StalledMedia) { + m_animation->start(); + } else { + m_animation->stop(); + } + } +} + +void QDeclarativeMediaBase::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status) +{ + if (status != m_status) { + m_status = status; + + switch (status) { + case QMediaPlayer::LoadedMedia: + emit loaded(); + break; + case QMediaPlayer::BufferingMedia: + emit buffering(); + break; + case QMediaPlayer::BufferedMedia: + emit buffered(); + break; + case QMediaPlayer::StalledMedia: + emit stalled(); + break; + case QMediaPlayer::EndOfMedia: + emit endOfMedia(); + break; + default: + break; + } + + emit statusChanged(); + + if (m_state == QMediaPlayer::PlayingState + || m_status == QMediaPlayer::BufferingMedia + || m_status == QMediaPlayer::StalledMedia) { + m_animation->start(); + } else { + m_animation->stop(); + } + } +} + +void QDeclarativeMediaBase::_q_metaDataChanged() +{ + m_metaObject->metaDataChanged(); +} + +QDeclarativeMediaBase::QDeclarativeMediaBase() + : m_mediaService(0) + , m_playerControl(0) + , m_mediaObject(0) + , m_mediaProvider(0) + , m_metaDataControl(0) + , m_metaObject(0) + , m_animation(0) + , m_state(QMediaPlayer::StoppedState) + , m_status(QMediaPlayer::NoMedia) + , m_error(QMediaPlayer::NoError) + , m_paused(false) +{ +} + +QDeclarativeMediaBase::~QDeclarativeMediaBase() +{ +} + +void QDeclarativeMediaBase::shutdown() +{ + delete m_metaObject; + delete m_mediaObject; + + if (m_mediaProvider) + m_mediaProvider->releaseService(m_mediaService); + + delete m_animation; + +} + +void QDeclarativeMediaBase::setObject(QObject *object) +{ + if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider())) { + if ((m_mediaService = m_mediaProvider->requestService(Q_MEDIASERVICE_MEDIAPLAYER))) { + m_playerControl = qobject_cast( + m_mediaService->control(QMediaPlayerControl_iid)); + m_metaDataControl = qobject_cast( + m_mediaService->control(QMetaDataControl_iid)); + m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService); + } + } + + if (m_playerControl) { + QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)), + object, SLOT(_q_stateChanged(QMediaPlayer::State))); + QObject::connect(m_playerControl, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), + object, SLOT(_q_mediaStatusChanged(QMediaPlayer::MediaStatus))); + QObject::connect(m_playerControl, SIGNAL(mediaChanged(QMediaContent)), + object, SIGNAL(sourceChanged())); + QObject::connect(m_playerControl, SIGNAL(durationChanged(qint64)), + object, SIGNAL(durationChanged())); + QObject::connect(m_playerControl, SIGNAL(positionChanged(qint64)), + object, SIGNAL(positionChanged())); + QObject::connect(m_playerControl, SIGNAL(volumeChanged(int)), + object, SIGNAL(volumeChanged())); + QObject::connect(m_playerControl, SIGNAL(mutedChanged(bool)), + object, SIGNAL(mutedChanged())); + QObject::connect(m_playerControl, SIGNAL(bufferStatusChanged(int)), + object, SIGNAL(bufferProgressChanged())); + QObject::connect(m_playerControl, SIGNAL(seekableChanged(bool)), + object, SIGNAL(seekableChanged())); + QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)), + object, SIGNAL(playbackRateChanged())); + QObject::connect(m_playerControl, SIGNAL(error(int,QString)), + object, SLOT(_q_error(int,QString))); + + m_animation = new QDeclarativeMediaBaseAnimation(this); + } else { + m_error = QMediaPlayer::ServiceMissingError; + + m_playerControl = new QDeclarativeMediaBasePlayerControl(object); + } + + if (m_metaDataControl) { + m_metaObject = new QMetaDataControlMetaObject(m_metaDataControl, object); + + QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()), + object, SLOT(_q_metaDataChanged())); + } +} + +QUrl QDeclarativeMediaBase::source() const +{ + return m_playerControl->media().canonicalUrl(); +} + +void QDeclarativeMediaBase::setSource(const QUrl &url) +{ + if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) { + m_error = QMediaPlayer::NoError; + m_errorString = QString(); + + emit errorChanged(); + } + + m_playerControl->setMedia(QMediaContent(url), 0); +} + +bool QDeclarativeMediaBase::isPlaying() const +{ + return m_state != QMediaPlayer::StoppedState; +} + +void QDeclarativeMediaBase::setPlaying(bool playing) +{ + if (playing && m_state == QMediaPlayer::StoppedState) { + if (m_paused) + m_playerControl->pause(); + else + m_playerControl->play(); + } else if (!playing) { + m_playerControl->stop(); + } +} + +bool QDeclarativeMediaBase::isPaused() const +{ + return m_paused; +} + +void QDeclarativeMediaBase::setPaused(bool paused) +{ + if (m_paused != paused) { + if (paused && m_state == QMediaPlayer::PlayingState) { + m_playerControl->pause(); + } else if (!paused && m_state == QMediaPlayer::PausedState) { + m_playerControl->play(); + } else { + m_paused = paused; + + emit pausedChanged(); + } + } +} + +int QDeclarativeMediaBase::duration() const +{ + return m_playerControl->duration(); +} + +int QDeclarativeMediaBase::position() const +{ + return m_playerControl->position(); + +} + +void QDeclarativeMediaBase::setPosition(int position) +{ + m_playerControl->setPosition(position); +} + +qreal QDeclarativeMediaBase::volume() const +{ + return qreal(m_playerControl->volume()) / 100; +} + +void QDeclarativeMediaBase::setVolume(qreal volume) +{ + m_playerControl->setVolume(qRound(volume * 100)); +} + +bool QDeclarativeMediaBase::isMuted() const +{ + return m_playerControl->isMuted(); +} + +void QDeclarativeMediaBase::setMuted(bool muted) +{ + m_playerControl->setMuted(muted); +} + +qreal QDeclarativeMediaBase::bufferProgress() const +{ + return qreal(m_playerControl->bufferStatus()) / 100; +} + +bool QDeclarativeMediaBase::isSeekable() const +{ + return m_playerControl->isSeekable(); +} + +qreal QDeclarativeMediaBase::playbackRate() const +{ + return m_playerControl->playbackRate(); +} + +void QDeclarativeMediaBase::setPlaybackRate(qreal rate) +{ + m_playerControl->setPlaybackRate(rate); +} + +QString QDeclarativeMediaBase::errorString() const +{ + return m_errorString; +} + +QT_END_NAMESPACE + diff --git a/src/imports/multimedia/qdeclarativemediabase_p.h b/src/imports/multimedia/qdeclarativemediabase_p.h new file mode 100644 index 0000000..b40e84e --- /dev/null +++ b/src/imports/multimedia/qdeclarativemediabase_p.h @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEMEDIABASE_P_H +#define QDECLARATIVEMEDIABASE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QMediaPlayerControl; +class QMediaService; +class QMediaServiceProvider; +class QMetaDataControl; +class QMetaDataControlMetaObject; +class QDeclarativeMediaBaseAnimation; + +class QDeclarativeMediaBase +{ +public: + QDeclarativeMediaBase(); + virtual ~QDeclarativeMediaBase(); + + QUrl source() const; + void setSource(const QUrl &url); + + bool isPlaying() const; + void setPlaying(bool playing); + + bool isPaused() const; + void setPaused(bool paused); + + int duration() const; + + int position() const; + void setPosition(int position); + + qreal volume() const; + void setVolume(qreal volume); + + bool isMuted() const; + void setMuted(bool muted); + + qreal bufferProgress() const; + + bool isSeekable() const; + + qreal playbackRate() const; + void setPlaybackRate(qreal rate); + + QString errorString() const; + + void _q_stateChanged(QMediaPlayer::State state); + void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status); + + void _q_metaDataChanged(); + +protected: + void shutdown(); + + void setObject(QObject *object); + + virtual void sourceChanged() = 0; + + virtual void playingChanged() = 0; + virtual void pausedChanged() = 0; + + virtual void started() = 0; + virtual void resumed() = 0; + virtual void paused() = 0; + virtual void stopped() = 0; + + virtual void statusChanged() = 0; + + virtual void loaded() = 0; + virtual void buffering() = 0; + virtual void stalled() = 0; + virtual void buffered() = 0; + virtual void endOfMedia() = 0; + + virtual void durationChanged() = 0; + virtual void positionChanged() = 0; + + virtual void volumeChanged() = 0; + virtual void mutedChanged() = 0; + + virtual void bufferProgressChanged() = 0; + + virtual void seekableChanged() = 0; + virtual void playbackRateChanged() = 0; + + virtual void errorChanged() = 0; + + QMediaService *m_mediaService; + QMediaPlayerControl *m_playerControl; + + QMediaObject *m_mediaObject; + QMediaServiceProvider *m_mediaProvider; + QMetaDataControl *m_metaDataControl; + QMetaDataControlMetaObject *m_metaObject; + QDeclarativeMediaBaseAnimation *m_animation; + + QMediaPlayer::State m_state; + QMediaPlayer::MediaStatus m_status; + QMediaPlayer::Error m_error; + bool m_paused; + QString m_errorString; + + friend class QDeclarativeMediaBaseAnimation; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp new file mode 100644 index 0000000..064f242 --- /dev/null +++ b/src/imports/multimedia/qdeclarativevideo.cpp @@ -0,0 +1,945 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativevideo_p.h" + +#include +#include +#include +#include +#include + + +QT_BEGIN_NAMESPACE + + +void QDeclarativeVideo::_q_nativeSizeChanged(const QSizeF &size) +{ + setImplicitWidth(size.width()); + setImplicitHeight(size.height()); +} + +void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) +{ + m_error = QMediaPlayer::Error(errorCode); + m_errorString = errorString; + + emit error(Error(errorCode), errorString); + emit errorChanged(); +} + + +/*! + \qmlclass Video QDeclarativeVideo + \since 4.7 + \brief The Video element allows you to add videos to a scene. + \inherits Item + + \qml + Video { source: "video/movie.mpg" } + \endqml + + The video item supports untransformed, stretched, and uniformly scaled video presentation. + For a description of stretched uniformly scaled presentation, see the \l fillMode property + description. + + The video item is only visible when the \l hasVideo property is true and the video is playing. + + \sa Audio +*/ + +/*! + \internal + \class QDeclarativeVideo + \brief The QDeclarativeVideo class provides a video item that you can add to a QDeclarativeView. +*/ + +QDeclarativeVideo::QDeclarativeVideo(QDeclarativeItem *parent) + : QDeclarativeItem(parent) + , m_graphicsItem(0) + +{ + m_graphicsItem = new QGraphicsVideoItem(this); + connect(m_graphicsItem, SIGNAL(nativeSizeChanged(QSizeF)), + this, SLOT(_q_nativeSizeChanged(QSizeF))); + + setObject(this); + + if (m_mediaService) { + connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)), + this, SIGNAL(hasAudioChanged())); + connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)), + this, SIGNAL(hasVideoChanged())); + + m_graphicsItem->setMediaObject(m_mediaObject); + } +} + +QDeclarativeVideo::~QDeclarativeVideo() +{ + shutdown(); + + delete m_graphicsItem; +} + +/*! + \qmlproperty url Video::source + + This property holds the source URL of the media. +*/ + +/*! + \qmlproperty bool Video::playing + + This property holds whether the media is playing. + + Defaults to false, and can be set to true to start playback. +*/ + +/*! + \qmlproperty bool Video::paused + + This property holds whether the media is paused. + + Defaults to false, and can be set to true to pause playback. +*/ + +/*! + \qmlsignal Video::onStarted() + + This handler is called when playback is started. +*/ + +/*! + \qmlsignal Video::onResumed() + + This handler is called when playback is resumed from the paused state. +*/ + +/*! + \qmlsignal Video::onPaused() + + This handler is called when playback is paused. +*/ + +/*! + \qmlsignal Video::onStopped() + + This handler is called when playback is stopped. +*/ + +/*! + \qmlproperty enum Video::status + + This property holds the status of media loading. It can be one of: + + \list + \o NoMedia - no media has been set. + \o Loading - the media is currently being loaded. + \o Loaded - the media has been loaded. + \o Buffering - the media is buffering data. + \o Stalled - playback has been interrupted while the media is buffering data. + \o Buffered - the media has buffered data. + \o EndOfMedia - the media has played to the end. + \o InvalidMedia - the media cannot be played. + \o UnknownStatus - the status of the media is cannot be determined. + \endlist +*/ + +QDeclarativeVideo::Status QDeclarativeVideo::status() const +{ + return Status(m_status); +} + +/*! + \qmlsignal Video::onLoaded() + + This handler is called when the media source has been loaded. +*/ + +/*! + \qmlsignal Video::onBuffering() + + This handler is called when the media starts buffering. +*/ + +/*! + \qmlsignal Video::onStalled() + + This handler is called when playback has stalled while the media buffers. +*/ + +/*! + \qmlsignal Video::onBuffered() + + This handler is called when the media has finished buffering. +*/ + +/*! + \qmlsignal Video::onEndOfMedia() + + This handler is called when playback stops because end of the media has been reached. +*/ + +/*! + \qmlproperty int Video::duration + + This property holds the duration of the media in milliseconds. + + If the media doesn't have a fixed duration (a live stream for example) this will be 0. +*/ + +/*! + \qmlproperty int Video::position + + This property holds the current playback position in milliseconds. +*/ + +/*! + \qmlproperty qreal Video::volume + + This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). +*/ + +/*! + \qmlproperty bool Video::muted + + This property holds whether the audio output is muted. +*/ + +/*! + \qmlproperty bool Video::hasAudio + + This property holds whether the media contains audio. +*/ + +bool QDeclarativeVideo::hasAudio() const +{ + return m_playerControl->isAudioAvailable(); +} + +/*! + \qmlproperty bool Video::hasVideo + + This property holds whether the media contains video. +*/ + +bool QDeclarativeVideo::hasVideo() const +{ + return m_playerControl->isVideoAvailable(); +} + +/*! + \qmlproperty qreal Video::bufferProgress + + This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 + (full). +*/ + +/*! + \qmlproperty bool Video::seekable + + This property holds whether position of the video can be changed. +*/ + +/*! + \qmlproperty qreal Video::playbackRate + + This property holds the rate at which video is played at as a multiple of the normal rate. +*/ + +/*! + \qmlproperty enum Video::error + + This property holds the error state of the video. It can be one of: + + \list + \o NoError - there is no current error. + \o ResourceError - the video cannot be played due to a problem allocating resources. + \o FormatError - the video format is not supported. + \o NetworkError - the video cannot be played due to network issues. + \o AccessDenied - the video cannot be played due to insufficient permissions. + \o ServiceMissing - the video cannot be played because the media service could not be + instantiated. + \endlist +*/ + + +QDeclarativeVideo::Error QDeclarativeVideo::error() const +{ + return Error(m_error); +} + +/*! + \qmlproperty string Video::errorString + + This property holds a string describing the current error condition in more detail. +*/ + +/*! + \qmlsignal Video::onError(error, errorString) + + This handler is called when an \l {Error}{error} has occurred. The errorString parameter + may contain more detailed information about the error. +*/ + +/*! + \qmlproperty enum Video::fillMode + + Set this property to define how the video is scaled to fit the target area. + + \list + \o Stretch - the video is scaled to fit. + \o PreserveAspectFit - the video is scaled uniformly to fit without cropping + \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary + \endlist + + The default fill mode is PreserveAspectFit. +*/ + +QDeclarativeVideo::FillMode QDeclarativeVideo::fillMode() const +{ + return FillMode(m_graphicsItem->aspectRatioMode()); +} + +void QDeclarativeVideo::setFillMode(FillMode mode) +{ + m_graphicsItem->setAspectRatioMode(Qt::AspectRatioMode(mode)); +} + +/*! + \qmlmethod Video::play() + + Starts playback of the media. + + Sets the \l playing property to true, and the \l paused property to false. +*/ + +void QDeclarativeVideo::play() +{ + m_playerControl->play(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Video::pause() + + Pauses playback of the media. + + Sets the \l playing and \l paused properties to true. +*/ + +void QDeclarativeVideo::pause() +{ + m_playerControl->pause(); + + if (!m_paused && m_state == QMediaPlayer::PausedState) { + m_paused = true; + emit pausedChanged(); + } +} + +/*! + \qmlmethod Video::stop() + + Stops playback of the media. + + Sets the \l playing and \l paused properties to false. +*/ + +void QDeclarativeVideo::stop() +{ + m_playerControl->stop(); + + if (m_paused) { + m_paused = false; + emit pausedChanged(); + } +} + +void QDeclarativeVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) +{ +} + +void QDeclarativeVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + m_graphicsItem->setSize(newGeometry.size()); + + QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); +} + +QT_END_NAMESPACE + +// *************************************** +// Documentation for meta-data properties. +// *************************************** + +/*! + \qmlproperty variant Video::title + + This property holds the tile of the media. + + \sa {QtMultimedia::Title} +*/ + +/*! + \qmlproperty variant Video::subTitle + + This property holds the sub-title of the media. + + \sa {QtMultimedia::SubTitle} +*/ + +/*! + \qmlproperty variant Video::author + + This property holds the author of the media. + + \sa {QtMultimedia::Author} +*/ + +/*! + \qmlproperty variant Video::comment + + This property holds a user comment about the media. + + \sa {QtMultimedia::Comment} +*/ + +/*! + \qmlproperty variant Video::description + + This property holds a description of the media. + + \sa {QtMultimedia::Description} +*/ + +/*! + \qmlproperty variant Video::category + + This property holds the category of the media + + \sa {QtMultimedia::Category} +*/ + +/*! + \qmlproperty variant Video::genre + + This property holds the genre of the media. + + \sa {QtMultimedia::Genre} +*/ + +/*! + \qmlproperty variant Video::year + + This property holds the year of release of the media. + + \sa {QtMultimedia::Year} +*/ + +/*! + \qmlproperty variant Video::date + + This property holds the date of the media. + + \sa {QtMultimedia::Date} +*/ + +/*! + \qmlproperty variant Video::userRating + + This property holds a user rating of the media in the range of 0 to 100. + + \sa {QtMultimedia::UserRating} +*/ + +/*! + \qmlproperty variant Video::keywords + + This property holds a list of keywords describing the media. + + \sa {QtMultimedia::Keywords} +*/ + +/*! + \qmlproperty variant Video::language + + This property holds the language of the media, as an ISO 639-2 code. + + \sa {QtMultimedia::Language} +*/ + +/*! + \qmlproperty variant Video::publisher + + This property holds the publisher of the media. + + \sa {QtMultimedia::Publisher} +*/ + +/*! + \qmlproperty variant Video::copyright + + This property holds the media's copyright notice. + + \sa {QtMultimedia::Copyright} +*/ + +/*! + \qmlproperty variant Video::parentalRating + + This property holds the parental rating of the media. + + \sa {QtMultimedia::ParentalRating} +*/ + +/*! + \qmlproperty variant Video::ratingOrganisation + + This property holds the name of the rating organisation responsible for the + parental rating of the media. + + \sa {QtMultimedia::RatingOrganisation} +*/ + +/*! + \qmlproperty variant Video::size + + This property property holds the size of the media in bytes. + + \sa {QtMultimedia::Size} +*/ + +/*! + \qmlproperty variant Video::mediaType + + This property holds the type of the media. + + \sa {QtMultimedia::MediaType} +*/ + +/*! + \qmlproperty variant Video::audioBitRate + + This property holds the bit rate of the media's audio stream ni bits per + second. + + \sa {QtMultimedia::AudioBitRate} +*/ + +/*! + \qmlproperty variant Video::audioCodec + + This property holds the encoding of the media audio stream. + + \sa {QtMultimedia::AudioCodec} +*/ + +/*! + \qmlproperty variant Video::averageLevel + + This property holds the average volume level of the media. + + \sa {QtMultimedia::AverageLevel} +*/ + +/*! + \qmlproperty variant Video::channelCount + + This property holds the number of channels in the media's audio stream. + + \sa {QtMultimedia::ChannelCount} +*/ + +/*! + \qmlproperty variant Video::peakValue + + This property holds the peak volume of media's audio stream. + + \sa {QtMultimedia::PeakValue} +*/ + +/*! + \qmlproperty variant Video::sampleRate + + This property holds the sample rate of the media's audio stream in hertz. + + \sa {QtMultimedia::SampleRate} +*/ + +/*! + \qmlproperty variant Video::albumTitle + + This property holds the title of the album the media belongs to. + + \sa {QtMultimedia::AlbumTitle} +*/ + +/*! + \qmlproperty variant Video::albumArtist + + This property holds the name of the principal artist of the album the media + belongs to. + + \sa {QtMultimedia::AlbumArtist} +*/ + +/*! + \qmlproperty variant Video::contributingArtist + + This property holds the names of artists contributing to the media. + + \sa {QtMultimedia::ContributingArtist} +*/ + +/*! + \qmlproperty variant Video::composer + + This property holds the composer of the media. + + \sa {QtMultimedia::Composer} +*/ + +/*! + \qmlproperty variant Video::conductor + + This property holds the conductor of the media. + + \sa {QtMultimedia::Conductor} +*/ + +/*! + \qmlproperty variant Video::lyrics + + This property holds the lyrics to the media. + + \sa {QtMultimedia::Lyrics} +*/ + +/*! + \qmlproperty variant Video::mood + + This property holds the mood of the media. + + \sa {QtMultimedia::Mood} +*/ + +/*! + \qmlproperty variant Video::trackNumber + + This property holds the track number of the media. + + \sa {QtMultimedia::TrackNumber} +*/ + +/*! + \qmlproperty variant Video::trackCount + + This property holds the number of track on the album containing the media. + + \sa {QtMultimedia::TrackNumber} +*/ + +/*! + \qmlproperty variant Video::coverArtUrlSmall + + This property holds the URL of a small cover art image. + + \sa {QtMultimedia::CoverArtUrlSmall} +*/ + +/*! + \qmlproperty variant Video::coverArtUrlLarge + + This property holds the URL of a large cover art image. + + \sa {QtMultimedia::CoverArtUrlLarge} +*/ + +/*! + \qmlproperty variant Video::resolution + + This property holds the dimension of an image or video. + + \sa {QtMultimedia::Resolution} +*/ + +/*! + \qmlproperty variant Video::pixelAspectRatio + + This property holds the pixel aspect ratio of an image or video. + + \sa {QtMultimedia::PixelAspectRatio} +*/ + +/*! + \qmlproperty variant Video::videoFrameRate + + This property holds the frame rate of the media's video stream. + + \sa {QtMultimedia::VideoFrameRate} +*/ + +/*! + \qmlproperty variant Video::videoBitRate + + This property holds the bit rate of the media's video stream in bits per + second. + + \sa {QtMultimedia::VideoBitRate} +*/ + +/*! + \qmlproperty variant Video::videoCodec + + This property holds the encoding of the media's video stream. + + \sa {QtMultimedia::VideoCodec} +*/ + +/*! + \qmlproperty variant Video::posterUrl + + This property holds the URL of a poster image. + + \sa {QtMultimedia::PosterUrl} +*/ + +/*! + \qmlproperty variant Video::chapterNumber + + This property holds the chapter number of the media. + + \sa {QtMultimedia::ChapterNumber} +*/ + +/*! + \qmlproperty variant Video::director + + This property holds the director of the media. + + \sa {QtMultimedia::Director} +*/ + +/*! + \qmlproperty variant Video::leadPerformer + + This property holds the lead performer in the media. + + \sa {QtMultimedia::LeadPerformer} +*/ + +/*! + \qmlproperty variant Video::writer + + This property holds the writer of the media. + + \sa {QtMultimedia::Writer} +*/ + +// The remaining properties are related to photos, and are technically +// available but will certainly never have values. +#ifndef Q_QDOC + +/*! + \qmlproperty variant Video::cameraManufacturer + + \sa {QtMultimedia::CameraManufacturer} +*/ + +/*! + \qmlproperty variant Video::cameraModel + + \sa {QtMultimedia::CameraModel} +*/ + +/*! + \qmlproperty variant Video::event + + \sa {QtMultimedia::Event} +*/ + +/*! + \qmlproperty variant Video::subject + + \sa {QtMultimedia::Subject} +*/ + +/*! + \qmlproperty variant Video::orientation + + \sa {QtMultimedia::Orientation} +*/ + +/*! + \qmlproperty variant Video::exposureTime + + \sa {QtMultimedia::ExposureTime} +*/ + +/*! + \qmlproperty variant Video::fNumber + + \sa {QtMultimedia::FNumber} +*/ + +/*! + \qmlproperty variant Video::exposureProgram + + \sa {QtMultimedia::ExposureProgram} +*/ + +/*! + \qmlproperty variant Video::isoSpeedRatings + + \sa {QtMultimedia::ISOSpeedRatings} +*/ + +/*! + \qmlproperty variant Video::exposureBiasValue + + \sa {QtMultimedia::ExposureBiasValue} +*/ + +/*! + \qmlproperty variant Video::dateTimeDigitized + + \sa {QtMultimedia::DateTimeDigitized} +*/ + +/*! + \qmlproperty variant Video::subjectDistance + + \sa {QtMultimedia::SubjectDistance} +*/ + +/*! + \qmlproperty variant Video::meteringMode + + \sa {QtMultimedia::MeteringMode} +*/ + +/*! + \qmlproperty variant Video::lightSource + + \sa {QtMultimedia::LightSource} +*/ + +/*! + \qmlproperty variant Video::flash + + \sa {QtMultimedia::Flash} +*/ + +/*! + \qmlproperty variant Video::focalLength + + \sa {QtMultimedia::FocalLength} +*/ + +/*! + \qmlproperty variant Video::exposureMode + + \sa {QtMultimedia::ExposureMode} +*/ + +/*! + \qmlproperty variant Video::whiteBalance + + \sa {QtMultimedia::WhiteBalance} +*/ + +/*! + \qmlproperty variant Video::DigitalZoomRatio + + \sa {QtMultimedia::DigitalZoomRatio} +*/ + +/*! + \qmlproperty variant Video::focalLengthIn35mmFilm + + \sa {QtMultimedia::FocalLengthIn35mmFile} +*/ + +/*! + \qmlproperty variant Video::sceneCaptureType + + \sa {QtMultimedia::SceneCaptureType} +*/ + +/*! + \qmlproperty variant Video::gainControl + + \sa {QtMultimedia::GainControl} +*/ + +/*! + \qmlproperty variant Video::contrast + + \sa {QtMultimedia::contrast} +*/ + +/*! + \qmlproperty variant Video::saturation + + \sa {QtMultimedia::Saturation} +*/ + +/*! + \qmlproperty variant Video::sharpness + + \sa {QtMultimedia::Sharpness} +*/ + +/*! + \qmlproperty variant Video::deviceSettingDescription + + \sa {QtMultimedia::DeviceSettingDescription} +*/ + +#endif + +#include "moc_qdeclarativevideo_p.cpp" diff --git a/src/imports/multimedia/qdeclarativevideo_p.h b/src/imports/multimedia/qdeclarativevideo_p.h new file mode 100644 index 0000000..fb13519 --- /dev/null +++ b/src/imports/multimedia/qdeclarativevideo_p.h @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEVIDEO_H +#define QDECLARATIVEVIDEO_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qdeclarativemediabase_p.h" + +#include + +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QTimerEvent; +class QVideoSurfaceFormat; + + +class QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase +{ + Q_OBJECT + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) + Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(int duration READ duration NOTIFY durationChanged) + Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) + Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) + Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) + Q_PROPERTY(bool hasAudio READ hasAudio NOTIFY hasAudioChanged) + Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged) + Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) + Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) + Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) + Q_PROPERTY(Error error READ error NOTIFY errorChanged) + Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) + Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode) + Q_ENUMS(FillMode) + Q_ENUMS(Status) + Q_ENUMS(Error) +public: + enum FillMode + { + Stretch = Qt::IgnoreAspectRatio, + PreserveAspectFit = Qt::KeepAspectRatio, + PreserveAspectCrop = Qt::KeepAspectRatioByExpanding + }; + + enum Status + { + UnknownStatus = QMediaPlayer::UnknownMediaStatus, + NoMedia = QMediaPlayer::NoMedia, + Loading = QMediaPlayer::LoadingMedia, + Loaded = QMediaPlayer::LoadedMedia, + Stalled = QMediaPlayer::StalledMedia, + Buffering = QMediaPlayer::BufferingMedia, + Buffered = QMediaPlayer::BufferedMedia, + EndOfMedia = QMediaPlayer::EndOfMedia, + InvalidMedia = QMediaPlayer::InvalidMedia + }; + + enum Error + { + NoError = QMediaPlayer::NoError, + ResourceError = QMediaPlayer::ResourceError, + FormatError = QMediaPlayer::FormatError, + NetworkError = QMediaPlayer::NetworkError, + AccessDenied = QMediaPlayer::AccessDeniedError, + ServiceMissing = QMediaPlayer::ServiceMissingError + }; + + QDeclarativeVideo(QDeclarativeItem *parent = 0); + ~QDeclarativeVideo(); + + bool hasAudio() const; + bool hasVideo() const; + + FillMode fillMode() const; + void setFillMode(FillMode mode); + + Status status() const; + Error error() const; + + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + +public Q_SLOTS: + void play(); + void pause(); + void stop(); + +Q_SIGNALS: + void sourceChanged(); + + void playingChanged(); + void pausedChanged(); + + void started(); + void resumed(); + void paused(); + void stopped(); + + void statusChanged(); + + void loaded(); + void buffering(); + void stalled(); + void buffered(); + void endOfMedia(); + + void durationChanged(); + void positionChanged(); + + void volumeChanged(); + void mutedChanged(); + void hasAudioChanged(); + void hasVideoChanged(); + + void bufferProgressChanged(); + + void seekableChanged(); + void playbackRateChanged(); + + void errorChanged(); + void error(QDeclarativeVideo::Error error, const QString &errorString); + +protected: + void geometryChanged(const QRectF &geometry, const QRectF &); + +private Q_SLOTS: + void _q_nativeSizeChanged(const QSizeF &size); + void _q_error(int, const QString &); + +private: + Q_DISABLE_COPY(QDeclarativeVideo) + + QGraphicsVideoItem *m_graphicsItem; + + Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) + Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) + Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) + + inline QDeclarativeMediaBase *mediaBase() { return this; } +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeVideo)) + +QT_END_HEADER + +#endif diff --git a/src/imports/multimedia/qmetadatacontrolmetaobject.cpp b/src/imports/multimedia/qmetadatacontrolmetaobject.cpp new file mode 100644 index 0000000..e90cbd6 --- /dev/null +++ b/src/imports/multimedia/qmetadatacontrolmetaobject.cpp @@ -0,0 +1,362 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmetadatacontrolmetaobject_p.h" +#include + + +QT_BEGIN_NAMESPACE + +// copied from qmetaobject.cpp +// do not touch without touching the moc as well +enum PropertyFlags { + Invalid = 0x00000000, + Readable = 0x00000001, + Writable = 0x00000002, + Resettable = 0x00000004, + EnumOrFlag = 0x00000008, + StdCppSet = 0x00000100, +// Override = 0x00000200, + Designable = 0x00001000, + ResolveDesignable = 0x00002000, + Scriptable = 0x00004000, + ResolveScriptable = 0x00008000, + Stored = 0x00010000, + ResolveStored = 0x00020000, + Editable = 0x00040000, + ResolveEditable = 0x00080000, + User = 0x00100000, + ResolveUser = 0x00200000, + Notify = 0x00400000, + Dynamic = 0x00800000 +}; + +enum MethodFlags { + AccessPrivate = 0x00, + AccessProtected = 0x01, + AccessPublic = 0x02, + AccessMask = 0x03, //mask + + MethodMethod = 0x00, + MethodSignal = 0x04, + MethodSlot = 0x08, + MethodConstructor = 0x0c, + MethodTypeMask = 0x0c, + + MethodCompatibility = 0x10, + MethodCloned = 0x20, + MethodScriptable = 0x40 +}; + +struct QMetaObjectPrivate +{ + int revision; + int className; + int classInfoCount, classInfoData; + int methodCount, methodData; + int propertyCount, propertyData; + int enumeratorCount, enumeratorData; + int constructorCount, constructorData; + int flags; +}; + +static inline const QMetaObjectPrivate *priv(const uint* m_data) +{ return reinterpret_cast(m_data); } +// end of copied lines from qmetaobject.cpp + +namespace +{ + struct MetaDataKey + { + QtMultimedia::MetaData key; + const char *name; + }; + + const MetaDataKey qt_metaDataKeys[] = + { + { QtMultimedia::Title, "title" }, + { QtMultimedia::SubTitle, "subTitle" }, + { QtMultimedia::Author, "author" }, + { QtMultimedia::Comment, "comment" }, + { QtMultimedia::Description, "description" }, + { QtMultimedia::Category, "category" }, + { QtMultimedia::Genre, "genre" }, + { QtMultimedia::Year, "year" }, + { QtMultimedia::Date, "date" }, + { QtMultimedia::UserRating, "userRating" }, + { QtMultimedia::Keywords, "keywords" }, + { QtMultimedia::Language, "language" }, + { QtMultimedia::Publisher, "publisher" }, + { QtMultimedia::Copyright, "copyright" }, + { QtMultimedia::ParentalRating, "parentalRating" }, + { QtMultimedia::RatingOrganisation, "ratingOrganisation" }, + + // Media + { QtMultimedia::Size, "size" }, + { QtMultimedia::MediaType, "mediaType" }, +// { QtMultimedia::Duration, "duration" }, + + // Audio + { QtMultimedia::AudioBitRate, "audioBitRate" }, + { QtMultimedia::AudioCodec, "audioCodec" }, + { QtMultimedia::AverageLevel, "averageLevel" }, + { QtMultimedia::ChannelCount, "channelCount" }, + { QtMultimedia::PeakValue, "peakValue" }, + { QtMultimedia::SampleRate, "sampleRate" }, + + // Music + { QtMultimedia::AlbumTitle, "albumTitle" }, + { QtMultimedia::AlbumArtist, "albumArtist" }, + { QtMultimedia::ContributingArtist, "contributingArtist" }, + { QtMultimedia::Composer, "composer" }, + { QtMultimedia::Conductor, "conductor" }, + { QtMultimedia::Lyrics, "lyrics" }, + { QtMultimedia::Mood, "mood" }, + { QtMultimedia::TrackNumber, "trackNumber" }, + { QtMultimedia::TrackCount, "trackCount" }, + + { QtMultimedia::CoverArtUrlSmall, "coverArtUrlSmall" }, + { QtMultimedia::CoverArtUrlLarge, "coverArtUrlLarge" }, + + // Image/Video + { QtMultimedia::Resolution, "resolution" }, + { QtMultimedia::PixelAspectRatio, "pixelAspectRatio" }, + + // Video + { QtMultimedia::VideoFrameRate, "videoFrameRate" }, + { QtMultimedia::VideoBitRate, "videoBitRate" }, + { QtMultimedia::VideoCodec, "videoCodec" }, + + { QtMultimedia::PosterUrl, "posterUrl" }, + + // Movie + { QtMultimedia::ChapterNumber, "chapterNumber" }, + { QtMultimedia::Director, "director" }, + { QtMultimedia::LeadPerformer, "leadPerformer" }, + { QtMultimedia::Writer, "writer" }, + + // Photos + { QtMultimedia::CameraManufacturer, "cameraManufacturer" }, + { QtMultimedia::CameraModel, "cameraModel" }, + { QtMultimedia::Event, "event" }, + { QtMultimedia::Subject, "subject" }, + { QtMultimedia::Orientation, "orientation" }, + { QtMultimedia::ExposureTime, "exposureTime" }, + { QtMultimedia::FNumber, "fNumber" }, + { QtMultimedia::ExposureProgram, "exposureProgram" }, + { QtMultimedia::ISOSpeedRatings, "isoSpeedRatings" }, + { QtMultimedia::ExposureBiasValue, "exposureBiasValue" }, + { QtMultimedia::DateTimeOriginal, "dateTimeOriginal" }, + { QtMultimedia::DateTimeDigitized, "dateTimeDigitized" }, + { QtMultimedia::SubjectDistance, "subjectDistance" }, + { QtMultimedia::MeteringMode, "meteringMode" }, + { QtMultimedia::LightSource, "lightSource" }, + { QtMultimedia::Flash, "flash" }, + { QtMultimedia::FocalLength, "focalLength" }, + { QtMultimedia::ExposureMode, "exposureMode" }, + { QtMultimedia::WhiteBalance, "whiteBalance" }, + { QtMultimedia::DigitalZoomRatio, "digitalZoomRatio" }, + { QtMultimedia::FocalLengthIn35mmFilm, "focalLengthIn35mmFilm" }, + { QtMultimedia::SceneCaptureType, "sceneCaptureType" }, + { QtMultimedia::GainControl, "gainControl" }, + { QtMultimedia::Contrast, "contrast" }, + { QtMultimedia::Saturation, "saturation" }, + { QtMultimedia::Sharpness, "sharpness" }, + { QtMultimedia::DeviceSettingDescription, "deviceSettingDescription" } + }; + + class QMetaDataControlObject : public QObject + { + public: + inline QObjectData *data() { return d_ptr.data(); } + }; +} + +QMetaDataControlMetaObject::QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object) + : m_control(control) + , m_object(object) + , m_string(0) + , m_data(0) + , m_propertyOffset(0) + , m_signalOffset(0) +{ + const QMetaObject *superClass = m_object->metaObject(); + + const int propertyCount = sizeof(qt_metaDataKeys) / sizeof(MetaDataKey); + const int dataSize = sizeof(uint) + * (13 // QMetaObjectPrivate members. + + 5 // 5 members per signal. + + 4 * propertyCount // 3 members per property + 1 notify signal per property. + + 1); // Terminating value. + + m_data = reinterpret_cast(qMalloc(dataSize)); + + QMetaObjectPrivate *pMeta = reinterpret_cast(m_data); + + pMeta->revision = 3; + pMeta->className = 0; + pMeta->classInfoCount = 0; + pMeta->classInfoData = 0; + pMeta->methodCount = 1; + pMeta->methodData = 13; + pMeta->propertyCount = propertyCount; + pMeta->propertyData = 18; + pMeta->enumeratorCount = 0; + pMeta->enumeratorData = 0; + pMeta->constructorCount = 0; + pMeta->constructorData = 0; + pMeta->flags = 0x01; // Dynamic meta object flag. + + const int classNameSize = qstrlen(superClass->className()) + 1; + + int stringIndex = classNameSize + 1; + + // __metaDataChanged() signal. + static const char *changeSignal = "__metaDataChanged()"; + const int changeSignalSize = qstrlen(changeSignal) + 1; + + m_data[13] = stringIndex; // Signature. + m_data[14] = classNameSize; // Parameters. + m_data[15] = classNameSize; // Type. + m_data[16] = classNameSize; // Tag. + m_data[17] = MethodSignal | AccessProtected; // Flags. + + stringIndex += changeSignalSize; + + const char *qvariantName = "QVariant"; + const int qvariantSize = qstrlen(qvariantName) + 1; + const int qvariantIndex = stringIndex; + + stringIndex += qvariantSize; + + // Properties. + for (int i = 0; i < propertyCount; ++i) { + m_data[18 + 3 * i] = stringIndex; // Name. + m_data[19 + 3 * i] = qvariantIndex; // Type. + m_data[20 + 3 * i] + = Readable | Writable | Notify | Dynamic | (0xffffffff << 24); // Flags. + m_data[18 + propertyCount * 3 + i] = 0; // Notify signal. + + stringIndex += qstrlen(qt_metaDataKeys[i].name) + 1; + } + + // Terminating value. + m_data[18 + propertyCount * 4] = 0; + + // Build string. + m_string = reinterpret_cast(qMalloc(stringIndex + 1)); + + // Class name. + qMemCopy(m_string, superClass->className(), classNameSize); + + stringIndex = classNameSize; + + // Null m_string. + m_string[stringIndex] = '\0'; + stringIndex += 1; + + // __metaDataChanged() signal. + qMemCopy(m_string + stringIndex, changeSignal, changeSignalSize); + stringIndex += changeSignalSize; + + qMemCopy(m_string + stringIndex, qvariantName, qvariantSize); + stringIndex += qvariantSize; + + // Properties. + for (int i = 0; i < propertyCount; ++i) { + const int propertyNameSize = qstrlen(qt_metaDataKeys[i].name) + 1; + + qMemCopy(m_string + stringIndex, qt_metaDataKeys[i].name, propertyNameSize); + stringIndex += propertyNameSize; + } + + // Terminating character. + m_string[stringIndex] = '\0'; + + d.superdata = superClass; + d.stringdata = m_string; + d.data = m_data; + d.extradata = 0; + + static_cast(m_object)->data()->metaObject = this; + + m_propertyOffset = propertyOffset(); + m_signalOffset = methodOffset(); +} + +QMetaDataControlMetaObject::~QMetaDataControlMetaObject() +{ + static_cast(m_object)->data()->metaObject = 0; + + qFree(m_data); + qFree(m_string); +} + +int QMetaDataControlMetaObject::metaCall(QMetaObject::Call c, int id, void **a) +{ + if (c == QMetaObject::ReadProperty && id >= m_propertyOffset) { + int propId = id - m_propertyOffset; + + *reinterpret_cast(a[0]) = m_control->metaData(qt_metaDataKeys[propId].key); + + return -1; + } else if (c == QMetaObject::WriteProperty && id >= m_propertyOffset) { + int propId = id - m_propertyOffset; + + m_control->setMetaData(qt_metaDataKeys[propId].key, *reinterpret_cast(a[0])); + + return -1; + } else { + return m_object->qt_metacall(c, id, a); + } +} + +int QMetaDataControlMetaObject::createProperty(const char *, const char *) +{ + return -1; +} + +void QMetaDataControlMetaObject::metaDataChanged() +{ + activate(m_object, m_signalOffset, 0); +} + +QT_END_NAMESPACE diff --git a/src/imports/multimedia/qmetadatacontrolmetaobject_p.h b/src/imports/multimedia/qmetadatacontrolmetaobject_p.h new file mode 100644 index 0000000..c381f2d --- /dev/null +++ b/src/imports/multimedia/qmetadatacontrolmetaobject_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMETADATACONTROLMETAOBJECT_P_H +#define QMETADATACONTROLMETAOJBECT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QMetaDataControl; + +class QMetaDataControlMetaObject : public QAbstractDynamicMetaObject +{ +public: + QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object); + ~QMetaDataControlMetaObject(); + + int metaCall(QMetaObject::Call call, int _id, void **arguments); + int createProperty(const char *, const char *); + + void metaDataChanged(); + +private: + QMetaDataControl *m_control; + QObject *m_object; + char *m_string; + uint *m_data; + + int m_propertyOffset; + int m_signalOffset; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp b/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp deleted file mode 100644 index df2888c..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativeaudio_p.h" - -#include - -QT_BEGIN_NAMESPACE - - -/*! - \qmlclass Audio QDeclarativeAudio - \since 4.7 - \brief The Audio element allows you to add audio playback to a scene. - - \qml - Audio { source: "audio/song.mp3" } - \endqml - - \sa Video -*/ - -/*! - \internal - \class QDeclarativeAudio - \brief The QDeclarativeAudio class provides an audio item that you can add to a QDeclarativeView. -*/ - -void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString) -{ - m_error = QMediaPlayer::Error(errorCode); - m_errorString = errorString; - - emit error(Error(errorCode), errorString); - emit errorChanged(); -} - - -QDeclarativeAudio::QDeclarativeAudio(QObject *parent) - : QObject(parent) -{ - setObject(this); -} - -QDeclarativeAudio::~QDeclarativeAudio() -{ - shutdown(); -} - -/*! - \qmlmethod Audio::play() - - Starts playback of the media. - - Sets the \l playing property to true, and the \l paused property to false. -*/ - -void QDeclarativeAudio::play() -{ - m_playerControl->play(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Audio::pause() - - Pauses playback of the media. - - Sets the \l playing and \l paused properties to true. -*/ - -void QDeclarativeAudio::pause() -{ - m_playerControl->pause(); - - if (!m_paused && m_state == QMediaPlayer::PausedState) { - m_paused = true; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Audio::stop() - - Stops playback of the media. - - Sets the \l playing and \l paused properties to false. -*/ - -void QDeclarativeAudio::stop() -{ - m_playerControl->stop(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -/*! - \qmlproperty url Audio::source - - This property holds the source URL of the media. -*/ - -/*! - \qmlproperty bool Audio::playing - - This property holds whether the media is playing. - - Defaults to false, and can be set to true to start playback. -*/ - -/*! - \qmlproperty bool Audio::paused - - This property holds whether the media is paused. - - Defaults to false, and can be set to true to pause playback. -*/ - -/*! - \qmlsignal Audio::onStarted() - - This handler is called when playback is started. -*/ - -/*! - \qmlsignal Audio::onResumed() - - This handler is called when playback is resumed from the paused state. -*/ - -/*! - \qmlsignal Audio::onPaused() - - This handler is called when playback is paused. -*/ - -/*! - \qmlsignal Audio::onStopped() - - This handler is called when playback is stopped. -*/ - -/*! - \qmlproperty enum Audio::status - - This property holds the status of media loading. It can be one of: - - \list - \o NoMedia - no media has been set. - \o Loading - the media is currently being loaded. - \o Loaded - the media has been loaded. - \o Buffering - the media is buffering data. - \o Stalled - playback has been interrupted while the media is buffering data. - \o Buffered - the media has buffered data. - \o EndOfMedia - the media has played to the end. - \o InvalidMedia - the media cannot be played. - \o UnknownStatus - the status of the media is unknown. - \endlist -*/ - -QDeclarativeAudio::Status QDeclarativeAudio::status() const -{ - return Status(m_status); -} - -/*! - \qmlsignal Audio::onLoaded() - - This handler is called when the media source has been loaded. -*/ - -/*! - \qmlsignal Audio::onBuffering() - - This handler is called when the media starts buffering. -*/ - -/*! - \qmlsignal Audio::onStalled() - - This handler is called when playback has stalled while the media buffers. -*/ - -/*! - \qmlsignal Audio::onBuffered() - - This handler is called when the media has finished buffering. -*/ - -/*! - \qmlsignal Audio::onEndOfMedia() - - This handler is called when playback stops because end of the media has been reached. -*/ -/*! - \qmlproperty int Audio::duration - - This property holds the duration of the media in milliseconds. - - If the media doesn't have a fixed duration (a live stream for example) this will be 0. -*/ - -/*! - \qmlproperty int Audio::position - - This property holds the current playback position in milliseconds. - - If the \l seekable property is true, this property can be set to seek to a new position. -*/ - -/*! - \qmlproperty qreal Audio::volume - - This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). -*/ - -/*! - \qmlproperty bool Audio::muted - - This property holds whether the audio output is muted. -*/ - -/*! - \qmlproperty qreal Audio::bufferProgress - - This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 - (full). -*/ - -/*! - \qmlproperty bool Audio::seekable - - This property holds whether position of the audio can be changed. - - If true; setting a \l position value will cause playback to seek to the new position. -*/ - -/*! - \qmlproperty qreal Audio::playbackRate - - This property holds the rate at which audio is played at as a multiple of the normal rate. -*/ - -/*! - \qmlproperty enum Audio::error - - This property holds the error state of the audio. It can be one of: - - \list - \o NoError - there is no current error. - \o ResourceError - the audio cannot be played due to a problem allocating resources. - \o FormatError - the audio format is not supported. - \o NetworkError - the audio cannot be played due to network issues. - \o AccessDenied - the audio cannot be played due to insufficient permissions. - \o ServiceMissing - the audio cannot be played because the media service could not be - instantiated. - \endlist -*/ - -QDeclarativeAudio::Error QDeclarativeAudio::error() const -{ - return Error(m_error); -} - -/*! - \qmlproperty string Audio::errorString - - This property holds a string describing the current error condition in more detail. -*/ - -/*! - \qmlsignal Audio::onError(error, errorString) - - This handler is called when an \l {Error}{error} has occurred. The errorString parameter - may contain more detailed information about the error. -*/ - -QT_END_NAMESPACE - -#include "moc_qdeclarativeaudio_p.cpp" - - diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h b/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h deleted file mode 100644 index 9881dbc..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qdeclarativeaudio_p.h +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEAUDIO_P_H -#define QDECLARATIVEAUDIO_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdeclarativemediabase_p.h" - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTimerEvent; - -class QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(int duration READ duration NOTIFY durationChanged) - Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) - Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) - Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) - Q_PROPERTY(Error error READ error NOTIFY errorChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - Q_ENUMS(Status) - Q_ENUMS(Error) - Q_INTERFACES(QDeclarativeParserStatus) -public: - enum Status - { - UnknownStatus = QMediaPlayer::UnknownMediaStatus, - NoMedia = QMediaPlayer::NoMedia, - Loading = QMediaPlayer::LoadingMedia, - Loaded = QMediaPlayer::LoadedMedia, - Stalled = QMediaPlayer::StalledMedia, - Buffering = QMediaPlayer::BufferingMedia, - Buffered = QMediaPlayer::BufferedMedia, - EndOfMedia = QMediaPlayer::EndOfMedia, - InvalidMedia = QMediaPlayer::InvalidMedia - }; - - enum Error - { - NoError = QMediaPlayer::NoError, - ResourceError = QMediaPlayer::ResourceError, - FormatError = QMediaPlayer::FormatError, - NetworkError = QMediaPlayer::NetworkError, - AccessDenied = QMediaPlayer::AccessDeniedError, - ServiceMissing = QMediaPlayer::ServiceMissingError - }; - - QDeclarativeAudio(QObject *parent = 0); - ~QDeclarativeAudio(); - - Status status() const; - Error error() const; - -public Q_SLOTS: - void play(); - void pause(); - void stop(); - -Q_SIGNALS: - void sourceChanged(); - - void playingChanged(); - void pausedChanged(); - - void started(); - void resumed(); - void paused(); - void stopped(); - - void statusChanged(); - - void loaded(); - void buffering(); - void stalled(); - void buffered(); - void endOfMedia(); - - void durationChanged(); - void positionChanged(); - - void volumeChanged(); - void mutedChanged(); - - void bufferProgressChanged(); - - void seekableChanged(); - void playbackRateChanged(); - - void errorChanged(); - void error(QDeclarativeAudio::Error error, const QString &errorString); - -private Q_SLOTS: - void _q_error(int, const QString &); - -private: - Q_DISABLE_COPY(QDeclarativeAudio) - Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) - Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) - Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) - - inline QDeclarativeMediaBase *mediaBase() { return this; } -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio)) - -QT_END_HEADER - -#endif diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp b/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp deleted file mode 100644 index 8e87e44..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase.cpp +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativemediabase_p.h" - -#include -#include - -#include -#include -#include -#include -#include "qmetadatacontrolmetaobject_p.h" - - - -QT_BEGIN_NAMESPACE - - -class QDeclarativeMediaBaseObject : public QMediaObject -{ -public: - QDeclarativeMediaBaseObject(QMediaService *service) - : QMediaObject(0, service) - { - } -}; - -class QDeclarativeMediaBasePlayerControl : public QMediaPlayerControl -{ -public: - QDeclarativeMediaBasePlayerControl(QObject *parent) - : QMediaPlayerControl(parent) - { - } - - QMediaPlayer::State state() const { return QMediaPlayer::StoppedState; } - QMediaPlayer::MediaStatus mediaStatus() const { return QMediaPlayer::NoMedia; } - - qint64 duration() const { return 0; } - qint64 position() const { return 0; } - void setPosition(qint64) {} - int volume() const { return 0; } - void setVolume(int) {} - bool isMuted() const { return false; } - void setMuted(bool) {} - int bufferStatus() const { return 0; } - bool isAudioAvailable() const { return false; } - bool isVideoAvailable() const { return false; } - bool isSeekable() const { return false; } - QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } - qreal playbackRate() const { return 1; } - void setPlaybackRate(qreal) {} - QMediaContent media() const { return QMediaContent(); } - const QIODevice *mediaStream() const { return 0; } - void setMedia(const QMediaContent &, QIODevice *) {} - - void play() {} - void pause() {} - void stop() {} -}; - -class QDeclarativeMediaBaseAnimation : public QObject -{ -public: - QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase *media) - : m_media(media) - { - } - - void start() { if (!m_timer.isActive()) m_timer.start(500, this); } - void stop() { m_timer.stop(); } - -protected: - void timerEvent(QTimerEvent *event) - { - if (event->timerId() == m_timer.timerId()) { - event->accept(); - - if (m_media->m_state == QMediaPlayer::PlayingState) - emit m_media->positionChanged(); - if (m_media->m_status == QMediaPlayer::BufferingMedia || QMediaPlayer::StalledMedia) - emit m_media->bufferProgressChanged(); - } else { - QObject::timerEvent(event); - } - } - -private: - QDeclarativeMediaBase *m_media; - QBasicTimer m_timer; -}; - -void QDeclarativeMediaBase::_q_stateChanged(QMediaPlayer::State state) -{ - if (state != m_state) { - QMediaPlayer::State oldState = m_state; - - m_state = state; - - if (state == QMediaPlayer::StoppedState) { - emit stopped(); - emit playingChanged(); - } else if (oldState == QMediaPlayer::StoppedState) { - emit started(); - emit playingChanged(); - } else if (oldState == QMediaPlayer::PausedState) { - m_paused = false; - - emit resumed(); - emit pausedChanged(); - } - - if (state == m_state && state == QMediaPlayer::PausedState) { - bool wasPaused = m_paused; - - m_paused = true; - - emit paused(); - - if (!wasPaused) - emit pausedChanged(); - } - - if (m_state == QMediaPlayer::PlayingState - || m_status == QMediaPlayer::BufferingMedia - || m_status == QMediaPlayer::StalledMedia) { - m_animation->start(); - } else { - m_animation->stop(); - } - } -} - -void QDeclarativeMediaBase::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status) -{ - if (status != m_status) { - m_status = status; - - switch (status) { - case QMediaPlayer::LoadedMedia: - emit loaded(); - break; - case QMediaPlayer::BufferingMedia: - emit buffering(); - break; - case QMediaPlayer::BufferedMedia: - emit buffered(); - break; - case QMediaPlayer::StalledMedia: - emit stalled(); - break; - case QMediaPlayer::EndOfMedia: - emit endOfMedia(); - break; - default: - break; - } - - emit statusChanged(); - - if (m_state == QMediaPlayer::PlayingState - || m_status == QMediaPlayer::BufferingMedia - || m_status == QMediaPlayer::StalledMedia) { - m_animation->start(); - } else { - m_animation->stop(); - } - } -} - -void QDeclarativeMediaBase::_q_metaDataChanged() -{ - m_metaObject->metaDataChanged(); -} - -QDeclarativeMediaBase::QDeclarativeMediaBase() - : m_mediaService(0) - , m_playerControl(0) - , m_mediaObject(0) - , m_mediaProvider(0) - , m_metaDataControl(0) - , m_metaObject(0) - , m_animation(0) - , m_state(QMediaPlayer::StoppedState) - , m_status(QMediaPlayer::NoMedia) - , m_error(QMediaPlayer::NoError) - , m_paused(false) -{ -} - -QDeclarativeMediaBase::~QDeclarativeMediaBase() -{ -} - -void QDeclarativeMediaBase::shutdown() -{ - delete m_metaObject; - delete m_mediaObject; - - if (m_mediaProvider) - m_mediaProvider->releaseService(m_mediaService); - - delete m_animation; - -} - -void QDeclarativeMediaBase::setObject(QObject *object) -{ - if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider())) { - if ((m_mediaService = m_mediaProvider->requestService(Q_MEDIASERVICE_MEDIAPLAYER))) { - m_playerControl = qobject_cast( - m_mediaService->control(QMediaPlayerControl_iid)); - m_metaDataControl = qobject_cast( - m_mediaService->control(QMetaDataControl_iid)); - m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService); - } - } - - if (m_playerControl) { - QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)), - object, SLOT(_q_stateChanged(QMediaPlayer::State))); - QObject::connect(m_playerControl, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), - object, SLOT(_q_mediaStatusChanged(QMediaPlayer::MediaStatus))); - QObject::connect(m_playerControl, SIGNAL(mediaChanged(QMediaContent)), - object, SIGNAL(sourceChanged())); - QObject::connect(m_playerControl, SIGNAL(durationChanged(qint64)), - object, SIGNAL(durationChanged())); - QObject::connect(m_playerControl, SIGNAL(positionChanged(qint64)), - object, SIGNAL(positionChanged())); - QObject::connect(m_playerControl, SIGNAL(volumeChanged(int)), - object, SIGNAL(volumeChanged())); - QObject::connect(m_playerControl, SIGNAL(mutedChanged(bool)), - object, SIGNAL(mutedChanged())); - QObject::connect(m_playerControl, SIGNAL(bufferStatusChanged(int)), - object, SIGNAL(bufferProgressChanged())); - QObject::connect(m_playerControl, SIGNAL(seekableChanged(bool)), - object, SIGNAL(seekableChanged())); - QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)), - object, SIGNAL(playbackRateChanged())); - QObject::connect(m_playerControl, SIGNAL(error(int,QString)), - object, SLOT(_q_error(int,QString))); - - m_animation = new QDeclarativeMediaBaseAnimation(this); - } else { - m_error = QMediaPlayer::ServiceMissingError; - - m_playerControl = new QDeclarativeMediaBasePlayerControl(object); - } - - if (m_metaDataControl) { - m_metaObject = new QMetaDataControlMetaObject(m_metaDataControl, object); - - QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()), - object, SLOT(_q_metaDataChanged())); - } -} - -QUrl QDeclarativeMediaBase::source() const -{ - return m_playerControl->media().canonicalUrl(); -} - -void QDeclarativeMediaBase::setSource(const QUrl &url) -{ - if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) { - m_error = QMediaPlayer::NoError; - m_errorString = QString(); - - emit errorChanged(); - } - - m_playerControl->setMedia(QMediaContent(url), 0); -} - -bool QDeclarativeMediaBase::isPlaying() const -{ - return m_state != QMediaPlayer::StoppedState; -} - -void QDeclarativeMediaBase::setPlaying(bool playing) -{ - if (playing && m_state == QMediaPlayer::StoppedState) { - if (m_paused) - m_playerControl->pause(); - else - m_playerControl->play(); - } else if (!playing) { - m_playerControl->stop(); - } -} - -bool QDeclarativeMediaBase::isPaused() const -{ - return m_paused; -} - -void QDeclarativeMediaBase::setPaused(bool paused) -{ - if (m_paused != paused) { - if (paused && m_state == QMediaPlayer::PlayingState) { - m_playerControl->pause(); - } else if (!paused && m_state == QMediaPlayer::PausedState) { - m_playerControl->play(); - } else { - m_paused = paused; - - emit pausedChanged(); - } - } -} - -int QDeclarativeMediaBase::duration() const -{ - return m_playerControl->duration(); -} - -int QDeclarativeMediaBase::position() const -{ - return m_playerControl->position(); - -} - -void QDeclarativeMediaBase::setPosition(int position) -{ - m_playerControl->setPosition(position); -} - -qreal QDeclarativeMediaBase::volume() const -{ - return qreal(m_playerControl->volume()) / 100; -} - -void QDeclarativeMediaBase::setVolume(qreal volume) -{ - m_playerControl->setVolume(qRound(volume * 100)); -} - -bool QDeclarativeMediaBase::isMuted() const -{ - return m_playerControl->isMuted(); -} - -void QDeclarativeMediaBase::setMuted(bool muted) -{ - m_playerControl->setMuted(muted); -} - -qreal QDeclarativeMediaBase::bufferProgress() const -{ - return qreal(m_playerControl->bufferStatus()) / 100; -} - -bool QDeclarativeMediaBase::isSeekable() const -{ - return m_playerControl->isSeekable(); -} - -qreal QDeclarativeMediaBase::playbackRate() const -{ - return m_playerControl->playbackRate(); -} - -void QDeclarativeMediaBase::setPlaybackRate(qreal rate) -{ - m_playerControl->setPlaybackRate(rate); -} - -QString QDeclarativeMediaBase::errorString() const -{ - return m_errorString; -} - -QT_END_NAMESPACE - diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h b/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h deleted file mode 100644 index b40e84e..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qdeclarativemediabase_p.h +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEMEDIABASE_P_H -#define QDECLARATIVEMEDIABASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QMediaPlayerControl; -class QMediaService; -class QMediaServiceProvider; -class QMetaDataControl; -class QMetaDataControlMetaObject; -class QDeclarativeMediaBaseAnimation; - -class QDeclarativeMediaBase -{ -public: - QDeclarativeMediaBase(); - virtual ~QDeclarativeMediaBase(); - - QUrl source() const; - void setSource(const QUrl &url); - - bool isPlaying() const; - void setPlaying(bool playing); - - bool isPaused() const; - void setPaused(bool paused); - - int duration() const; - - int position() const; - void setPosition(int position); - - qreal volume() const; - void setVolume(qreal volume); - - bool isMuted() const; - void setMuted(bool muted); - - qreal bufferProgress() const; - - bool isSeekable() const; - - qreal playbackRate() const; - void setPlaybackRate(qreal rate); - - QString errorString() const; - - void _q_stateChanged(QMediaPlayer::State state); - void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status); - - void _q_metaDataChanged(); - -protected: - void shutdown(); - - void setObject(QObject *object); - - virtual void sourceChanged() = 0; - - virtual void playingChanged() = 0; - virtual void pausedChanged() = 0; - - virtual void started() = 0; - virtual void resumed() = 0; - virtual void paused() = 0; - virtual void stopped() = 0; - - virtual void statusChanged() = 0; - - virtual void loaded() = 0; - virtual void buffering() = 0; - virtual void stalled() = 0; - virtual void buffered() = 0; - virtual void endOfMedia() = 0; - - virtual void durationChanged() = 0; - virtual void positionChanged() = 0; - - virtual void volumeChanged() = 0; - virtual void mutedChanged() = 0; - - virtual void bufferProgressChanged() = 0; - - virtual void seekableChanged() = 0; - virtual void playbackRateChanged() = 0; - - virtual void errorChanged() = 0; - - QMediaService *m_mediaService; - QMediaPlayerControl *m_playerControl; - - QMediaObject *m_mediaObject; - QMediaServiceProvider *m_mediaProvider; - QMetaDataControl *m_metaDataControl; - QMetaDataControlMetaObject *m_metaObject; - QDeclarativeMediaBaseAnimation *m_animation; - - QMediaPlayer::State m_state; - QMediaPlayer::MediaStatus m_status; - QMediaPlayer::Error m_error; - bool m_paused; - QString m_errorString; - - friend class QDeclarativeMediaBaseAnimation; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp b/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp deleted file mode 100644 index 064f242..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo.cpp +++ /dev/null @@ -1,945 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativevideo_p.h" - -#include -#include -#include -#include -#include - - -QT_BEGIN_NAMESPACE - - -void QDeclarativeVideo::_q_nativeSizeChanged(const QSizeF &size) -{ - setImplicitWidth(size.width()); - setImplicitHeight(size.height()); -} - -void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) -{ - m_error = QMediaPlayer::Error(errorCode); - m_errorString = errorString; - - emit error(Error(errorCode), errorString); - emit errorChanged(); -} - - -/*! - \qmlclass Video QDeclarativeVideo - \since 4.7 - \brief The Video element allows you to add videos to a scene. - \inherits Item - - \qml - Video { source: "video/movie.mpg" } - \endqml - - The video item supports untransformed, stretched, and uniformly scaled video presentation. - For a description of stretched uniformly scaled presentation, see the \l fillMode property - description. - - The video item is only visible when the \l hasVideo property is true and the video is playing. - - \sa Audio -*/ - -/*! - \internal - \class QDeclarativeVideo - \brief The QDeclarativeVideo class provides a video item that you can add to a QDeclarativeView. -*/ - -QDeclarativeVideo::QDeclarativeVideo(QDeclarativeItem *parent) - : QDeclarativeItem(parent) - , m_graphicsItem(0) - -{ - m_graphicsItem = new QGraphicsVideoItem(this); - connect(m_graphicsItem, SIGNAL(nativeSizeChanged(QSizeF)), - this, SLOT(_q_nativeSizeChanged(QSizeF))); - - setObject(this); - - if (m_mediaService) { - connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)), - this, SIGNAL(hasAudioChanged())); - connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)), - this, SIGNAL(hasVideoChanged())); - - m_graphicsItem->setMediaObject(m_mediaObject); - } -} - -QDeclarativeVideo::~QDeclarativeVideo() -{ - shutdown(); - - delete m_graphicsItem; -} - -/*! - \qmlproperty url Video::source - - This property holds the source URL of the media. -*/ - -/*! - \qmlproperty bool Video::playing - - This property holds whether the media is playing. - - Defaults to false, and can be set to true to start playback. -*/ - -/*! - \qmlproperty bool Video::paused - - This property holds whether the media is paused. - - Defaults to false, and can be set to true to pause playback. -*/ - -/*! - \qmlsignal Video::onStarted() - - This handler is called when playback is started. -*/ - -/*! - \qmlsignal Video::onResumed() - - This handler is called when playback is resumed from the paused state. -*/ - -/*! - \qmlsignal Video::onPaused() - - This handler is called when playback is paused. -*/ - -/*! - \qmlsignal Video::onStopped() - - This handler is called when playback is stopped. -*/ - -/*! - \qmlproperty enum Video::status - - This property holds the status of media loading. It can be one of: - - \list - \o NoMedia - no media has been set. - \o Loading - the media is currently being loaded. - \o Loaded - the media has been loaded. - \o Buffering - the media is buffering data. - \o Stalled - playback has been interrupted while the media is buffering data. - \o Buffered - the media has buffered data. - \o EndOfMedia - the media has played to the end. - \o InvalidMedia - the media cannot be played. - \o UnknownStatus - the status of the media is cannot be determined. - \endlist -*/ - -QDeclarativeVideo::Status QDeclarativeVideo::status() const -{ - return Status(m_status); -} - -/*! - \qmlsignal Video::onLoaded() - - This handler is called when the media source has been loaded. -*/ - -/*! - \qmlsignal Video::onBuffering() - - This handler is called when the media starts buffering. -*/ - -/*! - \qmlsignal Video::onStalled() - - This handler is called when playback has stalled while the media buffers. -*/ - -/*! - \qmlsignal Video::onBuffered() - - This handler is called when the media has finished buffering. -*/ - -/*! - \qmlsignal Video::onEndOfMedia() - - This handler is called when playback stops because end of the media has been reached. -*/ - -/*! - \qmlproperty int Video::duration - - This property holds the duration of the media in milliseconds. - - If the media doesn't have a fixed duration (a live stream for example) this will be 0. -*/ - -/*! - \qmlproperty int Video::position - - This property holds the current playback position in milliseconds. -*/ - -/*! - \qmlproperty qreal Video::volume - - This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). -*/ - -/*! - \qmlproperty bool Video::muted - - This property holds whether the audio output is muted. -*/ - -/*! - \qmlproperty bool Video::hasAudio - - This property holds whether the media contains audio. -*/ - -bool QDeclarativeVideo::hasAudio() const -{ - return m_playerControl->isAudioAvailable(); -} - -/*! - \qmlproperty bool Video::hasVideo - - This property holds whether the media contains video. -*/ - -bool QDeclarativeVideo::hasVideo() const -{ - return m_playerControl->isVideoAvailable(); -} - -/*! - \qmlproperty qreal Video::bufferProgress - - This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 - (full). -*/ - -/*! - \qmlproperty bool Video::seekable - - This property holds whether position of the video can be changed. -*/ - -/*! - \qmlproperty qreal Video::playbackRate - - This property holds the rate at which video is played at as a multiple of the normal rate. -*/ - -/*! - \qmlproperty enum Video::error - - This property holds the error state of the video. It can be one of: - - \list - \o NoError - there is no current error. - \o ResourceError - the video cannot be played due to a problem allocating resources. - \o FormatError - the video format is not supported. - \o NetworkError - the video cannot be played due to network issues. - \o AccessDenied - the video cannot be played due to insufficient permissions. - \o ServiceMissing - the video cannot be played because the media service could not be - instantiated. - \endlist -*/ - - -QDeclarativeVideo::Error QDeclarativeVideo::error() const -{ - return Error(m_error); -} - -/*! - \qmlproperty string Video::errorString - - This property holds a string describing the current error condition in more detail. -*/ - -/*! - \qmlsignal Video::onError(error, errorString) - - This handler is called when an \l {Error}{error} has occurred. The errorString parameter - may contain more detailed information about the error. -*/ - -/*! - \qmlproperty enum Video::fillMode - - Set this property to define how the video is scaled to fit the target area. - - \list - \o Stretch - the video is scaled to fit. - \o PreserveAspectFit - the video is scaled uniformly to fit without cropping - \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary - \endlist - - The default fill mode is PreserveAspectFit. -*/ - -QDeclarativeVideo::FillMode QDeclarativeVideo::fillMode() const -{ - return FillMode(m_graphicsItem->aspectRatioMode()); -} - -void QDeclarativeVideo::setFillMode(FillMode mode) -{ - m_graphicsItem->setAspectRatioMode(Qt::AspectRatioMode(mode)); -} - -/*! - \qmlmethod Video::play() - - Starts playback of the media. - - Sets the \l playing property to true, and the \l paused property to false. -*/ - -void QDeclarativeVideo::play() -{ - m_playerControl->play(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Video::pause() - - Pauses playback of the media. - - Sets the \l playing and \l paused properties to true. -*/ - -void QDeclarativeVideo::pause() -{ - m_playerControl->pause(); - - if (!m_paused && m_state == QMediaPlayer::PausedState) { - m_paused = true; - emit pausedChanged(); - } -} - -/*! - \qmlmethod Video::stop() - - Stops playback of the media. - - Sets the \l playing and \l paused properties to false. -*/ - -void QDeclarativeVideo::stop() -{ - m_playerControl->stop(); - - if (m_paused) { - m_paused = false; - emit pausedChanged(); - } -} - -void QDeclarativeVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) -{ -} - -void QDeclarativeVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - m_graphicsItem->setSize(newGeometry.size()); - - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); -} - -QT_END_NAMESPACE - -// *************************************** -// Documentation for meta-data properties. -// *************************************** - -/*! - \qmlproperty variant Video::title - - This property holds the tile of the media. - - \sa {QtMultimedia::Title} -*/ - -/*! - \qmlproperty variant Video::subTitle - - This property holds the sub-title of the media. - - \sa {QtMultimedia::SubTitle} -*/ - -/*! - \qmlproperty variant Video::author - - This property holds the author of the media. - - \sa {QtMultimedia::Author} -*/ - -/*! - \qmlproperty variant Video::comment - - This property holds a user comment about the media. - - \sa {QtMultimedia::Comment} -*/ - -/*! - \qmlproperty variant Video::description - - This property holds a description of the media. - - \sa {QtMultimedia::Description} -*/ - -/*! - \qmlproperty variant Video::category - - This property holds the category of the media - - \sa {QtMultimedia::Category} -*/ - -/*! - \qmlproperty variant Video::genre - - This property holds the genre of the media. - - \sa {QtMultimedia::Genre} -*/ - -/*! - \qmlproperty variant Video::year - - This property holds the year of release of the media. - - \sa {QtMultimedia::Year} -*/ - -/*! - \qmlproperty variant Video::date - - This property holds the date of the media. - - \sa {QtMultimedia::Date} -*/ - -/*! - \qmlproperty variant Video::userRating - - This property holds a user rating of the media in the range of 0 to 100. - - \sa {QtMultimedia::UserRating} -*/ - -/*! - \qmlproperty variant Video::keywords - - This property holds a list of keywords describing the media. - - \sa {QtMultimedia::Keywords} -*/ - -/*! - \qmlproperty variant Video::language - - This property holds the language of the media, as an ISO 639-2 code. - - \sa {QtMultimedia::Language} -*/ - -/*! - \qmlproperty variant Video::publisher - - This property holds the publisher of the media. - - \sa {QtMultimedia::Publisher} -*/ - -/*! - \qmlproperty variant Video::copyright - - This property holds the media's copyright notice. - - \sa {QtMultimedia::Copyright} -*/ - -/*! - \qmlproperty variant Video::parentalRating - - This property holds the parental rating of the media. - - \sa {QtMultimedia::ParentalRating} -*/ - -/*! - \qmlproperty variant Video::ratingOrganisation - - This property holds the name of the rating organisation responsible for the - parental rating of the media. - - \sa {QtMultimedia::RatingOrganisation} -*/ - -/*! - \qmlproperty variant Video::size - - This property property holds the size of the media in bytes. - - \sa {QtMultimedia::Size} -*/ - -/*! - \qmlproperty variant Video::mediaType - - This property holds the type of the media. - - \sa {QtMultimedia::MediaType} -*/ - -/*! - \qmlproperty variant Video::audioBitRate - - This property holds the bit rate of the media's audio stream ni bits per - second. - - \sa {QtMultimedia::AudioBitRate} -*/ - -/*! - \qmlproperty variant Video::audioCodec - - This property holds the encoding of the media audio stream. - - \sa {QtMultimedia::AudioCodec} -*/ - -/*! - \qmlproperty variant Video::averageLevel - - This property holds the average volume level of the media. - - \sa {QtMultimedia::AverageLevel} -*/ - -/*! - \qmlproperty variant Video::channelCount - - This property holds the number of channels in the media's audio stream. - - \sa {QtMultimedia::ChannelCount} -*/ - -/*! - \qmlproperty variant Video::peakValue - - This property holds the peak volume of media's audio stream. - - \sa {QtMultimedia::PeakValue} -*/ - -/*! - \qmlproperty variant Video::sampleRate - - This property holds the sample rate of the media's audio stream in hertz. - - \sa {QtMultimedia::SampleRate} -*/ - -/*! - \qmlproperty variant Video::albumTitle - - This property holds the title of the album the media belongs to. - - \sa {QtMultimedia::AlbumTitle} -*/ - -/*! - \qmlproperty variant Video::albumArtist - - This property holds the name of the principal artist of the album the media - belongs to. - - \sa {QtMultimedia::AlbumArtist} -*/ - -/*! - \qmlproperty variant Video::contributingArtist - - This property holds the names of artists contributing to the media. - - \sa {QtMultimedia::ContributingArtist} -*/ - -/*! - \qmlproperty variant Video::composer - - This property holds the composer of the media. - - \sa {QtMultimedia::Composer} -*/ - -/*! - \qmlproperty variant Video::conductor - - This property holds the conductor of the media. - - \sa {QtMultimedia::Conductor} -*/ - -/*! - \qmlproperty variant Video::lyrics - - This property holds the lyrics to the media. - - \sa {QtMultimedia::Lyrics} -*/ - -/*! - \qmlproperty variant Video::mood - - This property holds the mood of the media. - - \sa {QtMultimedia::Mood} -*/ - -/*! - \qmlproperty variant Video::trackNumber - - This property holds the track number of the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Video::trackCount - - This property holds the number of track on the album containing the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Video::coverArtUrlSmall - - This property holds the URL of a small cover art image. - - \sa {QtMultimedia::CoverArtUrlSmall} -*/ - -/*! - \qmlproperty variant Video::coverArtUrlLarge - - This property holds the URL of a large cover art image. - - \sa {QtMultimedia::CoverArtUrlLarge} -*/ - -/*! - \qmlproperty variant Video::resolution - - This property holds the dimension of an image or video. - - \sa {QtMultimedia::Resolution} -*/ - -/*! - \qmlproperty variant Video::pixelAspectRatio - - This property holds the pixel aspect ratio of an image or video. - - \sa {QtMultimedia::PixelAspectRatio} -*/ - -/*! - \qmlproperty variant Video::videoFrameRate - - This property holds the frame rate of the media's video stream. - - \sa {QtMultimedia::VideoFrameRate} -*/ - -/*! - \qmlproperty variant Video::videoBitRate - - This property holds the bit rate of the media's video stream in bits per - second. - - \sa {QtMultimedia::VideoBitRate} -*/ - -/*! - \qmlproperty variant Video::videoCodec - - This property holds the encoding of the media's video stream. - - \sa {QtMultimedia::VideoCodec} -*/ - -/*! - \qmlproperty variant Video::posterUrl - - This property holds the URL of a poster image. - - \sa {QtMultimedia::PosterUrl} -*/ - -/*! - \qmlproperty variant Video::chapterNumber - - This property holds the chapter number of the media. - - \sa {QtMultimedia::ChapterNumber} -*/ - -/*! - \qmlproperty variant Video::director - - This property holds the director of the media. - - \sa {QtMultimedia::Director} -*/ - -/*! - \qmlproperty variant Video::leadPerformer - - This property holds the lead performer in the media. - - \sa {QtMultimedia::LeadPerformer} -*/ - -/*! - \qmlproperty variant Video::writer - - This property holds the writer of the media. - - \sa {QtMultimedia::Writer} -*/ - -// The remaining properties are related to photos, and are technically -// available but will certainly never have values. -#ifndef Q_QDOC - -/*! - \qmlproperty variant Video::cameraManufacturer - - \sa {QtMultimedia::CameraManufacturer} -*/ - -/*! - \qmlproperty variant Video::cameraModel - - \sa {QtMultimedia::CameraModel} -*/ - -/*! - \qmlproperty variant Video::event - - \sa {QtMultimedia::Event} -*/ - -/*! - \qmlproperty variant Video::subject - - \sa {QtMultimedia::Subject} -*/ - -/*! - \qmlproperty variant Video::orientation - - \sa {QtMultimedia::Orientation} -*/ - -/*! - \qmlproperty variant Video::exposureTime - - \sa {QtMultimedia::ExposureTime} -*/ - -/*! - \qmlproperty variant Video::fNumber - - \sa {QtMultimedia::FNumber} -*/ - -/*! - \qmlproperty variant Video::exposureProgram - - \sa {QtMultimedia::ExposureProgram} -*/ - -/*! - \qmlproperty variant Video::isoSpeedRatings - - \sa {QtMultimedia::ISOSpeedRatings} -*/ - -/*! - \qmlproperty variant Video::exposureBiasValue - - \sa {QtMultimedia::ExposureBiasValue} -*/ - -/*! - \qmlproperty variant Video::dateTimeDigitized - - \sa {QtMultimedia::DateTimeDigitized} -*/ - -/*! - \qmlproperty variant Video::subjectDistance - - \sa {QtMultimedia::SubjectDistance} -*/ - -/*! - \qmlproperty variant Video::meteringMode - - \sa {QtMultimedia::MeteringMode} -*/ - -/*! - \qmlproperty variant Video::lightSource - - \sa {QtMultimedia::LightSource} -*/ - -/*! - \qmlproperty variant Video::flash - - \sa {QtMultimedia::Flash} -*/ - -/*! - \qmlproperty variant Video::focalLength - - \sa {QtMultimedia::FocalLength} -*/ - -/*! - \qmlproperty variant Video::exposureMode - - \sa {QtMultimedia::ExposureMode} -*/ - -/*! - \qmlproperty variant Video::whiteBalance - - \sa {QtMultimedia::WhiteBalance} -*/ - -/*! - \qmlproperty variant Video::DigitalZoomRatio - - \sa {QtMultimedia::DigitalZoomRatio} -*/ - -/*! - \qmlproperty variant Video::focalLengthIn35mmFilm - - \sa {QtMultimedia::FocalLengthIn35mmFile} -*/ - -/*! - \qmlproperty variant Video::sceneCaptureType - - \sa {QtMultimedia::SceneCaptureType} -*/ - -/*! - \qmlproperty variant Video::gainControl - - \sa {QtMultimedia::GainControl} -*/ - -/*! - \qmlproperty variant Video::contrast - - \sa {QtMultimedia::contrast} -*/ - -/*! - \qmlproperty variant Video::saturation - - \sa {QtMultimedia::Saturation} -*/ - -/*! - \qmlproperty variant Video::sharpness - - \sa {QtMultimedia::Sharpness} -*/ - -/*! - \qmlproperty variant Video::deviceSettingDescription - - \sa {QtMultimedia::DeviceSettingDescription} -*/ - -#endif - -#include "moc_qdeclarativevideo_p.cpp" diff --git a/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h b/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h deleted file mode 100644 index fb13519..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qdeclarativevideo_p.h +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIDEO_H -#define QDECLARATIVEVIDEO_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdeclarativemediabase_p.h" - -#include - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTimerEvent; -class QVideoSurfaceFormat; - - -class QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(int duration READ duration NOTIFY durationChanged) - Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(bool hasAudio READ hasAudio NOTIFY hasAudioChanged) - Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged) - Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) - Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) - Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) - Q_PROPERTY(Error error READ error NOTIFY errorChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode) - Q_ENUMS(FillMode) - Q_ENUMS(Status) - Q_ENUMS(Error) -public: - enum FillMode - { - Stretch = Qt::IgnoreAspectRatio, - PreserveAspectFit = Qt::KeepAspectRatio, - PreserveAspectCrop = Qt::KeepAspectRatioByExpanding - }; - - enum Status - { - UnknownStatus = QMediaPlayer::UnknownMediaStatus, - NoMedia = QMediaPlayer::NoMedia, - Loading = QMediaPlayer::LoadingMedia, - Loaded = QMediaPlayer::LoadedMedia, - Stalled = QMediaPlayer::StalledMedia, - Buffering = QMediaPlayer::BufferingMedia, - Buffered = QMediaPlayer::BufferedMedia, - EndOfMedia = QMediaPlayer::EndOfMedia, - InvalidMedia = QMediaPlayer::InvalidMedia - }; - - enum Error - { - NoError = QMediaPlayer::NoError, - ResourceError = QMediaPlayer::ResourceError, - FormatError = QMediaPlayer::FormatError, - NetworkError = QMediaPlayer::NetworkError, - AccessDenied = QMediaPlayer::AccessDeniedError, - ServiceMissing = QMediaPlayer::ServiceMissingError - }; - - QDeclarativeVideo(QDeclarativeItem *parent = 0); - ~QDeclarativeVideo(); - - bool hasAudio() const; - bool hasVideo() const; - - FillMode fillMode() const; - void setFillMode(FillMode mode); - - Status status() const; - Error error() const; - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - -public Q_SLOTS: - void play(); - void pause(); - void stop(); - -Q_SIGNALS: - void sourceChanged(); - - void playingChanged(); - void pausedChanged(); - - void started(); - void resumed(); - void paused(); - void stopped(); - - void statusChanged(); - - void loaded(); - void buffering(); - void stalled(); - void buffered(); - void endOfMedia(); - - void durationChanged(); - void positionChanged(); - - void volumeChanged(); - void mutedChanged(); - void hasAudioChanged(); - void hasVideoChanged(); - - void bufferProgressChanged(); - - void seekableChanged(); - void playbackRateChanged(); - - void errorChanged(); - void error(QDeclarativeVideo::Error error, const QString &errorString); - -protected: - void geometryChanged(const QRectF &geometry, const QRectF &); - -private Q_SLOTS: - void _q_nativeSizeChanged(const QSizeF &size); - void _q_error(int, const QString &); - -private: - Q_DISABLE_COPY(QDeclarativeVideo) - - QGraphicsVideoItem *m_graphicsItem; - - Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State)) - Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus)) - Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged()) - - inline QDeclarativeMediaBase *mediaBase() { return this; } -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeVideo)) - -QT_END_HEADER - -#endif diff --git a/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp b/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp deleted file mode 100644 index e90cbd6..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject.cpp +++ /dev/null @@ -1,362 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmetadatacontrolmetaobject_p.h" -#include - - -QT_BEGIN_NAMESPACE - -// copied from qmetaobject.cpp -// do not touch without touching the moc as well -enum PropertyFlags { - Invalid = 0x00000000, - Readable = 0x00000001, - Writable = 0x00000002, - Resettable = 0x00000004, - EnumOrFlag = 0x00000008, - StdCppSet = 0x00000100, -// Override = 0x00000200, - Designable = 0x00001000, - ResolveDesignable = 0x00002000, - Scriptable = 0x00004000, - ResolveScriptable = 0x00008000, - Stored = 0x00010000, - ResolveStored = 0x00020000, - Editable = 0x00040000, - ResolveEditable = 0x00080000, - User = 0x00100000, - ResolveUser = 0x00200000, - Notify = 0x00400000, - Dynamic = 0x00800000 -}; - -enum MethodFlags { - AccessPrivate = 0x00, - AccessProtected = 0x01, - AccessPublic = 0x02, - AccessMask = 0x03, //mask - - MethodMethod = 0x00, - MethodSignal = 0x04, - MethodSlot = 0x08, - MethodConstructor = 0x0c, - MethodTypeMask = 0x0c, - - MethodCompatibility = 0x10, - MethodCloned = 0x20, - MethodScriptable = 0x40 -}; - -struct QMetaObjectPrivate -{ - int revision; - int className; - int classInfoCount, classInfoData; - int methodCount, methodData; - int propertyCount, propertyData; - int enumeratorCount, enumeratorData; - int constructorCount, constructorData; - int flags; -}; - -static inline const QMetaObjectPrivate *priv(const uint* m_data) -{ return reinterpret_cast(m_data); } -// end of copied lines from qmetaobject.cpp - -namespace -{ - struct MetaDataKey - { - QtMultimedia::MetaData key; - const char *name; - }; - - const MetaDataKey qt_metaDataKeys[] = - { - { QtMultimedia::Title, "title" }, - { QtMultimedia::SubTitle, "subTitle" }, - { QtMultimedia::Author, "author" }, - { QtMultimedia::Comment, "comment" }, - { QtMultimedia::Description, "description" }, - { QtMultimedia::Category, "category" }, - { QtMultimedia::Genre, "genre" }, - { QtMultimedia::Year, "year" }, - { QtMultimedia::Date, "date" }, - { QtMultimedia::UserRating, "userRating" }, - { QtMultimedia::Keywords, "keywords" }, - { QtMultimedia::Language, "language" }, - { QtMultimedia::Publisher, "publisher" }, - { QtMultimedia::Copyright, "copyright" }, - { QtMultimedia::ParentalRating, "parentalRating" }, - { QtMultimedia::RatingOrganisation, "ratingOrganisation" }, - - // Media - { QtMultimedia::Size, "size" }, - { QtMultimedia::MediaType, "mediaType" }, -// { QtMultimedia::Duration, "duration" }, - - // Audio - { QtMultimedia::AudioBitRate, "audioBitRate" }, - { QtMultimedia::AudioCodec, "audioCodec" }, - { QtMultimedia::AverageLevel, "averageLevel" }, - { QtMultimedia::ChannelCount, "channelCount" }, - { QtMultimedia::PeakValue, "peakValue" }, - { QtMultimedia::SampleRate, "sampleRate" }, - - // Music - { QtMultimedia::AlbumTitle, "albumTitle" }, - { QtMultimedia::AlbumArtist, "albumArtist" }, - { QtMultimedia::ContributingArtist, "contributingArtist" }, - { QtMultimedia::Composer, "composer" }, - { QtMultimedia::Conductor, "conductor" }, - { QtMultimedia::Lyrics, "lyrics" }, - { QtMultimedia::Mood, "mood" }, - { QtMultimedia::TrackNumber, "trackNumber" }, - { QtMultimedia::TrackCount, "trackCount" }, - - { QtMultimedia::CoverArtUrlSmall, "coverArtUrlSmall" }, - { QtMultimedia::CoverArtUrlLarge, "coverArtUrlLarge" }, - - // Image/Video - { QtMultimedia::Resolution, "resolution" }, - { QtMultimedia::PixelAspectRatio, "pixelAspectRatio" }, - - // Video - { QtMultimedia::VideoFrameRate, "videoFrameRate" }, - { QtMultimedia::VideoBitRate, "videoBitRate" }, - { QtMultimedia::VideoCodec, "videoCodec" }, - - { QtMultimedia::PosterUrl, "posterUrl" }, - - // Movie - { QtMultimedia::ChapterNumber, "chapterNumber" }, - { QtMultimedia::Director, "director" }, - { QtMultimedia::LeadPerformer, "leadPerformer" }, - { QtMultimedia::Writer, "writer" }, - - // Photos - { QtMultimedia::CameraManufacturer, "cameraManufacturer" }, - { QtMultimedia::CameraModel, "cameraModel" }, - { QtMultimedia::Event, "event" }, - { QtMultimedia::Subject, "subject" }, - { QtMultimedia::Orientation, "orientation" }, - { QtMultimedia::ExposureTime, "exposureTime" }, - { QtMultimedia::FNumber, "fNumber" }, - { QtMultimedia::ExposureProgram, "exposureProgram" }, - { QtMultimedia::ISOSpeedRatings, "isoSpeedRatings" }, - { QtMultimedia::ExposureBiasValue, "exposureBiasValue" }, - { QtMultimedia::DateTimeOriginal, "dateTimeOriginal" }, - { QtMultimedia::DateTimeDigitized, "dateTimeDigitized" }, - { QtMultimedia::SubjectDistance, "subjectDistance" }, - { QtMultimedia::MeteringMode, "meteringMode" }, - { QtMultimedia::LightSource, "lightSource" }, - { QtMultimedia::Flash, "flash" }, - { QtMultimedia::FocalLength, "focalLength" }, - { QtMultimedia::ExposureMode, "exposureMode" }, - { QtMultimedia::WhiteBalance, "whiteBalance" }, - { QtMultimedia::DigitalZoomRatio, "digitalZoomRatio" }, - { QtMultimedia::FocalLengthIn35mmFilm, "focalLengthIn35mmFilm" }, - { QtMultimedia::SceneCaptureType, "sceneCaptureType" }, - { QtMultimedia::GainControl, "gainControl" }, - { QtMultimedia::Contrast, "contrast" }, - { QtMultimedia::Saturation, "saturation" }, - { QtMultimedia::Sharpness, "sharpness" }, - { QtMultimedia::DeviceSettingDescription, "deviceSettingDescription" } - }; - - class QMetaDataControlObject : public QObject - { - public: - inline QObjectData *data() { return d_ptr.data(); } - }; -} - -QMetaDataControlMetaObject::QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object) - : m_control(control) - , m_object(object) - , m_string(0) - , m_data(0) - , m_propertyOffset(0) - , m_signalOffset(0) -{ - const QMetaObject *superClass = m_object->metaObject(); - - const int propertyCount = sizeof(qt_metaDataKeys) / sizeof(MetaDataKey); - const int dataSize = sizeof(uint) - * (13 // QMetaObjectPrivate members. - + 5 // 5 members per signal. - + 4 * propertyCount // 3 members per property + 1 notify signal per property. - + 1); // Terminating value. - - m_data = reinterpret_cast(qMalloc(dataSize)); - - QMetaObjectPrivate *pMeta = reinterpret_cast(m_data); - - pMeta->revision = 3; - pMeta->className = 0; - pMeta->classInfoCount = 0; - pMeta->classInfoData = 0; - pMeta->methodCount = 1; - pMeta->methodData = 13; - pMeta->propertyCount = propertyCount; - pMeta->propertyData = 18; - pMeta->enumeratorCount = 0; - pMeta->enumeratorData = 0; - pMeta->constructorCount = 0; - pMeta->constructorData = 0; - pMeta->flags = 0x01; // Dynamic meta object flag. - - const int classNameSize = qstrlen(superClass->className()) + 1; - - int stringIndex = classNameSize + 1; - - // __metaDataChanged() signal. - static const char *changeSignal = "__metaDataChanged()"; - const int changeSignalSize = qstrlen(changeSignal) + 1; - - m_data[13] = stringIndex; // Signature. - m_data[14] = classNameSize; // Parameters. - m_data[15] = classNameSize; // Type. - m_data[16] = classNameSize; // Tag. - m_data[17] = MethodSignal | AccessProtected; // Flags. - - stringIndex += changeSignalSize; - - const char *qvariantName = "QVariant"; - const int qvariantSize = qstrlen(qvariantName) + 1; - const int qvariantIndex = stringIndex; - - stringIndex += qvariantSize; - - // Properties. - for (int i = 0; i < propertyCount; ++i) { - m_data[18 + 3 * i] = stringIndex; // Name. - m_data[19 + 3 * i] = qvariantIndex; // Type. - m_data[20 + 3 * i] - = Readable | Writable | Notify | Dynamic | (0xffffffff << 24); // Flags. - m_data[18 + propertyCount * 3 + i] = 0; // Notify signal. - - stringIndex += qstrlen(qt_metaDataKeys[i].name) + 1; - } - - // Terminating value. - m_data[18 + propertyCount * 4] = 0; - - // Build string. - m_string = reinterpret_cast(qMalloc(stringIndex + 1)); - - // Class name. - qMemCopy(m_string, superClass->className(), classNameSize); - - stringIndex = classNameSize; - - // Null m_string. - m_string[stringIndex] = '\0'; - stringIndex += 1; - - // __metaDataChanged() signal. - qMemCopy(m_string + stringIndex, changeSignal, changeSignalSize); - stringIndex += changeSignalSize; - - qMemCopy(m_string + stringIndex, qvariantName, qvariantSize); - stringIndex += qvariantSize; - - // Properties. - for (int i = 0; i < propertyCount; ++i) { - const int propertyNameSize = qstrlen(qt_metaDataKeys[i].name) + 1; - - qMemCopy(m_string + stringIndex, qt_metaDataKeys[i].name, propertyNameSize); - stringIndex += propertyNameSize; - } - - // Terminating character. - m_string[stringIndex] = '\0'; - - d.superdata = superClass; - d.stringdata = m_string; - d.data = m_data; - d.extradata = 0; - - static_cast(m_object)->data()->metaObject = this; - - m_propertyOffset = propertyOffset(); - m_signalOffset = methodOffset(); -} - -QMetaDataControlMetaObject::~QMetaDataControlMetaObject() -{ - static_cast(m_object)->data()->metaObject = 0; - - qFree(m_data); - qFree(m_string); -} - -int QMetaDataControlMetaObject::metaCall(QMetaObject::Call c, int id, void **a) -{ - if (c == QMetaObject::ReadProperty && id >= m_propertyOffset) { - int propId = id - m_propertyOffset; - - *reinterpret_cast(a[0]) = m_control->metaData(qt_metaDataKeys[propId].key); - - return -1; - } else if (c == QMetaObject::WriteProperty && id >= m_propertyOffset) { - int propId = id - m_propertyOffset; - - m_control->setMetaData(qt_metaDataKeys[propId].key, *reinterpret_cast(a[0])); - - return -1; - } else { - return m_object->qt_metacall(c, id, a); - } -} - -int QMetaDataControlMetaObject::createProperty(const char *, const char *) -{ - return -1; -} - -void QMetaDataControlMetaObject::metaDataChanged() -{ - activate(m_object, m_signalOffset, 0); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h b/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h deleted file mode 100644 index c381f2d..0000000 --- a/src/plugins/qdeclarativemodules/multimedia/qmetadatacontrolmetaobject_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMETADATACONTROLMETAOBJECT_P_H -#define QMETADATACONTROLMETAOJBECT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QMetaDataControl; - -class QMetaDataControlMetaObject : public QAbstractDynamicMetaObject -{ -public: - QMetaDataControlMetaObject(QMetaDataControl *control, QObject *object); - ~QMetaDataControlMetaObject(); - - int metaCall(QMetaObject::Call call, int _id, void **arguments); - int createProperty(const char *, const char *); - - void metaDataChanged(); - -private: - QMetaDataControl *m_control; - QObject *m_object; - char *m_string; - uint *m_data; - - int m_propertyOffset; - int m_signalOffset; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif -- cgit v0.12 From 372f474d97f2169597f994ee80e6c3d5b7f6d7bf Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 4 Mar 2010 17:16:54 +1000 Subject: Mark QGraphicsItem position properties as FINAL Some of these properties were already final, so this improves the consistency. QTBUG-7948. --- src/gui/graphicsview/qgraphicsitem.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index d72833b..56f94a2 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -540,10 +540,10 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) - Q_PROPERTY(QPointF pos READ pos WRITE setPos) - Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) - Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) - Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged) + Q_PROPERTY(QPointF pos READ pos WRITE setPos FINAL) + Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) + Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) + Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged FINAL) Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) -- cgit v0.12 From 4802116c73c0b9ee80dddc8ef4720bfdbde4e885 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 4 Mar 2010 17:20:52 +1000 Subject: Add support for tab and backtab in KeyNavigation Task-number: QT-3046 --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 88 ++++++++++++++++++---- src/declarative/graphicsitems/qdeclarativeitem_p.h | 13 +++- 2 files changed, 87 insertions(+), 14 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 5014fd8..3bee5b8 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -498,6 +498,32 @@ void QDeclarativeKeyNavigationAttached::setDown(QDeclarativeItem *i) emit changed(); } +QDeclarativeItem *QDeclarativeKeyNavigationAttached::tab() const +{ + Q_D(const QDeclarativeKeyNavigationAttached); + return d->tab; +} + +void QDeclarativeKeyNavigationAttached::setTab(QDeclarativeItem *i) +{ + Q_D(QDeclarativeKeyNavigationAttached); + d->tab = i; + emit changed(); +} + +QDeclarativeItem *QDeclarativeKeyNavigationAttached::backtab() const +{ + Q_D(const QDeclarativeKeyNavigationAttached); + return d->backtab; +} + +void QDeclarativeKeyNavigationAttached::setBacktab(QDeclarativeItem *i) +{ + Q_D(QDeclarativeKeyNavigationAttached); + d->backtab = i; + emit changed(); +} + void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event) { Q_D(QDeclarativeKeyNavigationAttached); @@ -529,6 +555,18 @@ void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event) event->accept(); } break; + case Qt::Key_Tab: + if (d->tab) { + d->tab->setFocus(true); + event->accept(); + } + break; + case Qt::Key_Backtab: + if (d->backtab) { + d->backtab->setFocus(true); + event->accept(); + } + break; default: break; } @@ -563,6 +601,16 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event) event->accept(); } break; + case Qt::Key_Tab: + if (d->tab) { + event->accept(); + } + break; + case Qt::Key_Backtab: + if (d->backtab) { + event->accept(); + } + break; default: break; } @@ -902,6 +950,8 @@ const QDeclarativeKeysAttached::SigMap QDeclarativeKeysAttached::sigMap[] = { { Qt::Key_Right, "rightPressed" }, { Qt::Key_Up, "upPressed" }, { Qt::Key_Down, "downPressed" }, + { Qt::Key_Tab, "tabPressed" }, + { Qt::Key_Backtab, "backtabPressed" }, { Qt::Key_Asterisk, "asteriskPressed" }, { Qt::Key_NumberSign, "numberSignPressed" }, { Qt::Key_Escape, "escapePressed" }, @@ -1440,7 +1490,7 @@ QDeclarativeAnchors *QDeclarativeItem::anchors() void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty *prop, QObject *o) { QDeclarativeItem *i = qobject_cast(o); - if (i) + if (i) i->setParentItem(static_cast(prop->object)); else o->setParent(static_cast(prop->object)); @@ -1568,7 +1618,7 @@ void QDeclarativeItemPrivate::transform_clear(QDeclarativeListProperty QDeclarativeItem::data() +QDeclarativeListProperty QDeclarativeItem::data() { return QDeclarativeListProperty(this, 0, QDeclarativeItemPrivate::data_append); } @@ -2179,16 +2229,16 @@ void QDeclarativeItem::focusChanged(bool flag) QDeclarativeListProperty QDeclarativeItem::fxChildren() { return QDeclarativeListProperty(this, 0, QDeclarativeItemPrivate::children_append, - QDeclarativeItemPrivate::children_count, - QDeclarativeItemPrivate::children_at); + QDeclarativeItemPrivate::children_count, + QDeclarativeItemPrivate::children_at); } /*! \internal */ QDeclarativeListProperty QDeclarativeItem::resources() { - return QDeclarativeListProperty(this, 0, QDeclarativeItemPrivate::resources_append, - QDeclarativeItemPrivate::resources_count, - QDeclarativeItemPrivate::resources_at); + return QDeclarativeListProperty(this, 0, QDeclarativeItemPrivate::resources_append, + QDeclarativeItemPrivate::resources_count, + QDeclarativeItemPrivate::resources_at); } /*! @@ -2465,14 +2515,26 @@ QPointF QDeclarativeItemPrivate::computeTransformOrigin() const /*! \internal */ bool QDeclarativeItem::sceneEvent(QEvent *event) { - bool rv = QGraphicsItem::sceneEvent(event); + if (event->type() == QEvent::KeyPress) { + QKeyEvent *k = static_cast(event); - if (event->type() == QEvent::FocusIn || - event->type() == QEvent::FocusOut) { - focusChanged(hasFocus()); - } + if ((k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) && + !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { + keyPressEvent(static_cast(event)); + if (!event->isAccepted()) + QGraphicsItem::sceneEvent(event); + } else { + QGraphicsItem::sceneEvent(event); + } + } else { + bool rv = QGraphicsItem::sceneEvent(event); - return rv; + if (event->type() == QEvent::FocusIn || + event->type() == QEvent::FocusOut) { + focusChanged(hasFocus()); + } + return rv; + } } /*! \internal */ diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index 4b4917e..e424970 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -289,12 +289,14 @@ class QDeclarativeKeyNavigationAttachedPrivate : public QObjectPrivate { public: QDeclarativeKeyNavigationAttachedPrivate() - : QObjectPrivate(), left(0), right(0), up(0), down(0) {} + : QObjectPrivate(), left(0), right(0), up(0), down(0), tab(0), backtab(0) {} QDeclarativeItem *left; QDeclarativeItem *right; QDeclarativeItem *up; QDeclarativeItem *down; + QDeclarativeItem *tab; + QDeclarativeItem *backtab; }; class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeItemKeyFilter @@ -306,6 +308,9 @@ class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeIte Q_PROPERTY(QDeclarativeItem *right READ right WRITE setRight NOTIFY changed) Q_PROPERTY(QDeclarativeItem *up READ up WRITE setUp NOTIFY changed) Q_PROPERTY(QDeclarativeItem *down READ down WRITE setDown NOTIFY changed) + Q_PROPERTY(QDeclarativeItem *tab READ tab WRITE setTab NOTIFY changed) + Q_PROPERTY(QDeclarativeItem *backtab READ backtab WRITE setBacktab NOTIFY changed) + public: QDeclarativeKeyNavigationAttached(QObject * = 0); @@ -317,6 +322,10 @@ public: void setUp(QDeclarativeItem *); QDeclarativeItem *down() const; void setDown(QDeclarativeItem *); + QDeclarativeItem *tab() const; + void setTab(QDeclarativeItem *); + QDeclarativeItem *backtab() const; + void setBacktab(QDeclarativeItem *); static QDeclarativeKeyNavigationAttached *qmlAttachedProperties(QObject *); @@ -407,6 +416,8 @@ Q_SIGNALS: void rightPressed(QDeclarativeKeyEvent *event); void upPressed(QDeclarativeKeyEvent *event); void downPressed(QDeclarativeKeyEvent *event); + void tabPressed(QDeclarativeKeyEvent *event); + void backtabPressed(QDeclarativeKeyEvent *event); void asteriskPressed(QDeclarativeKeyEvent *event); void numberSignPressed(QDeclarativeKeyEvent *event); -- cgit v0.12 From 787da2f188c34fd932662ee0229908bec8c4c91a Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 4 Mar 2010 17:21:33 +1000 Subject: Added playlist playback modes combo box to player demo Reviewed-by: Justin McPherson --- demos/multimedia/player/player.cpp | 28 +++++++++++++++++++++++++++- demos/multimedia/player/player.h | 3 +++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/demos/multimedia/player/player.cpp b/demos/multimedia/player/player.cpp index 49d18cb..af30a97 100644 --- a/demos/multimedia/player/player.cpp +++ b/demos/multimedia/player/player.cpp @@ -81,6 +81,22 @@ Player::Player(QWidget *parent) connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex))); + playbackModeBox = new QComboBox; + playbackModeBox->addItem(tr("Linear"), + QVariant::fromValue(QMediaPlaylist::Linear)); + playbackModeBox->addItem(tr("Loop"), + QVariant::fromValue(QMediaPlaylist::Loop)); + playbackModeBox->addItem(tr("Random"), + QVariant::fromValue(QMediaPlaylist::Random)); + playbackModeBox->addItem(tr("Current Item Once"), + QVariant::fromValue(QMediaPlaylist::CurrentItemOnce)); + playbackModeBox->addItem(tr("Current Item In Loop"), + QVariant::fromValue(QMediaPlaylist::CurrentItemInLoop)); + playbackModeBox->setCurrentIndex(0); + + connect(playbackModeBox, SIGNAL(activated(int)), SLOT(updatePlaybackMode())); + updatePlaybackMode(); + slider = new QSlider(Qt::Horizontal); slider->setRange(0, player->duration() / 1000); @@ -126,12 +142,16 @@ Player::Player(QWidget *parent) else colorButton->setEnabled(false); + QBoxLayout *playlistLayout = new QVBoxLayout; + playlistLayout->addWidget(playlistView); + playlistLayout->addWidget(playbackModeBox); + QBoxLayout *displayLayout = new QHBoxLayout; if (videoWidget) displayLayout->addWidget(videoWidget, 2); else displayLayout->addWidget(coverLabel, 2); - displayLayout->addWidget(playlistView); + displayLayout->addLayout(playlistLayout); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); @@ -333,3 +353,9 @@ void Player::showColorDialog() } colorDialog->show(); } + +void Player::updatePlaybackMode() +{ + playlist->setPlaybackMode( + playbackModeBox->itemData(playbackModeBox->currentIndex()).value()); +} diff --git a/demos/multimedia/player/player.h b/demos/multimedia/player/player.h index 1de8b1a..cda3eb9 100644 --- a/demos/multimedia/player/player.h +++ b/demos/multimedia/player/player.h @@ -57,6 +57,7 @@ class QAbstractItemView; class QLabel; class QModelIndex; class QSlider; +class QComboBox; class QMediaPlayer; class QVideoWidget; class PlaylistModel; @@ -87,6 +88,7 @@ private slots: void bufferingProgress(int progress); void showColorDialog(); + void updatePlaybackMode(); private: void setTrackInfo(const QString &info); @@ -97,6 +99,7 @@ private: QVideoWidget *videoWidget; QLabel *coverLabel; QSlider *slider; + QComboBox *playbackModeBox; PlaylistModel *playlistModel; QAbstractItemView *playlistView; QDialog *colorDialog; -- cgit v0.12 From c871d201a65b1524c0590e2d6ad77b8666338b08 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 4 Mar 2010 17:23:09 +1000 Subject: Fixup test --- tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml index 3d45b15..5ba324a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - property alias x: item.x + property alias blah: item.x Item { id: item } function testFunction() { return 9; } -- cgit v0.12 From 53af250a5366b4259bfb97a6b3c29c31e0aa10e0 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 4 Mar 2010 17:23:22 +1000 Subject: Debug media player status and media state changes. Disabled by default. Reviewed-by: Justin McPherson --- src/multimedia/playback/qmediaplayer.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 8056878..9466cad 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -55,6 +56,7 @@ #include #include +//#define DEBUG_PLAYER_STATE QT_BEGIN_HEADER @@ -152,10 +154,16 @@ public: void _q_playlistDestroyed(); }; +#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v))) + void QMediaPlayerPrivate::_q_stateChanged(QMediaPlayer::State ps) { Q_Q(QMediaPlayer); +#ifdef DEBUG_PLAYER_STATE + qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", ps) << (filterStates ? "(filtered)" : ""); +#endif + if (filterStates) return; @@ -183,6 +191,10 @@ void QMediaPlayerPrivate::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status { Q_Q(QMediaPlayer); +#ifdef DEBUG_PLAYER_STATE + qDebug() << "MediaStatus changed:" << ENUM_NAME(QMediaPlayer, "MediaStatus", status); +#endif + switch (status) { case QMediaPlayer::StalledMedia: case QMediaPlayer::BufferingMedia: @@ -230,8 +242,12 @@ void QMediaPlayerPrivate::_q_updateMedia(const QMediaContent &media) state = control->state(); - if (state != currentState) + if (state != currentState) { +#ifdef DEBUG_PLAYER_STATE + qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", state); +#endif emit q_func()->stateChanged(state); + } } void QMediaPlayerPrivate::_q_playlistDestroyed() -- cgit v0.12 From 5a3b9d3daf64ea686427478391d3773c5a1e024e Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 4 Mar 2010 17:26:19 +1000 Subject: WaveDecoder; be more permissive in handling of wave file formats. Reviewed-by: Dmytro Poplavskiy --- src/multimedia/effects/wavedecoder_p.cpp | 21 ++++++++++++++++----- src/multimedia/effects/wavedecoder_p.h | 1 - 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/multimedia/effects/wavedecoder_p.cpp b/src/multimedia/effects/wavedecoder_p.cpp index f2277ae..b534ded 100644 --- a/src/multimedia/effects/wavedecoder_p.cpp +++ b/src/multimedia/effects/wavedecoder_p.cpp @@ -55,7 +55,7 @@ WaveDecoder::WaveDecoder(QIODevice *s, QObject *parent): { open(QIODevice::ReadOnly | QIODevice::Unbuffered); - if (source->bytesAvailable() >= sizeof(CombinedHeader)) + if (source->bytesAvailable() >= qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16))) QTimer::singleShot(0, this, SLOT(handleData())); else connect(source, SIGNAL(readyRead()), SLOT(handleData())); @@ -105,7 +105,7 @@ qint64 WaveDecoder::writeData(const char *data, qint64 len) void WaveDecoder::handleData() { - if (source->bytesAvailable() < sizeof(CombinedHeader)) + if (source->bytesAvailable() < qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16))) return; source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); @@ -114,12 +114,23 @@ void WaveDecoder::handleData() if (qstrncmp(header.riff.descriptor.id, "RIFF", 4) != 0 || qstrncmp(header.riff.type, "WAVE", 4) != 0 || qstrncmp(header.wave.descriptor.id, "fmt ", 4) != 0 || - (header.wave.audioFormat != 0 && header.wave.audioFormat != 1) || - qstrncmp(header.data.descriptor.id, "data", 4) != 0) { + (header.wave.audioFormat != 0 && header.wave.audioFormat != 1)) { emit invalidFormat(); } else { + DATAHeader dataHeader; + + if (qFromLittleEndian(header.wave.descriptor.size) > sizeof(WAVEHeader)) { + // Extended data available + quint16 extraFormatBytes; + source->peek((char*)&extraFormatBytes, sizeof(quint16)); + extraFormatBytes = qFromLittleEndian(extraFormatBytes); + source->read(sizeof(quint16) + extraFormatBytes); // dump it all + } + + source->read((char*)&dataHeader, sizeof(DATAHeader)); + int bps = qFromLittleEndian(header.wave.bitsPerSample); format.setCodec(QLatin1String("audio/pcm")); @@ -129,7 +140,7 @@ void WaveDecoder::handleData() format.setSampleSize(bps); format.setChannels(qFromLittleEndian(header.wave.numChannels)); - dataSize = qFromLittleEndian(header.data.descriptor.size); + dataSize = qFromLittleEndian(dataHeader.descriptor.size); haveFormat = true; connect(source, SIGNAL(readyRead()), SIGNAL(readyRead())); diff --git a/src/multimedia/effects/wavedecoder_p.h b/src/multimedia/effects/wavedecoder_p.h index 00aa14e..fa1f77e 100644 --- a/src/multimedia/effects/wavedecoder_p.h +++ b/src/multimedia/effects/wavedecoder_p.h @@ -116,7 +116,6 @@ private: { RIFFHeader riff; WAVEHeader wave; - DATAHeader data; }; bool haveFormat; -- cgit v0.12 From 6633234f5f19899dc54510b2bddb2ae1afd38318 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 4 Mar 2010 18:12:45 +1000 Subject: Run signal expressions on attached property objects in correct scope QTBUG-8677 --- src/declarative/qml/qdeclarativecompiler.cpp | 13 +++++++++---- src/declarative/qml/qdeclarativecompiler_p.h | 1 + src/declarative/qml/qdeclarativeinstruction_p.h | 1 + src/declarative/qml/qdeclarativevme.cpp | 8 ++++---- .../data/attachedPropertyScope.qml | 9 +++++++++ .../declarative/qdeclarativeecmascript/testtypes.h | 13 ++++++++++++- .../tst_qdeclarativeecmascript.cpp | 21 +++++++++++++++++++++ .../data/attachedProperties.qml | 2 -- .../tst_qdeclarativelanguage.cpp | 5 ----- 9 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 32c746f..5a2f3b5 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -983,12 +983,15 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) } else if (v->type == Value::SignalExpression) { + BindingContext ctxt = compileState.signalExpressions.value(v); + QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreSignal; store.line = v->location.start.line; store.storeSignal.signalIndex = prop->index; store.storeSignal.value = output->indexForString(v->value.asScript().trimmed()); + store.storeSignal.context = ctxt.stack; output->bytecode << store; } @@ -1321,7 +1324,7 @@ QMetaMethod QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const } bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, - const BindingContext &ctxt) + const BindingContext &ctxt) { Q_ASSERT(obj->metaObject()); Q_ASSERT(!prop->isEmpty()); @@ -1357,6 +1360,8 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl QString script = prop->values.at(0)->value.asScript().trimmed(); if (script.isEmpty()) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Empty signal assignment")); + + compileState.signalExpressions.insert(prop->values.at(0), ctxt); } } @@ -2608,9 +2613,9 @@ bool QDeclarativeCompiler::buildBinding(QDeclarativeParser::Value *value, } void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *binding, - QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - QDeclarativeParser::Property *valueTypeProperty) + QDeclarativeParser::Property *prop, + QDeclarativeParser::Object *obj, + QDeclarativeParser::Property *valueTypeProperty) { Q_UNUSED(obj); Q_ASSERT(compileState.bindings.contains(binding)); diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index f8ada95..cca42e2 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -307,6 +307,7 @@ private: QByteArray compiledBindingData; QHash bindings; + QHash signalExpressions; QList aliasingObjects; QDeclarativeParser::Object *root; }; diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index d8af6a7..c41b14f 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -293,6 +293,7 @@ public: struct { int signalIndex; int value; + int context; } storeSignal; struct { int signal; diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index fc3722d..6a08674 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -538,13 +538,13 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QDeclarati case QDeclarativeInstruction::StoreSignal: { QObject *target = stack.top(); - // XXX scope - QMetaMethod signal = - target->metaObject()->method(instr.storeSignal.signalIndex); + QObject *context = stack.at(stack.count() - 1 - instr.assignBinding.context); + + QMetaMethod signal = target->metaObject()->method(instr.storeSignal.signalIndex); QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target); QDeclarativeExpression *expr = - new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), target); + new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), context); expr->setSourceLocation(comp->name, instr.line); bs->setExpression(expr); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml new file mode 100644 index 0000000..4b5464d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml @@ -0,0 +1,9 @@ +import Qt 4.6 +import Qt.test 1.0 + +QtObject { + property int value: 9 + property int value2 + + MyQmlObject.onMySignal: value2 = value +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 8fbd071..a283e3f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -60,10 +60,21 @@ class MyQmlAttachedObject : public QObject { Q_OBJECT Q_PROPERTY(int value READ value CONSTANT) + Q_PROPERTY(int value2 READ value2 WRITE setValue2) public: - MyQmlAttachedObject(QObject *parent) : QObject(parent) {} + MyQmlAttachedObject(QObject *parent) : QObject(parent), m_value2(0) {} int value() const { return 19; } + int value2() const { return m_value2; } + void setValue2(int v) { m_value2 = v; } + + void emitMySignal() { emit mySignal(); } + +signals: + void mySignal(); + +private: + int m_value2; }; class MyQmlObject : public QObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 75ee7ce..2e00e10 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -123,6 +123,7 @@ private slots: void multiEngineObject(); void deletedObject(); void scriptScope(); + void attachedPropertyScope(); void bug1(); @@ -1693,6 +1694,26 @@ void tst_qdeclarativeecmascript::scriptScope() } } +void tst_qdeclarativeecmascript::attachedPropertyScope() +{ + QDeclarativeComponent component(&engine, TEST_FILE("attachedPropertyScope.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + MyQmlAttachedObject *attached = + qobject_cast(qmlAttachedPropertiesObject(object)); + QVERIFY(attached != 0); + + QCOMPARE(object->property("value2").toInt(), 0); + + attached->emitMySignal(); + + QCOMPARE(object->property("value2").toInt(), 9); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml index aecb3c3..b46ec34 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml @@ -3,8 +3,6 @@ import Test 1.0 as Namespace import Qt 4.6 QtObject { - property int value2: 8 MyQmlObject.value: 10 Namespace.MyQmlObject.value2: 13 - MyQmlObject.onValueChanged: value2 = MyQmlObject.value } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index a339a6d..3ce15cb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -718,11 +718,6 @@ void tst_qdeclarativelanguage::attachedProperties() QVERIFY(attached != 0); QCOMPARE(attached->property("value"), QVariant(10)); QCOMPARE(attached->property("value2"), QVariant(13)); - - QEXPECT_FAIL("", "QTBUG-8677", Abort); - attached->setProperty("value", QVariant(12)); - int val = object->property("value2").toInt(); - QCOMPARE(val, 12); } // Tests non-static object properties -- cgit v0.12 From a65e37f0fd48158403296d5ca9ffa0f0feae2940 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 4 Mar 2010 18:17:24 +1000 Subject: Add autotests for tab and backtab in Keys and KeyNavigation. --- .../qdeclarativeitem/data/keynavigation.qml | 8 +++++ .../declarative/qdeclarativeitem/data/keys.qml | 2 ++ .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 38 ++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml b/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml index 9281a17..08da901 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml @@ -11,6 +11,8 @@ Grid { color: focus ? "red" : "lightgray" KeyNavigation.right: item2 KeyNavigation.down: item3 + KeyNavigation.tab: item2 + KeyNavigation.backtab: item4 } Rectangle { id: item2 @@ -19,6 +21,8 @@ Grid { color: focus ? "red" : "lightgray" KeyNavigation.left: item1 KeyNavigation.down: item4 + KeyNavigation.tab: item3 + KeyNavigation.backtab: item1 } Rectangle { id: item3 @@ -27,6 +31,8 @@ Grid { color: focus ? "red" : "lightgray" KeyNavigation.right: item4 KeyNavigation.up: item1 + KeyNavigation.tab: item4 + KeyNavigation.backtab: item2 } Rectangle { id: item4 @@ -35,5 +41,7 @@ Grid { color: focus ? "red" : "lightgray" KeyNavigation.left: item3 KeyNavigation.up: item2 + KeyNavigation.tab: item1 + KeyNavigation.backtab: item3 } } diff --git a/tests/auto/declarative/qdeclarativeitem/data/keys.qml b/tests/auto/declarative/qdeclarativeitem/data/keys.qml index f3c1f7b..7d34fc8 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/keys.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keys.qml @@ -7,6 +7,8 @@ Item { Keys.onReturnPressed: keysTestObject.keyPress(event.key, "Return", event.modifiers) Keys.onDigit0Pressed: keysTestObject.keyPress(event.key, event.text, event.modifiers) Keys.onDigit9Pressed: { event.accepted = false; keysTestObject.keyPress(event.key, event.text, event.modifiers) } + Keys.onTabPressed: keysTestObject.keyPress(event.key, "Tab", event.modifiers) + Keys.onBacktabPressed: keysTestObject.keyPress(event.key, "Backtab", event.modifiers) Keys.forwardTo: [ item2 ] Keys.enabled: enableKeyHanding diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 36dcf1f..dbcba16 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -176,6 +176,26 @@ void tst_QDeclarativeItem::keys() testObject->reset(); + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_Tab)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Tab)); + QCOMPARE(testObject->mText, QLatin1String("Tab")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_Backtab)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Backtab)); + QCOMPARE(testObject->mText, QLatin1String("Backtab")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(false)); key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1); @@ -240,6 +260,24 @@ void tst_QDeclarativeItem::keyNavigation() item = findItem(canvas->rootObject(), "item1"); QVERIFY(item); QVERIFY(item->hasFocus()); + + // tab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item2"); + QVERIFY(item); + QVERIFY(item->hasFocus()); + + // backtab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasFocus()); } void tst_QDeclarativeItem::smooth() -- cgit v0.12 From 83cbbd6c4c9ff2f00651c31af0d52845b2e98390 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 4 Mar 2010 18:22:49 +1000 Subject: Add testcase for QTBUG-7730 --- .../declarative/qdeclarativeecmascript/data/scope.4.qml | 12 ++++++++++++ .../tst_qdeclarativeecmascript.cpp | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml new file mode 100644 index 0000000..d65b6e7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml @@ -0,0 +1,12 @@ +import Qt.test 1.0 + +MyQmlObject { + id: a + property int b: 9 + + property int test + property string test2 + + // Should resolve to signal arguments, not to other elements in the file + onArgumentSignal: { test = a; test2 = b; } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 2e00e10..b5649cb 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -740,6 +740,23 @@ void tst_qdeclarativeecmascript::scope() QCOMPARE(object->property("test2").toBool(), true); QCOMPARE(object->property("test3").toBool(), true); } + + // Signal argument scope + { + QDeclarativeComponent component(&engine, TEST_FILE("scope.4.qml")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 0); + QCOMPARE(object->property("test2").toString(), QString()); + + emit object->argumentSignal(13, "Argument Scope", 9); + + QCOMPARE(object->property("test").toInt(), 13); + QCOMPARE(object->property("test2").toString(), QString("Argument Scope")); + + delete object; + } } /* -- cgit v0.12 From 8d6b5483e34d27f1ee45af9d9fadb87525c9f915 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 4 Mar 2010 09:23:53 +0100 Subject: Make QLabel::text a reloadable property In this way we can correctly load / reload a label in case it contains a rich text with a reference to the image taken from resources. Since QLabel::setText() ignores the call in case we try to set the same text, we force the reload by setting the empty string in between. For performance reasons we do it only in cases when the text value contains :/ (only in this case it might have a reference to the resources). Reviewed-by: Friedemann Kleint Task-number: QTBUG-8347 --- tools/designer/src/lib/shared/formwindowbase.cpp | 12 +++++++++++- tools/designer/src/lib/shared/qdesigner_propertysheet.cpp | 2 ++ tools/designer/src/lib/shared/qdesigner_propertysheet_p.h | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/designer/src/lib/shared/formwindowbase.cpp b/tools/designer/src/lib/shared/formwindowbase.cpp index 2c5efbf..b57e9d7 100644 --- a/tools/designer/src/lib/shared/formwindowbase.cpp +++ b/tools/designer/src/lib/shared/formwindowbase.cpp @@ -181,7 +181,17 @@ void FormWindowBase::reloadProperties() QMapIterator itIndex(itSheet.value()); while (itIndex.hasNext()) { const int index = itIndex.next().key(); - sheet->setProperty(index, sheet->property(index)); + const QVariant newValue = sheet->property(index); + if (qobject_cast(sheet->object()) && sheet->propertyName(index) == QLatin1String("text")) { + const PropertySheetStringValue newString = qVariantValue(newValue); + // optimize a bit, reset only if the text value might contain a reference to qt resources + // (however reloading of icons other than taken from resources might not work here) + if (newString.value().contains(QLatin1String(":/"))) { + const QVariant resetValue = qVariantFromValue(PropertySheetStringValue()); + sheet->setProperty(index, resetValue); + } + } + sheet->setProperty(index, newValue); } if (QTabWidget *tabWidget = qobject_cast(sheet->object())) { const int count = tabWidget->count(); diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp index 13bb1d7..77ab2a6 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -271,6 +271,7 @@ bool QDesignerPropertySheetPrivate::isReloadableProperty(int index) const { return isResourceProperty(index) || propertyType(index) == QDesignerPropertySheet::PropertyStyleSheet + || propertyType(index) == QDesignerPropertySheet::PropertyText || q->property(index).type() == QVariant::Url; } @@ -549,6 +550,7 @@ QDesignerPropertySheet::PropertyType QDesignerPropertySheet::propertyTypeFromNam propertyTypeHash.insert(QLatin1String("windowModality"), PropertyWindowModality); propertyTypeHash.insert(QLatin1String("windowModified"), PropertyWindowModified); propertyTypeHash.insert(QLatin1String("styleSheet"), PropertyStyleSheet); + propertyTypeHash.insert(QLatin1String("text"), PropertyText); } return propertyTypeHash.value(name, PropertyNone); } diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet_p.h b/tools/designer/src/lib/shared/qdesigner_propertysheet_p.h index 9db7367..0105eac 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertysheet_p.h +++ b/tools/designer/src/lib/shared/qdesigner_propertysheet_p.h @@ -176,7 +176,8 @@ public: PropertyWindowIconText, PropertyWindowModality, PropertyWindowModified, - PropertyStyleSheet + PropertyStyleSheet, + PropertyText }; enum ObjectType { ObjectNone, ObjectLabel, ObjectLayout, ObjectLayoutWidget, ObjectQ3GroupBox }; -- cgit v0.12 From a63dc3b837fbabafcd8ccdc6c30e304f69b278da Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 4 Mar 2010 09:59:24 +0100 Subject: Avoid QString reallocation for smallcaps fonts in Itemizer::generate() Reviewed-by: Simon Hausmann --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 2291138..b826588 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -81,7 +81,7 @@ public: void generate(int start, int length, QFont::Capitalization caps) { if ((int)caps == (int)QFont::SmallCaps) - generateScriptItemsSmallCaps(m_string.utf16(), start, length); + generateScriptItemsSmallCaps(reinterpret_cast(m_string.unicode()), start, length); else if(caps == QFont::Capitalize) generateScriptItemsCapitalize(start, length); else if(caps != QFont::MixedCase) { -- cgit v0.12 From 7d7a85fa16b28fdba257bb466be5a6d2b4bf5d2f Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 4 Mar 2010 10:01:56 +0100 Subject: Enable two fast path for blend_tiled_rgb565 Blending ARGB8565 and RGB16 on top of RGB16 is common on system with 16 bits color depth. The faster blending functions can be used instead of blend_tiled_generic. Reviewed-by: Tom Cooksey --- src/gui/painting/qdrawhelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 891f4c2..8d2da69 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5072,7 +5072,7 @@ static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) -- cgit v0.12 From c7fec28e7b2f7192c6589c37f3db3e0b4ee85460 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Mar 2010 10:21:06 +0100 Subject: Fixes tst_QScriptExtQObject::connectAndDisconnect Now that QVariant is known to QMetaType, it has an ID. This is much more robust as before. This would have fail if QVariant, would have been registered by the user. Reviewed-by: Kent Hansen --- src/script/bridge/qscriptqobject.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 8d111f9..39ba935 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -2174,14 +2174,12 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv) QByteArray typeName = parameterTypes.at(i); int argType = QMetaType::type(parameterTypes.at(i)); if (!argType) { - if (typeName == "QVariant") { - actual = QScriptEnginePrivate::jscValueFromVariant(exec, *reinterpret_cast(arg)); - } else { - qWarning("QScriptEngine: Unable to handle unregistered datatype '%s' " - "when invoking handler of signal %s::%s", - typeName.constData(), meta->className(), method.signature()); - actual = JSC::jsUndefined(); - } + qWarning("QScriptEngine: Unable to handle unregistered datatype '%s' " + "when invoking handler of signal %s::%s", + typeName.constData(), meta->className(), method.signature()); + actual = JSC::jsUndefined(); + } else if (argType == QMetaType::QVariant) { + actual = QScriptEnginePrivate::jscValueFromVariant(exec, *reinterpret_cast(arg)); } else { actual = QScriptEnginePrivate::create(exec, argType, arg); } -- cgit v0.12 From a99fe8624a25f8a09fe9b3234306a4d8b3a3f38e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Mar 2010 10:47:36 +0100 Subject: QScript: Test against QMetaType::QVariant instead of against the string now that QVariant is known to QMetaType, we can test for the metatype id instead of doing string comparison Reviewed-by: Kent Hansen --- src/script/api/qscriptengine.cpp | 11 ++++++----- src/script/bridge/qscriptqobject.cpp | 37 ++++++++++++++---------------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 9cd5c63..47c5262 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2901,6 +2901,9 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const result = eng->newQObject(*reinterpret_cast(ptr)); break; #endif + case QMetaType::QVariant: + result = jscValueFromVariant(exec, *reinterpret_cast(ptr)); + break; default: if (type == qMetaTypeId()) { result = eng->scriptValueToJSCValue(*reinterpret_cast(ptr)); @@ -2922,8 +2925,6 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const else { QByteArray typeName = QMetaType::typeName(type); - if (typeName == "QVariant") - result = jscValueFromVariant(exec, *reinterpret_cast(ptr)); if (typeName.endsWith('*') && !*reinterpret_cast(ptr)) return JSC::jsNull(); else @@ -3046,6 +3047,9 @@ bool QScriptEnginePrivate::convertValue(JSC::ExecState *exec, JSC::JSValue value *reinterpret_cast(ptr) = variantMapFromObject(exec, value); return true; } break; + case QMetaType::QVariant: + *reinterpret_cast(ptr) = toVariant(exec, value); + return true; default: ; } @@ -3096,9 +3100,6 @@ bool QScriptEnginePrivate::convertValue(JSC::ExecState *exec, JSC::JSValue value return false; *reinterpret_cast(ptr) = eng->scriptValueFromJSCValue(value); return true; - } else if (name == "QVariant") { - *reinterpret_cast(ptr) = toVariant(exec, value); - return true; } // lazy registration of some common list types diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 39ba935..91636da 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -523,19 +523,15 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c QByteArray returnTypeName = method.typeName(); int rtype = QMetaType::type(returnTypeName); if ((rtype == 0) && !returnTypeName.isEmpty()) { - if (returnTypeName == "QVariant") { - types.append(QScriptMetaType::variant()); - } else { - int enumIndex = indexOfMetaEnum(meta, returnTypeName); - if (enumIndex != -1) - types.append(QScriptMetaType::metaEnum(enumIndex, returnTypeName)); - else - types.append(QScriptMetaType::unresolved(returnTypeName)); - } + int enumIndex = indexOfMetaEnum(meta, returnTypeName); + if (enumIndex != -1) + types.append(QScriptMetaType::metaEnum(enumIndex, returnTypeName)); + else + types.append(QScriptMetaType::unresolved(returnTypeName)); } else { if (callType == QMetaMethod::Constructor) types.append(QScriptMetaType::metaType(QMetaType::QObjectStar, "QObject*")); - else if (returnTypeName == "QVariant") + else if (rtype == QMetaType::QVariant) types.append(QScriptMetaType::variant()); else types.append(QScriptMetaType::metaType(rtype, returnTypeName)); @@ -547,20 +543,15 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c QByteArray argTypeName = parameterTypeNames.at(i); int atype = QMetaType::type(argTypeName); if (atype == 0) { - if (argTypeName == "QVariant") { - types.append(QScriptMetaType::variant()); - } else { - int enumIndex = indexOfMetaEnum(meta, argTypeName); - if (enumIndex != -1) - types.append(QScriptMetaType::metaEnum(enumIndex, argTypeName)); - else - types.append(QScriptMetaType::unresolved(argTypeName)); - } - } else { - if (argTypeName == "QVariant") - types.append(QScriptMetaType::variant()); + int enumIndex = indexOfMetaEnum(meta, argTypeName); + if (enumIndex != -1) + types.append(QScriptMetaType::metaEnum(enumIndex, argTypeName)); else - types.append(QScriptMetaType::metaType(atype, argTypeName)); + types.append(QScriptMetaType::unresolved(argTypeName)); + } else if (atype == QMetaType::QVariant) { + types.append(QScriptMetaType::variant()); + } else { + types.append(QScriptMetaType::metaType(atype, argTypeName)); } } -- cgit v0.12 From 625f6b92a08d8ef2a1e5697fce28ca39d29917fe Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 4 Mar 2010 10:57:15 +0100 Subject: Fixes QMenu to only have static POD members This also fixes the autotests --- src/gui/widgets/qmenu.cpp | 24 ++++++++++++------------ src/gui/widgets/qmenu_p.h | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 5db14b8..9a4916e 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -85,9 +85,8 @@ QT_BEGIN_NAMESPACE -QPointer QMenuPrivate::mouseDown; -QBasicTimer QMenuPrivate::menuDelayTimer; -QBasicTimer QMenuPrivate::sloppyDelayTimer; +QMenu *QMenuPrivate::mouseDown = 0; +int QMenuPrivate::sloppyDelayTimer = 0; /* QMenu code */ // internal class used for the torn off popup @@ -487,8 +486,8 @@ void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst) if (action && action->isEnabled()) { if (!delay) q->internalDelayedPopup(); - else if (!QMenuPrivate::menuDelayTimer.isActive() && (!action->menu() || !action->menu()->isVisible())) - QMenuPrivate::menuDelayTimer.start(delay, q); + else if (!menuDelayTimer.isActive() && (!action->menu() || !action->menu()->isVisible())) + menuDelayTimer.start(delay, q); if (activateFirst && action->menu()) action->menu()->d_func()->setFirstActionActive(); } else if (QMenu *menu = activeMenu) { //hide the current item @@ -2375,8 +2374,8 @@ QMenu::event(QEvent *e) } } break; case QEvent::ContextMenu: - if(QMenuPrivate::menuDelayTimer.isActive()) { - QMenuPrivate::menuDelayTimer.stop(); + if(d->menuDelayTimer.isActive()) { + d->menuDelayTimer.stop(); internalDelayedPopup(); } break; @@ -2809,7 +2808,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) } if (d->sloppyRegion.contains(e->pos())) { d->sloppyAction = action; - QMenuPrivate::sloppyDelayTimer.start(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6, this); + QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6); } else { d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)); } @@ -2847,11 +2846,12 @@ QMenu::timerEvent(QTimerEvent *e) d->scrollMenu((QMenuPrivate::QMenuScroller::ScrollDirection)d->scroll->scrollDirection); if (d->scroll->scrollFlags == QMenuPrivate::QMenuScroller::ScrollNone) d->scroll->scrollTimer.stop(); - } else if(QMenuPrivate::menuDelayTimer.timerId() == e->timerId()) { - QMenuPrivate::menuDelayTimer.stop(); + } else if(d->menuDelayTimer.timerId() == e->timerId()) { + d->menuDelayTimer.stop(); internalDelayedPopup(); - } else if(QMenuPrivate::sloppyDelayTimer.timerId() == e->timerId()) { - QMenuPrivate::sloppyDelayTimer.stop(); + } else if(QMenuPrivate::sloppyDelayTimer == e->timerId()) { + killTimer(QMenuPrivate::sloppyDelayTimer); + QMenuPrivate::sloppyDelayTimer = 0; internalSetSloppyAction(); } else if(d->searchBufferTimer.timerId() == e->timerId()) { d->searchBuffer.clear(); diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index aaed6b1..276ffe6 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -202,7 +202,7 @@ public: bool activationRecursionGuard; //selection - static QPointer mouseDown; + static QMenu *mouseDown; QPoint mousePopupPos; uint hasHadMouse : 1; uint aboutToHide : 1; @@ -212,7 +212,7 @@ public: QAction *selectAction; QAction *cancelAction; #endif - static QBasicTimer menuDelayTimer; + QBasicTimer menuDelayTimer; enum SelectionReason { SelectedFromKeyboard, SelectedFromElsewhere @@ -272,7 +272,7 @@ public: mutable bool hasCheckableItems; //sloppy selection - static QBasicTimer sloppyDelayTimer; + static int sloppyDelayTimer; mutable QAction *sloppyAction; QRegion sloppyRegion; -- cgit v0.12 From e53480370409b96d24d3f53513e8b2019a398e70 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Mar 2010 11:12:44 +0100 Subject: Finish to resolve merge conflict. Move the change that were made in commit 9957e85e37345e946ecc67196d65fbca867a2001 from src/multimedia/qml/qml.pri to src/multimedia/effects/effects.pri --- src/multimedia/effects/effects.pri | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/multimedia/effects/effects.pri b/src/multimedia/effects/effects.pri index 5edd452..ff762e8 100644 --- a/src/multimedia/effects/effects.pri +++ b/src/multimedia/effects/effects.pri @@ -1,15 +1,16 @@ - -system(pkg-config --exists \'libpulse >= 0.9.10\') { - DEFINES += QT_MULTIMEDIA_PULSEAUDIO - HEADERS += $$PWD/qsoundeffect_pulse_p.h - SOURCES += $$PWD/qsoundeffect_pulse_p.cpp - LIBS += -lpulse -} else:x11 { - DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER - HEADERS += $$PWD/qsoundeffect_qmedia_p.h - SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp +unix { + unix:contains(QT_CONFIG, pulseaudio) { + DEFINES += QT_MULTIMEDIA_PULSEAUDIO + HEADERS += $$PWD/qsoundeffect_pulse_p.h + SOURCES += $$PWD/qsoundeffect_pulse_p.cpp + LIBS += -lpulse + } else { + DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER + HEADERS += $$PWD/qsoundeffect_qmedia_p.h + SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp + } } else { HEADERS += $$PWD/qsoundeffect_qsound_p.h SOURCES += $$PWD/qsoundeffect_qsound_p.cpp -- cgit v0.12 From 24c56ac5309150cf7ba42cd974df4e98d97ebb81 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 4 Mar 2010 11:21:37 +0100 Subject: Build fix for Sun Studio Task-number: QTBUG-8192 --- src/gui/widgets/qcombobox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 9b19a66..fb9af9f 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -111,10 +111,10 @@ public: bool hasFrame() const; inline int findText(const QString &text, - Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const + Qt::MatchFlags flags = static_cast(Qt::MatchExactly|Qt::MatchCaseSensitive)) const { return findData(text, Qt::DisplayRole, flags); } int findData(const QVariant &data, int role = Qt::UserRole, - Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const; + Qt::MatchFlags flags = static_cast(Qt::MatchExactly|Qt::MatchCaseSensitive)) const; enum InsertPolicy { NoInsert, -- cgit v0.12 From 52da988db3a03bce5513bc5e2efa3d69f3664f24 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 4 Mar 2010 11:47:36 +0100 Subject: qmake/MinGw: Link statically for Qt Creator to be able to detect it. Qt Creator detects Qt versions by running qmake. This fails if no MinGw setup is in the path as is usually the case when starting it from the menu. Make it possible to run qmake without setup. Strip executable. Reviewed-by: Thierry Bastian Reviewed-by: mariusSO --- qmake/Makefile.win32-g++ | 2 +- qmake/Makefile.win32-g++-sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index d4d6e0e..27ae27b 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -27,7 +27,7 @@ CFLAGS = -c -o$@ -O \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DQT_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) -LFLAGS = +LFLAGS = -static-libgcc -s LIBS = -lole32 -luuid LINKQMAKE = g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS) ADDCLEAN = diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 5061089..f7b486f 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -27,7 +27,7 @@ CFLAGS = -c -o$@ -O \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DQT_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) -LFLAGS = +LFLAGS = -static-libgcc -s LIBS = -lole32 -luuid LINKQMAKE = g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS) ADDCLEAN = -- cgit v0.12 From 4574b342ebb8800ba50ca23f154c20b3e8a239af Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 4 Mar 2010 11:55:01 +0100 Subject: Fix compile Missing header added --- tools/designer/src/lib/shared/formwindowbase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/designer/src/lib/shared/formwindowbase.cpp b/tools/designer/src/lib/shared/formwindowbase.cpp index b57e9d7..5292f5f 100644 --- a/tools/designer/src/lib/shared/formwindowbase.cpp +++ b/tools/designer/src/lib/shared/formwindowbase.cpp @@ -72,6 +72,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE -- cgit v0.12 From 8c8e9ffb60c244462f615f510bc71d4010cf8faf Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 4 Mar 2010 11:47:45 +0100 Subject: Remove the OBJECTS_DIR variable assignment from some projets in Qt. This prevent debug and release object file to be mixed up when linking these application in a debug_and_release configured Qt. Reviewed-by: Marius Storm-Olsen --- demos/qtdemo/qtdemo.pro | 2 -- examples/threads/waitconditions/waitconditions.pro | 2 -- src/tools/moc/util/generate_keywords.pro | 1 - .../auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro | 5 ----- tools/qev/qev.pro | 2 -- 5 files changed, 12 deletions(-) diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro index 011ea0c..2a776ac 100644 --- a/demos/qtdemo/qtdemo.pro +++ b/demos/qtdemo/qtdemo.pro @@ -3,8 +3,6 @@ TARGET = qtdemo DEMO_DESTDIR = $$QT_BUILD_TREE isEmpty(DEMO_DESTDIR):DEMO_DESTDIR=../.. DESTDIR = $$DEMO_DESTDIR/bin -OBJECTS_DIR = .obj -MOC_DIR = .moc INSTALLS += target sources diff --git a/examples/threads/waitconditions/waitconditions.pro b/examples/threads/waitconditions/waitconditions.pro index b07b413..c2be6cd 100644 --- a/examples/threads/waitconditions/waitconditions.pro +++ b/examples/threads/waitconditions/waitconditions.pro @@ -10,8 +10,6 @@ INCLUDEPATH += . # Input SOURCES += waitconditions.cpp CONFIG += qt warn_on create_prl link_prl console -OBJECTS_DIR=obj/debug-shared -MOC_DIR=moc/debug-shared # install target.path = $$[QT_INSTALL_EXAMPLES]/threads/waitconditions diff --git a/src/tools/moc/util/generate_keywords.pro b/src/tools/moc/util/generate_keywords.pro index 8dff744..eb04409 100644 --- a/src/tools/moc/util/generate_keywords.pro +++ b/src/tools/moc/util/generate_keywords.pro @@ -10,4 +10,3 @@ INCLUDEPATH += . # Input SOURCES += generate_keywords.cpp CONFIG += qt create_prl link_prl -OBJECTS_DIR=.obj/debug-shared diff --git a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro index 93a03db..e8b1ce9 100644 --- a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -13,8 +13,3 @@ wince*|symbian*:TARGET = ../desktopsettingsaware SOURCES += main.cpp CONFIG += qt warn_on create_prl link_prl CONFIG -= app_bundle - -!symbian*: { -OBJECTS_DIR=.obj/debug-shared -MOC_DIR=.moc/debug-shared -} diff --git a/tools/qev/qev.pro b/tools/qev/qev.pro index 28383c6..962b9fa 100644 --- a/tools/qev/qev.pro +++ b/tools/qev/qev.pro @@ -9,5 +9,3 @@ INCLUDEPATH += . # Input SOURCES += qev.cpp CONFIG += qt warn_on create_prl link_prl -OBJECTS_DIR=.obj/debug-shared -MOC_DIR=.moc/debug-shared -- cgit v0.12 From cd2afafbc9c29393a80d415145c49eb5f439da55 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 26 Feb 2010 16:57:38 +0100 Subject: Delay the resize section for better performance. This was particularly unusable when combining a QSortFilterProxyModel with resize mode ResizeToContents. Task-number: QTBUG-8540 Reviewed-by: Thierry --- src/gui/itemviews/qheaderview.cpp | 4 ++-- src/gui/itemviews/qtableview.cpp | 7 +------ src/gui/itemviews/qtreeview.cpp | 6 ++---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 5128b64..eb3db21 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -2037,7 +2037,7 @@ bool QHeaderView::event(QEvent *e) updateSection(d->hover); } break; } - case QEvent::Timer: { // ### reimplement timerEvent() instead ? + case QEvent::Timer: { QTimerEvent *te = static_cast(e); if (te->timerId() == d->delayedResize.timerId()) { d->delayedResize.stop(); @@ -2610,7 +2610,7 @@ void QHeaderView::updateGeometries() Q_D(QHeaderView); d->layoutChildren(); if (d->hasAutoResizeSections()) - resizeSections(); + d->doDelayedResizeSections(); } /*! diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 3111896..bdc1205 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1960,12 +1960,7 @@ QModelIndexList QTableView::selectedIndexes() const void QTableView::rowCountChanged(int /*oldCount*/, int /*newCount*/ ) { Q_D(QTableView); - updateGeometries(); - if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) - d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); - else - d->verticalHeader->setOffset(verticalScrollBar()->value()); - d->viewport->update(); + d->doDelayedItemsLayout(); } /*! diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 37168eb..1145235 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2524,8 +2524,7 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) d->viewItems[parentItem].hasChildren = true; d->updateChildCount(parentItem, delta); - updateGeometries(); - viewport()->update(); + d->doDelayedItemsLayout(); } else if ((parentItem != -1) && d->viewItems.at(parentItem).expanded) { d->doDelayedItemsLayout(); } else if (parentItem != -1 && (d->model->rowCount(parent) == end - start + 1)) { @@ -3780,8 +3779,7 @@ void QTreeViewPrivate::rowsRemoved(const QModelIndex &parent, } } if (after) { - q->updateGeometries(); - viewport->update(); + doDelayedItemsLayout(); } else { //we have removed items: we should at least update the scroll bar values. // They are used to determine the item geometry. -- cgit v0.12 From 6f09fc3a475eb2e1c843f4aebe7ea0d15182ac1d Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 4 Mar 2010 12:49:56 +0100 Subject: Update QML PropertyAnimation::easing docs Task-number: QTBUG-8726 --- src/declarative/util/qdeclarativeanimation.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index f33d7c7..76b6a58 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1736,7 +1736,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int Animate any objects that have changed their x or y properties in the target state using an InOutQuad easing curve: \qml - Transition { PropertyAnimation { properties: "x,y"; easing: "InOutQuad" } } + Transition { PropertyAnimation { properties: "x,y"; easing.type: "InOutQuad" } } \endqml \o In a Behavior @@ -1877,7 +1877,13 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) \qmlproperty QEasingCurve PropertyAnimation::easing \brief the easing curve used for the transition. - Available values are: + For the easing you can specify the following parameters: type, amplitude, period and overshoot. + + \qml + PropertyAnimation { properties: "y"; easing.type: "InOutElastc"; easing.amplitude: 2.0; easing.period: 1.5 } + \endqml + + Available types are: \table \row @@ -2048,6 +2054,15 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) \o \inlineimage qeasingcurve-outinbounce.png \endtable + easing.amplitude is not applicable for all curve types. It is only applicable for bounce and elastic curves (curves of type + QEasingCurve::InBounce, QEasingCurve::OutBounce, QEasingCurve::InOutBounce, QEasingCurve::OutInBounce, QEasingCurve::InElastic, + QEasingCurve::OutElastic, QEasingCurve::InOutElastic or QEasingCurve::OutInElastic). + + easing.overshoot is not applicable for all curve types. It is only applicable if type is: QEasingCurve::InBack, QEasingCurve::OutBack, + QEasingCurve::InOutBack or QEasingCurve::OutInBack. + + easing.period is not applicable for all curve types. It is only applicable if type is: QEasingCurve::InElastic, QEasingCurve::OutElastic, + QEasingCurve::InOutElastic or QEasingCurve::OutInElastic. */ QEasingCurve QDeclarativePropertyAnimation::easing() const { -- cgit v0.12 From edb37d5ab12c061b6085d0a84fcf075faf2dba54 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 2 Mar 2010 14:12:32 +0100 Subject: Added a documentation for the new enum value in gesture api. Task-number: QTBUG-7400 Reviewed-by: David Boddie --- src/corelib/global/qnamespace.qdoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index db910ce..c5b5998 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2978,6 +2978,11 @@ the Qt::GestureStarted state and ending with a gesture in the Qt::GestureFinished or Qt::GestureCanceled states. + \value IgnoredGesturesPropagateToParent Since Qt 4.7, this flag allows you + to fine-tune gesture event propagation. By setting the flag when + \l{QGraphicsObject::grabGesture}{grabbing} a gesture all ignored partial + gestures will propagate to their parent items. + \sa QWidget::grabGesture(), QGraphicsObject::grabGesture() */ -- cgit v0.12 From 1a666089d84cb85ec8e2bda3fe0fff6f2ec2ec4a Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 2 Mar 2010 15:00:55 +0100 Subject: Allow building documentation without all of Qt added a new make target 'sub-qdoc3' which builds qdoc3 and it's dependencies only, so that when running "make docs" we don't build all of sub-tools (including declarative module), but qdoc3 only Reviewed-by: David Boddie Reviewed-by: Joao --- doc/doc.pri | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index aea5b08..3d04049 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -43,11 +43,11 @@ win32-g++:isEmpty(QMAKE_SH) { # Build rules: adp_docs.commands = ($$QDOC $$ADP_DOCS_QDOCCONF_FILE) -adp_docs.depends += sub-tools # qdoc3 +adp_docs.depends += sub-qdoc3 # qdoc3 qch_docs.commands = $$QT_DOCUMENTATION -qch_docs.depends += sub-tools +qch_docs.depends += sub-qdoc3 -docs.depends = adp_docs qch_docs +docs.depends = sub-qdoc3 adp_docs qch_docs docs_zh_CN.depends = docs docs_zh_CN.commands = $$QT_ZH_CN_DOCUMENTATION @@ -64,5 +64,8 @@ qchdocs.CONFIG += no_check_exist docimages.files = $$QT_BUILD_TREE/doc/src/images docimages.path = $$[QT_INSTALL_DOCS]/src -QMAKE_EXTRA_TARGETS += qdoc adp_docs qch_docs docs docs_zh_CN +sub-qdoc3.depends = sub-corelib sub-xml +sub-qdoc3.commands += (cd tools/qdoc3 && $(MAKE)) + +QMAKE_EXTRA_TARGETS += sub-qdoc3 adp_docs qch_docs docs docs_zh_CN INSTALLS += htmldocs qchdocs docimages -- cgit v0.12 From ed1f672efb19932fe279a3ebfedb973c02c4fee4 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 4 Mar 2010 13:03:51 +0100 Subject: Fix build on EGL implementations where EGLConfig is a pointer EGLConfig is an opaque type which we really shouldn't cast to an int. Instead, we get the config id for the EGLConfig. Reviewed-By: TrustMe --- src/gui/egl/qegl_x11.cpp | 19 +++++++++++-------- src/opengl/qgl_x11egl.cpp | 5 ++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 339bd57..483c01d 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -149,6 +149,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) eglGetConfigAttrib(display(), config, EGL_BUFFER_SIZE, &eglValue); int configBitDepth = eglValue; + eglGetConfigAttrib(display(), config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + // See if EGL provided a valid VisualID: eglGetConfigAttrib(display(), config, EGL_NATIVE_VISUAL_ID, &eglValue); visualId = (VisualID)eglValue; @@ -170,14 +173,14 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual); if (!format || (format->type != PictTypeDirect) || (!format->direct.alphaMask)) { qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this is not ARGB", - (int)visualId, (int)config); + (int)visualId, configId); visualId = 0; } } #endif } else { qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!", - (int)visualId, chosenVisualInfo->depth, (int)config, configBitDepth); + (int)visualId, chosenVisualInfo->depth, configId, configBitDepth); visualId = 0; } } @@ -187,9 +190,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); #endif return visualId; } @@ -232,9 +235,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { # ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); + qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, configId); else - qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); + qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, configId); # endif // QT_DEBUG_X11_VISUAL_SELECTION return visualId; } @@ -263,12 +266,12 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, (int)config); + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); #endif return visualId; } - qWarning("Unable to find an X11 visual which matches EGL config %d", (int)config); + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); return (VisualID)0; } diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index ba05e72..123bbdd 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -404,7 +404,7 @@ EGLConfig Q_OPENGL_EXPORT qt_chooseEGLConfigForPixmap(bool hasAlpha, bool readOn if (configCount > 0) { // Got one qDebug() << "Found an" << (hasAlpha ? "ARGB" : "RGB") << (readOnly ? "readonly" : "target" ) - << "config (" << int(*targetConfig) << ") to create a pixmap surface:"; + << "config to create a pixmap surface:"; // QEglProperties configProps(*targetConfig); // qDebug() << configProps.toString(); @@ -446,8 +446,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl // qDebug("qt_createEGLSurfaceForPixmap() created surface 0x%x for pixmap 0x%x", // pixmapSurface, pixmapData->handle()); if (pixmapSurface == EGL_NO_SURFACE) { - qWarning() << "Failed to create a pixmap surface using config" << (int)pixmapConfig - << ":" << QEgl::errorString(); + qWarning() << "Failed to create a pixmap surface:" << QEgl::errorString(); return false; } -- cgit v0.12 From c5264c89b7710dc2f2d8c7c604f0b23852cb2eef Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 4 Mar 2010 13:08:32 +0100 Subject: Fix build when egl.h includes X11 headers & pollutes namespace At some point we should fix the include order in all the .cpp files, however #udef'ing the defines we use elsewhere seems to work for now. Reviewed-By: TrustMe --- src/gui/egl/qegl_p.h | 2 ++ src/opengl/qgl_p.h | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index aa89772..ffb45aa 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -77,6 +77,8 @@ QT_BEGIN_INCLUDE_NAMESPACE #undef Type #undef FontChange #undef CursorShape +#undef Unsorted +#undef GrayScale #endif // Internally we use the EGL-prefixed native types which are used in EGL >= 1.3. diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index b828bea..c142715 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -65,13 +65,7 @@ #include "qglpaintdevice_p.h" #ifdef QT_OPENGL_ES -QT_BEGIN_INCLUDE_NAMESPACE -#if defined(QT_OPENGL_ES_2) -#include -#else -#include -#endif -QT_END_INCLUDE_NAMESPACE +#include #endif QT_BEGIN_NAMESPACE -- cgit v0.12 From a0cb1ae902dce0c00dc2de8b92229d66945054c8 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 4 Mar 2010 14:26:24 +0100 Subject: Setting ImhHiddenText for NoEcho line edits is not 100% correct, but still way better than fully visible text. Reviewed-by: axis --- src/gui/widgets/qlineedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 94ee4b3..817547c 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -539,7 +539,7 @@ void QLineEdit::setEchoMode(EchoMode mode) if (mode == (EchoMode)d->control->echoMode()) return; Qt::InputMethodHints imHints = inputMethodHints(); - if (mode == Password) { + if (mode == Password || mode == NoEcho) { imHints |= Qt::ImhHiddenText; } else { imHints &= ~Qt::ImhHiddenText; -- cgit v0.12 From 4b3953678983b3da925066f464b55340fab3503c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 4 Mar 2010 15:12:49 +0100 Subject: doc: Fixed some qdoc errors. The QtMultimedia module needed to have its own \page unique name so that the QtMultimedia \module would not conflict with the QtMultimedia \namespace. --- doc/src/modules.qdoc | 1 + tools/qdoc3/cppcodeparser.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 9e1d340..76a52b4 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -130,6 +130,7 @@ /*! \module QtMultimedia + \page qtmultimedia-module.html \title QtMultimedia Module \contentspage All Qt Modules \previouspage QtCore diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index fef3c14..6884781 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -47,6 +47,7 @@ #include #include +#include #include "codechunk.h" #include "config.h" @@ -1650,8 +1651,9 @@ bool CppCodeParser::matchNamespaceDecl(InnerNode *parent) */ QString namespaceName = previousLexeme(); NamespaceNode *namespasse = 0; - if (parent) + if (parent) { namespasse = static_cast(parent->findNode(namespaceName, Node::Namespace)); + } if (!namespasse) { namespasse = new NamespaceNode(parent, namespaceName); namespasse->setAccess(access); -- cgit v0.12 From 4984b36c73fb59006a28051ea82bdca0b7aeb457 Mon Sep 17 00:00:00 2001 From: John Layt Date: Tue, 16 Feb 2010 01:13:13 +0000 Subject: QPrinter: Add Current Page print range support Support the selection of Current Page option in the print dialog by activating a new QPrintDialog::PrintDialogOption. If selected the PrintRange is set to CurrentPage. It is the responsibility of the application to read the PrintRange and apply the Current Page selection when rendering the pages. Merge-request: 2311 Reviewed-by: Trond --- src/gui/dialogs/qabstractprintdialog.cpp | 7 +- src/gui/dialogs/qabstractprintdialog.h | 6 +- src/gui/dialogs/qprintdialog_qws.cpp | 11 ++ src/gui/dialogs/qprintdialog_unix.cpp | 11 +- src/gui/dialogs/qprintdialog_win.cpp | 16 +- src/gui/dialogs/qprintsettingsoutput.ui | 246 +++++++++++++++---------------- src/gui/painting/qprinter.cpp | 3 + src/gui/painting/qprinter.h | 2 +- tests/auto/qprinter/tst_qprinter.cpp | 23 +++ 9 files changed, 186 insertions(+), 139 deletions(-) diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 4523433..25d9ebb 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -76,6 +76,7 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value AllPages All pages should be printed. \value Selection Only the selection should be printed. \value PageRange The specified page range should be printed. + \value CurrentPage Only the currently visible page should be printed. \sa QPrinter::PrintRange */ @@ -89,7 +90,9 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value PrintToFile The print to file option is enabled. \value PrintSelection The print selection option is enabled. \value PrintPageRange The page range selection option is enabled. - \value PrintCollateCopies + \value PrintShowPageSize Show the page size + margins page only if this is enabled. + \value PrintCollateCopies The collate copies option is enabled + \value PrintCurrentPage The print current page option is enabled This value is obsolete and does nothing since Qt 4.5: @@ -97,8 +100,6 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate would create a sheet by default the dialog was given a parent. This is no longer supported in Qt 4.5. If you want to use sheets, use QPrintDialog::open() instead. - - \value PrintShowPageSize Show the page size + margins page only if this is enabled. */ /*! diff --git a/src/gui/dialogs/qabstractprintdialog.h b/src/gui/dialogs/qabstractprintdialog.h index 4d867f6..82e3df8 100644 --- a/src/gui/dialogs/qabstractprintdialog.h +++ b/src/gui/dialogs/qabstractprintdialog.h @@ -65,7 +65,8 @@ public: enum PrintRange { AllPages, Selection, - PageRange + PageRange, + CurrentPage }; enum PrintDialogOption { @@ -75,7 +76,8 @@ public: PrintPageRange = 0x0004, PrintShowPageSize = 0x0008, PrintCollateCopies = 0x0010, - DontUseSheet = 0x0020 + DontUseSheet = 0x0020, + PrintCurrentPage = 0x0040 }; Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption) diff --git a/src/gui/dialogs/qprintdialog_qws.cpp b/src/gui/dialogs/qprintdialog_qws.cpp index 1336c04..b071427 100644 --- a/src/gui/dialogs/qprintdialog_qws.cpp +++ b/src/gui/dialogs/qprintdialog_qws.cpp @@ -178,6 +178,10 @@ void QPrintDialogPrivate::_q_okClicked() q->setPrintRange(QPrintDialog::PageRange); q->setFromTo(firstPage->value(), lastPage->value()); break; + case (int)QPrintDialog::CurrentPage: + q->setPrintRange(QPrintDialog::CurrentPage); + q->setFromTo(0, 0); + break; } q->accept(); } @@ -375,6 +379,7 @@ void QPrintDialogPrivate::setupOptions() rangeCombo->addItem(QPrintDialog::tr("Print all"), QPrintDialog::AllPages); rangeCombo->addItem(QPrintDialog::tr("Print selection"), QPrintDialog::Selection); rangeCombo->addItem(QPrintDialog::tr("Print range"), QPrintDialog::PageRange); + rangeCombo->addItem(QPrintDialog::tr("Print current page"), QPrintDialog::CurrentPage); QObject::connect(rangeCombo, SIGNAL(activated(int)), q, SLOT(_q_printRangeSelected(int))); @@ -490,6 +495,9 @@ void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings) if (!q->isOptionEnabled(QPrintDialog::PrintPageRange) && rangeCombo->findData(QPrintDialog::PageRange) > 0) rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::PageRange)); + if (!q->isOptionEnabled(QPrintDialog::PrintCurrentPage) + && rangeCombo->findData(QPrintDialog::CurrentPage) > 0) + rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::CurrentPage)); switch (q->printRange()) { case QPrintDialog::AllPages: @@ -501,6 +509,9 @@ void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings) case QPrintDialog::PageRange: rangeCombo->setCurrentIndex((int)(QPrintDialog::PageRange)); break; + case QPrintDialog::CurrentPage: + rangeCombo->setCurrentIndex((int)(QPrintDialog::CurrentPage)); + break; } } diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 2d169cf..0487f23 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -502,6 +502,9 @@ void QPrintDialogPrivate::setupPrinter() } else if (options.printSelection->isChecked()) { p->setPrintRange(QPrinter::Selection); p->setFromTo(0,0); + } else if (options.printCurrentPage->isChecked()) { + p->setPrintRange(QPrinter::CurrentPage); + p->setFromTo(0,0); } else if (options.printRange->isChecked()) { p->setPrintRange(QPrinter::PageRange); p->setFromTo(options.from->value(), qMax(options.from->value(), options.to->value())); @@ -518,10 +521,12 @@ void QPrintDialogPrivate::updateWidgets() { Q_Q(QPrintDialog); options.gbPrintRange->setVisible(q->isOptionEnabled(QPrintDialog::PrintPageRange) || - q->isOptionEnabled(QPrintDialog::PrintSelection)); + q->isOptionEnabled(QPrintDialog::PrintSelection) || + q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); options.printRange->setEnabled(q->isOptionEnabled(QPrintDialog::PrintPageRange)); options.printSelection->setVisible(q->isOptionEnabled(QPrintDialog::PrintSelection)); + options.printCurrentPage->setVisible(q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); options.collate->setVisible(q->isOptionEnabled(QPrintDialog::PrintCollateCopies)); switch (q->printRange()) { @@ -534,6 +539,10 @@ void QPrintDialogPrivate::updateWidgets() case QPrintDialog::PageRange: options.printRange->setChecked(true); break; + case QPrintDialog::CurrentPage: + if (q->isOptionEnabled(QPrintDialog::PrintCurrentPage)) + options.printCurrentPage->setChecked(true); + break; default: break; } diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index fa0c99f..1061660 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -128,11 +128,14 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, if (pd->nMinPage==0 && pd->nMaxPage==0) pd->Flags |= PD_NOPAGENUMS; - // we don't have a 'current page' notion in the QPrinter API yet. - // Neither do we support more than one page range, so limit those - // options - pd->Flags |= PD_NOCURRENTPAGE; + // Disable Current Page option if not required as default is Enabled + if (!pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage)) + pd->Flags |= PD_NOCURRENTPAGE; + + // Default to showing the General tab first pd->nStartPage = START_PAGE_GENERAL; + + // We don't support more than one page range in the QPrinter API yet. pd->nPageRanges = 1; pd->nMaxPageRanges = 1; @@ -153,7 +156,10 @@ static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPri } else if (pd->Flags & PD_PAGENUMS) { pdlg->setPrintRange(QPrintDialog::PageRange); pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); - } else { + } else if (pd->Flags & PD_CURRENTPAGE) { + pdlg->setPrintRange(QPrintDialog::CurrentPage); + pdlg->setFromTo(0, 0); + } else { // PD_ALLPAGES pdlg->setPrintRange(QPrintDialog::AllPages); pdlg->setFromTo(0, 0); } diff --git a/src/gui/dialogs/qprintsettingsoutput.ui b/src/gui/dialogs/qprintsettingsoutput.ui index fc57e86..be91679 100644 --- a/src/gui/dialogs/qprintsettingsoutput.ui +++ b/src/gui/dialogs/qprintsettingsoutput.ui @@ -1,121 +1,114 @@ - + + QPrintSettingsOutput - - + + 0 0 - 416 - 166 + 426 + 171 - + Form - - + + 0 - - + + 0 - - - - 0 - 0 - 412 - 139 - - - + + Copies - + - - - + + + 0 0 - + Print range - - + + 4 - + 6 - - + + Print all - + true - - + + 6 - + 0 - - + + Pages from - - + + false - + 1 - + 999 - - + + to - - + + false - + 1 - + 999 - + Qt::Horizontal - + 0 20 @@ -126,18 +119,25 @@ - - + + + Current Page + + + + + + Selection - - + + Qt::Vertical - + 1 1 @@ -149,37 +149,37 @@ - - + + Output Settings - - - - + + + + Copies: - + copies - - - + + + 1 - + 999 - - - + + + Qt::Horizontal - + 91 20 @@ -187,36 +187,36 @@ - - - + + + Collate - - - - + + + + 0 0 - - - + + + Reverse - - - + + + Qt::Vertical - + 0 1 @@ -229,31 +229,23 @@ - - - - 0 - 0 - 412 - 139 - - - + + Options - - - - + + + + Color Mode - - - - + + + + Qt::Vertical - + 1 0 @@ -261,19 +253,19 @@ - - - + + + Color - - + + - - - + + + Grayscale @@ -281,42 +273,42 @@ - - - + + + Duplex Printing - + - - + + None - + true - - + + Long side - - + + Short side - - + + Qt::Vertical - + 1 0 @@ -341,11 +333,11 @@ from setEnabled(bool) - + 76 59 - + 122 57 @@ -357,11 +349,11 @@ to setEnabled(bool) - + 69 67 - + 215 67 diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index edf224d..ae21416 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -382,6 +382,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value AllPages All pages should be printed. \value Selection Only the selection should be printed. \value PageRange The specified page range should be printed. + \value CurrentPage Only the current page should be printed. \sa QAbstractPrintDialog::PrintRange */ @@ -571,6 +572,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value AllPages All the pages should be printed. \value Selection Only the selection should be printed. \value PageRange Print according to the from page and to page options. + \value CurrentPage Only the current page should be printed. \sa setPrintRange(), printRange() */ @@ -586,6 +588,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value PrintSelection Describes if printing selections should be enabled. \value PrintPageRange Describes if printing page ranges (from, to) should be enabled + \value PrintCurrentPage if Print Current Page option should be enabled \sa setOptionEnabled(), isOptionEnabled() */ diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h index 6636179..996a954 100644 --- a/src/gui/painting/qprinter.h +++ b/src/gui/painting/qprinter.h @@ -124,7 +124,7 @@ public: enum OutputFormat { NativeFormat, PdfFormat, PostScriptFormat }; // ### Qt 5: Merge with QAbstractPrintDialog::PrintRange - enum PrintRange { AllPages, Selection, PageRange }; + enum PrintRange { AllPages, Selection, PageRange, CurrentPage }; enum Unit { Millimeter, diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index 7e8ce84..49bddb2 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -107,6 +107,7 @@ private slots: void printDialogCompleter(); void testCopyCount(); + void testCurrentPage(); void taskQTBUG4497_reusePrinterOnDifferentFiles(); @@ -1005,5 +1006,27 @@ void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles() QCOMPARE(file1.readAll(), file2.readAll()); } +void tst_QPrinter::testCurrentPage() +{ + QPrinter printer; + printer.setFromTo(1, 10); + + // Test set print range + printer.setPrintRange(QPrinter::CurrentPage); + QCOMPARE(printer.printRange(), QPrinter::CurrentPage); + QCOMPARE(printer.fromPage(), 1); + QCOMPARE(printer.toPage(), 10); + + QPrintDialog dialog(&printer); + + // Test default Current Page option to off + QCOMPARE(dialog.isOptionEnabled(QPrintDialog::PrintCurrentPage), false); + + // Test enable Current Page option + dialog.setOption(QPrintDialog::PrintCurrentPage); + QCOMPARE(dialog.isOptionEnabled(QPrintDialog::PrintCurrentPage), true); + +} + QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" -- cgit v0.12 From f2ff0521dfae47f63c9334cbc78b4070aa9c9d7d Mon Sep 17 00:00:00 2001 From: kh1 Date: Thu, 4 Mar 2010 16:38:38 +0100 Subject: Set database write behavior to synchronous=OFF and increase page cache. This improves the INSERT performance dramatically, since we won't wait anymore until all data is written back to the database. Should not have any impact on the database consistency in case of an app crash, only in case the whole OS crashes, but then you might be in trouble anyway. Reviewed-by: ck --- tools/assistant/lib/qhelpcollectionhandler.cpp | 8 ++++++++ tools/assistant/lib/qhelpgenerator.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/tools/assistant/lib/qhelpcollectionhandler.cpp b/tools/assistant/lib/qhelpcollectionhandler.cpp index 235f737..bd8dc20 100644 --- a/tools/assistant/lib/qhelpcollectionhandler.cpp +++ b/tools/assistant/lib/qhelpcollectionhandler.cpp @@ -114,6 +114,9 @@ bool QHelpCollectionHandler::openCollectionFile() return false; } + m_query.exec(QLatin1String("PRAGMA synchronous=OFF")); + m_query.exec(QLatin1String("PRAGMA cache_size=3000")); + m_query.exec(QLatin1String("SELECT COUNT(*) FROM sqlite_master WHERE TYPE=\'table\'" "AND Name=\'NamespaceTable\'")); m_query.next(); @@ -163,6 +166,9 @@ bool QHelpCollectionHandler::copyCollectionFile(const QString &fileName) return false; } + copyQuery->exec(QLatin1String("PRAGMA synchronous=OFF")); + copyQuery->exec(QLatin1String("PRAGMA cache_size=3000")); + if (!createTables(copyQuery)) { emit error(tr("Cannot copy collection file: %1").arg(colFile)); return false; @@ -582,6 +588,8 @@ void QHelpCollectionHandler::optimizeDatabase(const QString &fileName) } QSqlQuery query(db); + db.exec(QLatin1String("PRAGMA synchronous=OFF")); + db.exec(QLatin1String("PRAGMA cache_size=3000")); db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS NameIndex ON IndexTable(Name)")); db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS FileNameIndex ON FileNameTable(Name)")); db.exec(QLatin1String("CREATE INDEX IF NOT EXISTS FileIdIndex ON FileNameTable(FileId)")); diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp index 783f016..85bdd75 100644 --- a/tools/assistant/lib/qhelpgenerator.cpp +++ b/tools/assistant/lib/qhelpgenerator.cpp @@ -191,6 +191,9 @@ bool QHelpGenerator::generate(QHelpDataInterface *helpData, return false; } + d->query->exec(QLatin1String("PRAGMA synchronous=OFF")); + d->query->exec(QLatin1String("PRAGMA cache_size=3000")); + addProgress(1.0); createTables(); insertFileNotFoundFile(); -- cgit v0.12 From 22a54680149d8fe5170f16e6aba7aff645b43da2 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Thu, 4 Mar 2010 15:27:06 +0200 Subject: Optimize QScriptValue autotest generator. QScriptValue autotest suite compile 24 minutes on MSVS2008 which is unacceptable. Modification tries to reduce the compilation time. Temples were changed to use static arrays of data; instead of inserting values directly, they are inserted in a loop (less code to optimize). Generated code were separated into several files (better usage of distributed compiling). Reviewed-by: Kent Hansen --- tests/auto/qscriptvalue/testgen/main.cpp | 2 +- tests/auto/qscriptvalue/testgen/testgenerator.cpp | 401 +++++++++++++--------- tests/auto/qscriptvalue/testgen/testgenerator.h | 15 +- 3 files changed, 245 insertions(+), 173 deletions(-) diff --git a/tests/auto/qscriptvalue/testgen/main.cpp b/tests/auto/qscriptvalue/testgen/main.cpp index fe35de9..0672635 100644 --- a/tests/auto/qscriptvalue/testgen/main.cpp +++ b/tests/auto/qscriptvalue/testgen/main.cpp @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) QCoreApplication a(argc, argv); if (argc != 2) { - qWarning() << "./prog outputfile"; + qWarning() << "./prog outputdir"; exit(1); } diff --git a/tests/auto/qscriptvalue/testgen/testgenerator.cpp b/tests/auto/qscriptvalue/testgen/testgenerator.cpp index 4376c42..a291110 100644 --- a/tests/auto/qscriptvalue/testgen/testgenerator.cpp +++ b/tests/auto/qscriptvalue/testgen/testgenerator.cpp @@ -50,10 +50,17 @@ #include #include -void TestGenerator::save(const QString& data) +void TestGenerator::save(const QHash& data) { - QTextStream out(&m_ofile); - out << data; + foreach(const QString& name, data.keys()) { + QFile ofile(m_opath + "tst_qscriptvalue_generated_" + name + ".cpp"); + if (!ofile.open(QIODevice::WriteOnly | QIODevice::Text)) { + qWarning() << "Can't open output file: " << ofile.fileName(); + exit(2); + } + QTextStream out(&ofile); + out << data[name]; + } } static QString escape(QString txt) @@ -98,6 +105,55 @@ QString typeName() {return "bool";} template<> QString typeName() {return "QString";} +static QString generateLicence() +{ + return "/****************************************************************************\n" + "**\n" + "** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\n" + "** All rights reserved.\n" + "** Contact: Nokia Corporation (qt-info@nokia.com)\n" + "**\n" + "** This file is part of the test suite of the Qt Toolkit.\n" + "**\n" + "** $QT_BEGIN_LICENSE:LGPL$\n" + "** No Commercial Usage\n" + "** This file contains pre-release code and may not be distributed.\n" + "** You may use this file in accordance with the terms and conditions\n" + "** contained in the Technology Preview License Agreement accompanying\n" + "** this package.\n" + "**\n" + "** GNU Lesser General Public License Usage\n" + "** Alternatively, this file may be used under the terms of the GNU Lesser\n" + "** General Public License version 2.1 as published by the Free Software\n" + "** Foundation and appearing in the file LICENSE.LGPL included in the\n" + "** packaging of this file. Please review the following information to\n" + "** ensure the GNU Lesser General Public License version 2.1 requirements\n" + "** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n" + "**\n" + "** In addition, as a special exception, Nokia gives you certain additional\n" + "** rights. These rights are described in the Nokia Qt LGPL Exception\n" + "** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n" + "**\n" + "** If you have questions regarding the use of this file, please contact\n" + "** Nokia at qt-info@nokia.com.\n" + "**\n" + "**\n" + "**\n" + "**\n" + "**\n" + "**\n" + "**\n" + "**\n" + "** $QT_END_LICENSE$\n" + "**\n" + "****************************************************************************/\n" + "\n"\ + "/****************************************************************************\n"\ + "*************** This file has been generated. DO NOT MODIFY! ****************\n" + "****************************************************************************/\n\n"\ + "#include \"tst_qscriptvalue.h\"\n\n"; +} + static QString generateIsXXXDef(const QString& name, const QList& list) { static const QString templ("void tst_QScriptValue::%1_initData()\n"\ @@ -106,11 +162,14 @@ static QString generateIsXXXDef(const QString& name, const QList& list) " initScriptValues();\n"\ "}\n"\ "\n"\ + "static QString %1_array [] = {%2};\n\n"\ "void tst_QScriptValue::%1_makeData(const char* expr)\n"\ "{\n"\ " static QSet %1;\n"\ " if (%1.isEmpty()) {\n"\ - " %1%2\n"\ + " %1.reserve(%3);\n"\ + " for (unsigned i = 0; i < %3; ++i)\n"\ + " %1.insert(%1_array[i]);\n"\ " }\n"\ " newRow(expr) << %1.contains(expr);\n"\ "}\n"\ @@ -132,16 +191,14 @@ static QString generateIsXXXDef(const QString& name, const QList& list) QString result = templ; QStringList set; - foreach(QString t, list) { - t = escape(t); - t.append('\"'); - t.prepend('\"'); - set.append(QString(" << ")); - set.append(t); - set.append("\n "); + set.reserve(3 * list.count()); + foreach(const QString& t, list) { + set.append("\n \""); + set.append(escape(t)); + set.append("\","); } - set.append(";"); - return result.arg(name, set.join(QString())); + + return result.arg(name, set.join(QString()), QString::number(list.count())); } template @@ -154,11 +211,15 @@ static QString generateToXXXDef(const QString& name, const QList %1;\n"\ " if (%1.isEmpty()) {\n"\ - "%3"\ + " %1.reserve(%3);\n"\ + " for (unsigned i = 0; i < %3; ++i)\n"\ + " %1.insert(%1_tagArray[i], %1_valueArray[i]);\n"\ " }\n"\ " newRow(expr) << %1.value(expr);\n"\ "}\n"\ @@ -174,19 +235,26 @@ static QString generateToXXXDef(const QString& name, const QList >::const_iterator i = list.constBegin(); - QStringList set; + QStringList tagSet, valueSet; + tagSet.reserve(list.count()); + valueSet.reserve(list.count()); + int tmp = -1; for(; i != list.constEnd(); ++i) { QPair t = *i; t.first = escape(t.first); - set.append(QString(" ")); - set.append(name); - set.append(".insert(\""); - set.append(t.first); - set.append(QString::fromAscii("\", ")); - set.append(prepareToInsert(t.second)); - set.append(QString::fromAscii(");\n")); + tagSet.append(QString("\n \"")); + tagSet.append(t.first); + tagSet.append(QString::fromAscii("\",")); + if (!((++tmp)%2)) + valueSet.append(QString("\n ")); + valueSet.append(prepareToInsert(t.second)); + valueSet.append(QString::fromAscii(", ")); } - return result.arg(name, typeName(), set.join(QString())); + return result.arg(name, + typeName(), + QString::number(list.count()), + tagSet.join(QString()), + valueSet.join(QString())); } @@ -200,11 +268,15 @@ QString generateToXXXDef(const QString& name, const QList %1;\n"\ " if (%1.isEmpty()) {\n"\ - "%3"\ + " %1.reserve(%5);\n"\ + " for (unsigned i = 0; i < %5; ++i)\n"\ + " %1.insert(%1_tagArray[i], %1_valueArray[i]);\n"\ " }\n"\ " newRow(expr) << %1.value(expr);\n"\ "}\n"\ @@ -226,17 +298,20 @@ QString generateToXXXDef(const QString& name, const QList >::const_iterator i = list.constBegin(); - QStringList set; + QStringList tagSet, valueSet; + tagSet.reserve(list.count()); + valueSet.reserve(list.count()); + int tmp = -1; for(; i != list.constEnd(); ++i) { QPair t = *i; t.first = escape(t.first); - set.append(QString(" ")); - set.append(name); - set.append(".insert(\""); - set.append(t.first); - set.append(QString::fromAscii("\", ")); - set.append(prepareToInsert(t.second)); - set.append(QString::fromAscii(");\n")); + tagSet.append(QString("\n \"")); + tagSet.append(t.first); + tagSet.append(QString::fromAscii("\",")); + if (!((++tmp)%10)) + valueSet.append(QString("\n ")); + valueSet.append(prepareToInsert(t.second)); + valueSet.append(QString::fromAscii(", ")); } // toInteger shouldn't return NaN, so it would be nice to catch the case. QString hook; @@ -247,105 +322,129 @@ QString generateToXXXDef(const QString& name, const QList(), set.join(QString()), hook); + return result.arg(name, + typeName(), + tagSet.join(QString()), + valueSet.join(QString()), + QString::number(list.count()), + hook); } template static QString generateCastDef(const QList >& list) { static const QString templ = "\n"\ - "void tst_QScriptValue::qscriptvalue_cast%2_initData()\n"\ + "void tst_QScriptValue::qscriptvalue_cast%1_initData()\n"\ "{\n"\ - " QTest::addColumn<%2>(\"expected\");\n"\ + " QTest::addColumn<%1>(\"expected\");\n"\ " initScriptValues();\n"\ "}\n"\ "\n"\ - "void tst_QScriptValue::qscriptvalue_cast%2_makeData(const char* expr)\n"\ + "static QString qscriptvalue_cast%1_tagArray [] = {%2};\n"\ + "static %1 qscriptvalue_cast%1_valueArray [] = {%3};\n"\ + "void tst_QScriptValue::qscriptvalue_cast%1_makeData(const char* expr)\n"\ "{\n"\ - " static QHash value;\n"\ + " static QHash value;\n"\ " if (value.isEmpty()) {\n"\ - "%3"\ + " value.reserve(%4);\n"\ + " for (unsigned i = 0; i < %4; ++i)\n"\ + " value.insert(qscriptvalue_cast%1_tagArray[i], qscriptvalue_cast%1_valueArray[i]);\n"\ " }\n"\ " newRow(expr) << value.value(expr);\n"\ "}\n"\ "\n"\ - "void tst_QScriptValue::qscriptvalue_cast%2_test(const char*, const QScriptValue& value)\n"\ + "void tst_QScriptValue::qscriptvalue_cast%1_test(const char*, const QScriptValue& value)\n"\ "{\n"\ - " QFETCH(%2, expected);\n"\ - " QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\ - " QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\ + " QFETCH(%1, expected);\n"\ + " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\ + " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\ "}\n"\ "\n"\ - "DEFINE_TEST_FUNCTION(qscriptvalue_cast%2)\n"; + "DEFINE_TEST_FUNCTION(qscriptvalue_cast%1)\n"; QString result = templ; typename QList >::const_iterator i = list.constBegin(); - QStringList set; + QStringList tagSet, valueSet; + tagSet.reserve(list.count()); + valueSet.reserve(list.count()); + int tmp = -1; for(; i != list.constEnd(); ++i) { QPair t = *i; t.first = escape(t.first); - set.append(QString(" ")); - set.append("value.insert(\""); - set.append(t.first); - set.append(QString::fromAscii("\", ")); - set.append(prepareToInsert(t.second)); - set.append(QString::fromAscii(");\n")); + tagSet.append(QString("\n \"")); + tagSet.append(t.first); + tagSet.append(QString::fromAscii("\",")); + if (!((++tmp)%2)) + valueSet.append(QString("\n ")); + valueSet.append(prepareToInsert(t.second)); + valueSet.append(QString::fromAscii(", ")); } - return result.arg(typeName(), set.join(QString())); + return result.arg(typeName(), tagSet.join(QString()), valueSet.join(QString()), QString::number(list.count())); } template<> QString generateCastDef(const QList >& list) { static const QString templ = "\n"\ - "void tst_QScriptValue::qscriptvalue_cast%2_initData()\n"\ + "void tst_QScriptValue::qscriptvalue_cast%1_initData()\n"\ "{\n"\ - " QTest::addColumn<%2>(\"expected\");\n"\ + " QTest::addColumn<%1>(\"expected\");\n"\ " initScriptValues();\n"\ "}\n"\ "\n"\ - "void tst_QScriptValue::qscriptvalue_cast%2_makeData(const char* expr)\n"\ + "static QString qscriptvalue_cast%1_tagArray [] = {%2};\n"\ + "static %1 qscriptvalue_cast%1_valueArray [] = {%3};\n"\ + "void tst_QScriptValue::qscriptvalue_cast%1_makeData(const char* expr)\n"\ "{\n"\ - " static QHash value;\n"\ + " static QHash value;\n"\ " if (value.isEmpty()) {\n"\ - "%3"\ + " value.reserve(%4);\n"\ + " for (unsigned i = 0; i < %4; ++i)\n"\ + " value.insert(qscriptvalue_cast%1_tagArray[i], qscriptvalue_cast%1_valueArray[i]);\n"\ " }\n"\ " newRow(expr) << value.value(expr);\n"\ "}\n"\ "\n"\ - "void tst_QScriptValue::qscriptvalue_cast%2_test(const char*, const QScriptValue& value)\n"\ + "void tst_QScriptValue::qscriptvalue_cast%1_test(const char*, const QScriptValue& value)\n"\ "{\n"\ - " QFETCH(%2, expected);\n"\ + " QFETCH(%1, expected);\n"\ " if (qIsNaN(expected)) {\n" - " QVERIFY(qIsNaN(qscriptvalue_cast<%2>(value)));\n" - " QVERIFY(qIsNaN(qscriptvalue_cast<%2>(value)));\n" + " QVERIFY(qIsNaN(qscriptvalue_cast<%1>(value)));\n" + " QVERIFY(qIsNaN(qscriptvalue_cast<%1>(value)));\n" " return;\n" " }\n"\ " if (qIsInf(expected)) {\n" - " QVERIFY(qIsInf(qscriptvalue_cast<%2>(value)));\n" - " QVERIFY(qIsInf(qscriptvalue_cast<%2>(value)));\n" + " QVERIFY(qIsInf(qscriptvalue_cast<%1>(value)));\n" + " QVERIFY(qIsInf(qscriptvalue_cast<%1>(value)));\n" " return;\n" " }\n" - " QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\ - " QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\ + " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\ + " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\ "}\n"\ "\n"\ - "DEFINE_TEST_FUNCTION(qscriptvalue_cast%2)\n"; + "DEFINE_TEST_FUNCTION(qscriptvalue_cast%1)\n"; QString result = templ; QList >::const_iterator i = list.constBegin(); - QStringList set; + QStringList tagSet, valueSet; + tagSet.reserve(list.count()); + valueSet.reserve(list.count()); + int tmp = -1; for(; i != list.constEnd(); ++i) { QPair t = *i; t.first = escape(t.first); - set.append(QString(" ")); - set.append("value.insert(\""); - set.append(t.first); - set.append(QString::fromAscii("\", ")); - set.append(prepareToInsert(t.second)); - set.append(QString::fromAscii(");\n")); + tagSet.append(QString("\n \"")); + tagSet.append(t.first); + tagSet.append(QString::fromAscii("\",")); + if (!((++tmp)%10)) + valueSet.append(QString("\n ")); + valueSet.append(prepareToInsert(t.second)); + valueSet.append(QString::fromAscii(", ")); } - return result.arg(typeName(), set.join(QString())); + return result.arg(typeName(), + tagSet.join(QString()), + valueSet.join(QString()), + QString::number(list.count())); } static QString generateCompareDef(const QString& comparisionType, const QList tags) @@ -358,11 +457,14 @@ static QString generateCompareDef(const QString& comparisionType, const QList equals;\n"\ " if (equals.isEmpty()) {\n"\ - "%2\n"\ + " equals.reserve(%3);\n"\ + " for (unsigned i = 0; i < %3; ++i)\n"\ + " equals.insert(%1_array[i]);\n"\ " }\n"\ " QHash::const_iterator it;\n"\ " for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) {\n"\ @@ -386,59 +488,16 @@ static QString generateCompareDef(const QString& comparisionType, const QList& allDataTags) { - static const QString templ = "/****************************************************************************\n" - "**\n" - "** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\n" - "** All rights reserved.\n" - "** Contact: Nokia Corporation (qt-info@nokia.com)\n" - "**\n" - "** This file is part of the test suite of the Qt Toolkit.\n" - "**\n" - "** $QT_BEGIN_LICENSE:LGPL$\n" - "** No Commercial Usage\n" - "** This file contains pre-release code and may not be distributed.\n" - "** You may use this file in accordance with the terms and conditions\n" - "** contained in the Technology Preview License Agreement accompanying\n" - "** this package.\n" - "**\n" - "** GNU Lesser General Public License Usage\n" - "** Alternatively, this file may be used under the terms of the GNU Lesser\n" - "** General Public License version 2.1 as published by the Free Software\n" - "** Foundation and appearing in the file LICENSE.LGPL included in the\n" - "** packaging of this file. Please review the following information to\n" - "** ensure the GNU Lesser General Public License version 2.1 requirements\n" - "** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n" - "**\n" - "** In addition, as a special exception, Nokia gives you certain additional\n" - "** rights. These rights are described in the Nokia Qt LGPL Exception\n" - "** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n" - "**\n" - "** If you have questions regarding the use of this file, please contact\n" - "** Nokia at qt-info@nokia.com.\n" - "**\n" - "**\n" - "**\n" - "**\n" - "**\n" - "**\n" - "**\n" - "**\n" - "** $QT_END_LICENSE$\n" - "**\n" - "****************************************************************************/\n" - "\n"\ - "#include \"tst_qscriptvalue.h\"\n\n"\ - "#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr)\n"\ - "\n"\ - "void tst_QScriptValue::initScriptValues()\n"\ + static const QString templ = "void tst_QScriptValue::initScriptValues()\n"\ "{\n"\ " m_values.clear();\n"\ " if (engine) \n"\ @@ -463,7 +522,7 @@ static void squashTags(QString dataTag, const QVector& results, QList TestGenerator::generateTest() { // All data tags keept in one place. QVector dataTags; @@ -643,47 +702,63 @@ QString TestGenerator::generateTest() Q_ASSERT(in.atEnd()); // Generate. - QStringList result; - result.append(generateInitDef(dataTags)); - result.append(generateIsXXXDef("isValid", isValidList)); - result.append(generateIsXXXDef("isBool", isBoolList)); - result.append(generateIsXXXDef("isBoolean", isBooleanList)); - result.append(generateIsXXXDef("isNumber", isNumberList)); - result.append(generateIsXXXDef("isFunction", isFunctionList)); - result.append(generateIsXXXDef("isNull", isNullList)); - result.append(generateIsXXXDef("isString", isStringList)); - result.append(generateIsXXXDef("isUndefined", isUndefinedList)); - result.append(generateIsXXXDef("isVariant", isVariantList)); - result.append(generateIsXXXDef("isQObject", isQObjectList)); - result.append(generateIsXXXDef("isQMetaObject", isQMetaObjectList)); - result.append(generateIsXXXDef("isObject", isObjectList)); - result.append(generateIsXXXDef("isDate", isDateList)); - result.append(generateIsXXXDef("isRegExp", isRegExpList)); - result.append(generateIsXXXDef("isArray", isArrayList)); - result.append(generateIsXXXDef("isError", isErrorList)); - - result.append(generateToXXXDef("toString", toStringList)); - result.append(generateToXXXDef("toNumber", toNumberList)); - result.append(generateToXXXDef("toBool", toBoolList)); - result.append(generateToXXXDef("toBoolean", toBooleanList)); - result.append(generateToXXXDef("toInteger", toIntegerList)); - result.append(generateToXXXDef("toInt32", toInt32List)); - result.append(generateToXXXDef("toUInt32", toUInt32List)); - result.append(generateToXXXDef("toUInt16", toUInt16List)); - - result.append(generateCompareDef("equals", equalsList)); - result.append(generateCompareDef("strictlyEquals", strictlyEqualsList)); - result.append(generateCompareDef("lessThan", lessThanList)); - result.append(generateCompareDef("instanceOf", instanceOfList)); - - result.append(generateCastDef(castStringList)); - result.append(generateCastDef(castSRealList)); - result.append(generateCastDef(castBoolList)); - result.append(generateCastDef(castInt32List)); - result.append(generateCastDef(castUInt32List)); - result.append(generateCastDef(castUInt16List)); - - return result.join("\n"); + QHash result; + QStringList tmp; + tmp.append(generateLicence()); + tmp.append(generateInitDef(dataTags)); + result.insert("init", tmp.join("\n")); + tmp.clear(); + + tmp.append(generateLicence()); + tmp.append(generateIsXXXDef("isValid", isValidList)); + tmp.append(generateIsXXXDef("isBool", isBoolList)); + tmp.append(generateIsXXXDef("isBoolean", isBooleanList)); + tmp.append(generateIsXXXDef("isNumber", isNumberList)); + tmp.append(generateIsXXXDef("isFunction", isFunctionList)); + tmp.append(generateIsXXXDef("isNull", isNullList)); + tmp.append(generateIsXXXDef("isString", isStringList)); + tmp.append(generateIsXXXDef("isUndefined", isUndefinedList)); + tmp.append(generateIsXXXDef("isVariant", isVariantList)); + tmp.append(generateIsXXXDef("isQObject", isQObjectList)); + tmp.append(generateIsXXXDef("isQMetaObject", isQMetaObjectList)); + tmp.append(generateIsXXXDef("isObject", isObjectList)); + tmp.append(generateIsXXXDef("isDate", isDateList)); + tmp.append(generateIsXXXDef("isRegExp", isRegExpList)); + tmp.append(generateIsXXXDef("isArray", isArrayList)); + tmp.append(generateIsXXXDef("isError", isErrorList)); + result.insert("isXXX", tmp.join("\n")); + tmp.clear(); + + tmp.append(generateLicence()); + tmp.append(generateToXXXDef("toString", toStringList)); + tmp.append(generateToXXXDef("toNumber", toNumberList)); + tmp.append(generateToXXXDef("toBool", toBoolList)); + tmp.append(generateToXXXDef("toBoolean", toBooleanList)); + tmp.append(generateToXXXDef("toInteger", toIntegerList)); + tmp.append(generateToXXXDef("toInt32", toInt32List)); + tmp.append(generateToXXXDef("toUInt32", toUInt32List)); + tmp.append(generateToXXXDef("toUInt16", toUInt16List)); + result.insert("toXXX", tmp.join("\n")); + tmp.clear(); + + tmp.append(generateLicence()); + tmp.append(generateCompareDef("equals", equalsList)); + tmp.append(generateCompareDef("strictlyEquals", strictlyEqualsList)); + tmp.append(generateCompareDef("lessThan", lessThanList)); + tmp.append(generateCompareDef("instanceOf", instanceOfList)); + result.insert("comparison", tmp.join("\n")); + tmp.clear(); + + tmp.append(generateLicence()); + tmp.append(generateCastDef(castStringList)); + tmp.append(generateCastDef(castSRealList)); + tmp.append(generateCastDef(castBoolList)); + tmp.append(generateCastDef(castInt32List)); + tmp.append(generateCastDef(castUInt32List)); + tmp.append(generateCastDef(castUInt16List)); + result.insert("cast", tmp.join("\n")); + + return result; } diff --git a/tests/auto/qscriptvalue/testgen/testgenerator.h b/tests/auto/qscriptvalue/testgen/testgenerator.h index 8f4a357..1c61fc5 100644 --- a/tests/auto/qscriptvalue/testgen/testgenerator.h +++ b/tests/auto/qscriptvalue/testgen/testgenerator.h @@ -49,13 +49,10 @@ class TestGenerator { public: TestGenerator(QString& outputpath) - : m_ofile(outputpath) + : m_opath(outputpath) { - // Open output file - if (!m_ofile.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "Can't open output file: " << outputpath; - exit(2); - } + if (!m_opath.endsWith('/')) + m_opath.append('/'); m_tempFile.open(); } @@ -67,10 +64,10 @@ public: } void prepareData(); - QString generateTest(); - void save(const QString& data); + QHash generateTest(); + void save(const QHash& data); private: - QFile m_ofile; + QString m_opath; QTemporaryFile m_tempFile; }; -- cgit v0.12 From c5d04bb263528e665ed0423a27af3cc4bd40e9f2 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Thu, 4 Mar 2010 16:19:58 +0200 Subject: Reduce compiling time of QScriptValue autotest suite on Windows. The QScriptValue autotest suite compiles about 24 min with MSVS2008, which is unacceptable. Tests were splited into a few files for better use of distributed compilation. Repeated calls to insert() and operator<<() where replaced by loops, that should reduce time of code optimizing. Reviewed-by: Kent Hansen --- tests/auto/qscriptvalue/qscriptvalue.pro | 8 +- tests/auto/qscriptvalue/tst_qscriptvalue.h | 2 + .../qscriptvalue/tst_qscriptvalue_generated.cpp | 10221 ------------------- .../tst_qscriptvalue_generated_cast.cpp | 1453 +++ .../tst_qscriptvalue_generated_comparison.cpp | 7026 +++++++++++++ .../tst_qscriptvalue_generated_init.cpp | 198 + .../tst_qscriptvalue_generated_isXXX.cpp | 830 ++ .../tst_qscriptvalue_generated_toXXX.cpp | 1897 ++++ 8 files changed, 11412 insertions(+), 10223 deletions(-) delete mode 100644 tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp create mode 100644 tests/auto/qscriptvalue/tst_qscriptvalue_generated_cast.cpp create mode 100644 tests/auto/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp create mode 100644 tests/auto/qscriptvalue/tst_qscriptvalue_generated_init.cpp create mode 100644 tests/auto/qscriptvalue/tst_qscriptvalue_generated_isXXX.cpp create mode 100644 tests/auto/qscriptvalue/tst_qscriptvalue_generated_toXXX.cpp diff --git a/tests/auto/qscriptvalue/qscriptvalue.pro b/tests/auto/qscriptvalue/qscriptvalue.pro index 191cd4a..c3e9912 100644 --- a/tests/auto/qscriptvalue/qscriptvalue.pro +++ b/tests/auto/qscriptvalue/qscriptvalue.pro @@ -4,8 +4,12 @@ SOURCES += tst_qscriptvalue.cpp HEADERS += tst_qscriptvalue.h # Generated by testgen -SOURCES += tst_qscriptvalue_generated.cpp - +SOURCES += \ + tst_qscriptvalue_generated_init.cpp \ + tst_qscriptvalue_generated_cast.cpp \ + tst_qscriptvalue_generated_comparison.cpp \ + tst_qscriptvalue_generated_isXXX.cpp \ + tst_qscriptvalue_generated_toXXX.cpp win32-msvc* { # With -O2, MSVC takes up to 24 minutes to compile this test! diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h index a5c7b45..aae35b2 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.h +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h @@ -49,6 +49,8 @@ #include #include +#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr) + Q_DECLARE_METATYPE(QVariant) Q_DECLARE_METATYPE(QScriptValue) diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp deleted file mode 100644 index a07ff4b..0000000 --- a/tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp +++ /dev/null @@ -1,10221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tst_qscriptvalue.h" - -#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr) - -void tst_QScriptValue::initScriptValues() -{ - m_values.clear(); - if (engine) - delete engine; - engine = new QScriptEngine; - DEFINE_TEST_VALUE(QScriptValue()); - DEFINE_TEST_VALUE(QScriptValue(QScriptValue::UndefinedValue)); - DEFINE_TEST_VALUE(QScriptValue(QScriptValue::NullValue)); - DEFINE_TEST_VALUE(QScriptValue(true)); - DEFINE_TEST_VALUE(QScriptValue(false)); - DEFINE_TEST_VALUE(QScriptValue(int(122))); - DEFINE_TEST_VALUE(QScriptValue(uint(124))); - DEFINE_TEST_VALUE(QScriptValue(0)); - DEFINE_TEST_VALUE(QScriptValue(0.0)); - DEFINE_TEST_VALUE(QScriptValue(123.0)); - DEFINE_TEST_VALUE(QScriptValue(6.37e-8)); - DEFINE_TEST_VALUE(QScriptValue(-6.37e-8)); - DEFINE_TEST_VALUE(QScriptValue(0x43211234)); - DEFINE_TEST_VALUE(QScriptValue(0x10000)); - DEFINE_TEST_VALUE(QScriptValue(0x10001)); - DEFINE_TEST_VALUE(QScriptValue(qSNaN())); - DEFINE_TEST_VALUE(QScriptValue(qQNaN())); - DEFINE_TEST_VALUE(QScriptValue(qInf())); - DEFINE_TEST_VALUE(QScriptValue(-qInf())); - DEFINE_TEST_VALUE(QScriptValue("NaN")); - DEFINE_TEST_VALUE(QScriptValue("Infinity")); - DEFINE_TEST_VALUE(QScriptValue("-Infinity")); - DEFINE_TEST_VALUE(QScriptValue("ciao")); - DEFINE_TEST_VALUE(QScriptValue(QString::fromLatin1("ciao"))); - DEFINE_TEST_VALUE(QScriptValue(QString(""))); - DEFINE_TEST_VALUE(QScriptValue(QString())); - DEFINE_TEST_VALUE(QScriptValue(QString("0"))); - DEFINE_TEST_VALUE(QScriptValue(QString("123"))); - DEFINE_TEST_VALUE(QScriptValue(QString("12.4"))); - DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::UndefinedValue)); - DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::NullValue)); - DEFINE_TEST_VALUE(QScriptValue(0, true)); - DEFINE_TEST_VALUE(QScriptValue(0, false)); - DEFINE_TEST_VALUE(QScriptValue(0, int(122))); - DEFINE_TEST_VALUE(QScriptValue(0, uint(124))); - DEFINE_TEST_VALUE(QScriptValue(0, 0)); - DEFINE_TEST_VALUE(QScriptValue(0, 0.0)); - DEFINE_TEST_VALUE(QScriptValue(0, 123.0)); - DEFINE_TEST_VALUE(QScriptValue(0, 6.37e-8)); - DEFINE_TEST_VALUE(QScriptValue(0, -6.37e-8)); - DEFINE_TEST_VALUE(QScriptValue(0, 0x43211234)); - DEFINE_TEST_VALUE(QScriptValue(0, 0x10000)); - DEFINE_TEST_VALUE(QScriptValue(0, 0x10001)); - DEFINE_TEST_VALUE(QScriptValue(0, qSNaN())); - DEFINE_TEST_VALUE(QScriptValue(0, qQNaN())); - DEFINE_TEST_VALUE(QScriptValue(0, qInf())); - DEFINE_TEST_VALUE(QScriptValue(0, -qInf())); - DEFINE_TEST_VALUE(QScriptValue(0, "NaN")); - DEFINE_TEST_VALUE(QScriptValue(0, "Infinity")); - DEFINE_TEST_VALUE(QScriptValue(0, "-Infinity")); - DEFINE_TEST_VALUE(QScriptValue(0, "ciao")); - DEFINE_TEST_VALUE(QScriptValue(0, QString::fromLatin1("ciao"))); - DEFINE_TEST_VALUE(QScriptValue(0, QString(""))); - DEFINE_TEST_VALUE(QScriptValue(0, QString())); - DEFINE_TEST_VALUE(QScriptValue(0, QString("0"))); - DEFINE_TEST_VALUE(QScriptValue(0, QString("123"))); - DEFINE_TEST_VALUE(QScriptValue(0, QString("12.3"))); - DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::UndefinedValue)); - DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::NullValue)); - DEFINE_TEST_VALUE(QScriptValue(engine, true)); - DEFINE_TEST_VALUE(QScriptValue(engine, false)); - DEFINE_TEST_VALUE(QScriptValue(engine, int(122))); - DEFINE_TEST_VALUE(QScriptValue(engine, uint(124))); - DEFINE_TEST_VALUE(QScriptValue(engine, 0)); - DEFINE_TEST_VALUE(QScriptValue(engine, 0.0)); - DEFINE_TEST_VALUE(QScriptValue(engine, 123.0)); - DEFINE_TEST_VALUE(QScriptValue(engine, 6.37e-8)); - DEFINE_TEST_VALUE(QScriptValue(engine, -6.37e-8)); - DEFINE_TEST_VALUE(QScriptValue(engine, 0x43211234)); - DEFINE_TEST_VALUE(QScriptValue(engine, 0x10000)); - DEFINE_TEST_VALUE(QScriptValue(engine, 0x10001)); - DEFINE_TEST_VALUE(QScriptValue(engine, qSNaN())); - DEFINE_TEST_VALUE(QScriptValue(engine, qQNaN())); - DEFINE_TEST_VALUE(QScriptValue(engine, qInf())); - DEFINE_TEST_VALUE(QScriptValue(engine, -qInf())); - DEFINE_TEST_VALUE(QScriptValue(engine, "NaN")); - DEFINE_TEST_VALUE(QScriptValue(engine, "Infinity")); - DEFINE_TEST_VALUE(QScriptValue(engine, "-Infinity")); - DEFINE_TEST_VALUE(QScriptValue(engine, "ciao")); - DEFINE_TEST_VALUE(QScriptValue(engine, QString::fromLatin1("ciao"))); - DEFINE_TEST_VALUE(QScriptValue(engine, QString(""))); - DEFINE_TEST_VALUE(QScriptValue(engine, QString())); - DEFINE_TEST_VALUE(QScriptValue(engine, QString("0"))); - DEFINE_TEST_VALUE(QScriptValue(engine, QString("123"))); - DEFINE_TEST_VALUE(QScriptValue(engine, QString("1.23"))); - DEFINE_TEST_VALUE(engine->evaluate("[]")); - DEFINE_TEST_VALUE(engine->evaluate("{}")); - DEFINE_TEST_VALUE(engine->evaluate("Object.prototype")); - DEFINE_TEST_VALUE(engine->evaluate("Date.prototype")); - DEFINE_TEST_VALUE(engine->evaluate("Array.prototype")); - DEFINE_TEST_VALUE(engine->evaluate("Function.prototype")); - DEFINE_TEST_VALUE(engine->evaluate("Error.prototype")); - DEFINE_TEST_VALUE(engine->evaluate("Object")); - DEFINE_TEST_VALUE(engine->evaluate("Array")); - DEFINE_TEST_VALUE(engine->evaluate("Number")); - DEFINE_TEST_VALUE(engine->evaluate("Function")); - DEFINE_TEST_VALUE(engine->evaluate("(function() { return 1; })")); - DEFINE_TEST_VALUE(engine->evaluate("(function() { return 'ciao'; })")); - DEFINE_TEST_VALUE(engine->evaluate("(function() { throw new Error('foo'); })")); - DEFINE_TEST_VALUE(engine->evaluate("/foo/")); - DEFINE_TEST_VALUE(engine->evaluate("new Object()")); - DEFINE_TEST_VALUE(engine->evaluate("new Array()")); - DEFINE_TEST_VALUE(engine->evaluate("new Error()")); - DEFINE_TEST_VALUE(engine->evaluate("a = new Object(); a.foo = 22; a.foo")); - DEFINE_TEST_VALUE(engine->evaluate("Undefined")); - DEFINE_TEST_VALUE(engine->evaluate("Null")); - DEFINE_TEST_VALUE(engine->evaluate("True")); - DEFINE_TEST_VALUE(engine->evaluate("False")); - DEFINE_TEST_VALUE(engine->evaluate("undefined")); - DEFINE_TEST_VALUE(engine->evaluate("null")); - DEFINE_TEST_VALUE(engine->evaluate("true")); - DEFINE_TEST_VALUE(engine->evaluate("false")); - DEFINE_TEST_VALUE(engine->evaluate("122")); - DEFINE_TEST_VALUE(engine->evaluate("124")); - DEFINE_TEST_VALUE(engine->evaluate("0")); - DEFINE_TEST_VALUE(engine->evaluate("0.0")); - DEFINE_TEST_VALUE(engine->evaluate("123.0")); - DEFINE_TEST_VALUE(engine->evaluate("6.37e-8")); - DEFINE_TEST_VALUE(engine->evaluate("-6.37e-8")); - DEFINE_TEST_VALUE(engine->evaluate("0x43211234")); - DEFINE_TEST_VALUE(engine->evaluate("0x10000")); - DEFINE_TEST_VALUE(engine->evaluate("0x10001")); - DEFINE_TEST_VALUE(engine->evaluate("NaN")); - DEFINE_TEST_VALUE(engine->evaluate("Infinity")); - DEFINE_TEST_VALUE(engine->evaluate("-Infinity")); - DEFINE_TEST_VALUE(engine->evaluate("'ciao'")); - DEFINE_TEST_VALUE(engine->evaluate("''")); - DEFINE_TEST_VALUE(engine->evaluate("'0'")); - DEFINE_TEST_VALUE(engine->evaluate("'123'")); - DEFINE_TEST_VALUE(engine->evaluate("'12.4'")); - DEFINE_TEST_VALUE(engine->nullValue()); - DEFINE_TEST_VALUE(engine->undefinedValue()); - DEFINE_TEST_VALUE(engine->newObject()); - DEFINE_TEST_VALUE(engine->newArray()); - DEFINE_TEST_VALUE(engine->newArray(10)); - DEFINE_TEST_VALUE(engine->newDate(QDateTime())); - DEFINE_TEST_VALUE(engine->newQMetaObject(&QObject::staticMetaObject)); - DEFINE_TEST_VALUE(engine->newVariant(QVariant())); - DEFINE_TEST_VALUE(engine->newVariant(QVariant(123))); - DEFINE_TEST_VALUE(engine->newVariant(QVariant(false))); - DEFINE_TEST_VALUE(engine->newQObject(0)); - DEFINE_TEST_VALUE(engine->newQObject(engine)); -} - - -void tst_QScriptValue::isValid_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isValid_makeData(const char* expr) -{ - static QSet isValid; - if (isValid.isEmpty()) { - isValid << "QScriptValue(QScriptValue::UndefinedValue)" - << "QScriptValue(QScriptValue::NullValue)" - << "QScriptValue(true)" - << "QScriptValue(false)" - << "QScriptValue(int(122))" - << "QScriptValue(uint(124))" - << "QScriptValue(0)" - << "QScriptValue(0.0)" - << "QScriptValue(123.0)" - << "QScriptValue(6.37e-8)" - << "QScriptValue(-6.37e-8)" - << "QScriptValue(0x43211234)" - << "QScriptValue(0x10000)" - << "QScriptValue(0x10001)" - << "QScriptValue(qSNaN())" - << "QScriptValue(qQNaN())" - << "QScriptValue(qInf())" - << "QScriptValue(-qInf())" - << "QScriptValue(\"NaN\")" - << "QScriptValue(\"Infinity\")" - << "QScriptValue(\"-Infinity\")" - << "QScriptValue(\"ciao\")" - << "QScriptValue(QString::fromLatin1(\"ciao\"))" - << "QScriptValue(QString(\"\"))" - << "QScriptValue(QString())" - << "QScriptValue(QString(\"0\"))" - << "QScriptValue(QString(\"123\"))" - << "QScriptValue(QString(\"12.4\"))" - << "QScriptValue(0, QScriptValue::UndefinedValue)" - << "QScriptValue(0, QScriptValue::NullValue)" - << "QScriptValue(0, true)" - << "QScriptValue(0, false)" - << "QScriptValue(0, int(122))" - << "QScriptValue(0, uint(124))" - << "QScriptValue(0, 0)" - << "QScriptValue(0, 0.0)" - << "QScriptValue(0, 123.0)" - << "QScriptValue(0, 6.37e-8)" - << "QScriptValue(0, -6.37e-8)" - << "QScriptValue(0, 0x43211234)" - << "QScriptValue(0, 0x10000)" - << "QScriptValue(0, 0x10001)" - << "QScriptValue(0, qSNaN())" - << "QScriptValue(0, qQNaN())" - << "QScriptValue(0, qInf())" - << "QScriptValue(0, -qInf())" - << "QScriptValue(0, \"NaN\")" - << "QScriptValue(0, \"Infinity\")" - << "QScriptValue(0, \"-Infinity\")" - << "QScriptValue(0, \"ciao\")" - << "QScriptValue(0, QString::fromLatin1(\"ciao\"))" - << "QScriptValue(0, QString(\"\"))" - << "QScriptValue(0, QString())" - << "QScriptValue(0, QString(\"0\"))" - << "QScriptValue(0, QString(\"123\"))" - << "QScriptValue(0, QString(\"12.3\"))" - << "QScriptValue(engine, QScriptValue::UndefinedValue)" - << "QScriptValue(engine, QScriptValue::NullValue)" - << "QScriptValue(engine, true)" - << "QScriptValue(engine, false)" - << "QScriptValue(engine, int(122))" - << "QScriptValue(engine, uint(124))" - << "QScriptValue(engine, 0)" - << "QScriptValue(engine, 0.0)" - << "QScriptValue(engine, 123.0)" - << "QScriptValue(engine, 6.37e-8)" - << "QScriptValue(engine, -6.37e-8)" - << "QScriptValue(engine, 0x43211234)" - << "QScriptValue(engine, 0x10000)" - << "QScriptValue(engine, 0x10001)" - << "QScriptValue(engine, qSNaN())" - << "QScriptValue(engine, qQNaN())" - << "QScriptValue(engine, qInf())" - << "QScriptValue(engine, -qInf())" - << "QScriptValue(engine, \"NaN\")" - << "QScriptValue(engine, \"Infinity\")" - << "QScriptValue(engine, \"-Infinity\")" - << "QScriptValue(engine, \"ciao\")" - << "QScriptValue(engine, QString::fromLatin1(\"ciao\"))" - << "QScriptValue(engine, QString(\"\"))" - << "QScriptValue(engine, QString())" - << "QScriptValue(engine, QString(\"0\"))" - << "QScriptValue(engine, QString(\"123\"))" - << "QScriptValue(engine, QString(\"1.23\"))" - << "engine->evaluate(\"[]\")" - << "engine->evaluate(\"{}\")" - << "engine->evaluate(\"Object.prototype\")" - << "engine->evaluate(\"Date.prototype\")" - << "engine->evaluate(\"Array.prototype\")" - << "engine->evaluate(\"Function.prototype\")" - << "engine->evaluate(\"Error.prototype\")" - << "engine->evaluate(\"Object\")" - << "engine->evaluate(\"Array\")" - << "engine->evaluate(\"Number\")" - << "engine->evaluate(\"Function\")" - << "engine->evaluate(\"(function() { return 1; })\")" - << "engine->evaluate(\"(function() { return 'ciao'; })\")" - << "engine->evaluate(\"(function() { throw new Error('foo'); })\")" - << "engine->evaluate(\"/foo/\")" - << "engine->evaluate(\"new Object()\")" - << "engine->evaluate(\"new Array()\")" - << "engine->evaluate(\"new Error()\")" - << "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")" - << "engine->evaluate(\"Undefined\")" - << "engine->evaluate(\"Null\")" - << "engine->evaluate(\"True\")" - << "engine->evaluate(\"False\")" - << "engine->evaluate(\"undefined\")" - << "engine->evaluate(\"null\")" - << "engine->evaluate(\"true\")" - << "engine->evaluate(\"false\")" - << "engine->evaluate(\"122\")" - << "engine->evaluate(\"124\")" - << "engine->evaluate(\"0\")" - << "engine->evaluate(\"0.0\")" - << "engine->evaluate(\"123.0\")" - << "engine->evaluate(\"6.37e-8\")" - << "engine->evaluate(\"-6.37e-8\")" - << "engine->evaluate(\"0x43211234\")" - << "engine->evaluate(\"0x10000\")" - << "engine->evaluate(\"0x10001\")" - << "engine->evaluate(\"NaN\")" - << "engine->evaluate(\"Infinity\")" - << "engine->evaluate(\"-Infinity\")" - << "engine->evaluate(\"'ciao'\")" - << "engine->evaluate(\"''\")" - << "engine->evaluate(\"'0'\")" - << "engine->evaluate(\"'123'\")" - << "engine->evaluate(\"'12.4'\")" - << "engine->nullValue()" - << "engine->undefinedValue()" - << "engine->newObject()" - << "engine->newArray()" - << "engine->newArray(10)" - << "engine->newDate(QDateTime())" - << "engine->newQMetaObject(&QObject::staticMetaObject)" - << "engine->newVariant(QVariant())" - << "engine->newVariant(QVariant(123))" - << "engine->newVariant(QVariant(false))" - << "engine->newQObject(0)" - << "engine->newQObject(engine)" - ; - } - newRow(expr) << isValid.contains(expr); -} - -void tst_QScriptValue::isValid_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isValid(), expected); - QCOMPARE(value.isValid(), expected); -} - -DEFINE_TEST_FUNCTION(isValid) - - -void tst_QScriptValue::isBool_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isBool_makeData(const char* expr) -{ - static QSet isBool; - if (isBool.isEmpty()) { - isBool << "QScriptValue(true)" - << "QScriptValue(false)" - << "QScriptValue(0, true)" - << "QScriptValue(0, false)" - << "QScriptValue(engine, true)" - << "QScriptValue(engine, false)" - << "engine->evaluate(\"true\")" - << "engine->evaluate(\"false\")" - ; - } - newRow(expr) << isBool.contains(expr); -} - -void tst_QScriptValue::isBool_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isBool(), expected); - QCOMPARE(value.isBool(), expected); -} - -DEFINE_TEST_FUNCTION(isBool) - - -void tst_QScriptValue::isBoolean_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isBoolean_makeData(const char* expr) -{ - static QSet isBoolean; - if (isBoolean.isEmpty()) { - isBoolean << "QScriptValue(true)" - << "QScriptValue(false)" - << "QScriptValue(0, true)" - << "QScriptValue(0, false)" - << "QScriptValue(engine, true)" - << "QScriptValue(engine, false)" - << "engine->evaluate(\"true\")" - << "engine->evaluate(\"false\")" - ; - } - newRow(expr) << isBoolean.contains(expr); -} - -void tst_QScriptValue::isBoolean_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isBoolean(), expected); - QCOMPARE(value.isBoolean(), expected); -} - -DEFINE_TEST_FUNCTION(isBoolean) - - -void tst_QScriptValue::isNumber_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isNumber_makeData(const char* expr) -{ - static QSet isNumber; - if (isNumber.isEmpty()) { - isNumber << "QScriptValue(int(122))" - << "QScriptValue(uint(124))" - << "QScriptValue(0)" - << "QScriptValue(0.0)" - << "QScriptValue(123.0)" - << "QScriptValue(6.37e-8)" - << "QScriptValue(-6.37e-8)" - << "QScriptValue(0x43211234)" - << "QScriptValue(0x10000)" - << "QScriptValue(0x10001)" - << "QScriptValue(qSNaN())" - << "QScriptValue(qQNaN())" - << "QScriptValue(qInf())" - << "QScriptValue(-qInf())" - << "QScriptValue(0, int(122))" - << "QScriptValue(0, uint(124))" - << "QScriptValue(0, 0)" - << "QScriptValue(0, 0.0)" - << "QScriptValue(0, 123.0)" - << "QScriptValue(0, 6.37e-8)" - << "QScriptValue(0, -6.37e-8)" - << "QScriptValue(0, 0x43211234)" - << "QScriptValue(0, 0x10000)" - << "QScriptValue(0, 0x10001)" - << "QScriptValue(0, qSNaN())" - << "QScriptValue(0, qQNaN())" - << "QScriptValue(0, qInf())" - << "QScriptValue(0, -qInf())" - << "QScriptValue(engine, int(122))" - << "QScriptValue(engine, uint(124))" - << "QScriptValue(engine, 0)" - << "QScriptValue(engine, 0.0)" - << "QScriptValue(engine, 123.0)" - << "QScriptValue(engine, 6.37e-8)" - << "QScriptValue(engine, -6.37e-8)" - << "QScriptValue(engine, 0x43211234)" - << "QScriptValue(engine, 0x10000)" - << "QScriptValue(engine, 0x10001)" - << "QScriptValue(engine, qSNaN())" - << "QScriptValue(engine, qQNaN())" - << "QScriptValue(engine, qInf())" - << "QScriptValue(engine, -qInf())" - << "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")" - << "engine->evaluate(\"122\")" - << "engine->evaluate(\"124\")" - << "engine->evaluate(\"0\")" - << "engine->evaluate(\"0.0\")" - << "engine->evaluate(\"123.0\")" - << "engine->evaluate(\"6.37e-8\")" - << "engine->evaluate(\"-6.37e-8\")" - << "engine->evaluate(\"0x43211234\")" - << "engine->evaluate(\"0x10000\")" - << "engine->evaluate(\"0x10001\")" - << "engine->evaluate(\"NaN\")" - << "engine->evaluate(\"Infinity\")" - << "engine->evaluate(\"-Infinity\")" - ; - } - newRow(expr) << isNumber.contains(expr); -} - -void tst_QScriptValue::isNumber_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isNumber(), expected); - QCOMPARE(value.isNumber(), expected); -} - -DEFINE_TEST_FUNCTION(isNumber) - - -void tst_QScriptValue::isFunction_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isFunction_makeData(const char* expr) -{ - static QSet isFunction; - if (isFunction.isEmpty()) { - isFunction << "engine->evaluate(\"Function.prototype\")" - << "engine->evaluate(\"Object\")" - << "engine->evaluate(\"Array\")" - << "engine->evaluate(\"Number\")" - << "engine->evaluate(\"Function\")" - << "engine->evaluate(\"(function() { return 1; })\")" - << "engine->evaluate(\"(function() { return 'ciao'; })\")" - << "engine->evaluate(\"(function() { throw new Error('foo'); })\")" - << "engine->evaluate(\"/foo/\")" - << "engine->newQMetaObject(&QObject::staticMetaObject)" - ; - } - newRow(expr) << isFunction.contains(expr); -} - -void tst_QScriptValue::isFunction_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isFunction(), expected); - QCOMPARE(value.isFunction(), expected); -} - -DEFINE_TEST_FUNCTION(isFunction) - - -void tst_QScriptValue::isNull_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isNull_makeData(const char* expr) -{ - static QSet isNull; - if (isNull.isEmpty()) { - isNull << "QScriptValue(QScriptValue::NullValue)" - << "QScriptValue(0, QScriptValue::NullValue)" - << "QScriptValue(engine, QScriptValue::NullValue)" - << "engine->evaluate(\"null\")" - << "engine->nullValue()" - << "engine->newQObject(0)" - ; - } - newRow(expr) << isNull.contains(expr); -} - -void tst_QScriptValue::isNull_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isNull(), expected); - QCOMPARE(value.isNull(), expected); -} - -DEFINE_TEST_FUNCTION(isNull) - - -void tst_QScriptValue::isString_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isString_makeData(const char* expr) -{ - static QSet isString; - if (isString.isEmpty()) { - isString << "QScriptValue(\"NaN\")" - << "QScriptValue(\"Infinity\")" - << "QScriptValue(\"-Infinity\")" - << "QScriptValue(\"ciao\")" - << "QScriptValue(QString::fromLatin1(\"ciao\"))" - << "QScriptValue(QString(\"\"))" - << "QScriptValue(QString())" - << "QScriptValue(QString(\"0\"))" - << "QScriptValue(QString(\"123\"))" - << "QScriptValue(QString(\"12.4\"))" - << "QScriptValue(0, \"NaN\")" - << "QScriptValue(0, \"Infinity\")" - << "QScriptValue(0, \"-Infinity\")" - << "QScriptValue(0, \"ciao\")" - << "QScriptValue(0, QString::fromLatin1(\"ciao\"))" - << "QScriptValue(0, QString(\"\"))" - << "QScriptValue(0, QString())" - << "QScriptValue(0, QString(\"0\"))" - << "QScriptValue(0, QString(\"123\"))" - << "QScriptValue(0, QString(\"12.3\"))" - << "QScriptValue(engine, \"NaN\")" - << "QScriptValue(engine, \"Infinity\")" - << "QScriptValue(engine, \"-Infinity\")" - << "QScriptValue(engine, \"ciao\")" - << "QScriptValue(engine, QString::fromLatin1(\"ciao\"))" - << "QScriptValue(engine, QString(\"\"))" - << "QScriptValue(engine, QString())" - << "QScriptValue(engine, QString(\"0\"))" - << "QScriptValue(engine, QString(\"123\"))" - << "QScriptValue(engine, QString(\"1.23\"))" - << "engine->evaluate(\"'ciao'\")" - << "engine->evaluate(\"''\")" - << "engine->evaluate(\"'0'\")" - << "engine->evaluate(\"'123'\")" - << "engine->evaluate(\"'12.4'\")" - ; - } - newRow(expr) << isString.contains(expr); -} - -void tst_QScriptValue::isString_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isString(), expected); - QCOMPARE(value.isString(), expected); -} - -DEFINE_TEST_FUNCTION(isString) - - -void tst_QScriptValue::isUndefined_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isUndefined_makeData(const char* expr) -{ - static QSet isUndefined; - if (isUndefined.isEmpty()) { - isUndefined << "QScriptValue(QScriptValue::UndefinedValue)" - << "QScriptValue(0, QScriptValue::UndefinedValue)" - << "QScriptValue(engine, QScriptValue::UndefinedValue)" - << "engine->evaluate(\"{}\")" - << "engine->evaluate(\"undefined\")" - << "engine->undefinedValue()" - ; - } - newRow(expr) << isUndefined.contains(expr); -} - -void tst_QScriptValue::isUndefined_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isUndefined(), expected); - QCOMPARE(value.isUndefined(), expected); -} - -DEFINE_TEST_FUNCTION(isUndefined) - - -void tst_QScriptValue::isVariant_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isVariant_makeData(const char* expr) -{ - static QSet isVariant; - if (isVariant.isEmpty()) { - isVariant << "engine->newVariant(QVariant())" - << "engine->newVariant(QVariant(123))" - << "engine->newVariant(QVariant(false))" - ; - } - newRow(expr) << isVariant.contains(expr); -} - -void tst_QScriptValue::isVariant_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isVariant(), expected); - QCOMPARE(value.isVariant(), expected); -} - -DEFINE_TEST_FUNCTION(isVariant) - - -void tst_QScriptValue::isQObject_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isQObject_makeData(const char* expr) -{ - static QSet isQObject; - if (isQObject.isEmpty()) { - isQObject << "engine->newQObject(engine)" - ; - } - newRow(expr) << isQObject.contains(expr); -} - -void tst_QScriptValue::isQObject_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isQObject(), expected); - QCOMPARE(value.isQObject(), expected); -} - -DEFINE_TEST_FUNCTION(isQObject) - - -void tst_QScriptValue::isQMetaObject_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isQMetaObject_makeData(const char* expr) -{ - static QSet isQMetaObject; - if (isQMetaObject.isEmpty()) { - isQMetaObject << "engine->newQMetaObject(&QObject::staticMetaObject)" - ; - } - newRow(expr) << isQMetaObject.contains(expr); -} - -void tst_QScriptValue::isQMetaObject_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isQMetaObject(), expected); - QCOMPARE(value.isQMetaObject(), expected); -} - -DEFINE_TEST_FUNCTION(isQMetaObject) - - -void tst_QScriptValue::isObject_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isObject_makeData(const char* expr) -{ - static QSet isObject; - if (isObject.isEmpty()) { - isObject << "engine->evaluate(\"[]\")" - << "engine->evaluate(\"Object.prototype\")" - << "engine->evaluate(\"Date.prototype\")" - << "engine->evaluate(\"Array.prototype\")" - << "engine->evaluate(\"Function.prototype\")" - << "engine->evaluate(\"Error.prototype\")" - << "engine->evaluate(\"Object\")" - << "engine->evaluate(\"Array\")" - << "engine->evaluate(\"Number\")" - << "engine->evaluate(\"Function\")" - << "engine->evaluate(\"(function() { return 1; })\")" - << "engine->evaluate(\"(function() { return 'ciao'; })\")" - << "engine->evaluate(\"(function() { throw new Error('foo'); })\")" - << "engine->evaluate(\"/foo/\")" - << "engine->evaluate(\"new Object()\")" - << "engine->evaluate(\"new Array()\")" - << "engine->evaluate(\"new Error()\")" - << "engine->evaluate(\"Undefined\")" - << "engine->evaluate(\"Null\")" - << "engine->evaluate(\"True\")" - << "engine->evaluate(\"False\")" - << "engine->newObject()" - << "engine->newArray()" - << "engine->newArray(10)" - << "engine->newDate(QDateTime())" - << "engine->newQMetaObject(&QObject::staticMetaObject)" - << "engine->newVariant(QVariant())" - << "engine->newVariant(QVariant(123))" - << "engine->newVariant(QVariant(false))" - << "engine->newQObject(engine)" - ; - } - newRow(expr) << isObject.contains(expr); -} - -void tst_QScriptValue::isObject_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isObject(), expected); - QCOMPARE(value.isObject(), expected); -} - -DEFINE_TEST_FUNCTION(isObject) - - -void tst_QScriptValue::isDate_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isDate_makeData(const char* expr) -{ - static QSet isDate; - if (isDate.isEmpty()) { - isDate << "engine->evaluate(\"Date.prototype\")" - << "engine->newDate(QDateTime())" - ; - } - newRow(expr) << isDate.contains(expr); -} - -void tst_QScriptValue::isDate_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isDate(), expected); - QCOMPARE(value.isDate(), expected); -} - -DEFINE_TEST_FUNCTION(isDate) - - -void tst_QScriptValue::isRegExp_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isRegExp_makeData(const char* expr) -{ - static QSet isRegExp; - if (isRegExp.isEmpty()) { - isRegExp << "engine->evaluate(\"/foo/\")" - ; - } - newRow(expr) << isRegExp.contains(expr); -} - -void tst_QScriptValue::isRegExp_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isRegExp(), expected); - QCOMPARE(value.isRegExp(), expected); -} - -DEFINE_TEST_FUNCTION(isRegExp) - - -void tst_QScriptValue::isArray_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isArray_makeData(const char* expr) -{ - static QSet isArray; - if (isArray.isEmpty()) { - isArray << "engine->evaluate(\"[]\")" - << "engine->evaluate(\"Array.prototype\")" - << "engine->evaluate(\"new Array()\")" - << "engine->newArray()" - << "engine->newArray(10)" - ; - } - newRow(expr) << isArray.contains(expr); -} - -void tst_QScriptValue::isArray_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isArray(), expected); - QCOMPARE(value.isArray(), expected); -} - -DEFINE_TEST_FUNCTION(isArray) - - -void tst_QScriptValue::isError_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::isError_makeData(const char* expr) -{ - static QSet isError; - if (isError.isEmpty()) { - isError << "engine->evaluate(\"Error.prototype\")" - << "engine->evaluate(\"new Error()\")" - << "engine->evaluate(\"Undefined\")" - << "engine->evaluate(\"Null\")" - << "engine->evaluate(\"True\")" - << "engine->evaluate(\"False\")" - ; - } - newRow(expr) << isError.contains(expr); -} - -void tst_QScriptValue::isError_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.isError(), expected); - QCOMPARE(value.isError(), expected); -} - -DEFINE_TEST_FUNCTION(isError) - - - -void tst_QScriptValue::toString_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toString_makeData(const char* expr) -{ - static QHash toString; - if (toString.isEmpty()) { - toString.insert("QScriptValue()", ""); - toString.insert("QScriptValue(QScriptValue::UndefinedValue)", "undefined"); - toString.insert("QScriptValue(QScriptValue::NullValue)", "null"); - toString.insert("QScriptValue(true)", "true"); - toString.insert("QScriptValue(false)", "false"); - toString.insert("QScriptValue(int(122))", "122"); - toString.insert("QScriptValue(uint(124))", "124"); - toString.insert("QScriptValue(0)", "0"); - toString.insert("QScriptValue(0.0)", "0"); - toString.insert("QScriptValue(123.0)", "123"); - toString.insert("QScriptValue(6.37e-8)", "6.37e-8"); - toString.insert("QScriptValue(-6.37e-8)", "-6.37e-8"); - toString.insert("QScriptValue(0x43211234)", "1126240820"); - toString.insert("QScriptValue(0x10000)", "65536"); - toString.insert("QScriptValue(0x10001)", "65537"); - toString.insert("QScriptValue(qSNaN())", "NaN"); - toString.insert("QScriptValue(qQNaN())", "NaN"); - toString.insert("QScriptValue(qInf())", "Infinity"); - toString.insert("QScriptValue(-qInf())", "-Infinity"); - toString.insert("QScriptValue(\"NaN\")", "NaN"); - toString.insert("QScriptValue(\"Infinity\")", "Infinity"); - toString.insert("QScriptValue(\"-Infinity\")", "-Infinity"); - toString.insert("QScriptValue(\"ciao\")", "ciao"); - toString.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", "ciao"); - toString.insert("QScriptValue(QString(\"\"))", ""); - toString.insert("QScriptValue(QString())", ""); - toString.insert("QScriptValue(QString(\"0\"))", "0"); - toString.insert("QScriptValue(QString(\"123\"))", "123"); - toString.insert("QScriptValue(QString(\"12.4\"))", "12.4"); - toString.insert("QScriptValue(0, QScriptValue::UndefinedValue)", "undefined"); - toString.insert("QScriptValue(0, QScriptValue::NullValue)", "null"); - toString.insert("QScriptValue(0, true)", "true"); - toString.insert("QScriptValue(0, false)", "false"); - toString.insert("QScriptValue(0, int(122))", "122"); - toString.insert("QScriptValue(0, uint(124))", "124"); - toString.insert("QScriptValue(0, 0)", "0"); - toString.insert("QScriptValue(0, 0.0)", "0"); - toString.insert("QScriptValue(0, 123.0)", "123"); - toString.insert("QScriptValue(0, 6.37e-8)", "6.37e-8"); - toString.insert("QScriptValue(0, -6.37e-8)", "-6.37e-8"); - toString.insert("QScriptValue(0, 0x43211234)", "1126240820"); - toString.insert("QScriptValue(0, 0x10000)", "65536"); - toString.insert("QScriptValue(0, 0x10001)", "65537"); - toString.insert("QScriptValue(0, qSNaN())", "NaN"); - toString.insert("QScriptValue(0, qQNaN())", "NaN"); - toString.insert("QScriptValue(0, qInf())", "Infinity"); - toString.insert("QScriptValue(0, -qInf())", "-Infinity"); - toString.insert("QScriptValue(0, \"NaN\")", "NaN"); - toString.insert("QScriptValue(0, \"Infinity\")", "Infinity"); - toString.insert("QScriptValue(0, \"-Infinity\")", "-Infinity"); - toString.insert("QScriptValue(0, \"ciao\")", "ciao"); - toString.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", "ciao"); - toString.insert("QScriptValue(0, QString(\"\"))", ""); - toString.insert("QScriptValue(0, QString())", ""); - toString.insert("QScriptValue(0, QString(\"0\"))", "0"); - toString.insert("QScriptValue(0, QString(\"123\"))", "123"); - toString.insert("QScriptValue(0, QString(\"12.3\"))", "12.3"); - toString.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", "undefined"); - toString.insert("QScriptValue(engine, QScriptValue::NullValue)", "null"); - toString.insert("QScriptValue(engine, true)", "true"); - toString.insert("QScriptValue(engine, false)", "false"); - toString.insert("QScriptValue(engine, int(122))", "122"); - toString.insert("QScriptValue(engine, uint(124))", "124"); - toString.insert("QScriptValue(engine, 0)", "0"); - toString.insert("QScriptValue(engine, 0.0)", "0"); - toString.insert("QScriptValue(engine, 123.0)", "123"); - toString.insert("QScriptValue(engine, 6.37e-8)", "6.37e-8"); - toString.insert("QScriptValue(engine, -6.37e-8)", "-6.37e-8"); - toString.insert("QScriptValue(engine, 0x43211234)", "1126240820"); - toString.insert("QScriptValue(engine, 0x10000)", "65536"); - toString.insert("QScriptValue(engine, 0x10001)", "65537"); - toString.insert("QScriptValue(engine, qSNaN())", "NaN"); - toString.insert("QScriptValue(engine, qQNaN())", "NaN"); - toString.insert("QScriptValue(engine, qInf())", "Infinity"); - toString.insert("QScriptValue(engine, -qInf())", "-Infinity"); - toString.insert("QScriptValue(engine, \"NaN\")", "NaN"); - toString.insert("QScriptValue(engine, \"Infinity\")", "Infinity"); - toString.insert("QScriptValue(engine, \"-Infinity\")", "-Infinity"); - toString.insert("QScriptValue(engine, \"ciao\")", "ciao"); - toString.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", "ciao"); - toString.insert("QScriptValue(engine, QString(\"\"))", ""); - toString.insert("QScriptValue(engine, QString())", ""); - toString.insert("QScriptValue(engine, QString(\"0\"))", "0"); - toString.insert("QScriptValue(engine, QString(\"123\"))", "123"); - toString.insert("QScriptValue(engine, QString(\"1.23\"))", "1.23"); - toString.insert("engine->evaluate(\"[]\")", ""); - toString.insert("engine->evaluate(\"{}\")", "undefined"); - toString.insert("engine->evaluate(\"Object.prototype\")", "[object Object]"); - toString.insert("engine->evaluate(\"Date.prototype\")", "Invalid Date"); - toString.insert("engine->evaluate(\"Array.prototype\")", ""); - toString.insert("engine->evaluate(\"Function.prototype\")", "function () {\n [native code]\n}"); - toString.insert("engine->evaluate(\"Error.prototype\")", "Error: Unknown error"); - toString.insert("engine->evaluate(\"Object\")", "function Object() {\n [native code]\n}"); - toString.insert("engine->evaluate(\"Array\")", "function Array() {\n [native code]\n}"); - toString.insert("engine->evaluate(\"Number\")", "function Number() {\n [native code]\n}"); - toString.insert("engine->evaluate(\"Function\")", "function Function() {\n [native code]\n}"); - toString.insert("engine->evaluate(\"(function() { return 1; })\")", "function () { return 1; }"); - toString.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", "function () { return 'ciao'; }"); - toString.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", "function () { throw new Error('foo'); }"); - toString.insert("engine->evaluate(\"/foo/\")", "/foo/"); - toString.insert("engine->evaluate(\"new Object()\")", "[object Object]"); - toString.insert("engine->evaluate(\"new Array()\")", ""); - toString.insert("engine->evaluate(\"new Error()\")", "Error: Unknown error"); - toString.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", "22"); - toString.insert("engine->evaluate(\"Undefined\")", "ReferenceError: Can't find variable: Undefined"); - toString.insert("engine->evaluate(\"Null\")", "ReferenceError: Can't find variable: Null"); - toString.insert("engine->evaluate(\"True\")", "ReferenceError: Can't find variable: True"); - toString.insert("engine->evaluate(\"False\")", "ReferenceError: Can't find variable: False"); - toString.insert("engine->evaluate(\"undefined\")", "undefined"); - toString.insert("engine->evaluate(\"null\")", "null"); - toString.insert("engine->evaluate(\"true\")", "true"); - toString.insert("engine->evaluate(\"false\")", "false"); - toString.insert("engine->evaluate(\"122\")", "122"); - toString.insert("engine->evaluate(\"124\")", "124"); - toString.insert("engine->evaluate(\"0\")", "0"); - toString.insert("engine->evaluate(\"0.0\")", "0"); - toString.insert("engine->evaluate(\"123.0\")", "123"); - toString.insert("engine->evaluate(\"6.37e-8\")", "6.37e-8"); - toString.insert("engine->evaluate(\"-6.37e-8\")", "-6.37e-8"); - toString.insert("engine->evaluate(\"0x43211234\")", "1126240820"); - toString.insert("engine->evaluate(\"0x10000\")", "65536"); - toString.insert("engine->evaluate(\"0x10001\")", "65537"); - toString.insert("engine->evaluate(\"NaN\")", "NaN"); - toString.insert("engine->evaluate(\"Infinity\")", "Infinity"); - toString.insert("engine->evaluate(\"-Infinity\")", "-Infinity"); - toString.insert("engine->evaluate(\"'ciao'\")", "ciao"); - toString.insert("engine->evaluate(\"''\")", ""); - toString.insert("engine->evaluate(\"'0'\")", "0"); - toString.insert("engine->evaluate(\"'123'\")", "123"); - toString.insert("engine->evaluate(\"'12.4'\")", "12.4"); - toString.insert("engine->nullValue()", "null"); - toString.insert("engine->undefinedValue()", "undefined"); - toString.insert("engine->newObject()", "[object Object]"); - toString.insert("engine->newArray()", ""); - toString.insert("engine->newArray(10)", ",,,,,,,,,"); - toString.insert("engine->newDate(QDateTime())", "Invalid Date"); - toString.insert("engine->newQMetaObject(&QObject::staticMetaObject)", "[object QMetaObject]"); - toString.insert("engine->newVariant(QVariant())", "undefined"); - toString.insert("engine->newVariant(QVariant(123))", "123"); - toString.insert("engine->newVariant(QVariant(false))", "false"); - toString.insert("engine->newQObject(0)", "null"); - toString.insert("engine->newQObject(engine)", "QScriptEngine(name = \"\")"); - } - newRow(expr) << toString.value(expr); -} - -void tst_QScriptValue::toString_test(const char*, const QScriptValue& value) -{ - QFETCH(QString, expected); - QCOMPARE(value.toString(), expected); - QCOMPARE(value.toString(), expected); -} - -DEFINE_TEST_FUNCTION(toString) - - -void tst_QScriptValue::toNumber_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toNumber_makeData(const char* expr) -{ - static QHash toNumber; - if (toNumber.isEmpty()) { - toNumber.insert("QScriptValue()", 0); - toNumber.insert("QScriptValue(QScriptValue::UndefinedValue)", qQNaN()); - toNumber.insert("QScriptValue(QScriptValue::NullValue)", 0); - toNumber.insert("QScriptValue(true)", 1); - toNumber.insert("QScriptValue(false)", 0); - toNumber.insert("QScriptValue(int(122))", 122); - toNumber.insert("QScriptValue(uint(124))", 124); - toNumber.insert("QScriptValue(0)", 0); - toNumber.insert("QScriptValue(0.0)", 0); - toNumber.insert("QScriptValue(123.0)", 123); - toNumber.insert("QScriptValue(6.37e-8)", 6.369999999999999e-08); - toNumber.insert("QScriptValue(-6.37e-8)", -6.369999999999999e-08); - toNumber.insert("QScriptValue(0x43211234)", 1126240820); - toNumber.insert("QScriptValue(0x10000)", 65536); - toNumber.insert("QScriptValue(0x10001)", 65537); - toNumber.insert("QScriptValue(qSNaN())", qQNaN()); - toNumber.insert("QScriptValue(qQNaN())", qQNaN()); - toNumber.insert("QScriptValue(qInf())", qInf()); - toNumber.insert("QScriptValue(-qInf())", qInf()); - toNumber.insert("QScriptValue(\"NaN\")", qQNaN()); - toNumber.insert("QScriptValue(\"Infinity\")", qInf()); - toNumber.insert("QScriptValue(\"-Infinity\")", qInf()); - toNumber.insert("QScriptValue(\"ciao\")", qQNaN()); - toNumber.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", qQNaN()); - toNumber.insert("QScriptValue(QString(\"\"))", 0); - toNumber.insert("QScriptValue(QString())", 0); - toNumber.insert("QScriptValue(QString(\"0\"))", 0); - toNumber.insert("QScriptValue(QString(\"123\"))", 123); - toNumber.insert("QScriptValue(QString(\"12.4\"))", 12.4); - toNumber.insert("QScriptValue(0, QScriptValue::UndefinedValue)", qQNaN()); - toNumber.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - toNumber.insert("QScriptValue(0, true)", 1); - toNumber.insert("QScriptValue(0, false)", 0); - toNumber.insert("QScriptValue(0, int(122))", 122); - toNumber.insert("QScriptValue(0, uint(124))", 124); - toNumber.insert("QScriptValue(0, 0)", 0); - toNumber.insert("QScriptValue(0, 0.0)", 0); - toNumber.insert("QScriptValue(0, 123.0)", 123); - toNumber.insert("QScriptValue(0, 6.37e-8)", 6.369999999999999e-08); - toNumber.insert("QScriptValue(0, -6.37e-8)", -6.369999999999999e-08); - toNumber.insert("QScriptValue(0, 0x43211234)", 1126240820); - toNumber.insert("QScriptValue(0, 0x10000)", 65536); - toNumber.insert("QScriptValue(0, 0x10001)", 65537); - toNumber.insert("QScriptValue(0, qSNaN())", qQNaN()); - toNumber.insert("QScriptValue(0, qQNaN())", qQNaN()); - toNumber.insert("QScriptValue(0, qInf())", qInf()); - toNumber.insert("QScriptValue(0, -qInf())", qInf()); - toNumber.insert("QScriptValue(0, \"NaN\")", qQNaN()); - toNumber.insert("QScriptValue(0, \"Infinity\")", qInf()); - toNumber.insert("QScriptValue(0, \"-Infinity\")", qInf()); - toNumber.insert("QScriptValue(0, \"ciao\")", qQNaN()); - toNumber.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", qQNaN()); - toNumber.insert("QScriptValue(0, QString(\"\"))", 0); - toNumber.insert("QScriptValue(0, QString())", 0); - toNumber.insert("QScriptValue(0, QString(\"0\"))", 0); - toNumber.insert("QScriptValue(0, QString(\"123\"))", 123); - toNumber.insert("QScriptValue(0, QString(\"12.3\"))", 12.3); - toNumber.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", qQNaN()); - toNumber.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - toNumber.insert("QScriptValue(engine, true)", 1); - toNumber.insert("QScriptValue(engine, false)", 0); - toNumber.insert("QScriptValue(engine, int(122))", 122); - toNumber.insert("QScriptValue(engine, uint(124))", 124); - toNumber.insert("QScriptValue(engine, 0)", 0); - toNumber.insert("QScriptValue(engine, 0.0)", 0); - toNumber.insert("QScriptValue(engine, 123.0)", 123); - toNumber.insert("QScriptValue(engine, 6.37e-8)", 6.369999999999999e-08); - toNumber.insert("QScriptValue(engine, -6.37e-8)", -6.369999999999999e-08); - toNumber.insert("QScriptValue(engine, 0x43211234)", 1126240820); - toNumber.insert("QScriptValue(engine, 0x10000)", 65536); - toNumber.insert("QScriptValue(engine, 0x10001)", 65537); - toNumber.insert("QScriptValue(engine, qSNaN())", qQNaN()); - toNumber.insert("QScriptValue(engine, qQNaN())", qQNaN()); - toNumber.insert("QScriptValue(engine, qInf())", qInf()); - toNumber.insert("QScriptValue(engine, -qInf())", qInf()); - toNumber.insert("QScriptValue(engine, \"NaN\")", qQNaN()); - toNumber.insert("QScriptValue(engine, \"Infinity\")", qInf()); - toNumber.insert("QScriptValue(engine, \"-Infinity\")", qInf()); - toNumber.insert("QScriptValue(engine, \"ciao\")", qQNaN()); - toNumber.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", qQNaN()); - toNumber.insert("QScriptValue(engine, QString(\"\"))", 0); - toNumber.insert("QScriptValue(engine, QString())", 0); - toNumber.insert("QScriptValue(engine, QString(\"0\"))", 0); - toNumber.insert("QScriptValue(engine, QString(\"123\"))", 123); - toNumber.insert("QScriptValue(engine, QString(\"1.23\"))", 1.23); - toNumber.insert("engine->evaluate(\"[]\")", 0); - toNumber.insert("engine->evaluate(\"{}\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Object.prototype\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Date.prototype\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Array.prototype\")", 0); - toNumber.insert("engine->evaluate(\"Function.prototype\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Error.prototype\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Object\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Array\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Number\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Function\")", qQNaN()); - toNumber.insert("engine->evaluate(\"(function() { return 1; })\")", qQNaN()); - toNumber.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", qQNaN()); - toNumber.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", qQNaN()); - toNumber.insert("engine->evaluate(\"/foo/\")", qQNaN()); - toNumber.insert("engine->evaluate(\"new Object()\")", qQNaN()); - toNumber.insert("engine->evaluate(\"new Array()\")", 0); - toNumber.insert("engine->evaluate(\"new Error()\")", qQNaN()); - toNumber.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - toNumber.insert("engine->evaluate(\"Undefined\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Null\")", qQNaN()); - toNumber.insert("engine->evaluate(\"True\")", qQNaN()); - toNumber.insert("engine->evaluate(\"False\")", qQNaN()); - toNumber.insert("engine->evaluate(\"undefined\")", qQNaN()); - toNumber.insert("engine->evaluate(\"null\")", 0); - toNumber.insert("engine->evaluate(\"true\")", 1); - toNumber.insert("engine->evaluate(\"false\")", 0); - toNumber.insert("engine->evaluate(\"122\")", 122); - toNumber.insert("engine->evaluate(\"124\")", 124); - toNumber.insert("engine->evaluate(\"0\")", 0); - toNumber.insert("engine->evaluate(\"0.0\")", 0); - toNumber.insert("engine->evaluate(\"123.0\")", 123); - toNumber.insert("engine->evaluate(\"6.37e-8\")", 6.369999999999999e-08); - toNumber.insert("engine->evaluate(\"-6.37e-8\")", -6.369999999999999e-08); - toNumber.insert("engine->evaluate(\"0x43211234\")", 1126240820); - toNumber.insert("engine->evaluate(\"0x10000\")", 65536); - toNumber.insert("engine->evaluate(\"0x10001\")", 65537); - toNumber.insert("engine->evaluate(\"NaN\")", qQNaN()); - toNumber.insert("engine->evaluate(\"Infinity\")", qInf()); - toNumber.insert("engine->evaluate(\"-Infinity\")", qInf()); - toNumber.insert("engine->evaluate(\"'ciao'\")", qQNaN()); - toNumber.insert("engine->evaluate(\"''\")", 0); - toNumber.insert("engine->evaluate(\"'0'\")", 0); - toNumber.insert("engine->evaluate(\"'123'\")", 123); - toNumber.insert("engine->evaluate(\"'12.4'\")", 12.4); - toNumber.insert("engine->nullValue()", 0); - toNumber.insert("engine->undefinedValue()", qQNaN()); - toNumber.insert("engine->newObject()", qQNaN()); - toNumber.insert("engine->newArray()", 0); - toNumber.insert("engine->newArray(10)", qQNaN()); - toNumber.insert("engine->newDate(QDateTime())", qQNaN()); - toNumber.insert("engine->newQMetaObject(&QObject::staticMetaObject)", qQNaN()); - toNumber.insert("engine->newVariant(QVariant())", qQNaN()); - toNumber.insert("engine->newVariant(QVariant(123))", 123); - toNumber.insert("engine->newVariant(QVariant(false))", 0); - toNumber.insert("engine->newQObject(0)", 0); - toNumber.insert("engine->newQObject(engine)", qQNaN()); - } - newRow(expr) << toNumber.value(expr); -} - -void tst_QScriptValue::toNumber_test(const char*, const QScriptValue& value) -{ - QFETCH(qsreal, expected); - if (qIsNaN(expected)) { - QVERIFY(qIsNaN(value.toNumber())); - return; - } - if (qIsInf(expected)) { - QVERIFY(qIsInf(value.toNumber())); - QVERIFY(qIsInf(value.toNumber())); - return; - } - QCOMPARE(value.toNumber(), expected); - QCOMPARE(value.toNumber(), expected); -} - -DEFINE_TEST_FUNCTION(toNumber) - - -void tst_QScriptValue::toBool_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toBool_makeData(const char* expr) -{ - static QHash toBool; - if (toBool.isEmpty()) { - toBool.insert("QScriptValue()", false); - toBool.insert("QScriptValue(QScriptValue::UndefinedValue)", false); - toBool.insert("QScriptValue(QScriptValue::NullValue)", false); - toBool.insert("QScriptValue(true)", true); - toBool.insert("QScriptValue(false)", false); - toBool.insert("QScriptValue(int(122))", true); - toBool.insert("QScriptValue(uint(124))", true); - toBool.insert("QScriptValue(0)", false); - toBool.insert("QScriptValue(0.0)", false); - toBool.insert("QScriptValue(123.0)", true); - toBool.insert("QScriptValue(6.37e-8)", true); - toBool.insert("QScriptValue(-6.37e-8)", true); - toBool.insert("QScriptValue(0x43211234)", true); - toBool.insert("QScriptValue(0x10000)", true); - toBool.insert("QScriptValue(0x10001)", true); - toBool.insert("QScriptValue(qSNaN())", false); - toBool.insert("QScriptValue(qQNaN())", false); - toBool.insert("QScriptValue(qInf())", true); - toBool.insert("QScriptValue(-qInf())", true); - toBool.insert("QScriptValue(\"NaN\")", true); - toBool.insert("QScriptValue(\"Infinity\")", true); - toBool.insert("QScriptValue(\"-Infinity\")", true); - toBool.insert("QScriptValue(\"ciao\")", true); - toBool.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true); - toBool.insert("QScriptValue(QString(\"\"))", false); - toBool.insert("QScriptValue(QString())", false); - toBool.insert("QScriptValue(QString(\"0\"))", true); - toBool.insert("QScriptValue(QString(\"123\"))", true); - toBool.insert("QScriptValue(QString(\"12.4\"))", true); - toBool.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false); - toBool.insert("QScriptValue(0, QScriptValue::NullValue)", false); - toBool.insert("QScriptValue(0, true)", true); - toBool.insert("QScriptValue(0, false)", false); - toBool.insert("QScriptValue(0, int(122))", true); - toBool.insert("QScriptValue(0, uint(124))", true); - toBool.insert("QScriptValue(0, 0)", false); - toBool.insert("QScriptValue(0, 0.0)", false); - toBool.insert("QScriptValue(0, 123.0)", true); - toBool.insert("QScriptValue(0, 6.37e-8)", true); - toBool.insert("QScriptValue(0, -6.37e-8)", true); - toBool.insert("QScriptValue(0, 0x43211234)", true); - toBool.insert("QScriptValue(0, 0x10000)", true); - toBool.insert("QScriptValue(0, 0x10001)", true); - toBool.insert("QScriptValue(0, qSNaN())", false); - toBool.insert("QScriptValue(0, qQNaN())", false); - toBool.insert("QScriptValue(0, qInf())", true); - toBool.insert("QScriptValue(0, -qInf())", true); - toBool.insert("QScriptValue(0, \"NaN\")", true); - toBool.insert("QScriptValue(0, \"Infinity\")", true); - toBool.insert("QScriptValue(0, \"-Infinity\")", true); - toBool.insert("QScriptValue(0, \"ciao\")", true); - toBool.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true); - toBool.insert("QScriptValue(0, QString(\"\"))", false); - toBool.insert("QScriptValue(0, QString())", false); - toBool.insert("QScriptValue(0, QString(\"0\"))", true); - toBool.insert("QScriptValue(0, QString(\"123\"))", true); - toBool.insert("QScriptValue(0, QString(\"12.3\"))", true); - toBool.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false); - toBool.insert("QScriptValue(engine, QScriptValue::NullValue)", false); - toBool.insert("QScriptValue(engine, true)", true); - toBool.insert("QScriptValue(engine, false)", false); - toBool.insert("QScriptValue(engine, int(122))", true); - toBool.insert("QScriptValue(engine, uint(124))", true); - toBool.insert("QScriptValue(engine, 0)", false); - toBool.insert("QScriptValue(engine, 0.0)", false); - toBool.insert("QScriptValue(engine, 123.0)", true); - toBool.insert("QScriptValue(engine, 6.37e-8)", true); - toBool.insert("QScriptValue(engine, -6.37e-8)", true); - toBool.insert("QScriptValue(engine, 0x43211234)", true); - toBool.insert("QScriptValue(engine, 0x10000)", true); - toBool.insert("QScriptValue(engine, 0x10001)", true); - toBool.insert("QScriptValue(engine, qSNaN())", false); - toBool.insert("QScriptValue(engine, qQNaN())", false); - toBool.insert("QScriptValue(engine, qInf())", true); - toBool.insert("QScriptValue(engine, -qInf())", true); - toBool.insert("QScriptValue(engine, \"NaN\")", true); - toBool.insert("QScriptValue(engine, \"Infinity\")", true); - toBool.insert("QScriptValue(engine, \"-Infinity\")", true); - toBool.insert("QScriptValue(engine, \"ciao\")", true); - toBool.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true); - toBool.insert("QScriptValue(engine, QString(\"\"))", false); - toBool.insert("QScriptValue(engine, QString())", false); - toBool.insert("QScriptValue(engine, QString(\"0\"))", true); - toBool.insert("QScriptValue(engine, QString(\"123\"))", true); - toBool.insert("QScriptValue(engine, QString(\"1.23\"))", true); - toBool.insert("engine->evaluate(\"[]\")", true); - toBool.insert("engine->evaluate(\"{}\")", false); - toBool.insert("engine->evaluate(\"Object.prototype\")", true); - toBool.insert("engine->evaluate(\"Date.prototype\")", true); - toBool.insert("engine->evaluate(\"Array.prototype\")", true); - toBool.insert("engine->evaluate(\"Function.prototype\")", true); - toBool.insert("engine->evaluate(\"Error.prototype\")", true); - toBool.insert("engine->evaluate(\"Object\")", true); - toBool.insert("engine->evaluate(\"Array\")", true); - toBool.insert("engine->evaluate(\"Number\")", true); - toBool.insert("engine->evaluate(\"Function\")", true); - toBool.insert("engine->evaluate(\"(function() { return 1; })\")", true); - toBool.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true); - toBool.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true); - toBool.insert("engine->evaluate(\"/foo/\")", true); - toBool.insert("engine->evaluate(\"new Object()\")", true); - toBool.insert("engine->evaluate(\"new Array()\")", true); - toBool.insert("engine->evaluate(\"new Error()\")", true); - toBool.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", true); - toBool.insert("engine->evaluate(\"Undefined\")", true); - toBool.insert("engine->evaluate(\"Null\")", true); - toBool.insert("engine->evaluate(\"True\")", true); - toBool.insert("engine->evaluate(\"False\")", true); - toBool.insert("engine->evaluate(\"undefined\")", false); - toBool.insert("engine->evaluate(\"null\")", false); - toBool.insert("engine->evaluate(\"true\")", true); - toBool.insert("engine->evaluate(\"false\")", false); - toBool.insert("engine->evaluate(\"122\")", true); - toBool.insert("engine->evaluate(\"124\")", true); - toBool.insert("engine->evaluate(\"0\")", false); - toBool.insert("engine->evaluate(\"0.0\")", false); - toBool.insert("engine->evaluate(\"123.0\")", true); - toBool.insert("engine->evaluate(\"6.37e-8\")", true); - toBool.insert("engine->evaluate(\"-6.37e-8\")", true); - toBool.insert("engine->evaluate(\"0x43211234\")", true); - toBool.insert("engine->evaluate(\"0x10000\")", true); - toBool.insert("engine->evaluate(\"0x10001\")", true); - toBool.insert("engine->evaluate(\"NaN\")", false); - toBool.insert("engine->evaluate(\"Infinity\")", true); - toBool.insert("engine->evaluate(\"-Infinity\")", true); - toBool.insert("engine->evaluate(\"'ciao'\")", true); - toBool.insert("engine->evaluate(\"''\")", false); - toBool.insert("engine->evaluate(\"'0'\")", true); - toBool.insert("engine->evaluate(\"'123'\")", true); - toBool.insert("engine->evaluate(\"'12.4'\")", true); - toBool.insert("engine->nullValue()", false); - toBool.insert("engine->undefinedValue()", false); - toBool.insert("engine->newObject()", true); - toBool.insert("engine->newArray()", true); - toBool.insert("engine->newArray(10)", true); - toBool.insert("engine->newDate(QDateTime())", true); - toBool.insert("engine->newQMetaObject(&QObject::staticMetaObject)", true); - toBool.insert("engine->newVariant(QVariant())", true); - toBool.insert("engine->newVariant(QVariant(123))", true); - toBool.insert("engine->newVariant(QVariant(false))", true); - toBool.insert("engine->newQObject(0)", false); - toBool.insert("engine->newQObject(engine)", true); - } - newRow(expr) << toBool.value(expr); -} - -void tst_QScriptValue::toBool_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.toBool(), expected); - QCOMPARE(value.toBool(), expected); -} - -DEFINE_TEST_FUNCTION(toBool) - - -void tst_QScriptValue::toBoolean_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toBoolean_makeData(const char* expr) -{ - static QHash toBoolean; - if (toBoolean.isEmpty()) { - toBoolean.insert("QScriptValue()", false); - toBoolean.insert("QScriptValue(QScriptValue::UndefinedValue)", false); - toBoolean.insert("QScriptValue(QScriptValue::NullValue)", false); - toBoolean.insert("QScriptValue(true)", true); - toBoolean.insert("QScriptValue(false)", false); - toBoolean.insert("QScriptValue(int(122))", true); - toBoolean.insert("QScriptValue(uint(124))", true); - toBoolean.insert("QScriptValue(0)", false); - toBoolean.insert("QScriptValue(0.0)", false); - toBoolean.insert("QScriptValue(123.0)", true); - toBoolean.insert("QScriptValue(6.37e-8)", true); - toBoolean.insert("QScriptValue(-6.37e-8)", true); - toBoolean.insert("QScriptValue(0x43211234)", true); - toBoolean.insert("QScriptValue(0x10000)", true); - toBoolean.insert("QScriptValue(0x10001)", true); - toBoolean.insert("QScriptValue(qSNaN())", false); - toBoolean.insert("QScriptValue(qQNaN())", false); - toBoolean.insert("QScriptValue(qInf())", true); - toBoolean.insert("QScriptValue(-qInf())", true); - toBoolean.insert("QScriptValue(\"NaN\")", true); - toBoolean.insert("QScriptValue(\"Infinity\")", true); - toBoolean.insert("QScriptValue(\"-Infinity\")", true); - toBoolean.insert("QScriptValue(\"ciao\")", true); - toBoolean.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true); - toBoolean.insert("QScriptValue(QString(\"\"))", false); - toBoolean.insert("QScriptValue(QString())", false); - toBoolean.insert("QScriptValue(QString(\"0\"))", true); - toBoolean.insert("QScriptValue(QString(\"123\"))", true); - toBoolean.insert("QScriptValue(QString(\"12.4\"))", true); - toBoolean.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false); - toBoolean.insert("QScriptValue(0, QScriptValue::NullValue)", false); - toBoolean.insert("QScriptValue(0, true)", true); - toBoolean.insert("QScriptValue(0, false)", false); - toBoolean.insert("QScriptValue(0, int(122))", true); - toBoolean.insert("QScriptValue(0, uint(124))", true); - toBoolean.insert("QScriptValue(0, 0)", false); - toBoolean.insert("QScriptValue(0, 0.0)", false); - toBoolean.insert("QScriptValue(0, 123.0)", true); - toBoolean.insert("QScriptValue(0, 6.37e-8)", true); - toBoolean.insert("QScriptValue(0, -6.37e-8)", true); - toBoolean.insert("QScriptValue(0, 0x43211234)", true); - toBoolean.insert("QScriptValue(0, 0x10000)", true); - toBoolean.insert("QScriptValue(0, 0x10001)", true); - toBoolean.insert("QScriptValue(0, qSNaN())", false); - toBoolean.insert("QScriptValue(0, qQNaN())", false); - toBoolean.insert("QScriptValue(0, qInf())", true); - toBoolean.insert("QScriptValue(0, -qInf())", true); - toBoolean.insert("QScriptValue(0, \"NaN\")", true); - toBoolean.insert("QScriptValue(0, \"Infinity\")", true); - toBoolean.insert("QScriptValue(0, \"-Infinity\")", true); - toBoolean.insert("QScriptValue(0, \"ciao\")", true); - toBoolean.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true); - toBoolean.insert("QScriptValue(0, QString(\"\"))", false); - toBoolean.insert("QScriptValue(0, QString())", false); - toBoolean.insert("QScriptValue(0, QString(\"0\"))", true); - toBoolean.insert("QScriptValue(0, QString(\"123\"))", true); - toBoolean.insert("QScriptValue(0, QString(\"12.3\"))", true); - toBoolean.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false); - toBoolean.insert("QScriptValue(engine, QScriptValue::NullValue)", false); - toBoolean.insert("QScriptValue(engine, true)", true); - toBoolean.insert("QScriptValue(engine, false)", false); - toBoolean.insert("QScriptValue(engine, int(122))", true); - toBoolean.insert("QScriptValue(engine, uint(124))", true); - toBoolean.insert("QScriptValue(engine, 0)", false); - toBoolean.insert("QScriptValue(engine, 0.0)", false); - toBoolean.insert("QScriptValue(engine, 123.0)", true); - toBoolean.insert("QScriptValue(engine, 6.37e-8)", true); - toBoolean.insert("QScriptValue(engine, -6.37e-8)", true); - toBoolean.insert("QScriptValue(engine, 0x43211234)", true); - toBoolean.insert("QScriptValue(engine, 0x10000)", true); - toBoolean.insert("QScriptValue(engine, 0x10001)", true); - toBoolean.insert("QScriptValue(engine, qSNaN())", false); - toBoolean.insert("QScriptValue(engine, qQNaN())", false); - toBoolean.insert("QScriptValue(engine, qInf())", true); - toBoolean.insert("QScriptValue(engine, -qInf())", true); - toBoolean.insert("QScriptValue(engine, \"NaN\")", true); - toBoolean.insert("QScriptValue(engine, \"Infinity\")", true); - toBoolean.insert("QScriptValue(engine, \"-Infinity\")", true); - toBoolean.insert("QScriptValue(engine, \"ciao\")", true); - toBoolean.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true); - toBoolean.insert("QScriptValue(engine, QString(\"\"))", false); - toBoolean.insert("QScriptValue(engine, QString())", false); - toBoolean.insert("QScriptValue(engine, QString(\"0\"))", true); - toBoolean.insert("QScriptValue(engine, QString(\"123\"))", true); - toBoolean.insert("QScriptValue(engine, QString(\"1.23\"))", true); - toBoolean.insert("engine->evaluate(\"[]\")", true); - toBoolean.insert("engine->evaluate(\"{}\")", false); - toBoolean.insert("engine->evaluate(\"Object.prototype\")", true); - toBoolean.insert("engine->evaluate(\"Date.prototype\")", true); - toBoolean.insert("engine->evaluate(\"Array.prototype\")", true); - toBoolean.insert("engine->evaluate(\"Function.prototype\")", true); - toBoolean.insert("engine->evaluate(\"Error.prototype\")", true); - toBoolean.insert("engine->evaluate(\"Object\")", true); - toBoolean.insert("engine->evaluate(\"Array\")", true); - toBoolean.insert("engine->evaluate(\"Number\")", true); - toBoolean.insert("engine->evaluate(\"Function\")", true); - toBoolean.insert("engine->evaluate(\"(function() { return 1; })\")", true); - toBoolean.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true); - toBoolean.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true); - toBoolean.insert("engine->evaluate(\"/foo/\")", true); - toBoolean.insert("engine->evaluate(\"new Object()\")", true); - toBoolean.insert("engine->evaluate(\"new Array()\")", true); - toBoolean.insert("engine->evaluate(\"new Error()\")", true); - toBoolean.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", true); - toBoolean.insert("engine->evaluate(\"Undefined\")", true); - toBoolean.insert("engine->evaluate(\"Null\")", true); - toBoolean.insert("engine->evaluate(\"True\")", true); - toBoolean.insert("engine->evaluate(\"False\")", true); - toBoolean.insert("engine->evaluate(\"undefined\")", false); - toBoolean.insert("engine->evaluate(\"null\")", false); - toBoolean.insert("engine->evaluate(\"true\")", true); - toBoolean.insert("engine->evaluate(\"false\")", false); - toBoolean.insert("engine->evaluate(\"122\")", true); - toBoolean.insert("engine->evaluate(\"124\")", true); - toBoolean.insert("engine->evaluate(\"0\")", false); - toBoolean.insert("engine->evaluate(\"0.0\")", false); - toBoolean.insert("engine->evaluate(\"123.0\")", true); - toBoolean.insert("engine->evaluate(\"6.37e-8\")", true); - toBoolean.insert("engine->evaluate(\"-6.37e-8\")", true); - toBoolean.insert("engine->evaluate(\"0x43211234\")", true); - toBoolean.insert("engine->evaluate(\"0x10000\")", true); - toBoolean.insert("engine->evaluate(\"0x10001\")", true); - toBoolean.insert("engine->evaluate(\"NaN\")", false); - toBoolean.insert("engine->evaluate(\"Infinity\")", true); - toBoolean.insert("engine->evaluate(\"-Infinity\")", true); - toBoolean.insert("engine->evaluate(\"'ciao'\")", true); - toBoolean.insert("engine->evaluate(\"''\")", false); - toBoolean.insert("engine->evaluate(\"'0'\")", true); - toBoolean.insert("engine->evaluate(\"'123'\")", true); - toBoolean.insert("engine->evaluate(\"'12.4'\")", true); - toBoolean.insert("engine->nullValue()", false); - toBoolean.insert("engine->undefinedValue()", false); - toBoolean.insert("engine->newObject()", true); - toBoolean.insert("engine->newArray()", true); - toBoolean.insert("engine->newArray(10)", true); - toBoolean.insert("engine->newDate(QDateTime())", true); - toBoolean.insert("engine->newQMetaObject(&QObject::staticMetaObject)", true); - toBoolean.insert("engine->newVariant(QVariant())", true); - toBoolean.insert("engine->newVariant(QVariant(123))", true); - toBoolean.insert("engine->newVariant(QVariant(false))", true); - toBoolean.insert("engine->newQObject(0)", false); - toBoolean.insert("engine->newQObject(engine)", true); - } - newRow(expr) << toBoolean.value(expr); -} - -void tst_QScriptValue::toBoolean_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(value.toBoolean(), expected); - QCOMPARE(value.toBoolean(), expected); -} - -DEFINE_TEST_FUNCTION(toBoolean) - - -void tst_QScriptValue::toInteger_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toInteger_makeData(const char* expr) -{ - static QHash toInteger; - if (toInteger.isEmpty()) { - toInteger.insert("QScriptValue()", 0); - toInteger.insert("QScriptValue(QScriptValue::UndefinedValue)", 0); - toInteger.insert("QScriptValue(QScriptValue::NullValue)", 0); - toInteger.insert("QScriptValue(true)", 1); - toInteger.insert("QScriptValue(false)", 0); - toInteger.insert("QScriptValue(int(122))", 122); - toInteger.insert("QScriptValue(uint(124))", 124); - toInteger.insert("QScriptValue(0)", 0); - toInteger.insert("QScriptValue(0.0)", 0); - toInteger.insert("QScriptValue(123.0)", 123); - toInteger.insert("QScriptValue(6.37e-8)", 0); - toInteger.insert("QScriptValue(-6.37e-8)", 0); - toInteger.insert("QScriptValue(0x43211234)", 1126240820); - toInteger.insert("QScriptValue(0x10000)", 65536); - toInteger.insert("QScriptValue(0x10001)", 65537); - toInteger.insert("QScriptValue(qSNaN())", 0); - toInteger.insert("QScriptValue(qQNaN())", 0); - toInteger.insert("QScriptValue(qInf())", qInf()); - toInteger.insert("QScriptValue(-qInf())", qInf()); - toInteger.insert("QScriptValue(\"NaN\")", 0); - toInteger.insert("QScriptValue(\"Infinity\")", qInf()); - toInteger.insert("QScriptValue(\"-Infinity\")", qInf()); - toInteger.insert("QScriptValue(\"ciao\")", 0); - toInteger.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0); - toInteger.insert("QScriptValue(QString(\"\"))", 0); - toInteger.insert("QScriptValue(QString())", 0); - toInteger.insert("QScriptValue(QString(\"0\"))", 0); - toInteger.insert("QScriptValue(QString(\"123\"))", 123); - toInteger.insert("QScriptValue(QString(\"12.4\"))", 12); - toInteger.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0); - toInteger.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - toInteger.insert("QScriptValue(0, true)", 1); - toInteger.insert("QScriptValue(0, false)", 0); - toInteger.insert("QScriptValue(0, int(122))", 122); - toInteger.insert("QScriptValue(0, uint(124))", 124); - toInteger.insert("QScriptValue(0, 0)", 0); - toInteger.insert("QScriptValue(0, 0.0)", 0); - toInteger.insert("QScriptValue(0, 123.0)", 123); - toInteger.insert("QScriptValue(0, 6.37e-8)", 0); - toInteger.insert("QScriptValue(0, -6.37e-8)", 0); - toInteger.insert("QScriptValue(0, 0x43211234)", 1126240820); - toInteger.insert("QScriptValue(0, 0x10000)", 65536); - toInteger.insert("QScriptValue(0, 0x10001)", 65537); - toInteger.insert("QScriptValue(0, qSNaN())", 0); - toInteger.insert("QScriptValue(0, qQNaN())", 0); - toInteger.insert("QScriptValue(0, qInf())", qInf()); - toInteger.insert("QScriptValue(0, -qInf())", qInf()); - toInteger.insert("QScriptValue(0, \"NaN\")", 0); - toInteger.insert("QScriptValue(0, \"Infinity\")", qInf()); - toInteger.insert("QScriptValue(0, \"-Infinity\")", qInf()); - toInteger.insert("QScriptValue(0, \"ciao\")", 0); - toInteger.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0); - toInteger.insert("QScriptValue(0, QString(\"\"))", 0); - toInteger.insert("QScriptValue(0, QString())", 0); - toInteger.insert("QScriptValue(0, QString(\"0\"))", 0); - toInteger.insert("QScriptValue(0, QString(\"123\"))", 123); - toInteger.insert("QScriptValue(0, QString(\"12.3\"))", 12); - toInteger.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0); - toInteger.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - toInteger.insert("QScriptValue(engine, true)", 1); - toInteger.insert("QScriptValue(engine, false)", 0); - toInteger.insert("QScriptValue(engine, int(122))", 122); - toInteger.insert("QScriptValue(engine, uint(124))", 124); - toInteger.insert("QScriptValue(engine, 0)", 0); - toInteger.insert("QScriptValue(engine, 0.0)", 0); - toInteger.insert("QScriptValue(engine, 123.0)", 123); - toInteger.insert("QScriptValue(engine, 6.37e-8)", 0); - toInteger.insert("QScriptValue(engine, -6.37e-8)", 0); - toInteger.insert("QScriptValue(engine, 0x43211234)", 1126240820); - toInteger.insert("QScriptValue(engine, 0x10000)", 65536); - toInteger.insert("QScriptValue(engine, 0x10001)", 65537); - toInteger.insert("QScriptValue(engine, qSNaN())", 0); - toInteger.insert("QScriptValue(engine, qQNaN())", 0); - toInteger.insert("QScriptValue(engine, qInf())", qInf()); - toInteger.insert("QScriptValue(engine, -qInf())", qInf()); - toInteger.insert("QScriptValue(engine, \"NaN\")", 0); - toInteger.insert("QScriptValue(engine, \"Infinity\")", qInf()); - toInteger.insert("QScriptValue(engine, \"-Infinity\")", qInf()); - toInteger.insert("QScriptValue(engine, \"ciao\")", 0); - toInteger.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0); - toInteger.insert("QScriptValue(engine, QString(\"\"))", 0); - toInteger.insert("QScriptValue(engine, QString())", 0); - toInteger.insert("QScriptValue(engine, QString(\"0\"))", 0); - toInteger.insert("QScriptValue(engine, QString(\"123\"))", 123); - toInteger.insert("QScriptValue(engine, QString(\"1.23\"))", 1); - toInteger.insert("engine->evaluate(\"[]\")", 0); - toInteger.insert("engine->evaluate(\"{}\")", 0); - toInteger.insert("engine->evaluate(\"Object.prototype\")", 0); - toInteger.insert("engine->evaluate(\"Date.prototype\")", 0); - toInteger.insert("engine->evaluate(\"Array.prototype\")", 0); - toInteger.insert("engine->evaluate(\"Function.prototype\")", 0); - toInteger.insert("engine->evaluate(\"Error.prototype\")", 0); - toInteger.insert("engine->evaluate(\"Object\")", 0); - toInteger.insert("engine->evaluate(\"Array\")", 0); - toInteger.insert("engine->evaluate(\"Number\")", 0); - toInteger.insert("engine->evaluate(\"Function\")", 0); - toInteger.insert("engine->evaluate(\"(function() { return 1; })\")", 0); - toInteger.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0); - toInteger.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0); - toInteger.insert("engine->evaluate(\"/foo/\")", 0); - toInteger.insert("engine->evaluate(\"new Object()\")", 0); - toInteger.insert("engine->evaluate(\"new Array()\")", 0); - toInteger.insert("engine->evaluate(\"new Error()\")", 0); - toInteger.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - toInteger.insert("engine->evaluate(\"Undefined\")", 0); - toInteger.insert("engine->evaluate(\"Null\")", 0); - toInteger.insert("engine->evaluate(\"True\")", 0); - toInteger.insert("engine->evaluate(\"False\")", 0); - toInteger.insert("engine->evaluate(\"undefined\")", 0); - toInteger.insert("engine->evaluate(\"null\")", 0); - toInteger.insert("engine->evaluate(\"true\")", 1); - toInteger.insert("engine->evaluate(\"false\")", 0); - toInteger.insert("engine->evaluate(\"122\")", 122); - toInteger.insert("engine->evaluate(\"124\")", 124); - toInteger.insert("engine->evaluate(\"0\")", 0); - toInteger.insert("engine->evaluate(\"0.0\")", 0); - toInteger.insert("engine->evaluate(\"123.0\")", 123); - toInteger.insert("engine->evaluate(\"6.37e-8\")", 0); - toInteger.insert("engine->evaluate(\"-6.37e-8\")", 0); - toInteger.insert("engine->evaluate(\"0x43211234\")", 1126240820); - toInteger.insert("engine->evaluate(\"0x10000\")", 65536); - toInteger.insert("engine->evaluate(\"0x10001\")", 65537); - toInteger.insert("engine->evaluate(\"NaN\")", 0); - toInteger.insert("engine->evaluate(\"Infinity\")", qInf()); - toInteger.insert("engine->evaluate(\"-Infinity\")", qInf()); - toInteger.insert("engine->evaluate(\"'ciao'\")", 0); - toInteger.insert("engine->evaluate(\"''\")", 0); - toInteger.insert("engine->evaluate(\"'0'\")", 0); - toInteger.insert("engine->evaluate(\"'123'\")", 123); - toInteger.insert("engine->evaluate(\"'12.4'\")", 12); - toInteger.insert("engine->nullValue()", 0); - toInteger.insert("engine->undefinedValue()", 0); - toInteger.insert("engine->newObject()", 0); - toInteger.insert("engine->newArray()", 0); - toInteger.insert("engine->newArray(10)", 0); - toInteger.insert("engine->newDate(QDateTime())", 0); - toInteger.insert("engine->newQMetaObject(&QObject::staticMetaObject)", 0); - toInteger.insert("engine->newVariant(QVariant())", 0); - toInteger.insert("engine->newVariant(QVariant(123))", 123); - toInteger.insert("engine->newVariant(QVariant(false))", 0); - toInteger.insert("engine->newQObject(0)", 0); - toInteger.insert("engine->newQObject(engine)", 0); - } - newRow(expr) << toInteger.value(expr); -} - -void tst_QScriptValue::toInteger_test(const char*, const QScriptValue& value) -{ - QFETCH(qsreal, expected); - if (qIsInf(expected)) { - QVERIFY(qIsInf(value.toInteger())); - QVERIFY(qIsInf(value.toInteger())); - return; - } - QCOMPARE(value.toInteger(), expected); - QCOMPARE(value.toInteger(), expected); -} - -DEFINE_TEST_FUNCTION(toInteger) - - -void tst_QScriptValue::toInt32_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toInt32_makeData(const char* expr) -{ - static QHash toInt32; - if (toInt32.isEmpty()) { - toInt32.insert("QScriptValue()", 0); - toInt32.insert("QScriptValue(QScriptValue::UndefinedValue)", 0); - toInt32.insert("QScriptValue(QScriptValue::NullValue)", 0); - toInt32.insert("QScriptValue(true)", 1); - toInt32.insert("QScriptValue(false)", 0); - toInt32.insert("QScriptValue(int(122))", 122); - toInt32.insert("QScriptValue(uint(124))", 124); - toInt32.insert("QScriptValue(0)", 0); - toInt32.insert("QScriptValue(0.0)", 0); - toInt32.insert("QScriptValue(123.0)", 123); - toInt32.insert("QScriptValue(6.37e-8)", 0); - toInt32.insert("QScriptValue(-6.37e-8)", 0); - toInt32.insert("QScriptValue(0x43211234)", 1126240820); - toInt32.insert("QScriptValue(0x10000)", 65536); - toInt32.insert("QScriptValue(0x10001)", 65537); - toInt32.insert("QScriptValue(qSNaN())", 0); - toInt32.insert("QScriptValue(qQNaN())", 0); - toInt32.insert("QScriptValue(qInf())", 0); - toInt32.insert("QScriptValue(-qInf())", 0); - toInt32.insert("QScriptValue(\"NaN\")", 0); - toInt32.insert("QScriptValue(\"Infinity\")", 0); - toInt32.insert("QScriptValue(\"-Infinity\")", 0); - toInt32.insert("QScriptValue(\"ciao\")", 0); - toInt32.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0); - toInt32.insert("QScriptValue(QString(\"\"))", 0); - toInt32.insert("QScriptValue(QString())", 0); - toInt32.insert("QScriptValue(QString(\"0\"))", 0); - toInt32.insert("QScriptValue(QString(\"123\"))", 123); - toInt32.insert("QScriptValue(QString(\"12.4\"))", 12); - toInt32.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0); - toInt32.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - toInt32.insert("QScriptValue(0, true)", 1); - toInt32.insert("QScriptValue(0, false)", 0); - toInt32.insert("QScriptValue(0, int(122))", 122); - toInt32.insert("QScriptValue(0, uint(124))", 124); - toInt32.insert("QScriptValue(0, 0)", 0); - toInt32.insert("QScriptValue(0, 0.0)", 0); - toInt32.insert("QScriptValue(0, 123.0)", 123); - toInt32.insert("QScriptValue(0, 6.37e-8)", 0); - toInt32.insert("QScriptValue(0, -6.37e-8)", 0); - toInt32.insert("QScriptValue(0, 0x43211234)", 1126240820); - toInt32.insert("QScriptValue(0, 0x10000)", 65536); - toInt32.insert("QScriptValue(0, 0x10001)", 65537); - toInt32.insert("QScriptValue(0, qSNaN())", 0); - toInt32.insert("QScriptValue(0, qQNaN())", 0); - toInt32.insert("QScriptValue(0, qInf())", 0); - toInt32.insert("QScriptValue(0, -qInf())", 0); - toInt32.insert("QScriptValue(0, \"NaN\")", 0); - toInt32.insert("QScriptValue(0, \"Infinity\")", 0); - toInt32.insert("QScriptValue(0, \"-Infinity\")", 0); - toInt32.insert("QScriptValue(0, \"ciao\")", 0); - toInt32.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0); - toInt32.insert("QScriptValue(0, QString(\"\"))", 0); - toInt32.insert("QScriptValue(0, QString())", 0); - toInt32.insert("QScriptValue(0, QString(\"0\"))", 0); - toInt32.insert("QScriptValue(0, QString(\"123\"))", 123); - toInt32.insert("QScriptValue(0, QString(\"12.3\"))", 12); - toInt32.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0); - toInt32.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - toInt32.insert("QScriptValue(engine, true)", 1); - toInt32.insert("QScriptValue(engine, false)", 0); - toInt32.insert("QScriptValue(engine, int(122))", 122); - toInt32.insert("QScriptValue(engine, uint(124))", 124); - toInt32.insert("QScriptValue(engine, 0)", 0); - toInt32.insert("QScriptValue(engine, 0.0)", 0); - toInt32.insert("QScriptValue(engine, 123.0)", 123); - toInt32.insert("QScriptValue(engine, 6.37e-8)", 0); - toInt32.insert("QScriptValue(engine, -6.37e-8)", 0); - toInt32.insert("QScriptValue(engine, 0x43211234)", 1126240820); - toInt32.insert("QScriptValue(engine, 0x10000)", 65536); - toInt32.insert("QScriptValue(engine, 0x10001)", 65537); - toInt32.insert("QScriptValue(engine, qSNaN())", 0); - toInt32.insert("QScriptValue(engine, qQNaN())", 0); - toInt32.insert("QScriptValue(engine, qInf())", 0); - toInt32.insert("QScriptValue(engine, -qInf())", 0); - toInt32.insert("QScriptValue(engine, \"NaN\")", 0); - toInt32.insert("QScriptValue(engine, \"Infinity\")", 0); - toInt32.insert("QScriptValue(engine, \"-Infinity\")", 0); - toInt32.insert("QScriptValue(engine, \"ciao\")", 0); - toInt32.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0); - toInt32.insert("QScriptValue(engine, QString(\"\"))", 0); - toInt32.insert("QScriptValue(engine, QString())", 0); - toInt32.insert("QScriptValue(engine, QString(\"0\"))", 0); - toInt32.insert("QScriptValue(engine, QString(\"123\"))", 123); - toInt32.insert("QScriptValue(engine, QString(\"1.23\"))", 1); - toInt32.insert("engine->evaluate(\"[]\")", 0); - toInt32.insert("engine->evaluate(\"{}\")", 0); - toInt32.insert("engine->evaluate(\"Object.prototype\")", 0); - toInt32.insert("engine->evaluate(\"Date.prototype\")", 0); - toInt32.insert("engine->evaluate(\"Array.prototype\")", 0); - toInt32.insert("engine->evaluate(\"Function.prototype\")", 0); - toInt32.insert("engine->evaluate(\"Error.prototype\")", 0); - toInt32.insert("engine->evaluate(\"Object\")", 0); - toInt32.insert("engine->evaluate(\"Array\")", 0); - toInt32.insert("engine->evaluate(\"Number\")", 0); - toInt32.insert("engine->evaluate(\"Function\")", 0); - toInt32.insert("engine->evaluate(\"(function() { return 1; })\")", 0); - toInt32.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0); - toInt32.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0); - toInt32.insert("engine->evaluate(\"/foo/\")", 0); - toInt32.insert("engine->evaluate(\"new Object()\")", 0); - toInt32.insert("engine->evaluate(\"new Array()\")", 0); - toInt32.insert("engine->evaluate(\"new Error()\")", 0); - toInt32.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - toInt32.insert("engine->evaluate(\"Undefined\")", 0); - toInt32.insert("engine->evaluate(\"Null\")", 0); - toInt32.insert("engine->evaluate(\"True\")", 0); - toInt32.insert("engine->evaluate(\"False\")", 0); - toInt32.insert("engine->evaluate(\"undefined\")", 0); - toInt32.insert("engine->evaluate(\"null\")", 0); - toInt32.insert("engine->evaluate(\"true\")", 1); - toInt32.insert("engine->evaluate(\"false\")", 0); - toInt32.insert("engine->evaluate(\"122\")", 122); - toInt32.insert("engine->evaluate(\"124\")", 124); - toInt32.insert("engine->evaluate(\"0\")", 0); - toInt32.insert("engine->evaluate(\"0.0\")", 0); - toInt32.insert("engine->evaluate(\"123.0\")", 123); - toInt32.insert("engine->evaluate(\"6.37e-8\")", 0); - toInt32.insert("engine->evaluate(\"-6.37e-8\")", 0); - toInt32.insert("engine->evaluate(\"0x43211234\")", 1126240820); - toInt32.insert("engine->evaluate(\"0x10000\")", 65536); - toInt32.insert("engine->evaluate(\"0x10001\")", 65537); - toInt32.insert("engine->evaluate(\"NaN\")", 0); - toInt32.insert("engine->evaluate(\"Infinity\")", 0); - toInt32.insert("engine->evaluate(\"-Infinity\")", 0); - toInt32.insert("engine->evaluate(\"'ciao'\")", 0); - toInt32.insert("engine->evaluate(\"''\")", 0); - toInt32.insert("engine->evaluate(\"'0'\")", 0); - toInt32.insert("engine->evaluate(\"'123'\")", 123); - toInt32.insert("engine->evaluate(\"'12.4'\")", 12); - toInt32.insert("engine->nullValue()", 0); - toInt32.insert("engine->undefinedValue()", 0); - toInt32.insert("engine->newObject()", 0); - toInt32.insert("engine->newArray()", 0); - toInt32.insert("engine->newArray(10)", 0); - toInt32.insert("engine->newDate(QDateTime())", 0); - toInt32.insert("engine->newQMetaObject(&QObject::staticMetaObject)", 0); - toInt32.insert("engine->newVariant(QVariant())", 0); - toInt32.insert("engine->newVariant(QVariant(123))", 123); - toInt32.insert("engine->newVariant(QVariant(false))", 0); - toInt32.insert("engine->newQObject(0)", 0); - toInt32.insert("engine->newQObject(engine)", 0); - } - newRow(expr) << toInt32.value(expr); -} - -void tst_QScriptValue::toInt32_test(const char*, const QScriptValue& value) -{ - QFETCH(qint32, expected); - QCOMPARE(value.toInt32(), expected); - QCOMPARE(value.toInt32(), expected); -} - -DEFINE_TEST_FUNCTION(toInt32) - - -void tst_QScriptValue::toUInt32_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toUInt32_makeData(const char* expr) -{ - static QHash toUInt32; - if (toUInt32.isEmpty()) { - toUInt32.insert("QScriptValue()", 0); - toUInt32.insert("QScriptValue(QScriptValue::UndefinedValue)", 0); - toUInt32.insert("QScriptValue(QScriptValue::NullValue)", 0); - toUInt32.insert("QScriptValue(true)", 1); - toUInt32.insert("QScriptValue(false)", 0); - toUInt32.insert("QScriptValue(int(122))", 122); - toUInt32.insert("QScriptValue(uint(124))", 124); - toUInt32.insert("QScriptValue(0)", 0); - toUInt32.insert("QScriptValue(0.0)", 0); - toUInt32.insert("QScriptValue(123.0)", 123); - toUInt32.insert("QScriptValue(6.37e-8)", 0); - toUInt32.insert("QScriptValue(-6.37e-8)", 0); - toUInt32.insert("QScriptValue(0x43211234)", 1126240820); - toUInt32.insert("QScriptValue(0x10000)", 65536); - toUInt32.insert("QScriptValue(0x10001)", 65537); - toUInt32.insert("QScriptValue(qSNaN())", 0); - toUInt32.insert("QScriptValue(qQNaN())", 0); - toUInt32.insert("QScriptValue(qInf())", 0); - toUInt32.insert("QScriptValue(-qInf())", 0); - toUInt32.insert("QScriptValue(\"NaN\")", 0); - toUInt32.insert("QScriptValue(\"Infinity\")", 0); - toUInt32.insert("QScriptValue(\"-Infinity\")", 0); - toUInt32.insert("QScriptValue(\"ciao\")", 0); - toUInt32.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0); - toUInt32.insert("QScriptValue(QString(\"\"))", 0); - toUInt32.insert("QScriptValue(QString())", 0); - toUInt32.insert("QScriptValue(QString(\"0\"))", 0); - toUInt32.insert("QScriptValue(QString(\"123\"))", 123); - toUInt32.insert("QScriptValue(QString(\"12.4\"))", 12); - toUInt32.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0); - toUInt32.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - toUInt32.insert("QScriptValue(0, true)", 1); - toUInt32.insert("QScriptValue(0, false)", 0); - toUInt32.insert("QScriptValue(0, int(122))", 122); - toUInt32.insert("QScriptValue(0, uint(124))", 124); - toUInt32.insert("QScriptValue(0, 0)", 0); - toUInt32.insert("QScriptValue(0, 0.0)", 0); - toUInt32.insert("QScriptValue(0, 123.0)", 123); - toUInt32.insert("QScriptValue(0, 6.37e-8)", 0); - toUInt32.insert("QScriptValue(0, -6.37e-8)", 0); - toUInt32.insert("QScriptValue(0, 0x43211234)", 1126240820); - toUInt32.insert("QScriptValue(0, 0x10000)", 65536); - toUInt32.insert("QScriptValue(0, 0x10001)", 65537); - toUInt32.insert("QScriptValue(0, qSNaN())", 0); - toUInt32.insert("QScriptValue(0, qQNaN())", 0); - toUInt32.insert("QScriptValue(0, qInf())", 0); - toUInt32.insert("QScriptValue(0, -qInf())", 0); - toUInt32.insert("QScriptValue(0, \"NaN\")", 0); - toUInt32.insert("QScriptValue(0, \"Infinity\")", 0); - toUInt32.insert("QScriptValue(0, \"-Infinity\")", 0); - toUInt32.insert("QScriptValue(0, \"ciao\")", 0); - toUInt32.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0); - toUInt32.insert("QScriptValue(0, QString(\"\"))", 0); - toUInt32.insert("QScriptValue(0, QString())", 0); - toUInt32.insert("QScriptValue(0, QString(\"0\"))", 0); - toUInt32.insert("QScriptValue(0, QString(\"123\"))", 123); - toUInt32.insert("QScriptValue(0, QString(\"12.3\"))", 12); - toUInt32.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0); - toUInt32.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - toUInt32.insert("QScriptValue(engine, true)", 1); - toUInt32.insert("QScriptValue(engine, false)", 0); - toUInt32.insert("QScriptValue(engine, int(122))", 122); - toUInt32.insert("QScriptValue(engine, uint(124))", 124); - toUInt32.insert("QScriptValue(engine, 0)", 0); - toUInt32.insert("QScriptValue(engine, 0.0)", 0); - toUInt32.insert("QScriptValue(engine, 123.0)", 123); - toUInt32.insert("QScriptValue(engine, 6.37e-8)", 0); - toUInt32.insert("QScriptValue(engine, -6.37e-8)", 0); - toUInt32.insert("QScriptValue(engine, 0x43211234)", 1126240820); - toUInt32.insert("QScriptValue(engine, 0x10000)", 65536); - toUInt32.insert("QScriptValue(engine, 0x10001)", 65537); - toUInt32.insert("QScriptValue(engine, qSNaN())", 0); - toUInt32.insert("QScriptValue(engine, qQNaN())", 0); - toUInt32.insert("QScriptValue(engine, qInf())", 0); - toUInt32.insert("QScriptValue(engine, -qInf())", 0); - toUInt32.insert("QScriptValue(engine, \"NaN\")", 0); - toUInt32.insert("QScriptValue(engine, \"Infinity\")", 0); - toUInt32.insert("QScriptValue(engine, \"-Infinity\")", 0); - toUInt32.insert("QScriptValue(engine, \"ciao\")", 0); - toUInt32.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0); - toUInt32.insert("QScriptValue(engine, QString(\"\"))", 0); - toUInt32.insert("QScriptValue(engine, QString())", 0); - toUInt32.insert("QScriptValue(engine, QString(\"0\"))", 0); - toUInt32.insert("QScriptValue(engine, QString(\"123\"))", 123); - toUInt32.insert("QScriptValue(engine, QString(\"1.23\"))", 1); - toUInt32.insert("engine->evaluate(\"[]\")", 0); - toUInt32.insert("engine->evaluate(\"{}\")", 0); - toUInt32.insert("engine->evaluate(\"Object.prototype\")", 0); - toUInt32.insert("engine->evaluate(\"Date.prototype\")", 0); - toUInt32.insert("engine->evaluate(\"Array.prototype\")", 0); - toUInt32.insert("engine->evaluate(\"Function.prototype\")", 0); - toUInt32.insert("engine->evaluate(\"Error.prototype\")", 0); - toUInt32.insert("engine->evaluate(\"Object\")", 0); - toUInt32.insert("engine->evaluate(\"Array\")", 0); - toUInt32.insert("engine->evaluate(\"Number\")", 0); - toUInt32.insert("engine->evaluate(\"Function\")", 0); - toUInt32.insert("engine->evaluate(\"(function() { return 1; })\")", 0); - toUInt32.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0); - toUInt32.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0); - toUInt32.insert("engine->evaluate(\"/foo/\")", 0); - toUInt32.insert("engine->evaluate(\"new Object()\")", 0); - toUInt32.insert("engine->evaluate(\"new Array()\")", 0); - toUInt32.insert("engine->evaluate(\"new Error()\")", 0); - toUInt32.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - toUInt32.insert("engine->evaluate(\"Undefined\")", 0); - toUInt32.insert("engine->evaluate(\"Null\")", 0); - toUInt32.insert("engine->evaluate(\"True\")", 0); - toUInt32.insert("engine->evaluate(\"False\")", 0); - toUInt32.insert("engine->evaluate(\"undefined\")", 0); - toUInt32.insert("engine->evaluate(\"null\")", 0); - toUInt32.insert("engine->evaluate(\"true\")", 1); - toUInt32.insert("engine->evaluate(\"false\")", 0); - toUInt32.insert("engine->evaluate(\"122\")", 122); - toUInt32.insert("engine->evaluate(\"124\")", 124); - toUInt32.insert("engine->evaluate(\"0\")", 0); - toUInt32.insert("engine->evaluate(\"0.0\")", 0); - toUInt32.insert("engine->evaluate(\"123.0\")", 123); - toUInt32.insert("engine->evaluate(\"6.37e-8\")", 0); - toUInt32.insert("engine->evaluate(\"-6.37e-8\")", 0); - toUInt32.insert("engine->evaluate(\"0x43211234\")", 1126240820); - toUInt32.insert("engine->evaluate(\"0x10000\")", 65536); - toUInt32.insert("engine->evaluate(\"0x10001\")", 65537); - toUInt32.insert("engine->evaluate(\"NaN\")", 0); - toUInt32.insert("engine->evaluate(\"Infinity\")", 0); - toUInt32.insert("engine->evaluate(\"-Infinity\")", 0); - toUInt32.insert("engine->evaluate(\"'ciao'\")", 0); - toUInt32.insert("engine->evaluate(\"''\")", 0); - toUInt32.insert("engine->evaluate(\"'0'\")", 0); - toUInt32.insert("engine->evaluate(\"'123'\")", 123); - toUInt32.insert("engine->evaluate(\"'12.4'\")", 12); - toUInt32.insert("engine->nullValue()", 0); - toUInt32.insert("engine->undefinedValue()", 0); - toUInt32.insert("engine->newObject()", 0); - toUInt32.insert("engine->newArray()", 0); - toUInt32.insert("engine->newArray(10)", 0); - toUInt32.insert("engine->newDate(QDateTime())", 0); - toUInt32.insert("engine->newQMetaObject(&QObject::staticMetaObject)", 0); - toUInt32.insert("engine->newVariant(QVariant())", 0); - toUInt32.insert("engine->newVariant(QVariant(123))", 123); - toUInt32.insert("engine->newVariant(QVariant(false))", 0); - toUInt32.insert("engine->newQObject(0)", 0); - toUInt32.insert("engine->newQObject(engine)", 0); - } - newRow(expr) << toUInt32.value(expr); -} - -void tst_QScriptValue::toUInt32_test(const char*, const QScriptValue& value) -{ - QFETCH(quint32, expected); - QCOMPARE(value.toUInt32(), expected); - QCOMPARE(value.toUInt32(), expected); -} - -DEFINE_TEST_FUNCTION(toUInt32) - - -void tst_QScriptValue::toUInt16_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::toUInt16_makeData(const char* expr) -{ - static QHash toUInt16; - if (toUInt16.isEmpty()) { - toUInt16.insert("QScriptValue()", 0); - toUInt16.insert("QScriptValue(QScriptValue::UndefinedValue)", 0); - toUInt16.insert("QScriptValue(QScriptValue::NullValue)", 0); - toUInt16.insert("QScriptValue(true)", 1); - toUInt16.insert("QScriptValue(false)", 0); - toUInt16.insert("QScriptValue(int(122))", 122); - toUInt16.insert("QScriptValue(uint(124))", 124); - toUInt16.insert("QScriptValue(0)", 0); - toUInt16.insert("QScriptValue(0.0)", 0); - toUInt16.insert("QScriptValue(123.0)", 123); - toUInt16.insert("QScriptValue(6.37e-8)", 0); - toUInt16.insert("QScriptValue(-6.37e-8)", 0); - toUInt16.insert("QScriptValue(0x43211234)", 4660); - toUInt16.insert("QScriptValue(0x10000)", 0); - toUInt16.insert("QScriptValue(0x10001)", 1); - toUInt16.insert("QScriptValue(qSNaN())", 0); - toUInt16.insert("QScriptValue(qQNaN())", 0); - toUInt16.insert("QScriptValue(qInf())", 0); - toUInt16.insert("QScriptValue(-qInf())", 0); - toUInt16.insert("QScriptValue(\"NaN\")", 0); - toUInt16.insert("QScriptValue(\"Infinity\")", 0); - toUInt16.insert("QScriptValue(\"-Infinity\")", 0); - toUInt16.insert("QScriptValue(\"ciao\")", 0); - toUInt16.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0); - toUInt16.insert("QScriptValue(QString(\"\"))", 0); - toUInt16.insert("QScriptValue(QString())", 0); - toUInt16.insert("QScriptValue(QString(\"0\"))", 0); - toUInt16.insert("QScriptValue(QString(\"123\"))", 123); - toUInt16.insert("QScriptValue(QString(\"12.4\"))", 12); - toUInt16.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0); - toUInt16.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - toUInt16.insert("QScriptValue(0, true)", 1); - toUInt16.insert("QScriptValue(0, false)", 0); - toUInt16.insert("QScriptValue(0, int(122))", 122); - toUInt16.insert("QScriptValue(0, uint(124))", 124); - toUInt16.insert("QScriptValue(0, 0)", 0); - toUInt16.insert("QScriptValue(0, 0.0)", 0); - toUInt16.insert("QScriptValue(0, 123.0)", 123); - toUInt16.insert("QScriptValue(0, 6.37e-8)", 0); - toUInt16.insert("QScriptValue(0, -6.37e-8)", 0); - toUInt16.insert("QScriptValue(0, 0x43211234)", 4660); - toUInt16.insert("QScriptValue(0, 0x10000)", 0); - toUInt16.insert("QScriptValue(0, 0x10001)", 1); - toUInt16.insert("QScriptValue(0, qSNaN())", 0); - toUInt16.insert("QScriptValue(0, qQNaN())", 0); - toUInt16.insert("QScriptValue(0, qInf())", 0); - toUInt16.insert("QScriptValue(0, -qInf())", 0); - toUInt16.insert("QScriptValue(0, \"NaN\")", 0); - toUInt16.insert("QScriptValue(0, \"Infinity\")", 0); - toUInt16.insert("QScriptValue(0, \"-Infinity\")", 0); - toUInt16.insert("QScriptValue(0, \"ciao\")", 0); - toUInt16.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0); - toUInt16.insert("QScriptValue(0, QString(\"\"))", 0); - toUInt16.insert("QScriptValue(0, QString())", 0); - toUInt16.insert("QScriptValue(0, QString(\"0\"))", 0); - toUInt16.insert("QScriptValue(0, QString(\"123\"))", 123); - toUInt16.insert("QScriptValue(0, QString(\"12.3\"))", 12); - toUInt16.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0); - toUInt16.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - toUInt16.insert("QScriptValue(engine, true)", 1); - toUInt16.insert("QScriptValue(engine, false)", 0); - toUInt16.insert("QScriptValue(engine, int(122))", 122); - toUInt16.insert("QScriptValue(engine, uint(124))", 124); - toUInt16.insert("QScriptValue(engine, 0)", 0); - toUInt16.insert("QScriptValue(engine, 0.0)", 0); - toUInt16.insert("QScriptValue(engine, 123.0)", 123); - toUInt16.insert("QScriptValue(engine, 6.37e-8)", 0); - toUInt16.insert("QScriptValue(engine, -6.37e-8)", 0); - toUInt16.insert("QScriptValue(engine, 0x43211234)", 4660); - toUInt16.insert("QScriptValue(engine, 0x10000)", 0); - toUInt16.insert("QScriptValue(engine, 0x10001)", 1); - toUInt16.insert("QScriptValue(engine, qSNaN())", 0); - toUInt16.insert("QScriptValue(engine, qQNaN())", 0); - toUInt16.insert("QScriptValue(engine, qInf())", 0); - toUInt16.insert("QScriptValue(engine, -qInf())", 0); - toUInt16.insert("QScriptValue(engine, \"NaN\")", 0); - toUInt16.insert("QScriptValue(engine, \"Infinity\")", 0); - toUInt16.insert("QScriptValue(engine, \"-Infinity\")", 0); - toUInt16.insert("QScriptValue(engine, \"ciao\")", 0); - toUInt16.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0); - toUInt16.insert("QScriptValue(engine, QString(\"\"))", 0); - toUInt16.insert("QScriptValue(engine, QString())", 0); - toUInt16.insert("QScriptValue(engine, QString(\"0\"))", 0); - toUInt16.insert("QScriptValue(engine, QString(\"123\"))", 123); - toUInt16.insert("QScriptValue(engine, QString(\"1.23\"))", 1); - toUInt16.insert("engine->evaluate(\"[]\")", 0); - toUInt16.insert("engine->evaluate(\"{}\")", 0); - toUInt16.insert("engine->evaluate(\"Object.prototype\")", 0); - toUInt16.insert("engine->evaluate(\"Date.prototype\")", 0); - toUInt16.insert("engine->evaluate(\"Array.prototype\")", 0); - toUInt16.insert("engine->evaluate(\"Function.prototype\")", 0); - toUInt16.insert("engine->evaluate(\"Error.prototype\")", 0); - toUInt16.insert("engine->evaluate(\"Object\")", 0); - toUInt16.insert("engine->evaluate(\"Array\")", 0); - toUInt16.insert("engine->evaluate(\"Number\")", 0); - toUInt16.insert("engine->evaluate(\"Function\")", 0); - toUInt16.insert("engine->evaluate(\"(function() { return 1; })\")", 0); - toUInt16.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0); - toUInt16.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0); - toUInt16.insert("engine->evaluate(\"/foo/\")", 0); - toUInt16.insert("engine->evaluate(\"new Object()\")", 0); - toUInt16.insert("engine->evaluate(\"new Array()\")", 0); - toUInt16.insert("engine->evaluate(\"new Error()\")", 0); - toUInt16.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - toUInt16.insert("engine->evaluate(\"Undefined\")", 0); - toUInt16.insert("engine->evaluate(\"Null\")", 0); - toUInt16.insert("engine->evaluate(\"True\")", 0); - toUInt16.insert("engine->evaluate(\"False\")", 0); - toUInt16.insert("engine->evaluate(\"undefined\")", 0); - toUInt16.insert("engine->evaluate(\"null\")", 0); - toUInt16.insert("engine->evaluate(\"true\")", 1); - toUInt16.insert("engine->evaluate(\"false\")", 0); - toUInt16.insert("engine->evaluate(\"122\")", 122); - toUInt16.insert("engine->evaluate(\"124\")", 124); - toUInt16.insert("engine->evaluate(\"0\")", 0); - toUInt16.insert("engine->evaluate(\"0.0\")", 0); - toUInt16.insert("engine->evaluate(\"123.0\")", 123); - toUInt16.insert("engine->evaluate(\"6.37e-8\")", 0); - toUInt16.insert("engine->evaluate(\"-6.37e-8\")", 0); - toUInt16.insert("engine->evaluate(\"0x43211234\")", 4660); - toUInt16.insert("engine->evaluate(\"0x10000\")", 0); - toUInt16.insert("engine->evaluate(\"0x10001\")", 1); - toUInt16.insert("engine->evaluate(\"NaN\")", 0); - toUInt16.insert("engine->evaluate(\"Infinity\")", 0); - toUInt16.insert("engine->evaluate(\"-Infinity\")", 0); - toUInt16.insert("engine->evaluate(\"'ciao'\")", 0); - toUInt16.insert("engine->evaluate(\"''\")", 0); - toUInt16.insert("engine->evaluate(\"'0'\")", 0); - toUInt16.insert("engine->evaluate(\"'123'\")", 123); - toUInt16.insert("engine->evaluate(\"'12.4'\")", 12); - toUInt16.insert("engine->nullValue()", 0); - toUInt16.insert("engine->undefinedValue()", 0); - toUInt16.insert("engine->newObject()", 0); - toUInt16.insert("engine->newArray()", 0); - toUInt16.insert("engine->newArray(10)", 0); - toUInt16.insert("engine->newDate(QDateTime())", 0); - toUInt16.insert("engine->newQMetaObject(&QObject::staticMetaObject)", 0); - toUInt16.insert("engine->newVariant(QVariant())", 0); - toUInt16.insert("engine->newVariant(QVariant(123))", 123); - toUInt16.insert("engine->newVariant(QVariant(false))", 0); - toUInt16.insert("engine->newQObject(0)", 0); - toUInt16.insert("engine->newQObject(engine)", 0); - } - newRow(expr) << toUInt16.value(expr); -} - -void tst_QScriptValue::toUInt16_test(const char*, const QScriptValue& value) -{ - QFETCH(quint16, expected); - QCOMPARE(value.toUInt16(), expected); - QCOMPARE(value.toUInt16(), expected); -} - -DEFINE_TEST_FUNCTION(toUInt16) - - -void tst_QScriptValue::equals_initData() -{ - QTest::addColumn("other"); - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::equals_makeData(const char *expr) -{ - static QSet equals; - if (equals.isEmpty()) { - equals.insert("QScriptValue() <=> QScriptValue()"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(true) <=> QScriptValue(true)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(false) <=> QScriptValue(false)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(false) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(false) <=> engine->newArray()"); - equals.insert("QScriptValue(false) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(uint(124)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0) <=> engine->newArray()"); - equals.insert("QScriptValue(0) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0.0) <=> engine->newArray()"); - equals.insert("QScriptValue(0.0) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(123.0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(false)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->newArray()"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(false)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(QString()) <=> engine->newArray()"); - equals.insert("QScriptValue(QString()) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(false)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, false) <=> engine->newArray()"); - equals.insert("QScriptValue(0, false) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, 0) <=> engine->newArray()"); - equals.insert("QScriptValue(0, 0) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->newArray()"); - equals.insert("QScriptValue(0, 0.0) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, 123.0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->newArray()"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->newArray()"); - equals.insert("QScriptValue(0, QString()) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, false) <=> engine->newArray()"); - equals.insert("QScriptValue(engine, false) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->newArray()"); - equals.insert("QScriptValue(engine, 0) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->newArray()"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->newArray()"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->newArray()"); - equals.insert("QScriptValue(engine, QString()) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")"); - equals.insert("engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->evaluate(\"{}\") <=> engine->evaluate(\"null\")"); - equals.insert("engine->evaluate(\"{}\") <=> engine->nullValue()"); - equals.insert("engine->evaluate(\"{}\") <=> engine->undefinedValue()"); - equals.insert("engine->evaluate(\"{}\") <=> engine->newQObject(0)"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->evaluate(\"null\")"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->nullValue()"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->undefinedValue()"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->newQObject(0)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"{}\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"null\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->nullValue()"); - equals.insert("engine->evaluate(\"null\") <=> engine->undefinedValue()"); - equals.insert("engine->evaluate(\"null\") <=> engine->newQObject(0)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->newArray()"); - equals.insert("engine->evaluate(\"false\") <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"124\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->newArray()"); - equals.insert("engine->evaluate(\"0\") <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->newArray()"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->newArray()"); - equals.insert("engine->evaluate(\"''\") <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->nullValue() <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"{}\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"null\")"); - equals.insert("engine->nullValue() <=> engine->nullValue()"); - equals.insert("engine->nullValue() <=> engine->undefinedValue()"); - equals.insert("engine->nullValue() <=> engine->newQObject(0)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->undefinedValue() <=> engine->evaluate(\"{}\")"); - equals.insert("engine->undefinedValue() <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->undefinedValue() <=> engine->evaluate(\"null\")"); - equals.insert("engine->undefinedValue() <=> engine->nullValue()"); - equals.insert("engine->undefinedValue() <=> engine->undefinedValue()"); - equals.insert("engine->undefinedValue() <=> engine->newQObject(0)"); - equals.insert("engine->newObject() <=> engine->newObject()"); - equals.insert("engine->newArray() <=> QScriptValue(false)"); - equals.insert("engine->newArray() <=> QScriptValue(0)"); - equals.insert("engine->newArray() <=> QScriptValue(0.0)"); - equals.insert("engine->newArray() <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->newArray() <=> QScriptValue(QString())"); - equals.insert("engine->newArray() <=> QScriptValue(0, false)"); - equals.insert("engine->newArray() <=> QScriptValue(0, 0)"); - equals.insert("engine->newArray() <=> QScriptValue(0, 0.0)"); - equals.insert("engine->newArray() <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->newArray() <=> QScriptValue(0, QString())"); - equals.insert("engine->newArray() <=> QScriptValue(engine, false)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, 0)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->newArray() <=> QScriptValue(engine, QString())"); - equals.insert("engine->newArray() <=> engine->evaluate(\"false\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"0\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"''\")"); - equals.insert("engine->newArray() <=> engine->newArray()"); - equals.insert("engine->newArray(10) <=> engine->newArray(10)"); - equals.insert("engine->newDate(QDateTime()) <=> engine->newDate(QDateTime())"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->newVariant(QVariant()) <=> engine->newVariant(QVariant())"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(123.0)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, 123.0)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(false)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0.0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(QString())"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, false)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0.0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString())"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, false)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString())"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"false\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"''\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"{}\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"null\")"); - equals.insert("engine->newQObject(0) <=> engine->nullValue()"); - equals.insert("engine->newQObject(0) <=> engine->undefinedValue()"); - equals.insert("engine->newQObject(0) <=> engine->newQObject(0)"); - equals.insert("engine->newQObject(engine) <=> engine->newQObject(engine)"); - } - QHash::const_iterator it; - for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { - QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); - newRow(tag.toLatin1()) << it.value() << equals.contains(tag); - } -} - -void tst_QScriptValue::equals_test(const char *, const QScriptValue& value) -{ - QFETCH(QScriptValue, other); - QFETCH(bool, expected); - QCOMPARE(value.equals(other), expected); -} - -DEFINE_TEST_FUNCTION(equals) - - -void tst_QScriptValue::strictlyEquals_initData() -{ - QTest::addColumn("other"); - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::strictlyEquals_makeData(const char *expr) -{ - static QSet equals; - if (equals.isEmpty()) { - equals.insert("QScriptValue() <=> QScriptValue()"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(true) <=> QScriptValue(true)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(false) <=> QScriptValue(false)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(uint(124)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")"); - equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")"); - equals.insert("engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->evaluate(\"{}\") <=> engine->undefinedValue()"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->evaluate(\"undefined\") <=> engine->undefinedValue()"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"null\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->nullValue()"); - equals.insert("engine->evaluate(\"null\") <=> engine->newQObject(0)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"124\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"null\")"); - equals.insert("engine->nullValue() <=> engine->nullValue()"); - equals.insert("engine->nullValue() <=> engine->newQObject(0)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)"); - equals.insert("engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); - equals.insert("engine->undefinedValue() <=> engine->evaluate(\"{}\")"); - equals.insert("engine->undefinedValue() <=> engine->evaluate(\"undefined\")"); - equals.insert("engine->undefinedValue() <=> engine->undefinedValue()"); - equals.insert("engine->newObject() <=> engine->newObject()"); - equals.insert("engine->newArray() <=> engine->newArray()"); - equals.insert("engine->newArray(10) <=> engine->newArray(10)"); - equals.insert("engine->newDate(QDateTime()) <=> engine->newDate(QDateTime())"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->newVariant(QVariant()) <=> engine->newVariant(QVariant())"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"null\")"); - equals.insert("engine->newQObject(0) <=> engine->nullValue()"); - equals.insert("engine->newQObject(0) <=> engine->newQObject(0)"); - equals.insert("engine->newQObject(engine) <=> engine->newQObject(engine)"); - } - QHash::const_iterator it; - for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { - QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); - newRow(tag.toLatin1()) << it.value() << equals.contains(tag); - } -} - -void tst_QScriptValue::strictlyEquals_test(const char *, const QScriptValue& value) -{ - QFETCH(QScriptValue, other); - QFETCH(bool, expected); - QCOMPARE(value.strictlyEquals(other), expected); -} - -DEFINE_TEST_FUNCTION(strictlyEquals) - - -void tst_QScriptValue::lessThan_initData() -{ - QTest::addColumn("other"); - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::lessThan_makeData(const char *expr) -{ - static QSet equals; - if (equals.isEmpty()) { - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(true)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(true) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(true) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(true) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(true) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(true) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(true) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(true) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(true) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(true) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(true) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(true) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(false) <=> QScriptValue(true)"); - equals.insert("QScriptValue(false) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(false) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(false) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(false) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(false) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(false) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(false) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(false) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(false) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(int(122)) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(int(122)) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(int(122)) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(uint(124)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(uint(124)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(uint(124)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(uint(124)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(uint(124)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0.0) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0.0) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0.0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(123.0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(123.0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(true)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(6.37e-8) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(true)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(false)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->nullValue()"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->newArray()"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(-6.37e-8) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0x43211234) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0x43211234) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0x10000) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0x10000) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0x10000) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0x10000) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0x10001) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0x10001) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0x10001) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(true)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(false)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(-qInf()) <=> engine->nullValue()"); - equals.insert("QScriptValue(-qInf()) <=> engine->newArray()"); - equals.insert("QScriptValue(-qInf()) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(-qInf()) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(-qInf()) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(\"NaN\") <=> engine->newObject()"); - equals.insert("QScriptValue(\"NaN\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(\"NaN\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(\"Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->newObject()"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(\"Infinity\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(true)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(false)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->nullValue()"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->newObject()"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->newQObject(0)"); - equals.insert("QScriptValue(\"-Infinity\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(true)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->newObject()"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->newArray(10)"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(QString(\"\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(true)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(QString()) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(QString()) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(QString()) <=> engine->newObject()"); - equals.insert("QScriptValue(QString()) <=> engine->newArray(10)"); - equals.insert("QScriptValue(QString()) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(QString()) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(QString()) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(true)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->newObject()"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(QString(\"0\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->newObject()"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(QString(\"123\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->newObject()"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(QString(\"12.4\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, true) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, true) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, false) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, false) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, false) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, int(122)) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, int(122)) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, int(122)) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, uint(124)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, uint(124)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, uint(124)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, uint(124)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, uint(124)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, 0) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, 0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, 0.0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, 123.0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, 123.0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, 6.37e-8) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->nullValue()"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->newArray()"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, -6.37e-8) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, 0x43211234) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, 0x10000) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, 0x10000) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, 0x10001) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, 0x10001) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->nullValue()"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->newArray()"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, -qInf()) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->newObject()"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, \"NaN\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->newObject()"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, \"Infinity\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(false)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->nullValue()"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->newObject()"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->newQObject(0)"); - equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->newObject()"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->newArray(10)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, QString(\"\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, QString()) <=> engine->newObject()"); - equals.insert("QScriptValue(0, QString()) <=> engine->newArray(10)"); - equals.insert("QScriptValue(0, QString()) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, QString()) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, QString()) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(true)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->newObject()"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, QString(\"0\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->newObject()"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, QString(\"123\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->newObject()"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(0, QString(\"12.3\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, true) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, true) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, false) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, false) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, int(122)) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, int(122)) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, uint(124)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, uint(124)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, 0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, 0.0) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, 123.0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, 123.0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, 6.37e-8) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->nullValue()"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->newArray()"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, 0x10000) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, 0x10000) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, 0x10001) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, 0x10001) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(QString())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString())"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"[]\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"new Array()\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"''\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->nullValue()"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->newArray()"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, -qInf()) <=> engine->newQObject(0)"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->newObject()"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, \"NaN\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->newObject()"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, \"Infinity\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(false)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0.0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(-6.37e-8)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, false)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0.0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, -6.37e-8)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, false)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0.0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"null\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"false\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0.0\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->nullValue()"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->newObject()"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->newVariant(QVariant(false))"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->newQObject(0)"); - equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->newObject()"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->newArray(10)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, QString(\"\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(\"-Infinity\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"/foo/\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"'0'\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, QString()) <=> engine->newObject()"); - equals.insert("QScriptValue(engine, QString()) <=> engine->newArray(10)"); - equals.insert("QScriptValue(engine, QString()) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, QString()) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, QString()) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(true)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(6.37e-8)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, true)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, true)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"true\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->newObject()"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, QString(\"0\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->newObject()"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, QString(\"123\")) <=> engine->newQObject(engine)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(int(122))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(uint(124))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(123.0)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0x10000)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0x10001)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(qInf())"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(\"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(\"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, int(122))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, qInf())"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, int(122))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, uint(124))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 123.0)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 0x10000)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 0x10001)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, qInf())"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Object\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Array\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Number\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Function\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"new Object()\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"new Error()\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Undefined\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Null\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"True\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"False\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"122\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"124\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"123.0\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"0x10000\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"0x10001\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Infinity\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"'123'\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->newObject()"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->newVariant(QVariant(123))"); - equals.insert("QScriptValue(engine, QString(\"1.23\")) <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"[]\") <=> engine->newArray(10)"); - equals.insert("engine->evaluate(\"[]\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"[]\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"[]\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->newArray(10)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"Array\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Array\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Array\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Number\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Function\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Function\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"new Object()\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Object()\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Object()\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->newArray(10)"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"Undefined\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Undefined\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Undefined\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"Null\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"Null\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Null\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"Null\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Null\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"Null\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"Null\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"True\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"True\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"True\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"True\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"True\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"True\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"True\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"False\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"False\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"False\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"False\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"False\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"False\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"False\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"null\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"null\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"true\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"true\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"false\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"122\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"122\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"122\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"124\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"124\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"124\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"124\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"124\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"0\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"0.0\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"123.0\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"123.0\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"6.37e-8\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"null\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->nullValue()"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->newArray()"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->evaluate(\"-6.37e-8\") <=> engine->newQObject(0)"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"0x10000\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"0x10000\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"0x10001\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"0x10001\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(false)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0.0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(-6.37e-8)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(QString())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, false)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0.0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -6.37e-8)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, false)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0.0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -6.37e-8)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString())"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"[]\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"Array.prototype\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"new Array()\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"null\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"false\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0.0\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"''\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->nullValue()"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->newArray()"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->newVariant(QVariant(false))"); - equals.insert("engine->evaluate(\"-Infinity\") <=> engine->newQObject(0)"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(\"-Infinity\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"''\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"''\") <=> engine->newArray(10)"); - equals.insert("engine->evaluate(\"''\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"''\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"''\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(true)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(6.37e-8)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, true)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, true)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"true\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"'0'\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"'123'\") <=> engine->newQObject(engine)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(int(122))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(uint(124))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(123.0)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0x43211234)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0x10000)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0x10001)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(qInf())"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(\"NaN\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(\"ciao\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, int(122))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, uint(124))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 123.0)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, qInf())"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, int(122))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, qInf())"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Number\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Null\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"True\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"False\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"122\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"124\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->newObject()"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->evaluate(\"'12.4'\") <=> engine->newQObject(engine)"); - equals.insert("engine->nullValue() <=> QScriptValue(true)"); - equals.insert("engine->nullValue() <=> QScriptValue(int(122))"); - equals.insert("engine->nullValue() <=> QScriptValue(uint(124))"); - equals.insert("engine->nullValue() <=> QScriptValue(123.0)"); - equals.insert("engine->nullValue() <=> QScriptValue(6.37e-8)"); - equals.insert("engine->nullValue() <=> QScriptValue(0x43211234)"); - equals.insert("engine->nullValue() <=> QScriptValue(0x10000)"); - equals.insert("engine->nullValue() <=> QScriptValue(0x10001)"); - equals.insert("engine->nullValue() <=> QScriptValue(qInf())"); - equals.insert("engine->nullValue() <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->nullValue() <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->nullValue() <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->nullValue() <=> QScriptValue(0, true)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, int(122))"); - equals.insert("engine->nullValue() <=> QScriptValue(0, uint(124))"); - equals.insert("engine->nullValue() <=> QScriptValue(0, 123.0)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->nullValue() <=> QScriptValue(0, qInf())"); - equals.insert("engine->nullValue() <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->nullValue() <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->nullValue() <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, true)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, int(122))"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, qInf())"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->nullValue() <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"true\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"122\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"124\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->nullValue() <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->nullValue() <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->newObject() <=> QScriptValue(\"ciao\")"); - equals.insert("engine->newObject() <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newObject() <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->newObject() <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newObject() <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->newObject() <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newObject() <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"Array\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"Number\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"Function\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->newObject() <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->newArray() <=> QScriptValue(true)"); - equals.insert("engine->newArray() <=> QScriptValue(int(122))"); - equals.insert("engine->newArray() <=> QScriptValue(uint(124))"); - equals.insert("engine->newArray() <=> QScriptValue(123.0)"); - equals.insert("engine->newArray() <=> QScriptValue(6.37e-8)"); - equals.insert("engine->newArray() <=> QScriptValue(0x43211234)"); - equals.insert("engine->newArray() <=> QScriptValue(0x10000)"); - equals.insert("engine->newArray() <=> QScriptValue(0x10001)"); - equals.insert("engine->newArray() <=> QScriptValue(qInf())"); - equals.insert("engine->newArray() <=> QScriptValue(\"NaN\")"); - equals.insert("engine->newArray() <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->newArray() <=> QScriptValue(\"-Infinity\")"); - equals.insert("engine->newArray() <=> QScriptValue(\"ciao\")"); - equals.insert("engine->newArray() <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newArray() <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->newArray() <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->newArray() <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->newArray() <=> QScriptValue(0, true)"); - equals.insert("engine->newArray() <=> QScriptValue(0, int(122))"); - equals.insert("engine->newArray() <=> QScriptValue(0, uint(124))"); - equals.insert("engine->newArray() <=> QScriptValue(0, 123.0)"); - equals.insert("engine->newArray() <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->newArray() <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->newArray() <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->newArray() <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->newArray() <=> QScriptValue(0, qInf())"); - equals.insert("engine->newArray() <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->newArray() <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->newArray() <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("engine->newArray() <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->newArray() <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newArray() <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->newArray() <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->newArray() <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->newArray() <=> QScriptValue(engine, true)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, int(122))"); - equals.insert("engine->newArray() <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->newArray() <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->newArray() <=> QScriptValue(engine, qInf())"); - equals.insert("engine->newArray() <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->newArray() <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->newArray() <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("engine->newArray() <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->newArray() <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newArray() <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->newArray() <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->newArray() <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Array\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Number\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Function\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Null\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"True\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"False\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"true\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"122\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"124\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->newArray() <=> engine->newObject()"); - equals.insert("engine->newArray() <=> engine->newArray(10)"); - equals.insert("engine->newArray() <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->newArray() <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->newArray() <=> engine->newQObject(engine)"); - equals.insert("engine->newArray(10) <=> QScriptValue(\"NaN\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(\"-Infinity\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(\"ciao\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(QString(\"0\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, \"NaN\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, \"-Infinity\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, QString(\"0\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, \"NaN\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, \"-Infinity\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, QString(\"0\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->newArray(10) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Error.prototype\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Array\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Number\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Function\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"/foo/\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"new Error()\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Null\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"True\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"False\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"'0'\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->newArray(10) <=> engine->newObject()"); - equals.insert("engine->newArray(10) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - equals.insert("engine->newArray(10) <=> engine->newQObject(engine)"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(\"ciao\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Array\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Number\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Function\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(uint(124))"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0x43211234)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0x10000)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0x10001)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(qInf())"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, uint(124))"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, qInf())"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, qInf())"); - equals.insert("engine->newVariant(QVariant(123)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"124\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(true)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(int(122))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(uint(124))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(123.0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(6.37e-8)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0x43211234)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0x10000)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0x10001)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(qInf())"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, true)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, int(122))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, uint(124))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, 123.0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, qInf())"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, true)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, int(122))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, qInf())"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"true\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"122\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"124\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(true)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(int(122))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(uint(124))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(123.0)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(6.37e-8)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0x43211234)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0x10000)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0x10001)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(qInf())"); - equals.insert("engine->newQObject(0) <=> QScriptValue(\"Infinity\")"); - equals.insert("engine->newQObject(0) <=> QScriptValue(QString(\"123\"))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(QString(\"12.4\"))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, true)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, int(122))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, uint(124))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, 123.0)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, 6.37e-8)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, 0x43211234)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, 0x10000)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, 0x10001)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, qInf())"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, \"Infinity\")"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, QString(\"123\"))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(0, QString(\"12.3\"))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, true)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, int(122))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, uint(124))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, 123.0)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, 6.37e-8)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, 0x43211234)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, 0x10000)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, 0x10001)"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, qInf())"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, \"Infinity\")"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, QString(\"123\"))"); - equals.insert("engine->newQObject(0) <=> QScriptValue(engine, QString(\"1.23\"))"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"true\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"122\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"124\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"123.0\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"6.37e-8\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"0x43211234\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"0x10000\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"0x10001\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"Infinity\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"'123'\")"); - equals.insert("engine->newQObject(0) <=> engine->evaluate(\"'12.4'\")"); - equals.insert("engine->newQObject(0) <=> engine->newVariant(QVariant(123))"); - equals.insert("engine->newQObject(engine) <=> QScriptValue(\"ciao\")"); - equals.insert("engine->newQObject(engine) <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newQObject(engine) <=> QScriptValue(0, \"ciao\")"); - equals.insert("engine->newQObject(engine) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newQObject(engine) <=> QScriptValue(engine, \"ciao\")"); - equals.insert("engine->newQObject(engine) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Object.prototype\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Function.prototype\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Array\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Number\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Function\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"(function() { return 1; })\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"new Object()\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Undefined\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Null\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"True\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"False\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"'ciao'\")"); - equals.insert("engine->newQObject(engine) <=> engine->newObject()"); - equals.insert("engine->newQObject(engine) <=> engine->newQMetaObject(&QObject::staticMetaObject)"); - } - QHash::const_iterator it; - for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { - QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); - newRow(tag.toLatin1()) << it.value() << equals.contains(tag); - } -} - -void tst_QScriptValue::lessThan_test(const char *, const QScriptValue& value) -{ - QFETCH(QScriptValue, other); - QFETCH(bool, expected); - QCOMPARE(value.lessThan(other), expected); -} - -DEFINE_TEST_FUNCTION(lessThan) - - -void tst_QScriptValue::instanceOf_initData() -{ - QTest::addColumn("other"); - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::instanceOf_makeData(const char *expr) -{ - static QSet equals; - if (equals.isEmpty()) { - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"[]\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Object\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Array\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Array\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Number\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Number\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"Function\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Function\")"); - equals.insert("engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Array\")"); - equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"Null\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"True\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->evaluate(\"False\") <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newObject() <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newArray() <=> engine->evaluate(\"Array\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newArray(10) <=> engine->evaluate(\"Array\")"); - equals.insert("engine->newDate(QDateTime()) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newVariant(QVariant()) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newVariant(QVariant(123)) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newVariant(QVariant(false)) <=> engine->evaluate(\"Object\")"); - equals.insert("engine->newQObject(engine) <=> engine->evaluate(\"Object\")"); - } - QHash::const_iterator it; - for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { - QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); - newRow(tag.toLatin1()) << it.value() << equals.contains(tag); - } -} - -void tst_QScriptValue::instanceOf_test(const char *, const QScriptValue& value) -{ - QFETCH(QScriptValue, other); - QFETCH(bool, expected); - QCOMPARE(value.instanceOf(other), expected); -} - -DEFINE_TEST_FUNCTION(instanceOf) - - -void tst_QScriptValue::qscriptvalue_castQString_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::qscriptvalue_castQString_makeData(const char* expr) -{ - static QHash value; - if (value.isEmpty()) { - value.insert("QScriptValue()", ""); - value.insert("QScriptValue(QScriptValue::UndefinedValue)", ""); - value.insert("QScriptValue(QScriptValue::NullValue)", ""); - value.insert("QScriptValue(true)", "true"); - value.insert("QScriptValue(false)", "false"); - value.insert("QScriptValue(int(122))", "122"); - value.insert("QScriptValue(uint(124))", "124"); - value.insert("QScriptValue(0)", "0"); - value.insert("QScriptValue(0.0)", "0"); - value.insert("QScriptValue(123.0)", "123"); - value.insert("QScriptValue(6.37e-8)", "6.37e-8"); - value.insert("QScriptValue(-6.37e-8)", "-6.37e-8"); - value.insert("QScriptValue(0x43211234)", "1126240820"); - value.insert("QScriptValue(0x10000)", "65536"); - value.insert("QScriptValue(0x10001)", "65537"); - value.insert("QScriptValue(qSNaN())", "NaN"); - value.insert("QScriptValue(qQNaN())", "NaN"); - value.insert("QScriptValue(qInf())", "Infinity"); - value.insert("QScriptValue(-qInf())", "-Infinity"); - value.insert("QScriptValue(\"NaN\")", "NaN"); - value.insert("QScriptValue(\"Infinity\")", "Infinity"); - value.insert("QScriptValue(\"-Infinity\")", "-Infinity"); - value.insert("QScriptValue(\"ciao\")", "ciao"); - value.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", "ciao"); - value.insert("QScriptValue(QString(\"\"))", ""); - value.insert("QScriptValue(QString())", ""); - value.insert("QScriptValue(QString(\"0\"))", "0"); - value.insert("QScriptValue(QString(\"123\"))", "123"); - value.insert("QScriptValue(QString(\"12.4\"))", "12.4"); - value.insert("QScriptValue(0, QScriptValue::UndefinedValue)", ""); - value.insert("QScriptValue(0, QScriptValue::NullValue)", ""); - value.insert("QScriptValue(0, true)", "true"); - value.insert("QScriptValue(0, false)", "false"); - value.insert("QScriptValue(0, int(122))", "122"); - value.insert("QScriptValue(0, uint(124))", "124"); - value.insert("QScriptValue(0, 0)", "0"); - value.insert("QScriptValue(0, 0.0)", "0"); - value.insert("QScriptValue(0, 123.0)", "123"); - value.insert("QScriptValue(0, 6.37e-8)", "6.37e-8"); - value.insert("QScriptValue(0, -6.37e-8)", "-6.37e-8"); - value.insert("QScriptValue(0, 0x43211234)", "1126240820"); - value.insert("QScriptValue(0, 0x10000)", "65536"); - value.insert("QScriptValue(0, 0x10001)", "65537"); - value.insert("QScriptValue(0, qSNaN())", "NaN"); - value.insert("QScriptValue(0, qQNaN())", "NaN"); - value.insert("QScriptValue(0, qInf())", "Infinity"); - value.insert("QScriptValue(0, -qInf())", "-Infinity"); - value.insert("QScriptValue(0, \"NaN\")", "NaN"); - value.insert("QScriptValue(0, \"Infinity\")", "Infinity"); - value.insert("QScriptValue(0, \"-Infinity\")", "-Infinity"); - value.insert("QScriptValue(0, \"ciao\")", "ciao"); - value.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", "ciao"); - value.insert("QScriptValue(0, QString(\"\"))", ""); - value.insert("QScriptValue(0, QString())", ""); - value.insert("QScriptValue(0, QString(\"0\"))", "0"); - value.insert("QScriptValue(0, QString(\"123\"))", "123"); - value.insert("QScriptValue(0, QString(\"12.3\"))", "12.3"); - value.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", ""); - value.insert("QScriptValue(engine, QScriptValue::NullValue)", ""); - value.insert("QScriptValue(engine, true)", "true"); - value.insert("QScriptValue(engine, false)", "false"); - value.insert("QScriptValue(engine, int(122))", "122"); - value.insert("QScriptValue(engine, uint(124))", "124"); - value.insert("QScriptValue(engine, 0)", "0"); - value.insert("QScriptValue(engine, 0.0)", "0"); - value.insert("QScriptValue(engine, 123.0)", "123"); - value.insert("QScriptValue(engine, 6.37e-8)", "6.37e-8"); - value.insert("QScriptValue(engine, -6.37e-8)", "-6.37e-8"); - value.insert("QScriptValue(engine, 0x43211234)", "1126240820"); - value.insert("QScriptValue(engine, 0x10000)", "65536"); - value.insert("QScriptValue(engine, 0x10001)", "65537"); - value.insert("QScriptValue(engine, qSNaN())", "NaN"); - value.insert("QScriptValue(engine, qQNaN())", "NaN"); - value.insert("QScriptValue(engine, qInf())", "Infinity"); - value.insert("QScriptValue(engine, -qInf())", "-Infinity"); - value.insert("QScriptValue(engine, \"NaN\")", "NaN"); - value.insert("QScriptValue(engine, \"Infinity\")", "Infinity"); - value.insert("QScriptValue(engine, \"-Infinity\")", "-Infinity"); - value.insert("QScriptValue(engine, \"ciao\")", "ciao"); - value.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", "ciao"); - value.insert("QScriptValue(engine, QString(\"\"))", ""); - value.insert("QScriptValue(engine, QString())", ""); - value.insert("QScriptValue(engine, QString(\"0\"))", "0"); - value.insert("QScriptValue(engine, QString(\"123\"))", "123"); - value.insert("QScriptValue(engine, QString(\"1.23\"))", "1.23"); - value.insert("engine->evaluate(\"[]\")", ""); - value.insert("engine->evaluate(\"{}\")", ""); - value.insert("engine->evaluate(\"Object.prototype\")", "[object Object]"); - value.insert("engine->evaluate(\"Date.prototype\")", "Invalid Date"); - value.insert("engine->evaluate(\"Array.prototype\")", ""); - value.insert("engine->evaluate(\"Function.prototype\")", "function () {\n [native code]\n}"); - value.insert("engine->evaluate(\"Error.prototype\")", "Error: Unknown error"); - value.insert("engine->evaluate(\"Object\")", "function Object() {\n [native code]\n}"); - value.insert("engine->evaluate(\"Array\")", "function Array() {\n [native code]\n}"); - value.insert("engine->evaluate(\"Number\")", "function Number() {\n [native code]\n}"); - value.insert("engine->evaluate(\"Function\")", "function Function() {\n [native code]\n}"); - value.insert("engine->evaluate(\"(function() { return 1; })\")", "function () { return 1; }"); - value.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", "function () { return 'ciao'; }"); - value.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", "function () { throw new Error('foo'); }"); - value.insert("engine->evaluate(\"/foo/\")", "/foo/"); - value.insert("engine->evaluate(\"new Object()\")", "[object Object]"); - value.insert("engine->evaluate(\"new Array()\")", ""); - value.insert("engine->evaluate(\"new Error()\")", "Error: Unknown error"); - value.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", "22"); - value.insert("engine->evaluate(\"Undefined\")", "ReferenceError: Can't find variable: Undefined"); - value.insert("engine->evaluate(\"Null\")", "ReferenceError: Can't find variable: Null"); - value.insert("engine->evaluate(\"True\")", "ReferenceError: Can't find variable: True"); - value.insert("engine->evaluate(\"False\")", "ReferenceError: Can't find variable: False"); - value.insert("engine->evaluate(\"undefined\")", ""); - value.insert("engine->evaluate(\"null\")", ""); - value.insert("engine->evaluate(\"true\")", "true"); - value.insert("engine->evaluate(\"false\")", "false"); - value.insert("engine->evaluate(\"122\")", "122"); - value.insert("engine->evaluate(\"124\")", "124"); - value.insert("engine->evaluate(\"0\")", "0"); - value.insert("engine->evaluate(\"0.0\")", "0"); - value.insert("engine->evaluate(\"123.0\")", "123"); - value.insert("engine->evaluate(\"6.37e-8\")", "6.37e-8"); - value.insert("engine->evaluate(\"-6.37e-8\")", "-6.37e-8"); - value.insert("engine->evaluate(\"0x43211234\")", "1126240820"); - value.insert("engine->evaluate(\"0x10000\")", "65536"); - value.insert("engine->evaluate(\"0x10001\")", "65537"); - value.insert("engine->evaluate(\"NaN\")", "NaN"); - value.insert("engine->evaluate(\"Infinity\")", "Infinity"); - value.insert("engine->evaluate(\"-Infinity\")", "-Infinity"); - value.insert("engine->evaluate(\"'ciao'\")", "ciao"); - value.insert("engine->evaluate(\"''\")", ""); - value.insert("engine->evaluate(\"'0'\")", "0"); - value.insert("engine->evaluate(\"'123'\")", "123"); - value.insert("engine->evaluate(\"'12.4'\")", "12.4"); - value.insert("engine->nullValue()", ""); - value.insert("engine->undefinedValue()", ""); - value.insert("engine->newObject()", "[object Object]"); - value.insert("engine->newArray()", ""); - value.insert("engine->newArray(10)", ",,,,,,,,,"); - value.insert("engine->newDate(QDateTime())", "Invalid Date"); - value.insert("engine->newQMetaObject(&QObject::staticMetaObject)", "[object QMetaObject]"); - value.insert("engine->newVariant(QVariant())", "undefined"); - value.insert("engine->newVariant(QVariant(123))", "123"); - value.insert("engine->newVariant(QVariant(false))", "false"); - value.insert("engine->newQObject(0)", ""); - value.insert("engine->newQObject(engine)", "QScriptEngine(name = \"\")"); - } - newRow(expr) << value.value(expr); -} - -void tst_QScriptValue::qscriptvalue_castQString_test(const char*, const QScriptValue& value) -{ - QFETCH(QString, expected); - QCOMPARE(qscriptvalue_cast(value), expected); - QCOMPARE(qscriptvalue_cast(value), expected); -} - -DEFINE_TEST_FUNCTION(qscriptvalue_castQString) - - -void tst_QScriptValue::qscriptvalue_castqsreal_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::qscriptvalue_castqsreal_makeData(const char* expr) -{ - static QHash value; - if (value.isEmpty()) { - value.insert("QScriptValue()", 0); - value.insert("QScriptValue(QScriptValue::UndefinedValue)", qQNaN()); - value.insert("QScriptValue(QScriptValue::NullValue)", 0); - value.insert("QScriptValue(true)", 1); - value.insert("QScriptValue(false)", 0); - value.insert("QScriptValue(int(122))", 122); - value.insert("QScriptValue(uint(124))", 124); - value.insert("QScriptValue(0)", 0); - value.insert("QScriptValue(0.0)", 0); - value.insert("QScriptValue(123.0)", 123); - value.insert("QScriptValue(6.37e-8)", 6.369999999999999e-08); - value.insert("QScriptValue(-6.37e-8)", -6.369999999999999e-08); - value.insert("QScriptValue(0x43211234)", 1126240820); - value.insert("QScriptValue(0x10000)", 65536); - value.insert("QScriptValue(0x10001)", 65537); - value.insert("QScriptValue(qSNaN())", qQNaN()); - value.insert("QScriptValue(qQNaN())", qQNaN()); - value.insert("QScriptValue(qInf())", qInf()); - value.insert("QScriptValue(-qInf())", qInf()); - value.insert("QScriptValue(\"NaN\")", qQNaN()); - value.insert("QScriptValue(\"Infinity\")", qInf()); - value.insert("QScriptValue(\"-Infinity\")", qInf()); - value.insert("QScriptValue(\"ciao\")", qQNaN()); - value.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", qQNaN()); - value.insert("QScriptValue(QString(\"\"))", 0); - value.insert("QScriptValue(QString())", 0); - value.insert("QScriptValue(QString(\"0\"))", 0); - value.insert("QScriptValue(QString(\"123\"))", 123); - value.insert("QScriptValue(QString(\"12.4\"))", 12.4); - value.insert("QScriptValue(0, QScriptValue::UndefinedValue)", qQNaN()); - value.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(0, true)", 1); - value.insert("QScriptValue(0, false)", 0); - value.insert("QScriptValue(0, int(122))", 122); - value.insert("QScriptValue(0, uint(124))", 124); - value.insert("QScriptValue(0, 0)", 0); - value.insert("QScriptValue(0, 0.0)", 0); - value.insert("QScriptValue(0, 123.0)", 123); - value.insert("QScriptValue(0, 6.37e-8)", 6.369999999999999e-08); - value.insert("QScriptValue(0, -6.37e-8)", -6.369999999999999e-08); - value.insert("QScriptValue(0, 0x43211234)", 1126240820); - value.insert("QScriptValue(0, 0x10000)", 65536); - value.insert("QScriptValue(0, 0x10001)", 65537); - value.insert("QScriptValue(0, qSNaN())", qQNaN()); - value.insert("QScriptValue(0, qQNaN())", qQNaN()); - value.insert("QScriptValue(0, qInf())", qInf()); - value.insert("QScriptValue(0, -qInf())", qInf()); - value.insert("QScriptValue(0, \"NaN\")", qQNaN()); - value.insert("QScriptValue(0, \"Infinity\")", qInf()); - value.insert("QScriptValue(0, \"-Infinity\")", qInf()); - value.insert("QScriptValue(0, \"ciao\")", qQNaN()); - value.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", qQNaN()); - value.insert("QScriptValue(0, QString(\"\"))", 0); - value.insert("QScriptValue(0, QString())", 0); - value.insert("QScriptValue(0, QString(\"0\"))", 0); - value.insert("QScriptValue(0, QString(\"123\"))", 123); - value.insert("QScriptValue(0, QString(\"12.3\"))", 12.3); - value.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", qQNaN()); - value.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(engine, true)", 1); - value.insert("QScriptValue(engine, false)", 0); - value.insert("QScriptValue(engine, int(122))", 122); - value.insert("QScriptValue(engine, uint(124))", 124); - value.insert("QScriptValue(engine, 0)", 0); - value.insert("QScriptValue(engine, 0.0)", 0); - value.insert("QScriptValue(engine, 123.0)", 123); - value.insert("QScriptValue(engine, 6.37e-8)", 6.369999999999999e-08); - value.insert("QScriptValue(engine, -6.37e-8)", -6.369999999999999e-08); - value.insert("QScriptValue(engine, 0x43211234)", 1126240820); - value.insert("QScriptValue(engine, 0x10000)", 65536); - value.insert("QScriptValue(engine, 0x10001)", 65537); - value.insert("QScriptValue(engine, qSNaN())", qQNaN()); - value.insert("QScriptValue(engine, qQNaN())", qQNaN()); - value.insert("QScriptValue(engine, qInf())", qInf()); - value.insert("QScriptValue(engine, -qInf())", qInf()); - value.insert("QScriptValue(engine, \"NaN\")", qQNaN()); - value.insert("QScriptValue(engine, \"Infinity\")", qInf()); - value.insert("QScriptValue(engine, \"-Infinity\")", qInf()); - value.insert("QScriptValue(engine, \"ciao\")", qQNaN()); - value.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", qQNaN()); - value.insert("QScriptValue(engine, QString(\"\"))", 0); - value.insert("QScriptValue(engine, QString())", 0); - value.insert("QScriptValue(engine, QString(\"0\"))", 0); - value.insert("QScriptValue(engine, QString(\"123\"))", 123); - value.insert("QScriptValue(engine, QString(\"1.23\"))", 1.23); - value.insert("engine->evaluate(\"[]\")", 0); - value.insert("engine->evaluate(\"{}\")", qQNaN()); - value.insert("engine->evaluate(\"Object.prototype\")", qQNaN()); - value.insert("engine->evaluate(\"Date.prototype\")", qQNaN()); - value.insert("engine->evaluate(\"Array.prototype\")", 0); - value.insert("engine->evaluate(\"Function.prototype\")", qQNaN()); - value.insert("engine->evaluate(\"Error.prototype\")", qQNaN()); - value.insert("engine->evaluate(\"Object\")", qQNaN()); - value.insert("engine->evaluate(\"Array\")", qQNaN()); - value.insert("engine->evaluate(\"Number\")", qQNaN()); - value.insert("engine->evaluate(\"Function\")", qQNaN()); - value.insert("engine->evaluate(\"(function() { return 1; })\")", qQNaN()); - value.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", qQNaN()); - value.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", qQNaN()); - value.insert("engine->evaluate(\"/foo/\")", qQNaN()); - value.insert("engine->evaluate(\"new Object()\")", qQNaN()); - value.insert("engine->evaluate(\"new Array()\")", 0); - value.insert("engine->evaluate(\"new Error()\")", qQNaN()); - value.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - value.insert("engine->evaluate(\"Undefined\")", qQNaN()); - value.insert("engine->evaluate(\"Null\")", qQNaN()); - value.insert("engine->evaluate(\"True\")", qQNaN()); - value.insert("engine->evaluate(\"False\")", qQNaN()); - value.insert("engine->evaluate(\"undefined\")", qQNaN()); - value.insert("engine->evaluate(\"null\")", 0); - value.insert("engine->evaluate(\"true\")", 1); - value.insert("engine->evaluate(\"false\")", 0); - value.insert("engine->evaluate(\"122\")", 122); - value.insert("engine->evaluate(\"124\")", 124); - value.insert("engine->evaluate(\"0\")", 0); - value.insert("engine->evaluate(\"0.0\")", 0); - value.insert("engine->evaluate(\"123.0\")", 123); - value.insert("engine->evaluate(\"6.37e-8\")", 6.369999999999999e-08); - value.insert("engine->evaluate(\"-6.37e-8\")", -6.369999999999999e-08); - value.insert("engine->evaluate(\"0x43211234\")", 1126240820); - value.insert("engine->evaluate(\"0x10000\")", 65536); - value.insert("engine->evaluate(\"0x10001\")", 65537); - value.insert("engine->evaluate(\"NaN\")", qQNaN()); - value.insert("engine->evaluate(\"Infinity\")", qInf()); - value.insert("engine->evaluate(\"-Infinity\")", qInf()); - value.insert("engine->evaluate(\"'ciao'\")", qQNaN()); - value.insert("engine->evaluate(\"''\")", 0); - value.insert("engine->evaluate(\"'0'\")", 0); - value.insert("engine->evaluate(\"'123'\")", 123); - value.insert("engine->evaluate(\"'12.4'\")", 12.4); - value.insert("engine->nullValue()", 0); - value.insert("engine->undefinedValue()", qQNaN()); - value.insert("engine->newObject()", qQNaN()); - value.insert("engine->newArray()", 0); - value.insert("engine->newArray(10)", qQNaN()); - value.insert("engine->newDate(QDateTime())", qQNaN()); - value.insert("engine->newQMetaObject(&QObject::staticMetaObject)", qQNaN()); - value.insert("engine->newVariant(QVariant())", qQNaN()); - value.insert("engine->newVariant(QVariant(123))", 123); - value.insert("engine->newVariant(QVariant(false))", 0); - value.insert("engine->newQObject(0)", 0); - value.insert("engine->newQObject(engine)", qQNaN()); - } - newRow(expr) << value.value(expr); -} - -void tst_QScriptValue::qscriptvalue_castqsreal_test(const char*, const QScriptValue& value) -{ - QFETCH(qsreal, expected); - if (qIsNaN(expected)) { - QVERIFY(qIsNaN(qscriptvalue_cast(value))); - QVERIFY(qIsNaN(qscriptvalue_cast(value))); - return; - } - if (qIsInf(expected)) { - QVERIFY(qIsInf(qscriptvalue_cast(value))); - QVERIFY(qIsInf(qscriptvalue_cast(value))); - return; - } - QCOMPARE(qscriptvalue_cast(value), expected); - QCOMPARE(qscriptvalue_cast(value), expected); -} - -DEFINE_TEST_FUNCTION(qscriptvalue_castqsreal) - - -void tst_QScriptValue::qscriptvalue_castbool_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::qscriptvalue_castbool_makeData(const char* expr) -{ - static QHash value; - if (value.isEmpty()) { - value.insert("QScriptValue()", false); - value.insert("QScriptValue(QScriptValue::UndefinedValue)", false); - value.insert("QScriptValue(QScriptValue::NullValue)", false); - value.insert("QScriptValue(true)", true); - value.insert("QScriptValue(false)", false); - value.insert("QScriptValue(int(122))", true); - value.insert("QScriptValue(uint(124))", true); - value.insert("QScriptValue(0)", false); - value.insert("QScriptValue(0.0)", false); - value.insert("QScriptValue(123.0)", true); - value.insert("QScriptValue(6.37e-8)", true); - value.insert("QScriptValue(-6.37e-8)", true); - value.insert("QScriptValue(0x43211234)", true); - value.insert("QScriptValue(0x10000)", true); - value.insert("QScriptValue(0x10001)", true); - value.insert("QScriptValue(qSNaN())", false); - value.insert("QScriptValue(qQNaN())", false); - value.insert("QScriptValue(qInf())", true); - value.insert("QScriptValue(-qInf())", true); - value.insert("QScriptValue(\"NaN\")", true); - value.insert("QScriptValue(\"Infinity\")", true); - value.insert("QScriptValue(\"-Infinity\")", true); - value.insert("QScriptValue(\"ciao\")", true); - value.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true); - value.insert("QScriptValue(QString(\"\"))", false); - value.insert("QScriptValue(QString())", false); - value.insert("QScriptValue(QString(\"0\"))", true); - value.insert("QScriptValue(QString(\"123\"))", true); - value.insert("QScriptValue(QString(\"12.4\"))", true); - value.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false); - value.insert("QScriptValue(0, QScriptValue::NullValue)", false); - value.insert("QScriptValue(0, true)", true); - value.insert("QScriptValue(0, false)", false); - value.insert("QScriptValue(0, int(122))", true); - value.insert("QScriptValue(0, uint(124))", true); - value.insert("QScriptValue(0, 0)", false); - value.insert("QScriptValue(0, 0.0)", false); - value.insert("QScriptValue(0, 123.0)", true); - value.insert("QScriptValue(0, 6.37e-8)", true); - value.insert("QScriptValue(0, -6.37e-8)", true); - value.insert("QScriptValue(0, 0x43211234)", true); - value.insert("QScriptValue(0, 0x10000)", true); - value.insert("QScriptValue(0, 0x10001)", true); - value.insert("QScriptValue(0, qSNaN())", false); - value.insert("QScriptValue(0, qQNaN())", false); - value.insert("QScriptValue(0, qInf())", true); - value.insert("QScriptValue(0, -qInf())", true); - value.insert("QScriptValue(0, \"NaN\")", true); - value.insert("QScriptValue(0, \"Infinity\")", true); - value.insert("QScriptValue(0, \"-Infinity\")", true); - value.insert("QScriptValue(0, \"ciao\")", true); - value.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true); - value.insert("QScriptValue(0, QString(\"\"))", false); - value.insert("QScriptValue(0, QString())", false); - value.insert("QScriptValue(0, QString(\"0\"))", true); - value.insert("QScriptValue(0, QString(\"123\"))", true); - value.insert("QScriptValue(0, QString(\"12.3\"))", true); - value.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false); - value.insert("QScriptValue(engine, QScriptValue::NullValue)", false); - value.insert("QScriptValue(engine, true)", true); - value.insert("QScriptValue(engine, false)", false); - value.insert("QScriptValue(engine, int(122))", true); - value.insert("QScriptValue(engine, uint(124))", true); - value.insert("QScriptValue(engine, 0)", false); - value.insert("QScriptValue(engine, 0.0)", false); - value.insert("QScriptValue(engine, 123.0)", true); - value.insert("QScriptValue(engine, 6.37e-8)", true); - value.insert("QScriptValue(engine, -6.37e-8)", true); - value.insert("QScriptValue(engine, 0x43211234)", true); - value.insert("QScriptValue(engine, 0x10000)", true); - value.insert("QScriptValue(engine, 0x10001)", true); - value.insert("QScriptValue(engine, qSNaN())", false); - value.insert("QScriptValue(engine, qQNaN())", false); - value.insert("QScriptValue(engine, qInf())", true); - value.insert("QScriptValue(engine, -qInf())", true); - value.insert("QScriptValue(engine, \"NaN\")", true); - value.insert("QScriptValue(engine, \"Infinity\")", true); - value.insert("QScriptValue(engine, \"-Infinity\")", true); - value.insert("QScriptValue(engine, \"ciao\")", true); - value.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true); - value.insert("QScriptValue(engine, QString(\"\"))", false); - value.insert("QScriptValue(engine, QString())", false); - value.insert("QScriptValue(engine, QString(\"0\"))", true); - value.insert("QScriptValue(engine, QString(\"123\"))", true); - value.insert("QScriptValue(engine, QString(\"1.23\"))", true); - value.insert("engine->evaluate(\"[]\")", true); - value.insert("engine->evaluate(\"{}\")", false); - value.insert("engine->evaluate(\"Object.prototype\")", true); - value.insert("engine->evaluate(\"Date.prototype\")", true); - value.insert("engine->evaluate(\"Array.prototype\")", true); - value.insert("engine->evaluate(\"Function.prototype\")", true); - value.insert("engine->evaluate(\"Error.prototype\")", true); - value.insert("engine->evaluate(\"Object\")", true); - value.insert("engine->evaluate(\"Array\")", true); - value.insert("engine->evaluate(\"Number\")", true); - value.insert("engine->evaluate(\"Function\")", true); - value.insert("engine->evaluate(\"(function() { return 1; })\")", true); - value.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true); - value.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true); - value.insert("engine->evaluate(\"/foo/\")", true); - value.insert("engine->evaluate(\"new Object()\")", true); - value.insert("engine->evaluate(\"new Array()\")", true); - value.insert("engine->evaluate(\"new Error()\")", true); - value.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", true); - value.insert("engine->evaluate(\"Undefined\")", true); - value.insert("engine->evaluate(\"Null\")", true); - value.insert("engine->evaluate(\"True\")", true); - value.insert("engine->evaluate(\"False\")", true); - value.insert("engine->evaluate(\"undefined\")", false); - value.insert("engine->evaluate(\"null\")", false); - value.insert("engine->evaluate(\"true\")", true); - value.insert("engine->evaluate(\"false\")", false); - value.insert("engine->evaluate(\"122\")", true); - value.insert("engine->evaluate(\"124\")", true); - value.insert("engine->evaluate(\"0\")", false); - value.insert("engine->evaluate(\"0.0\")", false); - value.insert("engine->evaluate(\"123.0\")", true); - value.insert("engine->evaluate(\"6.37e-8\")", true); - value.insert("engine->evaluate(\"-6.37e-8\")", true); - value.insert("engine->evaluate(\"0x43211234\")", true); - value.insert("engine->evaluate(\"0x10000\")", true); - value.insert("engine->evaluate(\"0x10001\")", true); - value.insert("engine->evaluate(\"NaN\")", false); - value.insert("engine->evaluate(\"Infinity\")", true); - value.insert("engine->evaluate(\"-Infinity\")", true); - value.insert("engine->evaluate(\"'ciao'\")", true); - value.insert("engine->evaluate(\"''\")", false); - value.insert("engine->evaluate(\"'0'\")", true); - value.insert("engine->evaluate(\"'123'\")", true); - value.insert("engine->evaluate(\"'12.4'\")", true); - value.insert("engine->nullValue()", false); - value.insert("engine->undefinedValue()", false); - value.insert("engine->newObject()", true); - value.insert("engine->newArray()", true); - value.insert("engine->newArray(10)", true); - value.insert("engine->newDate(QDateTime())", true); - value.insert("engine->newQMetaObject(&QObject::staticMetaObject)", true); - value.insert("engine->newVariant(QVariant())", true); - value.insert("engine->newVariant(QVariant(123))", true); - value.insert("engine->newVariant(QVariant(false))", true); - value.insert("engine->newQObject(0)", false); - value.insert("engine->newQObject(engine)", true); - } - newRow(expr) << value.value(expr); -} - -void tst_QScriptValue::qscriptvalue_castbool_test(const char*, const QScriptValue& value) -{ - QFETCH(bool, expected); - QCOMPARE(qscriptvalue_cast(value), expected); - QCOMPARE(qscriptvalue_cast(value), expected); -} - -DEFINE_TEST_FUNCTION(qscriptvalue_castbool) - - -void tst_QScriptValue::qscriptvalue_castqint32_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::qscriptvalue_castqint32_makeData(const char* expr) -{ - static QHash value; - if (value.isEmpty()) { - value.insert("QScriptValue()", 0); - value.insert("QScriptValue(QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(QScriptValue::NullValue)", 0); - value.insert("QScriptValue(true)", 1); - value.insert("QScriptValue(false)", 0); - value.insert("QScriptValue(int(122))", 122); - value.insert("QScriptValue(uint(124))", 124); - value.insert("QScriptValue(0)", 0); - value.insert("QScriptValue(0.0)", 0); - value.insert("QScriptValue(123.0)", 123); - value.insert("QScriptValue(6.37e-8)", 0); - value.insert("QScriptValue(-6.37e-8)", 0); - value.insert("QScriptValue(0x43211234)", 1126240820); - value.insert("QScriptValue(0x10000)", 65536); - value.insert("QScriptValue(0x10001)", 65537); - value.insert("QScriptValue(qSNaN())", 0); - value.insert("QScriptValue(qQNaN())", 0); - value.insert("QScriptValue(qInf())", 0); - value.insert("QScriptValue(-qInf())", 0); - value.insert("QScriptValue(\"NaN\")", 0); - value.insert("QScriptValue(\"Infinity\")", 0); - value.insert("QScriptValue(\"-Infinity\")", 0); - value.insert("QScriptValue(\"ciao\")", 0); - value.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(QString(\"\"))", 0); - value.insert("QScriptValue(QString())", 0); - value.insert("QScriptValue(QString(\"0\"))", 0); - value.insert("QScriptValue(QString(\"123\"))", 123); - value.insert("QScriptValue(QString(\"12.4\"))", 12); - value.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(0, true)", 1); - value.insert("QScriptValue(0, false)", 0); - value.insert("QScriptValue(0, int(122))", 122); - value.insert("QScriptValue(0, uint(124))", 124); - value.insert("QScriptValue(0, 0)", 0); - value.insert("QScriptValue(0, 0.0)", 0); - value.insert("QScriptValue(0, 123.0)", 123); - value.insert("QScriptValue(0, 6.37e-8)", 0); - value.insert("QScriptValue(0, -6.37e-8)", 0); - value.insert("QScriptValue(0, 0x43211234)", 1126240820); - value.insert("QScriptValue(0, 0x10000)", 65536); - value.insert("QScriptValue(0, 0x10001)", 65537); - value.insert("QScriptValue(0, qSNaN())", 0); - value.insert("QScriptValue(0, qQNaN())", 0); - value.insert("QScriptValue(0, qInf())", 0); - value.insert("QScriptValue(0, -qInf())", 0); - value.insert("QScriptValue(0, \"NaN\")", 0); - value.insert("QScriptValue(0, \"Infinity\")", 0); - value.insert("QScriptValue(0, \"-Infinity\")", 0); - value.insert("QScriptValue(0, \"ciao\")", 0); - value.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(0, QString(\"\"))", 0); - value.insert("QScriptValue(0, QString())", 0); - value.insert("QScriptValue(0, QString(\"0\"))", 0); - value.insert("QScriptValue(0, QString(\"123\"))", 123); - value.insert("QScriptValue(0, QString(\"12.3\"))", 12); - value.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(engine, true)", 1); - value.insert("QScriptValue(engine, false)", 0); - value.insert("QScriptValue(engine, int(122))", 122); - value.insert("QScriptValue(engine, uint(124))", 124); - value.insert("QScriptValue(engine, 0)", 0); - value.insert("QScriptValue(engine, 0.0)", 0); - value.insert("QScriptValue(engine, 123.0)", 123); - value.insert("QScriptValue(engine, 6.37e-8)", 0); - value.insert("QScriptValue(engine, -6.37e-8)", 0); - value.insert("QScriptValue(engine, 0x43211234)", 1126240820); - value.insert("QScriptValue(engine, 0x10000)", 65536); - value.insert("QScriptValue(engine, 0x10001)", 65537); - value.insert("QScriptValue(engine, qSNaN())", 0); - value.insert("QScriptValue(engine, qQNaN())", 0); - value.insert("QScriptValue(engine, qInf())", 0); - value.insert("QScriptValue(engine, -qInf())", 0); - value.insert("QScriptValue(engine, \"NaN\")", 0); - value.insert("QScriptValue(engine, \"Infinity\")", 0); - value.insert("QScriptValue(engine, \"-Infinity\")", 0); - value.insert("QScriptValue(engine, \"ciao\")", 0); - value.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(engine, QString(\"\"))", 0); - value.insert("QScriptValue(engine, QString())", 0); - value.insert("QScriptValue(engine, QString(\"0\"))", 0); - value.insert("QScriptValue(engine, QString(\"123\"))", 123); - value.insert("QScriptValue(engine, QString(\"1.23\"))", 1); - value.insert("engine->evaluate(\"[]\")", 0); - value.insert("engine->evaluate(\"{}\")", 0); - value.insert("engine->evaluate(\"Object.prototype\")", 0); - value.insert("engine->evaluate(\"Date.prototype\")", 0); - value.insert("engine->evaluate(\"Array.prototype\")", 0); - value.insert("engine->evaluate(\"Function.prototype\")", 0); - value.insert("engine->evaluate(\"Error.prototype\")", 0); - value.insert("engine->evaluate(\"Object\")", 0); - value.insert("engine->evaluate(\"Array\")", 0); - value.insert("engine->evaluate(\"Number\")", 0); - value.insert("engine->evaluate(\"Function\")", 0); - value.insert("engine->evaluate(\"(function() { return 1; })\")", 0); - value.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0); - value.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0); - value.insert("engine->evaluate(\"/foo/\")", 0); - value.insert("engine->evaluate(\"new Object()\")", 0); - value.insert("engine->evaluate(\"new Array()\")", 0); - value.insert("engine->evaluate(\"new Error()\")", 0); - value.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - value.insert("engine->evaluate(\"Undefined\")", 0); - value.insert("engine->evaluate(\"Null\")", 0); - value.insert("engine->evaluate(\"True\")", 0); - value.insert("engine->evaluate(\"False\")", 0); - value.insert("engine->evaluate(\"undefined\")", 0); - value.insert("engine->evaluate(\"null\")", 0); - value.insert("engine->evaluate(\"true\")", 1); - value.insert("engine->evaluate(\"false\")", 0); - value.insert("engine->evaluate(\"122\")", 122); - value.insert("engine->evaluate(\"124\")", 124); - value.insert("engine->evaluate(\"0\")", 0); - value.insert("engine->evaluate(\"0.0\")", 0); - value.insert("engine->evaluate(\"123.0\")", 123); - value.insert("engine->evaluate(\"6.37e-8\")", 0); - value.insert("engine->evaluate(\"-6.37e-8\")", 0); - value.insert("engine->evaluate(\"0x43211234\")", 1126240820); - value.insert("engine->evaluate(\"0x10000\")", 65536); - value.insert("engine->evaluate(\"0x10001\")", 65537); - value.insert("engine->evaluate(\"NaN\")", 0); - value.insert("engine->evaluate(\"Infinity\")", 0); - value.insert("engine->evaluate(\"-Infinity\")", 0); - value.insert("engine->evaluate(\"'ciao'\")", 0); - value.insert("engine->evaluate(\"''\")", 0); - value.insert("engine->evaluate(\"'0'\")", 0); - value.insert("engine->evaluate(\"'123'\")", 123); - value.insert("engine->evaluate(\"'12.4'\")", 12); - value.insert("engine->nullValue()", 0); - value.insert("engine->undefinedValue()", 0); - value.insert("engine->newObject()", 0); - value.insert("engine->newArray()", 0); - value.insert("engine->newArray(10)", 0); - value.insert("engine->newDate(QDateTime())", 0); - value.insert("engine->newQMetaObject(&QObject::staticMetaObject)", 0); - value.insert("engine->newVariant(QVariant())", 0); - value.insert("engine->newVariant(QVariant(123))", 123); - value.insert("engine->newVariant(QVariant(false))", 0); - value.insert("engine->newQObject(0)", 0); - value.insert("engine->newQObject(engine)", 0); - } - newRow(expr) << value.value(expr); -} - -void tst_QScriptValue::qscriptvalue_castqint32_test(const char*, const QScriptValue& value) -{ - QFETCH(qint32, expected); - QCOMPARE(qscriptvalue_cast(value), expected); - QCOMPARE(qscriptvalue_cast(value), expected); -} - -DEFINE_TEST_FUNCTION(qscriptvalue_castqint32) - - -void tst_QScriptValue::qscriptvalue_castquint32_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::qscriptvalue_castquint32_makeData(const char* expr) -{ - static QHash value; - if (value.isEmpty()) { - value.insert("QScriptValue()", 0); - value.insert("QScriptValue(QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(QScriptValue::NullValue)", 0); - value.insert("QScriptValue(true)", 1); - value.insert("QScriptValue(false)", 0); - value.insert("QScriptValue(int(122))", 122); - value.insert("QScriptValue(uint(124))", 124); - value.insert("QScriptValue(0)", 0); - value.insert("QScriptValue(0.0)", 0); - value.insert("QScriptValue(123.0)", 123); - value.insert("QScriptValue(6.37e-8)", 0); - value.insert("QScriptValue(-6.37e-8)", 0); - value.insert("QScriptValue(0x43211234)", 1126240820); - value.insert("QScriptValue(0x10000)", 65536); - value.insert("QScriptValue(0x10001)", 65537); - value.insert("QScriptValue(qSNaN())", 0); - value.insert("QScriptValue(qQNaN())", 0); - value.insert("QScriptValue(qInf())", 0); - value.insert("QScriptValue(-qInf())", 0); - value.insert("QScriptValue(\"NaN\")", 0); - value.insert("QScriptValue(\"Infinity\")", 0); - value.insert("QScriptValue(\"-Infinity\")", 0); - value.insert("QScriptValue(\"ciao\")", 0); - value.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(QString(\"\"))", 0); - value.insert("QScriptValue(QString())", 0); - value.insert("QScriptValue(QString(\"0\"))", 0); - value.insert("QScriptValue(QString(\"123\"))", 123); - value.insert("QScriptValue(QString(\"12.4\"))", 12); - value.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(0, true)", 1); - value.insert("QScriptValue(0, false)", 0); - value.insert("QScriptValue(0, int(122))", 122); - value.insert("QScriptValue(0, uint(124))", 124); - value.insert("QScriptValue(0, 0)", 0); - value.insert("QScriptValue(0, 0.0)", 0); - value.insert("QScriptValue(0, 123.0)", 123); - value.insert("QScriptValue(0, 6.37e-8)", 0); - value.insert("QScriptValue(0, -6.37e-8)", 0); - value.insert("QScriptValue(0, 0x43211234)", 1126240820); - value.insert("QScriptValue(0, 0x10000)", 65536); - value.insert("QScriptValue(0, 0x10001)", 65537); - value.insert("QScriptValue(0, qSNaN())", 0); - value.insert("QScriptValue(0, qQNaN())", 0); - value.insert("QScriptValue(0, qInf())", 0); - value.insert("QScriptValue(0, -qInf())", 0); - value.insert("QScriptValue(0, \"NaN\")", 0); - value.insert("QScriptValue(0, \"Infinity\")", 0); - value.insert("QScriptValue(0, \"-Infinity\")", 0); - value.insert("QScriptValue(0, \"ciao\")", 0); - value.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(0, QString(\"\"))", 0); - value.insert("QScriptValue(0, QString())", 0); - value.insert("QScriptValue(0, QString(\"0\"))", 0); - value.insert("QScriptValue(0, QString(\"123\"))", 123); - value.insert("QScriptValue(0, QString(\"12.3\"))", 12); - value.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(engine, true)", 1); - value.insert("QScriptValue(engine, false)", 0); - value.insert("QScriptValue(engine, int(122))", 122); - value.insert("QScriptValue(engine, uint(124))", 124); - value.insert("QScriptValue(engine, 0)", 0); - value.insert("QScriptValue(engine, 0.0)", 0); - value.insert("QScriptValue(engine, 123.0)", 123); - value.insert("QScriptValue(engine, 6.37e-8)", 0); - value.insert("QScriptValue(engine, -6.37e-8)", 0); - value.insert("QScriptValue(engine, 0x43211234)", 1126240820); - value.insert("QScriptValue(engine, 0x10000)", 65536); - value.insert("QScriptValue(engine, 0x10001)", 65537); - value.insert("QScriptValue(engine, qSNaN())", 0); - value.insert("QScriptValue(engine, qQNaN())", 0); - value.insert("QScriptValue(engine, qInf())", 0); - value.insert("QScriptValue(engine, -qInf())", 0); - value.insert("QScriptValue(engine, \"NaN\")", 0); - value.insert("QScriptValue(engine, \"Infinity\")", 0); - value.insert("QScriptValue(engine, \"-Infinity\")", 0); - value.insert("QScriptValue(engine, \"ciao\")", 0); - value.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(engine, QString(\"\"))", 0); - value.insert("QScriptValue(engine, QString())", 0); - value.insert("QScriptValue(engine, QString(\"0\"))", 0); - value.insert("QScriptValue(engine, QString(\"123\"))", 123); - value.insert("QScriptValue(engine, QString(\"1.23\"))", 1); - value.insert("engine->evaluate(\"[]\")", 0); - value.insert("engine->evaluate(\"{}\")", 0); - value.insert("engine->evaluate(\"Object.prototype\")", 0); - value.insert("engine->evaluate(\"Date.prototype\")", 0); - value.insert("engine->evaluate(\"Array.prototype\")", 0); - value.insert("engine->evaluate(\"Function.prototype\")", 0); - value.insert("engine->evaluate(\"Error.prototype\")", 0); - value.insert("engine->evaluate(\"Object\")", 0); - value.insert("engine->evaluate(\"Array\")", 0); - value.insert("engine->evaluate(\"Number\")", 0); - value.insert("engine->evaluate(\"Function\")", 0); - value.insert("engine->evaluate(\"(function() { return 1; })\")", 0); - value.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0); - value.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0); - value.insert("engine->evaluate(\"/foo/\")", 0); - value.insert("engine->evaluate(\"new Object()\")", 0); - value.insert("engine->evaluate(\"new Array()\")", 0); - value.insert("engine->evaluate(\"new Error()\")", 0); - value.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - value.insert("engine->evaluate(\"Undefined\")", 0); - value.insert("engine->evaluate(\"Null\")", 0); - value.insert("engine->evaluate(\"True\")", 0); - value.insert("engine->evaluate(\"False\")", 0); - value.insert("engine->evaluate(\"undefined\")", 0); - value.insert("engine->evaluate(\"null\")", 0); - value.insert("engine->evaluate(\"true\")", 1); - value.insert("engine->evaluate(\"false\")", 0); - value.insert("engine->evaluate(\"122\")", 122); - value.insert("engine->evaluate(\"124\")", 124); - value.insert("engine->evaluate(\"0\")", 0); - value.insert("engine->evaluate(\"0.0\")", 0); - value.insert("engine->evaluate(\"123.0\")", 123); - value.insert("engine->evaluate(\"6.37e-8\")", 0); - value.insert("engine->evaluate(\"-6.37e-8\")", 0); - value.insert("engine->evaluate(\"0x43211234\")", 1126240820); - value.insert("engine->evaluate(\"0x10000\")", 65536); - value.insert("engine->evaluate(\"0x10001\")", 65537); - value.insert("engine->evaluate(\"NaN\")", 0); - value.insert("engine->evaluate(\"Infinity\")", 0); - value.insert("engine->evaluate(\"-Infinity\")", 0); - value.insert("engine->evaluate(\"'ciao'\")", 0); - value.insert("engine->evaluate(\"''\")", 0); - value.insert("engine->evaluate(\"'0'\")", 0); - value.insert("engine->evaluate(\"'123'\")", 123); - value.insert("engine->evaluate(\"'12.4'\")", 12); - value.insert("engine->nullValue()", 0); - value.insert("engine->undefinedValue()", 0); - value.insert("engine->newObject()", 0); - value.insert("engine->newArray()", 0); - value.insert("engine->newArray(10)", 0); - value.insert("engine->newDate(QDateTime())", 0); - value.insert("engine->newQMetaObject(&QObject::staticMetaObject)", 0); - value.insert("engine->newVariant(QVariant())", 0); - value.insert("engine->newVariant(QVariant(123))", 123); - value.insert("engine->newVariant(QVariant(false))", 0); - value.insert("engine->newQObject(0)", 0); - value.insert("engine->newQObject(engine)", 0); - } - newRow(expr) << value.value(expr); -} - -void tst_QScriptValue::qscriptvalue_castquint32_test(const char*, const QScriptValue& value) -{ - QFETCH(quint32, expected); - QCOMPARE(qscriptvalue_cast(value), expected); - QCOMPARE(qscriptvalue_cast(value), expected); -} - -DEFINE_TEST_FUNCTION(qscriptvalue_castquint32) - - -void tst_QScriptValue::qscriptvalue_castquint16_initData() -{ - QTest::addColumn("expected"); - initScriptValues(); -} - -void tst_QScriptValue::qscriptvalue_castquint16_makeData(const char* expr) -{ - static QHash value; - if (value.isEmpty()) { - value.insert("QScriptValue()", 0); - value.insert("QScriptValue(QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(QScriptValue::NullValue)", 0); - value.insert("QScriptValue(true)", 1); - value.insert("QScriptValue(false)", 0); - value.insert("QScriptValue(int(122))", 122); - value.insert("QScriptValue(uint(124))", 124); - value.insert("QScriptValue(0)", 0); - value.insert("QScriptValue(0.0)", 0); - value.insert("QScriptValue(123.0)", 123); - value.insert("QScriptValue(6.37e-8)", 0); - value.insert("QScriptValue(-6.37e-8)", 0); - value.insert("QScriptValue(0x43211234)", 4660); - value.insert("QScriptValue(0x10000)", 0); - value.insert("QScriptValue(0x10001)", 1); - value.insert("QScriptValue(qSNaN())", 0); - value.insert("QScriptValue(qQNaN())", 0); - value.insert("QScriptValue(qInf())", 0); - value.insert("QScriptValue(-qInf())", 0); - value.insert("QScriptValue(\"NaN\")", 0); - value.insert("QScriptValue(\"Infinity\")", 0); - value.insert("QScriptValue(\"-Infinity\")", 0); - value.insert("QScriptValue(\"ciao\")", 0); - value.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(QString(\"\"))", 0); - value.insert("QScriptValue(QString())", 0); - value.insert("QScriptValue(QString(\"0\"))", 0); - value.insert("QScriptValue(QString(\"123\"))", 123); - value.insert("QScriptValue(QString(\"12.4\"))", 12); - value.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(0, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(0, true)", 1); - value.insert("QScriptValue(0, false)", 0); - value.insert("QScriptValue(0, int(122))", 122); - value.insert("QScriptValue(0, uint(124))", 124); - value.insert("QScriptValue(0, 0)", 0); - value.insert("QScriptValue(0, 0.0)", 0); - value.insert("QScriptValue(0, 123.0)", 123); - value.insert("QScriptValue(0, 6.37e-8)", 0); - value.insert("QScriptValue(0, -6.37e-8)", 0); - value.insert("QScriptValue(0, 0x43211234)", 4660); - value.insert("QScriptValue(0, 0x10000)", 0); - value.insert("QScriptValue(0, 0x10001)", 1); - value.insert("QScriptValue(0, qSNaN())", 0); - value.insert("QScriptValue(0, qQNaN())", 0); - value.insert("QScriptValue(0, qInf())", 0); - value.insert("QScriptValue(0, -qInf())", 0); - value.insert("QScriptValue(0, \"NaN\")", 0); - value.insert("QScriptValue(0, \"Infinity\")", 0); - value.insert("QScriptValue(0, \"-Infinity\")", 0); - value.insert("QScriptValue(0, \"ciao\")", 0); - value.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(0, QString(\"\"))", 0); - value.insert("QScriptValue(0, QString())", 0); - value.insert("QScriptValue(0, QString(\"0\"))", 0); - value.insert("QScriptValue(0, QString(\"123\"))", 123); - value.insert("QScriptValue(0, QString(\"12.3\"))", 12); - value.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0); - value.insert("QScriptValue(engine, QScriptValue::NullValue)", 0); - value.insert("QScriptValue(engine, true)", 1); - value.insert("QScriptValue(engine, false)", 0); - value.insert("QScriptValue(engine, int(122))", 122); - value.insert("QScriptValue(engine, uint(124))", 124); - value.insert("QScriptValue(engine, 0)", 0); - value.insert("QScriptValue(engine, 0.0)", 0); - value.insert("QScriptValue(engine, 123.0)", 123); - value.insert("QScriptValue(engine, 6.37e-8)", 0); - value.insert("QScriptValue(engine, -6.37e-8)", 0); - value.insert("QScriptValue(engine, 0x43211234)", 4660); - value.insert("QScriptValue(engine, 0x10000)", 0); - value.insert("QScriptValue(engine, 0x10001)", 1); - value.insert("QScriptValue(engine, qSNaN())", 0); - value.insert("QScriptValue(engine, qQNaN())", 0); - value.insert("QScriptValue(engine, qInf())", 0); - value.insert("QScriptValue(engine, -qInf())", 0); - value.insert("QScriptValue(engine, \"NaN\")", 0); - value.insert("QScriptValue(engine, \"Infinity\")", 0); - value.insert("QScriptValue(engine, \"-Infinity\")", 0); - value.insert("QScriptValue(engine, \"ciao\")", 0); - value.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0); - value.insert("QScriptValue(engine, QString(\"\"))", 0); - value.insert("QScriptValue(engine, QString())", 0); - value.insert("QScriptValue(engine, QString(\"0\"))", 0); - value.insert("QScriptValue(engine, QString(\"123\"))", 123); - value.insert("QScriptValue(engine, QString(\"1.23\"))", 1); - value.insert("engine->evaluate(\"[]\")", 0); - value.insert("engine->evaluate(\"{}\")", 0); - value.insert("engine->evaluate(\"Object.prototype\")", 0); - value.insert("engine->evaluate(\"Date.prototype\")", 0); - value.insert("engine->evaluate(\"Array.prototype\")", 0); - value.insert("engine->evaluate(\"Function.prototype\")", 0); - value.insert("engine->evaluate(\"Error.prototype\")", 0); - value.insert("engine->evaluate(\"Object\")", 0); - value.insert("engine->evaluate(\"Array\")", 0); - value.insert("engine->evaluate(\"Number\")", 0); - value.insert("engine->evaluate(\"Function\")", 0); - value.insert("engine->evaluate(\"(function() { return 1; })\")", 0); - value.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0); - value.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0); - value.insert("engine->evaluate(\"/foo/\")", 0); - value.insert("engine->evaluate(\"new Object()\")", 0); - value.insert("engine->evaluate(\"new Array()\")", 0); - value.insert("engine->evaluate(\"new Error()\")", 0); - value.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22); - value.insert("engine->evaluate(\"Undefined\")", 0); - value.insert("engine->evaluate(\"Null\")", 0); - value.insert("engine->evaluate(\"True\")", 0); - value.insert("engine->evaluate(\"False\")", 0); - value.insert("engine->evaluate(\"undefined\")", 0); - value.insert("engine->evaluate(\"null\")", 0); - value.insert("engine->evaluate(\"true\")", 1); - value.insert("engine->evaluate(\"false\")", 0); - value.insert("engine->evaluate(\"122\")", 122); - value.insert("engine->evaluate(\"124\")", 124); - value.insert("engine->evaluate(\"0\")", 0); - value.insert("engine->evaluate(\"0.0\")", 0); - value.insert("engine->evaluate(\"123.0\")", 123); - value.insert("engine->evaluate(\"6.37e-8\")", 0); - value.insert("engine->evaluate(\"-6.37e-8\")", 0); - value.insert("engine->evaluate(\"0x43211234\")", 4660); - value.insert("engine->evaluate(\"0x10000\")", 0); - value.insert("engine->evaluate(\"0x10001\")", 1); - value.insert("engine->evaluate(\"NaN\")", 0); - value.insert("engine->evaluate(\"Infinity\")", 0); - value.insert("engine->evaluate(\"-Infinity\")", 0); - value.insert("engine->evaluate(\"'ciao'\")", 0); - value.insert("engine->evaluate(\"''\")", 0); - value.insert("engine->evaluate(\"'0'\")", 0); - value.insert("engine->evaluate(\"'123'\")", 123); - value.insert("engine->evaluate(\"'12.4'\")", 12); - value.insert("engine->nullValue()", 0); - value.insert("engine->undefinedValue()", 0); - value.insert("engine->newObject()", 0); - value.insert("engine->newArray()", 0); - value.insert("engine->newArray(10)", 0); - value.insert("engine->newDate(QDateTime())", 0); - value.insert("engine->newQMetaObject(&QObject::staticMetaObject)", 0); - value.insert("engine->newVariant(QVariant())", 0); - value.insert("engine->newVariant(QVariant(123))", 123); - value.insert("engine->newVariant(QVariant(false))", 0); - value.insert("engine->newQObject(0)", 0); - value.insert("engine->newQObject(engine)", 0); - } - newRow(expr) << value.value(expr); -} - -void tst_QScriptValue::qscriptvalue_castquint16_test(const char*, const QScriptValue& value) -{ - QFETCH(quint16, expected); - QCOMPARE(qscriptvalue_cast(value), expected); - QCOMPARE(qscriptvalue_cast(value), expected); -} - -DEFINE_TEST_FUNCTION(qscriptvalue_castquint16) diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_cast.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_cast.cpp new file mode 100644 index 0000000..e651810 --- /dev/null +++ b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_cast.cpp @@ -0,0 +1,1453 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +*************** This file has been generated. DO NOT MODIFY! **************** +****************************************************************************/ + +#include "tst_qscriptvalue.h" + + + +void tst_QScriptValue::qscriptvalue_castQString_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString qscriptvalue_castQString_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static QString qscriptvalue_castQString_valueArray [] = { + "", "", + "", "true", + "false", "122", + "124", "0", + "0", "123", + "6.37e-8", "-6.37e-8", + "1126240820", "65536", + "65537", "NaN", + "NaN", "Infinity", + "-Infinity", "NaN", + "Infinity", "-Infinity", + "ciao", "ciao", + "", "", + "0", "123", + "12.4", "", + "", "true", + "false", "122", + "124", "0", + "0", "123", + "6.37e-8", "-6.37e-8", + "1126240820", "65536", + "65537", "NaN", + "NaN", "Infinity", + "-Infinity", "NaN", + "Infinity", "-Infinity", + "ciao", "ciao", + "", "", + "0", "123", + "12.3", "", + "", "true", + "false", "122", + "124", "0", + "0", "123", + "6.37e-8", "-6.37e-8", + "1126240820", "65536", + "65537", "NaN", + "NaN", "Infinity", + "-Infinity", "NaN", + "Infinity", "-Infinity", + "ciao", "ciao", + "", "", + "0", "123", + "1.23", "", + "", "[object Object]", + "Invalid Date", "", + "function () {\n [native code]\n}", "Error: Unknown error", + "function Object() {\n [native code]\n}", "function Array() {\n [native code]\n}", + "function Number() {\n [native code]\n}", "function Function() {\n [native code]\n}", + "function () { return 1; }", "function () { return 'ciao'; }", + "function () { throw new Error('foo'); }", "/foo/", + "[object Object]", "", + "Error: Unknown error", "22", + "ReferenceError: Can't find variable: Undefined", "ReferenceError: Can't find variable: Null", + "ReferenceError: Can't find variable: True", "ReferenceError: Can't find variable: False", + "", "", + "true", "false", + "122", "124", + "0", "0", + "123", "6.37e-8", + "-6.37e-8", "1126240820", + "65536", "65537", + "NaN", "Infinity", + "-Infinity", "ciao", + "", "0", + "123", "12.4", + "", "", + "[object Object]", "", + ",,,,,,,,,", "Invalid Date", + "[object QMetaObject]", "undefined", + "123", "false", + "", "QScriptEngine(name = \"\")", }; +void tst_QScriptValue::qscriptvalue_castQString_makeData(const char* expr) +{ + static QHash value; + if (value.isEmpty()) { + value.reserve(142); + for (unsigned i = 0; i < 142; ++i) + value.insert(qscriptvalue_castQString_tagArray[i], qscriptvalue_castQString_valueArray[i]); + } + newRow(expr) << value.value(expr); +} + +void tst_QScriptValue::qscriptvalue_castQString_test(const char*, const QScriptValue& value) +{ + QFETCH(QString, expected); + QCOMPARE(qscriptvalue_cast(value), expected); + QCOMPARE(qscriptvalue_cast(value), expected); +} + +DEFINE_TEST_FUNCTION(qscriptvalue_castQString) + + +void tst_QScriptValue::qscriptvalue_castqsreal_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString qscriptvalue_castqsreal_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static qsreal qscriptvalue_castqsreal_valueArray [] = { + 0, qQNaN(), 0, 1, 0, 122, 124, 0, 0, 123, + 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), + qInf(), qInf(), qQNaN(), qQNaN(), 0, 0, 0, 123, 12.4, qQNaN(), + 0, 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, + 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(), + qQNaN(), qQNaN(), 0, 0, 0, 123, 12.3, qQNaN(), 0, 1, + 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536, + 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(), qQNaN(), qQNaN(), + 0, 0, 0, 123, 1.23, 0, qQNaN(), qQNaN(), qQNaN(), 0, + qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), + qQNaN(), 0, qQNaN(), 22, qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), 0, + 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, + 65536, 65537, qQNaN(), qInf(), qInf(), qQNaN(), 0, 0, 123, 12.4, + 0, qQNaN(), qQNaN(), 0, qQNaN(), qQNaN(), qQNaN(), qQNaN(), 123, 0, + 0, qQNaN(), }; +void tst_QScriptValue::qscriptvalue_castqsreal_makeData(const char* expr) +{ + static QHash value; + if (value.isEmpty()) { + value.reserve(142); + for (unsigned i = 0; i < 142; ++i) + value.insert(qscriptvalue_castqsreal_tagArray[i], qscriptvalue_castqsreal_valueArray[i]); + } + newRow(expr) << value.value(expr); +} + +void tst_QScriptValue::qscriptvalue_castqsreal_test(const char*, const QScriptValue& value) +{ + QFETCH(qsreal, expected); + if (qIsNaN(expected)) { + QVERIFY(qIsNaN(qscriptvalue_cast(value))); + QVERIFY(qIsNaN(qscriptvalue_cast(value))); + return; + } + if (qIsInf(expected)) { + QVERIFY(qIsInf(qscriptvalue_cast(value))); + QVERIFY(qIsInf(qscriptvalue_cast(value))); + return; + } + QCOMPARE(qscriptvalue_cast(value), expected); + QCOMPARE(qscriptvalue_cast(value), expected); +} + +DEFINE_TEST_FUNCTION(qscriptvalue_castqsreal) + + +void tst_QScriptValue::qscriptvalue_castbool_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString qscriptvalue_castbool_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static bool qscriptvalue_castbool_valueArray [] = { + false, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, true, + false, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + false, false, + true, false, + true, true, + false, false, + true, true, + true, true, + true, true, + false, true, + true, true, + false, true, + true, true, + false, false, + true, true, + true, true, + true, true, + true, true, + false, true, }; +void tst_QScriptValue::qscriptvalue_castbool_makeData(const char* expr) +{ + static QHash value; + if (value.isEmpty()) { + value.reserve(142); + for (unsigned i = 0; i < 142; ++i) + value.insert(qscriptvalue_castbool_tagArray[i], qscriptvalue_castbool_valueArray[i]); + } + newRow(expr) << value.value(expr); +} + +void tst_QScriptValue::qscriptvalue_castbool_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(qscriptvalue_cast(value), expected); + QCOMPARE(qscriptvalue_cast(value), expected); +} + +DEFINE_TEST_FUNCTION(qscriptvalue_castbool) + + +void tst_QScriptValue::qscriptvalue_castqint32_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString qscriptvalue_castqint32_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static qint32 qscriptvalue_castqint32_valueArray [] = { + 0, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 22, + 0, 0, + 0, 0, + 0, 0, + 1, 0, + 122, 124, + 0, 0, + 123, 0, + 0, 1126240820, + 65536, 65537, + 0, 0, + 0, 0, + 0, 0, + 123, 12, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 123, 0, + 0, 0, }; +void tst_QScriptValue::qscriptvalue_castqint32_makeData(const char* expr) +{ + static QHash value; + if (value.isEmpty()) { + value.reserve(142); + for (unsigned i = 0; i < 142; ++i) + value.insert(qscriptvalue_castqint32_tagArray[i], qscriptvalue_castqint32_valueArray[i]); + } + newRow(expr) << value.value(expr); +} + +void tst_QScriptValue::qscriptvalue_castqint32_test(const char*, const QScriptValue& value) +{ + QFETCH(qint32, expected); + QCOMPARE(qscriptvalue_cast(value), expected); + QCOMPARE(qscriptvalue_cast(value), expected); +} + +DEFINE_TEST_FUNCTION(qscriptvalue_castqint32) + + +void tst_QScriptValue::qscriptvalue_castquint32_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString qscriptvalue_castquint32_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static quint32 qscriptvalue_castquint32_valueArray [] = { + 0, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 22, + 0, 0, + 0, 0, + 0, 0, + 1, 0, + 122, 124, + 0, 0, + 123, 0, + 0, 1126240820, + 65536, 65537, + 0, 0, + 0, 0, + 0, 0, + 123, 12, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 123, 0, + 0, 0, }; +void tst_QScriptValue::qscriptvalue_castquint32_makeData(const char* expr) +{ + static QHash value; + if (value.isEmpty()) { + value.reserve(142); + for (unsigned i = 0; i < 142; ++i) + value.insert(qscriptvalue_castquint32_tagArray[i], qscriptvalue_castquint32_valueArray[i]); + } + newRow(expr) << value.value(expr); +} + +void tst_QScriptValue::qscriptvalue_castquint32_test(const char*, const QScriptValue& value) +{ + QFETCH(quint32, expected); + QCOMPARE(qscriptvalue_cast(value), expected); + QCOMPARE(qscriptvalue_cast(value), expected); +} + +DEFINE_TEST_FUNCTION(qscriptvalue_castquint32) + + +void tst_QScriptValue::qscriptvalue_castquint16_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString qscriptvalue_castquint16_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static quint16 qscriptvalue_castquint16_valueArray [] = { + 0, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 4660, 0, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 4660, 0, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 4660, 0, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 22, + 0, 0, + 0, 0, + 0, 0, + 1, 0, + 122, 124, + 0, 0, + 123, 0, + 0, 4660, + 0, 1, + 0, 0, + 0, 0, + 0, 0, + 123, 12, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 123, 0, + 0, 0, }; +void tst_QScriptValue::qscriptvalue_castquint16_makeData(const char* expr) +{ + static QHash value; + if (value.isEmpty()) { + value.reserve(142); + for (unsigned i = 0; i < 142; ++i) + value.insert(qscriptvalue_castquint16_tagArray[i], qscriptvalue_castquint16_valueArray[i]); + } + newRow(expr) << value.value(expr); +} + +void tst_QScriptValue::qscriptvalue_castquint16_test(const char*, const QScriptValue& value) +{ + QFETCH(quint16, expected); + QCOMPARE(qscriptvalue_cast(value), expected); + QCOMPARE(qscriptvalue_cast(value), expected); +} + +DEFINE_TEST_FUNCTION(qscriptvalue_castquint16) diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp new file mode 100644 index 0000000..6e1f8ee --- /dev/null +++ b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp @@ -0,0 +1,7026 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +*************** This file has been generated. DO NOT MODIFY! **************** +****************************************************************************/ + +#include "tst_qscriptvalue.h" + + + +void tst_QScriptValue::equals_initData() +{ + QTest::addColumn("other"); + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString equals_array [] = { + "QScriptValue() <=> QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->nullValue()", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->newQObject(0)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(QScriptValue::NullValue) <=> engine->undefinedValue()", + "QScriptValue(QScriptValue::NullValue) <=> engine->newQObject(0)", + "QScriptValue(true) <=> QScriptValue(true)", + "QScriptValue(true) <=> QScriptValue(0, true)", + "QScriptValue(true) <=> QScriptValue(engine, true)", + "QScriptValue(true) <=> engine->evaluate(\"true\")", + "QScriptValue(false) <=> QScriptValue(false)", + "QScriptValue(false) <=> QScriptValue(0)", + "QScriptValue(false) <=> QScriptValue(0.0)", + "QScriptValue(false) <=> QScriptValue(QString(\"\"))", + "QScriptValue(false) <=> QScriptValue(QString())", + "QScriptValue(false) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(false) <=> QScriptValue(0, false)", + "QScriptValue(false) <=> QScriptValue(0, 0)", + "QScriptValue(false) <=> QScriptValue(0, 0.0)", + "QScriptValue(false) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(false) <=> QScriptValue(0, QString())", + "QScriptValue(false) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(false) <=> QScriptValue(engine, false)", + "QScriptValue(false) <=> QScriptValue(engine, 0)", + "QScriptValue(false) <=> QScriptValue(engine, 0.0)", + "QScriptValue(false) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(false) <=> QScriptValue(engine, QString())", + "QScriptValue(false) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(false) <=> engine->evaluate(\"[]\")", + "QScriptValue(false) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(false) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(false) <=> engine->evaluate(\"false\")", + "QScriptValue(false) <=> engine->evaluate(\"0\")", + "QScriptValue(false) <=> engine->evaluate(\"0.0\")", + "QScriptValue(false) <=> engine->evaluate(\"''\")", + "QScriptValue(false) <=> engine->evaluate(\"'0'\")", + "QScriptValue(false) <=> engine->newArray()", + "QScriptValue(false) <=> engine->newVariant(QVariant(false))", + "QScriptValue(int(122)) <=> QScriptValue(int(122))", + "QScriptValue(int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0) <=> QScriptValue(false)", + "QScriptValue(0) <=> QScriptValue(0)", + "QScriptValue(0) <=> QScriptValue(0.0)", + "QScriptValue(0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0) <=> QScriptValue(QString())", + "QScriptValue(0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0) <=> QScriptValue(0, false)", + "QScriptValue(0) <=> QScriptValue(0, 0)", + "QScriptValue(0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0) <=> QScriptValue(0, QString())", + "QScriptValue(0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0) <=> QScriptValue(engine, false)", + "QScriptValue(0) <=> QScriptValue(engine, 0)", + "QScriptValue(0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0) <=> QScriptValue(engine, QString())", + "QScriptValue(0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0) <=> engine->evaluate(\"false\")", + "QScriptValue(0) <=> engine->evaluate(\"0\")", + "QScriptValue(0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0) <=> engine->evaluate(\"''\")", + "QScriptValue(0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0) <=> engine->newArray()", + "QScriptValue(0) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0.0) <=> QScriptValue(false)", + "QScriptValue(0.0) <=> QScriptValue(0)", + "QScriptValue(0.0) <=> QScriptValue(0.0)", + "QScriptValue(0.0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0.0) <=> QScriptValue(QString())", + "QScriptValue(0.0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0.0) <=> QScriptValue(0, false)", + "QScriptValue(0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0.0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0.0) <=> QScriptValue(0, QString())", + "QScriptValue(0.0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0.0) <=> QScriptValue(engine, false)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0.0) <=> QScriptValue(engine, QString())", + "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0.0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0.0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0.0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0.0) <=> engine->evaluate(\"false\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0.0) <=> engine->evaluate(\"''\")", + "QScriptValue(0.0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0.0) <=> engine->newArray()", + "QScriptValue(0.0) <=> engine->newVariant(QVariant(false))", + "QScriptValue(123.0) <=> QScriptValue(123.0)", + "QScriptValue(123.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(123.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(123.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(123.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(123.0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(qInf()) <=> QScriptValue(qInf())", + "QScriptValue(qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(-qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, -qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, -qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(false)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, false)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, false)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"[]\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"false\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(QString(\"\")) <=> engine->newArray()", + "QScriptValue(QString(\"\")) <=> engine->newVariant(QVariant(false))", + "QScriptValue(QString()) <=> QScriptValue(false)", + "QScriptValue(QString()) <=> QScriptValue(0)", + "QScriptValue(QString()) <=> QScriptValue(0.0)", + "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(QString())", + "QScriptValue(QString()) <=> QScriptValue(0, false)", + "QScriptValue(QString()) <=> QScriptValue(0, 0)", + "QScriptValue(QString()) <=> QScriptValue(0, 0.0)", + "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(0, QString())", + "QScriptValue(QString()) <=> QScriptValue(engine, false)", + "QScriptValue(QString()) <=> QScriptValue(engine, 0)", + "QScriptValue(QString()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(QString()) <=> engine->evaluate(\"[]\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(QString()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(QString()) <=> engine->evaluate(\"false\")", + "QScriptValue(QString()) <=> engine->evaluate(\"0\")", + "QScriptValue(QString()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(QString()) <=> engine->newArray()", + "QScriptValue(QString()) <=> engine->newVariant(QVariant(false))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(false)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, false)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, false)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"false\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(QString(\"0\")) <=> engine->newVariant(QVariant(false))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(123.0)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString(\"123\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->nullValue()", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->newQObject(0)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->undefinedValue()", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->newQObject(0)", + "QScriptValue(0, true) <=> QScriptValue(true)", + "QScriptValue(0, true) <=> QScriptValue(0, true)", + "QScriptValue(0, true) <=> QScriptValue(engine, true)", + "QScriptValue(0, true) <=> engine->evaluate(\"true\")", + "QScriptValue(0, false) <=> QScriptValue(false)", + "QScriptValue(0, false) <=> QScriptValue(0)", + "QScriptValue(0, false) <=> QScriptValue(0.0)", + "QScriptValue(0, false) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, false) <=> QScriptValue(QString())", + "QScriptValue(0, false) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, false) <=> QScriptValue(0, false)", + "QScriptValue(0, false) <=> QScriptValue(0, 0)", + "QScriptValue(0, false) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, false) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, false) <=> QScriptValue(0, QString())", + "QScriptValue(0, false) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, false) <=> QScriptValue(engine, false)", + "QScriptValue(0, false) <=> QScriptValue(engine, 0)", + "QScriptValue(0, false) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, false) <=> QScriptValue(engine, QString())", + "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, false) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, false) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, false) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, false) <=> engine->evaluate(\"false\")", + "QScriptValue(0, false) <=> engine->evaluate(\"0\")", + "QScriptValue(0, false) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, false) <=> engine->evaluate(\"''\")", + "QScriptValue(0, false) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, false) <=> engine->newArray()", + "QScriptValue(0, false) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 0) <=> QScriptValue(false)", + "QScriptValue(0, 0) <=> QScriptValue(0)", + "QScriptValue(0, 0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, 0) <=> QScriptValue(QString())", + "QScriptValue(0, 0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, 0) <=> QScriptValue(0, false)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, 0) <=> QScriptValue(0, QString())", + "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, 0) <=> QScriptValue(engine, false)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString())", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, 0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"false\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"''\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, 0) <=> engine->newArray()", + "QScriptValue(0, 0) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, 0.0) <=> QScriptValue(false)", + "QScriptValue(0, 0.0) <=> QScriptValue(0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(QString())", + "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, false)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString())", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, false)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString())", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"false\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"''\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, 0.0) <=> engine->newArray()", + "QScriptValue(0, 0.0) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, 123.0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(-qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, -qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(false)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, false)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, false)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"false\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString(\"\")) <=> engine->newArray()", + "QScriptValue(0, QString(\"\")) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, QString()) <=> QScriptValue(false)", + "QScriptValue(0, QString()) <=> QScriptValue(0)", + "QScriptValue(0, QString()) <=> QScriptValue(0.0)", + "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(QString())", + "QScriptValue(0, QString()) <=> QScriptValue(0, false)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 0)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString()) <=> QScriptValue(engine, false)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 0)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString()) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"false\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"0\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString()) <=> engine->newArray()", + "QScriptValue(0, QString()) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(false)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, false)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, false)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"false\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, QString(\"0\")) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(123.0)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString(\"123\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->nullValue()", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->newQObject(0)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->undefinedValue()", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->newQObject(0)", + "QScriptValue(engine, true) <=> QScriptValue(true)", + "QScriptValue(engine, true) <=> QScriptValue(0, true)", + "QScriptValue(engine, true) <=> QScriptValue(engine, true)", + "QScriptValue(engine, true) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, false) <=> QScriptValue(false)", + "QScriptValue(engine, false) <=> QScriptValue(0)", + "QScriptValue(engine, false) <=> QScriptValue(0.0)", + "QScriptValue(engine, false) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, false) <=> QScriptValue(QString())", + "QScriptValue(engine, false) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, false) <=> QScriptValue(0, false)", + "QScriptValue(engine, false) <=> QScriptValue(0, 0)", + "QScriptValue(engine, false) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, false) <=> QScriptValue(0, QString())", + "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, false) <=> QScriptValue(engine, false)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, false) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, false) <=> engine->newArray()", + "QScriptValue(engine, false) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 0) <=> QScriptValue(false)", + "QScriptValue(engine, 0) <=> QScriptValue(0)", + "QScriptValue(engine, 0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, 0) <=> QScriptValue(QString())", + "QScriptValue(engine, 0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, 0) <=> QScriptValue(0, false)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString())", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, false)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, 0) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, 0) <=> engine->newArray()", + "QScriptValue(engine, 0) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, 0.0) <=> QScriptValue(false)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString())", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, false)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString())", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, false)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, 0.0) <=> engine->newArray()", + "QScriptValue(engine, 0.0) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, 123.0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(-qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, -qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(false)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, false)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, false)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString(\"\")) <=> engine->newArray()", + "QScriptValue(engine, QString(\"\")) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, QString()) <=> QScriptValue(false)", + "QScriptValue(engine, QString()) <=> QScriptValue(0)", + "QScriptValue(engine, QString()) <=> QScriptValue(0.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(0, false)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 0)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, false)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString()) <=> engine->newArray()", + "QScriptValue(engine, QString()) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(false)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, false)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, false)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(123.0)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(false)", + "engine->evaluate(\"[]\") <=> QScriptValue(0)", + "engine->evaluate(\"[]\") <=> QScriptValue(0.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(QString())", + "engine->evaluate(\"[]\") <=> QScriptValue(0, false)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"{}\") <=> engine->nullValue()", + "engine->evaluate(\"{}\") <=> engine->undefinedValue()", + "engine->evaluate(\"{}\") <=> engine->newQObject(0)", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(false)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString())", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, false)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(false)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString())", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, false)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"undefined\") <=> engine->nullValue()", + "engine->evaluate(\"undefined\") <=> engine->undefinedValue()", + "engine->evaluate(\"undefined\") <=> engine->newQObject(0)", + "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"null\") <=> engine->nullValue()", + "engine->evaluate(\"null\") <=> engine->undefinedValue()", + "engine->evaluate(\"null\") <=> engine->newQObject(0)", + "engine->evaluate(\"true\") <=> QScriptValue(true)", + "engine->evaluate(\"true\") <=> QScriptValue(0, true)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"false\") <=> QScriptValue(false)", + "engine->evaluate(\"false\") <=> QScriptValue(0)", + "engine->evaluate(\"false\") <=> QScriptValue(0.0)", + "engine->evaluate(\"false\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"false\") <=> QScriptValue(QString())", + "engine->evaluate(\"false\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"false\") <=> QScriptValue(0, false)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"false\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"false\") <=> engine->newArray()", + "engine->evaluate(\"false\") <=> engine->newVariant(QVariant(false))", + "engine->evaluate(\"122\") <=> QScriptValue(int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"124\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"0\") <=> QScriptValue(false)", + "engine->evaluate(\"0\") <=> QScriptValue(0)", + "engine->evaluate(\"0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"0\") <=> QScriptValue(QString())", + "engine->evaluate(\"0\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"0\") <=> QScriptValue(0, false)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"0\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"0\") <=> engine->newArray()", + "engine->evaluate(\"0\") <=> engine->newVariant(QVariant(false))", + "engine->evaluate(\"0.0\") <=> QScriptValue(false)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString())", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, false)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"0.0\") <=> engine->newArray()", + "engine->evaluate(\"0.0\") <=> engine->newVariant(QVariant(false))", + "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"123.0\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\") <=> QScriptValue(false)", + "engine->evaluate(\"''\") <=> QScriptValue(0)", + "engine->evaluate(\"''\") <=> QScriptValue(0.0)", + "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(QString())", + "engine->evaluate(\"''\") <=> QScriptValue(0, false)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"''\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"''\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"''\") <=> engine->newArray()", + "engine->evaluate(\"''\") <=> engine->newVariant(QVariant(false))", + "engine->evaluate(\"'0'\") <=> QScriptValue(false)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, false)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"'0'\") <=> engine->newVariant(QVariant(false))", + "engine->evaluate(\"'123'\") <=> QScriptValue(123.0)", + "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"'123'\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")", + "engine->nullValue() <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->nullValue() <=> engine->evaluate(\"{}\")", + "engine->nullValue() <=> engine->evaluate(\"undefined\")", + "engine->nullValue() <=> engine->evaluate(\"null\")", + "engine->nullValue() <=> engine->nullValue()", + "engine->nullValue() <=> engine->undefinedValue()", + "engine->nullValue() <=> engine->newQObject(0)", + "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(QScriptValue::NullValue)", + "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->undefinedValue() <=> engine->evaluate(\"{}\")", + "engine->undefinedValue() <=> engine->evaluate(\"undefined\")", + "engine->undefinedValue() <=> engine->evaluate(\"null\")", + "engine->undefinedValue() <=> engine->nullValue()", + "engine->undefinedValue() <=> engine->undefinedValue()", + "engine->undefinedValue() <=> engine->newQObject(0)", + "engine->newObject() <=> engine->newObject()", + "engine->newArray() <=> QScriptValue(false)", + "engine->newArray() <=> QScriptValue(0)", + "engine->newArray() <=> QScriptValue(0.0)", + "engine->newArray() <=> QScriptValue(QString(\"\"))", + "engine->newArray() <=> QScriptValue(QString())", + "engine->newArray() <=> QScriptValue(0, false)", + "engine->newArray() <=> QScriptValue(0, 0)", + "engine->newArray() <=> QScriptValue(0, 0.0)", + "engine->newArray() <=> QScriptValue(0, QString(\"\"))", + "engine->newArray() <=> QScriptValue(0, QString())", + "engine->newArray() <=> QScriptValue(engine, false)", + "engine->newArray() <=> QScriptValue(engine, 0)", + "engine->newArray() <=> QScriptValue(engine, 0.0)", + "engine->newArray() <=> QScriptValue(engine, QString(\"\"))", + "engine->newArray() <=> QScriptValue(engine, QString())", + "engine->newArray() <=> engine->evaluate(\"false\")", + "engine->newArray() <=> engine->evaluate(\"0\")", + "engine->newArray() <=> engine->evaluate(\"0.0\")", + "engine->newArray() <=> engine->evaluate(\"''\")", + "engine->newArray() <=> engine->newArray()", + "engine->newArray(10) <=> engine->newArray(10)", + "engine->newDate(QDateTime()) <=> engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant()) <=> engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123)) <=> QScriptValue(123.0)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(QString(\"123\"))", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, 123.0)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, QString(\"123\"))", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 123.0)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, QString(\"123\"))", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"123.0\")", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"'123'\")", + "engine->newVariant(QVariant(123)) <=> engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(false)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0.0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(QString())", + "engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"0\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, false)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0.0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString())", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"0\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, false)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0.0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString())", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"0\"))", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"false\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0.0\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"''\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"'0'\")", + "engine->newVariant(QVariant(false)) <=> engine->newVariant(QVariant(false))", + "engine->newQObject(0) <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->newQObject(0) <=> QScriptValue(QScriptValue::NullValue)", + "engine->newQObject(0) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->newQObject(0) <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->newQObject(0) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->newQObject(0) <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->newQObject(0) <=> engine->evaluate(\"{}\")", + "engine->newQObject(0) <=> engine->evaluate(\"undefined\")", + "engine->newQObject(0) <=> engine->evaluate(\"null\")", + "engine->newQObject(0) <=> engine->nullValue()", + "engine->newQObject(0) <=> engine->undefinedValue()", + "engine->newQObject(0) <=> engine->newQObject(0)", + "engine->newQObject(engine) <=> engine->newQObject(engine)",}; + +void tst_QScriptValue::equals_makeData(const char *expr) +{ + static QSet equals; + if (equals.isEmpty()) { + equals.reserve(1217); + for (unsigned i = 0; i < 1217; ++i) + equals.insert(equals_array[i]); + } + QHash::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); + newRow(tag.toLatin1()) << it.value() << equals.contains(tag); + } +} + +void tst_QScriptValue::equals_test(const char *, const QScriptValue& value) +{ + QFETCH(QScriptValue, other); + QFETCH(bool, expected); + QCOMPARE(value.equals(other), expected); +} + +DEFINE_TEST_FUNCTION(equals) + + +void tst_QScriptValue::strictlyEquals_initData() +{ + QTest::addColumn("other"); + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString strictlyEquals_array [] = { + "QScriptValue() <=> QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(QScriptValue::NullValue) <=> engine->newQObject(0)", + "QScriptValue(true) <=> QScriptValue(true)", + "QScriptValue(true) <=> QScriptValue(0, true)", + "QScriptValue(true) <=> QScriptValue(engine, true)", + "QScriptValue(true) <=> engine->evaluate(\"true\")", + "QScriptValue(false) <=> QScriptValue(false)", + "QScriptValue(false) <=> QScriptValue(0, false)", + "QScriptValue(false) <=> QScriptValue(engine, false)", + "QScriptValue(false) <=> engine->evaluate(\"false\")", + "QScriptValue(int(122)) <=> QScriptValue(int(122))", + "QScriptValue(int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0) <=> QScriptValue(0)", + "QScriptValue(0) <=> QScriptValue(0.0)", + "QScriptValue(0) <=> QScriptValue(0, 0)", + "QScriptValue(0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0) <=> QScriptValue(engine, 0)", + "QScriptValue(0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0) <=> engine->evaluate(\"0\")", + "QScriptValue(0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0.0) <=> QScriptValue(0)", + "QScriptValue(0.0) <=> QScriptValue(0.0)", + "QScriptValue(0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(123.0) <=> QScriptValue(123.0)", + "QScriptValue(123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(qInf()) <=> QScriptValue(qInf())", + "QScriptValue(qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(QString())", + "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(0, QString())", + "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->newQObject(0)", + "QScriptValue(0, true) <=> QScriptValue(true)", + "QScriptValue(0, true) <=> QScriptValue(0, true)", + "QScriptValue(0, true) <=> QScriptValue(engine, true)", + "QScriptValue(0, true) <=> engine->evaluate(\"true\")", + "QScriptValue(0, false) <=> QScriptValue(false)", + "QScriptValue(0, false) <=> QScriptValue(0, false)", + "QScriptValue(0, false) <=> QScriptValue(engine, false)", + "QScriptValue(0, false) <=> engine->evaluate(\"false\")", + "QScriptValue(0, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 0) <=> QScriptValue(0)", + "QScriptValue(0, 0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 0.0) <=> QScriptValue(0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(QString())", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", + "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->newQObject(0)", + "QScriptValue(engine, true) <=> QScriptValue(true)", + "QScriptValue(engine, true) <=> QScriptValue(0, true)", + "QScriptValue(engine, true) <=> QScriptValue(engine, true)", + "QScriptValue(engine, true) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, false) <=> QScriptValue(false)", + "QScriptValue(engine, false) <=> QScriptValue(0, false)", + "QScriptValue(engine, false) <=> QScriptValue(engine, false)", + "QScriptValue(engine, false) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 0) <=> QScriptValue(0)", + "QScriptValue(engine, 0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 0.0) <=> QScriptValue(0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"{}\") <=> engine->undefinedValue()", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")", + "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")", + "engine->evaluate(\"undefined\") <=> engine->undefinedValue()", + "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"null\") <=> engine->nullValue()", + "engine->evaluate(\"null\") <=> engine->newQObject(0)", + "engine->evaluate(\"true\") <=> QScriptValue(true)", + "engine->evaluate(\"true\") <=> QScriptValue(0, true)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"false\") <=> QScriptValue(false)", + "engine->evaluate(\"false\") <=> QScriptValue(0, false)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"122\") <=> QScriptValue(int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"124\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"0\") <=> QScriptValue(0)", + "engine->evaluate(\"0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"0.0\") <=> QScriptValue(0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(QString())", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")", + "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->nullValue() <=> engine->evaluate(\"null\")", + "engine->nullValue() <=> engine->nullValue()", + "engine->nullValue() <=> engine->newQObject(0)", + "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->undefinedValue() <=> engine->evaluate(\"{}\")", + "engine->undefinedValue() <=> engine->evaluate(\"undefined\")", + "engine->undefinedValue() <=> engine->undefinedValue()", + "engine->newObject() <=> engine->newObject()", + "engine->newArray() <=> engine->newArray()", + "engine->newArray(10) <=> engine->newArray(10)", + "engine->newDate(QDateTime()) <=> engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant()) <=> engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123)) <=> engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false)) <=> engine->newVariant(QVariant(false))", + "engine->newQObject(0) <=> QScriptValue(QScriptValue::NullValue)", + "engine->newQObject(0) <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->newQObject(0) <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->newQObject(0) <=> engine->evaluate(\"null\")", + "engine->newQObject(0) <=> engine->nullValue()", + "engine->newQObject(0) <=> engine->newQObject(0)", + "engine->newQObject(engine) <=> engine->newQObject(engine)",}; + +void tst_QScriptValue::strictlyEquals_makeData(const char *expr) +{ + static QSet equals; + if (equals.isEmpty()) { + equals.reserve(523); + for (unsigned i = 0; i < 523; ++i) + equals.insert(strictlyEquals_array[i]); + } + QHash::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); + newRow(tag.toLatin1()) << it.value() << equals.contains(tag); + } +} + +void tst_QScriptValue::strictlyEquals_test(const char *, const QScriptValue& value) +{ + QFETCH(QScriptValue, other); + QFETCH(bool, expected); + QCOMPARE(value.strictlyEquals(other), expected); +} + +DEFINE_TEST_FUNCTION(strictlyEquals) + + +void tst_QScriptValue::lessThan_initData() +{ + QTest::addColumn("other"); + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString lessThan_array [] = { + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(true)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(int(122))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(uint(124))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(123.0)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(6.37e-8)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0x43211234)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0x10000)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0x10001)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(qInf())", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(\"Infinity\")", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, true)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, int(122))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, uint(124))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 123.0)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 0x10000)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, 0x10001)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, qInf())", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, true)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, int(122))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, uint(124))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 123.0)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, qInf())", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"true\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"122\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"124\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"123.0\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(QScriptValue::NullValue) <=> engine->newVariant(QVariant(123))", + "QScriptValue(true) <=> QScriptValue(int(122))", + "QScriptValue(true) <=> QScriptValue(uint(124))", + "QScriptValue(true) <=> QScriptValue(123.0)", + "QScriptValue(true) <=> QScriptValue(0x43211234)", + "QScriptValue(true) <=> QScriptValue(0x10000)", + "QScriptValue(true) <=> QScriptValue(0x10001)", + "QScriptValue(true) <=> QScriptValue(qInf())", + "QScriptValue(true) <=> QScriptValue(\"Infinity\")", + "QScriptValue(true) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(true) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(true) <=> QScriptValue(0, int(122))", + "QScriptValue(true) <=> QScriptValue(0, uint(124))", + "QScriptValue(true) <=> QScriptValue(0, 123.0)", + "QScriptValue(true) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(true) <=> QScriptValue(0, 0x10000)", + "QScriptValue(true) <=> QScriptValue(0, 0x10001)", + "QScriptValue(true) <=> QScriptValue(0, qInf())", + "QScriptValue(true) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(true) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(true) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(true) <=> QScriptValue(engine, int(122))", + "QScriptValue(true) <=> QScriptValue(engine, uint(124))", + "QScriptValue(true) <=> QScriptValue(engine, 123.0)", + "QScriptValue(true) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(true) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(true) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(true) <=> QScriptValue(engine, qInf())", + "QScriptValue(true) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(true) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(true) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(true) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(true) <=> engine->evaluate(\"122\")", + "QScriptValue(true) <=> engine->evaluate(\"124\")", + "QScriptValue(true) <=> engine->evaluate(\"123.0\")", + "QScriptValue(true) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(true) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(true) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(true) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(true) <=> engine->evaluate(\"'123'\")", + "QScriptValue(true) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(true) <=> engine->newVariant(QVariant(123))", + "QScriptValue(false) <=> QScriptValue(true)", + "QScriptValue(false) <=> QScriptValue(int(122))", + "QScriptValue(false) <=> QScriptValue(uint(124))", + "QScriptValue(false) <=> QScriptValue(123.0)", + "QScriptValue(false) <=> QScriptValue(6.37e-8)", + "QScriptValue(false) <=> QScriptValue(0x43211234)", + "QScriptValue(false) <=> QScriptValue(0x10000)", + "QScriptValue(false) <=> QScriptValue(0x10001)", + "QScriptValue(false) <=> QScriptValue(qInf())", + "QScriptValue(false) <=> QScriptValue(\"Infinity\")", + "QScriptValue(false) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(false) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(false) <=> QScriptValue(0, true)", + "QScriptValue(false) <=> QScriptValue(0, int(122))", + "QScriptValue(false) <=> QScriptValue(0, uint(124))", + "QScriptValue(false) <=> QScriptValue(0, 123.0)", + "QScriptValue(false) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(false) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(false) <=> QScriptValue(0, 0x10000)", + "QScriptValue(false) <=> QScriptValue(0, 0x10001)", + "QScriptValue(false) <=> QScriptValue(0, qInf())", + "QScriptValue(false) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(false) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(false) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(false) <=> QScriptValue(engine, true)", + "QScriptValue(false) <=> QScriptValue(engine, int(122))", + "QScriptValue(false) <=> QScriptValue(engine, uint(124))", + "QScriptValue(false) <=> QScriptValue(engine, 123.0)", + "QScriptValue(false) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(false) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(false) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(false) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(false) <=> QScriptValue(engine, qInf())", + "QScriptValue(false) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(false) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(false) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(false) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(false) <=> engine->evaluate(\"true\")", + "QScriptValue(false) <=> engine->evaluate(\"122\")", + "QScriptValue(false) <=> engine->evaluate(\"124\")", + "QScriptValue(false) <=> engine->evaluate(\"123.0\")", + "QScriptValue(false) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(false) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(false) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(false) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(false) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(false) <=> engine->evaluate(\"'123'\")", + "QScriptValue(false) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(false) <=> engine->newVariant(QVariant(123))", + "QScriptValue(int(122)) <=> QScriptValue(uint(124))", + "QScriptValue(int(122)) <=> QScriptValue(123.0)", + "QScriptValue(int(122)) <=> QScriptValue(0x43211234)", + "QScriptValue(int(122)) <=> QScriptValue(0x10000)", + "QScriptValue(int(122)) <=> QScriptValue(0x10001)", + "QScriptValue(int(122)) <=> QScriptValue(qInf())", + "QScriptValue(int(122)) <=> QScriptValue(\"Infinity\")", + "QScriptValue(int(122)) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(int(122)) <=> QScriptValue(0, uint(124))", + "QScriptValue(int(122)) <=> QScriptValue(0, 123.0)", + "QScriptValue(int(122)) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(int(122)) <=> QScriptValue(0, 0x10000)", + "QScriptValue(int(122)) <=> QScriptValue(0, 0x10001)", + "QScriptValue(int(122)) <=> QScriptValue(0, qInf())", + "QScriptValue(int(122)) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(int(122)) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(int(122)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(int(122)) <=> QScriptValue(engine, 123.0)", + "QScriptValue(int(122)) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(int(122)) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(int(122)) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(int(122)) <=> QScriptValue(engine, qInf())", + "QScriptValue(int(122)) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(int(122)) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(int(122)) <=> engine->evaluate(\"124\")", + "QScriptValue(int(122)) <=> engine->evaluate(\"123.0\")", + "QScriptValue(int(122)) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(int(122)) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(int(122)) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(int(122)) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(int(122)) <=> engine->evaluate(\"'123'\")", + "QScriptValue(int(122)) <=> engine->newVariant(QVariant(123))", + "QScriptValue(uint(124)) <=> QScriptValue(0x43211234)", + "QScriptValue(uint(124)) <=> QScriptValue(0x10000)", + "QScriptValue(uint(124)) <=> QScriptValue(0x10001)", + "QScriptValue(uint(124)) <=> QScriptValue(qInf())", + "QScriptValue(uint(124)) <=> QScriptValue(\"Infinity\")", + "QScriptValue(uint(124)) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(uint(124)) <=> QScriptValue(0, 0x10000)", + "QScriptValue(uint(124)) <=> QScriptValue(0, 0x10001)", + "QScriptValue(uint(124)) <=> QScriptValue(0, qInf())", + "QScriptValue(uint(124)) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(uint(124)) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(uint(124)) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(uint(124)) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(uint(124)) <=> QScriptValue(engine, qInf())", + "QScriptValue(uint(124)) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(uint(124)) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(uint(124)) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(uint(124)) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(uint(124)) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0) <=> QScriptValue(true)", + "QScriptValue(0) <=> QScriptValue(int(122))", + "QScriptValue(0) <=> QScriptValue(uint(124))", + "QScriptValue(0) <=> QScriptValue(123.0)", + "QScriptValue(0) <=> QScriptValue(6.37e-8)", + "QScriptValue(0) <=> QScriptValue(0x43211234)", + "QScriptValue(0) <=> QScriptValue(0x10000)", + "QScriptValue(0) <=> QScriptValue(0x10001)", + "QScriptValue(0) <=> QScriptValue(qInf())", + "QScriptValue(0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0) <=> QScriptValue(0, true)", + "QScriptValue(0) <=> QScriptValue(0, int(122))", + "QScriptValue(0) <=> QScriptValue(0, uint(124))", + "QScriptValue(0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0) <=> QScriptValue(0, qInf())", + "QScriptValue(0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0) <=> QScriptValue(engine, true)", + "QScriptValue(0) <=> QScriptValue(engine, int(122))", + "QScriptValue(0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0) <=> QScriptValue(engine, qInf())", + "QScriptValue(0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0) <=> engine->evaluate(\"true\")", + "QScriptValue(0) <=> engine->evaluate(\"122\")", + "QScriptValue(0) <=> engine->evaluate(\"124\")", + "QScriptValue(0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0.0) <=> QScriptValue(true)", + "QScriptValue(0.0) <=> QScriptValue(int(122))", + "QScriptValue(0.0) <=> QScriptValue(uint(124))", + "QScriptValue(0.0) <=> QScriptValue(123.0)", + "QScriptValue(0.0) <=> QScriptValue(6.37e-8)", + "QScriptValue(0.0) <=> QScriptValue(0x43211234)", + "QScriptValue(0.0) <=> QScriptValue(0x10000)", + "QScriptValue(0.0) <=> QScriptValue(0x10001)", + "QScriptValue(0.0) <=> QScriptValue(qInf())", + "QScriptValue(0.0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0.0) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0.0) <=> QScriptValue(0, true)", + "QScriptValue(0.0) <=> QScriptValue(0, int(122))", + "QScriptValue(0.0) <=> QScriptValue(0, uint(124))", + "QScriptValue(0.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0.0) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0.0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0.0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0.0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0.0) <=> QScriptValue(0, qInf())", + "QScriptValue(0.0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0.0) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0.0) <=> QScriptValue(engine, true)", + "QScriptValue(0.0) <=> QScriptValue(engine, int(122))", + "QScriptValue(0.0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0.0) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0.0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0.0) <=> QScriptValue(engine, qInf())", + "QScriptValue(0.0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0.0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0.0) <=> engine->evaluate(\"true\")", + "QScriptValue(0.0) <=> engine->evaluate(\"122\")", + "QScriptValue(0.0) <=> engine->evaluate(\"124\")", + "QScriptValue(0.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0.0) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0.0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0.0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0.0) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0.0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(123.0) <=> QScriptValue(uint(124))", + "QScriptValue(123.0) <=> QScriptValue(0x43211234)", + "QScriptValue(123.0) <=> QScriptValue(0x10000)", + "QScriptValue(123.0) <=> QScriptValue(0x10001)", + "QScriptValue(123.0) <=> QScriptValue(qInf())", + "QScriptValue(123.0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(123.0) <=> QScriptValue(0, uint(124))", + "QScriptValue(123.0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(123.0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(123.0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(123.0) <=> QScriptValue(0, qInf())", + "QScriptValue(123.0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(123.0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(123.0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(123.0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(123.0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(123.0) <=> QScriptValue(engine, qInf())", + "QScriptValue(123.0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(123.0) <=> engine->evaluate(\"124\")", + "QScriptValue(123.0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(123.0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(123.0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(123.0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(6.37e-8) <=> QScriptValue(true)", + "QScriptValue(6.37e-8) <=> QScriptValue(int(122))", + "QScriptValue(6.37e-8) <=> QScriptValue(uint(124))", + "QScriptValue(6.37e-8) <=> QScriptValue(123.0)", + "QScriptValue(6.37e-8) <=> QScriptValue(0x43211234)", + "QScriptValue(6.37e-8) <=> QScriptValue(0x10000)", + "QScriptValue(6.37e-8) <=> QScriptValue(0x10001)", + "QScriptValue(6.37e-8) <=> QScriptValue(qInf())", + "QScriptValue(6.37e-8) <=> QScriptValue(\"Infinity\")", + "QScriptValue(6.37e-8) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(6.37e-8) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(6.37e-8) <=> QScriptValue(0, true)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, int(122))", + "QScriptValue(6.37e-8) <=> QScriptValue(0, uint(124))", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 123.0)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 0x10000)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, 0x10001)", + "QScriptValue(6.37e-8) <=> QScriptValue(0, qInf())", + "QScriptValue(6.37e-8) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(6.37e-8) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, true)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, int(122))", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, uint(124))", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 123.0)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, qInf())", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"true\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"122\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"124\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"123.0\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"'123'\")", + "QScriptValue(6.37e-8) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(6.37e-8) <=> engine->newVariant(QVariant(123))", + "QScriptValue(-6.37e-8) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(-6.37e-8) <=> QScriptValue(true)", + "QScriptValue(-6.37e-8) <=> QScriptValue(false)", + "QScriptValue(-6.37e-8) <=> QScriptValue(int(122))", + "QScriptValue(-6.37e-8) <=> QScriptValue(uint(124))", + "QScriptValue(-6.37e-8) <=> QScriptValue(0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0.0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(123.0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0x43211234)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0x10000)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0x10001)", + "QScriptValue(-6.37e-8) <=> QScriptValue(qInf())", + "QScriptValue(-6.37e-8) <=> QScriptValue(\"Infinity\")", + "QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(QString())", + "QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, true)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, false)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, int(122))", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, uint(124))", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, 0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, 0.0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, 123.0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, 0x10000)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, 0x10001)", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, qInf())", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, QString())", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, true)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, false)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, int(122))", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, uint(124))", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0.0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, 123.0)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, qInf())", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString())", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(-6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"[]\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"null\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"true\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"false\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"122\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"124\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"0\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"0.0\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"123.0\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"''\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"'0'\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"'123'\")", + "QScriptValue(-6.37e-8) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(-6.37e-8) <=> engine->nullValue()", + "QScriptValue(-6.37e-8) <=> engine->newArray()", + "QScriptValue(-6.37e-8) <=> engine->newVariant(QVariant(123))", + "QScriptValue(-6.37e-8) <=> engine->newVariant(QVariant(false))", + "QScriptValue(-6.37e-8) <=> engine->newQObject(0)", + "QScriptValue(0x43211234) <=> QScriptValue(qInf())", + "QScriptValue(0x43211234) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0x43211234) <=> QScriptValue(0, qInf())", + "QScriptValue(0x43211234) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0x43211234) <=> QScriptValue(engine, qInf())", + "QScriptValue(0x43211234) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0x43211234) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0x10000) <=> QScriptValue(0x43211234)", + "QScriptValue(0x10000) <=> QScriptValue(0x10001)", + "QScriptValue(0x10000) <=> QScriptValue(qInf())", + "QScriptValue(0x10000) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0x10000) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0x10000) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0x10000) <=> QScriptValue(0, qInf())", + "QScriptValue(0x10000) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0x10000) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0x10000) <=> QScriptValue(engine, qInf())", + "QScriptValue(0x10000) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0x10000) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0x10000) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0x10000) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0x10001) <=> QScriptValue(0x43211234)", + "QScriptValue(0x10001) <=> QScriptValue(qInf())", + "QScriptValue(0x10001) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0x10001) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0x10001) <=> QScriptValue(0, qInf())", + "QScriptValue(0x10001) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0x10001) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0x10001) <=> QScriptValue(engine, qInf())", + "QScriptValue(0x10001) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0x10001) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0x10001) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(-qInf()) <=> QScriptValue(true)", + "QScriptValue(-qInf()) <=> QScriptValue(false)", + "QScriptValue(-qInf()) <=> QScriptValue(int(122))", + "QScriptValue(-qInf()) <=> QScriptValue(uint(124))", + "QScriptValue(-qInf()) <=> QScriptValue(0)", + "QScriptValue(-qInf()) <=> QScriptValue(0.0)", + "QScriptValue(-qInf()) <=> QScriptValue(123.0)", + "QScriptValue(-qInf()) <=> QScriptValue(6.37e-8)", + "QScriptValue(-qInf()) <=> QScriptValue(-6.37e-8)", + "QScriptValue(-qInf()) <=> QScriptValue(0x43211234)", + "QScriptValue(-qInf()) <=> QScriptValue(0x10000)", + "QScriptValue(-qInf()) <=> QScriptValue(0x10001)", + "QScriptValue(-qInf()) <=> QScriptValue(qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(-qInf()) <=> QScriptValue(QString())", + "QScriptValue(-qInf()) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(-qInf()) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(-qInf()) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(-qInf()) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(-qInf()) <=> QScriptValue(0, true)", + "QScriptValue(-qInf()) <=> QScriptValue(0, false)", + "QScriptValue(-qInf()) <=> QScriptValue(0, int(122))", + "QScriptValue(-qInf()) <=> QScriptValue(0, uint(124))", + "QScriptValue(-qInf()) <=> QScriptValue(0, 0)", + "QScriptValue(-qInf()) <=> QScriptValue(0, 0.0)", + "QScriptValue(-qInf()) <=> QScriptValue(0, 123.0)", + "QScriptValue(-qInf()) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(-qInf()) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(-qInf()) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(-qInf()) <=> QScriptValue(0, 0x10000)", + "QScriptValue(-qInf()) <=> QScriptValue(0, 0x10001)", + "QScriptValue(-qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(-qInf()) <=> QScriptValue(0, QString())", + "QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(-qInf()) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(-qInf()) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, true)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, false)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, int(122))", + "QScriptValue(-qInf()) <=> QScriptValue(engine, uint(124))", + "QScriptValue(-qInf()) <=> QScriptValue(engine, 0)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, 123.0)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(-qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(-qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(-qInf()) <=> QScriptValue(engine, QString())", + "QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(-qInf()) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(-qInf()) <=> engine->evaluate(\"[]\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"null\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"true\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"false\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"122\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"124\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"0\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"123.0\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"''\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"'0'\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"'123'\")", + "QScriptValue(-qInf()) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(-qInf()) <=> engine->nullValue()", + "QScriptValue(-qInf()) <=> engine->newArray()", + "QScriptValue(-qInf()) <=> engine->newVariant(QVariant(123))", + "QScriptValue(-qInf()) <=> engine->newVariant(QVariant(false))", + "QScriptValue(-qInf()) <=> engine->newQObject(0)", + "QScriptValue(\"NaN\") <=> QScriptValue(\"ciao\")", + "QScriptValue(\"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"NaN\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(\"NaN\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(\"NaN\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Object\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Array\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Number\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Function\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"Null\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"True\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"False\")", + "QScriptValue(\"NaN\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(\"NaN\") <=> engine->newObject()", + "QScriptValue(\"NaN\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(\"NaN\") <=> engine->newQObject(engine)", + "QScriptValue(\"Infinity\") <=> QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(\"ciao\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(\"Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Object\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Array\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Number\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Function\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Null\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"True\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"False\")", + "QScriptValue(\"Infinity\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(\"Infinity\") <=> engine->newObject()", + "QScriptValue(\"Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(\"Infinity\") <=> engine->newQObject(engine)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(true)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(false)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(int(122))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(uint(124))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0.0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(123.0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(6.37e-8)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(-6.37e-8)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0x43211234)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0x10000)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0x10001)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(\"NaN\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(\"ciao\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(QString(\"0\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(QString(\"123\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, true)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, false)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, int(122))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, uint(124))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0.0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, 123.0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0x43211234)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0x10000)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, 0x10001)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, true)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, false)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, int(122))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, uint(124))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0.0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 123.0)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0x10000)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, 0x10001)", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Object\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Array\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Number\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Function\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"/foo/\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"new Error()\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Null\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"True\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"False\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"null\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"true\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"false\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"122\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"124\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0.0\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"123.0\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0x10000\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"0x10001\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'0'\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'123'\")", + "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(\"-Infinity\") <=> engine->nullValue()", + "QScriptValue(\"-Infinity\") <=> engine->newObject()", + "QScriptValue(\"-Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(\"-Infinity\") <=> engine->newVariant(QVariant(123))", + "QScriptValue(\"-Infinity\") <=> engine->newVariant(QVariant(false))", + "QScriptValue(\"-Infinity\") <=> engine->newQObject(0)", + "QScriptValue(\"-Infinity\") <=> engine->newQObject(engine)", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"Object\")", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"Array\")", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"Number\")", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"Function\")", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(\"ciao\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(true)", + "QScriptValue(QString(\"\")) <=> QScriptValue(int(122))", + "QScriptValue(QString(\"\")) <=> QScriptValue(uint(124))", + "QScriptValue(QString(\"\")) <=> QScriptValue(123.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(6.37e-8)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0x43211234)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0x10000)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0x10001)", + "QScriptValue(QString(\"\")) <=> QScriptValue(qInf())", + "QScriptValue(QString(\"\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, true)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, int(122))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, qInf())", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, true)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"/foo/\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"True\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"False\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"true\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"122\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"124\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString(\"\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(QString(\"\")) <=> engine->newObject()", + "QScriptValue(QString(\"\")) <=> engine->newArray(10)", + "QScriptValue(QString(\"\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(QString(\"\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(QString(\"\")) <=> engine->newQObject(engine)", + "QScriptValue(QString()) <=> QScriptValue(true)", + "QScriptValue(QString()) <=> QScriptValue(int(122))", + "QScriptValue(QString()) <=> QScriptValue(uint(124))", + "QScriptValue(QString()) <=> QScriptValue(123.0)", + "QScriptValue(QString()) <=> QScriptValue(6.37e-8)", + "QScriptValue(QString()) <=> QScriptValue(0x43211234)", + "QScriptValue(QString()) <=> QScriptValue(0x10000)", + "QScriptValue(QString()) <=> QScriptValue(0x10001)", + "QScriptValue(QString()) <=> QScriptValue(qInf())", + "QScriptValue(QString()) <=> QScriptValue(\"NaN\")", + "QScriptValue(QString()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(QString()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(QString()) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString()) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString()) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(QString()) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString()) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QString()) <=> QScriptValue(0, true)", + "QScriptValue(QString()) <=> QScriptValue(0, int(122))", + "QScriptValue(QString()) <=> QScriptValue(0, uint(124))", + "QScriptValue(QString()) <=> QScriptValue(0, 123.0)", + "QScriptValue(QString()) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(QString()) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(QString()) <=> QScriptValue(0, 0x10000)", + "QScriptValue(QString()) <=> QScriptValue(0, 0x10001)", + "QScriptValue(QString()) <=> QScriptValue(0, qInf())", + "QScriptValue(QString()) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(QString()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(QString()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(QString()) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString()) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString()) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(QString()) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString()) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, true)", + "QScriptValue(QString()) <=> QScriptValue(engine, int(122))", + "QScriptValue(QString()) <=> QScriptValue(engine, uint(124))", + "QScriptValue(QString()) <=> QScriptValue(engine, 123.0)", + "QScriptValue(QString()) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(QString()) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(QString()) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(QString()) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(QString()) <=> QScriptValue(engine, qInf())", + "QScriptValue(QString()) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(QString()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(QString()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(QString()) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString()) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(QString()) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Object\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Array\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Number\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Function\")", + "QScriptValue(QString()) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(QString()) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(QString()) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(QString()) <=> engine->evaluate(\"/foo/\")", + "QScriptValue(QString()) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(QString()) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(QString()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Null\")", + "QScriptValue(QString()) <=> engine->evaluate(\"True\")", + "QScriptValue(QString()) <=> engine->evaluate(\"False\")", + "QScriptValue(QString()) <=> engine->evaluate(\"true\")", + "QScriptValue(QString()) <=> engine->evaluate(\"122\")", + "QScriptValue(QString()) <=> engine->evaluate(\"124\")", + "QScriptValue(QString()) <=> engine->evaluate(\"123.0\")", + "QScriptValue(QString()) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(QString()) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(QString()) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(QString()) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(QString()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(QString()) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString()) <=> engine->evaluate(\"'0'\")", + "QScriptValue(QString()) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString()) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(QString()) <=> engine->newObject()", + "QScriptValue(QString()) <=> engine->newArray(10)", + "QScriptValue(QString()) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(QString()) <=> engine->newVariant(QVariant(123))", + "QScriptValue(QString()) <=> engine->newQObject(engine)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(true)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(int(122))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(uint(124))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(123.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(6.37e-8)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0x43211234)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0x10000)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0x10001)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(qInf())", + "QScriptValue(QString(\"0\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, true)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, int(122))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, qInf())", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, true)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"True\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"False\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"true\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"122\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"124\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(QString(\"0\")) <=> engine->newObject()", + "QScriptValue(QString(\"0\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(QString(\"0\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(QString(\"0\")) <=> engine->newQObject(engine)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(uint(124))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0x43211234)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0x10000)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0x10001)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(qInf())", + "QScriptValue(QString(\"123\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, qInf())", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"True\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"False\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"124\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"123\")) <=> engine->newObject()", + "QScriptValue(QString(\"123\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(QString(\"123\")) <=> engine->newQObject(engine)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(int(122))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(uint(124))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(123.0)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0x43211234)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0x10000)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0x10001)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(qInf())", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, int(122))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, qInf())", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"12.4\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"True\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"False\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"122\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"124\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(QString(\"12.4\")) <=> engine->newObject()", + "QScriptValue(QString(\"12.4\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(QString(\"12.4\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(QString(\"12.4\")) <=> engine->newQObject(engine)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(true)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(int(122))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(uint(124))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(123.0)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0x43211234)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0x10000)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0x10001)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(qInf())", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, true)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, int(122))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, qInf())", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, true)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"true\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"122\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"124\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QScriptValue::NullValue) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, true) <=> QScriptValue(int(122))", + "QScriptValue(0, true) <=> QScriptValue(uint(124))", + "QScriptValue(0, true) <=> QScriptValue(123.0)", + "QScriptValue(0, true) <=> QScriptValue(0x43211234)", + "QScriptValue(0, true) <=> QScriptValue(0x10000)", + "QScriptValue(0, true) <=> QScriptValue(0x10001)", + "QScriptValue(0, true) <=> QScriptValue(qInf())", + "QScriptValue(0, true) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, true) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, true) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, true) <=> QScriptValue(0, int(122))", + "QScriptValue(0, true) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, true) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, true) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, true) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, true) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, true) <=> QScriptValue(0, qInf())", + "QScriptValue(0, true) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, true) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, true) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, true) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, true) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, true) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, true) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, true) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, true) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, true) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, true) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, true) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, true) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, true) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, true) <=> engine->evaluate(\"122\")", + "QScriptValue(0, true) <=> engine->evaluate(\"124\")", + "QScriptValue(0, true) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, true) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, true) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, true) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, true) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, true) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, true) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, true) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, false) <=> QScriptValue(true)", + "QScriptValue(0, false) <=> QScriptValue(int(122))", + "QScriptValue(0, false) <=> QScriptValue(uint(124))", + "QScriptValue(0, false) <=> QScriptValue(123.0)", + "QScriptValue(0, false) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, false) <=> QScriptValue(0x43211234)", + "QScriptValue(0, false) <=> QScriptValue(0x10000)", + "QScriptValue(0, false) <=> QScriptValue(0x10001)", + "QScriptValue(0, false) <=> QScriptValue(qInf())", + "QScriptValue(0, false) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, false) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, false) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, false) <=> QScriptValue(0, true)", + "QScriptValue(0, false) <=> QScriptValue(0, int(122))", + "QScriptValue(0, false) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, false) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, false) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, false) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, false) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, false) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, false) <=> QScriptValue(0, qInf())", + "QScriptValue(0, false) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, false) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, false) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, false) <=> QScriptValue(engine, true)", + "QScriptValue(0, false) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, false) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, false) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, false) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, false) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, false) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, false) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, false) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, false) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, false) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, false) <=> engine->evaluate(\"true\")", + "QScriptValue(0, false) <=> engine->evaluate(\"122\")", + "QScriptValue(0, false) <=> engine->evaluate(\"124\")", + "QScriptValue(0, false) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, false) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, false) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, false) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, false) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, false) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, false) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, false) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, false) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, int(122)) <=> QScriptValue(uint(124))", + "QScriptValue(0, int(122)) <=> QScriptValue(123.0)", + "QScriptValue(0, int(122)) <=> QScriptValue(0x43211234)", + "QScriptValue(0, int(122)) <=> QScriptValue(0x10000)", + "QScriptValue(0, int(122)) <=> QScriptValue(0x10001)", + "QScriptValue(0, int(122)) <=> QScriptValue(qInf())", + "QScriptValue(0, int(122)) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, int(122)) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, int(122)) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, int(122)) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, int(122)) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, int(122)) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, int(122)) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, int(122)) <=> QScriptValue(0, qInf())", + "QScriptValue(0, int(122)) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, int(122)) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, int(122)) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"124\")", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, int(122)) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, int(122)) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, uint(124)) <=> QScriptValue(0x43211234)", + "QScriptValue(0, uint(124)) <=> QScriptValue(0x10000)", + "QScriptValue(0, uint(124)) <=> QScriptValue(0x10001)", + "QScriptValue(0, uint(124)) <=> QScriptValue(qInf())", + "QScriptValue(0, uint(124)) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, qInf())", + "QScriptValue(0, uint(124)) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, uint(124)) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, uint(124)) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, 0) <=> QScriptValue(true)", + "QScriptValue(0, 0) <=> QScriptValue(int(122))", + "QScriptValue(0, 0) <=> QScriptValue(uint(124))", + "QScriptValue(0, 0) <=> QScriptValue(123.0)", + "QScriptValue(0, 0) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, 0) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0) <=> QScriptValue(0x10000)", + "QScriptValue(0, 0) <=> QScriptValue(0x10001)", + "QScriptValue(0, 0) <=> QScriptValue(qInf())", + "QScriptValue(0, 0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, 0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, 0) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, 0) <=> QScriptValue(0, true)", + "QScriptValue(0, 0) <=> QScriptValue(0, int(122))", + "QScriptValue(0, 0) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, 0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, 0) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 0) <=> QScriptValue(0, qInf())", + "QScriptValue(0, 0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, 0) <=> QScriptValue(engine, true)", + "QScriptValue(0, 0) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, 0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, 0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 0) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, 0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, 0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"true\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"122\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, 0) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, 0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, 0.0) <=> QScriptValue(true)", + "QScriptValue(0, 0.0) <=> QScriptValue(int(122))", + "QScriptValue(0, 0.0) <=> QScriptValue(uint(124))", + "QScriptValue(0, 0.0) <=> QScriptValue(123.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, 0.0) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0.0) <=> QScriptValue(0x10000)", + "QScriptValue(0, 0.0) <=> QScriptValue(0x10001)", + "QScriptValue(0, 0.0) <=> QScriptValue(qInf())", + "QScriptValue(0, 0.0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, true)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, int(122))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 0.0) <=> QScriptValue(0, qInf())", + "QScriptValue(0, 0.0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, true)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"true\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"122\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, 0.0) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, 0.0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, 123.0) <=> QScriptValue(uint(124))", + "QScriptValue(0, 123.0) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 123.0) <=> QScriptValue(0x10000)", + "QScriptValue(0, 123.0) <=> QScriptValue(0x10001)", + "QScriptValue(0, 123.0) <=> QScriptValue(qInf())", + "QScriptValue(0, 123.0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, 123.0) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, 123.0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 123.0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 123.0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 123.0) <=> QScriptValue(0, qInf())", + "QScriptValue(0, 123.0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, 123.0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, 123.0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(true)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(int(122))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(uint(124))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(123.0)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0x10000)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0x10001)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(qInf())", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, true)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, int(122))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, qInf())", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, true)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"true\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"122\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"124\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, 6.37e-8) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(true)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(false)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(int(122))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(uint(124))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0.0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(123.0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0x43211234)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0x10000)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0x10001)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(qInf())", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(QString())", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, true)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, false)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, int(122))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, qInf())", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString())", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, true)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, false)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString())", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"null\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"true\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"false\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"122\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"124\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"''\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, -6.37e-8) <=> engine->nullValue()", + "QScriptValue(0, -6.37e-8) <=> engine->newArray()", + "QScriptValue(0, -6.37e-8) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, -6.37e-8) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, -6.37e-8) <=> engine->newQObject(0)", + "QScriptValue(0, 0x43211234) <=> QScriptValue(qInf())", + "QScriptValue(0, 0x43211234) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0, qInf())", + "QScriptValue(0, 0x43211234) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, 0x10000) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0x10000) <=> QScriptValue(0x10001)", + "QScriptValue(0, 0x10000) <=> QScriptValue(qInf())", + "QScriptValue(0, 0x10000) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, qInf())", + "QScriptValue(0, 0x10000) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, 0x10000) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, 0x10000) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, 0x10001) <=> QScriptValue(0x43211234)", + "QScriptValue(0, 0x10001) <=> QScriptValue(qInf())", + "QScriptValue(0, 0x10001) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10001) <=> QScriptValue(0, qInf())", + "QScriptValue(0, 0x10001) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, 0x10001) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, 0x10001) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, 0x10001) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, -qInf()) <=> QScriptValue(true)", + "QScriptValue(0, -qInf()) <=> QScriptValue(false)", + "QScriptValue(0, -qInf()) <=> QScriptValue(int(122))", + "QScriptValue(0, -qInf()) <=> QScriptValue(uint(124))", + "QScriptValue(0, -qInf()) <=> QScriptValue(0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0.0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(123.0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, -qInf()) <=> QScriptValue(-6.37e-8)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0x43211234)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0x10000)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0x10001)", + "QScriptValue(0, -qInf()) <=> QScriptValue(qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(QString())", + "QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, true)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, false)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, int(122))", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, 0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, 0.0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, QString())", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, true)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, false)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString())", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, -qInf()) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"[]\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"null\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"true\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"false\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"122\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"124\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"0\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"''\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, -qInf()) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, -qInf()) <=> engine->nullValue()", + "QScriptValue(0, -qInf()) <=> engine->newArray()", + "QScriptValue(0, -qInf()) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, -qInf()) <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, -qInf()) <=> engine->newQObject(0)", + "QScriptValue(0, \"NaN\") <=> QScriptValue(\"ciao\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Object\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Array\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Number\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Function\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"Null\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"True\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"False\")", + "QScriptValue(0, \"NaN\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, \"NaN\") <=> engine->newObject()", + "QScriptValue(0, \"NaN\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, \"NaN\") <=> engine->newQObject(engine)", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"NaN\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"ciao\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Object\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Array\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Number\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Function\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Null\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"True\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"False\")", + "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, \"Infinity\") <=> engine->newObject()", + "QScriptValue(0, \"Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, \"Infinity\") <=> engine->newQObject(engine)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(true)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(false)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(int(122))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(uint(124))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0.0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(123.0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(6.37e-8)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(-6.37e-8)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0x43211234)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0x10000)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0x10001)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"NaN\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"ciao\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, true)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, false)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, int(122))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, uint(124))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0.0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 123.0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, true)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, false)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, int(122))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0.0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Object\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Array\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Number\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Function\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"/foo/\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"new Error()\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Null\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"True\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"False\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"null\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"true\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"false\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"122\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"124\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0.0\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, \"-Infinity\") <=> engine->nullValue()", + "QScriptValue(0, \"-Infinity\") <=> engine->newObject()", + "QScriptValue(0, \"-Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, \"-Infinity\") <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, \"-Infinity\") <=> engine->newVariant(QVariant(false))", + "QScriptValue(0, \"-Infinity\") <=> engine->newQObject(0)", + "QScriptValue(0, \"-Infinity\") <=> engine->newQObject(engine)", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Object\")", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Array\")", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Number\")", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Function\")", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(true)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(int(122))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(uint(124))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(123.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0x43211234)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0x10000)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0x10001)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(qInf())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, true)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, int(122))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, qInf())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, true)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"/foo/\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"True\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"False\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"true\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"122\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"124\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QString(\"\")) <=> engine->newObject()", + "QScriptValue(0, QString(\"\")) <=> engine->newArray(10)", + "QScriptValue(0, QString(\"\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, QString(\"\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, QString(\"\")) <=> engine->newQObject(engine)", + "QScriptValue(0, QString()) <=> QScriptValue(true)", + "QScriptValue(0, QString()) <=> QScriptValue(int(122))", + "QScriptValue(0, QString()) <=> QScriptValue(uint(124))", + "QScriptValue(0, QString()) <=> QScriptValue(123.0)", + "QScriptValue(0, QString()) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, QString()) <=> QScriptValue(0x43211234)", + "QScriptValue(0, QString()) <=> QScriptValue(0x10000)", + "QScriptValue(0, QString()) <=> QScriptValue(0x10001)", + "QScriptValue(0, QString()) <=> QScriptValue(qInf())", + "QScriptValue(0, QString()) <=> QScriptValue(\"NaN\")", + "QScriptValue(0, QString()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, QString()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(0, QString()) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString()) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString()) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(0, QString()) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString()) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, true)", + "QScriptValue(0, QString()) <=> QScriptValue(0, int(122))", + "QScriptValue(0, QString()) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, QString()) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, QString()) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, QString()) <=> QScriptValue(0, qInf())", + "QScriptValue(0, QString()) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, QString()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, QString()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, QString()) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, true)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, QString()) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, QString()) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, QString()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, QString()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(0, QString()) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Object\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Array\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Number\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Function\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"/foo/\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Null\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"True\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"False\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"true\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"122\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"124\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"'0'\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString()) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QString()) <=> engine->newObject()", + "QScriptValue(0, QString()) <=> engine->newArray(10)", + "QScriptValue(0, QString()) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, QString()) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, QString()) <=> engine->newQObject(engine)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(true)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(int(122))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(uint(124))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(123.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(6.37e-8)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0x43211234)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0x10000)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0x10001)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(qInf())", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, true)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, int(122))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, qInf())", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, true)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"True\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"False\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"true\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"122\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"124\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QString(\"0\")) <=> engine->newObject()", + "QScriptValue(0, QString(\"0\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, QString(\"0\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, QString(\"0\")) <=> engine->newQObject(engine)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(uint(124))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0x43211234)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0x10000)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0x10001)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(qInf())", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, qInf())", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"True\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"False\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"124\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"123\")) <=> engine->newObject()", + "QScriptValue(0, QString(\"123\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, QString(\"123\")) <=> engine->newQObject(engine)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(int(122))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(uint(124))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(123.0)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0x43211234)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0x10000)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0x10001)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(qInf())", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, int(122))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, qInf())", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"True\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"False\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"122\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"124\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(0, QString(\"12.3\")) <=> engine->newObject()", + "QScriptValue(0, QString(\"12.3\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(0, QString(\"12.3\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(0, QString(\"12.3\")) <=> engine->newQObject(engine)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(true)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(int(122))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(uint(124))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(123.0)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0x10000)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0x10001)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(qInf())", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, true)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, true)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, QScriptValue::NullValue) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, true) <=> QScriptValue(int(122))", + "QScriptValue(engine, true) <=> QScriptValue(uint(124))", + "QScriptValue(engine, true) <=> QScriptValue(123.0)", + "QScriptValue(engine, true) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, true) <=> QScriptValue(0x10000)", + "QScriptValue(engine, true) <=> QScriptValue(0x10001)", + "QScriptValue(engine, true) <=> QScriptValue(qInf())", + "QScriptValue(engine, true) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, true) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, true) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, true) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, true) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, true) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, true) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, true) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, true) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, true) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, true) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, true) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, true) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, true) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, true) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, true) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, true) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, true) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, true) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, true) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, true) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, true) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, true) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, true) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, true) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, true) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, false) <=> QScriptValue(true)", + "QScriptValue(engine, false) <=> QScriptValue(int(122))", + "QScriptValue(engine, false) <=> QScriptValue(uint(124))", + "QScriptValue(engine, false) <=> QScriptValue(123.0)", + "QScriptValue(engine, false) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, false) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, false) <=> QScriptValue(0x10000)", + "QScriptValue(engine, false) <=> QScriptValue(0x10001)", + "QScriptValue(engine, false) <=> QScriptValue(qInf())", + "QScriptValue(engine, false) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, false) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, false) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, false) <=> QScriptValue(0, true)", + "QScriptValue(engine, false) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, false) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, false) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, false) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, false) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, false) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, false) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, false) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, false) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, false) <=> QScriptValue(engine, true)", + "QScriptValue(engine, false) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, false) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, false) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, false) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, false) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, false) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, false) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, false) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, false) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, int(122)) <=> QScriptValue(uint(124))", + "QScriptValue(engine, int(122)) <=> QScriptValue(123.0)", + "QScriptValue(engine, int(122)) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, int(122)) <=> QScriptValue(0x10000)", + "QScriptValue(engine, int(122)) <=> QScriptValue(0x10001)", + "QScriptValue(engine, int(122)) <=> QScriptValue(qInf())", + "QScriptValue(engine, int(122)) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, int(122)) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, int(122)) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, int(122)) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, int(122)) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, int(122)) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0x10000)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0x10001)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(qInf())", + "QScriptValue(engine, uint(124)) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, uint(124)) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, 0) <=> QScriptValue(true)", + "QScriptValue(engine, 0) <=> QScriptValue(int(122))", + "QScriptValue(engine, 0) <=> QScriptValue(uint(124))", + "QScriptValue(engine, 0) <=> QScriptValue(123.0)", + "QScriptValue(engine, 0) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, 0) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 0) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 0) <=> QScriptValue(qInf())", + "QScriptValue(engine, 0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, 0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, 0) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, 0) <=> QScriptValue(0, true)", + "QScriptValue(engine, 0) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, 0) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, 0) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 0) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, 0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, true)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 0) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, 0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, 0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, 0) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, 0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, 0.0) <=> QScriptValue(true)", + "QScriptValue(engine, 0.0) <=> QScriptValue(int(122))", + "QScriptValue(engine, 0.0) <=> QScriptValue(uint(124))", + "QScriptValue(engine, 0.0) <=> QScriptValue(123.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 0.0) <=> QScriptValue(qInf())", + "QScriptValue(engine, 0.0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, true)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, true)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, 0.0) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, 0.0) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, 123.0) <=> QScriptValue(uint(124))", + "QScriptValue(engine, 123.0) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 123.0) <=> QScriptValue(qInf())", + "QScriptValue(engine, 123.0) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, 123.0) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, 123.0) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, 123.0) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(true)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(int(122))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(uint(124))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(123.0)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0x10000)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(qInf())", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, true)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, true)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, 6.37e-8) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(true)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(false)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(int(122))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(uint(124))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0.0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(123.0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0x10000)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0x10001)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(qInf())", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString())", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, true)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, false)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString())", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, true)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, false)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, -6.37e-8) <=> engine->nullValue()", + "QScriptValue(engine, -6.37e-8) <=> engine->newArray()", + "QScriptValue(engine, -6.37e-8) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, -6.37e-8) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, -6.37e-8) <=> engine->newQObject(0)", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(qInf())", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10001)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(qInf())", + "QScriptValue(engine, 0x10000) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, 0x10000) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(qInf())", + "QScriptValue(engine, 0x10001) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, 0x10001) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(true)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(false)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(int(122))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(uint(124))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0.0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(123.0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(-6.37e-8)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0x10000)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0x10001)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(QString())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, true)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, false)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, true)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, false)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString())", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"[]\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"Array.prototype\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"new Array()\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"null\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"false\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"''\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, -qInf()) <=> engine->nullValue()", + "QScriptValue(engine, -qInf()) <=> engine->newArray()", + "QScriptValue(engine, -qInf()) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, -qInf()) <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, -qInf()) <=> engine->newQObject(0)", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"True\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"False\")", + "QScriptValue(engine, \"NaN\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, \"NaN\") <=> engine->newObject()", + "QScriptValue(engine, \"NaN\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, \"NaN\") <=> engine->newQObject(engine)", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"True\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"False\")", + "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, \"Infinity\") <=> engine->newObject()", + "QScriptValue(engine, \"Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, \"Infinity\") <=> engine->newQObject(engine)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(true)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(false)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(int(122))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(uint(124))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0.0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(123.0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(-6.37e-8)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0x43211234)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0x10000)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0x10001)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, true)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, false)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, int(122))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0.0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, -6.37e-8)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, true)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, false)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0.0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"/foo/\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"new Error()\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"True\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"False\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"null\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"true\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"false\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"122\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"124\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0.0\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, \"-Infinity\") <=> engine->nullValue()", + "QScriptValue(engine, \"-Infinity\") <=> engine->newObject()", + "QScriptValue(engine, \"-Infinity\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, \"-Infinity\") <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, \"-Infinity\") <=> engine->newVariant(QVariant(false))", + "QScriptValue(engine, \"-Infinity\") <=> engine->newQObject(0)", + "QScriptValue(engine, \"-Infinity\") <=> engine->newQObject(engine)", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(true)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(int(122))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(uint(124))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(123.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0x10000)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0x10001)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(qInf())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, true)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, true)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"/foo/\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"True\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"False\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, QString(\"\")) <=> engine->newObject()", + "QScriptValue(engine, QString(\"\")) <=> engine->newArray(10)", + "QScriptValue(engine, QString(\"\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, QString(\"\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, QString(\"\")) <=> engine->newQObject(engine)", + "QScriptValue(engine, QString()) <=> QScriptValue(true)", + "QScriptValue(engine, QString()) <=> QScriptValue(int(122))", + "QScriptValue(engine, QString()) <=> QScriptValue(uint(124))", + "QScriptValue(engine, QString()) <=> QScriptValue(123.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, QString()) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, QString()) <=> QScriptValue(0x10000)", + "QScriptValue(engine, QString()) <=> QScriptValue(0x10001)", + "QScriptValue(engine, QString()) <=> QScriptValue(qInf())", + "QScriptValue(engine, QString()) <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, QString()) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, QString()) <=> QScriptValue(\"-Infinity\")", + "QScriptValue(engine, QString()) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString()) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"0\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, true)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, QString()) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, QString()) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, QString()) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, QString()) <=> QScriptValue(0, \"-Infinity\")", + "QScriptValue(engine, QString()) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"0\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, true)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"/foo/\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"True\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"False\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"'0'\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString()) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, QString()) <=> engine->newObject()", + "QScriptValue(engine, QString()) <=> engine->newArray(10)", + "QScriptValue(engine, QString()) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, QString()) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, QString()) <=> engine->newQObject(engine)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(true)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(int(122))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(uint(124))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(123.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(6.37e-8)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0x10000)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0x10001)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(qInf())", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, true)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 6.37e-8)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, true)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"1.23\"))", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"True\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"False\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"true\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"6.37e-8\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, QString(\"0\")) <=> engine->newObject()", + "QScriptValue(engine, QString(\"0\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, QString(\"0\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, QString(\"0\")) <=> engine->newQObject(engine)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(uint(124))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0x10000)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0x10001)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(qInf())", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"True\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"False\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"123\")) <=> engine->newObject()", + "QScriptValue(engine, QString(\"123\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, QString(\"123\")) <=> engine->newQObject(engine)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(int(122))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(uint(124))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(123.0)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0x43211234)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0x10000)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0x10001)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(qInf())", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(\"NaN\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(\"Infinity\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(\"ciao\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(QString(\"12.4\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, int(122))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, uint(124))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 123.0)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 0x43211234)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 0x10000)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, 0x10001)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, qInf())", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, \"NaN\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, \"Infinity\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, \"ciao\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, int(122))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, uint(124))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 123.0)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 0x10000)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, 0x10001)", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, qInf())", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Object.prototype\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Function.prototype\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Error.prototype\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Object\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Array\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Number\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Function\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"(function() { return 1; })\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"new Object()\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"new Error()\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Undefined\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Null\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"True\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"False\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"122\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"124\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"123.0\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"0x43211234\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"0x10000\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"0x10001\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"Infinity\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"'ciao'\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"'123'\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->evaluate(\"'12.4'\")", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->newObject()", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->newVariant(QVariant(123))", + "QScriptValue(engine, QString(\"1.23\")) <=> engine->newQObject(engine)", + "engine->evaluate(\"[]\") <=> QScriptValue(true)", + "engine->evaluate(\"[]\") <=> QScriptValue(int(122))", + "engine->evaluate(\"[]\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"[]\") <=> QScriptValue(123.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"[]\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"[]\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"[]\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"[]\") <=> QScriptValue(qInf())", + "engine->evaluate(\"[]\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"[]\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"[]\") <=> QScriptValue(\"-Infinity\")", + "engine->evaluate(\"[]\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"[]\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, true)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"[]\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"[]\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"[]\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"[]\") <=> QScriptValue(0, \"-Infinity\")", + "engine->evaluate(\"[]\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, \"-Infinity\")", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"[]\") <=> engine->newObject()", + "engine->evaluate(\"[]\") <=> engine->newArray(10)", + "engine->evaluate(\"[]\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"[]\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"[]\") <=> engine->newQObject(engine)", + "engine->evaluate(\"Object.prototype\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"Object.prototype\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Object.prototype\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"Object.prototype\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Object.prototype\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"Object.prototype\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"Object.prototype\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(true)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(int(122))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(123.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(qInf())", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"-Infinity\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, true)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"-Infinity\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"-Infinity\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"Array.prototype\") <=> engine->newObject()", + "engine->evaluate(\"Array.prototype\") <=> engine->newArray(10)", + "engine->evaluate(\"Array.prototype\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"Array.prototype\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"Array.prototype\") <=> engine->newQObject(engine)", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"Error.prototype\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"Error.prototype\") <=> engine->newObject()", + "engine->evaluate(\"Error.prototype\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"Error.prototype\") <=> engine->newQObject(engine)", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"/foo/\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"/foo/\") <=> engine->newObject()", + "engine->evaluate(\"/foo/\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"/foo/\") <=> engine->newQObject(engine)", + "engine->evaluate(\"new Object()\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"new Object()\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Object()\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"new Object()\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Object()\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"new Object()\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"new Object()\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(true)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(int(122))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(123.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(qInf())", + "engine->evaluate(\"new Array()\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(\"-Infinity\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, true)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"-Infinity\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"-Infinity\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"new Array()\") <=> engine->newObject()", + "engine->evaluate(\"new Array()\") <=> engine->newArray(10)", + "engine->evaluate(\"new Array()\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"new Array()\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"new Array()\") <=> engine->newQObject(engine)", + "engine->evaluate(\"new Error()\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Error()\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Error()\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"new Error()\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"new Error()\") <=> engine->newObject()", + "engine->evaluate(\"new Error()\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"new Error()\") <=> engine->newQObject(engine)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(int(122))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(123.0)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(qInf())", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"Undefined\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"Undefined\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Undefined\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"Undefined\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Undefined\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"Undefined\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"Undefined\") <=> engine->newObject()", + "engine->evaluate(\"Undefined\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"Null\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"Null\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Null\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"Null\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Null\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"Null\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"Null\") <=> engine->newObject()", + "engine->evaluate(\"Null\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"True\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"True\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"True\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"True\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"True\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"True\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"True\") <=> engine->newObject()", + "engine->evaluate(\"True\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"False\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"False\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"False\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"False\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"False\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"False\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"False\") <=> engine->newObject()", + "engine->evaluate(\"False\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"null\") <=> QScriptValue(true)", + "engine->evaluate(\"null\") <=> QScriptValue(int(122))", + "engine->evaluate(\"null\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"null\") <=> QScriptValue(123.0)", + "engine->evaluate(\"null\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"null\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"null\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"null\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"null\") <=> QScriptValue(qInf())", + "engine->evaluate(\"null\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"null\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"null\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"null\") <=> QScriptValue(0, true)", + "engine->evaluate(\"null\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"null\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"null\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"null\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"null\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"null\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"null\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"null\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"null\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"null\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"null\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"null\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"null\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"null\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"null\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"null\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"null\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"null\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"null\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"null\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"true\") <=> QScriptValue(int(122))", + "engine->evaluate(\"true\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"true\") <=> QScriptValue(123.0)", + "engine->evaluate(\"true\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"true\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"true\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"true\") <=> QScriptValue(qInf())", + "engine->evaluate(\"true\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"true\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"true\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"true\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"true\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"true\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"true\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"true\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"true\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"true\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"true\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"true\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"true\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"true\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"true\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"true\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"true\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"true\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"true\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"true\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"true\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"true\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"true\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"false\") <=> QScriptValue(true)", + "engine->evaluate(\"false\") <=> QScriptValue(int(122))", + "engine->evaluate(\"false\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"false\") <=> QScriptValue(123.0)", + "engine->evaluate(\"false\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"false\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"false\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"false\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"false\") <=> QScriptValue(qInf())", + "engine->evaluate(\"false\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"false\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"false\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"false\") <=> QScriptValue(0, true)", + "engine->evaluate(\"false\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"false\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"false\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"false\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"false\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"false\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"false\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"false\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"false\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"false\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"false\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"122\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"122\") <=> QScriptValue(123.0)", + "engine->evaluate(\"122\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"122\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"122\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"122\") <=> QScriptValue(qInf())", + "engine->evaluate(\"122\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"122\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"122\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"122\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"122\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"122\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"122\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"122\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"122\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"122\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"122\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"122\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"122\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"122\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"122\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"122\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"122\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"122\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"122\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"122\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"122\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"122\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"122\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"122\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"122\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"122\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"124\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"124\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"124\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"124\") <=> QScriptValue(qInf())", + "engine->evaluate(\"124\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"124\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"124\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"124\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"124\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"124\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"124\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"124\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"124\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"124\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"124\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"124\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"124\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"124\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"124\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"0\") <=> QScriptValue(true)", + "engine->evaluate(\"0\") <=> QScriptValue(int(122))", + "engine->evaluate(\"0\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"0\") <=> QScriptValue(123.0)", + "engine->evaluate(\"0\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"0\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"0\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"0\") <=> QScriptValue(qInf())", + "engine->evaluate(\"0\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"0\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"0\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"0\") <=> QScriptValue(0, true)", + "engine->evaluate(\"0\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"0\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"0\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"0\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"0\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"0\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"0\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"0\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"0\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"0\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"0\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"0.0\") <=> QScriptValue(true)", + "engine->evaluate(\"0.0\") <=> QScriptValue(int(122))", + "engine->evaluate(\"0.0\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"0.0\") <=> QScriptValue(123.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"0.0\") <=> QScriptValue(qInf())", + "engine->evaluate(\"0.0\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, true)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"0.0\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"0.0\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"123.0\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"123.0\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"123.0\") <=> QScriptValue(qInf())", + "engine->evaluate(\"123.0\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"123.0\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"123.0\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"123.0\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(true)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(int(122))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(123.0)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(qInf())", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, true)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"6.37e-8\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(true)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(false)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(int(122))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0.0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(123.0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(qInf())", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString())", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, true)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, false)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"-6.37e-8\") <=> engine->nullValue()", + "engine->evaluate(\"-6.37e-8\") <=> engine->newArray()", + "engine->evaluate(\"-6.37e-8\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"-6.37e-8\") <=> engine->newVariant(QVariant(false))", + "engine->evaluate(\"-6.37e-8\") <=> engine->newQObject(0)", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(qInf())", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(qInf())", + "engine->evaluate(\"0x10000\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"0x10000\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(qInf())", + "engine->evaluate(\"0x10001\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"0x10001\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(QScriptValue::NullValue)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(true)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(false)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(int(122))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0.0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(123.0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(-6.37e-8)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(QString())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QScriptValue::NullValue)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, true)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, false)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0.0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -6.37e-8)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, false)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0.0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -6.37e-8)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString())", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"[]\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"new Array()\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"null\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"false\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0.0\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"''\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"-Infinity\") <=> engine->nullValue()", + "engine->evaluate(\"-Infinity\") <=> engine->newArray()", + "engine->evaluate(\"-Infinity\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"-Infinity\") <=> engine->newVariant(QVariant(false))", + "engine->evaluate(\"-Infinity\") <=> engine->newQObject(0)", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"''\") <=> QScriptValue(true)", + "engine->evaluate(\"''\") <=> QScriptValue(int(122))", + "engine->evaluate(\"''\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"''\") <=> QScriptValue(123.0)", + "engine->evaluate(\"''\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"''\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"''\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"''\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"''\") <=> QScriptValue(qInf())", + "engine->evaluate(\"''\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"''\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"''\") <=> QScriptValue(\"-Infinity\")", + "engine->evaluate(\"''\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"''\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"''\") <=> QScriptValue(QString(\"0\"))", + "engine->evaluate(\"''\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"''\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, true)", + "engine->evaluate(\"''\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"''\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"''\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"''\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"''\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"''\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"''\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"''\") <=> QScriptValue(0, \"-Infinity\")", + "engine->evaluate(\"''\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"0\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"''\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"''\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"''\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"''\") <=> QScriptValue(engine, \"-Infinity\")", + "engine->evaluate(\"''\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"0\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"/foo/\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"'0'\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"''\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"''\") <=> engine->newObject()", + "engine->evaluate(\"''\") <=> engine->newArray(10)", + "engine->evaluate(\"''\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"''\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"''\") <=> engine->newQObject(engine)", + "engine->evaluate(\"'0'\") <=> QScriptValue(true)", + "engine->evaluate(\"'0'\") <=> QScriptValue(int(122))", + "engine->evaluate(\"'0'\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"'0'\") <=> QScriptValue(123.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(6.37e-8)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"'0'\") <=> QScriptValue(qInf())", + "engine->evaluate(\"'0'\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"12.4\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, true)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 6.37e-8)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"12.3\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, true)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 6.37e-8)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"true\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'12.4'\")", + "engine->evaluate(\"'0'\") <=> engine->newObject()", + "engine->evaluate(\"'0'\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"'0'\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"'0'\") <=> engine->newQObject(engine)", + "engine->evaluate(\"'123'\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"'123'\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"'123'\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"'123'\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"'123'\") <=> QScriptValue(qInf())", + "engine->evaluate(\"'123'\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"'123'\") <=> engine->newObject()", + "engine->evaluate(\"'123'\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"'123'\") <=> engine->newQObject(engine)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(int(122))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(uint(124))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(123.0)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0x43211234)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0x10000)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0x10001)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(qInf())", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(\"NaN\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(\"Infinity\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(\"ciao\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"123\"))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, int(122))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, uint(124))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 123.0)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 0x43211234)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 0x10000)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, 0x10001)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, qInf())", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, \"NaN\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, \"Infinity\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, \"ciao\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(0, QString(\"123\"))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, int(122))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, uint(124))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 123.0)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 0x43211234)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 0x10000)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, 0x10001)", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, qInf())", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, \"NaN\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, \"Infinity\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, \"ciao\")", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->evaluate(\"'12.4'\") <=> QScriptValue(engine, QString(\"123\"))", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Number\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"new Object()\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"new Error()\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Undefined\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Null\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"True\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"False\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"122\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"124\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"123.0\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"0x10000\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"0x10001\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"Infinity\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\") <=> engine->newObject()", + "engine->evaluate(\"'12.4'\") <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->evaluate(\"'12.4'\") <=> engine->newVariant(QVariant(123))", + "engine->evaluate(\"'12.4'\") <=> engine->newQObject(engine)", + "engine->nullValue() <=> QScriptValue(true)", + "engine->nullValue() <=> QScriptValue(int(122))", + "engine->nullValue() <=> QScriptValue(uint(124))", + "engine->nullValue() <=> QScriptValue(123.0)", + "engine->nullValue() <=> QScriptValue(6.37e-8)", + "engine->nullValue() <=> QScriptValue(0x43211234)", + "engine->nullValue() <=> QScriptValue(0x10000)", + "engine->nullValue() <=> QScriptValue(0x10001)", + "engine->nullValue() <=> QScriptValue(qInf())", + "engine->nullValue() <=> QScriptValue(\"Infinity\")", + "engine->nullValue() <=> QScriptValue(QString(\"123\"))", + "engine->nullValue() <=> QScriptValue(QString(\"12.4\"))", + "engine->nullValue() <=> QScriptValue(0, true)", + "engine->nullValue() <=> QScriptValue(0, int(122))", + "engine->nullValue() <=> QScriptValue(0, uint(124))", + "engine->nullValue() <=> QScriptValue(0, 123.0)", + "engine->nullValue() <=> QScriptValue(0, 6.37e-8)", + "engine->nullValue() <=> QScriptValue(0, 0x43211234)", + "engine->nullValue() <=> QScriptValue(0, 0x10000)", + "engine->nullValue() <=> QScriptValue(0, 0x10001)", + "engine->nullValue() <=> QScriptValue(0, qInf())", + "engine->nullValue() <=> QScriptValue(0, \"Infinity\")", + "engine->nullValue() <=> QScriptValue(0, QString(\"123\"))", + "engine->nullValue() <=> QScriptValue(0, QString(\"12.3\"))", + "engine->nullValue() <=> QScriptValue(engine, true)", + "engine->nullValue() <=> QScriptValue(engine, int(122))", + "engine->nullValue() <=> QScriptValue(engine, uint(124))", + "engine->nullValue() <=> QScriptValue(engine, 123.0)", + "engine->nullValue() <=> QScriptValue(engine, 6.37e-8)", + "engine->nullValue() <=> QScriptValue(engine, 0x43211234)", + "engine->nullValue() <=> QScriptValue(engine, 0x10000)", + "engine->nullValue() <=> QScriptValue(engine, 0x10001)", + "engine->nullValue() <=> QScriptValue(engine, qInf())", + "engine->nullValue() <=> QScriptValue(engine, \"Infinity\")", + "engine->nullValue() <=> QScriptValue(engine, QString(\"123\"))", + "engine->nullValue() <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->nullValue() <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->nullValue() <=> engine->evaluate(\"true\")", + "engine->nullValue() <=> engine->evaluate(\"122\")", + "engine->nullValue() <=> engine->evaluate(\"124\")", + "engine->nullValue() <=> engine->evaluate(\"123.0\")", + "engine->nullValue() <=> engine->evaluate(\"6.37e-8\")", + "engine->nullValue() <=> engine->evaluate(\"0x43211234\")", + "engine->nullValue() <=> engine->evaluate(\"0x10000\")", + "engine->nullValue() <=> engine->evaluate(\"0x10001\")", + "engine->nullValue() <=> engine->evaluate(\"Infinity\")", + "engine->nullValue() <=> engine->evaluate(\"'123'\")", + "engine->nullValue() <=> engine->evaluate(\"'12.4'\")", + "engine->nullValue() <=> engine->newVariant(QVariant(123))", + "engine->newObject() <=> QScriptValue(\"ciao\")", + "engine->newObject() <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->newObject() <=> QScriptValue(0, \"ciao\")", + "engine->newObject() <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->newObject() <=> QScriptValue(engine, \"ciao\")", + "engine->newObject() <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->newObject() <=> engine->evaluate(\"Function.prototype\")", + "engine->newObject() <=> engine->evaluate(\"Object\")", + "engine->newObject() <=> engine->evaluate(\"Array\")", + "engine->newObject() <=> engine->evaluate(\"Number\")", + "engine->newObject() <=> engine->evaluate(\"Function\")", + "engine->newObject() <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->newObject() <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->newObject() <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->newObject() <=> engine->evaluate(\"'ciao'\")", + "engine->newObject() <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newArray() <=> QScriptValue(true)", + "engine->newArray() <=> QScriptValue(int(122))", + "engine->newArray() <=> QScriptValue(uint(124))", + "engine->newArray() <=> QScriptValue(123.0)", + "engine->newArray() <=> QScriptValue(6.37e-8)", + "engine->newArray() <=> QScriptValue(0x43211234)", + "engine->newArray() <=> QScriptValue(0x10000)", + "engine->newArray() <=> QScriptValue(0x10001)", + "engine->newArray() <=> QScriptValue(qInf())", + "engine->newArray() <=> QScriptValue(\"NaN\")", + "engine->newArray() <=> QScriptValue(\"Infinity\")", + "engine->newArray() <=> QScriptValue(\"-Infinity\")", + "engine->newArray() <=> QScriptValue(\"ciao\")", + "engine->newArray() <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->newArray() <=> QScriptValue(QString(\"0\"))", + "engine->newArray() <=> QScriptValue(QString(\"123\"))", + "engine->newArray() <=> QScriptValue(QString(\"12.4\"))", + "engine->newArray() <=> QScriptValue(0, true)", + "engine->newArray() <=> QScriptValue(0, int(122))", + "engine->newArray() <=> QScriptValue(0, uint(124))", + "engine->newArray() <=> QScriptValue(0, 123.0)", + "engine->newArray() <=> QScriptValue(0, 6.37e-8)", + "engine->newArray() <=> QScriptValue(0, 0x43211234)", + "engine->newArray() <=> QScriptValue(0, 0x10000)", + "engine->newArray() <=> QScriptValue(0, 0x10001)", + "engine->newArray() <=> QScriptValue(0, qInf())", + "engine->newArray() <=> QScriptValue(0, \"NaN\")", + "engine->newArray() <=> QScriptValue(0, \"Infinity\")", + "engine->newArray() <=> QScriptValue(0, \"-Infinity\")", + "engine->newArray() <=> QScriptValue(0, \"ciao\")", + "engine->newArray() <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->newArray() <=> QScriptValue(0, QString(\"0\"))", + "engine->newArray() <=> QScriptValue(0, QString(\"123\"))", + "engine->newArray() <=> QScriptValue(0, QString(\"12.3\"))", + "engine->newArray() <=> QScriptValue(engine, true)", + "engine->newArray() <=> QScriptValue(engine, int(122))", + "engine->newArray() <=> QScriptValue(engine, uint(124))", + "engine->newArray() <=> QScriptValue(engine, 123.0)", + "engine->newArray() <=> QScriptValue(engine, 6.37e-8)", + "engine->newArray() <=> QScriptValue(engine, 0x43211234)", + "engine->newArray() <=> QScriptValue(engine, 0x10000)", + "engine->newArray() <=> QScriptValue(engine, 0x10001)", + "engine->newArray() <=> QScriptValue(engine, qInf())", + "engine->newArray() <=> QScriptValue(engine, \"NaN\")", + "engine->newArray() <=> QScriptValue(engine, \"Infinity\")", + "engine->newArray() <=> QScriptValue(engine, \"-Infinity\")", + "engine->newArray() <=> QScriptValue(engine, \"ciao\")", + "engine->newArray() <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->newArray() <=> QScriptValue(engine, QString(\"0\"))", + "engine->newArray() <=> QScriptValue(engine, QString(\"123\"))", + "engine->newArray() <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->newArray() <=> engine->evaluate(\"Object.prototype\")", + "engine->newArray() <=> engine->evaluate(\"Function.prototype\")", + "engine->newArray() <=> engine->evaluate(\"Error.prototype\")", + "engine->newArray() <=> engine->evaluate(\"Object\")", + "engine->newArray() <=> engine->evaluate(\"Array\")", + "engine->newArray() <=> engine->evaluate(\"Number\")", + "engine->newArray() <=> engine->evaluate(\"Function\")", + "engine->newArray() <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->newArray() <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->newArray() <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->newArray() <=> engine->evaluate(\"/foo/\")", + "engine->newArray() <=> engine->evaluate(\"new Object()\")", + "engine->newArray() <=> engine->evaluate(\"new Error()\")", + "engine->newArray() <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->newArray() <=> engine->evaluate(\"Undefined\")", + "engine->newArray() <=> engine->evaluate(\"Null\")", + "engine->newArray() <=> engine->evaluate(\"True\")", + "engine->newArray() <=> engine->evaluate(\"False\")", + "engine->newArray() <=> engine->evaluate(\"true\")", + "engine->newArray() <=> engine->evaluate(\"122\")", + "engine->newArray() <=> engine->evaluate(\"124\")", + "engine->newArray() <=> engine->evaluate(\"123.0\")", + "engine->newArray() <=> engine->evaluate(\"6.37e-8\")", + "engine->newArray() <=> engine->evaluate(\"0x43211234\")", + "engine->newArray() <=> engine->evaluate(\"0x10000\")", + "engine->newArray() <=> engine->evaluate(\"0x10001\")", + "engine->newArray() <=> engine->evaluate(\"Infinity\")", + "engine->newArray() <=> engine->evaluate(\"'ciao'\")", + "engine->newArray() <=> engine->evaluate(\"'0'\")", + "engine->newArray() <=> engine->evaluate(\"'123'\")", + "engine->newArray() <=> engine->evaluate(\"'12.4'\")", + "engine->newArray() <=> engine->newObject()", + "engine->newArray() <=> engine->newArray(10)", + "engine->newArray() <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newArray() <=> engine->newVariant(QVariant(123))", + "engine->newArray() <=> engine->newQObject(engine)", + "engine->newArray(10) <=> QScriptValue(\"NaN\")", + "engine->newArray(10) <=> QScriptValue(\"Infinity\")", + "engine->newArray(10) <=> QScriptValue(\"-Infinity\")", + "engine->newArray(10) <=> QScriptValue(\"ciao\")", + "engine->newArray(10) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->newArray(10) <=> QScriptValue(QString(\"0\"))", + "engine->newArray(10) <=> QScriptValue(QString(\"123\"))", + "engine->newArray(10) <=> QScriptValue(QString(\"12.4\"))", + "engine->newArray(10) <=> QScriptValue(0, \"NaN\")", + "engine->newArray(10) <=> QScriptValue(0, \"Infinity\")", + "engine->newArray(10) <=> QScriptValue(0, \"-Infinity\")", + "engine->newArray(10) <=> QScriptValue(0, \"ciao\")", + "engine->newArray(10) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->newArray(10) <=> QScriptValue(0, QString(\"0\"))", + "engine->newArray(10) <=> QScriptValue(0, QString(\"123\"))", + "engine->newArray(10) <=> QScriptValue(0, QString(\"12.3\"))", + "engine->newArray(10) <=> QScriptValue(engine, \"NaN\")", + "engine->newArray(10) <=> QScriptValue(engine, \"Infinity\")", + "engine->newArray(10) <=> QScriptValue(engine, \"-Infinity\")", + "engine->newArray(10) <=> QScriptValue(engine, \"ciao\")", + "engine->newArray(10) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->newArray(10) <=> QScriptValue(engine, QString(\"0\"))", + "engine->newArray(10) <=> QScriptValue(engine, QString(\"123\"))", + "engine->newArray(10) <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->newArray(10) <=> engine->evaluate(\"Object.prototype\")", + "engine->newArray(10) <=> engine->evaluate(\"Function.prototype\")", + "engine->newArray(10) <=> engine->evaluate(\"Error.prototype\")", + "engine->newArray(10) <=> engine->evaluate(\"Object\")", + "engine->newArray(10) <=> engine->evaluate(\"Array\")", + "engine->newArray(10) <=> engine->evaluate(\"Number\")", + "engine->newArray(10) <=> engine->evaluate(\"Function\")", + "engine->newArray(10) <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->newArray(10) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->newArray(10) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->newArray(10) <=> engine->evaluate(\"/foo/\")", + "engine->newArray(10) <=> engine->evaluate(\"new Object()\")", + "engine->newArray(10) <=> engine->evaluate(\"new Error()\")", + "engine->newArray(10) <=> engine->evaluate(\"Undefined\")", + "engine->newArray(10) <=> engine->evaluate(\"Null\")", + "engine->newArray(10) <=> engine->evaluate(\"True\")", + "engine->newArray(10) <=> engine->evaluate(\"False\")", + "engine->newArray(10) <=> engine->evaluate(\"'ciao'\")", + "engine->newArray(10) <=> engine->evaluate(\"'0'\")", + "engine->newArray(10) <=> engine->evaluate(\"'123'\")", + "engine->newArray(10) <=> engine->evaluate(\"'12.4'\")", + "engine->newArray(10) <=> engine->newObject()", + "engine->newArray(10) <=> engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newArray(10) <=> engine->newQObject(engine)", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(\"ciao\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(0, \"ciao\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(engine, \"ciao\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Function.prototype\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Object\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Array\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Number\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Function\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"'ciao'\")", + "engine->newVariant(QVariant(123)) <=> QScriptValue(uint(124))", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0x43211234)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0x10000)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0x10001)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(qInf())", + "engine->newVariant(QVariant(123)) <=> QScriptValue(\"Infinity\")", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, uint(124))", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, 0x43211234)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, 0x10000)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, 0x10001)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, qInf())", + "engine->newVariant(QVariant(123)) <=> QScriptValue(0, \"Infinity\")", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, uint(124))", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 0x43211234)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 0x10000)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, 0x10001)", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, qInf())", + "engine->newVariant(QVariant(123)) <=> QScriptValue(engine, \"Infinity\")", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"124\")", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"0x43211234\")", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"0x10000\")", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"0x10001\")", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"Infinity\")", + "engine->newVariant(QVariant(false)) <=> QScriptValue(true)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(int(122))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(uint(124))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(123.0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(6.37e-8)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0x43211234)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0x10000)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0x10001)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(qInf())", + "engine->newVariant(QVariant(false)) <=> QScriptValue(\"Infinity\")", + "engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"123\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(QString(\"12.4\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, true)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, int(122))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, uint(124))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, 123.0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, 6.37e-8)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0x43211234)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0x10000)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, 0x10001)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, qInf())", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, \"Infinity\")", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"123\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(0, QString(\"12.3\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, true)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, int(122))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, uint(124))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 123.0)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 6.37e-8)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0x43211234)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0x10000)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, 0x10001)", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, qInf())", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, \"Infinity\")", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"123\"))", + "engine->newVariant(QVariant(false)) <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"true\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"122\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"124\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"123.0\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"6.37e-8\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0x43211234\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0x10000\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"0x10001\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"Infinity\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"'123'\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"'12.4'\")", + "engine->newVariant(QVariant(false)) <=> engine->newVariant(QVariant(123))", + "engine->newQObject(0) <=> QScriptValue(true)", + "engine->newQObject(0) <=> QScriptValue(int(122))", + "engine->newQObject(0) <=> QScriptValue(uint(124))", + "engine->newQObject(0) <=> QScriptValue(123.0)", + "engine->newQObject(0) <=> QScriptValue(6.37e-8)", + "engine->newQObject(0) <=> QScriptValue(0x43211234)", + "engine->newQObject(0) <=> QScriptValue(0x10000)", + "engine->newQObject(0) <=> QScriptValue(0x10001)", + "engine->newQObject(0) <=> QScriptValue(qInf())", + "engine->newQObject(0) <=> QScriptValue(\"Infinity\")", + "engine->newQObject(0) <=> QScriptValue(QString(\"123\"))", + "engine->newQObject(0) <=> QScriptValue(QString(\"12.4\"))", + "engine->newQObject(0) <=> QScriptValue(0, true)", + "engine->newQObject(0) <=> QScriptValue(0, int(122))", + "engine->newQObject(0) <=> QScriptValue(0, uint(124))", + "engine->newQObject(0) <=> QScriptValue(0, 123.0)", + "engine->newQObject(0) <=> QScriptValue(0, 6.37e-8)", + "engine->newQObject(0) <=> QScriptValue(0, 0x43211234)", + "engine->newQObject(0) <=> QScriptValue(0, 0x10000)", + "engine->newQObject(0) <=> QScriptValue(0, 0x10001)", + "engine->newQObject(0) <=> QScriptValue(0, qInf())", + "engine->newQObject(0) <=> QScriptValue(0, \"Infinity\")", + "engine->newQObject(0) <=> QScriptValue(0, QString(\"123\"))", + "engine->newQObject(0) <=> QScriptValue(0, QString(\"12.3\"))", + "engine->newQObject(0) <=> QScriptValue(engine, true)", + "engine->newQObject(0) <=> QScriptValue(engine, int(122))", + "engine->newQObject(0) <=> QScriptValue(engine, uint(124))", + "engine->newQObject(0) <=> QScriptValue(engine, 123.0)", + "engine->newQObject(0) <=> QScriptValue(engine, 6.37e-8)", + "engine->newQObject(0) <=> QScriptValue(engine, 0x43211234)", + "engine->newQObject(0) <=> QScriptValue(engine, 0x10000)", + "engine->newQObject(0) <=> QScriptValue(engine, 0x10001)", + "engine->newQObject(0) <=> QScriptValue(engine, qInf())", + "engine->newQObject(0) <=> QScriptValue(engine, \"Infinity\")", + "engine->newQObject(0) <=> QScriptValue(engine, QString(\"123\"))", + "engine->newQObject(0) <=> QScriptValue(engine, QString(\"1.23\"))", + "engine->newQObject(0) <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->newQObject(0) <=> engine->evaluate(\"true\")", + "engine->newQObject(0) <=> engine->evaluate(\"122\")", + "engine->newQObject(0) <=> engine->evaluate(\"124\")", + "engine->newQObject(0) <=> engine->evaluate(\"123.0\")", + "engine->newQObject(0) <=> engine->evaluate(\"6.37e-8\")", + "engine->newQObject(0) <=> engine->evaluate(\"0x43211234\")", + "engine->newQObject(0) <=> engine->evaluate(\"0x10000\")", + "engine->newQObject(0) <=> engine->evaluate(\"0x10001\")", + "engine->newQObject(0) <=> engine->evaluate(\"Infinity\")", + "engine->newQObject(0) <=> engine->evaluate(\"'123'\")", + "engine->newQObject(0) <=> engine->evaluate(\"'12.4'\")", + "engine->newQObject(0) <=> engine->newVariant(QVariant(123))", + "engine->newQObject(engine) <=> QScriptValue(\"ciao\")", + "engine->newQObject(engine) <=> QScriptValue(QString::fromLatin1(\"ciao\"))", + "engine->newQObject(engine) <=> QScriptValue(0, \"ciao\")", + "engine->newQObject(engine) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "engine->newQObject(engine) <=> QScriptValue(engine, \"ciao\")", + "engine->newQObject(engine) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "engine->newQObject(engine) <=> engine->evaluate(\"Object.prototype\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Function.prototype\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Object\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Array\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Number\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Function\")", + "engine->newQObject(engine) <=> engine->evaluate(\"(function() { return 1; })\")", + "engine->newQObject(engine) <=> engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->newQObject(engine) <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->newQObject(engine) <=> engine->evaluate(\"new Object()\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Undefined\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Null\")", + "engine->newQObject(engine) <=> engine->evaluate(\"True\")", + "engine->newQObject(engine) <=> engine->evaluate(\"False\")", + "engine->newQObject(engine) <=> engine->evaluate(\"'ciao'\")", + "engine->newQObject(engine) <=> engine->newObject()", + "engine->newQObject(engine) <=> engine->newQMetaObject(&QObject::staticMetaObject)",}; + +void tst_QScriptValue::lessThan_makeData(const char *expr) +{ + static QSet equals; + if (equals.isEmpty()) { + equals.reserve(5063); + for (unsigned i = 0; i < 5063; ++i) + equals.insert(lessThan_array[i]); + } + QHash::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); + newRow(tag.toLatin1()) << it.value() << equals.contains(tag); + } +} + +void tst_QScriptValue::lessThan_test(const char *, const QScriptValue& value) +{ + QFETCH(QScriptValue, other); + QFETCH(bool, expected); + QCOMPARE(value.lessThan(other), expected); +} + +DEFINE_TEST_FUNCTION(lessThan) + + +void tst_QScriptValue::instanceOf_initData() +{ + QTest::addColumn("other"); + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString instanceOf_array [] = { + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"[]\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Object\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Number\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Function\")", + "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Array\")", + "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"Null\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"True\") <=> engine->evaluate(\"Object\")", + "engine->evaluate(\"False\") <=> engine->evaluate(\"Object\")", + "engine->newObject() <=> engine->evaluate(\"Object\")", + "engine->newArray() <=> engine->evaluate(\"Object\")", + "engine->newArray() <=> engine->evaluate(\"Array\")", + "engine->newArray(10) <=> engine->evaluate(\"Object\")", + "engine->newArray(10) <=> engine->evaluate(\"Array\")", + "engine->newDate(QDateTime()) <=> engine->evaluate(\"Object\")", + "engine->newQMetaObject(&QObject::staticMetaObject) <=> engine->evaluate(\"Object\")", + "engine->newVariant(QVariant()) <=> engine->evaluate(\"Object\")", + "engine->newVariant(QVariant(123)) <=> engine->evaluate(\"Object\")", + "engine->newVariant(QVariant(false)) <=> engine->evaluate(\"Object\")", + "engine->newQObject(engine) <=> engine->evaluate(\"Object\")",}; + +void tst_QScriptValue::instanceOf_makeData(const char *expr) +{ + static QSet equals; + if (equals.isEmpty()) { + equals.reserve(40); + for (unsigned i = 0; i < 40; ++i) + equals.insert(instanceOf_array[i]); + } + QHash::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + QString tag = QString::fromLatin1("%20 <=> %21").arg(expr).arg(it.key()); + newRow(tag.toLatin1()) << it.value() << equals.contains(tag); + } +} + +void tst_QScriptValue::instanceOf_test(const char *, const QScriptValue& value) +{ + QFETCH(QScriptValue, other); + QFETCH(bool, expected); + QCOMPARE(value.instanceOf(other), expected); +} + +DEFINE_TEST_FUNCTION(instanceOf) diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_init.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_init.cpp new file mode 100644 index 0000000..a9eb2ca --- /dev/null +++ b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_init.cpp @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +*************** This file has been generated. DO NOT MODIFY! **************** +****************************************************************************/ + +#include "tst_qscriptvalue.h" + + +void tst_QScriptValue::initScriptValues() +{ + m_values.clear(); + if (engine) + delete engine; + engine = new QScriptEngine; + DEFINE_TEST_VALUE(QScriptValue()); + DEFINE_TEST_VALUE(QScriptValue(QScriptValue::UndefinedValue)); + DEFINE_TEST_VALUE(QScriptValue(QScriptValue::NullValue)); + DEFINE_TEST_VALUE(QScriptValue(true)); + DEFINE_TEST_VALUE(QScriptValue(false)); + DEFINE_TEST_VALUE(QScriptValue(int(122))); + DEFINE_TEST_VALUE(QScriptValue(uint(124))); + DEFINE_TEST_VALUE(QScriptValue(0)); + DEFINE_TEST_VALUE(QScriptValue(0.0)); + DEFINE_TEST_VALUE(QScriptValue(123.0)); + DEFINE_TEST_VALUE(QScriptValue(6.37e-8)); + DEFINE_TEST_VALUE(QScriptValue(-6.37e-8)); + DEFINE_TEST_VALUE(QScriptValue(0x43211234)); + DEFINE_TEST_VALUE(QScriptValue(0x10000)); + DEFINE_TEST_VALUE(QScriptValue(0x10001)); + DEFINE_TEST_VALUE(QScriptValue(qSNaN())); + DEFINE_TEST_VALUE(QScriptValue(qQNaN())); + DEFINE_TEST_VALUE(QScriptValue(qInf())); + DEFINE_TEST_VALUE(QScriptValue(-qInf())); + DEFINE_TEST_VALUE(QScriptValue("NaN")); + DEFINE_TEST_VALUE(QScriptValue("Infinity")); + DEFINE_TEST_VALUE(QScriptValue("-Infinity")); + DEFINE_TEST_VALUE(QScriptValue("ciao")); + DEFINE_TEST_VALUE(QScriptValue(QString::fromLatin1("ciao"))); + DEFINE_TEST_VALUE(QScriptValue(QString(""))); + DEFINE_TEST_VALUE(QScriptValue(QString())); + DEFINE_TEST_VALUE(QScriptValue(QString("0"))); + DEFINE_TEST_VALUE(QScriptValue(QString("123"))); + DEFINE_TEST_VALUE(QScriptValue(QString("12.4"))); + DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::UndefinedValue)); + DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::NullValue)); + DEFINE_TEST_VALUE(QScriptValue(0, true)); + DEFINE_TEST_VALUE(QScriptValue(0, false)); + DEFINE_TEST_VALUE(QScriptValue(0, int(122))); + DEFINE_TEST_VALUE(QScriptValue(0, uint(124))); + DEFINE_TEST_VALUE(QScriptValue(0, 0)); + DEFINE_TEST_VALUE(QScriptValue(0, 0.0)); + DEFINE_TEST_VALUE(QScriptValue(0, 123.0)); + DEFINE_TEST_VALUE(QScriptValue(0, 6.37e-8)); + DEFINE_TEST_VALUE(QScriptValue(0, -6.37e-8)); + DEFINE_TEST_VALUE(QScriptValue(0, 0x43211234)); + DEFINE_TEST_VALUE(QScriptValue(0, 0x10000)); + DEFINE_TEST_VALUE(QScriptValue(0, 0x10001)); + DEFINE_TEST_VALUE(QScriptValue(0, qSNaN())); + DEFINE_TEST_VALUE(QScriptValue(0, qQNaN())); + DEFINE_TEST_VALUE(QScriptValue(0, qInf())); + DEFINE_TEST_VALUE(QScriptValue(0, -qInf())); + DEFINE_TEST_VALUE(QScriptValue(0, "NaN")); + DEFINE_TEST_VALUE(QScriptValue(0, "Infinity")); + DEFINE_TEST_VALUE(QScriptValue(0, "-Infinity")); + DEFINE_TEST_VALUE(QScriptValue(0, "ciao")); + DEFINE_TEST_VALUE(QScriptValue(0, QString::fromLatin1("ciao"))); + DEFINE_TEST_VALUE(QScriptValue(0, QString(""))); + DEFINE_TEST_VALUE(QScriptValue(0, QString())); + DEFINE_TEST_VALUE(QScriptValue(0, QString("0"))); + DEFINE_TEST_VALUE(QScriptValue(0, QString("123"))); + DEFINE_TEST_VALUE(QScriptValue(0, QString("12.3"))); + DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::UndefinedValue)); + DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::NullValue)); + DEFINE_TEST_VALUE(QScriptValue(engine, true)); + DEFINE_TEST_VALUE(QScriptValue(engine, false)); + DEFINE_TEST_VALUE(QScriptValue(engine, int(122))); + DEFINE_TEST_VALUE(QScriptValue(engine, uint(124))); + DEFINE_TEST_VALUE(QScriptValue(engine, 0)); + DEFINE_TEST_VALUE(QScriptValue(engine, 0.0)); + DEFINE_TEST_VALUE(QScriptValue(engine, 123.0)); + DEFINE_TEST_VALUE(QScriptValue(engine, 6.37e-8)); + DEFINE_TEST_VALUE(QScriptValue(engine, -6.37e-8)); + DEFINE_TEST_VALUE(QScriptValue(engine, 0x43211234)); + DEFINE_TEST_VALUE(QScriptValue(engine, 0x10000)); + DEFINE_TEST_VALUE(QScriptValue(engine, 0x10001)); + DEFINE_TEST_VALUE(QScriptValue(engine, qSNaN())); + DEFINE_TEST_VALUE(QScriptValue(engine, qQNaN())); + DEFINE_TEST_VALUE(QScriptValue(engine, qInf())); + DEFINE_TEST_VALUE(QScriptValue(engine, -qInf())); + DEFINE_TEST_VALUE(QScriptValue(engine, "NaN")); + DEFINE_TEST_VALUE(QScriptValue(engine, "Infinity")); + DEFINE_TEST_VALUE(QScriptValue(engine, "-Infinity")); + DEFINE_TEST_VALUE(QScriptValue(engine, "ciao")); + DEFINE_TEST_VALUE(QScriptValue(engine, QString::fromLatin1("ciao"))); + DEFINE_TEST_VALUE(QScriptValue(engine, QString(""))); + DEFINE_TEST_VALUE(QScriptValue(engine, QString())); + DEFINE_TEST_VALUE(QScriptValue(engine, QString("0"))); + DEFINE_TEST_VALUE(QScriptValue(engine, QString("123"))); + DEFINE_TEST_VALUE(QScriptValue(engine, QString("1.23"))); + DEFINE_TEST_VALUE(engine->evaluate("[]")); + DEFINE_TEST_VALUE(engine->evaluate("{}")); + DEFINE_TEST_VALUE(engine->evaluate("Object.prototype")); + DEFINE_TEST_VALUE(engine->evaluate("Date.prototype")); + DEFINE_TEST_VALUE(engine->evaluate("Array.prototype")); + DEFINE_TEST_VALUE(engine->evaluate("Function.prototype")); + DEFINE_TEST_VALUE(engine->evaluate("Error.prototype")); + DEFINE_TEST_VALUE(engine->evaluate("Object")); + DEFINE_TEST_VALUE(engine->evaluate("Array")); + DEFINE_TEST_VALUE(engine->evaluate("Number")); + DEFINE_TEST_VALUE(engine->evaluate("Function")); + DEFINE_TEST_VALUE(engine->evaluate("(function() { return 1; })")); + DEFINE_TEST_VALUE(engine->evaluate("(function() { return 'ciao'; })")); + DEFINE_TEST_VALUE(engine->evaluate("(function() { throw new Error('foo'); })")); + DEFINE_TEST_VALUE(engine->evaluate("/foo/")); + DEFINE_TEST_VALUE(engine->evaluate("new Object()")); + DEFINE_TEST_VALUE(engine->evaluate("new Array()")); + DEFINE_TEST_VALUE(engine->evaluate("new Error()")); + DEFINE_TEST_VALUE(engine->evaluate("a = new Object(); a.foo = 22; a.foo")); + DEFINE_TEST_VALUE(engine->evaluate("Undefined")); + DEFINE_TEST_VALUE(engine->evaluate("Null")); + DEFINE_TEST_VALUE(engine->evaluate("True")); + DEFINE_TEST_VALUE(engine->evaluate("False")); + DEFINE_TEST_VALUE(engine->evaluate("undefined")); + DEFINE_TEST_VALUE(engine->evaluate("null")); + DEFINE_TEST_VALUE(engine->evaluate("true")); + DEFINE_TEST_VALUE(engine->evaluate("false")); + DEFINE_TEST_VALUE(engine->evaluate("122")); + DEFINE_TEST_VALUE(engine->evaluate("124")); + DEFINE_TEST_VALUE(engine->evaluate("0")); + DEFINE_TEST_VALUE(engine->evaluate("0.0")); + DEFINE_TEST_VALUE(engine->evaluate("123.0")); + DEFINE_TEST_VALUE(engine->evaluate("6.37e-8")); + DEFINE_TEST_VALUE(engine->evaluate("-6.37e-8")); + DEFINE_TEST_VALUE(engine->evaluate("0x43211234")); + DEFINE_TEST_VALUE(engine->evaluate("0x10000")); + DEFINE_TEST_VALUE(engine->evaluate("0x10001")); + DEFINE_TEST_VALUE(engine->evaluate("NaN")); + DEFINE_TEST_VALUE(engine->evaluate("Infinity")); + DEFINE_TEST_VALUE(engine->evaluate("-Infinity")); + DEFINE_TEST_VALUE(engine->evaluate("'ciao'")); + DEFINE_TEST_VALUE(engine->evaluate("''")); + DEFINE_TEST_VALUE(engine->evaluate("'0'")); + DEFINE_TEST_VALUE(engine->evaluate("'123'")); + DEFINE_TEST_VALUE(engine->evaluate("'12.4'")); + DEFINE_TEST_VALUE(engine->nullValue()); + DEFINE_TEST_VALUE(engine->undefinedValue()); + DEFINE_TEST_VALUE(engine->newObject()); + DEFINE_TEST_VALUE(engine->newArray()); + DEFINE_TEST_VALUE(engine->newArray(10)); + DEFINE_TEST_VALUE(engine->newDate(QDateTime())); + DEFINE_TEST_VALUE(engine->newQMetaObject(&QObject::staticMetaObject)); + DEFINE_TEST_VALUE(engine->newVariant(QVariant())); + DEFINE_TEST_VALUE(engine->newVariant(QVariant(123))); + DEFINE_TEST_VALUE(engine->newVariant(QVariant(false))); + DEFINE_TEST_VALUE(engine->newQObject(0)); + DEFINE_TEST_VALUE(engine->newQObject(engine)); +} + diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_isXXX.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_isXXX.cpp new file mode 100644 index 0000000..106043b --- /dev/null +++ b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_isXXX.cpp @@ -0,0 +1,830 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +*************** This file has been generated. DO NOT MODIFY! **************** +****************************************************************************/ + +#include "tst_qscriptvalue.h" + + +void tst_QScriptValue::isValid_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isValid_array [] = { + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; + +void tst_QScriptValue::isValid_makeData(const char* expr) +{ + static QSet isValid; + if (isValid.isEmpty()) { + isValid.reserve(141); + for (unsigned i = 0; i < 141; ++i) + isValid.insert(isValid_array[i]); + } + newRow(expr) << isValid.contains(expr); +} + +void tst_QScriptValue::isValid_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isValid(), expected); + QCOMPARE(value.isValid(), expected); +} + +DEFINE_TEST_FUNCTION(isValid) + + +void tst_QScriptValue::isBool_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isBool_array [] = { + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")",}; + +void tst_QScriptValue::isBool_makeData(const char* expr) +{ + static QSet isBool; + if (isBool.isEmpty()) { + isBool.reserve(8); + for (unsigned i = 0; i < 8; ++i) + isBool.insert(isBool_array[i]); + } + newRow(expr) << isBool.contains(expr); +} + +void tst_QScriptValue::isBool_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isBool(), expected); + QCOMPARE(value.isBool(), expected); +} + +DEFINE_TEST_FUNCTION(isBool) + + +void tst_QScriptValue::isBoolean_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isBoolean_array [] = { + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")",}; + +void tst_QScriptValue::isBoolean_makeData(const char* expr) +{ + static QSet isBoolean; + if (isBoolean.isEmpty()) { + isBoolean.reserve(8); + for (unsigned i = 0; i < 8; ++i) + isBoolean.insert(isBoolean_array[i]); + } + newRow(expr) << isBoolean.contains(expr); +} + +void tst_QScriptValue::isBoolean_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isBoolean(), expected); + QCOMPARE(value.isBoolean(), expected); +} + +DEFINE_TEST_FUNCTION(isBoolean) + + +void tst_QScriptValue::isNumber_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isNumber_array [] = { + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")",}; + +void tst_QScriptValue::isNumber_makeData(const char* expr) +{ + static QSet isNumber; + if (isNumber.isEmpty()) { + isNumber.reserve(56); + for (unsigned i = 0; i < 56; ++i) + isNumber.insert(isNumber_array[i]); + } + newRow(expr) << isNumber.contains(expr); +} + +void tst_QScriptValue::isNumber_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isNumber(), expected); + QCOMPARE(value.isNumber(), expected); +} + +DEFINE_TEST_FUNCTION(isNumber) + + +void tst_QScriptValue::isFunction_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isFunction_array [] = { + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->newQMetaObject(&QObject::staticMetaObject)",}; + +void tst_QScriptValue::isFunction_makeData(const char* expr) +{ + static QSet isFunction; + if (isFunction.isEmpty()) { + isFunction.reserve(10); + for (unsigned i = 0; i < 10; ++i) + isFunction.insert(isFunction_array[i]); + } + newRow(expr) << isFunction.contains(expr); +} + +void tst_QScriptValue::isFunction_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isFunction(), expected); + QCOMPARE(value.isFunction(), expected); +} + +DEFINE_TEST_FUNCTION(isFunction) + + +void tst_QScriptValue::isNull_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isNull_array [] = { + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "engine->evaluate(\"null\")", + "engine->nullValue()", + "engine->newQObject(0)",}; + +void tst_QScriptValue::isNull_makeData(const char* expr) +{ + static QSet isNull; + if (isNull.isEmpty()) { + isNull.reserve(6); + for (unsigned i = 0; i < 6; ++i) + isNull.insert(isNull_array[i]); + } + newRow(expr) << isNull.contains(expr); +} + +void tst_QScriptValue::isNull_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isNull(), expected); + QCOMPARE(value.isNull(), expected); +} + +DEFINE_TEST_FUNCTION(isNull) + + +void tst_QScriptValue::isString_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isString_array [] = { + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")",}; + +void tst_QScriptValue::isString_makeData(const char* expr) +{ + static QSet isString; + if (isString.isEmpty()) { + isString.reserve(35); + for (unsigned i = 0; i < 35; ++i) + isString.insert(isString_array[i]); + } + newRow(expr) << isString.contains(expr); +} + +void tst_QScriptValue::isString_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isString(), expected); + QCOMPARE(value.isString(), expected); +} + +DEFINE_TEST_FUNCTION(isString) + + +void tst_QScriptValue::isUndefined_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isUndefined_array [] = { + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"undefined\")", + "engine->undefinedValue()",}; + +void tst_QScriptValue::isUndefined_makeData(const char* expr) +{ + static QSet isUndefined; + if (isUndefined.isEmpty()) { + isUndefined.reserve(6); + for (unsigned i = 0; i < 6; ++i) + isUndefined.insert(isUndefined_array[i]); + } + newRow(expr) << isUndefined.contains(expr); +} + +void tst_QScriptValue::isUndefined_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isUndefined(), expected); + QCOMPARE(value.isUndefined(), expected); +} + +DEFINE_TEST_FUNCTION(isUndefined) + + +void tst_QScriptValue::isVariant_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isVariant_array [] = { + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))",}; + +void tst_QScriptValue::isVariant_makeData(const char* expr) +{ + static QSet isVariant; + if (isVariant.isEmpty()) { + isVariant.reserve(3); + for (unsigned i = 0; i < 3; ++i) + isVariant.insert(isVariant_array[i]); + } + newRow(expr) << isVariant.contains(expr); +} + +void tst_QScriptValue::isVariant_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isVariant(), expected); + QCOMPARE(value.isVariant(), expected); +} + +DEFINE_TEST_FUNCTION(isVariant) + + +void tst_QScriptValue::isQObject_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isQObject_array [] = { + "engine->newQObject(engine)",}; + +void tst_QScriptValue::isQObject_makeData(const char* expr) +{ + static QSet isQObject; + if (isQObject.isEmpty()) { + isQObject.reserve(1); + for (unsigned i = 0; i < 1; ++i) + isQObject.insert(isQObject_array[i]); + } + newRow(expr) << isQObject.contains(expr); +} + +void tst_QScriptValue::isQObject_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isQObject(), expected); + QCOMPARE(value.isQObject(), expected); +} + +DEFINE_TEST_FUNCTION(isQObject) + + +void tst_QScriptValue::isQMetaObject_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isQMetaObject_array [] = { + "engine->newQMetaObject(&QObject::staticMetaObject)",}; + +void tst_QScriptValue::isQMetaObject_makeData(const char* expr) +{ + static QSet isQMetaObject; + if (isQMetaObject.isEmpty()) { + isQMetaObject.reserve(1); + for (unsigned i = 0; i < 1; ++i) + isQMetaObject.insert(isQMetaObject_array[i]); + } + newRow(expr) << isQMetaObject.contains(expr); +} + +void tst_QScriptValue::isQMetaObject_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isQMetaObject(), expected); + QCOMPARE(value.isQMetaObject(), expected); +} + +DEFINE_TEST_FUNCTION(isQMetaObject) + + +void tst_QScriptValue::isObject_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isObject_array [] = { + "engine->evaluate(\"[]\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(engine)",}; + +void tst_QScriptValue::isObject_makeData(const char* expr) +{ + static QSet isObject; + if (isObject.isEmpty()) { + isObject.reserve(30); + for (unsigned i = 0; i < 30; ++i) + isObject.insert(isObject_array[i]); + } + newRow(expr) << isObject.contains(expr); +} + +void tst_QScriptValue::isObject_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isObject(), expected); + QCOMPARE(value.isObject(), expected); +} + +DEFINE_TEST_FUNCTION(isObject) + + +void tst_QScriptValue::isDate_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isDate_array [] = { + "engine->evaluate(\"Date.prototype\")", + "engine->newDate(QDateTime())",}; + +void tst_QScriptValue::isDate_makeData(const char* expr) +{ + static QSet isDate; + if (isDate.isEmpty()) { + isDate.reserve(2); + for (unsigned i = 0; i < 2; ++i) + isDate.insert(isDate_array[i]); + } + newRow(expr) << isDate.contains(expr); +} + +void tst_QScriptValue::isDate_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isDate(), expected); + QCOMPARE(value.isDate(), expected); +} + +DEFINE_TEST_FUNCTION(isDate) + + +void tst_QScriptValue::isRegExp_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isRegExp_array [] = { + "engine->evaluate(\"/foo/\")",}; + +void tst_QScriptValue::isRegExp_makeData(const char* expr) +{ + static QSet isRegExp; + if (isRegExp.isEmpty()) { + isRegExp.reserve(1); + for (unsigned i = 0; i < 1; ++i) + isRegExp.insert(isRegExp_array[i]); + } + newRow(expr) << isRegExp.contains(expr); +} + +void tst_QScriptValue::isRegExp_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isRegExp(), expected); + QCOMPARE(value.isRegExp(), expected); +} + +DEFINE_TEST_FUNCTION(isRegExp) + + +void tst_QScriptValue::isArray_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isArray_array [] = { + "engine->evaluate(\"[]\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"new Array()\")", + "engine->newArray()", + "engine->newArray(10)",}; + +void tst_QScriptValue::isArray_makeData(const char* expr) +{ + static QSet isArray; + if (isArray.isEmpty()) { + isArray.reserve(5); + for (unsigned i = 0; i < 5; ++i) + isArray.insert(isArray_array[i]); + } + newRow(expr) << isArray.contains(expr); +} + +void tst_QScriptValue::isArray_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isArray(), expected); + QCOMPARE(value.isArray(), expected); +} + +DEFINE_TEST_FUNCTION(isArray) + + +void tst_QScriptValue::isError_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString isError_array [] = { + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")",}; + +void tst_QScriptValue::isError_makeData(const char* expr) +{ + static QSet isError; + if (isError.isEmpty()) { + isError.reserve(6); + for (unsigned i = 0; i < 6; ++i) + isError.insert(isError_array[i]); + } + newRow(expr) << isError.contains(expr); +} + +void tst_QScriptValue::isError_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.isError(), expected); + QCOMPARE(value.isError(), expected); +} + +DEFINE_TEST_FUNCTION(isError) + diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_toXXX.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_toXXX.cpp new file mode 100644 index 0000000..754f4e0 --- /dev/null +++ b/tests/auto/qscriptvalue/tst_qscriptvalue_generated_toXXX.cpp @@ -0,0 +1,1897 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +*************** This file has been generated. DO NOT MODIFY! **************** +****************************************************************************/ + +#include "tst_qscriptvalue.h" + + + +void tst_QScriptValue::toString_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toString_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; + +static QString toString_valueArray [] = { + "", "undefined", + "null", "true", + "false", "122", + "124", "0", + "0", "123", + "6.37e-8", "-6.37e-8", + "1126240820", "65536", + "65537", "NaN", + "NaN", "Infinity", + "-Infinity", "NaN", + "Infinity", "-Infinity", + "ciao", "ciao", + "", "", + "0", "123", + "12.4", "undefined", + "null", "true", + "false", "122", + "124", "0", + "0", "123", + "6.37e-8", "-6.37e-8", + "1126240820", "65536", + "65537", "NaN", + "NaN", "Infinity", + "-Infinity", "NaN", + "Infinity", "-Infinity", + "ciao", "ciao", + "", "", + "0", "123", + "12.3", "undefined", + "null", "true", + "false", "122", + "124", "0", + "0", "123", + "6.37e-8", "-6.37e-8", + "1126240820", "65536", + "65537", "NaN", + "NaN", "Infinity", + "-Infinity", "NaN", + "Infinity", "-Infinity", + "ciao", "ciao", + "", "", + "0", "123", + "1.23", "", + "undefined", "[object Object]", + "Invalid Date", "", + "function () {\n [native code]\n}", "Error: Unknown error", + "function Object() {\n [native code]\n}", "function Array() {\n [native code]\n}", + "function Number() {\n [native code]\n}", "function Function() {\n [native code]\n}", + "function () { return 1; }", "function () { return 'ciao'; }", + "function () { throw new Error('foo'); }", "/foo/", + "[object Object]", "", + "Error: Unknown error", "22", + "ReferenceError: Can't find variable: Undefined", "ReferenceError: Can't find variable: Null", + "ReferenceError: Can't find variable: True", "ReferenceError: Can't find variable: False", + "undefined", "null", + "true", "false", + "122", "124", + "0", "0", + "123", "6.37e-8", + "-6.37e-8", "1126240820", + "65536", "65537", + "NaN", "Infinity", + "-Infinity", "ciao", + "", "0", + "123", "12.4", + "null", "undefined", + "[object Object]", "", + ",,,,,,,,,", "Invalid Date", + "[object QMetaObject]", "undefined", + "123", "false", + "null", "QScriptEngine(name = \"\")", }; + +void tst_QScriptValue::toString_makeData(const char* expr) +{ + static QHash toString; + if (toString.isEmpty()) { + toString.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toString.insert(toString_tagArray[i], toString_valueArray[i]); + } + newRow(expr) << toString.value(expr); +} + +void tst_QScriptValue::toString_test(const char*, const QScriptValue& value) +{ + QFETCH(QString, expected); + QCOMPARE(value.toString(), expected); + QCOMPARE(value.toString(), expected); +} + +DEFINE_TEST_FUNCTION(toString) + + +void tst_QScriptValue::toNumber_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toNumber_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static qsreal toNumber_valueArray [] = { + 0, qQNaN(), 0, 1, 0, 122, 124, 0, 0, 123, + 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), + qInf(), qInf(), qQNaN(), qQNaN(), 0, 0, 0, 123, 12.4, qQNaN(), + 0, 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, + 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(), + qQNaN(), qQNaN(), 0, 0, 0, 123, 12.3, qQNaN(), 0, 1, + 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536, + 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(), qQNaN(), qQNaN(), + 0, 0, 0, 123, 1.23, 0, qQNaN(), qQNaN(), qQNaN(), 0, + qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), + qQNaN(), 0, qQNaN(), 22, qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), 0, + 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, + 65536, 65537, qQNaN(), qInf(), qInf(), qQNaN(), 0, 0, 123, 12.4, + 0, qQNaN(), qQNaN(), 0, qQNaN(), qQNaN(), qQNaN(), qQNaN(), 123, 0, + 0, qQNaN(), }; +void tst_QScriptValue::toNumber_makeData(const char* expr) +{ + static QHash toNumber; + if (toNumber.isEmpty()) { + toNumber.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toNumber.insert(toNumber_tagArray[i], toNumber_valueArray[i]); + } + newRow(expr) << toNumber.value(expr); +} + +void tst_QScriptValue::toNumber_test(const char*, const QScriptValue& value) +{ + QFETCH(qsreal, expected); + if (qIsNaN(expected)) { + QVERIFY(qIsNaN(value.toNumber())); + return; + } + if (qIsInf(expected)) { + QVERIFY(qIsInf(value.toNumber())); + QVERIFY(qIsInf(value.toNumber())); + return; + } + QCOMPARE(value.toNumber(), expected); + QCOMPARE(value.toNumber(), expected); +} + +DEFINE_TEST_FUNCTION(toNumber) + + +void tst_QScriptValue::toBool_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toBool_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; + +static bool toBool_valueArray [] = { + false, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, true, + false, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + false, false, + true, false, + true, true, + false, false, + true, true, + true, true, + true, true, + false, true, + true, true, + false, true, + true, true, + false, false, + true, true, + true, true, + true, true, + true, true, + false, true, }; + +void tst_QScriptValue::toBool_makeData(const char* expr) +{ + static QHash toBool; + if (toBool.isEmpty()) { + toBool.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toBool.insert(toBool_tagArray[i], toBool_valueArray[i]); + } + newRow(expr) << toBool.value(expr); +} + +void tst_QScriptValue::toBool_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.toBool(), expected); + QCOMPARE(value.toBool(), expected); +} + +DEFINE_TEST_FUNCTION(toBool) + + +void tst_QScriptValue::toBoolean_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toBoolean_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; + +static bool toBoolean_valueArray [] = { + false, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, false, + false, true, + false, true, + true, false, + false, true, + true, true, + true, true, + true, false, + false, true, + true, true, + true, true, + true, true, + false, false, + true, true, + true, true, + false, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + true, true, + false, false, + true, false, + true, true, + false, false, + true, true, + true, true, + true, true, + false, true, + true, true, + false, true, + true, true, + false, false, + true, true, + true, true, + true, true, + true, true, + false, true, }; + +void tst_QScriptValue::toBoolean_makeData(const char* expr) +{ + static QHash toBoolean; + if (toBoolean.isEmpty()) { + toBoolean.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toBoolean.insert(toBoolean_tagArray[i], toBoolean_valueArray[i]); + } + newRow(expr) << toBoolean.value(expr); +} + +void tst_QScriptValue::toBoolean_test(const char*, const QScriptValue& value) +{ + QFETCH(bool, expected); + QCOMPARE(value.toBoolean(), expected); + QCOMPARE(value.toBoolean(), expected); +} + +DEFINE_TEST_FUNCTION(toBoolean) + + +void tst_QScriptValue::toInteger_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toInteger_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; +static qsreal toInteger_valueArray [] = { + 0, 0, 0, 1, 0, 122, 124, 0, 0, 123, + 0, 0, 1126240820, 65536, 65537, 0, 0, qInf(), qInf(), 0, + qInf(), qInf(), 0, 0, 0, 0, 0, 123, 12, 0, + 0, 1, 0, 122, 124, 0, 0, 123, 0, 0, + 1126240820, 65536, 65537, 0, 0, qInf(), qInf(), 0, qInf(), qInf(), + 0, 0, 0, 0, 0, 123, 12, 0, 0, 1, + 0, 122, 124, 0, 0, 123, 0, 0, 1126240820, 65536, + 65537, 0, 0, qInf(), qInf(), 0, qInf(), qInf(), 0, 0, + 0, 0, 0, 123, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, + 1, 0, 122, 124, 0, 0, 123, 0, 0, 1126240820, + 65536, 65537, 0, qInf(), qInf(), 0, 0, 0, 123, 12, + 0, 0, 0, 0, 0, 0, 0, 0, 123, 0, + 0, 0, }; +void tst_QScriptValue::toInteger_makeData(const char* expr) +{ + static QHash toInteger; + if (toInteger.isEmpty()) { + toInteger.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toInteger.insert(toInteger_tagArray[i], toInteger_valueArray[i]); + } + newRow(expr) << toInteger.value(expr); +} + +void tst_QScriptValue::toInteger_test(const char*, const QScriptValue& value) +{ + QFETCH(qsreal, expected); + if (qIsInf(expected)) { + QVERIFY(qIsInf(value.toInteger())); + QVERIFY(qIsInf(value.toInteger())); + return; + } + QCOMPARE(value.toInteger(), expected); + QCOMPARE(value.toInteger(), expected); +} + +DEFINE_TEST_FUNCTION(toInteger) + + +void tst_QScriptValue::toInt32_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toInt32_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; + +static qint32 toInt32_valueArray [] = { + 0, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 22, + 0, 0, + 0, 0, + 0, 0, + 1, 0, + 122, 124, + 0, 0, + 123, 0, + 0, 1126240820, + 65536, 65537, + 0, 0, + 0, 0, + 0, 0, + 123, 12, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 123, 0, + 0, 0, }; + +void tst_QScriptValue::toInt32_makeData(const char* expr) +{ + static QHash toInt32; + if (toInt32.isEmpty()) { + toInt32.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toInt32.insert(toInt32_tagArray[i], toInt32_valueArray[i]); + } + newRow(expr) << toInt32.value(expr); +} + +void tst_QScriptValue::toInt32_test(const char*, const QScriptValue& value) +{ + QFETCH(qint32, expected); + QCOMPARE(value.toInt32(), expected); + QCOMPARE(value.toInt32(), expected); +} + +DEFINE_TEST_FUNCTION(toInt32) + + +void tst_QScriptValue::toUInt32_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toUInt32_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; + +static quint32 toUInt32_valueArray [] = { + 0, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 1126240820, 65536, + 65537, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 22, + 0, 0, + 0, 0, + 0, 0, + 1, 0, + 122, 124, + 0, 0, + 123, 0, + 0, 1126240820, + 65536, 65537, + 0, 0, + 0, 0, + 0, 0, + 123, 12, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 123, 0, + 0, 0, }; + +void tst_QScriptValue::toUInt32_makeData(const char* expr) +{ + static QHash toUInt32; + if (toUInt32.isEmpty()) { + toUInt32.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toUInt32.insert(toUInt32_tagArray[i], toUInt32_valueArray[i]); + } + newRow(expr) << toUInt32.value(expr); +} + +void tst_QScriptValue::toUInt32_test(const char*, const QScriptValue& value) +{ + QFETCH(quint32, expected); + QCOMPARE(value.toUInt32(), expected); + QCOMPARE(value.toUInt32(), expected); +} + +DEFINE_TEST_FUNCTION(toUInt32) + + +void tst_QScriptValue::toUInt16_initData() +{ + QTest::addColumn("expected"); + initScriptValues(); +} + +static QString toUInt16_tagArray [] = { + "QScriptValue()", + "QScriptValue(QScriptValue::UndefinedValue)", + "QScriptValue(QScriptValue::NullValue)", + "QScriptValue(true)", + "QScriptValue(false)", + "QScriptValue(int(122))", + "QScriptValue(uint(124))", + "QScriptValue(0)", + "QScriptValue(0.0)", + "QScriptValue(123.0)", + "QScriptValue(6.37e-8)", + "QScriptValue(-6.37e-8)", + "QScriptValue(0x43211234)", + "QScriptValue(0x10000)", + "QScriptValue(0x10001)", + "QScriptValue(qSNaN())", + "QScriptValue(qQNaN())", + "QScriptValue(qInf())", + "QScriptValue(-qInf())", + "QScriptValue(\"NaN\")", + "QScriptValue(\"Infinity\")", + "QScriptValue(\"-Infinity\")", + "QScriptValue(\"ciao\")", + "QScriptValue(QString::fromLatin1(\"ciao\"))", + "QScriptValue(QString(\"\"))", + "QScriptValue(QString())", + "QScriptValue(QString(\"0\"))", + "QScriptValue(QString(\"123\"))", + "QScriptValue(QString(\"12.4\"))", + "QScriptValue(0, QScriptValue::UndefinedValue)", + "QScriptValue(0, QScriptValue::NullValue)", + "QScriptValue(0, true)", + "QScriptValue(0, false)", + "QScriptValue(0, int(122))", + "QScriptValue(0, uint(124))", + "QScriptValue(0, 0)", + "QScriptValue(0, 0.0)", + "QScriptValue(0, 123.0)", + "QScriptValue(0, 6.37e-8)", + "QScriptValue(0, -6.37e-8)", + "QScriptValue(0, 0x43211234)", + "QScriptValue(0, 0x10000)", + "QScriptValue(0, 0x10001)", + "QScriptValue(0, qSNaN())", + "QScriptValue(0, qQNaN())", + "QScriptValue(0, qInf())", + "QScriptValue(0, -qInf())", + "QScriptValue(0, \"NaN\")", + "QScriptValue(0, \"Infinity\")", + "QScriptValue(0, \"-Infinity\")", + "QScriptValue(0, \"ciao\")", + "QScriptValue(0, QString::fromLatin1(\"ciao\"))", + "QScriptValue(0, QString(\"\"))", + "QScriptValue(0, QString())", + "QScriptValue(0, QString(\"0\"))", + "QScriptValue(0, QString(\"123\"))", + "QScriptValue(0, QString(\"12.3\"))", + "QScriptValue(engine, QScriptValue::UndefinedValue)", + "QScriptValue(engine, QScriptValue::NullValue)", + "QScriptValue(engine, true)", + "QScriptValue(engine, false)", + "QScriptValue(engine, int(122))", + "QScriptValue(engine, uint(124))", + "QScriptValue(engine, 0)", + "QScriptValue(engine, 0.0)", + "QScriptValue(engine, 123.0)", + "QScriptValue(engine, 6.37e-8)", + "QScriptValue(engine, -6.37e-8)", + "QScriptValue(engine, 0x43211234)", + "QScriptValue(engine, 0x10000)", + "QScriptValue(engine, 0x10001)", + "QScriptValue(engine, qSNaN())", + "QScriptValue(engine, qQNaN())", + "QScriptValue(engine, qInf())", + "QScriptValue(engine, -qInf())", + "QScriptValue(engine, \"NaN\")", + "QScriptValue(engine, \"Infinity\")", + "QScriptValue(engine, \"-Infinity\")", + "QScriptValue(engine, \"ciao\")", + "QScriptValue(engine, QString::fromLatin1(\"ciao\"))", + "QScriptValue(engine, QString(\"\"))", + "QScriptValue(engine, QString())", + "QScriptValue(engine, QString(\"0\"))", + "QScriptValue(engine, QString(\"123\"))", + "QScriptValue(engine, QString(\"1.23\"))", + "engine->evaluate(\"[]\")", + "engine->evaluate(\"{}\")", + "engine->evaluate(\"Object.prototype\")", + "engine->evaluate(\"Date.prototype\")", + "engine->evaluate(\"Array.prototype\")", + "engine->evaluate(\"Function.prototype\")", + "engine->evaluate(\"Error.prototype\")", + "engine->evaluate(\"Object\")", + "engine->evaluate(\"Array\")", + "engine->evaluate(\"Number\")", + "engine->evaluate(\"Function\")", + "engine->evaluate(\"(function() { return 1; })\")", + "engine->evaluate(\"(function() { return 'ciao'; })\")", + "engine->evaluate(\"(function() { throw new Error('foo'); })\")", + "engine->evaluate(\"/foo/\")", + "engine->evaluate(\"new Object()\")", + "engine->evaluate(\"new Array()\")", + "engine->evaluate(\"new Error()\")", + "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", + "engine->evaluate(\"Undefined\")", + "engine->evaluate(\"Null\")", + "engine->evaluate(\"True\")", + "engine->evaluate(\"False\")", + "engine->evaluate(\"undefined\")", + "engine->evaluate(\"null\")", + "engine->evaluate(\"true\")", + "engine->evaluate(\"false\")", + "engine->evaluate(\"122\")", + "engine->evaluate(\"124\")", + "engine->evaluate(\"0\")", + "engine->evaluate(\"0.0\")", + "engine->evaluate(\"123.0\")", + "engine->evaluate(\"6.37e-8\")", + "engine->evaluate(\"-6.37e-8\")", + "engine->evaluate(\"0x43211234\")", + "engine->evaluate(\"0x10000\")", + "engine->evaluate(\"0x10001\")", + "engine->evaluate(\"NaN\")", + "engine->evaluate(\"Infinity\")", + "engine->evaluate(\"-Infinity\")", + "engine->evaluate(\"'ciao'\")", + "engine->evaluate(\"''\")", + "engine->evaluate(\"'0'\")", + "engine->evaluate(\"'123'\")", + "engine->evaluate(\"'12.4'\")", + "engine->nullValue()", + "engine->undefinedValue()", + "engine->newObject()", + "engine->newArray()", + "engine->newArray(10)", + "engine->newDate(QDateTime())", + "engine->newQMetaObject(&QObject::staticMetaObject)", + "engine->newVariant(QVariant())", + "engine->newVariant(QVariant(123))", + "engine->newVariant(QVariant(false))", + "engine->newQObject(0)", + "engine->newQObject(engine)",}; + +static quint16 toUInt16_valueArray [] = { + 0, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 4660, 0, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 4660, 0, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 12, 0, + 0, 1, + 0, 122, + 124, 0, + 0, 123, + 0, 0, + 4660, 0, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 123, + 1, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 22, + 0, 0, + 0, 0, + 0, 0, + 1, 0, + 122, 124, + 0, 0, + 123, 0, + 0, 4660, + 0, 1, + 0, 0, + 0, 0, + 0, 0, + 123, 12, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 123, 0, + 0, 0, }; + +void tst_QScriptValue::toUInt16_makeData(const char* expr) +{ + static QHash toUInt16; + if (toUInt16.isEmpty()) { + toUInt16.reserve(142); + for (unsigned i = 0; i < 142; ++i) + toUInt16.insert(toUInt16_tagArray[i], toUInt16_valueArray[i]); + } + newRow(expr) << toUInt16.value(expr); +} + +void tst_QScriptValue::toUInt16_test(const char*, const QScriptValue& value) +{ + QFETCH(quint16, expected); + QCOMPARE(value.toUInt16(), expected); + QCOMPARE(value.toUInt16(), expected); +} + +DEFINE_TEST_FUNCTION(toUInt16) -- cgit v0.12 From 34329f2f7b535cb0904279203ac1c06efb958651 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 4 Mar 2010 14:09:25 +0100 Subject: QScript: Fix crash when converting a null value to a variant. Fixes test tst_QScriptValue::equals(engine->newVariant(QVariant(123)) <=> engine->newArray(10)) Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptengine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 47c5262..024b4d0 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1591,7 +1591,9 @@ QRegExp QScriptEnginePrivate::toRegExp(JSC::ExecState *exec, JSC::JSValue value) QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue value) { - if (isObject(value)) { + if (!value) { + return QVariant(); + } else if (isObject(value)) { if (isVariant(value)) return variantValue(value); #ifndef QT_NO_QOBJECT -- cgit v0.12 From 2701b8389eb9cfbdd65b87b00e5406187c57b297 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 4 Mar 2010 16:51:37 +0100 Subject: Compile fix for wince Reviewed-by: Leo Cunha --- src/declarative/qml/qdeclarativeengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 1711cf1..7ce2d0b 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -953,7 +953,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE QString format = ctxt->argument(1).toString(); return engine->newVariant(qVariantFromValue(date.toString(format))); } else if (ctxt->argument(1).isNumber()) { - enumFormat = Qt::DateFormat(ctxt->argument(1).toInteger()); + enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32()); } else return engine->nullValue(); } @@ -973,7 +973,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE QString format = ctxt->argument(1).toString(); return engine->newVariant(qVariantFromValue(date.toString(format))); } else if (ctxt->argument(1).isNumber()) { - enumFormat = Qt::DateFormat(ctxt->argument(1).toInteger()); + enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32()); } else return engine->nullValue(); } @@ -993,7 +993,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr QString format = ctxt->argument(1).toString(); return engine->newVariant(qVariantFromValue(date.toString(format))); } else if (ctxt->argument(1).isNumber()) { - enumFormat = Qt::DateFormat(ctxt->argument(1).toInteger()); + enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32()); } else return engine->nullValue(); } -- cgit v0.12 From 449a5173075786c0d8ee28cac8d790145096cc49 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 4 Mar 2010 17:28:40 +0100 Subject: Doc: Fixed typos. Reviewed-by: Trust Me --- src/corelib/tools/qtextboundaryfinder.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp index 7c40e35..9205297 100644 --- a/src/corelib/tools/qtextboundaryfinder.cpp +++ b/src/corelib/tools/qtextboundaryfinder.cpp @@ -100,7 +100,8 @@ static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int HB_GetSentenceBoundaries(string, length, scriptItems.data(), scriptItems.count(), attributes); } -/*! \class QTextBoundaryFinder +/*! + \class QTextBoundaryFinder \brief The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string. @@ -331,7 +332,7 @@ QString QTextBoundaryFinder::string() const /*! Moves the QTextBoundaryFinder to the next boundary position and returns that position. - Returns -1 is there is no next boundary. + Returns -1 if there is no next boundary. */ int QTextBoundaryFinder::toNextBoundary() { @@ -373,7 +374,7 @@ int QTextBoundaryFinder::toNextBoundary() /*! Moves the QTextBoundaryFinder to the previous boundary position and returns that position. - Returns -1 is there is no previous boundary. + Returns -1 if there is no previous boundary. */ int QTextBoundaryFinder::toPreviousBoundary() { -- cgit v0.12 From 5aca5d430a6e626e3899925bf92b75e4906b6cd8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 4 Mar 2010 17:48:55 +0100 Subject: Doc: Fixed the row number for a widget in two parts of the tutorial. Task-number: QTBUG-7152 Reviewed-by: Trust Me --- examples/tutorials/addressbook/part3/addressbook.cpp | 2 +- examples/tutorials/addressbook/part4/addressbook.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/addressbook/part3/addressbook.cpp b/examples/tutorials/addressbook/part3/addressbook.cpp index 59b297a..5b39159 100644 --- a/examples/tutorials/addressbook/part3/addressbook.cpp +++ b/examples/tutorials/addressbook/part3/addressbook.cpp @@ -91,7 +91,7 @@ AddressBook::AddressBook(QWidget *parent) mainLayout->addWidget(addressText, 1, 1); mainLayout->addLayout(buttonLayout1, 1, 2); //! [adding navigation layout] - mainLayout->addLayout(buttonLayout2, 3, 1); + mainLayout->addLayout(buttonLayout2, 2, 1); //! [adding navigation layout] setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); diff --git a/examples/tutorials/addressbook/part4/addressbook.cpp b/examples/tutorials/addressbook/part4/addressbook.cpp index e4e451f..a4bf459 100644 --- a/examples/tutorials/addressbook/part4/addressbook.cpp +++ b/examples/tutorials/addressbook/part4/addressbook.cpp @@ -100,7 +100,7 @@ AddressBook::AddressBook(QWidget *parent) mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop); mainLayout->addWidget(addressText, 1, 1); mainLayout->addLayout(buttonLayout1, 1, 2); - mainLayout->addLayout(buttonLayout2, 3, 1); + mainLayout->addLayout(buttonLayout2, 2, 1); setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); -- cgit v0.12 From 85655807c660b9252795648384b8f629ce533c5e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 4 Mar 2010 18:11:33 +0100 Subject: Doc: Added a note about the lack of standard file copy/paste on X11. Reviewed-by: Trust Me Reported-by: Pierre Rossi --- src/gui/kernel/qclipboard.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index a59bb98..f7c0b6e 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -107,6 +107,12 @@ QT_BEGIN_NAMESPACE store or retrieve the clipboard contents in response to timer or non-user-input events. + \i Since there is no standard way to copy and paste files between + applications on X11, various MIME types and conventions are currently + in use. For instance, Nautilus expects files to be supplied with a + \c{x-special/gnome-copied-files} MIME type with data beginning with + the cut/copy action, a newline character, and the URL of the file. + \endlist \section1 Notes for Mac OS X Users -- cgit v0.12 From 4f2203e481cc1663776e7b87b082cf0dd42849fd Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 4 Mar 2010 18:32:13 +0100 Subject: Doc: Applied suggestion for an improvement to the foreach documentation. Task-number: QTBUG-6153 Reviewed-by: Trust Me --- doc/src/frameworks-technologies/containers.qdoc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc index 86920fd..505b65c 100644 --- a/doc/src/frameworks-technologies/containers.qdoc +++ b/doc/src/frameworks-technologies/containers.qdoc @@ -612,11 +612,14 @@ Qt automatically takes a copy of the container when it enters a \c foreach loop. If you modify the container as you are - iterating, that won't affect the loop. (If you don't modify the + iterating, that won't affect the loop. (If you do not modify the container, the copy still takes place, but thanks to \l{implicit - sharing} copying a container is very fast.) Similarly, declaring - the variable to be a non-const reference, in order to modify the - current item in the list will not work either. + sharing} copying a container is very fast.) + + Since foreach creates a copy of the container, using a non-const + reference for the variable does not allow you to modify the original + container. It only affects the copy, which is probably not what you + want. In addition to \c foreach, Qt also provides a \c forever pseudo-keyword for infinite loops: -- cgit v0.12 From 364ba2bfeeab574d2ae940e4387d3c90b2a46dcd Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 4 Mar 2010 18:40:22 +0100 Subject: Updated URLs. Reviewed-by: Erik Verbruggen --- dist/changes-4.5.4 | 2 +- dist/changes-4.7.0 | 4 ++-- doc/src/declarative/basictypes.qdoc | 2 +- tools/qdoc3/test/qdeclarative.qdocconf | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/changes-4.5.4 b/dist/changes-4.5.4 index abaf4f0..e60e507 100644 --- a/dist/changes-4.5.4 +++ b/dist/changes-4.5.4 @@ -11,7 +11,7 @@ Applications compiled for 4.4 will continue to run with 4.5. Some of the changes listed in this file include issue tracking numbers corresponding to tasks in the Task Tracker: - http://www.qtsoftware.com/developer/task-tracker + http://qt.nokia.com/developer/task-tracker Each of these identifiers can be entered in the task tracker to obtain more information about a particular change. diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 4d776ee..76fa7f8 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -2,7 +2,7 @@ Qt 4.7 introduces many new features and improvements as well as bugfixes over the 4.6.x series. For more details, refer to the online documentation included in this distribution. The documentation is also available online: - http://doc.trolltech.com/4.7 + http://qt.nokia.com/doc/4.7 The Qt version 4.7 series is binary compatible with the 4.6.x series. Applications compiled for 4.6 will continue to run with 4.7. @@ -10,7 +10,7 @@ Applications compiled for 4.6 will continue to run with 4.7. Some of the changes listed in this file include issue tracking numbers corresponding to tasks in the Task Tracker: - http://www.qtsoftware.com/developer/task-tracker + http://qt.nokia.com/developer/task-tracker Each of these identifiers can be entered in the task tracker to obtain more information about a particular change. diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index c60847e..6901947 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -128,7 +128,7 @@ \brief A URL is a resource locator, like a file name. A URL is a resource locator, like a file name. It can be either - absolute, e.g. "http://qtsoftware.com", or relative, e.g. + absolute, e.g. "http://qt.nokia.com", or relative, e.g. "pics/logo.png". A relative URL is resolved relative to the URL of the component where the URL is converted from a JavaScript string expression to a url property value. diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 3b5d8dc..e5b883a 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -6,7 +6,7 @@ include(qt-defines.qdocconf) project = Qml description = Qml Reference Documentation -url = http://doc.qtsoftware.com/4.6 +url = http://qt.nokia.com/doc/4.6/ qmlonly = true edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \ -- cgit v0.12 From ca89d8dc944e7af886c3b31c9d23c8957e5667ab Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 4 Mar 2010 20:39:04 +0100 Subject: Doc: Enabled the context menu in the spreadsheet demo. Task-number: QTBUG-5522 Reviewed-by: Trust Me --- demos/spreadsheet/spreadsheet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/spreadsheet/spreadsheet.cpp b/demos/spreadsheet/spreadsheet.cpp index 9693f3c..f2a1738 100644 --- a/demos/spreadsheet/spreadsheet.cpp +++ b/demos/spreadsheet/spreadsheet.cpp @@ -70,6 +70,7 @@ SpreadSheet::SpreadSheet(int rows, int cols, QWidget *parent) updateColor(0); setupMenuBar(); setupContents(); + setupContextMenu(); setCentralWidget(table); statusBar(); -- cgit v0.12 From 38ff49e632da2bd61ac5fb59f57f62208c2687fd Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 5 Mar 2010 09:15:19 +1000 Subject: MouseRegion is dead. Long live MouseArea. --- src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 1 - src/multimedia/effects/qsoundeffect.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index e0ae2eb..25660f8 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -106,7 +106,6 @@ void QDeclarativeItemModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,LayoutItem,QDeclarativeLayoutItem); QML_REGISTER_TYPE(Qt,4,6,ListView,QDeclarativeListView); QML_REGISTER_TYPE(Qt,4,6,Loader,QDeclarativeLoader); - QML_REGISTER_TYPE(Qt,4,6,MouseRegion,QDeclarativeMouseArea); QML_REGISTER_TYPE(Qt,4,6,MouseArea,QDeclarativeMouseArea); QML_REGISTER_TYPE(Qt,4,6,Opacity,QGraphicsOpacityEffect); QML_REGISTER_TYPE(Qt,4,6,ParticleMotion,QDeclarativeParticleMotion); diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp index 541e6c9..2694023 100644 --- a/src/multimedia/effects/qsoundeffect.cpp +++ b/src/multimedia/effects/qsoundeffect.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE id: playSound source: "test.wav" } - MouseRegion { + MouseArea { id: playArea anchors.fill: parent onPressed: { -- cgit v0.12 From 8708350f4b00507348fa59f313bcfa554a3d6f79 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 5 Mar 2010 10:35:54 +1000 Subject: Update QML documentation snippets to latest syntax. --- doc/src/snippets/declarative/GroupBox.qml | 15 --------------- doc/src/snippets/declarative/content.qml | 9 --------- doc/src/snippets/declarative/listview/highlight.qml | 4 ++-- doc/src/snippets/declarative/mouseregion.qml | 2 +- doc/src/snippets/declarative/pathview/pathattributes.qml | 2 +- doc/src/snippets/declarative/pathview/pathview.qml | 2 +- 6 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 doc/src/snippets/declarative/GroupBox.qml delete mode 100644 doc/src/snippets/declarative/content.qml diff --git a/doc/src/snippets/declarative/GroupBox.qml b/doc/src/snippets/declarative/GroupBox.qml deleted file mode 100644 index 6c5431e..0000000 --- a/doc/src/snippets/declarative/GroupBox.qml +++ /dev/null @@ -1,15 +0,0 @@ -import Qt 4.6 - -ContentWrapper { - id: container; width: parent.width; height: contents.height - children: [ - Rectangle { - width: parent.width; height: contents.height - color: "white"; pen.width: 2; pen.color: "#adaeb0"; radius: 10 - Column { - id: layout; width: parent.width; margin: 5; spacing: 2 - Content { } - } - } - ] -} diff --git a/doc/src/snippets/declarative/content.qml b/doc/src/snippets/declarative/content.qml deleted file mode 100644 index fb03ced..0000000 --- a/doc/src/snippets/declarative/content.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -Rectangle { - width: 200; height: 100; color: "lightgray" - GroupBox { - Text { text: "First Item" } - Text { text: "Second Item" } - } -} diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml index b016f9a..6a9d215 100644 --- a/doc/src/snippets/declarative/listview/highlight.qml +++ b/doc/src/snippets/declarative/listview/highlight.qml @@ -30,7 +30,7 @@ Rectangle { } ] transitions: [ - Transition { NumberAnimation { matchProperties: "x"; duration: 200 } } + Transition { NumberAnimation { properties: "x"; duration: 200 } } ] } } @@ -44,7 +44,7 @@ Rectangle { Rectangle { width: 180; height: 40 color: "lightsteelblue"; radius: 5 - y: SpringFollow { + SpringFollow on y { source: list.currentItem.y spring: 3 damping: 0.2 diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/mouseregion.qml index 79f8f8f..fc6c8f0 100644 --- a/doc/src/snippets/declarative/mouseregion.qml +++ b/doc/src/snippets/declarative/mouseregion.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { width: 200; height: 100 -HorizontalLayout { +Row { //! [0] Rectangle { width: 100; height: 100; color: "green" MouseArea { anchors.fill: parent; onClicked: { parent.color = 'red' } } diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml index 19a192c..99d0de2 100644 --- a/doc/src/snippets/declarative/pathview/pathattributes.qml +++ b/doc/src/snippets/declarative/pathview/pathattributes.qml @@ -13,7 +13,7 @@ Rectangle { opacity: PathView.opacity Column { Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon } - Text { id: name; text: name; font.pointSize: 16} + Text { text: name; font.pointSize: 16} } } } diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml index 5605139..e316578 100644 --- a/doc/src/snippets/declarative/pathview/pathview.qml +++ b/doc/src/snippets/declarative/pathview/pathview.qml @@ -11,7 +11,7 @@ Rectangle { width: 80; height: 80 Column { Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon } - Text { id: name; text: name; font.pointSize: 16} + Text { text: name; font.pointSize: 16} } } } -- cgit v0.12 From 5048b96a14b61329257e153f2551b6fca4519f84 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 5 Mar 2010 10:40:49 +1000 Subject: Include QML doc snippets in examples autotest --- tests/auto/declarative/examples/examples.pro | 2 ++ tests/auto/declarative/examples/tst_examples.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index b9bcd28..85d2a73 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -3,3 +3,5 @@ contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle SOURCES += tst_examples.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 106a4e0..678dd59 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -168,10 +168,12 @@ void tst_examples::examples_data() QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath); QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath); + QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; QStringList files; files << findQmlFiles(QDir(examples)); files << findQmlFiles(QDir(demos)); + files << findQmlFiles(QDir(snippets)); foreach (const QString &file, files) QTest::newRow(file.toLatin1().constData()) << file; -- cgit v0.12