summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-05-01 00:53:02 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-05-01 00:53:02 (GMT)
commit09be36905f81923e665743520b93a24af0ec784d (patch)
tree0f829c546055f23a1e083237e609a7305ae1ff1e /src
parent020f86805e2f3f9fa8e069c3a0ae04ef4a6d57cd (diff)
parentdae1a84e571691e32147e7d1699e161693dbfee1 (diff)
downloadQt-09be36905f81923e665743520b93a24af0ec784d.zip
Qt-09be36905f81923e665743520b93a24af0ec784d.tar.gz
Qt-09be36905f81923e665743520b93a24af0ec784d.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfximage.cpp25
-rw-r--r--src/declarative/fx/qfxpath.cpp90
-rw-r--r--src/declarative/fx/qfxpathview.cpp30
3 files changed, 51 insertions, 94 deletions
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index dded48c..1361d68 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -68,28 +68,27 @@ QML_DEFINE_TYPE(QFxImage,Image);
\o \image declarative-qtlogo1.png
\o Untransformed
\code
- <Image src="pics/qtlogo.png"/>
+ Image { source: "pics/qtlogo.png" }
\endcode
\row
\o \image declarative-qtlogo2.png
\o Stretched
\code
- <Image width="160" height="160" src="pics/qtlogo.png"/>
+ Image { width: 160; height: 160; source: "pics/qtlogo.png" }
\endcode
\row
\o \image declarative-qtlogo4.png
\o Grid-scaled
\code
- <Image scaleGrid.left="20" scaleGrid.right="10"
- scaleGrid.top="14" scaleGrid.bottom="14"
- width="160" height="160" src="pics/qtlogo.png"/>
+ Image { scaleGrid.left: 20; scaleGrid.right: 10
+ scaleGrid.top: 14; scaleGrid.bottom: 14
+ width: 160; height: 160; source: "pics/qtlogo.png" }
\endcode
\row
\o \image declarative-qtlogo3.png
\o Tiled
\code
- <Image tile="true"
- width="160" height="160" src="pics/qtlogo.png"/>
+ Image { tile: true; width: 160; height: 160; source: "pics/qtlogo.png" }
\endcode
\endtable
*/
@@ -103,7 +102,7 @@ QML_DEFINE_TYPE(QFxImage,Image);
Example:
\code
- <Image src="pics/star.png"/>
+ Image { source: "pics/star.png" }
\endcode
A QFxImage object can be instantiated in Qml using the tag \l Image.
@@ -200,11 +199,11 @@ QFxScaleGrid *QFxImage::scaleGrid()
of unscaled tiles, clipped to the size of the Image.
\code
- <Item>
- <Image src="tile.png" />
- <Image x="80" width="100" height="100" src="tile.png" />
- <Image x="190" width="100" height="100" tile="true" src="tile.png" />
- </Item>
+ Item {
+ Image { source: "tile.png" }
+ Image { x: 80; width: 100; height: 100; src: "tile.png" }
+ Image { x: 190; width: 100; height: 100; tile: true; src: "tile.png" }
+ }
\endcode
\image declarative-image_tile.png
diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp
index f08671d..26aa10e 100644
--- a/src/declarative/fx/qfxpath.cpp
+++ b/src/declarative/fx/qfxpath.cpp
@@ -164,16 +164,7 @@ void QFxPath::setStartY(qreal y)
\i \l PathPercent - a way to spread out items along various segments of the path.
\endlist
- \code
- <Path startX="240" startY="350">
- <PathAttribute name="scale" value="1.0"/>
- <PathAttribute name="opacity" value="1"/>
- <PathQuad x="240" y="150" controlX="660" controlY="250"/>
- <PathAttribute name="scale" value="0.1"/>
- <PathAttribute name="opacity" value="-0.5"/>
- <PathCubic x="240" y="350" control1X="-180" control1Y="250" control2X="0" control2Y="25"/>
- </Path>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 2
*/
QList<QFxPathElement *>* QFxPath::pathElements()
@@ -493,31 +484,15 @@ void QFxCurve::setY(qreal y)
an attribute at any particular point is interpolated from the PathAttributes
bounding the point.
- The example below shows a path with the items scaled to 10% at the ends of
- the path and scaled 100% along the PathLine in the middle. Note the use
- of the PathView.scale attached property to set the scale of the delegate.
+ The example below shows a path with the items scaled to 30% with opacity 50%
+ at the top of the path and scaled 100% with opacity 100% at the bottom.
+ Note the use of the PathView.scale and PathView.opacity attached properties
+ to set the scale and opacity of the delegate.
\table
\row
\o \image declarative-pathattribute.png
\o
- \code
- <Component id="Delegate">
- <Rect id="Wrapper" width="20" height="20" scale="{PathView.scale}" color="steelblue"/>
- </Component>
- <PathView width="200" height="100" model="{Model}" delegate="{Delegate}">
- <path>
- <Path startX="20" startY="0">
- <PathAttribute name="scale" value="0.1"/>
- <PathQuad x="50" y="80" controlX="0" controlY="80"/>
- <PathAttribute name="scale" value="1"/>
- <PathLine x="150" y="80"/>
- <PathAttribute name="scale" value="1"/>
- <PathQuad x="180" y="0" controlX="200" controlY="80"/>
- <PathAttribute name="scale" value="0.1"/>
- </Path>
- </path>
- </PathView>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 0
\endtable
\sa Path
@@ -583,9 +558,10 @@ void QFxPathAttribute::setValue(qreal value)
0,100 to 200,100:
\code
- <Path startX="0" startY="100">
- <PathLine x="200" y="100"/>
- </Path>
+ Path {
+ startX: 0; startY: 100
+ PathLine { x: 200; y: 100 }
+ }
\endcode
\sa Path, PathQuad, PathCubic
@@ -624,9 +600,10 @@ void QFxPathLine::addToPath(QPainterPath &path)
\o \image declarative-pathquad.png
\o
\code
- <Path startX="0" startY="0">
- <PathQuad x="200" y="0" controlX="100" controlY="150"/>
- </Path>
+ Path {
+ startX: 0; startY: 0
+ PathQuad x: 200; y: 0; controlX: 100; controlY: 150 }
+ }
\endcode
\endtable
@@ -707,10 +684,13 @@ void QFxPathQuad::addToPath(QPainterPath &path)
\o \image declarative-pathcubic.png
\o
\code
- <Path startX="20" startY="0">
- <PathCubic x="180" y="0" control1X="-10" control1Y="90"
- control2X="210" control2Y="90"/>
- </Path>
+ Path {
+ startX: 20; startY: 0
+ PathCubic {
+ x: 180; y: 0; control1X: -10; control1Y: 90
+ control2X: 210; control2Y: 90
+ }
+ }
\endcode
\endtable
@@ -834,24 +814,26 @@ void QFxPathCubic::addToPath(QPainterPath &path)
\o \image declarative-nopercent.png
\o
\code
- <Path startX="20" startY="0">
- <PathQuad x="50" y="80" controlX="0" controlY="80"/>
- <PathLine x="150" y="80"/>
- <PathQuad x="180" y="0" controlX="200" controlY="80"/>
- </Path>
+ Path {
+ startX: 20; startY: 0
+ PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }
+ PathLine { x: 150; y: 80 }
+ PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }
+ }
\endcode
\row
\o \image declarative-percent.png
\o
\code
- <Path startX="20" startY="0">
- <PathQuad x="50" y="80" controlX="0" controlY="80"/>
- <PathPercent value=".25"/>
- <PathLine x="150" y="80"/>
- <PathPercent value=".75"/>
- <PathQuad x="180" y="0" controlX="200" controlY="80"/>
- <PathPercent value="1"/>
- </Path>
+ Path {
+ startX: 20; startY: 0
+ PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }
+ PathPercent { value: 0.25 }
+ PathLine { x: 150; y: 80 }
+ PathPercent { value: 0.75 }
+ PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }
+ PathPercent { value: 1 }
+ }
\endcode
\endtable
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index a2ea8ee..810a359 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -41,7 +41,6 @@
#include <math.h>
#include <QDebug>
-#include <QPen>
#include <QEvent>
#include "qmlbindablevalue.h"
#include "qmlstate.h"
@@ -51,7 +50,6 @@
#include "qfxpathview.h"
#include "qfxpathview_p.h"
#include <QGraphicsSceneEvent>
-#include <QTimer>
static const int FlickThreshold = 5;
@@ -103,13 +101,7 @@ private:
The items are laid out along a path defined by a \l Path and may be flicked to scroll.
- \code
- <PathView id="pathview" delegate="{contactDelegate}">
- <resources><Component id="contactDelegate">...</Component></resources>
- <model>...</model>
- <path>...</path>
- </PathView>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 0
\image pathview.gif
@@ -320,23 +312,7 @@ void QFxPathView::setDragMargin(qreal dragMargin)
The delegate provides a template describing what each item in the view should look and act like.
Here is an example delegate:
- \code
- <PathView delegate="{contactDelegate}" ...>
- <resources>
- <Component id="contactDelegate">
- <Item id="wrapper" scale="{PathView.sc}" opacity="{PathView.op}" z="{PathView.z}">
- <Image id="pic" width="100" height="100" file="{portrait}"
- anchors.horizontalCenter="{parent.horizontalCenter}"/>
- <Text id="name" text="{firstName + ' ' + lastName}"
- font.size="20"
- anchors.top="{pic.bottom}" anchors.topMargin="5"
- anchors.horizontalCenter="{parent.horizontalCenter}"/>
- </Item>
- </Component>
- </resources>
- ...
- </PathView>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
*/
/*!
@@ -682,7 +658,7 @@ void QFxPathView::itemsInserted(int modelIndex, int count)
{
//XXX support animated insertion
Q_D(QFxPathView);
- if (d->pathItems == -1 || d->items.count() < d->pathItems) {
+ if (d->pathItems == -1) {
for (int i = 0; i < count; ++i) {
QFxItem *item = d->model->item(modelIndex + i);
item->setZ(modelIndex + i);