diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-05 06:16:04 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-05 06:16:04 (GMT) |
commit | fb5e2e78746965d2c73ab8d757662573b4312fb7 (patch) | |
tree | ff2c31c95318fb9e86359b4a447b38c70a683598 | |
parent | 769a11719ca85e9cdac4c0f1d0fcffe6145d6972 (diff) | |
parent | cb486319b599eccbc40166d0b3d057d11d92759c (diff) | |
download | Qt-fb5e2e78746965d2c73ab8d757662573b4312fb7.zip Qt-fb5e2e78746965d2c73ab8d757662573b4312fb7.tar.gz Qt-fb5e2e78746965d2c73ab8d757662573b4312fb7.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
29 files changed, 1990 insertions, 1672 deletions
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 6cca39b..67aadcf 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -71,9 +71,11 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l PropertyAnimation \o \l NumberAnimation \o \l ColorAnimation +\o \l RotationAnimation \o \l SequentialAnimation \o \l ParallelAnimation \o \l PauseAnimation +\o \l ParentAnimation \o \l PropertyAction \o \l ParentAction \o \l ScriptAction @@ -92,8 +94,6 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l Package \o \l XmlListModel and XmlRole \o \l WorkerListModel -\o \l DateTimeFormatter -\o \l NumberFormatter \endlist \o diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 6e77abf..591fb3d 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -7,6 +7,8 @@ Flickable: renamed viewportX -> contentX Flickable: renamed viewportY -> contentY Removed Flickable.reportedVelocitySmoothing Removed Qt.playSound (replaced by SoundEffect element) +Removed NumberFormatter +Removed DateTimeFormatter (use Qt.formatDateTime() instead) Renamed MouseRegion -> MouseArea Connection: syntax and rename: Connection { sender: a; signal: foo(); script: xxx } diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 76b6a58..8c8dd95 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1341,24 +1341,26 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \brief The RotationAnimation element allows you to animate rotations. RotationAnimation is a specialized PropertyAnimation that gives control - over the direction of rotation. + over the direction of rotation. By default, it will rotate + via the shortest path; for example, a rotation from 20 to 340 degrees will + rotation 40 degrees counterclockwise. - The RotationAnimation in the following example ensures that we always take - the shortest rotation path when switching between our states. + When used in a transition RotationAnimation will rotate all + properties named "rotation" or "angle". You can override this by providing + your own properties via \c properties or \c property. + + In the following example we use RotationAnimation to animate the rotation + between states via the shortest path. \qml states: { State { name: "180"; PropertyChanges { target: myItem; rotation: 180 } } - State { name: "-180"; PropertyChanges { target: myItem; rotation: -180 } } - State { name: "180"; PropertyChanges { target: myItem; rotation: 270 } } + State { name: "90"; PropertyChanges { target: myItem; rotation: 90 } } + State { name: "-90"; PropertyChanges { target: myItem; rotation: -90 } } } transition: Transition { - RotationAnimation { direction: RotationAnimation.Shortest } + RotationAnimation { } } \endqml - - By default, when used in a transition RotationAnimation will rotate all - properties named "rotation" or "angle". You can override this by providing - your own properties via \c properties or \c property. */ /*! @@ -2389,6 +2391,52 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions } } +/*! + \qmlclass ParentAnimation QDeclarativeParentAnimation + \since 4.7 + \inherits Animation + \brief The ParentAnimation element allows you to animate parent changes. + + ParentAnimation is used in conjunction with NumberAnimation to smoothly + animate changing an item's parent. In the following example, + ParentAnimation wraps a NumberAnimation which animates from the + current position in the old parent to the new position in the new + parent. + + \qml + ... + State { + //reparent myItem to newParent. myItem's final location + //should be 10,10 in newParent. + ParentChange { + target: myItem + parent: newParent + x: 10; y: 10 + } + } + ... + Transition { + //smoothly reparent myItem and move into new position + ParentAnimation { + target: theItem + NumberAnimation { properties: "x,y" } + } + } + \endqml + + ParentAnimation can wrap any number of animations -- those animations will + be run in parallel (like those in a ParallelAnimation group). + + In some cases, such as reparenting between items with clipping, it's useful + to animate the parent change \i via another item with no clipping. + + When used in a transition, ParentAnimation will by default animate + all ParentChanges. +*/ +/*! + \internal + \class QDeclarativeParentAnimation +*/ QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent) { @@ -2410,6 +2458,13 @@ QDeclarativeParentAnimation::~QDeclarativeParentAnimation() { } +/*! + \qmlproperty item ParentAnimation::target + The item to reparent. + + When used in a transition, if no target is specified all + ParentChanges will be animated by the ParentAnimation. +*/ QDeclarativeItem *QDeclarativeParentAnimation::target() const { Q_D(const QDeclarativeParentAnimation); @@ -2422,6 +2477,12 @@ void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target) d->target = target; } +/*! + \qmlproperty item ParentAnimation::newParent + The new parent to animate to. + + If not set, then the parent defined in the end state of the transition. +*/ QDeclarativeItem *QDeclarativeParentAnimation::newParent() const { Q_D(const QDeclarativeParentAnimation); @@ -2434,6 +2495,19 @@ void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent) d->newParent = newParent; } +/*! + \qmlproperty item ParentAnimation::via + The item to reparent via. This provides a way to do an unclipped animation + when both the old parent and new parent are clipped + + \qml + ParentAnimation { + target: myItem + via: topLevelItem + ... + } + \endqml +*/ QDeclarativeItem *QDeclarativeParentAnimation::via() const { Q_D(const QDeclarativeParentAnimation); @@ -2480,12 +2554,13 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, struct QDeclarativeParentActionData : public QAbstractAnimationAction { - QDeclarativeParentActionData(): pc(0) {} - ~QDeclarativeParentActionData() { delete pc; } + QDeclarativeParentActionData() {} + ~QDeclarativeParentActionData() { qDeleteAll(pc); } QDeclarativeStateActions actions; + //### reverse should probably apply on a per-action basis bool reverse; - QDeclarativeParentChange *pc; + QList<QDeclarativeParentChange *> pc; virtual void doAction() { for (int ii = 0; ii < actions.count(); ++ii) { @@ -2500,6 +2575,33 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, QDeclarativeParentActionData *data = new QDeclarativeParentActionData; QDeclarativeParentActionData *viaData = new QDeclarativeParentActionData; + + bool hasExplicit = false; + if (d->target && d->newParent) { + data->reverse = false; + QDeclarativeAction myAction; + QDeclarativeParentChange *pc = new QDeclarativeParentChange; + pc->setObject(d->target); + pc->setParent(d->newParent); + myAction.event = pc; + data->pc << pc; + data->actions << myAction; + hasExplicit = true; + if (d->via) { + viaData->reverse = false; + QDeclarativeAction myVAction; + QDeclarativeParentChange *vpc = new QDeclarativeParentChange; + vpc->setObject(d->target); + vpc->setParent(d->via); + myVAction.event = vpc; + viaData->pc << vpc; + viaData->actions << myVAction; + } + //### once actions have concept of modified, + // loop to match appropriate ParentChanges and mark as modified + } + + if (!hasExplicit) for (int i = 0; i < actions.size(); ++i) { QDeclarativeAction &action = actions[i]; if (action.event && action.event->typeName() == QLatin1String("ParentChange") @@ -2508,8 +2610,21 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, QDeclarativeParentChange *pc = static_cast<QDeclarativeParentChange*>(action.event); QDeclarativeAction myAction = action; data->reverse = action.reverseEvent; - action.actionDone = true; - data->actions << myAction; + + //### this logic differs from PropertyAnimation + // (probably a result of modified vs. done) + if (d->newParent) { + QDeclarativeParentChange *epc = new QDeclarativeParentChange; + epc->setObject(static_cast<QDeclarativeParentChange*>(action.event)->object()); + epc->setParent(d->newParent); + myAction.event = epc; + data->pc << epc; + data->actions << myAction; + pc = epc; + } else { + action.actionDone = true; + data->actions << myAction; + } if (d->via) { viaData->reverse = false; @@ -2518,7 +2633,7 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, vpc->setObject(pc->object()); vpc->setParent(d->via); myAction.event = vpc; - viaData->pc = vpc; + viaData->pc << vpc; viaData->actions << myAction; QDeclarativeAction dummyAction; QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction; diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index 0f23f5c..af48309 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -457,7 +457,7 @@ class QDeclarativeParentAnimation : public QDeclarativeAnimationGroup Q_DECLARE_PRIVATE(QDeclarativeParentAnimation) Q_PROPERTY(QDeclarativeItem *target READ target WRITE setTarget) - //Q_PROPERTY(QDeclarativeItem *newParent READ newParent WRITE setNewParent) + Q_PROPERTY(QDeclarativeItem *newParent READ newParent WRITE setNewParent) Q_PROPERTY(QDeclarativeItem *via READ via WRITE setVia) public: diff --git a/src/declarative/util/qdeclarativedatetimeformatter.cpp b/src/declarative/util/qdeclarativedatetimeformatter.cpp deleted file mode 100644 index 4087091..0000000 --- a/src/declarative/util/qdeclarativedatetimeformatter.cpp +++ /dev/null @@ -1,373 +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 "qdeclarativedatetimeformatter_p.h" - -#include <QtCore/qlocale.h> - -#include <private/qobject_p.h> - -QT_BEGIN_NAMESPACE - -//TODO: may need optimisation as the QDateTime member may not be needed? -// be able to set a locale? - -class QDeclarativeDateTimeFormatterPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeDateTimeFormatter) -public: - QDeclarativeDateTimeFormatterPrivate() : locale(QLocale::system()), longStyle(false), componentComplete(true) {} - - void updateText(); - - QDateTime dateTime; - QDate date; - QTime time; - QLocale locale; - QString dateTimeText; - QString dateText; - QString timeText; - QString dateTimeFormat; //set for convienience? - QString dateFormat; - QString timeFormat; - bool longStyle; - bool componentComplete; -}; - -/*! - \qmlclass DateTimeFormatter QDeclarativeDateTimeFormatter - \since 4.7 - \brief The DateTimeFormatter allows you to control the format of a date string. - - \code - DateTimeFormatter { id: formatter; date: System.date } - Text { text: formatter.dateText } - \endcode - - By default, the text properties (dateText, timeText, and dateTimeText) will return the - date and time using the current system locale's format. -*/ - -/*! - \internal - \class QDeclarativeDateTimeFormatter - \ingroup group_utility - \brief The QDeclarativeDateTimeFormatter class allows you to format a date string. -*/ - -QDeclarativeDateTimeFormatter::QDeclarativeDateTimeFormatter(QObject *parent) -: QObject(*(new QDeclarativeDateTimeFormatterPrivate), parent) -{ -} - -QDeclarativeDateTimeFormatter::~QDeclarativeDateTimeFormatter() -{ -} - -/*! - \qmlproperty string DateTimeFormatter::dateText - \qmlproperty string DateTimeFormatter::timeText - \qmlproperty string DateTimeFormatter::dateTimeText - - Formatted text representations of the \c date, \c time, - and \c {date and time}, respectively. - - If there is no explictly specified format the DateTimeFormatter - will use the system locale's default 'short' setting. - - \code - // specify source date (assuming today is February 19, 2009) - DateTimeFormatter { id: formatter; dateTime: Today.date } - - // display the full date and time - Text { text: formatter.dateText } - \endcode - - Would be equivalent to the following for a US English locale: - - \code - // display the date - Text { text: "2/19/09" } - \endcode -*/ -QString QDeclarativeDateTimeFormatter::dateTimeText() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->dateTimeText; -} - -QString QDeclarativeDateTimeFormatter::dateText() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->dateText; -} - -QString QDeclarativeDateTimeFormatter::timeText() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->timeText; -} - -/*! - \qmlproperty date DateTimeFormatter::date - \qmlproperty time DateTimeFormatter::time - \qmlproperty datetime DateTimeFormatter::dateTime - - The source date and time to be used by the formatter. - - \code - // setting the date and time - DateTimeFormatter { date: System.date; time: System.time } - \endcode - - For convienience it is possible to set the datetime property to set both the date and the time. - \code - // setting the datetime - DateTimeFormatter { dateTime: System.dateTime } - \endcode - - There can only be one instance of date and time per formatter; if date, time, and dateTime are all - set the actual date and time used is not guaranteed. - - \note If no date is set, dateTimeText will be just the date; - If no time is set, the dateTimeText will be just the time. - -*/ -QDate QDeclarativeDateTimeFormatter::date() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->date; -} - -QTime QDeclarativeDateTimeFormatter::time() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->time; -} - -QDateTime QDeclarativeDateTimeFormatter::dateTime() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->dateTime; -} - -/*! - \qmlproperty string DateTimeFormatter::dateFormat - \qmlproperty string DateTimeFormatter::timeFormat - \qmlproperty string DateTimeFormatter::dateTimeFormat - - Specifies a custom format which the DateTime Formatter can use. - - If there is no explictly specified format the DateTimeFormatter - will use the system locale's default 'short' setting. - - The text's format may be modified by setting: - \list - \i \c dateFormat - \i \c timeFormat - \i \c dateTimeFormat - \endlist - - If only the format for date is defined, the time and dateTime formats will be defined - as the system locale default and likewise for the others. - - Syntax for the format is based on the QDateTime::toString() formatting options. - - \code - // Format the date such that the dateText is: '1997-12-12' - DateTimeFormatter { id: formatter; dateTime: Today.dateTime; formatDate: "yyyy-MM-d" } - \endcode - - Assigning an empty string to a particular format will reset it. -*/ -QString QDeclarativeDateTimeFormatter::dateTimeFormat() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->dateTimeFormat; -} - -QString QDeclarativeDateTimeFormatter::dateFormat() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->dateFormat; -} - -QString QDeclarativeDateTimeFormatter::timeFormat() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->timeFormat; -} - -/*! - \qmlproperty bool DateTimeFormatter::longStyle - - This property causes the formatter to use the system locale's long format rather than short format - by default. - - This setting is off by default. -*/ -bool QDeclarativeDateTimeFormatter::longStyle() const -{ - Q_D(const QDeclarativeDateTimeFormatter); - return d->longStyle; -} - -void QDeclarativeDateTimeFormatter::setDateTime(const QDateTime &dateTime) -{ - Q_D(QDeclarativeDateTimeFormatter); - if (d->dateTime == dateTime) - return; - d->dateTime = dateTime; - d->date = d->dateTime.date(); - d->time = d->dateTime.time(); - d->updateText(); -} - -void QDeclarativeDateTimeFormatter::setTime(const QTime &time) -{ - Q_D(QDeclarativeDateTimeFormatter); - if (d->dateTime.time() == time) - return; - d->time = time; - d->dateTime.setTime(time); - d->updateText(); -} - -void QDeclarativeDateTimeFormatter::setDate(const QDate &date) -{ - Q_D(QDeclarativeDateTimeFormatter); - if (d->dateTime.date() == date) - return; - d->date = date; - bool clearTime = d->dateTime.time().isValid() ? false : true; //because setting date generates default time - d->dateTime.setDate(date); - if (clearTime) - d->dateTime.setTime(QTime()); - d->updateText(); -} - -//DateTime formatting may be a combination of date and time? -void QDeclarativeDateTimeFormatter::setDateTimeFormat(const QString &format) -{ - Q_D(QDeclarativeDateTimeFormatter); - //no format checking - d->dateTimeFormat = format; - d->updateText(); -} - -void QDeclarativeDateTimeFormatter::setDateFormat(const QString &format) -{ - Q_D(QDeclarativeDateTimeFormatter); - //no format checking - d->dateFormat = format; - d->updateText(); -} - -void QDeclarativeDateTimeFormatter::setTimeFormat(const QString &format) -{ - Q_D(QDeclarativeDateTimeFormatter); - //no format checking - d->timeFormat = format; - d->updateText(); -} - -void QDeclarativeDateTimeFormatter::setLongStyle(bool longStyle) -{ - Q_D(QDeclarativeDateTimeFormatter); - d->longStyle = longStyle; - d->updateText(); -} - -void QDeclarativeDateTimeFormatterPrivate::updateText() -{ - Q_Q(QDeclarativeDateTimeFormatter); - if (!componentComplete) - return; - - QString str; - QString str1; - QString str2; - - Qt::DateFormat defaultFormat = longStyle ? Qt::SystemLocaleLongDate : Qt::SystemLocaleShortDate; - - if (dateFormat.isEmpty()) - str1 = date.toString(defaultFormat); - else - str1 = date.toString(dateFormat); - - if (timeFormat.isEmpty()) - str2 = time.toString(defaultFormat); - else - str2 = time.toString(timeFormat); - - if (dateTimeFormat.isEmpty()) - str = dateTime.toString(defaultFormat); - //else if (!formatTime.isEmpty() && !formatDate.isEmpty()) - // str = str1 + QLatin1Char(' ') + str2; - else - str = dateTime.toString(dateTimeFormat); - - if (dateTimeText == str && dateText == str1 && timeText == str2) - return; - - dateTimeText = str; - dateText = str1; - timeText = str2; - - emit q->textChanged(); -} - -void QDeclarativeDateTimeFormatter::classBegin() -{ - Q_D(QDeclarativeDateTimeFormatter); - d->componentComplete = false; -} - -void QDeclarativeDateTimeFormatter::componentComplete() -{ - Q_D(QDeclarativeDateTimeFormatter); - d->componentComplete = true; - d->updateText(); -} - - - -QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativedatetimeformatter_p.h b/src/declarative/util/qdeclarativedatetimeformatter_p.h deleted file mode 100644 index da900be..0000000 --- a/src/declarative/util/qdeclarativedatetimeformatter_p.h +++ /dev/null @@ -1,117 +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 QDECLARATIVEDATETIMEFORMATTER_H -#define QDECLARATIVEDATETIMEFORMATTER_H - -#include <qdeclarative.h> - -#include <QtCore/qdatetime.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeDateTimeFormatterPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeDateTimeFormatter : public QObject, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_INTERFACES(QDeclarativeParserStatus) - - Q_PROPERTY(QString dateText READ dateText NOTIFY textChanged) - Q_PROPERTY(QString timeText READ timeText NOTIFY textChanged) - Q_PROPERTY(QString dateTimeText READ dateTimeText NOTIFY textChanged) - Q_PROPERTY(QDate date READ date WRITE setDate) - Q_PROPERTY(QTime time READ time WRITE setTime) - Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime) - Q_PROPERTY(QString dateFormat READ dateFormat WRITE setDateFormat) - Q_PROPERTY(QString timeFormat READ timeFormat WRITE setTimeFormat) - Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat) - Q_PROPERTY(bool longStyle READ longStyle WRITE setLongStyle) -public: - QDeclarativeDateTimeFormatter(QObject *parent=0); - ~QDeclarativeDateTimeFormatter(); - - QString dateTimeText() const; - QString dateText() const; - QString timeText() const; - - QDate date() const; - void setDate(const QDate &); - - QTime time() const; - void setTime(const QTime &); - - QDateTime dateTime() const; - void setDateTime(const QDateTime &); - - QString dateTimeFormat() const; - void setDateTimeFormat(const QString &); - - QString dateFormat() const; - void setDateFormat(const QString &); - - QString timeFormat() const; - void setTimeFormat(const QString &); - - bool longStyle() const; - void setLongStyle(bool); - - virtual void classBegin(); - virtual void componentComplete(); - -Q_SIGNALS: - void textChanged(); - -private: - Q_DISABLE_COPY(QDeclarativeDateTimeFormatter) - Q_DECLARE_PRIVATE(QDeclarativeDateTimeFormatter) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeDateTimeFormatter) - -QT_END_HEADER - -#endif diff --git a/src/declarative/util/qdeclarativenumberformatter.cpp b/src/declarative/util/qdeclarativenumberformatter.cpp deleted file mode 100644 index 5d81958..0000000 --- a/src/declarative/util/qdeclarativenumberformatter.cpp +++ /dev/null @@ -1,261 +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 "qdeclarativenumberformatter_p.h" - -#include <private/qobject_p.h> - -QT_BEGIN_NAMESPACE - -//TODO: set locale -// docs -// this is a wrapper around qnumberformat (test integration) -// if number or format haven't been explictly set, text should be an empty string - -class QDeclarativeNumberFormatterPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeNumberFormatter) -public: - QDeclarativeNumberFormatterPrivate() : locale(QLocale::system()), number(0), componentComplete(true) {} - - void updateText(); - - QLocale locale; - QString format; - QNumberFormat numberFormat; - QString text; - qreal number; - bool componentComplete; -}; -/*! - \qmlclass NumberFormatter - \since 4.7 - \brief The NumberFormatter allows you to control the format of a number string. - - The format property documentation has more details on how the format can be manipulated. - - In the following example, the text element will display the text "1,234.57". - \code - NumberFormatter { id: formatter; number: 1234.5678; format: "##,##0.##" } - Text { text: formatter.text } - \endcode - - */ -/*! - \internal - \class QDeclarativeNumberFormatter - \ingroup group_utility - \brief The QDeclarativeNumberFormatter class allows you to format a number to a particular string format/locale specific number format. -*/ - -QDeclarativeNumberFormatter::QDeclarativeNumberFormatter(QObject *parent) -: QObject(*(new QDeclarativeNumberFormatterPrivate), parent) -{ -} - -QDeclarativeNumberFormatter::~QDeclarativeNumberFormatter() -{ -} - -/*! - \qmlproperty string NumberFormatter::text - - The number in the specified format. - - If no format is specified the text will be empty. -*/ - -QString QDeclarativeNumberFormatter::text() const -{ - Q_D(const QDeclarativeNumberFormatter); - return d->text; -} - -/*! - \qmlproperty real NumberFormatter::number - - A single point precision number. (Doubles are not yet supported) - -*/ -qreal QDeclarativeNumberFormatter::number() const -{ - Q_D(const QDeclarativeNumberFormatter); - return d->number; -} - -/*! - \qmlproperty string NumberFormatter::format - - The particular format the number will adhere to during the conversion to text. - - The format syntax follows a style similar to the Unicode Standard (UTS35). - - The table below shows the characters, patterns that can be used in the format. - - \table - \header - \o Character - \o Meaning - \row - \o # - \o Any digit(s), zero shows as absent (for leading/trailing zeroes). - \row - \o 0 - \o Implicit digit. Zero will show in the case that the input number is too small. - \row - \o . - \o Decimal separator. Output decimal seperator will be dependant on system locale. - \row - \o , - \o Grouping separator. The number of digits (either #, or 0) between the grouping separator and the decimal (or the rightmost digit) will determine the groupingSize). - \row - \o other - \o Any other character will be taken as a string literal and placed directly into the output string. - \endtable - - Invalid formats will not guarantee a meaningful text output. - - \note Input numbers that are too long for the given format will be rounded dependent on precison based on the position of the decimal point. - - The following table illustrates the output text created by applying some examples of numeric formats to the formatter. - - \table - \header - \o Format - \o Number - \o Output - \row - \o ### - \o 123456 - \o 123456 - \row - \o 000 - \o 123456 - \o 123456 - \row - \o ###### - \o 1234 - \o 1234 - \row - \o 000000 - \o 1234 - \o 001234 - \row - \o ##,##0.## - \o 1234.456 - \o 1,234.46 (for US locale) - \codeline 1 234,46 (for FR locale) - \row - \o 000000,000.# - \o 123456 - \o 000,123,456 (for US locale) - \codeline 000 123 456 (for FR locale) - \row - \o 0.0### - \o 0.999997 - \o 1.0 - \row - \o (000) 000 - 000 - \o 12345678 - \o (012) 345 - 678 - \row - \o #A - \o 12 - \o 12A - \endtable - -*/ -QString QDeclarativeNumberFormatter::format() const -{ - Q_D(const QDeclarativeNumberFormatter); - return d->format; -} - -void QDeclarativeNumberFormatter::setNumber(const qreal &number) -{ - Q_D(QDeclarativeNumberFormatter); - if (d->number == number) - return; - d->number = number; - d->updateText(); -} - -void QDeclarativeNumberFormatter::setFormat(const QString &format) -{ - Q_D(QDeclarativeNumberFormatter); - //no format checking - if (format.isEmpty()) - d->format = QString::null; - else - d->format = format; - d->updateText(); -} - -void QDeclarativeNumberFormatterPrivate::updateText() -{ - Q_Q(QDeclarativeNumberFormatter); - if (!componentComplete) - return; - - QNumberFormat tempFormat; - tempFormat.setFormat(format); - tempFormat.setNumber(number); - - text = tempFormat.text(); - - emit q->textChanged(); -} - -void QDeclarativeNumberFormatter::classBegin() -{ - Q_D(QDeclarativeNumberFormatter); - d->componentComplete = false; -} - -void QDeclarativeNumberFormatter::componentComplete() -{ - Q_D(QDeclarativeNumberFormatter); - d->componentComplete = true; - d->updateText(); -} - - -QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativenumberformatter_p.h b/src/declarative/util/qdeclarativenumberformatter_p.h deleted file mode 100644 index 3b8c7e1..0000000 --- a/src/declarative/util/qdeclarativenumberformatter_p.h +++ /dev/null @@ -1,93 +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 QDECLARATIVENUMBERFORMATTER_H -#define QDECLARATIVENUMBERFORMATTER_H - -#include "qnumberformat_p.h" - -#include <qdeclarative.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeNumberFormatterPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeNumberFormatter : public QObject, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_INTERFACES(QDeclarativeParserStatus) - - Q_PROPERTY(QString text READ text NOTIFY textChanged) - Q_PROPERTY(QString format READ format WRITE setFormat) - Q_PROPERTY(qreal number READ number WRITE setNumber) -public: - QDeclarativeNumberFormatter(QObject *parent=0); - ~QDeclarativeNumberFormatter(); - - QString text() const; - - qreal number() const; - void setNumber(const qreal &); - - QString format() const; - void setFormat(const QString &); - - virtual void classBegin(); - virtual void componentComplete(); - -Q_SIGNALS: - void textChanged(); - -private: - Q_DISABLE_COPY(QDeclarativeNumberFormatter) - Q_DECLARE_PRIVATE(QDeclarativeNumberFormatter) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeNumberFormatter) - -QT_END_HEADER - -#endif diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index cea9ad7..cd06380 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -158,17 +158,17 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q \qmlclass ParentChange QDeclarativeParentChange \brief The ParentChange element allows you to reparent an Item in a state change. - ParentChange reparents an Item while preserving its visual appearance (position, rotation, - and scale) on screen. You can then specify a transition to move/rotate/scale the Item to - its final intended appearance. + ParentChange reparents an item while preserving its visual appearance (position, size, + rotation, and scale) on screen. You can then specify a transition to move/resize/rotate/scale + the item to its final intended appearance. ParentChange can only preserve visual appearance if no complex transforms are involved. More specifically, it will not work if the transform property has been set for any - Items involved in the reparenting (defined as any Items in the common ancestor tree + items involved in the reparenting (i.e. items in the common ancestor tree for the original and new parent). You can specify at which point in a transition you want a ParentChange to occur by - using a ParentAction. + using a ParentAnimation or ParentAction. */ @@ -181,6 +181,16 @@ QDeclarativeParentChange::~QDeclarativeParentChange() { } +/*! + \qmlproperty real ParentChange::x + \qmlproperty real ParentChange::y + \qmlproperty real ParentChange::width + \qmlproperty real ParentChange::height + \qmlproperty real ParentChange::scale + \qmlproperty real ParentChange::rotation + These properties hold the new position, size, scale, and rotation + for the item in this state. +*/ qreal QDeclarativeParentChange::x() const { Q_D(const QDeclarativeParentChange); @@ -314,7 +324,7 @@ void QDeclarativeParentChange::setObject(QDeclarativeItem *target) /*! \qmlproperty Item ParentChange::parent - This property holds the parent for the item in this state + This property holds the new parent for the item in this state. */ QDeclarativeItem *QDeclarativeParentChange::parent() const diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index 1f85b89..65bfdc1 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -46,13 +46,11 @@ #include "qdeclarativebehavior_p.h" #include "qdeclarativebind_p.h" #include "qdeclarativeconnections_p.h" -#include "qdeclarativedatetimeformatter_p.h" #include "qdeclarativeeasefollow_p.h" #include "qdeclarativefontloader_p.h" #include "qdeclarativelistaccessor_p.h" #include "qdeclarativelistmodel_p.h" #include "qdeclarativenullablevalue_p_p.h" -#include "qdeclarativenumberformatter_p.h" #include "qdeclarativeopenmetaobject_p.h" #include "qdeclarativepackage_p.h" #include "qdeclarativepixmapcache_p.h" @@ -73,7 +71,6 @@ #ifndef QT_NO_XMLPATTERNS #include "qdeclarativexmllistmodel_p.h" #endif -#include "qnumberformat_p.h" #include "qperformancelog_p_p.h" void QDeclarativeUtilModule::defineModule() @@ -83,12 +80,10 @@ void QDeclarativeUtilModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,Binding,QDeclarativeBind); QML_REGISTER_TYPE(Qt,4,6,ColorAnimation,QDeclarativeColorAnimation); QML_REGISTER_TYPE(Qt,4,6,Connections,QDeclarativeConnections); - QML_REGISTER_TYPE(Qt,4,6,DateTimeFormatter,QDeclarativeDateTimeFormatter); QML_REGISTER_TYPE(Qt,4,6,EaseFollow,QDeclarativeEaseFollow);; QML_REGISTER_TYPE(Qt,4,6,FontLoader,QDeclarativeFontLoader); QML_REGISTER_TYPE(Qt,4,6,ListElement,QDeclarativeListElement); QML_REGISTER_TYPE(Qt,4,6,NumberAnimation,QDeclarativeNumberAnimation); - QML_REGISTER_TYPE(Qt,4,6,NumberFormatter,QDeclarativeNumberFormatter);; QML_REGISTER_TYPE(Qt,4,6,Package,QDeclarativePackage); QML_REGISTER_TYPE(Qt,4,6,ParallelAnimation,QDeclarativeParallelAnimation); QML_REGISTER_TYPE(Qt,4,6,ParentAction,QDeclarativeParentAction); @@ -116,7 +111,6 @@ void QDeclarativeUtilModule::defineModule() QML_REGISTER_NOCREATE_TYPE(QDeclarativeAnchors); QML_REGISTER_NOCREATE_TYPE(QDeclarativeAbstractAnimation); QML_REGISTER_NOCREATE_TYPE(QDeclarativeStateOperation); - QML_REGISTER_NOCREATE_TYPE(QNumberFormat); QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, ListModel, QDeclarativeListModel, QDeclarativeListModelParser); QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, PropertyChanges, QDeclarativePropertyChanges, QDeclarativePropertyChangesParser); diff --git a/src/declarative/util/qnumberformat.cpp b/src/declarative/util/qnumberformat.cpp deleted file mode 100644 index 81d0b90..0000000 --- a/src/declarative/util/qnumberformat.cpp +++ /dev/null @@ -1,224 +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 "qnumberformat_p.h" -#include <QtCore/qstringlist.h> - -QT_BEGIN_NAMESPACE - -QNumberFormat::QNumberFormat(QObject *parent) : QObject(parent), _number(0), _type(Decimal), - _groupingSize(0) -{ - _locale = QLocale::system(); - _groupingSeparator = _locale.groupSeparator(); - _decimalSeparator = _locale.decimalPoint(); - _currencySymbol = QLatin1Char('$'); -} - -QNumberFormat::~QNumberFormat() -{ - -} - -void QNumberFormat::updateText() -{ - QTime t; - t.start(); - static int totalTime; - - handleFormat(); - - totalTime += t.elapsed(); - emit textChanged(); -} - -void QNumberFormat::handleFormat() -{ - // ### is extremely messy - if (_format.isEmpty()) { - _text = QString::number(_number, 'f', -1); - return; - } - - QString inputString; - - // ### possible to use the following parsed data in the future - - int remainingLength = _format.size(); - int currentIndex = _format.size()-1; - - int maxDigits = 0; - int minDigits = 0; - int decimalLength = 0; - - while (remainingLength > 0) { - switch(_format.at(currentIndex).unicode()) { - case ',': - if (decimalLength && !_groupingSize) - setGroupingSize(maxDigits - decimalLength); - else if (!_groupingSize) - setGroupingSize(maxDigits); - break; - case '.': - if (!decimalLength) - decimalLength = maxDigits; - break; - case '0': - minDigits++; - case '#': - maxDigits++; - break; - default: - break; - } - currentIndex--; - remainingLength--; - } - - // round given the decimal length/precision - inputString = QString::number(_number, 'f', decimalLength); - - QStringList parts = inputString.split(QLatin1Char('.')); - QStringList formatParts = _format.split(QLatin1Char('.')); - - if (formatParts.size() > 2 || parts.size() > 2 ) - return; - - QString formatInt = formatParts.at(0); - - QString formatDec; - if (formatParts.size() == 2) - formatDec = formatParts.at(1); - - QString integer = parts.at(0); - - QString decimal; - if (parts.size() == 2) - decimal = parts.at(1); - - QString outputDecimal = formatDecimal(formatDec, decimal); - QString outputInteger = formatInteger(formatInt, integer); - - // insert separators - if (_groupingSize) { - unsigned int count = 0; - for (int i = outputInteger.size()-1; i > 0; i--) { - if (outputInteger.at(i).digitValue() >= 0) { - if (count == _groupingSize - 1) { - count = 0; - outputInteger.insert(i, _groupingSeparator); - } - else - count++; - } - } - } - if (!outputDecimal.isEmpty()) - _text = outputInteger + _decimalSeparator + outputDecimal; - else - _text = outputInteger; -} - -QString QNumberFormat::formatInteger(const QString &formatInt, const QString &integer) -{ - if (formatInt.isEmpty() || integer.isEmpty()) - return QString(); - - QString outputInteger; - int formatIndex = formatInt.size()-1; - - //easier for carry? - for (int index= integer.size()-1; index >= 0; index--) { - if (formatIndex < 0) { - outputInteger.push_front(integer.at(index)); - } - else { - switch(formatInt.at(formatIndex).unicode()) { - case '0': - if (index > integer.size()-1) { - outputInteger.push_front(QLatin1Char('0')); - break; - } - case '#': - outputInteger.push_front(integer.at(index)); - break; - case ',': - index++; - break; - default: - outputInteger.push_front(formatInt.at(formatIndex)); - index++; - break; - } - formatIndex--; - } - } - while (formatIndex >= 0) { - if (formatInt.at(formatIndex).unicode() != '#' && formatInt.at(formatIndex).unicode() != ',') - outputInteger.push_front(formatInt.at(formatIndex)); - formatIndex--; - } - return outputInteger; -} - -QString QNumberFormat::formatDecimal(const QString &formatDec, const QString &decimal) -{ - QString outputDecimal; - - // up to max 6 decimal places - for (int index=formatDec.size()-1; index >= 0; index--) { - switch(formatDec.at(index).unicode()) { - case '0': - outputDecimal.push_front(decimal.at(index)); - break; - case '#': - if (decimal.at(index) != QLatin1Char('0') || outputDecimal.size() > 0) - outputDecimal.push_front(decimal.at(index)); - break; - default: - outputDecimal.push_front(formatDec.at(index)); - break; - } - } - return outputDecimal; -} - -QT_END_NAMESPACE diff --git a/src/declarative/util/qnumberformat_p.h b/src/declarative/util/qnumberformat_p.h deleted file mode 100644 index ced4442..0000000 --- a/src/declarative/util/qnumberformat_p.h +++ /dev/null @@ -1,174 +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 NUMBERFORMAT_H -#define NUMBERFORMAT_H - -#include <qdeclarative.h> - -#include <QtCore/QLocale> -#include <QtCore/QTime> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -// TODO -// be able to set Locale, instead of default system for dynamic formatting -// add currency support -// add additional syntax, extend to format scientific, percentiles, significant digits etc - - -class QNumberFormat : public QObject -{ - Q_OBJECT - Q_ENUMS(NumberType) -public: - QNumberFormat(QObject *parent=0); - ~QNumberFormat(); - - enum NumberType { - Percent, - Scientific, - Currency, - Decimal - }; - - //external property, only visible - Q_PROPERTY(QString text READ text NOTIFY textChanged) - - //mutatable properties to modify the output (text) - Q_PROPERTY(qreal number READ number WRITE setNumber) - Q_PROPERTY(QString format READ format WRITE setFormat) - Q_PROPERTY(QLocale locale READ locale WRITE setLocale) - - //Format specific settings - Q_PROPERTY(unsigned short groupingSeparator READ groupingSeparator WRITE setGroupingSeparator) - Q_PROPERTY(unsigned short decimalSeperator READ decimalSeparator WRITE setDecimalSeparator) - Q_PROPERTY(unsigned int groupingSize READ groupingSize WRITE setGroupingSize) - Q_PROPERTY(unsigned short currencySymbol READ currencySymbol WRITE setCurrencySymbol) - - - QString text() const { return _text; } - - qreal number() const { return _number; } - void setNumber(qreal n) { - if (_number == n) - return; - _number = n; - updateText(); - } - - QString format() const { return _format; } - void setFormat(const QString &format) { - if (format.isEmpty()) - _format = QString::null; - else if (_format == format) - return; - - _format = format; - updateText(); - } - - QLocale locale() const { return _locale; } - void setLocale(const QLocale &locale) { _locale = locale; updateText(); } - - //Do we deal with unicode standard? or create our own - // ### since this is the backend for the number conversions, we will use the unicode - // the front-end will handle the QChar/QString -> short int - - unsigned short groupingSeparator() { return _groupingSeparator.unicode(); } - void setGroupingSeparator(unsigned short unicodeSymbol) - { - _groupingSeparator = QChar(unicodeSymbol); - } - - unsigned short decimalSeparator() { return _decimalSeparator.unicode(); } - void setDecimalSeparator(unsigned short unicodeSymbol) - { - _decimalSeparator = QChar(unicodeSymbol); - } - - unsigned short currencySymbol() { return _currencySymbol.unicode(); } - void setCurrencySymbol(unsigned short unicodeSymbol) - { - _currencySymbol = QChar(unicodeSymbol); - } - - unsigned int groupingSize() { return _groupingSize; } - void setGroupingSize(unsigned int size) - { - _groupingSize = size; - } - -Q_SIGNALS: - void textChanged(); - -private: - void updateText(); - void handleFormat(); - QString formatInteger(const QString &formatInt, const QString &integer); - QString formatDecimal(const QString &formatDec, const QString &decimal); - - qreal _number; - NumberType _type; - QChar _groupingSeparator; - QChar _decimalSeparator; - QChar _currencySymbol; - unsigned int _groupingSize; - - QLocale _locale; - QString _format; - - // only hooked member at the moment - QString _text; - -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QNumberFormat) - -QT_END_HEADER - -#endif diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 198e9e5..26edecc 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -25,9 +25,6 @@ SOURCES += \ $$PWD/qdeclarativebind.cpp \ $$PWD/qdeclarativepropertymap.cpp \ $$PWD/qdeclarativepixmapcache.cpp \ - $$PWD/qnumberformat.cpp \ - $$PWD/qdeclarativenumberformatter.cpp \ - $$PWD/qdeclarativedatetimeformatter.cpp \ $$PWD/qdeclarativebehavior.cpp \ $$PWD/qdeclarativefontloader.cpp \ $$PWD/qdeclarativestyledtext.cpp @@ -60,9 +57,6 @@ HEADERS += \ $$PWD/qdeclarativebind_p.h \ $$PWD/qdeclarativepropertymap.h \ $$PWD/qdeclarativepixmapcache_p.h \ - $$PWD/qnumberformat_p.h \ - $$PWD/qdeclarativenumberformatter_p.h \ - $$PWD/qdeclarativedatetimeformatter_p.h \ $$PWD/qdeclarativebehavior_p.h \ $$PWD/qdeclarativefontloader_p.h \ $$PWD/qdeclarativestyledtext_p.h diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 99a32d9..143fbad 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -10,7 +10,6 @@ SUBDIRS += \ qdeclarativecomponent \ # Cover qdeclarativeconnection \ # Cover qdeclarativecontext \ # Cover - qdeclarativedatetimeformatter \ # Cover qdeclarativedebug \ # Cover qdeclarativedebugclient \ # Cover qdeclarativedebugservice \ # Cover @@ -45,7 +44,6 @@ SUBDIRS += \ qdeclarativeproperty \ # Cover qdeclarativemetatype \ # Cover qdeclarativemoduleplugin \ # Cover - qdeclarativenumberformatter \ # Cover qdeclarativepixmapcache \ # Cover qdeclarativepropertymap \ # Cover qdeclarativeqt \ # Cover diff --git a/tests/auto/declarative/qdeclarativeanimations/data/rotation.qml b/tests/auto/declarative/qdeclarativeanimations/data/rotation.qml new file mode 100644 index 0000000..e9c57d4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimations/data/rotation.qml @@ -0,0 +1,48 @@ +import Qt 4.6 + +Rectangle { + width: 600; height: 200 + + Row { + spacing: 5 + Rectangle { + id: rr + objectName: "rr" + color: "red" + width: 100; height: 100 + } + Rectangle { + id: rr2 + objectName: "rr2" + color: "red" + width: 100; height: 100 + } + Rectangle { + id: rr3 + objectName: "rr3" + color: "red" + width: 100; height: 100 + } + Rectangle { + id: rr4 + objectName: "rr4" + color: "red" + width: 100; height: 100 + } + } + + states: State { + name: "state1" + PropertyChanges { target: rr; rotation: 370 } + PropertyChanges { target: rr2; rotation: 370 } + PropertyChanges { target: rr3; rotation: 370 } + PropertyChanges { target: rr4; rotation: 370 } + } + + transitions: Transition { + RotationAnimation { target: rr; direction: RotationAnimation.Numerical; duration: 1000 } + RotationAnimation { target: rr2; direction: RotationAnimation.Clockwise; duration: 1000 } + RotationAnimation { target: rr3; direction: RotationAnimation.Counterclockwise; duration: 1000 } + RotationAnimation { target: rr4; direction: RotationAnimation.Shortest; duration: 1000 } + } +} diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index f5e15fb..076afea 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -59,6 +59,7 @@ private slots: void simpleProperty(); void simpleNumber(); void simpleColor(); + void simpleRotation(); void alwaysRunToEnd(); void complete(); void resume(); @@ -73,6 +74,7 @@ private slots: void propertyValueSourceDefaultStart(); void dontStart(); void easingProperties(); + void rotation(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -168,6 +170,32 @@ void tst_qdeclarativeanimations::simpleColor() QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1)); } +void tst_qdeclarativeanimations::simpleRotation() +{ + QDeclarativeRectangle rect; + QDeclarativeRotationAnimation animation; + animation.setTarget(&rect); + animation.setProperty("rotation"); + animation.setTo(270); + QVERIFY(animation.target() == &rect); + QVERIFY(animation.property() == "rotation"); + QVERIFY(animation.to() == 270); + QVERIFY(animation.direction() == QDeclarativeRotationAnimation::Shortest); + animation.start(); + QVERIFY(animation.isRunning()); + QTest::qWait(animation.duration()); + QTIMED_COMPARE(rect.rotation(), qreal(270)); + + rect.setRotation(0); + animation.start(); + animation.pause(); + QVERIFY(animation.isRunning()); + QVERIFY(animation.isPaused()); + animation.setCurrentTime(125); + QVERIFY(animation.currentTime() == 125); + QCOMPARE(rect.rotation(), qreal(-45)); +} + void tst_qdeclarativeanimations::alwaysRunToEnd() { QDeclarativeRectangle rect; @@ -667,6 +695,36 @@ void tst_qdeclarativeanimations::easingProperties() } } +void tst_qdeclarativeanimations::rotation() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/rotation.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *rr = rect->findChild<QDeclarativeRectangle*>("rr"); + QDeclarativeRectangle *rr2 = rect->findChild<QDeclarativeRectangle*>("rr2"); + QDeclarativeRectangle *rr3 = rect->findChild<QDeclarativeRectangle*>("rr3"); + QDeclarativeRectangle *rr4 = rect->findChild<QDeclarativeRectangle*>("rr4"); + + rect->setState("state1"); + QTest::qWait(800); + qreal r1 = rr->rotation(); + qreal r2 = rr2->rotation(); + qreal r3 = rr3->rotation(); + qreal r4 = rr4->rotation(); + + QVERIFY(r1 > qreal(0) && r1 < qreal(370)); + QVERIFY(r2 > qreal(0) && r2 < qreal(370)); + QVERIFY(r3 < qreal(0) && r3 > qreal(-350)); + QVERIFY(r4 > qreal(0) && r4 < qreal(10)); + QCOMPARE(r1,r2); + QVERIFY(r4 < r2); + + QTest::qWait(800); + QTIMED_COMPARE(rr->rotation() + rr2->rotation() + rr3->rotation() + rr4->rotation(), qreal(370*4)); +} + QTEST_MAIN(tst_qdeclarativeanimations) #include "tst_qdeclarativeanimations.moc" diff --git a/tests/auto/declarative/qdeclarativedatetimeformatter/qdeclarativedatetimeformatter.pro b/tests/auto/declarative/qdeclarativedatetimeformatter/qdeclarativedatetimeformatter.pro deleted file mode 100644 index 22f53e6..0000000 --- a/tests/auto/declarative/qdeclarativedatetimeformatter/qdeclarativedatetimeformatter.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qdeclarativedatetimeformatter.cpp diff --git a/tests/auto/declarative/qdeclarativedatetimeformatter/tst_qdeclarativedatetimeformatter.cpp b/tests/auto/declarative/qdeclarativedatetimeformatter/tst_qdeclarativedatetimeformatter.cpp deleted file mode 100644 index 69d7900..0000000 --- a/tests/auto/declarative/qdeclarativedatetimeformatter/tst_qdeclarativedatetimeformatter.cpp +++ /dev/null @@ -1,150 +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 <qtest.h> -#include <QtDeclarative/qdeclarativeengine.h> -#include <QtDeclarative/qdeclarativecomponent.h> -#include <private/qdeclarativedatetimeformatter_p.h> -#include <QDebug> - -class tst_qdeclarativedatetimeformatter : public QObject -{ - Q_OBJECT -public: - tst_qdeclarativedatetimeformatter() {} - -private slots: - void date(); - void time(); - void dateTime(); -}; - -void tst_qdeclarativedatetimeformatter::date() -{ - QDeclarativeEngine engine; - QDeclarativeComponent formatterComponent(&engine); - formatterComponent.setData(QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"), - QUrl::fromLocalFile("")); - QDeclarativeDateTimeFormatter *formatter = qobject_cast<QDeclarativeDateTimeFormatter*>(formatterComponent.create()); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatter != 0); - - QDate date(2008,12,24); - QCOMPARE(formatter->date(), date); - QCOMPARE(formatter->dateTime().date(), date); - QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleShortDate)); - - formatter->setLongStyle(true); - QVERIFY(formatter->longStyle()); - QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleLongDate)); - - formatter->setDateFormat("ddd MMMM d yy"); - QCOMPARE(formatter->dateFormat(), QLatin1String("ddd MMMM d yy")); - QCOMPARE(formatter->dateText(),date.toString("ddd MMMM d yy")); - - QVERIFY(formatter->timeText().isEmpty()); - QVERIFY(formatter->dateTimeText().isEmpty()); - - delete formatter; -} - -void tst_qdeclarativedatetimeformatter::time() -{ - QDeclarativeEngine engine; - QDeclarativeComponent formatterComponent(&engine); - formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl::fromLocalFile("")); - QDeclarativeDateTimeFormatter *formatter = qobject_cast<QDeclarativeDateTimeFormatter*>(formatterComponent.create()); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatter != 0); - - QTime time(14,15,38,200); - - QCOMPARE(formatter->time(),time); - QCOMPARE(formatter->dateTime().time(),time); - - QCOMPARE(formatter->timeText(),time.toString(Qt::SystemLocaleShortDate)); - - formatter->setLongStyle(true); - QCOMPARE(formatter->timeText(),time.toString(Qt::SystemLocaleLongDate)); - - formatter->setTimeFormat("H:m:s a"); - QCOMPARE(formatter->timeFormat(), QLatin1String("H:m:s a")); - QCOMPARE(formatter->timeText(),time.toString("H:m:s a")); - - formatter->setTimeFormat("hh:mm:ss.zzz"); - QCOMPARE(formatter->timeText(),time.toString("hh:mm:ss.zzz")); - - QVERIFY(formatter->dateText().isEmpty()); - QVERIFY(formatter->dateTimeText().isEmpty()); - - delete formatter; -} - -void tst_qdeclarativedatetimeformatter::dateTime() -{ - QDeclarativeEngine engine; - QDeclarativeComponent formatterComponent(&engine); - formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl::fromLocalFile("")); - QDeclarativeDateTimeFormatter *formatter = qobject_cast<QDeclarativeDateTimeFormatter*>(formatterComponent.create()); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatter != 0); - - QDateTime dateTime(QDate(1978,03,04),QTime(9,13,54)); - QCOMPARE(formatter->dateTime(),dateTime); - QCOMPARE(formatter->date(),dateTime.date()); - QCOMPARE(formatter->time(),dateTime.time()); - QCOMPARE(formatter->dateTimeText(),dateTime.toString(Qt::SystemLocaleShortDate)); - - formatter->setLongStyle(true); - QCOMPARE(formatter->dateTimeText(),dateTime.toString(Qt::SystemLocaleLongDate)); - - formatter->setDateTimeFormat("M/d/yy H:m:s a"); - QCOMPARE(formatter->dateTimeFormat(), QLatin1String("M/d/yy H:m:s a")); - QCOMPARE(formatter->dateTimeText(),dateTime.toString("M/d/yy H:m:s a")); - - delete formatter; -} - -QTEST_MAIN(tst_qdeclarativedatetimeformatter) - -#include "tst_qdeclarativedatetimeformatter.moc" diff --git a/tests/auto/declarative/qdeclarativenumberformatter/qdeclarativenumberformatter.pro b/tests/auto/declarative/qdeclarativenumberformatter/qdeclarativenumberformatter.pro deleted file mode 100644 index 672e95c..0000000 --- a/tests/auto/declarative/qdeclarativenumberformatter/qdeclarativenumberformatter.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qdeclarativenumberformatter.cpp diff --git a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp deleted file mode 100644 index a9a0077..0000000 --- a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp +++ /dev/null @@ -1,224 +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 <qtest.h> -#include <QDebug> -#include <QtDeclarative/qdeclarativeengine.h> -#include <QtDeclarative/qdeclarativecomponent.h> -#include <private/qnumberformat_p.h> -#include <private/qdeclarativenumberformatter_p.h> - -class tst_qdeclarativenumberformatter : public QObject -{ - Q_OBJECT -public: - tst_qdeclarativenumberformatter(); - - void init() {} - void initTestCase() {} - - void cleanup() {} - void cleanupTestCase() {} - -private slots: - void text_data(); - void text(); - -private: - QStringList strings; - QStringList formats; - QStringList texts; -}; - -tst_qdeclarativenumberformatter::tst_qdeclarativenumberformatter() -{ - strings << "100.0" - << "12345" - << "1234567" - << "0.123" - << "0.9999" - << "0.989" - << "1" - << "1.0" - << "1.01"; - - formats << "" - << "0000" - << "0000.00" - << "##" - << "##.##" - << "#0.00#" - << "##,##0.##" - << "(000) 000 - 000" - << "00000,000.0000"; - - //US locale only. - texts << "100.000000" - << "12345.000000" - << "1234567.000000" - << "0.123000" - << "0.999900" - << "0.989000" - << "1.000000" - << "1.000000" - << "1.010000" //end "" - << "0100" - << "12345" - << "1234567" - << "0000" - << "0001" - << "0001" - << "0001" - << "0001" - << "0001" // end "0000" - << "0100.00" - << "12345.00" - << "1234567.00" - << "0000.12" - << "0001.00" - << "0000.99" - << "0001.00" - << "0001.00" - << "0001.01" // end "0000.00" - << "100" - << "12345" - << "1234567" - << "0" - << "1" - << "1" - << "1" - << "1" - << "1" // end "##" - << "100"//start "##.##" - << "12345" - << "1234567" - << "0.12" - << "1" - << "0.99" - << "1" - << "1" - << "1.01" // end "##.##" -- ### EXPECT FAIL ### QNumberFormat::formatDecimal() bug - << "100.00" //start "#0.00#" - << "12345.00" - << "1234567.00" - << "0.123" - << "1.00" - << "0.989" - << "1.00" - << "1.00" - << "1.01" //end "#0.00#" - << "100" //start "##,##0.##" - << "12,345" - << "1,234,567" - << "0.12" - << "1" - << "0.99" - << "1" - << "1" - << "1.01" //end "##,##0.##" -- ### EXPECT FAIL ### QNumberFormat::formatDecimal() bug - << "(000) 000 - 100" //start "(000) 000 - 000" - << "(000) 012 - 345" - << "(001) 234 - 567" - << "(000) 000 - 000" - << "(000) 000 - 001" - << "(000) 000 - 001" - << "(000) 000 - 001" - << "(000) 000 - 001" - << "(000) 000 - 001" // end "(000) 000 - 000" - << "00,000,100.0000" // start "00000,000.0000" - << "00,012,345.0000" - << "01,234,567.0000" - << "00,000,000.1230" - << "00,000,000.9999" - << "00,000,000.9890" - << "00,000,001.0000" - << "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() -{ - QTest::addColumn<QString>("string"); - QTest::addColumn<QString>("format"); - QTest::addColumn<QString>("text"); - - for (int j=0; j < formats.size(); j++) - { - for (int i=0; i < strings.size(); i++) - { - QTest::newRow(QString("%1, %2").arg(strings.at(i)).arg(formats.at(j)).toAscii()) - << strings.at(i) << formats.at(j) << texts.at(j*formats.size()+i); - } - } - -} - -void tst_qdeclarativenumberformatter::text() -{ - QFETCH(QString, string); - QFETCH(QString, format); - QFETCH(QString, text); - - QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: ") + string + QString("; format: \"") + format + QString("\" }"); - - QDeclarativeEngine engine; - QDeclarativeComponent formatterComponent(&engine); - formatterComponent.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatterComponent.isReady()); - QDeclarativeNumberFormatter *formatter = qobject_cast<QDeclarativeNumberFormatter*>(formatterComponent.create()); - QVERIFY(formatter != 0); - - QCOMPARE(formatter->format(), format); - QCOMPARE(formatter->text(), text); - - delete formatter; -} - -QTEST_MAIN(tst_qdeclarativenumberformatter) - -#include "tst_qdeclarativenumberformatter.moc" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 6199234..0e5e1b0 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -267,6 +267,8 @@ void tst_qdeclarativexmllistmodel::reload() QCOMPARE(spyRemove[0][0].toInt(), 0); QCOMPARE(spyRemove[0][1].toInt(), 9); + + delete model; } void tst_qdeclarativexmllistmodel::useKeys() @@ -285,7 +287,7 @@ void tst_qdeclarativexmllistmodel::useKeys() QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); - + model->setXml(oldXml); QTRY_COMPARE(model->count(), oldCount); @@ -320,6 +322,8 @@ void tst_qdeclarativexmllistmodel::useKeys() QCOMPARE(spyRemove[i][0].toInt(), removeRanges[i].first); QCOMPARE(spyRemove[i][1].toInt(), removeRanges[i].second); } + + delete model; } void tst_qdeclarativexmllistmodel::useKeys_data() @@ -451,18 +455,16 @@ void tst_qdeclarativexmllistmodel::noKeysValueChanges() model->setXml(xml); // wait for the new xml data to be set, and verify no signals were emitted - for (int i=0; i<50; i++) { - QTest::qWait(100); - if (model->data(0, model->roles()[2]).toString() != QLatin1String("AussieRules")) - break; - } + QTRY_VERIFY(model->data(0, model->roles()[2]).toString() != QLatin1String("Football")); QCOMPARE(model->data(0, model->roles()[2]).toString(), QLatin1String("AussieRules")); QVERIFY(spyInsert.count() == 0); QVERIFY(spyRemove.count() == 0); QVERIFY(spyCount.count() == 0); - + QCOMPARE(model->count(), 2); + + delete model; } void tst_qdeclarativexmllistmodel::keysChanged() @@ -499,6 +501,8 @@ void tst_qdeclarativexmllistmodel::keysChanged() QCOMPARE(spyRemove[0][1].toInt(), 2); QCOMPARE(spyCount.count(), 0); + + delete model; } void tst_qdeclarativexmllistmodel::propertyChanges() diff --git a/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.0.png b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.0.png Binary files differnew file mode 100644 index 0000000..7d41abc --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.0.png diff --git a/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.1.png b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.1.png Binary files differnew file mode 100644 index 0000000..16b95ab --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.1.png diff --git a/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.2.png b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.2.png Binary files differnew file mode 100644 index 0000000..7d41abc --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.2.png diff --git a/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.3.png b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.3.png Binary files differnew file mode 100644 index 0000000..800bf12 --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.3.png diff --git a/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.4.png b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.4.png Binary files differnew file mode 100644 index 0000000..d0155bb --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.4.png diff --git a/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.5.png b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.5.png Binary files differnew file mode 100644 index 0000000..7d41abc --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.5.png diff --git a/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.qml b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.qml new file mode 100644 index 0000000..5718560 --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/data/parentAnimation.qml @@ -0,0 +1,1663 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 32 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 48 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 64 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 80 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 96 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 112 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 128 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 144 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 160 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 176 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 192 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 208 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 224 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 240 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 256 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 272 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 288 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 304 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 320 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 336 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 352 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 368 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 384 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 400 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 416 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 432 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 448 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 464 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 480 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 496 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 512 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 528 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 544 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 560 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 576 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 592 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 608 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 624 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 640 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 656 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 672 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 688 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 704 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 720 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 736 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 752 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 768 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 784 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 800 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 816 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 832 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 848 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 864 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 880 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 896 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 912 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 928 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 944 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 960 + image: "parentAnimation.0.png" + } + Frame { + msec: 976 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 992 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1008 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1024 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1040 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1056 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1072 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1088 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1104 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1120 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1136 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1152 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1168 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1184 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1200 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1216 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1232 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1248 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1264 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1280 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1296 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1312 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1328 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1344 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1360 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1376 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1392 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1408 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1424 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1440 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1456 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1472 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1488 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1504 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1520 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1536 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1552 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 1568 + hash: "633b5668278295faa57d0cfffe8a29cb" + } + Frame { + msec: 1584 + hash: "ccbf4505e0f05547d2f7ce874ab941c0" + } + Frame { + msec: 1600 + hash: "be904489959fa365badb642fa9e85922" + } + Frame { + msec: 1616 + hash: "de6a97ac6e2677feb223336199cbffe1" + } + Frame { + msec: 1632 + hash: "997b0a547336a9bb6a67cd9beffe1831" + } + Frame { + msec: 1648 + hash: "ac9a6e111050b8a7c4492f06c33d3969" + } + Frame { + msec: 1664 + hash: "7313c0d2ee06e393f486670222c29bb4" + } + Frame { + msec: 1680 + hash: "24cea420d03d1fdcddb1b9cf5112cbee" + } + Frame { + msec: 1696 + hash: "764688785eeaa01e9c84821476911edb" + } + Frame { + msec: 1712 + hash: "b24ae0cb512abfd2606ff9c20a6751bf" + } + Frame { + msec: 1728 + hash: "f1daed3391f10e27435a54222df8d0ab" + } + Frame { + msec: 1744 + hash: "99704e182267f2c12d0215b9c03f4d68" + } + Frame { + msec: 1760 + hash: "143cd9259a41b8af5d41a5b2aaf8de64" + } + Frame { + msec: 1776 + hash: "b5f0a0f838b5870c162a24cd767f068b" + } + Frame { + msec: 1792 + hash: "c5c8cdcbfab7466e447eaff582bf7312" + } + Frame { + msec: 1808 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1824 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1840 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1856 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1872 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1888 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1904 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1920 + image: "parentAnimation.1.png" + } + Frame { + msec: 1936 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1952 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1968 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 1984 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2000 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2016 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2032 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2048 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2064 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2080 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2096 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2112 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2128 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2144 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2160 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2176 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2192 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2208 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2224 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2240 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2256 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2272 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2288 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2304 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2320 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2336 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2352 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2368 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2384 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2400 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2416 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2432 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2448 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2464 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2480 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2496 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 2512 + hash: "eaeeb8c51d43e3c38ff7dde632d1f9c8" + } + Frame { + msec: 2528 + hash: "ec0e68c2e7a75fedd1091ce633dadd4f" + } + Frame { + msec: 2544 + hash: "a5d60efc176dee9083a2d746e7ad8315" + } + Frame { + msec: 2560 + hash: "48bcbbacf413080247f818e35e496e04" + } + Frame { + msec: 2576 + hash: "c521af8efa19fbac39119ad75cd469f5" + } + Frame { + msec: 2592 + hash: "0e74613c67fc9d9acb21a3d382c5efcd" + } + Frame { + msec: 2608 + hash: "eeb3f4467ebd7ee678c3b7371db28519" + } + Frame { + msec: 2624 + hash: "9c5b9009a35b74d0ddec8fec85f204bf" + } + Frame { + msec: 2640 + hash: "aefc70824e23428aebf0a40830a57469" + } + Frame { + msec: 2656 + hash: "1fa9c23760193b74b0063b4e4c434070" + } + Frame { + msec: 2672 + hash: "8091700d4729163bd87521385853e608" + } + Frame { + msec: 2688 + hash: "a13558e609570f9390f20a85d244fa22" + } + Frame { + msec: 2704 + hash: "7be5e3609bbeb9a2c1df7d52f3953d4d" + } + Frame { + msec: 2720 + hash: "51c8ae31f858121d86ef09cc9a5c5ef3" + } + Frame { + msec: 2736 + hash: "84ce8f39207f4b07c2c3323425a8c238" + } + Frame { + msec: 2752 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2768 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2784 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2800 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2816 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2832 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2848 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2864 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2880 + image: "parentAnimation.2.png" + } + Frame { + msec: 2896 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2912 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2928 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2944 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2960 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2976 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 2992 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3008 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3024 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3040 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3056 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3072 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3088 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3104 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3120 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3136 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3152 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3168 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3184 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3200 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3216 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3232 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3248 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3264 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3280 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3296 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3312 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3328 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3344 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3360 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3376 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3392 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 3408 + hash: "633b5668278295faa57d0cfffe8a29cb" + } + Frame { + msec: 3424 + hash: "ccbf4505e0f05547d2f7ce874ab941c0" + } + Frame { + msec: 3440 + hash: "be904489959fa365badb642fa9e85922" + } + Frame { + msec: 3456 + hash: "de6a97ac6e2677feb223336199cbffe1" + } + Frame { + msec: 3472 + hash: "997b0a547336a9bb6a67cd9beffe1831" + } + Frame { + msec: 3488 + hash: "ac9a6e111050b8a7c4492f06c33d3969" + } + Frame { + msec: 3504 + hash: "7313c0d2ee06e393f486670222c29bb4" + } + Frame { + msec: 3520 + hash: "24cea420d03d1fdcddb1b9cf5112cbee" + } + Frame { + msec: 3536 + hash: "764688785eeaa01e9c84821476911edb" + } + Frame { + msec: 3552 + hash: "b24ae0cb512abfd2606ff9c20a6751bf" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3568 + hash: "b24ae0cb512abfd2606ff9c20a6751bf" + } + Frame { + msec: 3584 + hash: "d7bf1b48f1a03974e7f095468e07f037" + } + Frame { + msec: 3600 + hash: "a59ab4fe1c22d27b5cdde949cf90e6f4" + } + Frame { + msec: 3616 + hash: "7c3082720e65b8a6217bf5a5fe4d48c0" + } + Frame { + msec: 3632 + hash: "350d1ff24fb8fba0ab8a6694d99544b3" + } + Frame { + msec: 3648 + hash: "81d17a62c33d79ed25968ec47771d292" + } + Frame { + msec: 3664 + hash: "43fd3ef88bd7a2e5bf4546f088783077" + } + Frame { + msec: 3680 + hash: "041938ad2e023202db18df28f2329c8f" + } + Frame { + msec: 3696 + hash: "ec8677eae06cbf77a9508953325b179e" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3712 + hash: "ec8677eae06cbf77a9508953325b179e" + } + Frame { + msec: 3728 + hash: "453026339c3901ee286831b4b41088f6" + } + Frame { + msec: 3744 + hash: "d58a7a41ade691cc0acfb0303bfc3b68" + } + Frame { + msec: 3760 + hash: "a200b05ef3d7e39e11513fd2f8ff1497" + } + Frame { + msec: 3776 + hash: "faa1223975acdf2d4b48045d7f2ce445" + } + Frame { + msec: 3792 + hash: "964d9b80d82d0fe3d3fb328a1661a60e" + } + Frame { + msec: 3808 + hash: "705871bc384de93100354acb19b371b0" + } + Frame { + msec: 3824 + hash: "1a4480463adfc5a3d525916b03c2c3ce" + } + Frame { + msec: 3840 + image: "parentAnimation.3.png" + } + Frame { + msec: 3856 + hash: "9a55bdf428f45f02d9c8cf414dcd7754" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3872 + hash: "9a55bdf428f45f02d9c8cf414dcd7754" + } + Frame { + msec: 3888 + hash: "0f6d82d02ce7d79a1bdf6bf81791f321" + } + Frame { + msec: 3904 + hash: "b145b9d299714020686069baec11cb71" + } + Frame { + msec: 3920 + hash: "5dbf5e4151c01f10cf23b07ca1df56ab" + } + Frame { + msec: 3936 + hash: "822d4397ac514673ca1015ad05c9b4ac" + } + Frame { + msec: 3952 + hash: "461d35e865153d22e9a67bb0ffddefb7" + } + Frame { + msec: 3968 + hash: "676fff498e6879144090d5596056c6c8" + } + Frame { + msec: 3984 + hash: "854da7ed627237250e20b263f9eb9d90" + } + Frame { + msec: 4000 + hash: "157ec877797883d329ff329537205d02" + } + Frame { + msec: 4016 + hash: "613669ca60240fcc490d548fe802390d" + } + Frame { + msec: 4032 + hash: "803e84f027c773db96f9530511e5fedb" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4048 + hash: "803e84f027c773db96f9530511e5fedb" + } + Frame { + msec: 4064 + hash: "f47cfd1f1094b782c08490be2f49c6ed" + } + Frame { + msec: 4080 + hash: "db5953f3ee4e2db87e33b85464167f74" + } + Frame { + msec: 4096 + hash: "8313cb750b9abc586a43b9422de08f53" + } + Frame { + msec: 4112 + hash: "deb390ce992fee85c56733168b4bd1ec" + } + Frame { + msec: 4128 + hash: "29a1cda3647c49731e9adcd107a2d13c" + } + Frame { + msec: 4144 + hash: "bfa17a3afa06699107b217df6e4aed43" + } + Frame { + msec: 4160 + hash: "8e639ef01ab6d8876c3f40adc44928c6" + } + Frame { + msec: 4176 + hash: "14038aedf42de0ca62d872d317018ee0" + } + Frame { + msec: 4192 + hash: "c1288465163d44ed40e28f21e0298ea6" + } + Frame { + msec: 4208 + hash: "d6915f22a905737488d27e8138002f31" + } + Frame { + msec: 4224 + hash: "5b1621451a5a3af40302603ec31bb8bb" + } + Frame { + msec: 4240 + hash: "16fd73c0cb615cc717cdc4a6787471c2" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4256 + hash: "16fd73c0cb615cc717cdc4a6787471c2" + } + Frame { + msec: 4272 + hash: "db5caf42e11705ecdb2006e1ed6b0c4f" + } + Frame { + msec: 4288 + hash: "4b7e51e4e9fb1dacb32aac11a4a46ceb" + } + Frame { + msec: 4304 + hash: "63c93cda9892f733809125991af997b6" + } + Frame { + msec: 4320 + hash: "0e74613c67fc9d9acb21a3d382c5efcd" + } + Frame { + msec: 4336 + hash: "58e813a6619828b6c9ec9cf300ff0e2d" + } + Frame { + msec: 4352 + hash: "181a6e334d745381f091bf1b55fc1690" + } + Frame { + msec: 4368 + hash: "f25bbc9ddc8cc72036c49d50b45bece8" + } + Frame { + msec: 4384 + hash: "88e8f0496debfee6bc2426895fe1c3d9" + } + Frame { + msec: 4400 + hash: "db5953f3ee4e2db87e33b85464167f74" + } + Frame { + msec: 4416 + hash: "9818a899adb916b6ba5f7537697ef062" + } + Frame { + msec: 4432 + hash: "3842f40093d70089a4004fb803c05981" + } + Frame { + msec: 4448 + hash: "be904489959fa365badb642fa9e85922" + } + Frame { + msec: 4464 + hash: "cbae27751ff0ebce4fcc164564f4cf1b" + } + Frame { + msec: 4480 + hash: "3a1b468bd3fd747bbe6b069426b170a9" + } + Frame { + msec: 4496 + hash: "57fbcd580eb1607a2a7526a65842dfeb" + } + Frame { + msec: 4512 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4528 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4544 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4560 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4576 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4592 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4608 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4624 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4640 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 4656 + hash: "633b5668278295faa57d0cfffe8a29cb" + } + Frame { + msec: 4672 + hash: "ccbf4505e0f05547d2f7ce874ab941c0" + } + Frame { + msec: 4688 + hash: "be904489959fa365badb642fa9e85922" + } + Frame { + msec: 4704 + hash: "de6a97ac6e2677feb223336199cbffe1" + } + Frame { + msec: 4720 + hash: "997b0a547336a9bb6a67cd9beffe1831" + } + Frame { + msec: 4736 + hash: "ac9a6e111050b8a7c4492f06c33d3969" + } + Frame { + msec: 4752 + hash: "7313c0d2ee06e393f486670222c29bb4" + } + Frame { + msec: 4768 + hash: "24cea420d03d1fdcddb1b9cf5112cbee" + } + Frame { + msec: 4784 + hash: "764688785eeaa01e9c84821476911edb" + } + Frame { + msec: 4800 + image: "parentAnimation.4.png" + } + Frame { + msec: 4816 + hash: "f1daed3391f10e27435a54222df8d0ab" + } + Frame { + msec: 4832 + hash: "99704e182267f2c12d0215b9c03f4d68" + } + Frame { + msec: 4848 + hash: "143cd9259a41b8af5d41a5b2aaf8de64" + } + Frame { + msec: 4864 + hash: "b5f0a0f838b5870c162a24cd767f068b" + } + Frame { + msec: 4880 + hash: "c5c8cdcbfab7466e447eaff582bf7312" + } + Frame { + msec: 4896 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 4912 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 4928 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 4944 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 4960 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 4976 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 4992 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5008 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5024 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5040 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5056 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5072 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5088 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5104 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5120 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5136 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5152 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5168 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5184 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5200 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5216 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5232 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5248 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5264 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5280 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5296 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5312 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5328 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5344 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 237; y: 299 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 5360 + hash: "f1bc451d1f62cfb5dd60a7ea483d3844" + } + Frame { + msec: 5376 + hash: "eaeeb8c51d43e3c38ff7dde632d1f9c8" + } + Frame { + msec: 5392 + hash: "ec0e68c2e7a75fedd1091ce633dadd4f" + } + Frame { + msec: 5408 + hash: "a5d60efc176dee9083a2d746e7ad8315" + } + Frame { + msec: 5424 + hash: "48bcbbacf413080247f818e35e496e04" + } + Frame { + msec: 5440 + hash: "c521af8efa19fbac39119ad75cd469f5" + } + Frame { + msec: 5456 + hash: "0e74613c67fc9d9acb21a3d382c5efcd" + } + Frame { + msec: 5472 + hash: "eeb3f4467ebd7ee678c3b7371db28519" + } + Frame { + msec: 5488 + hash: "9c5b9009a35b74d0ddec8fec85f204bf" + } + Frame { + msec: 5504 + hash: "aefc70824e23428aebf0a40830a57469" + } + Frame { + msec: 5520 + hash: "1fa9c23760193b74b0063b4e4c434070" + } + Frame { + msec: 5536 + hash: "8091700d4729163bd87521385853e608" + } + Frame { + msec: 5552 + hash: "a13558e609570f9390f20a85d244fa22" + } + Frame { + msec: 5568 + hash: "7be5e3609bbeb9a2c1df7d52f3953d4d" + } + Frame { + msec: 5584 + hash: "51c8ae31f858121d86ef09cc9a5c5ef3" + } + Frame { + msec: 5600 + hash: "84ce8f39207f4b07c2c3323425a8c238" + } + Frame { + msec: 5616 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5632 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5648 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5664 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5680 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5696 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5712 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5728 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5744 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5760 + image: "parentAnimation.5.png" + } + Frame { + msec: 5776 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5792 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5808 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5824 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5840 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5856 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5872 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5888 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5904 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5920 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5936 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5952 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5968 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 5984 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6000 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6016 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6032 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6048 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6064 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6080 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6096 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6112 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6128 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6144 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6160 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6176 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6192 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6208 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6224 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6240 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6256 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } + Frame { + msec: 6272 + hash: "4135271d78a5c63c3837a09c86f35ebe" + } +} diff --git a/tests/auto/declarative/visual/animation/parentAnimation/parentAnimation.qml b/tests/auto/declarative/visual/animation/parentAnimation/parentAnimation.qml new file mode 100644 index 0000000..1833cf0 --- /dev/null +++ b/tests/auto/declarative/visual/animation/parentAnimation/parentAnimation.qml @@ -0,0 +1,58 @@ +import Qt 4.6 +Rectangle { + width: 800; + height: 480; + color: "black"; + + Rectangle { + id: gr + color: "green" + width: 100; height: 100 + } + + MouseRegion { + id: mouser + anchors.fill: parent + } + + Rectangle { + id: np + x: 300 + width: 300; height: 300 + color: "yellow" + clip: true + Rectangle { + color: "red" + x: 100; y: 100; height: 100; width: 100 + } + + } + + Rectangle { + id: vp + x: 200; y: 200 + width: 100; height: 100 + color: "blue" + rotation: 45 + scale: 2 + } + + states: State { + name: "state1" + when: mouser.pressed + ParentChange { + target: gr + parent: np + x: 100; y: 100; width: 200; + } + } + + transitions: Transition { + reversible: true + to: "state1" + ParentAnimation { + target: gr; via: vp; + NumberAnimation { properties: "x,y,rotation,scale,width" } + } + } +} |