diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-08 23:39:57 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-08 23:39:57 (GMT) |
commit | db0c932bf816b76547798ec62336e25b453d29b8 (patch) | |
tree | 5f662f9318fd144e17146e2733ba7857473ec89c /src/declarative | |
parent | d4abbfdd1959a65ecfb997c962aa8ea132c77eaf (diff) | |
parent | 5f0912e71b6f10c2987eccbc62ea36ab5928f9b8 (diff) | |
download | Qt-db0c932bf816b76547798ec62336e25b453d29b8.zip Qt-db0c932bf816b76547798ec62336e25b453d29b8.tar.gz Qt-db0c932bf816b76547798ec62336e25b453d29b8.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative')
8 files changed, 37 insertions, 54 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index b36127f..1ebbaee 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -68,56 +68,31 @@ public: \brief The Flipable item provides a surface that can be flipped. \inherits Item - Flipable allows you to specify a front and a back and then flip between those sides. + Flipable is an item that can be visibly "flipped" between its front and + back sides. It is used together with Rotation and State/Transition to + produce a flipping effect. - Here's an example that flips between the front and back sides when clicked: + Here is a Flipable that flips whenever it is clicked: - \qml - - Flipable { - id: flipable - width: 250; height: 250 - property int angle: 0 - - transform: Rotation { - id: rotation - origin.x: flipable.width/2; origin.y: flipable.height/2 - axis.x: 0; axis.y: 1; axis.z: 0 // rotate around y-axis - angle: flipable.angle - } - - front: Image { source: "front.png" } - back: Image { source: "back.png" } - - states: State { - name: "back" - PropertyChanges { target: flipable; angle: 180 } - } - - transitions: Transition { - NumberAnimation { properties: "angle"; duration: 2000 } - } - - MouseArea { - // change between default and 'back' states - onClicked: flipable.state = (flipable.state == 'back' ? '' : 'back') - anchors.fill: parent - } - } - \endqml + \snippet examples/declarative/flipable/flipable.qml 0 \image flipable.gif + + The Rotation element is used to specify the angle and axis of the flip, + and the State defines the changes in angle which produce the flipping + effect. Finally, the Transition creates the animation that changes the + angle over one second. */ /*! \internal \class QDeclarativeFlipable - \brief The QDeclarativeFlipable class provides a flipable surface. + \brief The Flipable item provides a surface that can be flipped. \ingroup group_widgets - QDeclarativeFlipable allows you to specify a front and a back, as well as an - axis for the flip. + Flipable is an item that can be visibly "flipped" between its front and + back sides. */ QDeclarativeFlipable::QDeclarativeFlipable(QDeclarativeItem *parent) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index b0a7570..59dd43d 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2217,7 +2217,7 @@ void QDeclarativeItem::setKeepMouseGrab(bool keep) \qmlmethod object Item::mapFromItem(Item item, int x, int y) Maps the point (\a x, \a y), which is in \a item's coordinate system, to - this item's coordinate system, and returns an object with \c x and \c y + this item's coordinate system, and returns an object with \c x and \c y properties matching the mapped cooordinate. If \a item is a \c null value, this maps the point from the coordinate @@ -2576,9 +2576,9 @@ bool QDeclarativeItem::sceneEvent(QEvent *event) !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { keyPressEvent(static_cast<QKeyEvent *>(event)); if (!event->isAccepted()) - QGraphicsItem::sceneEvent(event); + return QGraphicsItem::sceneEvent(event); } else { - QGraphicsItem::sceneEvent(event); + return QGraphicsItem::sceneEvent(event); } } else { bool rv = QGraphicsItem::sceneEvent(event); diff --git a/src/declarative/graphicsitems/qdeclarativeparticles.cpp b/src/declarative/graphicsitems/qdeclarativeparticles.cpp index deabdd6..ec0bf6c 100644 --- a/src/declarative/graphicsitems/qdeclarativeparticles.cpp +++ b/src/declarative/graphicsitems/qdeclarativeparticles.cpp @@ -758,11 +758,13 @@ void QDeclarativeParticles::setSource(const QUrl &name) The particles element emits particles until it has count active particles. When this number is reached, new particles are not emitted until - some of the current particles reach theend of their lifespan. + some of the current particles reach the end of their lifespan. If count is -1 then there is no maximum number of active particles, and particles will be constantly emitted at the rate specified by emissionRate. + The default value for count is 1. + If both count and emissionRate are set to -1, nothing will be emitted. */ @@ -1219,7 +1221,7 @@ void QDeclarativeParticles::burst(int count, int emissionRate) void QDeclarativeParticlesPainter::updateSize() { - if (!isComponentComplete()) + if (!d->_componentComplete) return; const int parentX = parentItem()->x(); @@ -1304,7 +1306,7 @@ void QDeclarativeParticles::componentComplete() { Q_D(QDeclarativeParticles); QDeclarativeItem::componentComplete(); - if (d->count) { + if (d->count && d->emissionRate) { d->paintItem->updateSize(); d->clock.start(); } diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 55f1c89..6bad4da 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -927,6 +927,8 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q if (inPackage) { emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj)); } else { + if (item->hasFocus()) + item->clearFocus(); item->setOpacity(0.0); static_cast<QGraphicsItem*>(item)->setParentItem(0); } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 3c6c949..ef1032b 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2204,6 +2204,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) if (propNames.contains(prop.name)) COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QDeclarativeCompiler","Duplicate property name")); + if (QString::fromUtf8(prop.name).at(0).isUpper()) + COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QDeclarativeCompiler","Property names cannot begin with an upper case letter")); propNames.insert(prop.name); } @@ -2211,12 +2213,16 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) QByteArray name = obj->dynamicSignals.at(ii).name; if (methodNames.contains(name)) COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Duplicate signal name")); + if (QString::fromUtf8(name).at(0).isUpper()) + COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Signal names cannot begin with an upper case letter")); methodNames.insert(name); } for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) { QByteArray name = obj->dynamicSlots.at(ii).name; if (methodNames.contains(name)) COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Duplicate method name")); + if (QString::fromUtf8(name).at(0).isUpper()) + COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Method names cannot begin with an upper case letter")); methodNames.insert(name); } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 1e60df4..41d55d7 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1234,17 +1234,13 @@ QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine else if (a == 0x00) finalColor = color; else { - uint src = tintColor.rgba(); - uint dest = color.rgba(); + qreal a = tintColor.alphaF(); + qreal inv_a = 1.0 - a; - uint res = (((a * (src & 0xFF00FF)) + - ((0xFF - a) * (dest & 0xFF00FF))) >> 8) & 0xFF00FF; - res |= (((a * ((src >> 8) & 0xFF00FF)) + - ((0xFF - a) * ((dest >> 8) & 0xFF00FF)))) & 0xFF00FF00; - if ((src & 0xFF000000) == 0xFF000000) - res |= 0xFF000000; - - finalColor = QColor::fromRgba(res); + finalColor.setRgbF(tintColor.redF() * a + color.redF() * inv_a, + tintColor.greenF() * a + color.greenF() * inv_a, + tintColor.blueF() * a + color.blueF() * inv_a, + a + inv_a * color.alphaF()); } return qScriptValueFromValue(engine, qVariantFromValue(finalColor)); diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index dea2c02..d90ca33 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -157,6 +157,7 @@ void QDeclarativeBehavior::setEnabled(bool enabled) void QDeclarativeBehavior::write(const QVariant &value) { Q_D(QDeclarativeBehavior); + qmlExecuteDeferred(this); if (!d->animation || !d->enabled) { QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); return; diff --git a/src/declarative/util/qdeclarativebehavior_p.h b/src/declarative/util/qdeclarativebehavior_p.h index a633b55..ff58210 100644 --- a/src/declarative/util/qdeclarativebehavior_p.h +++ b/src/declarative/util/qdeclarativebehavior_p.h @@ -65,6 +65,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeBehavior : public QObject, public QDeclar Q_CLASSINFO("DefaultProperty", "animation") Q_PROPERTY(QDeclarativeAbstractAnimation *animation READ animation WRITE setAnimation) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + Q_CLASSINFO("DeferredPropertyNames", "animation") public: QDeclarativeBehavior(QObject *parent=0); |