diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-08-27 06:12:19 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-08-27 06:12:19 (GMT) |
commit | 2d23a0659ebfa87e681e9540935eb54ea3785bfc (patch) | |
tree | ca5d0c052a1e190bd959d4adcbe2cbca185e95fe /src/declarative | |
parent | 09c662b1c3440d7ff0b151d1fd10fc19ef75725f (diff) | |
parent | 84ab1ebab17e62176db1120845d0a3ece5cf9d80 (diff) | |
download | Qt-2d23a0659ebfa87e681e9540935eb54ea3785bfc.zip Qt-2d23a0659ebfa87e681e9540935eb54ea3785bfc.tar.gz Qt-2d23a0659ebfa87e681e9540935eb54ea3785bfc.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/debugger/qpacketprotocol.cpp | 2 | ||||
-rw-r--r-- | src/declarative/extra/extra.pri | 4 | ||||
-rw-r--r-- | src/declarative/extra/qmlbehavior.cpp (renamed from src/declarative/extra/qmlbehaviour.cpp) | 74 | ||||
-rw-r--r-- | src/declarative/extra/qmlbehavior.h (renamed from src/declarative/extra/qmlbehaviour.h) | 18 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.cpp | 19 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 3 | ||||
-rw-r--r-- | src/declarative/fx/qfxtextinput.cpp | 14 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 14 | ||||
-rw-r--r-- | src/declarative/util/qmlstate.cpp | 2 |
12 files changed, 80 insertions, 76 deletions
diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 6bccf4b..84882dd 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -391,7 +391,7 @@ QIODevice * QPacketProtocol::device() Only packets returned from QPacketProtocol::read() may be read from. QPacket instances constructed by directly by applications are for transmission only and are considered "write only". Attempting to read data from them will - result in undefined behaviour. + result in undefined behavior. \ingroup io \sa QPacketProtocol diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri index 1f84406..ae07a19 100644 --- a/src/declarative/extra/extra.pri +++ b/src/declarative/extra/extra.pri @@ -7,7 +7,7 @@ SOURCES += \ extra/qfxanimatedimageitem.cpp \ extra/qfxflowview.cpp \ extra/qfxparticles.cpp \ - extra/qmlbehaviour.cpp \ + extra/qmlbehavior.cpp \ extra/qbindablemap.cpp \ extra/qmlfontloader.cpp @@ -21,7 +21,7 @@ HEADERS += \ extra/qfxanimatedimageitem_p.h \ extra/qfxflowview.h \ extra/qfxparticles.h \ - extra/qmlbehaviour.h \ + extra/qmlbehavior.h \ extra/qbindablemap.h \ extra/qmlfontloader.h diff --git a/src/declarative/extra/qmlbehaviour.cpp b/src/declarative/extra/qmlbehavior.cpp index 5401b0d..7784ef5 100644 --- a/src/declarative/extra/qmlbehaviour.cpp +++ b/src/declarative/extra/qmlbehavior.cpp @@ -42,19 +42,19 @@ #include <private/qobject_p.h> #include "qmlanimation.h" #include "qmltransition.h" -#include "qmlbehaviour.h" +#include "qmlbehavior.h" #include <QtDeclarative/qmlcontext.h> #include <QtCore/qparallelanimationgroup.h> QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Behavior,QmlBehaviour) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Behavior,QmlBehavior) -class QmlBehaviourData : public QObject +class QmlBehaviorData : public QObject { Q_OBJECT public: - QmlBehaviourData(QObject *parent) + QmlBehaviorData(QObject *parent) : QObject(parent) {} Q_PROPERTY(QVariant endValue READ endValue NOTIFY valuesChanged) @@ -69,13 +69,13 @@ Q_SIGNALS: void valuesChanged(); private: - friend class QmlBehaviour; + friend class QmlBehavior; }; -class QmlBehaviourPrivate : public QObjectPrivate +class QmlBehaviorPrivate : public QObjectPrivate { public: - QmlBehaviourPrivate() : operations(this) {} + QmlBehaviorPrivate() : operations(this) {} QmlMetaProperty property; QVariant currentValue; @@ -84,7 +84,7 @@ public: class AnimationList : public QmlConcreteList<QmlAbstractAnimation *> { public: - AnimationList(QmlBehaviourPrivate *parent) : _parent(parent) {} + AnimationList(QmlBehaviorPrivate *parent) : _parent(parent) {} virtual void append(QmlAbstractAnimation *a) { QmlConcreteList<QmlAbstractAnimation *>::append(a); @@ -95,14 +95,14 @@ public: } virtual void clear() { QmlConcreteList<QmlAbstractAnimation *>::clear(); } //### private: - QmlBehaviourPrivate *_parent; + QmlBehaviorPrivate *_parent; }; AnimationList operations; QParallelAnimationGroup *group; }; /*! - \qmlclass Behavior QmlBehaviour + \qmlclass Behavior QmlBehavior \brief The Behavior element allows you to specify a default animation for a property change. In example below, the rect will use a bounce easing curve over 200 millisecond for any changes to its y property: @@ -121,77 +121,77 @@ public: \endcode */ -QmlBehaviour::QmlBehaviour(QObject *parent) -: QObject(*(new QmlBehaviourPrivate), parent) +QmlBehavior::QmlBehavior(QObject *parent) +: QObject(*(new QmlBehaviorPrivate), parent) { - Q_D(QmlBehaviour); + Q_D(QmlBehavior); d->group = new QParallelAnimationGroup; QFx_setParent_noEvent(d->group, this); } /*! - \qmlproperty QVariant Behavior::fromValue - This property holds a selector specifying a starting value for the behavior + \qmlproperty QVariant Behavior::from + This property holds a selector specifying a starting value for the behavior. If you only want the behavior to apply when the change starts at a specific value you can specify fromValue. This selector is used in conjunction - with the toValue selector. + with the to selector. */ -QVariant QmlBehaviour::fromValue() const +QVariant QmlBehavior::fromValue() const { - Q_D(const QmlBehaviour); + Q_D(const QmlBehavior); return d->fromValue; } -void QmlBehaviour::setFromValue(const QVariant &v) +void QmlBehavior::setFromValue(const QVariant &v) { - Q_D(QmlBehaviour); + Q_D(QmlBehavior); d->fromValue = v; } /*! - \qmlproperty QVariant Behavior::toValue - This property holds a selector specifying a ending value for the behavior + \qmlproperty QVariant Behavior::to + This property holds a selector specifying a ending value for the behavior. If you only want the behavior to apply when the change ends at a specific value you can specify toValue. This selector is used in conjunction - with the fromValue selector. + with the from selector. */ -QVariant QmlBehaviour::toValue() const +QVariant QmlBehavior::toValue() const { - Q_D(const QmlBehaviour); + Q_D(const QmlBehavior); return d->toValue; } -void QmlBehaviour::setToValue(const QVariant &v) +void QmlBehavior::setToValue(const QVariant &v) { - Q_D(QmlBehaviour); + Q_D(QmlBehavior); d->toValue = v; } -QmlList<QmlAbstractAnimation *>* QmlBehaviour::operations() +QmlList<QmlAbstractAnimation *>* QmlBehavior::operations() { - Q_D(QmlBehaviour); + Q_D(QmlBehavior); return &d->operations; } -QmlBehaviour::~QmlBehaviour() +QmlBehavior::~QmlBehavior() { //### do we need any other cleanup here? } -bool QmlBehaviour::_ignore = false; -void QmlBehaviour::propertyValueChanged() +bool QmlBehavior::_ignore = false; +void QmlBehavior::propertyValueChanged() { - Q_D(QmlBehaviour); + Q_D(QmlBehavior); if (_ignore) return; QVariant newValue = d->property.read(); - if ((!fromValue().isValid() || fromValue() == d->currentValue) && + if ((!fromValue().isValid() || fromValue() == d->currentValue) && (!toValue().isValid() || toValue() == newValue)) { //### does this clean up everything needed? @@ -220,9 +220,9 @@ void QmlBehaviour::propertyValueChanged() d->currentValue = newValue; } -void QmlBehaviour::setTarget(const QmlMetaProperty &property) +void QmlBehavior::setTarget(const QmlMetaProperty &property) { - Q_D(QmlBehaviour); + Q_D(QmlBehavior); d->property = property; d->currentValue = property.read(); d->property.connectNotifier(this, SLOT(propertyValueChanged())); @@ -233,4 +233,4 @@ void QmlBehaviour::setTarget(const QmlMetaProperty &property) QT_END_NAMESPACE -#include "qmlbehaviour.moc" +#include "qmlbehavior.moc" diff --git a/src/declarative/extra/qmlbehaviour.h b/src/declarative/extra/qmlbehavior.h index b33d72a..a4a0679 100644 --- a/src/declarative/extra/qmlbehaviour.h +++ b/src/declarative/extra/qmlbehavior.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLBEHAVIOUR_H -#define QMLBEHAVIOUR_H +#ifndef QMLBEHAVIOR_H +#define QMLBEHAVIOR_H #include <QtDeclarative/qmlpropertyvaluesource.h> #include <QtDeclarative/qml.h> @@ -53,11 +53,11 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QmlAbstractAnimation; -class QmlBehaviourPrivate; -class Q_DECLARATIVE_EXPORT QmlBehaviour : public QObject, public QmlPropertyValueSource +class QmlBehaviorPrivate; +class Q_DECLARATIVE_EXPORT QmlBehavior : public QObject, public QmlPropertyValueSource { Q_OBJECT - Q_DECLARE_PRIVATE(QmlBehaviour) + Q_DECLARE_PRIVATE(QmlBehavior) Q_PROPERTY(QVariant from READ fromValue WRITE setFromValue) Q_PROPERTY(QVariant to READ toValue WRITE setToValue) @@ -65,8 +65,8 @@ class Q_DECLARATIVE_EXPORT QmlBehaviour : public QObject, public QmlPropertyValu Q_PROPERTY(QmlList<QmlAbstractAnimation *>* operations READ operations) public: - QmlBehaviour(QObject *parent=0); - ~QmlBehaviour(); + QmlBehavior(QObject *parent=0); + ~QmlBehavior(); QVariant fromValue() const; void setFromValue(const QVariant &); @@ -84,8 +84,8 @@ private Q_SLOTS: QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlBehaviour) +QML_DECLARE_TYPE(QmlBehavior) QT_END_HEADER -#endif // QMLBEHAVIOUR_H +#endif // QMLBEHAVIOR_H diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 428815a..440c1ca 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -607,7 +607,6 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *) { Q_Q(QFxFlickable); - pressed = false; if (lastPosTime.isNull()) return; @@ -871,13 +870,8 @@ void QFxFlickable::setViewportWidth(int w) else d->_flick->setWidth(w); // Make sure that we're entirely in view. - if (d->_moveX.value() > minXExtent() || maxXExtent() > 0) { - d->_tl.clear(); - d->_moveX.setValue(minXExtent()); - } else if (d->_moveX.value() < maxXExtent()) { - d->_tl.clear(); - d->_moveX.setValue(maxXExtent()); - } + if (!d->pressed) + d->fixupX(); emit viewportWidthChanged(); d->updateBeginningEnd(); } @@ -919,13 +913,8 @@ void QFxFlickable::setViewportHeight(int h) else d->_flick->setHeight(h); // Make sure that we're entirely in view. - if (d->_moveY.value() > minYExtent() || maxYExtent() > 0) { - d->_tl.clear(); - d->_moveY.setValue(minYExtent()); - } else if (d->_moveY.value() < maxYExtent()) { - d->_tl.clear(); - d->_moveY.setValue(maxYExtent()); - } + if (!d->pressed) + d->fixupY(); emit viewportHeightChanged(); d->updateBeginningEnd(); } diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index e13fa9b..13d793f 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -70,7 +70,7 @@ class Q_DECLARATIVE_EXPORT QFxFlickable : public QFxItem Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) Q_PROPERTY(bool locked READ isLocked WRITE setLocked) //### interactive, ensure flicking is stopped, etc. - Q_PROPERTY(DragMode dragMode READ dragMode WRITE setDragMode) //### remove. Consider a better way to implement different drag behaviour + Q_PROPERTY(DragMode dragMode READ dragMode WRITE setDragMode) //### remove. Consider a better way to implement different drag behavior Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged) Q_PROPERTY(bool atYEnd READ isAtYEnd NOTIFY isAtBoundaryChanged) diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 4030a0b..0dfdce8 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1396,13 +1396,14 @@ void QFxListView::trackedPositionChanged() case Free: if (d->trackedItem->position() < d->position()) { d->setPosition(d->trackedItem->position()); + d->fixupPosition(); } else if (d->trackedItem->endPosition() > d->position() + d->size()) { qreal pos = d->trackedItem->endPosition() - d->size(); if (d->trackedItem->size() > d->size()) pos = d->trackedItem->position(); d->setPosition(pos); + d->fixupPosition(); } - d->fixupPosition(); break; case Snap: if (d->trackedItem->position() < d->startPosition() + d->snapPos) diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp index b9b33ab..f491d34 100644 --- a/src/declarative/fx/qfxtextinput.cpp +++ b/src/declarative/fx/qfxtextinput.cpp @@ -320,6 +320,20 @@ void QFxTextInput::setSelectionEnd(int s) d->control->setSelection(d->lastSelectionStart, s - d->lastSelectionStart); } +/*! + \qmlproperty string TextInput::selectedText + + This read-only property provides the text currently selected in the + text input. + + It is equivalent to the following snippet, but is faster and easier + to use. + + \qmlcode + myTextInput.text.toString().substring(myTextInput.selectionStart, + myTextInput.selectionEnd); + \endcode +*/ QString QFxTextInput::selectedText() const { Q_D(const QFxTextInput); diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index f9183c8..764699e 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1231,7 +1231,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, if (!prop->isDefault && prop->name == "id" && !ctxt.isSubContext()) { - // The magic "id" behaviour doesn't apply when "id" is resolved as a + // The magic "id" behavior doesn't apply when "id" is resolved as a // default property or to sub-objects (which are always in binding // sub-contexts) COMPILE_CHECK(buildIdProperty(prop, obj)); diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 77463cd..845dcf6 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -315,7 +315,7 @@ QVariant QmlExpression::value() Q_D(QmlExpression); QVariant rv; - if (!d->context() || (!d->sse.isValid() && d->expression.isEmpty())) + if (!engine() || (!d->sse.isValid() && d->expression.isEmpty())) return rv; #ifdef Q_ENABLE_PERFORMANCE_LOG diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index cbddb91..c535045 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -47,7 +47,7 @@ #include "qml.h" #include "qmlinfo.h" #include "qmlanimation_p.h" -#include "qmlbehaviour.h" +#include "qmlbehavior.h" #include <QParallelAnimationGroup> #include <QSequentialAnimationGroup> #include <QtCore/qset.h> @@ -330,7 +330,7 @@ void QmlAbstractAnimation::componentComplete() calling the \c stop() method. The \c complete() method is not effected by this value. - This behaviour is most useful when the \c repeat property is set, as the + This behavior is most useful when the \c repeat property is set, as the animation will finish playing normally but not restart. By default, the alwaysRunToEnd property is not set. @@ -1007,9 +1007,9 @@ void QmlPropertyAction::transition(QmlStateActions &actions, { for (int ii = 0; ii < actions.count(); ++ii) { const Action &action = actions.at(ii); - QmlBehaviour::_ignore = true; + QmlBehavior::_ignore = true; action.property.write(action.toValue); - QmlBehaviour::_ignore = false; + QmlBehavior::_ignore = false; } } }; @@ -1338,7 +1338,7 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions, inc = -1; from = d->animations.count() - 1; } - + //needed for Behavior if (d->userProperty.isValid() && d->propertyName.isEmpty() && !target()) { for (int i = 0; i < d->animations.count(); ++i) @@ -1760,7 +1760,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, for (int ii = 0; ii < actions.count(); ++ii) { Action &action = actions[ii]; - QmlBehaviour::_ignore = true; + QmlBehavior::_ignore = true; if (v == 1.) action.property.write(action.toValue); else { @@ -1779,7 +1779,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, if (interpolator) action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v)); } - QmlBehaviour::_ignore = false; + QmlBehavior::_ignore = false; } } }; diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index a17d16e..508ef43 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -208,7 +208,7 @@ void QmlState::setWhen(QmlBinding *when) } /*! - \qmlproperty string State::extends + \qmlproperty string State::extend This property holds the state that this state extends The state being extended is treated as the base state in regards to |