summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-05-01 01:07:52 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-05-01 01:07:52 (GMT)
commit94dff487709583068bdc002a955cf5b423cae614 (patch)
tree7c27e546986c478de9ac7d8fc8b5b481acddde09
parentdae1a84e571691e32147e7d1699e161693dbfee1 (diff)
downloadQt-94dff487709583068bdc002a955cf5b423cae614.zip
Qt-94dff487709583068bdc002a955cf5b423cae614.tar.gz
Qt-94dff487709583068bdc002a955cf5b423cae614.tar.bz2
More format conversion.
-rw-r--r--doc/src/declarative/pics/repeater.pngbin0 -> 800 bytes
-rw-r--r--doc/src/snippets/declarative/repeater.qml12
-rw-r--r--src/declarative/fx/qfxflickable.cpp29
-rw-r--r--src/declarative/fx/qfxrepeater.cpp31
4 files changed, 44 insertions, 28 deletions
diff --git a/doc/src/declarative/pics/repeater.png b/doc/src/declarative/pics/repeater.png
new file mode 100644
index 0000000..973df27
--- /dev/null
+++ b/doc/src/declarative/pics/repeater.png
Binary files differ
diff --git a/doc/src/snippets/declarative/repeater.qml b/doc/src/snippets/declarative/repeater.qml
new file mode 100644
index 0000000..c8f9f18
--- /dev/null
+++ b/doc/src/snippets/declarative/repeater.qml
@@ -0,0 +1,12 @@
+//! [0]
+Rect { width: 220; height: 20; color: "white"
+ Component { id: Dot
+ Rect { width: 20; height: 20; radius: 10; color: "green" }
+ }
+ HorizontalLayout {
+ Rect { width: 10; height: 20; color: "red" }
+ Repeater { component: Dot; dataSource: 10 }
+ Rect { width: 10; height: 20; color: "blue" }
+ }
+}
+//! [0]
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index 671d65d..17e44e1 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -232,9 +232,10 @@ QML_DEFINE_TYPE(QFxFlickable,Flickable);
Flickable places its children on a surface that can be dragged and flicked.
\code
- <Flickable width="200" height="200" viewportWidth="{image.width}" viewportHeight="{image.height}">
- <Image id="image" file="bigimage.png"/>
- </Flickable>
+ Flickable {
+ width: 200; height: 200; viewportWidth: image.width; viewportHeight: image.height
+ Image { id: image; source: "bigimage.png" }
+ }
\endcode
\image flickable.gif
@@ -257,9 +258,10 @@ QML_DEFINE_TYPE(QFxFlickable,Flickable);
QFxFlickable allows its children to be dragged and flicked.
\code
-<Flickable width="320" height="480" viewportWidth="{image.width}" viewportHeight="{image.height}">
- <Image id="image" file="bigimage.png"/>
-</Flickable>
+Flickable {
+ width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height
+ Image { id: image; source: "bigimage.png" }
+}
\endcode
Note that QFxFlickable does not automatically clip its contents. If
@@ -475,9 +477,11 @@ bool QFxFlickable::isAtYBeginning() const
These properties are typically used to draw a scrollbar, for example:
\code
- <Rect opacity="0.5" anchors.right="{MyListView.right-2}" width="6"
- y="{MyListView.pageYPosition * MyListView.height}"
- height="{MyListView.pageHeight * MyListView.height}"/>
+ Rect {
+ opacity: 0.5; anchors.right: MyListView.right-2; width: 6
+ y: MyListView.pageYPosition * MyListView.height
+ height: MyListView.pageHeight * MyListView.height
+ }
\endcode
*/
qreal QFxFlickable::pageWidth() const
@@ -879,9 +883,10 @@ void QFxFlickable::setOverShoot(bool o)
should be set to the combined size of the items placed in the Flickable.
\code
- <Flickable width="320" height="480" viewportWidth="{image.width}" viewportHeight="{image.height}">
- <Image id="image" file="bigimage.png"/>
- </Flickable>
+ Flickable {
+ width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height
+ Image { id: image; source: "bigimage.png" }
+ }
\endcode
*/
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index 7ee949d..f9fc878 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -99,14 +99,9 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater);
the instantiated items would visually appear stacked between the red and
blue rectangles.
- \code
- <Item>
- <Rect width="100" height="100" color="red" />
- <Repeater ...repeater arguments... />
- <!-- Instantiated items would appear here -->
- <Rect width="100" height="100" color="blue" />
- </Item>
- \endcode
+ \snippet doc/src/snippets/declarative/repeater.qml 0
+
+ \image repeater.png
The repeater instance continues to own all items it instantiates, even
if they are otherwise manipulated. It is illegal to manually remove an item
@@ -144,14 +139,7 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater);
the instantiated items would visually appear stacked between the red and
blue rectangles.
- \code
- <Item>
- <Rect width="100" height="100" color="red" />
- <Repeater ...repeater arguments... />
- <!-- Instantiated items would appear here -->
- <Rect width="100" height="100" color="blue" />
- </Item>
- \endcode
+ \snippet doc/src/snippets/declarative/repeater.qml 0
The QFxRepeater instance continues to own all items it instantiates, even
if they are otherwise manipulated. It is illegal to manually delete an item
@@ -191,6 +179,17 @@ QFxRepeater::~QFxRepeater()
\qmlproperty any Repeater::dataSource
The Repeater's data source.
+
+ The data source may be either an object list, a string list or a Qt model.
+ In each case, the data element and the index is exposed to each instantiated
+ component. The index is always exposed as an accessible \c index property.
+ In the case of an object or string list, the data element (of type string
+ or object) is available as the \c modelData property. In the case of a Qt model,
+ all roles are available as named properties just like in the view classes.
+
+ As a special case the data source can also be merely a number. In this case it will
+ create that many instances of the component. They will also be assigned an index
+ based on the order they are created.
*/
/*!