diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-08-25 11:47:24 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-08-25 12:52:15 +0200 |
commit | 8e6ecb56e5d61ce661422779c9d9cbf22f081a34 (patch) | |
tree | 227aeb360800a49de58472bd39bc5f4c596c1b15 /src/qtquick1 | |
parent | c9224b6cf5cceb7d5314f7504d44bfe72bc66950 (diff) | |
parent | 0d84e957297b4ffa6ab5b0b5bcf8b169d567d298 (diff) |
Merge branch 'master' into refactor
Conflicts:
src/declarative/items/qsgcanvas.cpp
src/declarative/items/qsgitem.cpp
src/declarative/items/qsgtextnode.cpp
tests/auto/declarative/examples/examples.pro
tools/qmlviewer/qmlviewer.pro
Change-Id: Icbb0ef5dc79b658c62fd2b2c25a66c9bb3cbeb10
Diffstat (limited to 'src/qtquick1')
32 files changed, 150 insertions, 121 deletions
diff --git a/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp b/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp index b1866e419b..a133bd4e68 100644 --- a/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativeanimatedimage.cpp @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE \bold Note: Unlike images, animated images are not cached or shared internally. \clearfloat - \snippet doc/src/snippets/declarative/animatedimage.qml document + \snippet doc/src/snippets/qtquick1/animatedimage.qml document \sa BorderImage, Image */ diff --git a/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp b/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp index 8db733ba2e..1beef966f0 100644 --- a/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativeborderimage.cpp @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE used to determine the parts of the image that will lie inside the unscaled corner areas and the parts that will be stretched horizontally and vertically. - \snippet doc/src/snippets/declarative/borderimage/normal-image.qml normal image + \snippet doc/src/snippets/qtquick1/borderimage/normal-image.qml normal image \clearfloat \beginfloatleft @@ -116,7 +116,7 @@ QT_BEGIN_NAMESPACE is set to \l{BorderImage::verticalTileMode}{BorderImage.Stretch}, the parts of image in regions 4 and 6 are stretched vertically. - \snippet doc/src/snippets/declarative/borderimage/borderimage-scaled.qml scaled border image + \snippet doc/src/snippets/qtquick1/borderimage/borderimage-scaled.qml scaled border image \clearfloat \beginfloatleft @@ -130,7 +130,7 @@ QT_BEGIN_NAMESPACE \l{BorderImage::verticalTileMode}{BorderImage.Repeat}, the parts of image in regions 4 and 6 are tiled so that they fill the space at the left and right of the element. - \snippet doc/src/snippets/declarative/borderimage/borderimage-tiled.qml tiled border image + \snippet doc/src/snippets/qtquick1/borderimage/borderimage-tiled.qml tiled border image \clearfloat In some situations, the width of regions 2 and 8 may not be an exact multiple of the width diff --git a/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp b/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp index 04e926ac46..f145312334 100644 --- a/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativeflickable.cpp @@ -462,7 +462,7 @@ void QDeclarative1FlickablePrivate::updateBeginningEnd() The following example shows a small view onto a large image in which the user can drag or flick the image in order to view different parts of it. - \snippet doc/src/snippets/declarative/flickable.qml document + \snippet doc/src/snippets/qtquick1/flickable.qml document \clearfloat @@ -524,9 +524,9 @@ void QDeclarative1FlickablePrivate::updateBeginningEnd() These properties are typically used to draw a scrollbar. For example: - \snippet doc/src/snippets/declarative/flickableScrollbar.qml 0 + \snippet doc/src/snippets/qtquick1/flickableScrollbar.qml 0 \dots 8 - \snippet doc/src/snippets/declarative/flickableScrollbar.qml 1 + \snippet doc/src/snippets/qtquick1/flickableScrollbar.qml 1 \sa {declarative/ui-components/scrollbar}{scrollbar example} */ @@ -1331,7 +1331,7 @@ void QDeclarative1Flickable::setBoundsBehavior(BoundsBehavior b) The following snippet shows how these properties are used to display an image that is larger than the Flickable item itself: - \snippet doc/src/snippets/declarative/flickable.qml document + \snippet doc/src/snippets/qtquick1/flickable.qml document In some cases, the the content dimensions can be automatically set using the \l {Item::childrenRect.width}{childrenRect.width} @@ -1566,6 +1566,7 @@ bool QDeclarative1Flickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) return stealThisEvent || d->delayedPressEvent || disabledItem; } else if (d->lastPosTime.isValid()) { d->lastPosTime.invalidate(); + returnToBounds(); } if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { d->clearDelayedPress(); diff --git a/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp b/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp index 789cadafb4..e9c23b4dfd 100644 --- a/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativeflipable.cpp @@ -96,7 +96,7 @@ public: degrees to produce the flipping effect. When \c flipped is false, the item reverts to the default state, in which the \c angle value is 0. - \snippet doc/src/snippets/declarative/flipable/flipable.qml 0 + \snippet doc/src/snippets/qtquick1/flipable/flipable.qml 0 \image flipable.gif diff --git a/src/qtquick1/graphicsitems/qdeclarativegridview.cpp b/src/qtquick1/graphicsitems/qdeclarativegridview.cpp index 63b907b022..f2511a15c9 100644 --- a/src/qtquick1/graphicsitems/qdeclarativegridview.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativegridview.cpp @@ -1269,7 +1269,7 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal The following example shows the definition of a simple list model defined in a file called \c ContactModel.qml: - \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0 + \snippet doc/src/snippets/qtquick1/gridview/ContactModel.qml 0 \div {class="float-right"} \inlineimage gridview-simple.png @@ -1283,9 +1283,9 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal (containing \l Image and \l Text elements) for its delegate. \clearfloat - \snippet doc/src/snippets/declarative/gridview/gridview.qml import + \snippet doc/src/snippets/qtquick1/gridview/gridview.qml import \codeline - \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple + \snippet doc/src/snippets/qtquick1/gridview/gridview.qml classdocs simple \div {class="float-right"} \inlineimage gridview-highlight.png @@ -1298,7 +1298,7 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal into a separate \c contactDelegate component. \clearfloat - \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs advanced + \snippet doc/src/snippets/qtquick1/gridview/gridview.qml classdocs advanced The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true to enable keyboard navigation for the grid view. @@ -1312,7 +1312,7 @@ void QDeclarative1GridViewPrivate::flick(AxisData &data, qreal minExtent, qreal this attached property directly as \c GridView.isCurrentItem, while the child \c contactInfo object must refer to this property as \c wrapper.GridView.isCurrentItem. - \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem + \snippet doc/src/snippets/qtquick1/gridview/gridview.qml isCurrentItem \note Views do not set the \l{Item::}{clip} property automatically. If the view is not clipped by another item or the screen, it will be necessary @@ -1351,7 +1351,7 @@ QDeclarative1GridView::~QDeclarative1GridView() It is attached to each instance of the delegate. - \snippet doc/src/snippets/declarative/gridview/gridview.qml isCurrentItem + \snippet doc/src/snippets/qtquick1/gridview/gridview.qml isCurrentItem */ /*! @@ -1366,7 +1366,7 @@ QDeclarative1GridView::~QDeclarative1GridView() The example below ensures that the animation completes before the item is removed from the grid. - \snippet doc/src/snippets/declarative/gridview/gridview.qml delayRemove + \snippet doc/src/snippets/qtquick1/gridview/gridview.qml delayRemove */ /*! @@ -1640,7 +1640,7 @@ void QDeclarative1GridView::setHighlight(QDeclarativeComponent *highlight) Here is a highlight with its motion defined by a \l {SpringAnimation} item: - \snippet doc/src/snippets/declarative/gridview/gridview.qml highlightFollowsCurrentItem + \snippet doc/src/snippets/qtquick1/gridview/gridview.qml highlightFollowsCurrentItem */ bool QDeclarative1GridView::highlightFollowsCurrentItem() const { @@ -2748,7 +2748,7 @@ void QDeclarative1GridView::trackedPositionChanged() void QDeclarative1GridView::itemsInserted(int modelIndex, int count) { Q_D(QDeclarative1GridView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->model || !d->model->isValid()) return; int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0; @@ -2879,7 +2879,7 @@ void QDeclarative1GridView::itemsInserted(int modelIndex, int count) void QDeclarative1GridView::itemsRemoved(int modelIndex, int count) { Q_D(QDeclarative1GridView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->model || !d->model->isValid()) return; d->itemCount -= count; @@ -2979,7 +2979,7 @@ void QDeclarative1GridView::destroyRemoved() void QDeclarative1GridView::itemsMoved(int from, int to, int count) { Q_D(QDeclarative1GridView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->isValid()) return; QHash<int,FxGridItem1*> moved; diff --git a/src/qtquick1/graphicsitems/qdeclarativeimage.cpp b/src/qtquick1/graphicsitems/qdeclarativeimage.cpp index 4e2cd10218..bc301ddf6c 100644 --- a/src/qtquick1/graphicsitems/qdeclarativeimage.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativeimage.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE The following example shows the simplest usage of the Image element. - \snippet doc/src/snippets/declarative/image.qml document + \snippet doc/src/snippets/qtquick1/image.qml document \beginfloatleft \image declarative-qtlogo.png diff --git a/src/qtquick1/graphicsitems/qdeclarativeitem.cpp b/src/qtquick1/graphicsitems/qdeclarativeitem.cpp index 20b4c11f5b..b32898fe38 100644 --- a/src/qtquick1/graphicsitems/qdeclarativeitem.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativeitem.cpp @@ -201,7 +201,7 @@ QT_BEGIN_NAMESPACE rotations you must specify the axis to rotate around in addition to the origin point. The following example shows various 3D-like rotations applied to an \l Image. - \snippet doc/src/snippets/declarative/rotation.qml 0 + \snippet doc/src/snippets/qtquick1/rotation.qml 0 \image axisrotation.png @@ -434,7 +434,7 @@ void QDeclarativeItemKeyFilter::componentComplete() The following example provides key navigation for a 2x2 grid of items: - \snippet doc/src/snippets/declarative/keynavigation.qml 0 + \snippet doc/src/snippets/qtquick1/keynavigation.qml 0 The top-left item initially receives focus by setting \l {Item::}{focus} to \c true. When an arrow key is pressed, the focus will move to the @@ -821,7 +821,7 @@ void QDeclarative1KeyNavigationAttached::setFocusNavigation(QDeclarativeItem *cu from left to right by default, they are now positioned from right to left instead, as demonstrated by the numbering and opacity of the items: - \snippet doc/src/snippets/declarative/layoutmirroring.qml 0 + \snippet doc/src/snippets/qtquick1/layoutmirroring.qml 0 \image layoutmirroring.png @@ -985,13 +985,13 @@ void QDeclarativeItemPrivate::setLayoutMirror(bool mirror) be used to test for a certain key; in this case, the left cursor key: - \snippet doc/src/snippets/declarative/keys/keys-pressed.qml key item + \snippet doc/src/snippets/qtquick1/keys/keys-pressed.qml key item Some keys may alternatively be handled via specific signal properties, for example \e onSelectPressed. These handlers automatically set \e event.accepted to true. - \snippet doc/src/snippets/declarative/keys/keys-handler.qml key item + \snippet doc/src/snippets/qtquick1/keys/keys-handler.qml key item See \l{Qt::Key}{Qt.Key} for the list of keyboard codes. diff --git a/src/qtquick1/graphicsitems/qdeclarativelistview.cpp b/src/qtquick1/graphicsitems/qdeclarativelistview.cpp index c58543c735..5119c0e1fb 100644 --- a/src/qtquick1/graphicsitems/qdeclarativelistview.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativelistview.cpp @@ -446,6 +446,7 @@ public: FxListItem1 *snapItemAt(qreal pos) { FxListItem1 *snapItem = 0; + qreal prevItemSize = 0; for (int i = 0; i < visibleItems.count(); ++i) { FxListItem1 *item = visibleItems[i]; if (item->index == -1) @@ -453,8 +454,9 @@ public: qreal itemTop = item->position(); if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size() - 1) return item; - if (itemTop+item->size()/2 >= pos && itemTop-item->size()/2 < pos) + if (itemTop+item->size()/2 >= pos && itemTop-prevItemSize/2 < pos) snapItem = item; + prevItemSize = item->size(); } return snapItem; } @@ -1564,13 +1566,13 @@ void QDeclarative1ListViewPrivate::flick(AxisData &data, qreal minExtent, qreal The following example shows the definition of a simple list model defined in a file called \c ContactModel.qml: - \snippet doc/src/snippets/declarative/listview/ContactModel.qml 0 + \snippet doc/src/snippets/qtquick1/listview/ContactModel.qml 0 Another component can display this model data in a ListView, like this: - \snippet doc/src/snippets/declarative/listview/listview.qml import + \snippet doc/src/snippets/qtquick1/listview/listview.qml import \codeline - \snippet doc/src/snippets/declarative/listview/listview.qml classdocs simple + \snippet doc/src/snippets/qtquick1/listview/listview.qml classdocs simple \image listview-simple.png @@ -1581,7 +1583,7 @@ void QDeclarative1ListViewPrivate::flick(AxisData &data, qreal minExtent, qreal An improved list view is shown below. The delegate is visually improved and is moved into a separate \c contactDelegate component. - \snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced + \snippet doc/src/snippets/qtquick1/listview/listview.qml classdocs advanced \image listview-highlight.png The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property, @@ -1596,7 +1598,7 @@ void QDeclarative1ListViewPrivate::flick(AxisData &data, qreal minExtent, qreal this attached property directly as \c ListView.isCurrentItem, while the child \c contactInfo object must refer to this property as \c wrapper.ListView.isCurrentItem. - \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem + \snippet doc/src/snippets/qtquick1/listview/listview.qml isCurrentItem \note Views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary @@ -1631,7 +1633,7 @@ QDeclarative1ListView::~QDeclarative1ListView() This property may be used to adjust the appearance of the current item, for example: - \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem + \snippet doc/src/snippets/qtquick1/listview/listview.qml isCurrentItem */ /*! @@ -1680,7 +1682,7 @@ QDeclarative1ListView::~QDeclarative1ListView() The example delegate below ensures that the animation completes before the item is removed from the list. - \snippet doc/src/snippets/declarative/listview/listview.qml delayRemove + \snippet doc/src/snippets/qtquick1/listview/listview.qml delayRemove */ /*! @@ -1960,7 +1962,7 @@ void QDeclarative1ListView::setHighlight(QDeclarativeComponent *highlight) Here is a highlight with its motion defined by a \l {SpringAnimation} item: - \snippet doc/src/snippets/declarative/listview/listview.qml highlightFollowsCurrentItem + \snippet doc/src/snippets/qtquick1/listview/listview.qml highlightFollowsCurrentItem Note that the highlight animation also affects the way that the view is scrolled. This is because the view moves to maintain the @@ -3131,7 +3133,6 @@ void QDeclarative1ListView::trackedPositionChanged() qreal trackedPos = qCeil(d->trackedItem->position()); qreal trackedSize = d->trackedItem->size(); if (d->trackedItem != d->currentItem) { - trackedPos -= d->currentItem->sectionSize(); trackedSize += d->currentItem->sectionSize(); } qreal viewPos; @@ -3195,7 +3196,7 @@ void QDeclarative1ListView::trackedPositionChanged() void QDeclarative1ListView::itemsInserted(int modelIndex, int count) { Q_D(QDeclarative1ListView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->model || !d->model->isValid()) return; d->updateUnrequestedIndexes(); d->moveReason = QDeclarative1ListViewPrivate::Other; @@ -3338,7 +3339,7 @@ void QDeclarative1ListView::itemsInserted(int modelIndex, int count) void QDeclarative1ListView::itemsRemoved(int modelIndex, int count) { Q_D(QDeclarative1ListView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->model || !d->model->isValid()) return; d->moveReason = QDeclarative1ListViewPrivate::Other; d->updateUnrequestedIndexes(); @@ -3453,7 +3454,7 @@ void QDeclarative1ListView::destroyRemoved() void QDeclarative1ListView::itemsMoved(int from, int to, int count) { Q_D(QDeclarative1ListView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->isValid()) return; d->updateUnrequestedIndexes(); diff --git a/src/qtquick1/graphicsitems/qdeclarativeloader.cpp b/src/qtquick1/graphicsitems/qdeclarativeloader.cpp index 7162c31662..3b68ed4a9e 100644 --- a/src/qtquick1/graphicsitems/qdeclarativeloader.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativeloader.cpp @@ -138,7 +138,7 @@ void QDeclarative1LoaderPrivate::initResize() Here is a Loader that loads "Page1.qml" as a component when the \l MouseArea is clicked: - \snippet doc/src/snippets/declarative/loader/simple.qml 0 + \snippet doc/src/snippets/qtquick1/loader/simple.qml 0 The loaded item can be accessed using the \l item property. @@ -170,8 +170,8 @@ void QDeclarative1LoaderPrivate::initResize() \o sizeloader.qml \o sizeitem.qml \row - \o \snippet doc/src/snippets/declarative/loader/sizeloader.qml 0 - \o \snippet doc/src/snippets/declarative/loader/sizeitem.qml 0 + \o \snippet doc/src/snippets/qtquick1/loader/sizeloader.qml 0 + \o \snippet doc/src/snippets/qtquick1/loader/sizeitem.qml 0 \row \o The red rectangle will be sized to the size of the root item. \o The red rectangle will be 50x50, centered in the root item. @@ -190,8 +190,8 @@ void QDeclarative1LoaderPrivate::initResize() \o application.qml \o MyItem.qml \row - \o \snippet doc/src/snippets/declarative/loader/connections.qml 0 - \o \snippet doc/src/snippets/declarative/loader/MyItem.qml 0 + \o \snippet doc/src/snippets/qtquick1/loader/connections.qml 0 + \o \snippet doc/src/snippets/qtquick1/loader/MyItem.qml 0 \endtable Alternatively, since \c MyItem.qml is loaded within the scope of the @@ -217,8 +217,8 @@ void QDeclarative1LoaderPrivate::initResize() \o application.qml \o KeyReader.qml \row - \o \snippet doc/src/snippets/declarative/loader/focus.qml 0 - \o \snippet doc/src/snippets/declarative/loader/KeyReader.qml 0 + \o \snippet doc/src/snippets/qtquick1/loader/focus.qml 0 + \o \snippet doc/src/snippets/qtquick1/loader/KeyReader.qml 0 \endtable Once \c KeyReader.qml is loaded, it accepts key events and sets diff --git a/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp b/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp index 7f43eb1070..94f6b2a798 100644 --- a/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp @@ -226,9 +226,9 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate() The following example uses a MouseArea in a \l Rectangle that changes the \l Rectangle color to red when clicked: - \snippet doc/src/snippets/declarative/mousearea/mousearea.qml import + \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml import \codeline - \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro + \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml intro \clearfloat Many MouseArea signals pass a \l{MouseEvent}{mouse} parameter that contains @@ -238,7 +238,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate() Here is an extension of the previous example that produces a different color when the area is right clicked: - \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro-extended + \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml intro-extended \sa MouseEvent, {declarative/touchinteraction/mousearea}{MouseArea example} */ @@ -492,7 +492,7 @@ void QDeclarative1MouseArea::setPreventStealing(bool prevent) The code below displays "right" when the right mouse buttons is pressed: - \snippet doc/src/snippets/declarative/mousearea/mousearea.qml mousebuttons + \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml mousebuttons \sa acceptedButtons */ @@ -999,7 +999,7 @@ QDeclarative1Drag *QDeclarative1MouseArea::drag() The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity of the rectangle is reduced when it is dragged to the right. - \snippet doc/src/snippets/declarative/mousearea/mousearea.qml drag + \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml drag \note Items cannot be dragged if they are anchored for the requested \c drag.axis. For example, if \c anchors.left or \c anchors.right was set @@ -1010,7 +1010,7 @@ QDeclarative1Drag *QDeclarative1MouseArea::drag() If \c drag.filterChildren is set to true, a drag can override descendant MouseAreas. This enables a parent MouseArea to handle drags, for example, while descendants handle clicks: - \snippet doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml dragfilter + \snippet doc/src/snippets/qtquick1/mousearea/mouseareadragfilter.qml dragfilter */ diff --git a/src/qtquick1/graphicsitems/qdeclarativepath.cpp b/src/qtquick1/graphicsitems/qdeclarativepath.cpp index ecf9e24e2f..5b52af8469 100644 --- a/src/qtquick1/graphicsitems/qdeclarativepath.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativepath.cpp @@ -155,7 +155,7 @@ bool QDeclarative1Path::isClosed() const \i \l PathPercent - a way to spread out items along various segments of the path. \endlist - \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 2 + \snippet doc/src/snippets/qtquick1/pathview/pathattributes.qml 2 */ QDeclarativeListProperty<QDeclarative1PathElement> QDeclarative1Path::pathElements() @@ -519,7 +519,7 @@ void QDeclarative1Curve::setY(qreal y) \row \o \image declarative-pathattribute.png \o - \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 0 + \snippet doc/src/snippets/qtquick1/pathview/pathattributes.qml 0 (see the PathView documentation for the specification of ContactModel.qml used for ContactModel above.) \endtable diff --git a/src/qtquick1/graphicsitems/qdeclarativepathview.cpp b/src/qtquick1/graphicsitems/qdeclarativepathview.cpp index 2c0875b4c4..e01cf05f22 100644 --- a/src/qtquick1/graphicsitems/qdeclarativepathview.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativepathview.cpp @@ -365,11 +365,11 @@ void QDeclarative1PathViewPrivate::regenerate() For example, if there is a simple list model defined in a file \c ContactModel.qml like this: - \snippet doc/src/snippets/declarative/pathview/ContactModel.qml 0 + \snippet doc/src/snippets/qtquick1/pathview/ContactModel.qml 0 This data can be represented as a PathView, like this: - \snippet doc/src/snippets/declarative/pathview/pathview.qml 0 + \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 0 \image pathview.gif @@ -402,7 +402,7 @@ void QDeclarative1PathViewPrivate::regenerate() this attached property directly as \c PathView.isCurrentItem, while the child \c nameText object must refer to this property as \c wrapper.PathView.isCurrentItem. - \snippet doc/src/snippets/declarative/pathview/pathview.qml 1 + \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 1 \bold Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary @@ -464,7 +464,7 @@ QDeclarative1PathView::~QDeclarative1PathView() This property may be used to adjust the appearance of the current item. - \snippet doc/src/snippets/declarative/pathview/pathview.qml 1 + \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 1 */ /*! @@ -1002,7 +1002,7 @@ bool QDeclarative1PathView::isFlicking() const item in the delegate. Here is an example delegate: - \snippet doc/src/snippets/declarative/pathview/pathview.qml 1 + \snippet doc/src/snippets/qtquick1/pathview/pathview.qml 1 */ QDeclarativeComponent *QDeclarative1PathView::delegate() const { @@ -1285,6 +1285,7 @@ bool QDeclarative1PathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) return d->stealMouse; } else if (d->lastPosTime.isValid()) { d->lastPosTime.invalidate(); + d->fixOffset(); } if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) d->stealMouse = false; @@ -1309,6 +1310,22 @@ bool QDeclarative1PathView::sceneEventFilter(QGraphicsItem *i, QEvent *e) return QDeclarativeItem::sceneEventFilter(i, e); } +bool QDeclarative1PathView::sceneEvent(QEvent *event) +{ + bool rv = QDeclarativeItem::sceneEvent(event); + if (event->type() == QEvent::UngrabMouse) { + Q_D(QDeclarative1PathView); + if (d->stealMouse) { + // if our mouse grab has been removed (probably by another Flickable), + // fix our state + d->stealMouse = false; + setKeepMouseGrab(false); + d->lastPosTime.invalidate(); + } + } + return rv; +} + bool QDeclarative1PathView::event(QEvent *event) { if (event->type() == QEvent::User) { diff --git a/src/qtquick1/graphicsitems/qdeclarativepathview_p.h b/src/qtquick1/graphicsitems/qdeclarativepathview_p.h index b4897f9e1d..955951ffd1 100644 --- a/src/qtquick1/graphicsitems/qdeclarativepathview_p.h +++ b/src/qtquick1/graphicsitems/qdeclarativepathview_p.h @@ -173,6 +173,7 @@ protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *); bool sendMouseEvent(QGraphicsSceneMouseEvent *event); bool sceneEventFilter(QGraphicsItem *, QEvent *); + bool sceneEvent(QEvent *event); bool event(QEvent *event); void componentComplete(); diff --git a/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp b/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp index 7046945d27..353fbcc418 100644 --- a/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativepositioners.cpp @@ -349,7 +349,7 @@ void QDeclarative1BasePositioner::finishApplyTransitions() \image verticalpositioner_example.png - \snippet doc/src/snippets/declarative/column/vertical-positioner.qml document + \snippet doc/src/snippets/qtquick1/column/vertical-positioner.qml document \section1 Using Transitions @@ -512,7 +512,7 @@ void QDeclarative1Column::reportConflictingAnchors() \image horizontalpositioner_example.png - \snippet doc/src/snippets/declarative/row/row.qml document + \snippet doc/src/snippets/qtquick1/row/row.qml document \section1 Using Transitions @@ -743,7 +743,7 @@ void QDeclarative1Row::reportConflictingAnchors() \image gridLayout_example.png - \snippet doc/src/snippets/declarative/grid/grid.qml document + \snippet doc/src/snippets/qtquick1/grid/grid.qml document \section1 Using Transitions @@ -1129,7 +1129,7 @@ void QDeclarative1Grid::reportConflictingAnchors() \image qml-flow-snippet.png - \snippet doc/src/snippets/declarative/flow.qml flow item + \snippet doc/src/snippets/qtquick1/flow.qml flow item \section1 Using Transitions diff --git a/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp b/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp index b67536cc86..088c296a26 100644 --- a/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativerectangle.cpp @@ -147,7 +147,7 @@ void QDeclarative1GradientStop::updateGradient() with red, blending to yellow at one third of the height of the rectangle, and ending with green: - \snippet doc/src/snippets/declarative/gradient.qml code + \snippet doc/src/snippets/qtquick1/gradient.qml code \clearfloat \section1 Performance and Limitations @@ -235,7 +235,7 @@ void QDeclarative1Gradient::doUpdate() The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: - \snippet doc/src/snippets/declarative/rectangle/rectangle.qml document + \snippet doc/src/snippets/qtquick1/rectangle/rectangle.qml document \clearfloat \section1 Performance @@ -284,7 +284,7 @@ void QDeclarative1Rectangle::doUpdate() \inlineimage rect-border-width.png \enddiv - \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0 + \snippet doc/src/snippets/qtquick1/rectangle/rect-border-width.qml 0 \clearfloat Here, the innermost rectangle's border is clipped on the bottom and right edges by its @@ -308,7 +308,7 @@ QDeclarative1Pen *QDeclarative1Rectangle::border() \inlineimage declarative-rect_gradient.png \enddiv - \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles + \snippet doc/src/snippets/qtquick1/rectangle/rectangle-gradient.qml rectangles \clearfloat If both a gradient and a color are specified, the gradient will be used. @@ -379,7 +379,7 @@ void QDeclarative1Rectangle::setRadius(qreal radius) The following example shows rectangles with colors specified using hexadecimal and named color notation: - \snippet doc/src/snippets/declarative/rectangle/rectangle-colors.qml rectangles + \snippet doc/src/snippets/qtquick1/rectangle/rectangle-colors.qml rectangles \clearfloat If both a gradient and a color are specified, the gradient will be used. diff --git a/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp b/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp index cc080d10d3..ab9beb4d4d 100644 --- a/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativerepeater.cpp @@ -79,9 +79,9 @@ QDeclarative1RepeaterPrivate::~QDeclarative1RepeaterPrivate() The following Repeater creates three instances of a \l Rectangle item within a \l Row: - \snippet doc/src/snippets/declarative/repeaters/repeater.qml import + \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml import \codeline - \snippet doc/src/snippets/declarative/repeaters/repeater.qml simple + \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml simple \image repeater-simple.png @@ -96,7 +96,7 @@ QDeclarative1RepeaterPrivate::~QDeclarative1RepeaterPrivate() a Repeater to be used inside a layout. For example, the following Repeater's items are stacked between a red rectangle and a blue rectangle: - \snippet doc/src/snippets/declarative/repeaters/repeater.qml layout + \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml layout \image repeater.png @@ -242,7 +242,7 @@ void QDeclarative1Repeater::setModel(const QVariant &model) \table \row - \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index + \o \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml index \o \image repeater-index.png \endtable @@ -253,7 +253,7 @@ void QDeclarative1Repeater::setModel(const QVariant &model) \table \row - \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata + \o \snippet doc/src/snippets/qtquick1/repeaters/repeater.qml modeldata \o \image repeater-modeldata.png \endtable diff --git a/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp b/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp index 83a94ec9de..bcdf92c675 100644 --- a/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativescalegrid.cpp @@ -167,6 +167,8 @@ QDeclarative1GridScaledImage::QDeclarative1GridScaledImage(QIODevice *data) _l = l; _r = r; _t = t; _b = b; _pix = imgFile; + if (_pix.startsWith(QLatin1Char('"')) && _pix.endsWith(QLatin1Char('"'))) + _pix = _pix.mid(1, _pix.size() - 2); // remove leading/trailing quotes. } QDeclarative1BorderImage::TileMode QDeclarative1GridScaledImage::stringToRule(const QString &s) diff --git a/src/qtquick1/graphicsitems/qdeclarativetext.cpp b/src/qtquick1/graphicsitems/qdeclarativetext.cpp index 6974f73739..aad4b1e952 100644 --- a/src/qtquick1/graphicsitems/qdeclarativetext.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativetext.cpp @@ -749,7 +749,7 @@ QDeclarative1Text::~QDeclarative1Text() The link must be in rich text or HTML format and the \a link string provides access to the particular link. - \snippet doc/src/snippets/declarative/text/onLinkActivated.qml 0 + \snippet doc/src/snippets/qtquick1/text/onLinkActivated.qml 0 The example code will display the text "The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}." diff --git a/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp index c8627b9d26..5d8a3d4b37 100644 --- a/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -659,7 +659,7 @@ QDeclarative1VisualDataModelData *QDeclarative1VisualDataModelPrivate::data(QObj The example below illustrates using a VisualDataModel with a ListView. - \snippet doc/src/snippets/declarative/visualdatamodel.qml 0 + \snippet doc/src/snippets/qtquick1/visualdatamodel.qml 0 */ QDeclarative1VisualDataModel::QDeclarative1VisualDataModel() @@ -852,10 +852,10 @@ void QDeclarative1VisualDataModel::setDelegate(QDeclarativeComponent *delegate) the new directory's contents. \c main.cpp: - \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/main.cpp 0 + \snippet doc/src/snippets/qtquick1/visualdatamodel_rootindex/main.cpp 0 \c view.qml: - \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml 0 + \snippet doc/src/snippets/qtquick1/visualdatamodel_rootindex/view.qml 0 If the \l model is a QAbstractItemModel subclass, the delegate can also reference a \c hasModelChildren property (optionally qualified by a diff --git a/src/qtquick1/util/qdeclarativeanimation.cpp b/src/qtquick1/util/qdeclarativeanimation.cpp index 89b768b827..8204e33022 100644 --- a/src/qtquick1/util/qdeclarativeanimation.cpp +++ b/src/qtquick1/util/qdeclarativeanimation.cpp @@ -642,7 +642,7 @@ QAbstractAnimation *QDeclarative1PauseAnimation::qtAnimation() as a property value source. It animates the \c color property's value from its current value to a value of "red", over 1000 milliseconds: - \snippet doc/src/snippets/declarative/coloranimation.qml 0 + \snippet doc/src/snippets/qtquick1/coloranimation.qml 0 Like any other animation element, a ColorAnimation can be applied in a number of ways, including transitions, behaviors and property value @@ -757,7 +757,7 @@ void QDeclarative1ColorAnimation::setTo(const QColor &t) When used as part of a Transition, you can also target a specific StateChangeScript to run using the \c scriptName property. - \snippet doc/src/snippets/declarative/states/statechangescript.qml state and transition + \snippet doc/src/snippets/qtquick1/states/statechangescript.qml state and transition \sa StateChangeScript */ @@ -884,14 +884,14 @@ QAbstractAnimation *QDeclarative1ScriptAction::qtAnimation() \l {Image::}{smooth} property to \c true, animates the width of the image, then sets \l {Image::}{smooth} back to \c false: - \snippet doc/src/snippets/declarative/propertyaction.qml standalone + \snippet doc/src/snippets/qtquick1/propertyaction.qml standalone PropertyAction is also useful for setting the exact point at which a property change should occur during a \l Transition. For example, if PropertyChanges was used in a \l State to rotate an item around a particular \l {Item::}{transformOrigin}, it might be implemented like this: - \snippet doc/src/snippets/declarative/propertyaction.qml transition + \snippet doc/src/snippets/qtquick1/propertyaction.qml transition However, with this code, the \c transformOrigin is not set until \e after the animation, as a \l State is taken to define the values at the \e end of @@ -899,7 +899,7 @@ QAbstractAnimation *QDeclarative1ScriptAction::qtAnimation() then jump to \c Item.BottomRight. To fix this, insert a PropertyAction before the RotationAnimation begins: - \snippet doc/src/snippets/declarative/propertyaction-sequential.qml sequential + \snippet doc/src/snippets/qtquick1/propertyaction-sequential.qml sequential This immediately sets the \c transformOrigin property to the value defined in the end state of the \l Transition (i.e. the value defined in the @@ -1144,7 +1144,7 @@ void QDeclarative1PropertyAction::transition(QDeclarative1StateActions &actions, as a property value source. It animates the \c x value from its current value to a value of 50, over 1000 milliseconds: - \snippet doc/src/snippets/declarative/numberanimation.qml 0 + \snippet doc/src/snippets/qtquick1/numberanimation.qml 0 Like any other animation element, a NumberAnimation can be applied in a number of ways, including transitions, behaviors and property value @@ -1339,7 +1339,7 @@ void QDeclarative1Vector3dAnimation::setTo(QVector3D t) In the following example we use RotationAnimation to animate the rotation between states via the shortest path: - \snippet doc/src/snippets/declarative/rotationanimation.qml 0 + \snippet doc/src/snippets/qtquick1/rotationanimation.qml 0 Notice the RotationAnimation did not need to set a \l target value. As a convenience, when used in a transition, RotationAnimation will rotate all @@ -1580,7 +1580,7 @@ QDeclarativeListProperty<QDeclarative1AbstractAnimation> QDeclarative1AnimationG The following example runs two number animations in a sequence. The \l Rectangle animates to a \c x position of 50, then to a \c y position of 50. - \snippet doc/src/snippets/declarative/sequentialanimation.qml 0 + \snippet doc/src/snippets/qtquick1/sequentialanimation.qml 0 Animations defined within a \l Transition are automatically run in parallel, so SequentialAnimation can be used to enclose the animations in a \l Transition @@ -1655,7 +1655,7 @@ void QDeclarative1SequentialAnimation::transition(QDeclarative1StateActions &act The following animation runs two number animations in parallel. The \l Rectangle moves to (50,50) by animating its \c x and \c y properties at the same time. - \snippet doc/src/snippets/declarative/parallelanimation.qml 0 + \snippet doc/src/snippets/qtquick1/parallelanimation.qml 0 Like any other animation element, a ParallelAnimation can be applied in a number of ways, including transitions, behaviors and property value @@ -1772,21 +1772,21 @@ void QDeclarative1PropertyAnimationPrivate::convertVariant(QVariant &variant, in For example, to animate any objects that have changed their \c x or \c y properties as a result of a state change, using an \c InOutQuad easing curve: - \snippet doc/src/snippets/declarative/propertyanimation.qml transition + \snippet doc/src/snippets/qtquick1/propertyanimation.qml transition \o In a \l Behavior For example, to animate all changes to a rectangle's \c x property: - \snippet doc/src/snippets/declarative/propertyanimation.qml behavior + \snippet doc/src/snippets/qtquick1/propertyanimation.qml behavior \o As a property value source For example, to repeatedly animate the rectangle's \c x property: - \snippet doc/src/snippets/declarative/propertyanimation.qml propertyvaluesource + \snippet doc/src/snippets/qtquick1/propertyanimation.qml propertyvaluesource \o In a signal handler @@ -1803,7 +1803,7 @@ void QDeclarative1PropertyAnimationPrivate::convertVariant(QVariant &variant, in For example, to animate \c rect's \c width property over 500ms, from its current width to 30: - \snippet doc/src/snippets/declarative/propertyanimation.qml standalone + \snippet doc/src/snippets/qtquick1/propertyanimation.qml standalone \endlist @@ -2460,7 +2460,7 @@ void QDeclarative1PropertyAnimation::transition(QDeclarative1StateActions &actio the transition, ensures the item animates smoothly as it moves to its new parent: - \snippet doc/src/snippets/declarative/parentanimation.qml 0 + \snippet doc/src/snippets/qtquick1/parentanimation.qml 0 A ParentAnimation can contain any number of animations. These animations will be run in parallel; to run them sequentially, define them within a @@ -2818,7 +2818,7 @@ QAbstractAnimation *QDeclarative1ParentAnimation::qtAnimation() In the following snippet we animate the addition of a right anchor to a \l Rectangle: - \snippet doc/src/snippets/declarative/anchoranimation.qml 0 + \snippet doc/src/snippets/qtquick1/anchoranimation.qml 0 For convenience, when an AnchorAnimation is used in a \l Transition, it will animate any AnchorChanges that have occurred during the state change. diff --git a/src/qtquick1/util/qdeclarativebehavior.cpp b/src/qtquick1/util/qdeclarativebehavior.cpp index 02d1b0eed1..0475eea01f 100644 --- a/src/qtquick1/util/qdeclarativebehavior.cpp +++ b/src/qtquick1/util/qdeclarativebehavior.cpp @@ -86,7 +86,7 @@ public: whenever the \l Rectangle's \c width value changes. When the MouseArea is clicked, the \c width is changed, triggering the behavior's animation: - \snippet doc/src/snippets/declarative/behavior.qml 0 + \snippet doc/src/snippets/qtquick1/behavior.qml 0 Note that a property cannot have more than one assigned Behavior. To provide multiple animations within a Behavior, use ParallelAnimation or diff --git a/src/qtquick1/util/qdeclarativebind.cpp b/src/qtquick1/util/qdeclarativebind.cpp index 50514234a3..7afe848448 100644 --- a/src/qtquick1/util/qdeclarativebind.cpp +++ b/src/qtquick1/util/qdeclarativebind.cpp @@ -42,6 +42,7 @@ #include "QtQuick1/private/qdeclarativebind_p.h" #include "QtDeclarative/private/qdeclarativenullablevalue_p_p.h" +#include "QtDeclarative/private/qdeclarativeguard_p.h" #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecontext.h> @@ -65,7 +66,7 @@ public: bool when : 1; bool componentComplete : 1; - QObject *obj; + QDeclarativeGuard<QObject> obj; QString prop; QDeclarativeNullableValue<QVariant> value; }; diff --git a/src/qtquick1/util/qdeclarativelistmodel.cpp b/src/qtquick1/util/qdeclarativelistmodel.cpp index 520d9ac388..d5aa75bec5 100644 --- a/src/qtquick1/util/qdeclarativelistmodel.cpp +++ b/src/qtquick1/util/qdeclarativelistmodel.cpp @@ -115,7 +115,7 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis \inlineimage listmodel.png \enddiv - \snippet doc/src/snippets/declarative/listmodel.qml 0 + \snippet doc/src/snippets/qtquick1/listmodel.qml 0 \clearfloat Roles (properties) in each element must begin with a lower-case letter and @@ -125,14 +125,14 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis Since the example model contains an \c id property, it can be referenced by views, such as the ListView in this example: - \snippet doc/src/snippets/declarative/listmodel-simple.qml 0 + \snippet doc/src/snippets/qtquick1/listmodel-simple.qml 0 \dots 8 - \snippet doc/src/snippets/declarative/listmodel-simple.qml 1 + \snippet doc/src/snippets/qtquick1/listmodel-simple.qml 1 It is possible for roles to contain list data. In the following example we create a list of fruit attributes: - \snippet doc/src/snippets/declarative/listmodel-nested.qml model + \snippet doc/src/snippets/qtquick1/listmodel-nested.qml model The delegate displays all the fruit attributes: @@ -140,7 +140,7 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis \inlineimage listmodel-nested.png \enddiv - \snippet doc/src/snippets/declarative/listmodel-nested.qml delegate + \snippet doc/src/snippets/qtquick1/listmodel-nested.qml delegate \clearfloat \section1 Modifying List Models @@ -148,7 +148,7 @@ QDeclarative1ListModelParser::ListInstruction *QDeclarative1ListModelParser::Lis The content of a ListModel may be created and modified using the clear(), append(), set(), insert() and setProperty() methods. For example: - \snippet doc/src/snippets/declarative/listmodel-modify.qml delegate + \snippet doc/src/snippets/qtquick1/listmodel-modify.qml delegate Note that when creating content dynamically the set of available properties cannot be changed once set. Whatever properties are first added to the model @@ -905,12 +905,12 @@ bool QDeclarative1ListModelParser::definesEmptyList(const QString &s) The following model defines a series of list elements, each of which contain "name" and "cost" roles and their associated values. - \snippet doc/src/snippets/declarative/qml-data-models/listelements.qml model + \snippet doc/src/snippets/qtquick1/qml-data-models/listelements.qml model The delegate obtains the name and cost for each element by simply referring to \c name and \c cost: - \snippet doc/src/snippets/declarative/qml-data-models/listelements.qml view + \snippet doc/src/snippets/qtquick1/qml-data-models/listelements.qml view \sa ListModel */ diff --git a/src/qtquick1/util/qdeclarativepropertychanges.cpp b/src/qtquick1/util/qdeclarativepropertychanges.cpp index 5882fc5810..776701e58f 100644 --- a/src/qtquick1/util/qdeclarativepropertychanges.cpp +++ b/src/qtquick1/util/qdeclarativepropertychanges.cpp @@ -80,9 +80,9 @@ QT_BEGIN_NAMESPACE properties are to be modified, and define the new property values or bindings. For example: - \snippet doc/src/snippets/declarative/propertychanges.qml import + \snippet doc/src/snippets/qtquick1/propertychanges.qml import \codeline - \snippet doc/src/snippets/declarative/propertychanges.qml 0 + \snippet doc/src/snippets/qtquick1/propertychanges.qml 0 When the mouse is pressed, the \l Rectangle changes to the \e resized state. In this state, the PropertyChanges object sets the rectangle's @@ -116,7 +116,7 @@ QT_BEGIN_NAMESPACE state, its \c width property is reset, giving the text its natural width and displaying the whole string on a single line. - \snippet doc/src/snippets/declarative/propertychanges.qml reset + \snippet doc/src/snippets/qtquick1/propertychanges.qml reset \section2 Immediate property changes in transitions diff --git a/src/qtquick1/util/qdeclarativesmoothedanimation.cpp b/src/qtquick1/util/qdeclarativesmoothedanimation.cpp index 0bad1a416b..7e96fe6a1c 100644 --- a/src/qtquick1/util/qdeclarativesmoothedanimation.cpp +++ b/src/qtquick1/util/qdeclarativesmoothedanimation.cpp @@ -269,7 +269,7 @@ void QSmoothedAnimation_1::init() bound to those of the red rectangle. Whenever these values change, the green rectangle smoothly animates to its new position: - \snippet doc/src/snippets/declarative/smoothedanimation.qml 0 + \snippet doc/src/snippets/qtquick1/smoothedanimation.qml 0 A SmoothedAnimation can be configured by setting the \l velocity at which the animation should occur, or the \l duration that the animation should take. diff --git a/src/qtquick1/util/qdeclarativespringanimation.cpp b/src/qtquick1/util/qdeclarativespringanimation.cpp index d6dd68c4c6..155f7bb08f 100644 --- a/src/qtquick1/util/qdeclarativespringanimation.cpp +++ b/src/qtquick1/util/qdeclarativespringanimation.cpp @@ -254,7 +254,7 @@ void QDeclarative1SpringAnimationPrivate::updateMode() on the \c x and \c y values indicates that whenever these values are changed, a SpringAnimation should be applied. - \snippet doc/src/snippets/declarative/springanimation.qml 0 + \snippet doc/src/snippets/qtquick1/springanimation.qml 0 Like any other animation element, a SpringAnimation can be applied in a number of ways, including transitions, behaviors and property value diff --git a/src/qtquick1/util/qdeclarativestate.cpp b/src/qtquick1/util/qdeclarativestate.cpp index 6d96f8d1f7..1be3395c5a 100644 --- a/src/qtquick1/util/qdeclarativestate.cpp +++ b/src/qtquick1/util/qdeclarativestate.cpp @@ -151,7 +151,7 @@ QDeclarative1StateOperation::QDeclarative1StateOperation(QObjectPrivate &dd, QOb between the default state and the "clicked" state, thus toggling the color of the rectangle between black and red. - \snippet doc/src/snippets/declarative/state.qml 0 + \snippet doc/src/snippets/qtquick1/state.qml 0 Notice the default state is referred to using an empty string (""). @@ -217,7 +217,7 @@ bool QDeclarative1State::isWhenKnown() const be applied. For example, the following \l Rectangle changes in and out of the "hidden" state when the \l MouseArea is pressed: - \snippet doc/src/snippets/declarative/state-when.qml 0 + \snippet doc/src/snippets/qtquick1/state-when.qml 0 If multiple states in a group have \c when clauses that evaluate to \c true at the same time, the first matching state will be applied. For example, in diff --git a/src/qtquick1/util/qdeclarativestategroup.cpp b/src/qtquick1/util/qdeclarativestategroup.cpp index 60ca08ca17..539fbbadab 100644 --- a/src/qtquick1/util/qdeclarativestategroup.cpp +++ b/src/qtquick1/util/qdeclarativestategroup.cpp @@ -385,7 +385,11 @@ QDeclarative1Transition *QDeclarative1StateGroupPrivate::findTransition(const QS QStringList toState; fromState = t->fromState().split(QLatin1Char(',')); + for (int jj = 0; jj < fromState.count(); ++jj) + fromState[jj] = fromState.at(jj).trimmed(); toState = t->toState().split(QLatin1Char(',')); + for (int jj = 0; jj < toState.count(); ++jj) + toState[jj] = toState.at(jj).trimmed(); if (ii == 1) qSwap(fromState, toState); int tScore = 0; diff --git a/src/qtquick1/util/qdeclarativestateoperations.cpp b/src/qtquick1/util/qdeclarativestateoperations.cpp index 37ebe3e248..7d57083c59 100644 --- a/src/qtquick1/util/qdeclarativestateoperations.cpp +++ b/src/qtquick1/util/qdeclarativestateoperations.cpp @@ -189,7 +189,7 @@ void QDeclarative1ParentChangePrivate::doChange(QDeclarativeItem *targetParent, When the \c blueRect is clicked, it changes to the "reparented" state: its parent is changed to \c redRect and it is positioned at (10, 10) within the red rectangle, as specified in the ParentChange. - \snippet doc/src/snippets/declarative/parentchange.qml 0 + \snippet doc/src/snippets/qtquick1/parentchange.qml 0 \image parentchange.png @@ -703,7 +703,7 @@ QString QDeclarative1StateChangeScript::typeName() const using AnchorChanges, and the top and bottom anchor margins using PropertyChanges: - \snippet doc/src/snippets/declarative/anchorchanges.qml 0 + \snippet doc/src/snippets/qtquick1/anchorchanges.qml 0 \image anchorchanges.png diff --git a/src/qtquick1/util/qdeclarativesystempalette.cpp b/src/qtquick1/util/qdeclarativesystempalette.cpp index 7f0dde3a93..a026c5f805 100644 --- a/src/qtquick1/util/qdeclarativesystempalette.cpp +++ b/src/qtquick1/util/qdeclarativesystempalette.cpp @@ -79,7 +79,7 @@ public: group and uses this to color the window and text items appropriately: - \snippet doc/src/snippets/declarative/systempalette.qml 0 + \snippet doc/src/snippets/qtquick1/systempalette.qml 0 \sa QPalette */ diff --git a/src/qtquick1/util/qdeclarativetransition.cpp b/src/qtquick1/util/qdeclarativetransition.cpp index 8498f6c4e2..235db8b483 100644 --- a/src/qtquick1/util/qdeclarativetransition.cpp +++ b/src/qtquick1/util/qdeclarativetransition.cpp @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE changes between the default and the "moved" state, any changes to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad. - \snippet doc/src/snippets/declarative/transition.qml 0 + \snippet doc/src/snippets/qtquick1/transition.qml 0 Notice the example does not require \l{PropertyAnimation::}{to} and \l{PropertyAnimation::}{from} values for the NumberAnimation. As a convenience, @@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE To define multiple transitions, specify \l Item::transitions as a list: - \snippet doc/src/snippets/declarative/transitions-list.qml list of transitions + \snippet doc/src/snippets/qtquick1/transitions-list.qml list of transitions If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular state change. In the example above, when changing to \c state1, the first transition will be used, rather @@ -238,15 +238,17 @@ void QDeclarative1Transition::prepare(QDeclarative1StateOperation::ActionList &a properties, so the animation is always applied when changing between the two states (i.e. when the mouse is pressed and released). - \snippet doc/src/snippets/declarative/transition-from-to.qml 0 + \snippet doc/src/snippets/qtquick1/transition-from-to.qml 0 If the transition was changed to this: - \snippet doc/src/snippets/declarative/transition-from-to-modified.qml modified transition + \snippet doc/src/snippets/qtquick1/transition-from-to-modified.qml modified transition The animation would only be applied when changing from the default state to the "brighter" state (i.e. when the mouse is pressed, but not on release). + Multiple \c to and \from values can be set by using a comma-separated string. + \sa reversible */ QString QDeclarative1Transition::fromState() const @@ -283,7 +285,7 @@ void QDeclarative1Transition::setFromState(const QString &f) transition applies a sequential animation when the mouse is pressed, and reverses the sequence of the animation when the mouse is released: - \snippet doc/src/snippets/declarative/transition-reversible.qml 0 + \snippet doc/src/snippets/qtquick1/transition-reversible.qml 0 If the transition did not set the \c to and \c reversible values, then on the mouse release, the transition would play the PropertyAnimation @@ -332,7 +334,7 @@ void QDeclarative1Transition::setToState(const QString &t) The top-level animations are run in parallel. To run them sequentially, define them within a SequentialAnimation: - \snippet doc/src/snippets/declarative/transition-reversible.qml sequential animations + \snippet doc/src/snippets/qtquick1/transition-reversible.qml sequential animations */ QDeclarativeListProperty<QDeclarative1AbstractAnimation> QDeclarative1Transition::animations() { diff --git a/src/qtquick1/util/qdeclarativexmllistmodel.cpp b/src/qtquick1/util/qdeclarativexmllistmodel.cpp index 8beb5d2a94..2450534174 100644 --- a/src/qtquick1/util/qdeclarativexmllistmodel.cpp +++ b/src/qtquick1/util/qdeclarativexmllistmodel.cpp @@ -115,13 +115,13 @@ typedef QPair<int, int> QDeclarative1XmlListRange; For example, if there is an XML document like this: - \quotefile doc/src/snippets/declarative/xmlrole.xml + \quotefile doc/src/snippets/qtquick1/xmlrole.xml Here are some valid XPath expressions for XmlRole queries on this document: - \snippet doc/src/snippets/declarative/xmlrole.qml 0 + \snippet doc/src/snippets/qtquick1/xmlrole.qml 0 \dots 4 - \snippet doc/src/snippets/declarative/xmlrole.qml 1 + \snippet doc/src/snippets/qtquick1/xmlrole.qml 1 See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information. */ |