diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-02 09:11:55 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-02 09:11:55 (GMT) |
commit | 9e949e41c2751a0c27ac4bb6edae8e7cfc59851a (patch) | |
tree | a307dd40b6642425e005839fc209dd8b31618885 | |
parent | 8b4cbdbd3bfcdc98ca5f8e728b004596a1213127 (diff) | |
parent | 7f86f70e98e0b826ad35b8bb744305b5f4dbbfe8 (diff) | |
download | Qt-9e949e41c2751a0c27ac4bb6edae8e7cfc59851a.zip Qt-9e949e41c2751a0c27ac4bb6edae8e7cfc59851a.tar.gz Qt-9e949e41c2751a0c27ac4bb6edae8e7cfc59851a.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
26 files changed, 551 insertions, 171 deletions
diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index 2aac5f1..0c6836f 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -9,10 +9,12 @@ Item { property var minutes property var seconds property var shift : 0 + property bool night: false function timeChanged() { var date = new Date; hours = shift ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours() + if ( hours < 7 || hours > 19 ) night = true; else night = false minutes = shift ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() seconds = date.getUTCSeconds(); } @@ -22,7 +24,8 @@ Item { onTriggered: clock.timeChanged() } - Image { id: background; source: "clock.png" } + Image { id: background; source: "clock.png"; visible: clock.night == false } + Image { source: "clock-night.png"; visible: clock.night == true } Image { x: 92.5; y: 27 diff --git a/examples/declarative/clocks/content/clock-night.png b/examples/declarative/clocks/content/clock-night.png Binary files differnew file mode 100755 index 0000000..cc7151a --- /dev/null +++ b/examples/declarative/clocks/content/clock-night.png diff --git a/examples/declarative/clocks/content/clock.png b/examples/declarative/clocks/content/clock.png Binary files differindex 30bc577..462edac 100755 --- a/examples/declarative/clocks/content/clock.png +++ b/examples/declarative/clocks/content/clock.png diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index 8eac580..15d775c 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -28,8 +28,8 @@ HEADERS += \ graphicsitems/qmlgraphicspath_p_p.h \ graphicsitems/qmlgraphicspathview_p.h \ graphicsitems/qmlgraphicspathview_p_p.h \ - graphicsitems/qmlgraphicsrect_p.h \ - graphicsitems/qmlgraphicsrect_p_p.h \ + graphicsitems/qmlgraphicsrectangle_p.h \ + graphicsitems/qmlgraphicsrectangle_p_p.h \ graphicsitems/qmlgraphicsrepeater_p.h \ graphicsitems/qmlgraphicsrepeater_p_p.h \ graphicsitems/qmlgraphicsscalegrid_p_p.h \ @@ -64,7 +64,7 @@ SOURCES += \ graphicsitems/qmlgraphicsmouseregion.cpp \ graphicsitems/qmlgraphicspath.cpp \ graphicsitems/qmlgraphicspathview.cpp \ - graphicsitems/qmlgraphicsrect.cpp \ + graphicsitems/qmlgraphicsrectangle.cpp \ graphicsitems/qmlgraphicsrepeater.cpp \ graphicsitems/qmlgraphicsscalegrid.cpp \ graphicsitems/qmlgraphicstextinput.cpp \ diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index dc8bab2..cf399f9 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -994,7 +994,7 @@ QmlGraphicsListView::~QmlGraphicsListView() /*! \qmlattachedproperty bool ListView::isCurrentItem - This attched property is true if this delegate is the current item; otherwise false. + This attached property is true if this delegate is the current item; otherwise false. It is attached to each instance of the delegate. diff --git a/src/declarative/graphicsitems/qmlgraphicsrect.cpp b/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp index 605e82c..8ae40b7 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrect.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicsrect_p.h" -#include "qmlgraphicsrect_p_p.h" +#include "qmlgraphicsrectangle_p.h" +#include "qmlgraphicsrectangle_p_p.h" #include <QPainter> #include <QtCore/qmath.h> @@ -149,10 +149,10 @@ void QmlGraphicsGradient::doUpdate() emit updated(); } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rectangle,QmlGraphicsRect) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rectangle,QmlGraphicsRectangle) /*! - \qmlclass Rectangle QmlGraphicsRect + \qmlclass Rectangle QmlGraphicsRectangle \brief The Rectangle item allows you to add rectangles to a scene. \inherits Item @@ -175,28 +175,28 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rectangle,QmlGraphicsRect) /*! \internal - \class QmlGraphicsRect - \brief The QmlGraphicsRect class provides a rectangle item that you can add to a QmlView. + \class QmlGraphicsRectangle + \brief The QmlGraphicsRectangle class provides a rectangle item that you can add to a QmlView. */ -QmlGraphicsRect::QmlGraphicsRect(QmlGraphicsItem *parent) - : QmlGraphicsItem(*(new QmlGraphicsRectPrivate), parent) +QmlGraphicsRectangle::QmlGraphicsRectangle(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsRectanglePrivate), parent) { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); d->init(); setFlag(QGraphicsItem::ItemHasNoContents, false); } -QmlGraphicsRect::QmlGraphicsRect(QmlGraphicsRectPrivate &dd, QmlGraphicsItem *parent) +QmlGraphicsRectangle::QmlGraphicsRectangle(QmlGraphicsRectanglePrivate &dd, QmlGraphicsItem *parent) : QmlGraphicsItem(dd, parent) { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); d->init(); setFlag(QGraphicsItem::ItemHasNoContents, false); } -void QmlGraphicsRect::doUpdate() +void QmlGraphicsRectangle::doUpdate() { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); d->rectImage = QPixmap(); const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; d->setPaintMargin((pw+1)/2); @@ -214,9 +214,9 @@ void QmlGraphicsRect::doUpdate() To keep the border smooth (rather than blurry), odd widths cause the rectangle to be painted at a half-pixel offset; */ -QmlGraphicsPen *QmlGraphicsRect::border() +QmlGraphicsPen *QmlGraphicsRectangle::border() { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); return d->getPen(); } @@ -254,15 +254,15 @@ QmlGraphicsPen *QmlGraphicsRect::border() \sa Gradient, color */ -QmlGraphicsGradient *QmlGraphicsRect::gradient() const +QmlGraphicsGradient *QmlGraphicsRectangle::gradient() const { - Q_D(const QmlGraphicsRect); + Q_D(const QmlGraphicsRectangle); return d->gradient; } -void QmlGraphicsRect::setGradient(QmlGraphicsGradient *gradient) +void QmlGraphicsRectangle::setGradient(QmlGraphicsGradient *gradient) { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); if (d->gradient == gradient) return; if (d->gradient) @@ -282,15 +282,15 @@ void QmlGraphicsRect::setGradient(QmlGraphicsGradient *gradient) painted as a normal rectangle. The same radius is used by all 4 corners; there is currently no way to specify different radii for different corners. */ -qreal QmlGraphicsRect::radius() const +qreal QmlGraphicsRectangle::radius() const { - Q_D(const QmlGraphicsRect); + Q_D(const QmlGraphicsRectangle); return d->radius; } -void QmlGraphicsRect::setRadius(qreal radius) +void QmlGraphicsRectangle::setRadius(qreal radius) { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); if (d->radius == radius) return; @@ -316,15 +316,15 @@ void QmlGraphicsRect::setRadius(qreal radius) If both a gradient and a color are specified, the gradient will be used. */ -QColor QmlGraphicsRect::color() const +QColor QmlGraphicsRectangle::color() const { - Q_D(const QmlGraphicsRect); + Q_D(const QmlGraphicsRectangle); return d->color; } -void QmlGraphicsRect::setColor(const QColor &c) +void QmlGraphicsRectangle::setColor(const QColor &c) { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); if (d->color == c) return; @@ -334,9 +334,9 @@ void QmlGraphicsRect::setColor(const QColor &c) emit colorChanged(); } -void QmlGraphicsRect::generateRoundedRect() +void QmlGraphicsRectangle::generateRoundedRect() { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); if (d->rectImage.isNull()) { const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; const int radius = qCeil(d->radius); //ensure odd numbered width/height so we get 1-pixel center @@ -358,9 +358,9 @@ void QmlGraphicsRect::generateRoundedRect() } } -void QmlGraphicsRect::generateBorderedRect() +void QmlGraphicsRectangle::generateBorderedRect() { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); if (d->rectImage.isNull()) { const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3); @@ -382,9 +382,9 @@ void QmlGraphicsRect::generateBorderedRect() } } -void QmlGraphicsRect::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); if (d->radius > 0 || (d->pen && d->pen->isValid()) || (d->gradient && d->gradient->gradient()) ) { drawRect(*p); @@ -399,9 +399,9 @@ void QmlGraphicsRect::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidg } } -void QmlGraphicsRect::drawRect(QPainter &p) +void QmlGraphicsRectangle::drawRect(QPainter &p) { - Q_D(QmlGraphicsRect); + Q_D(QmlGraphicsRectangle); if (d->gradient && d->gradient->gradient()) { // XXX This path is still slower than the image path // Image path won't work for gradients though @@ -466,9 +466,9 @@ void QmlGraphicsRect::drawRect(QPainter &p) \image rect-smooth.png */ -QRectF QmlGraphicsRect::boundingRect() const +QRectF QmlGraphicsRectangle::boundingRect() const { - Q_D(const QmlGraphicsRect); + Q_D(const QmlGraphicsRectangle); return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2); } diff --git a/src/declarative/graphicsitems/qmlgraphicsrect_p.h b/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h index 97334fd..2a80619 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrect_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h @@ -130,8 +130,8 @@ private: friend class QmlGraphicsGradientStop; }; -class QmlGraphicsRectPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsRect : public QmlGraphicsItem +class QmlGraphicsRectanglePrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsRectangle : public QmlGraphicsItem { Q_OBJECT @@ -140,7 +140,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsRect : public QmlGraphicsItem Q_PROPERTY(QmlGraphicsPen * border READ border CONSTANT) Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) public: - QmlGraphicsRect(QmlGraphicsItem *parent=0); + QmlGraphicsRectangle(QmlGraphicsItem *parent=0); QColor color() const; void setColor(const QColor &); @@ -170,11 +170,11 @@ private: void drawRect(QPainter &painter); protected: - QmlGraphicsRect(QmlGraphicsRectPrivate &dd, QmlGraphicsItem *parent); + QmlGraphicsRectangle(QmlGraphicsRectanglePrivate &dd, QmlGraphicsItem *parent); private: - Q_DISABLE_COPY(QmlGraphicsRect) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRect) + Q_DISABLE_COPY(QmlGraphicsRectangle) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRectangle) }; QT_END_NAMESPACE @@ -182,7 +182,7 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QmlGraphicsPen) QML_DECLARE_TYPE(QmlGraphicsGradientStop) QML_DECLARE_TYPE(QmlGraphicsGradient) -QML_DECLARE_TYPE(QmlGraphicsRect) +QML_DECLARE_TYPE(QmlGraphicsRectangle) QT_END_HEADER diff --git a/src/declarative/graphicsitems/qmlgraphicsrect_p_p.h b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h index f44e8de..cb914d6 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrect_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h @@ -58,18 +58,18 @@ QT_BEGIN_NAMESPACE class QmlGraphicsGradient; -class QmlGraphicsRect; -class QmlGraphicsRectPrivate : public QmlGraphicsItemPrivate +class QmlGraphicsRectangle; +class QmlGraphicsRectanglePrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QmlGraphicsRect) + Q_DECLARE_PUBLIC(QmlGraphicsRectangle) public: - QmlGraphicsRectPrivate() : + QmlGraphicsRectanglePrivate() : color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0) { } - ~QmlGraphicsRectPrivate() + ~QmlGraphicsRectanglePrivate() { delete pen; } @@ -83,7 +83,7 @@ public: QmlGraphicsGradient *gradient; QmlGraphicsPen *getPen() { if (!pen) { - Q_Q(QmlGraphicsRect); + Q_Q(QmlGraphicsRectangle); pen = new QmlGraphicsPen; QObject::connect(pen, SIGNAL(penChanged()), q, SLOT(doUpdate())); } @@ -96,7 +96,7 @@ public: void setPaintMargin(qreal margin) { - Q_Q(QmlGraphicsRect); + Q_Q(QmlGraphicsRectangle); if (margin == paintmargin) return; q->prepareGeometryChange(); diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index dba2203..17083db 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -457,6 +457,7 @@ void QmlListModel::remove(int index) if (node) delete node; emit itemsRemoved(index,1); + emit countChanged(_root->values.count()); } } @@ -488,6 +489,7 @@ void QmlListModel::insert(int index, const QScriptValue& valuemap) mn->setObjectValue(valuemap); _root->values.insert(index,qVariantFromValue(mn)); emit itemsInserted(index,1); + emit countChanged(_root->values.count()); } /*! @@ -563,6 +565,7 @@ void QmlListModel::append(const QScriptValue& valuemap) mn->setObjectValue(valuemap); _root->values << qVariantFromValue(mn); emit itemsInserted(count()-1,1); + emit countChanged(_root->values.count()); } /*! @@ -642,7 +645,6 @@ void QmlListModel::set(int index, const QString& property, const QVariant& value emit itemsChanged(index,1,roles); } - class QmlListModelParser : public QmlCustomParser { public: diff --git a/src/declarative/util/qmllistmodel_p.h b/src/declarative/util/qmllistmodel_p.h index 8676024..31365d1 100644 --- a/src/declarative/util/qmllistmodel_p.h +++ b/src/declarative/util/qmllistmodel_p.h @@ -62,7 +62,7 @@ struct ModelNode; class QmlListModel : public QListModelInterface { Q_OBJECT - Q_PROPERTY(int count READ count) + Q_PROPERTY(int count READ count NOTIFY countChanged) public: QmlListModel(QObject *parent=0); @@ -81,6 +81,9 @@ public: Q_INVOKABLE void set(int index, const QString& property, const QVariant& value); Q_INVOKABLE void move(int from, int to, int count); +Q_SIGNALS: + void countChanged(int); + private: QVariant valueForNode(ModelNode *) const; mutable QStringList roleStrings; diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h index 92aef8c..ff42893 100644 --- a/src/declarative/util/qmlstate_p.h +++ b/src/declarative/util/qmlstate_p.h @@ -54,7 +54,7 @@ QT_MODULE(Declarative) class ActionEvent; class QmlBinding; -class Action +class Q_DECLARATIVE_EXPORT Action { public: Action(); diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index 60c6b3d..8abf04f 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -42,7 +42,7 @@ #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> #include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrect_p.h> +#include <private/qmlgraphicsrectangle_p.h> #include <QtDeclarative/private/qmlgraphicsanchors_p_p.h> @@ -95,41 +95,41 @@ void tst_anchors::basicAnchors() qApp->processEvents(); //sibling horizontal - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect1"))->x(), 26.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect2"))->x(), 122.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect3"))->x(), 74.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect4"))->x(), 16.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect5"))->x(), 112.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect6"))->x(), 64.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect1"))->x(), 26.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect2"))->x(), 122.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect3"))->x(), 74.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect4"))->x(), 16.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect5"))->x(), 112.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect6"))->x(), 64.0); //parent horizontal - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect7"))->x(), 0.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect8"))->x(), 240.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect9"))->x(), 120.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect10"))->x(), -10.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect11"))->x(), 230.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect12"))->x(), 110.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect7"))->x(), 0.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect8"))->x(), 240.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect9"))->x(), 120.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect10"))->x(), -10.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect11"))->x(), 230.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect12"))->x(), 110.0); //vertical - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect13"))->y(), 20.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect14"))->y(), 155.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect13"))->y(), 20.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect14"))->y(), 155.0); //stretch - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect15"))->x(), 26.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect15"))->width(), 96.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect16"))->x(), 26.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect16"))->width(), 192.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect17"))->x(), -70.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect17"))->width(), 192.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect15"))->x(), 26.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect15"))->width(), 96.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect16"))->x(), 26.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect16"))->width(), 192.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect17"))->x(), -70.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect17"))->width(), 192.0); //vertical stretch - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect18"))->y(), 20.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect18"))->height(), 40.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect18"))->y(), 20.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect18"))->height(), 40.0); //more parent horizontal - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect19"))->x(), 115.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect20"))->x(), 235.0); - QCOMPARE(findItem<QmlGraphicsRect>(view->root(), QLatin1String("Rect21"))->x(), -5.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect19"))->x(), 115.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect20"))->x(), 235.0); + QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("Rect21"))->x(), -5.0); delete view; } @@ -173,7 +173,7 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml")); - QString expect = "QML QmlGraphicsRect (" + view->url().toString() + ":7:5" + ") Can't specify left, right, and hcenter anchors."; + QString expect = "QML QmlGraphicsRectangle (" + view->url().toString() + ":7:5" + ") Can't specify left, right, and hcenter anchors."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); qApp->processEvents(); @@ -199,7 +199,7 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml")); - QString expect = "QML QmlGraphicsRect (" + view->url().toString() + ":9:5" + ") Can't anchor to an item that isn't a parent or sibling."; + QString expect = "QML QmlGraphicsRectangle (" + view->url().toString() + ":9:5" + ") Can't anchor to an item that isn't a parent or sibling."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); //qApp->processEvents(); diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp index a82c8e6..f6141cb 100644 --- a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp +++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp @@ -42,7 +42,7 @@ #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> #include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrect_p.h> +#include <private/qmlgraphicsrectangle_p.h> #include <private/qmlgraphicsimage_p.h> #include <private/qmlgraphicsanimatedimageitem_p.h> diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp index 77a31e5..ca383bb 100644 --- a/tests/auto/declarative/animations/tst_animations.cpp +++ b/tests/auto/declarative/animations/tst_animations.cpp @@ -42,7 +42,7 @@ #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> #include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrect_p.h> +#include <private/qmlgraphicsrectangle_p.h> #include <private/qmlanimation_p.h> class tst_animations : public QObject @@ -72,7 +72,7 @@ private slots: void tst_animations::simpleNumber() { - QmlGraphicsRect rect; + QmlGraphicsRectangle rect; QmlNumberAnimation animation; animation.setTarget(&rect); animation.setProperty("x"); @@ -90,7 +90,7 @@ void tst_animations::simpleNumber() void tst_animations::simpleColor() { - QmlGraphicsRect rect; + QmlGraphicsRectangle rect; QmlColorAnimation animation; animation.setTarget(&rect); animation.setProperty("color"); @@ -108,7 +108,7 @@ void tst_animations::simpleColor() void tst_animations::alwaysRunToEnd() { - QmlGraphicsRect rect; + QmlGraphicsRectangle rect; QmlPropertyAnimation animation; animation.setTarget(&rect); animation.setProperty("x"); @@ -126,7 +126,7 @@ void tst_animations::alwaysRunToEnd() void tst_animations::dotProperty() { - QmlGraphicsRect rect; + QmlGraphicsRectangle rect; QmlNumberAnimation animation; animation.setTarget(&rect); animation.setProperty("border.width"); @@ -181,12 +181,12 @@ void tst_animations::badTypes() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype4.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("state1"); QTest::qWait(1000 + 50); - QmlGraphicsRect *myRect = qobject_cast<QmlGraphicsRect*>(rect->QGraphicsObject::children().at(3)); //### not robust + QmlGraphicsRectangle *myRect = qobject_cast<QmlGraphicsRectangle*>(rect->QGraphicsObject::children().at(3)); //### not robust QVERIFY(myRect); QCOMPARE(myRect->x(),qreal(200)); } @@ -198,7 +198,7 @@ void tst_animations::badProperties() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badproperty1.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty1.qml:22:9) Cannot animate non-existant property \"pen.colr\""); @@ -214,12 +214,12 @@ void tst_animations::mixedTypes() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/mixedtype1.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("state1"); QTest::qWait(500); - QmlGraphicsRect *myRect = qobject_cast<QmlGraphicsRect*>(rect->QGraphicsObject::children().at(3)); //### not robust + QmlGraphicsRectangle *myRect = qobject_cast<QmlGraphicsRectangle*>(rect->QGraphicsObject::children().at(3)); //### not robust QVERIFY(myRect); //rather inexact -- is there a better way? @@ -230,12 +230,12 @@ void tst_animations::mixedTypes() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/mixedtype2.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("state1"); QTest::qWait(500); - QmlGraphicsRect *myRect = qobject_cast<QmlGraphicsRect*>(rect->QGraphicsObject::children().at(3)); //### not robust + QmlGraphicsRectangle *myRect = qobject_cast<QmlGraphicsRectangle*>(rect->QGraphicsObject::children().at(3)); //### not robust QVERIFY(myRect); //rather inexact -- is there a better way? diff --git a/tests/auto/declarative/behaviors/tst_behaviors.cpp b/tests/auto/declarative/behaviors/tst_behaviors.cpp index aea5604..9803a9d 100644 --- a/tests/auto/declarative/behaviors/tst_behaviors.cpp +++ b/tests/auto/declarative/behaviors/tst_behaviors.cpp @@ -42,7 +42,7 @@ #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> #include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrect_p.h> +#include <private/qmlgraphicsrectangle_p.h> #include <private/qmlanimation_p.h> class tst_behaviors : public QObject @@ -66,12 +66,12 @@ void tst_behaviors::simpleBehavior() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/simple.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - qreal x = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("MyRect"))->x(); + qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } @@ -79,12 +79,12 @@ void tst_behaviors::scriptTriggered() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/scripttrigger.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setColor(QColor("red")); QTest::qWait(100); - qreal x = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("MyRect"))->x(); + qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } @@ -92,10 +92,10 @@ void tst_behaviors::cppTriggered() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/cpptrigger.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); - QmlGraphicsRect *innerRect = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("MyRect")); + QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); QVERIFY(innerRect); innerRect->setProperty("x", 200); @@ -108,7 +108,7 @@ void tst_behaviors::loop() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/loop.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); //don't crash @@ -119,12 +119,12 @@ void tst_behaviors::colorBehavior() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/color.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("red"); QTest::qWait(100); - QColor color = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("MyRect"))->color(); + QColor color = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->color(); QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered } @@ -132,12 +132,12 @@ void tst_behaviors::replaceBinding() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/binding.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - QmlGraphicsRect *innerRect = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("MyRect")); + QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); QVERIFY(innerRect); qreal x = innerRect->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered @@ -167,24 +167,24 @@ void tst_behaviors::group() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/groupProperty.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - qreal x = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("MyRect"))->x(); + qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/groupProperty2.qml")); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(c.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - qreal x = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("MyRect"))->x(); + qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } } diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index fbcc904..b0df57ea 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> #include <private/qlistmodelinterface_p.h> #include <qmlview.h> -#include <private/qmlgraphicsrect_p.h> +#include <private/qmlgraphicsrectangle_p.h> #include <qmlexpression.h> class tst_QmlGraphicsLayouts : public QObject @@ -73,13 +73,13 @@ void tst_QmlGraphicsLayouts::test_horizontal() canvas->execute(); qApp->processEvents(); - QmlGraphicsRect *one = canvas->root()->findChild<QmlGraphicsRect*>("one"); + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); - QmlGraphicsRect *two = canvas->root()->findChild<QmlGraphicsRect*>("two"); + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); QVERIFY(two != 0); - QmlGraphicsRect *three = canvas->root()->findChild<QmlGraphicsRect*>("three"); + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -97,13 +97,13 @@ void tst_QmlGraphicsLayouts::test_horizontal_spacing() canvas->execute(); qApp->processEvents(); - QmlGraphicsRect *one = canvas->root()->findChild<QmlGraphicsRect*>("one"); + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); - QmlGraphicsRect *two = canvas->root()->findChild<QmlGraphicsRect*>("two"); + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); QVERIFY(two != 0); - QmlGraphicsRect *three = canvas->root()->findChild<QmlGraphicsRect*>("three"); + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -121,13 +121,13 @@ void tst_QmlGraphicsLayouts::test_vertical() canvas->execute(); qApp->processEvents(); - QmlGraphicsRect *one = canvas->root()->findChild<QmlGraphicsRect*>("one"); + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); - QmlGraphicsRect *two = canvas->root()->findChild<QmlGraphicsRect*>("two"); + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); QVERIFY(two != 0); - QmlGraphicsRect *three = canvas->root()->findChild<QmlGraphicsRect*>("three"); + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -145,13 +145,13 @@ void tst_QmlGraphicsLayouts::test_vertical_spacing() canvas->execute(); qApp->processEvents(); - QmlGraphicsRect *one = canvas->root()->findChild<QmlGraphicsRect*>("one"); + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); - QmlGraphicsRect *two = canvas->root()->findChild<QmlGraphicsRect*>("two"); + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); QVERIFY(two != 0); - QmlGraphicsRect *three = canvas->root()->findChild<QmlGraphicsRect*>("three"); + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -169,15 +169,15 @@ void tst_QmlGraphicsLayouts::test_grid() canvas->execute(); qApp->processEvents(); - QmlGraphicsRect *one = canvas->root()->findChild<QmlGraphicsRect*>("one"); + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); - QmlGraphicsRect *two = canvas->root()->findChild<QmlGraphicsRect*>("two"); + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); QVERIFY(two != 0); - QmlGraphicsRect *three = canvas->root()->findChild<QmlGraphicsRect*>("three"); + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); QVERIFY(three != 0); - QmlGraphicsRect *four = canvas->root()->findChild<QmlGraphicsRect*>("four"); + QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four"); QVERIFY(four != 0); - QmlGraphicsRect *five = canvas->root()->findChild<QmlGraphicsRect*>("five"); + QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five"); QVERIFY(five != 0); QCOMPARE(one->x(), 0.0); @@ -199,15 +199,15 @@ void tst_QmlGraphicsLayouts::test_grid_spacing() canvas->execute(); qApp->processEvents(); - QmlGraphicsRect *one = canvas->root()->findChild<QmlGraphicsRect*>("one"); + QmlGraphicsRectangle *one = canvas->root()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); - QmlGraphicsRect *two = canvas->root()->findChild<QmlGraphicsRect*>("two"); + QmlGraphicsRectangle *two = canvas->root()->findChild<QmlGraphicsRectangle*>("two"); QVERIFY(two != 0); - QmlGraphicsRect *three = canvas->root()->findChild<QmlGraphicsRect*>("three"); + QmlGraphicsRectangle *three = canvas->root()->findChild<QmlGraphicsRectangle*>("three"); QVERIFY(three != 0); - QmlGraphicsRect *four = canvas->root()->findChild<QmlGraphicsRect*>("four"); + QmlGraphicsRectangle *four = canvas->root()->findChild<QmlGraphicsRectangle*>("four"); QVERIFY(four != 0); - QmlGraphicsRect *five = canvas->root()->findChild<QmlGraphicsRect*>("five"); + QmlGraphicsRectangle *five = canvas->root()->findChild<QmlGraphicsRectangle*>("five"); QVERIFY(five != 0); QCOMPARE(one->x(), 0.0); diff --git a/tests/auto/declarative/pathview/tst_pathview.cpp b/tests/auto/declarative/pathview/tst_pathview.cpp index 41decb1..57ae8c0 100644 --- a/tests/auto/declarative/pathview/tst_pathview.cpp +++ b/tests/auto/declarative/pathview/tst_pathview.cpp @@ -43,7 +43,7 @@ #include <qmlview.h> #include <private/qmlgraphicspathview_p.h> #include <private/qmlgraphicstext_p.h> -#include <private/qmlgraphicsrect_p.h> +#include <private/qmlgraphicsrectangle_p.h> #include <qmlcontext.h> #include <qmlexpression.h> @@ -190,7 +190,7 @@ void tst_QmlGraphicsPathView::pathMoved() QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->root(), "view"); QVERIFY(pathview != 0); - QmlGraphicsRect *firstItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 0); + QmlGraphicsRectangle *firstItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 0); QVERIFY(firstItem); QmlGraphicsPath *path = qobject_cast<QmlGraphicsPath*>(pathview->path()); QVERIFY(path); @@ -203,7 +203,7 @@ void tst_QmlGraphicsPathView::pathMoved() QTest::qWait(1000);//Moving is animated? for(int i=0; i<model.count(); i++){ - QmlGraphicsRect *curItem = findItem<QmlGraphicsRect>(pathview, "wrapper", i); + QmlGraphicsRectangle *curItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", i); QCOMPARE(curItem->pos() + offset, path->pointAt(0.1 + i*0.25)); } @@ -234,22 +234,22 @@ void tst_QmlGraphicsPathView::limitedItems() pathview->setPathItemCount(10); QCOMPARE(pathview->pathItemCount(), 10); - QmlGraphicsRect *testItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 0); + QmlGraphicsRectangle *testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 0); QVERIFY(testItem != 0); - testItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 9); + testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 9); QVERIFY(testItem != 0); - testItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 10); + testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 10); QVERIFY(testItem == 0); pathview->setCurrentIndex(50); QTest::qWait(5100);//Moving is animated and it's travelling far - should be reconsidered. - testItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 0); + testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 0); QVERIFY(testItem == 0); - testItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 1); + testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 1); QVERIFY(testItem == 0); - testItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 9); + testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 9); QVERIFY(testItem == 0); - testItem = findItem<QmlGraphicsRect>(pathview, "wrapper", 50); + testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 50); QVERIFY(testItem != 0); } diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 7dfb0ff..128fa87 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -987,11 +987,11 @@ void tst_qmllanguage::importsLocal_data() QTest::newRow("local import") << "import \"subdir\"\n" // QT-613 "Test {}" - << "QmlGraphicsRect"; + << "QmlGraphicsRectangle"; QTest::newRow("local import as") << "import \"subdir\" as T\n" "T.Test {}" - << "QmlGraphicsRect"; + << "QmlGraphicsRectangle"; QTest::newRow("wrong local import as") << "import \"subdir\" as T\n" "Test {}" @@ -1019,7 +1019,7 @@ void tst_qmllanguage::importsRemote_data() + QtNetworkSettings::serverName() + "/qtest/declarative/qmllanguage"; - QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QmlGraphicsRect"; + QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QmlGraphicsRectangle"; QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QmlGraphicsText"; QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QmlGraphicsImage"; } @@ -1042,7 +1042,7 @@ void tst_qmllanguage::importsInstalled_data() QTest::newRow("installed import 1") << "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QmlGraphicsRect"; + << "QmlGraphicsRectangle"; QTest::newRow("installed import 2") << "import com.nokia.installedtest 1.4\n" "InstalledTest {}" @@ -1075,7 +1075,7 @@ void tst_qmllanguage::importsOrder_data() "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QmlGraphicsRect"; + << "QmlGraphicsRectangle"; QTest::newRow("installed import re-overrides 1") << "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" @@ -1088,13 +1088,13 @@ void tst_qmllanguage::importsOrder_data() "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QmlGraphicsRect"; + << "QmlGraphicsRectangle"; QTest::newRow("installed import versus builtin 1") << "import com.nokia.installedtest 1.5\n" "import Qt 4.6\n" "Rectangle {}" - << "QmlGraphicsRect"; + << "QmlGraphicsRectangle"; QTest::newRow("installed import versus builtin 2") << "import Qt 4.6\n" "import com.nokia.installedtest 1.5\n" diff --git a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp b/tests/auto/declarative/qmltimer/tst_qmltimer.cpp index d3b273c..9c5dc30 100644 --- a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp +++ b/tests/auto/declarative/qmltimer/tst_qmltimer.cpp @@ -53,6 +53,7 @@ private slots: void notRepeating(); void notRepeatingStart(); void repeat(); + void noTriggerIfNotRunning(); void triggeredOnStart(); void triggeredOnStartRepeat(); }; @@ -176,6 +177,22 @@ void tst_qmltimer::triggeredOnStartRepeat() QVERIFY(helper.count > oldCount); } +void tst_qmltimer::noTriggerIfNotRunning() +{ + QmlEngine engine; + QmlComponent component(&engine, QByteArray( + "import Qt 4.6\n" + "Item { property bool ok: true\n" + "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" + "Timer { interval: 10; running: true; onTriggered: t1.running=false }" + "}" + ), QUrl("file://")); + QObject *item = component.create(); + QVERIFY(item != 0); + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(item->property("ok").toBool(), true); +} + QTEST_MAIN(tst_qmltimer) #include "tst_qmltimer.moc" diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index 4425eac..89e755e 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -41,7 +41,7 @@ #include <qtest.h> #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicsrect_p.h> +#include <private/qmlgraphicsrectangle_p.h> class tst_states : public QObject { @@ -62,7 +62,7 @@ void tst_states::basicChanges() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -76,7 +76,7 @@ void tst_states::basicChanges() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -96,7 +96,7 @@ void tst_states::basicChanges() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -132,7 +132,7 @@ void tst_states::basicExtension() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -165,7 +165,7 @@ void tst_states::basicExtension() { QmlComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -196,7 +196,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -223,7 +223,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -253,7 +253,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -277,7 +277,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml"); - QmlGraphicsRect *rect = qobject_cast<QmlGraphicsRect*>(rectComponent.create()); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -303,7 +303,7 @@ void tst_states::basicBinding() } } -class MyRect : public QmlGraphicsRect +class MyRect : public QmlGraphicsRectangle { Q_OBJECT public: @@ -343,7 +343,7 @@ void tst_states::signalOverride() rect->doSomething(); QCOMPARE(rect->color(),QColor("blue")); - QmlGraphicsRect *innerRect = qobject_cast<QmlGraphicsRect*>(rect->findChild<QmlGraphicsRect*>("extendedRect")); + QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("extendedRect")); innerRect->setState("green"); rect->doSomething(); diff --git a/examples/declarative/smooth/GradientRect.qml b/tests/auto/declarative/visual/rect/GradientRect.qml index ed56418..ed56418 100644 --- a/examples/declarative/smooth/GradientRect.qml +++ b/tests/auto/declarative/visual/rect/GradientRect.qml diff --git a/examples/declarative/smooth/MyRect.qml b/tests/auto/declarative/visual/rect/MyRect.qml index 9b6c3ae..9b6c3ae 100644 --- a/examples/declarative/smooth/MyRect.qml +++ b/tests/auto/declarative/visual/rect/MyRect.qml diff --git a/tests/auto/declarative/visual/rect/data/rect-painting.0.png b/tests/auto/declarative/visual/rect/data/rect-painting.0.png Binary files differnew file mode 100644 index 0000000..0b45874 --- /dev/null +++ b/tests/auto/declarative/visual/rect/data/rect-painting.0.png diff --git a/tests/auto/declarative/visual/rect/data/rect-painting.qml b/tests/auto/declarative/visual/rect/data/rect-painting.qml new file mode 100644 index 0000000..2c3267e --- /dev/null +++ b/tests/auto/declarative/visual/rect/data/rect-painting.qml @@ -0,0 +1,355 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 32 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 48 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 64 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 80 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 96 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 112 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 128 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 144 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 160 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 176 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 192 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 208 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 224 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 240 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 256 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 272 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 288 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 304 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 320 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 336 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 352 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 368 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 384 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 400 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 416 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 432 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 448 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 464 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 480 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 496 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 512 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 528 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 544 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 560 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 576 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 592 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 608 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 624 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 640 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 656 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 672 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 688 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 704 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 720 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 736 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 752 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 768 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 784 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 800 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 816 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 832 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 848 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 864 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 880 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 896 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 912 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 928 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 944 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 960 + image: "rect-painting.0.png" + } + Frame { + msec: 976 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 992 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1008 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1024 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1040 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1056 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1072 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1088 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1104 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1120 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1136 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1152 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1168 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1184 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1200 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1216 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1232 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1248 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1264 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1280 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1296 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1312 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1328 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1344 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } + Frame { + msec: 1360 + hash: "f38360b51d832ed7f70614dfe1964ec8" + } +} diff --git a/examples/declarative/smooth/rect-painting.qml b/tests/auto/declarative/visual/rect/rect-painting.qml index 4b6e223..4b6e223 100644 --- a/examples/declarative/smooth/rect-painting.qml +++ b/tests/auto/declarative/visual/rect/rect-painting.qml diff --git a/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp index 0af4858..e268136 100644 --- a/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp +++ b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp @@ -327,7 +327,7 @@ void tst_QmlPainting::drawTransformedImageRoundedRect() surface.save("ti.png"); } -//code from QmlGraphicsRect for drawing rounded rects +//code from QmlGraphicsRectangle for drawing rounded rects void tst_QmlPainting::drawScaleGridRoundedRect() { //setup image @@ -422,7 +422,7 @@ void tst_QmlPainting::drawScaledScaleGridRoundedRect_data() // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied; } -//code from QmlGraphicsRect for drawing rounded rects +//code from QmlGraphicsRectangle for drawing rounded rects void tst_QmlPainting::drawScaledScaleGridRoundedRect() { QFETCH(float, scale); @@ -522,7 +522,7 @@ void tst_QmlPainting::drawTransformedScaleGridRoundedRect_data() } -//code from QmlGraphicsRect for drawing rounded rects +//code from QmlGraphicsRectangle for drawing rounded rects void tst_QmlPainting::drawTransformedScaleGridRoundedRect() { QFETCH(QTransform, transform); |