summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxkeyactions.cpp10
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp32
-rw-r--r--src/declarative/fx/qfxrect.cpp36
3 files changed, 31 insertions, 47 deletions
diff --git a/src/declarative/fx/qfxkeyactions.cpp b/src/declarative/fx/qfxkeyactions.cpp
index d2739ea..52a013a 100644
--- a/src/declarative/fx/qfxkeyactions.cpp
+++ b/src/declarative/fx/qfxkeyactions.cpp
@@ -245,7 +245,7 @@ void QFxKeyActions::setEnabled(bool e)
The following example sets actions for the 'c' and 'x' keys.
\code
- <KeyActions keyC="print('c is for cookie')" keyX="print('I like cookies')" />
+ KeyActions { keyC: "print('c is for cookie')"; keyX: "print('I like cookies')" }
\endcode
*/
QString QFxKeyActions::key_A() const
@@ -519,7 +519,7 @@ void QFxKeyActions::setKey_Z(const QString &s)
The following example sets actions for the left and right arrow keys.
\code
- <KeyActions leftArrow="print('You pressed left')" rightArrow="print('You pressed right')" />
+ KeyActions { leftArrow: "print('You pressed left')"; rightArrow: "print('You pressed right')" }
\endcode
*/
@@ -570,7 +570,7 @@ void QFxKeyActions::setKey_Down(const QString &s)
The following example sets actions for the '5' and '6' keys.
\code
- <KeyActions digit5="print('5 is a prime number')" digit6="print('6 is a composite number')" />
+ KeyActions { digit5: "print('5 is a prime number')"; digit6: "print('6 is a composite number')"; focus: true }
\endcode
*/
@@ -745,7 +745,7 @@ void QFxKeyActions::setKey_Space(const QString &s)
The following example sets an action for the space key.
\code
- <KeyActions space="print('Space pressed')" />
+ KeyActions { space: "print('Space pressed')" }
\endcode
*/
@@ -766,7 +766,7 @@ void QFxKeyActions::setKey_Space(const QString &s)
The following example sets an action for the hangup key.
\code
- <KeyActions hangup="print('Go away now')" />
+ KeyActions { hangup: "print('Go away now')" }
\endcode
*/
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index d197c9a..3b318e3 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -148,12 +148,11 @@ void QFxDrag::setYmax(int m)
\brief The MouseRegion element enables simple mouse handling.
\inherits Item
- A MouseRegion is typically used in conjunction with a visible element, where the MouseRegion effectively 'proxies' mouse handling for that element. For example, we can put a MouseRegion in a Rect that changes the Rect color to red when clicked:
- \code
- <Rect width="100" height="100">
- <MouseRegion anchors.fill="{parent}" onClick="parent.color = 'red';"/>
- </Rect>
- \endcode
+ A MouseRegion is typically used in conjunction with a visible element,
+ where the MouseRegion effectively 'proxies' mouse handling for that
+ element. For example, we can put a MouseRegion in a Rect that changes
+ the Rect color to red when clicked:
+ \snippet doc/src/snippets/declarative/mouseregion.qml 0
Many MouseRegion signals pass a \l {MouseEvent}{mouse} parameter that contains
additional information about the mouse event, such as the position, button,
@@ -161,11 +160,7 @@ void QFxDrag::setYmax(int m)
Below we have the previous
example extended so as to give a different color when you right click.
- \code
- <Rect width="100" height="100">
- <MouseRegion anchors.fill="{parent}" onClick="if (mouse.button==Qt.RightButton) { parent.color='blue';} else { parent.color = 'red';}"/>
- </Rect>
- \endcode
+ \snippet doc/src/snippets/declarative/mouseregion.qml 1
For basic key handling, see \l KeyActions.
@@ -578,19 +573,8 @@ QFxDrag *QFxMouseRegion::drag()
\i the min and max properties limit how far the target can be dragged along the corresponding axes.
\endlist
- The following example uses drag to blur an image as it moves to the right:
- \code
- <Item id="blurtest" width="600" height="200">
- <Image id="pic" file="pic.png" anchors.verticalCenter="{parent.verticalCenter}" >
- <filter><Blur radius="{pic.x/10}"/></filter>
- <MouseRegion anchors.fill="{parent}"
- drag.target="{pic}"
- drag.axis="x"
- drag.xmin="0"
- drag.xmax="{blurtest.width-pic.width}" />
- </Image>
- </Item>
- \endcode
+ The following example uses drag to reduce the opacity of an image as it moves to the right:
+ \snippet doc/src/snippets/declarative/drag.qml 0
*/
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index 2bfc149..8aaddba 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -54,7 +54,7 @@ QML_DEFINE_TYPE(QFxPen,Pen);
Example:
\code
- <Rect pen.width="2" pen.color="red".../>
+ Rect { pen.width: 2; pen.color: "red" ... }
\endcode
*/
@@ -73,11 +73,11 @@ QML_DEFINE_TYPE(QFxPen,Pen);
or as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords}{SVG color keyword name}
(as defined by the World Wide Web Consortium). For example:
\code
- <!-- rect with green border using hexidecimal notation -->
- <Rect pen.color="#00FF00" .../>
+ // rect with green border using hexidecimal notation
+ Rect { pen.color: "#00FF00" }
- <!-- rect with steelblue border using SVG color name-->
- <Rect pen.color="steelblue" .../>
+ // rect with steelblue border using SVG color name
+ Rect { pen.color: "steelblue" }
\endcode
For the full set of ways to specify color, see Qt's QColor::setNamedColor documentation.
@@ -102,7 +102,7 @@ QML_DEFINE_TYPE(QFxRect,Rect);
A Rect is painted having a solid fill (color) and an optional border (pen). You can also create rounded rectangles using the radius property.
\code
- <Rect width="100" height="100" color="red" pen.color="black" pen.width="5" radius="10"/>
+ Rect { width: 100; height: 100; color: "red"; pen.color: "black"; pen.width: 5; radius: 10 }
\endcode
\image declarative-rect.png
@@ -116,7 +116,7 @@ QML_DEFINE_TYPE(QFxRect,Rect);
A Rect is painted having a solid fill (color) and an optional border (pen). You can also create rounded rectangles using the radius property.
\code
- <Rect width="100" height="100" color="red" pen.color="black" pen.width="5" radius="10"/>
+ Rect { width: 100; height: 100; color: "red"; pen.color: "black"; pen.width: 5; radius: 10 }
\endcode
\image declarative-rect.png
@@ -217,11 +217,11 @@ void QFxRect::dump(int depth)
This property holds the color used to fill the rect.
\code
- <!-- green rect using hexidecimal notation -->
- <Rect color="#00FF00" .../>
+ // green rect using hexidecimal notation
+ Rect { color: "#00FF00" }
- <!-- steelblue rect using SVG color name-->
- <Rect color="steelblue" .../>
+ // steelblue rect using SVG color name
+ Rect { color: "steelblue" }
\endcode
*/
@@ -260,8 +260,8 @@ void QFxRect::setColor(const QColor &c)
This color will be drawn over the rect's color when the rect is painted. The tint color should usually be mostly transparent, or you will not be able to see the underlying color. The below example provides a slight red tint by having the tint color be pure red which is only 1/16th opaque.
\code
- <Rect x="0" width="80" height="80" color="lightsteelblue"/>
- <Rect x="100" width="80" height="80" color="lightsteelblue" tintColor="#10FF0000"/>
+ Rect { x: 0; width: 80; height: 80; color: "lightsteelblue" }
+ Rect { x: 100; width: 80; height: 80; color: "lightsteelblue"; tintColor: "#10FF0000" }
\endcode
\image declarative-rect_tint.png
@@ -321,11 +321,11 @@ QColor QFxRectPrivate::getColor()
This property allows for the easy construction of simple horizontal gradients. Other gradients may by formed by adding rotation to the rect. The gradient will blend linearly from the rect's main color to the color specified for gradient color.
\code
- <Rect y="0" width="80" height="80" color="lightsteelblue"/>
- <Rect y="100" width="80" height="80" color="lightsteelblue" gradientColor="blue"/>
- <Rect rotation="90" x="80" y="200" width="80" height="80" color="lightsteelblue"
- gradientColor="blue"/>
- <!-- The x offset is needed because the rotation is from the top left corner -->
+ Rect { y: 0; width: 80; height: 80; color: "lightsteelblue" }
+ Rect { y: 100; width: 80; height: 80; color: "lightsteelblue"; gradientColor="blue" }
+ Rect { rotation: 90; x: 80; y: 200; width: 80; height: 80; color="lightsteelblue"
+ gradientColor: "blue" }
+ // The x offset is needed because the rotation is from the top left corner
\endcode
\image declarative-rect_gradient.png
*/