diff options
22 files changed, 399 insertions, 290 deletions
diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index e686d02..76a5813 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -2,6 +2,7 @@ import Qt 4.6 Flickable { property alias title: webView.title + property alias icon: webView.icon property alias progress: webView.progress property alias url: webView.url property alias back: webView.back diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml index e8c9208..94c94f2 100644 --- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml +++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml @@ -13,31 +13,40 @@ Image { ? -webView.contentX+webView.contentWidth-webView.width : 0 y: webView.contentY < 0 ? -webView.contentY : progressOff* (webView.contentY>height?-height:-webView.contentY) - Text { - id: headerText + Row { + id: headerTitle - text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...' - elide: Text.ElideRight + anchors.top: header.top + anchors.topMargin: 4 + anchors.horizontalCenter: parent.horizontalCenter + spacing: 6 - color: "white" - styleColor: "black" - style: Text.Raised + Image { + id: headerIcon + pixmap: webView.icon + } - font.family: "Helvetica" - font.pointSize: 10 - font.bold: true + Text { + id: headerText - anchors.left: header.left - anchors.right: header.right - anchors.leftMargin: 4 - anchors.rightMargin: 4 - anchors.top: header.top - anchors.topMargin: 4 - horizontalAlignment: Text.AlignHCenter + text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...' + elide: Text.ElideRight + //width: parent.width - headerIcon.width-4 + + color: "white" + styleColor: "black" + style: Text.Raised + + font.family: "Helvetica" + font.pointSize: 10 + font.bold: true + + horizontalAlignment: Text.AlignHCenter + } } Item { width: parent.width - anchors.top: headerText.bottom + anchors.top: headerTitle.bottom anchors.topMargin: 2 anchors.bottom: parent.bottom diff --git a/doc/src/files-and-resources/datastreamformat.qdoc b/doc/src/files-and-resources/datastreamformat.qdoc index 1c2d887..bab2c2c 100644 --- a/doc/src/files-and-resources/datastreamformat.qdoc +++ b/doc/src/files-and-resources/datastreamformat.qdoc @@ -47,7 +47,7 @@ The \l QDataStream allows you to serialize some of the Qt data types. The table below lists the data types that QDataStream can serialize and how they are represented. The format described below is - \l{QDataStream::setVersion()}{version 8}. + \l{QDataStream::setVersion()}{version 12}. It is always best to cast integers to a Qt integer type, such as qint16 or quint32, when reading and writing. This ensures that @@ -57,9 +57,9 @@ \table \row \o bool - \o \list - \o boolean - \endlist + \o \list + \o boolean + \endlist \row \o qint8 \o \list \o signed byte @@ -145,6 +145,17 @@ \o Time (QTime) \o 0 for Qt::LocalTime, 1 for Qt::UTC (quint8) \endlist + \row \o QEasingCurve + \o \list + \o type (quint8) + \o func (quint64) + \o hasConfig (bool) + \o If hasConfig is true then these fields follow: + \o list + \o period (double) + \o amplitude (double) + \o overshoot (double) + \endlist \row \o QFont \o \list \o The family (QString) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 64b4dca..d4b2c27 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -860,7 +860,7 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item) QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) { - stream << easing.d_ptr->type; + stream << quint8(easing.d_ptr->type); stream << quint64(quintptr(easing.d_ptr->func)); bool hasConfig = easing.d_ptr->config; @@ -886,7 +886,7 @@ QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) { QEasingCurve::Type type; - int int_type; + quint8 int_type; stream >> int_type; type = static_cast<QEasingCurve::Type>(int_type); easing.setType(type); diff --git a/src/declarative/graphicsitems/qdeclarativewebview.cpp b/src/declarative/graphicsitems/qdeclarativewebview.cpp index 61b5b56..a2b16ba 100644 --- a/src/declarative/graphicsitems/qdeclarativewebview.cpp +++ b/src/declarative/graphicsitems/qdeclarativewebview.cpp @@ -177,6 +177,8 @@ void QDeclarativeWebView::init() { Q_D(QDeclarativeWebView); + QWebSettings::enablePersistentStorage(); + setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, false); @@ -955,6 +957,7 @@ void QDeclarativeWebView::setPage(QWebPage *page) connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index cecca65..88ca5cd 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -130,7 +130,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) if (data->property.propertyType() == qMetaTypeId<QDeclarativeBinding *>()) { - int idx = data->property.coreIndex(); + int idx = data->property.index(); Q_ASSERT(idx != -1); @@ -223,7 +223,7 @@ void QDeclarativeBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteF int QDeclarativeBinding::propertyIndex() { Q_D(QDeclarativeBinding); - return d->bindingData()->property.coreIndex(); + return d->bindingData()->property.index(); } bool QDeclarativeBinding::enabled() const diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index fbea6ac..9ed760e 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -115,7 +115,6 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj) } /*! - \internal Creates a QDeclarativeProperty for the default property of \a obj. If there is no default property, an invalid QDeclarativeProperty will be created. */ @@ -124,6 +123,20 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeContext *ct { d->q = this; d->context = ctxt; + d->engine = ctxt?ctxt->engine():0; + d->initDefault(obj); +} + +/*! + Creates a QDeclarativeProperty for the default property of \a obj. If there is no + default property, an invalid QDeclarativeProperty will be created. + */ +QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeEngine *engine) +: d(new QDeclarativePropertyPrivate) +{ + d->q = this; + d->context = 0; + d->engine = engine; d->initDefault(obj); } @@ -137,10 +150,8 @@ void QDeclarativePropertyPrivate::initDefault(QObject *obj) QMetaProperty p = QDeclarativeMetaType::defaultProperty(obj); core.load(p); - if (core.isValid()) { - isDefaultProperty = true; + if (core.isValid()) object = obj; - } } /*! @@ -155,7 +166,6 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name) } /*! - \internal Creates a QDeclarativeProperty for the property \a name of \a obj. */ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeContext *ctxt) @@ -163,8 +173,22 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QD { d->q = this; d->context = ctxt; + d->engine = ctxt?ctxt->engine():0; + d->initProperty(obj, name); + if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; } +} + +/*! + Creates a QDeclarativeProperty for the property \a name of \a obj. + */ +QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeEngine *engine) +: d(new QDeclarativePropertyPrivate) +{ + d->q = this; + d->context = 0; + d->engine = engine; d->initProperty(obj, name); - if (!isValid()) { d->object = 0; d->context = 0; } + if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; } } Q_GLOBAL_STATIC(QDeclarativeValueTypeFactory, qmlValueTypes); @@ -173,7 +197,6 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name { if (!obj) return; - QDeclarativeEngine *engine = context?context->engine():0; QDeclarativeTypeNameCache *typeNameCache = context?QDeclarativeContextPrivate::get(context)->imports:0; QStringList path = name.split(QLatin1Char('.')); @@ -267,7 +290,7 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name // Property QDeclarativePropertyCache::Data local; QDeclarativePropertyCache::Data *property = - QDeclarativePropertyCache::property(context?context->engine():0, currentObject, terminal, local); + QDeclarativePropertyCache::property(engine, currentObject, terminal, local); if (property && !(property->flags & QDeclarativePropertyCache::Data::IsFunction)) { object = currentObject; core = *property; @@ -302,7 +325,6 @@ QDeclarativeProperty::QDeclarativeProperty(const QDeclarativeProperty &other) \value Invalid The property is invalid. \value Property The property is a regular Qt property. \value SignalProperty The property is a signal property. - \value Default The property is the default property. */ /*! @@ -413,7 +435,7 @@ QDeclarativeProperty::Type QDeclarativeProperty::type() const if (d->core.flags & QDeclarativePropertyCache::Data::IsFunction) return SignalProperty; else if (d->core.isValid()) - return (Type)(Property | ((d->isDefaultProperty)?Default:0)); + return Property; else return Invalid; } @@ -427,11 +449,11 @@ bool QDeclarativeProperty::isProperty() const } /*! - Returns true if this QDeclarativeProperty represents a default property. + Returns true if this QDeclarativeProperty represents a QML signal property. */ -bool QDeclarativeProperty::isDefault() const +bool QDeclarativeProperty::isSignalProperty() const { - return type() & Default; + return type() & SignalProperty; } /*! @@ -448,9 +470,9 @@ QObject *QDeclarativeProperty::object() const QDeclarativeProperty &QDeclarativeProperty::operator=(const QDeclarativeProperty &other) { d->context = other.d->context; + d->engine = other.d->engine; d->object = other.d->object; - d->isDefaultProperty = other.d->isDefaultProperty; d->isNameCached = other.d->isNameCached; d->core = other.d->core; d->nameCache = other.d->nameCache; @@ -521,7 +543,7 @@ QString QDeclarativeProperty::name() const } else if (d->isValueType()) { QString rv = d->core.name(d->object) + QLatin1Char('.'); - QDeclarativeEnginePrivate *ep = d->context?QDeclarativeEnginePrivate::get(d->context->engine()):0; + QDeclarativeEnginePrivate *ep = d->engine?QDeclarativeEnginePrivate::get(d->engine):0; QDeclarativeValueType *valueType = 0; if (ep) valueType = ep->valueTypes[d->core.propType]; else valueType = QDeclarativeValueTypeFactory::valueType(d->core.propType); @@ -669,7 +691,7 @@ QDeclarativePropertyPrivate::signalExpression(const QDeclarativeProperty &that) QObject *child = children.at(ii); QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child); - if (signal && signal->index() == that.coreIndex()) + if (signal && signal->index() == that.index()) return signal->expression(); } @@ -698,7 +720,7 @@ QDeclarativePropertyPrivate::setSignalExpression(const QDeclarativeProperty &tha QObject *child = children.at(ii); QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child); - if (signal && signal->index() == that.coreIndex()) + if (signal && signal->index() == that.index()) return signal->setExpression(expr); } @@ -730,6 +752,24 @@ QVariant QDeclarativeProperty::read() const return QVariant(); } +QVariant QDeclarativeProperty::read(QObject *object, const QString &name) +{ + QDeclarativeProperty p(object, name); + return p.read(); +} + +QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDeclarativeContext *ctxt) +{ + QDeclarativeProperty p(object, name, ctxt); + return p.read(); +} + +QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDeclarativeEngine *engine) +{ + QDeclarativeProperty p(object, name, engine); + return p.read(); +} + QVariant QDeclarativePropertyPrivate::readValueProperty() { if(isValueType()) { @@ -753,7 +793,7 @@ QVariant QDeclarativePropertyPrivate::readValueProperty() QDeclarativeListProperty<QObject> prop; void *args[] = { &prop, 0 }; QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args); - return QVariant::fromValue(QDeclarativeListReferencePrivate::init(prop, core.propType, context?context->engine():0)); + return QVariant::fromValue(QDeclarativeListReferencePrivate::init(prop, core.propType, engine)); } else { @@ -952,13 +992,13 @@ bool QDeclarativePropertyPrivate::write(QObject *object, const QDeclarativePrope for (int ii = 0; ii < list.count(); ++ii) { QObject *o = list.at(ii); - if (!canConvert(o->metaObject(), listType)) + if (o && !canConvert(o->metaObject(), listType)) o = 0; prop.append(&prop, (void *)o); } } else { QObject *o = enginePriv?enginePriv->toQObject(value):QDeclarativeMetaType::toQObject(value); - if (!canConvert(o->metaObject(), listType)) + if (o && !canConvert(o->metaObject(), listType)) o = 0; prop.append(&prop, (void *)o); } @@ -1014,6 +1054,26 @@ bool QDeclarativeProperty::write(const QVariant &value) const return QDeclarativePropertyPrivate::write(*this, value, 0); } +bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value) +{ + QDeclarativeProperty p(object, name); + return p.write(value); +} + +bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value, + QDeclarativeContext *ctxt) +{ + QDeclarativeProperty p(object, name, ctxt); + return p.write(value); +} + +bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value, + QDeclarativeEngine *engine) +{ + QDeclarativeProperty p(object, name, engine); + return p.write(value); +} + /*! Resets the property value. */ @@ -1041,7 +1101,7 @@ bool QDeclarativePropertyPrivate::write(const QDeclarativeProperty &that, /*! Returns true if the property has a change notifier signal, otherwise false. */ -bool QDeclarativeProperty::hasChangedNotifier() const +bool QDeclarativeProperty::hasNotifySignal() const { if (type() & Property && d->object) { return d->object->metaObject()->property(d->core.coreIndex).hasNotifySignal(); @@ -1056,7 +1116,7 @@ bool QDeclarativeProperty::hasChangedNotifier() const Some properties, such as attached properties or those whose value never changes, do not require a change notifier. */ -bool QDeclarativeProperty::needsChangedNotifier() const +bool QDeclarativeProperty::needsNotifySignal() const { return type() & Property && !property().isConstant(); } @@ -1069,7 +1129,7 @@ bool QDeclarativeProperty::needsChangedNotifier() const change notifier signal, or if the \a dest object does not have the specified \a method. */ -bool QDeclarativeProperty::connectNotifier(QObject *dest, int method) const +bool QDeclarativeProperty::connectNotifySignal(QObject *dest, int method) const { if (!(type() & Property) || !d->object) return false; @@ -1090,7 +1150,7 @@ bool QDeclarativeProperty::connectNotifier(QObject *dest, int method) const change notifier signal, or if the \a dest object does not have the specified \a slot. */ -bool QDeclarativeProperty::connectNotifier(QObject *dest, const char *slot) const +bool QDeclarativeProperty::connectNotifySignal(QObject *dest, const char *slot) const { if (!(type() & Property) || !d->object) return false; @@ -1107,7 +1167,7 @@ bool QDeclarativeProperty::connectNotifier(QObject *dest, const char *slot) cons /*! Return the Qt metaobject index of the property. */ -int QDeclarativeProperty::coreIndex() const +int QDeclarativeProperty::index() const { return d->core.coreIndex; } @@ -1164,6 +1224,7 @@ QDeclarativePropertyPrivate::restore(const QByteArray &data, QObject *object, QD prop.d->object = object; prop.d->context = ctxt; + prop.d->engine = ctxt?ctxt->engine():0; const SerializedData *sd = (const SerializedData *)data.constData(); if (sd->isValueType) { diff --git a/src/declarative/qml/qdeclarativeproperty.h b/src/declarative/qml/qdeclarativeproperty.h index 3504a15..73bccf3 100644 --- a/src/declarative/qml/qdeclarativeproperty.h +++ b/src/declarative/qml/qdeclarativeproperty.h @@ -51,11 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QObject; -class QDeclarativeAbstractBinding; -class QDeclarativeExpression; -class QStringList; class QVariant; -struct QMetaObject; class QDeclarativeContext; class QDeclarativeEngine; @@ -70,10 +66,10 @@ public: Normal }; - enum Type { Invalid = 0x00, - Property = 0x01, - SignalProperty = 0x02, - Default = 0x08 + enum Type { + Invalid, + Property, + SignalProperty }; QDeclarativeProperty(); @@ -81,45 +77,55 @@ public: QDeclarativeProperty(QObject *); QDeclarativeProperty(QObject *, QDeclarativeContext *); + QDeclarativeProperty(QObject *, QDeclarativeEngine *); QDeclarativeProperty(QObject *, const QString &); QDeclarativeProperty(QObject *, const QString &, QDeclarativeContext *); + QDeclarativeProperty(QObject *, const QString &, QDeclarativeEngine *); QDeclarativeProperty(const QDeclarativeProperty &); QDeclarativeProperty &operator=(const QDeclarativeProperty &); + bool operator==(const QDeclarativeProperty &) const; + + Type type() const; + bool isValid() const; + bool isProperty() const; + bool isSignalProperty() const; + + int propertyType() const; + PropertyTypeCategory propertyTypeCategory() const; + const char *propertyTypeName() const; + QString name() const; QVariant read() const; + static QVariant read(QObject *, const QString &); + static QVariant read(QObject *, const QString &, QDeclarativeContext *); + static QVariant read(QObject *, const QString &, QDeclarativeEngine *); + bool write(const QVariant &) const; + static bool write(QObject *, const QString &, const QVariant &); + static bool write(QObject *, const QString &, const QVariant &, QDeclarativeContext *); + static bool write(QObject *, const QString &, const QVariant &, QDeclarativeEngine *); + bool reset() const; - bool hasChangedNotifier() const; - bool needsChangedNotifier() const; - bool connectNotifier(QObject *dest, const char *slot) const; - bool connectNotifier(QObject *dest, int method) const; + bool hasNotifySignal() const; + bool needsNotifySignal() const; + bool connectNotifySignal(QObject *dest, const char *slot) const; + bool connectNotifySignal(QObject *dest, int method) const; - Type type() const; - bool isProperty() const; - bool isDefault() const; bool isWritable() const; bool isDesignable() const; bool isResettable() const; - bool isValid() const; QObject *object() const; - int propertyType() const; - PropertyTypeCategory propertyTypeCategory() const; - const char *propertyTypeName() const; - - bool operator==(const QDeclarativeProperty &) const; - - int coreIndex() const; + int index() const; QMetaProperty property() const; QMetaMethod method() const; private: - friend class QDeclarativeEnginePrivate; friend class QDeclarativePropertyPrivate; QDeclarativePropertyPrivate *d; }; diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h index eb5fa9a..1fda7f4 100644 --- a/src/declarative/qml/qdeclarativeproperty_p.h +++ b/src/declarative/qml/qdeclarativeproperty_p.h @@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeContext; class QDeclarativeEnginePrivate; +class QDeclarativeExpression; class Q_AUTOTEST_EXPORT QDeclarativePropertyPrivate { public: @@ -71,20 +72,20 @@ public: Q_DECLARE_FLAGS(WriteFlags, WriteFlag) QDeclarativePropertyPrivate() - : q(0), context(0), object(0), isDefaultProperty(false), isNameCached(false) {} + : q(0), context(0), engine(0), object(0), isNameCached(false) {} QDeclarativePropertyPrivate(const QDeclarativePropertyPrivate &other) - : q(0), context(other.context), object(other.object), - isDefaultProperty(other.isDefaultProperty), isNameCached(other.isNameCached), + : q(0), context(other.context), engine(other.engine), object(other.object), + isNameCached(other.isNameCached), core(other.core), nameCache(other.nameCache), valueType(other.valueType) {} QDeclarativeProperty *q; QDeclarativeContext *context; + QDeclarativeEngine *engine; QDeclarativeGuard<QObject> object; - bool isDefaultProperty:1; bool isNameCached:1; QDeclarativePropertyCache::Data core; QString nameCache; diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index baa98bd..720b496 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -525,7 +525,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature())) VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature()))); - QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex()); + QMetaObject::connect(target, prop.index(), assign, method.methodIndex()); } else { VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr))); @@ -593,7 +593,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati QDeclarativeProperty mp = QDeclarativePropertyPrivate::restore(datas.at(instr.assignBinding.property), target, ctxt); - int coreIndex = mp.coreIndex(); + int coreIndex = mp.index(); if (stack.count() == 1 && bindingSkipList.testBit(coreIndex)) break; @@ -648,7 +648,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati obj->setParent(target); vi->setTarget(prop); QDeclarativeVMEMetaObject *mo = static_cast<QDeclarativeVMEMetaObject *>((QMetaObject*)target->metaObject()); - mo->registerInterceptor(prop.coreIndex(), QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), vi); + mo->registerInterceptor(prop.index(), QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), vi); } break; diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 8af8fc2..328f0e4 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1509,6 +1509,11 @@ QDeclarativeAnimationGroup::QDeclarativeAnimationGroup(QObject *parent) { } +QDeclarativeAnimationGroup::QDeclarativeAnimationGroup(QDeclarativeAnimationGroupPrivate &dd, QObject *parent) + : QDeclarativeAbstractAnimation(dd, parent) +{ +} + void QDeclarativeAnimationGroupPrivate::append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *a) { QDeclarativeAnimationGroup *q = qobject_cast<QDeclarativeAnimationGroup *>(list->object); @@ -1567,7 +1572,8 @@ QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent QDeclarativeAnimationGroup(parent) { Q_D(QDeclarativeAnimationGroup); - d->ag = new QSequentialAnimationGroup(this); + d->ag = new QSequentialAnimationGroup; + QDeclarativeGraphics_setParent_noEvent(d->ag, this); } QDeclarativeSequentialAnimation::~QDeclarativeSequentialAnimation() @@ -1632,7 +1638,8 @@ QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) : QDeclarativeAnimationGroup(parent) { Q_D(QDeclarativeAnimationGroup); - d->ag = new QParallelAnimationGroup(this); + d->ag = new QParallelAnimationGroup; + QDeclarativeGraphics_setParent_noEvent(d->ag, this); } QDeclarativeParallelAnimation::~QDeclarativeParallelAnimation() @@ -1791,7 +1798,7 @@ QDeclarativePropertyAnimation::~QDeclarativePropertyAnimation() void QDeclarativePropertyAnimationPrivate::init() { Q_Q(QDeclarativePropertyAnimation); - va = new QDeclarativeTimeLineValueAnimator; + va = new QDeclarativeBulkValueAnimator; QDeclarativeGraphics_setParent_noEvent(va, q); } @@ -2207,7 +2214,7 @@ QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation() return d->va; } -struct PropertyUpdater : public QDeclarativeTimeLineValue +struct PropertyUpdater : public QDeclarativeBulkValueUpdater { QDeclarativeStateActions actions; int interpolatorType; //for Number/ColorAnimation @@ -2225,7 +2232,6 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue wasDeleted = &deleted; if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 v = 1 - v; - QDeclarativeTimeLineValue::setValue(v); for (int ii = 0; ii < actions.count(); ++ii) { QDeclarativeAction &action = actions[ii]; @@ -2365,10 +2371,8 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions } } - - QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) - : QDeclarativeAnimationGroup(parent) + : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent) { Q_D(QDeclarativeParentAnimation); d->topLevelGroup = new QSequentialAnimationGroup; diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index b57bd9e..0f23f5c 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -413,6 +413,9 @@ public: QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations(); friend class QDeclarativeAbstractAnimation; + +protected: + QDeclarativeAnimationGroup(QDeclarativeAnimationGroupPrivate &dd, QObject *parent); }; class QDeclarativeSequentialAnimation : public QDeclarativeAnimationGroup diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index e582066..ae82a90 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -149,14 +149,21 @@ private: bool running; }; -//animates QDeclarativeTimeLineValue (assumes start and end values will be reals or compatible) -class QDeclarativeTimeLineValueAnimator : public QVariantAnimation +class QDeclarativeBulkValueUpdater +{ +public: + virtual ~QDeclarativeBulkValueUpdater() {} + virtual void setValue(qreal value) = 0; +}; + +//animates QDeclarativeBulkValueUpdater (assumes start and end values will be reals or compatible) +class QDeclarativeBulkValueAnimator : public QVariantAnimation { Q_OBJECT public: - QDeclarativeTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} - ~QDeclarativeTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } - void setAnimValue(QDeclarativeTimeLineValue *value, DeletionPolicy p) + QDeclarativeBulkValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} + ~QDeclarativeBulkValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } + void setAnimValue(QDeclarativeBulkValueUpdater *value, DeletionPolicy p) { if (state() == Running) stop(); @@ -193,7 +200,7 @@ protected: } private: - QDeclarativeTimeLineValue *animValue; + QDeclarativeBulkValueUpdater *animValue; bool *fromSourced; DeletionPolicy policy; }; @@ -352,7 +359,7 @@ public: int interpolatorType; QVariantAnimation::Interpolator interpolator; - QDeclarativeTimeLineValueAnimator *va; + QDeclarativeBulkValueAnimator *va; static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); static void convertVariant(QVariant &variant, int type); diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index abdbec5..0c6e7a3 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -53,7 +53,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeActionEvent; +class QDeclarativeAbstractBinding; class QDeclarativeBinding; +class QDeclarativeExpression; class Q_DECLARATIVE_EXPORT QDeclarativeAction { public: diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index e625c69..95c168a 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -313,8 +313,6 @@ SUBDIRS += \ qmediaserviceprovider \ qmediatimerange \ qvideowidget \ - qdeclarativeaudio \ - qdeclarativevideo \ qspinbox \ qsplitter \ qsql \ @@ -485,6 +483,9 @@ contains(QT_CONFIG,opengl):SUBDIRS += qgl qglbuffer qgl_threads contains(QT_CONFIG,qt3support):!wince*:SUBDIRS += $$Q3SUBDIRS +contains(QT_CONFIG,multimedia):contains(QT_CONFIG,declarative):SUBDIRS += qdeclarativeaudio \ + qdeclarativevideo + contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter mac: { SUBDIRS += macgui \ diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index c72c9e7..0333d98 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -140,18 +140,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty() QCOMPARE(prop.name(), QString()); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -167,7 +166,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); + QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -234,18 +233,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(prop.name(), QString()); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -261,7 +259,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); + QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -281,18 +279,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QCOMPARE(prop.name(), QString("defaultProperty")); QCOMPARE(prop.read(), QVariant(10)); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), (QDeclarativeProperty::Type)(QDeclarativeProperty::Property | QDeclarativeProperty::Default)); + QCOMPARE(prop.type(), QDeclarativeProperty::Property); QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), true); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), true); QCOMPARE(prop.isResettable(), false); @@ -310,7 +307,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -335,18 +332,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.name(), QString()); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -362,7 +358,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); + QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -382,18 +378,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.name(), QString("defaultProperty")); QCOMPARE(prop.read(), QVariant(10)); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); QCOMPARE(prop.type(), QDeclarativeProperty::Property); QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), true); QCOMPARE(prop.isResettable(), false); @@ -411,7 +406,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -431,18 +426,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.name(), QString("onClicked")); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant("Hello")), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().signature()), QString("clicked()")); QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -459,7 +453,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -479,18 +473,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QCOMPARE(prop.name(), QString("onOddlyNamedNotifySignal")); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant("Hello")), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().signature()), QString("oddlyNamedNotifySignal()")); QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -507,7 +500,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string() QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -532,18 +525,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(prop.name(), QString()); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -559,7 +551,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); + QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -579,18 +571,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QCOMPARE(prop.name(), QString("defaultProperty")); QCOMPARE(prop.read(), QVariant(10)); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), (QDeclarativeProperty::Type)(QDeclarativeProperty::Property | QDeclarativeProperty::Default)); + QCOMPARE(prop.type(), QDeclarativeProperty::Property); QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), true); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), true); QCOMPARE(prop.isResettable(), false); @@ -608,7 +599,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -633,18 +624,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.name(), QString()); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -660,7 +650,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); + QCOMPARE(prop.index(), -1); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -680,18 +670,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.name(), QString("defaultProperty")); QCOMPARE(prop.read(), QVariant(10)); QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(prop.method().signature() == 0); QCOMPARE(prop.type(), QDeclarativeProperty::Property); QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), true); QCOMPARE(prop.isResettable(), false); @@ -709,7 +698,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -729,18 +718,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.name(), QString("onClicked")); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant("Hello")), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().signature()), QString("clicked()")); QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -757,7 +745,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; @@ -777,18 +765,17 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.name(), QString("onOddlyNamedNotifySignal")); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant("Hello")), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().signature()), QString("oddlyNamedNotifySignal()")); QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); QCOMPARE(prop.isWritable(), false); QCOMPARE(prop.isDesignable(), false); QCOMPARE(prop.isResettable(), false); @@ -805,7 +792,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); delete obj; diff --git a/tests/auto/declarative/qdeclarativewebview/data/forward.html b/tests/auto/declarative/qdeclarativewebview/data/forward.html index 030446a..62ab62d 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/forward.html +++ b/tests/auto/declarative/qdeclarativewebview/data/forward.html @@ -1,6 +1,6 @@ <html> <head><title>Forward</title> -<link rel="icon" sizes="48x48" href="basic.png"> +<link rel="icon" sizes="32x32" href="forward.png"> </head> <body leftmargin="0" marginwidth="0"> <table width="123"> diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index 2634825..6d16056 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -277,6 +277,8 @@ void tst_qdeclarativewebview::historyNav() wv->setUrl(QUrl::fromLocalFile(SRCDIR "/data/forward.html")); QTRY_COMPARE(wv->progress(), 1.0); QCOMPARE(wv->title(),QString("Forward")); + QTRY_COMPARE(wv->icon().width(), 32); + QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/forward.png")); QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/forward.html")), strippedHtml(wv->html())); QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/forward.html")); QCOMPARE(wv->status(), QDeclarativeWebView::Ready); diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index c94ea7b..31e12fe 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -162,6 +162,9 @@ private slots: void stream_QIcon_data(); void stream_QIcon(); + void stream_QEasingCurve_data(); + void stream_QEasingCurve(); + void stream_atEnd_data(); void stream_atEnd(); @@ -243,6 +246,7 @@ private: void writeqint64(QDataStream *s); void writeQWMatrix(QDataStream *s); void writeQIcon(QDataStream *s); + void writeQEasingCurve(QDataStream *s); void readbool(QDataStream *s); void readQBool(QDataStream *s); @@ -272,6 +276,7 @@ private: void readqint64(QDataStream *s); void readQWMatrix(QDataStream *s); void readQIcon(QDataStream *s); + void readQEasingCurve(QDataStream *s); private: QString svgFile; @@ -687,6 +692,70 @@ void tst_QDataStream::readHash(QDataStream *s) // ************************************ +static QEasingCurve QEasingCurveData(int index) +{ + QEasingCurve easing; + + switch (index) { + case 0: + default: + break; + case 1: + easing.setType(QEasingCurve::Linear); + break; + case 2: + easing.setType(QEasingCurve::OutCubic); + break; + case 3: + easing.setType(QEasingCurve::InOutSine); + break; + case 4: + easing.setType(QEasingCurve::InOutElastic); + easing.setPeriod(1.5); + easing.setAmplitude(2.0); + break; + case 5: + easing.setType(QEasingCurve::OutInBack); + break; + case 6: + easing.setType(QEasingCurve::OutCurve); + break; + case 7: + easing.setType(QEasingCurve::InOutBack); + easing.setOvershoot(0.5); + break; + } + return easing; +} +#define MAX_EASING_DATA 8 + +void tst_QDataStream::stream_QEasingCurve_data() +{ + stream_data(MAX_EASING_DATA); +} + +void tst_QDataStream::stream_QEasingCurve() +{ + STREAM_IMPL(QEasingCurve); +} + +void tst_QDataStream::writeQEasingCurve(QDataStream* s) +{ + QEasingCurve test(QEasingCurveData(dataIndex(QTest::currentDataTag()))); + *s << test; +} + +void tst_QDataStream::readQEasingCurve(QDataStream *s) +{ + QEasingCurve S; + QEasingCurve expected(QEasingCurveData(dataIndex(QTest::currentDataTag()))); + + *s >> S; + QCOMPARE(S, expected); +} + +// ************************************ + // contains some quint64 testing as well #define MAX_qint64_DATA 4 diff --git a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro index f3262ee..13bf606 100644 --- a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro +++ b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro @@ -2,5 +2,3 @@ load(qttest_p4) SOURCES += tst_qdeclarativeaudio.cpp QT += multimedia declarative -requires(contains(QT_CONFIG, multimedia)) -requires(contains(QT_CONFIG, declarative)) diff --git a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro index 0cd7879..d946bb0 100644 --- a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro +++ b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro @@ -2,5 +2,3 @@ load(qttest_p4) SOURCES += tst_qdeclarativevideo.cpp QT += multimedia declarative -requires(contains(QT_CONFIG, multimedia)) -requires(contains(QT_CONFIG, declarative)) diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index abb4014..124f900 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -69,8 +69,6 @@ private slots: void valueForProgress(); void setCustomType(); void operators(); - void dataStreamOperators_data(); - void dataStreamOperators(); void properties(); void metaTypes(); @@ -509,58 +507,6 @@ void tst_QEasingCurve::operators() QVERIFY(curve2 == curve); } -void tst_QEasingCurve::dataStreamOperators_data() -{ - QTest::addColumn<int>("type"); - QTest::addColumn<qreal>("amplitude"); - QTest::addColumn<qreal>("overshoot"); - QTest::addColumn<qreal>("period"); - QTest::addColumn<QEasingCurve>("easingCurve"); - QTest::newRow("Linear") << int(QEasingCurve::Linear) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::Linear); - QTest::newRow("OutCubic") << int(QEasingCurve::OutCubic) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCubic); - QTest::newRow("InOutSine") << int(QEasingCurve::InOutSine) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::InOutSine); - QEasingCurve inOutElastic(QEasingCurve::InOutElastic); - inOutElastic.setPeriod(1.5); - inOutElastic.setAmplitude(2.0); - QTest::newRow("InOutElastic") << int(QEasingCurve::InOutElastic) << 2.0 << -1.0 << 1.5 << inOutElastic; - QTest::newRow("OutInBack") << int(QEasingCurve::OutInBack) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutInBack); - QTest::newRow("OutCurve") << int(QEasingCurve::OutCurve) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCurve); - QEasingCurve inOutBack(QEasingCurve::InOutBack); - inOutBack.setOvershoot(0.5); - QTest::newRow("InOutBack") << int(QEasingCurve::InOutBack) << -1.0 << 0.5 << -1.0 << inOutBack; -} - -void tst_QEasingCurve::dataStreamOperators() -{ - QFETCH(int, type); - QFETCH(qreal, amplitude); - QFETCH(qreal, overshoot); - QFETCH(qreal, period); - QFETCH(QEasingCurve, easingCurve); - - // operator << - QEasingCurve curve; - curve.setType(QEasingCurve::Type(type)); - if (amplitude != -1.0) - curve.setAmplitude(amplitude); - if (overshoot != -1.0) - curve.setOvershoot(overshoot); - if (period != -1.0) - curve.setPeriod(period); - - QVERIFY(easingCurve == curve); - - QByteArray array; - QDataStream out(&array, QIODevice::WriteOnly); - out << curve; - - QDataStream in(array); - QEasingCurve curve2; - in >> curve2; - - QVERIFY(curve2 == curve); -} - class tst_QEasingProperties : public QObject { Q_OBJECT |