diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-05-01 06:26:59 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-05-01 06:26:59 (GMT) |
commit | 8f52aee209aa64ef6719126547c767583870bd9f (patch) | |
tree | 587ce6fe8e250706a5a761c1119efbcd48a21a63 | |
parent | 6aeccc0f8b592d835d9ec32daecc0b5d104f132b (diff) | |
download | Qt-8f52aee209aa64ef6719126547c767583870bd9f.zip Qt-8f52aee209aa64ef6719126547c767583870bd9f.tar.gz Qt-8f52aee209aa64ef6719126547c767583870bd9f.tar.bz2 |
doc
-rw-r--r-- | src/declarative/fx/qfxreflectionfilter.cpp | 69 | ||||
-rw-r--r-- | src/declarative/fx/qfxrepeater.cpp | 8 | ||||
-rw-r--r-- | src/declarative/fx/qfxshadowfilter.cpp | 28 | ||||
-rw-r--r-- | src/declarative/fx/qfxtext.cpp | 28 | ||||
-rw-r--r-- | src/declarative/fx/qfxtextedit.cpp | 69 | ||||
-rw-r--r-- | src/declarative/fx/qfxtransform.cpp | 43 |
6 files changed, 136 insertions, 109 deletions
diff --git a/src/declarative/fx/qfxreflectionfilter.cpp b/src/declarative/fx/qfxreflectionfilter.cpp index e02bc16..a55f374 100644 --- a/src/declarative/fx/qfxreflectionfilter.cpp +++ b/src/declarative/fx/qfxreflectionfilter.cpp @@ -69,35 +69,30 @@ public: Here is an example of various Reflections applied to an image. - \code - <HorizontalLayout> - <Image src="icon.png" > - <filter> - <Reflection /> - </filter> - </Image> - <Image src="icon.png" > - <filter> - <Reflection offset="1" /> - </filter> - </Image> - <Image src="icon.png" > - <filter> - <Reflection offset="1" alpha="0.5" /> - </filter> - </Image> - <Image src="icon.png" > - <filter> - <Reflection offset="1" alpha="0.5" height="50" /> - </filter> - </Image> - <Image src="icon.png" > - <filter> - <Reflection offset="1" alpha="0.5" height="50" scale="0.5" /> - </filter> - </Image> - </HorizontalLayout> - \endcode + \qml +HorizontalLayout { + Image { + src: "icon.png" + filter: Reflection { } + } + Image { + src: "icon.png" + filter: Reflection { offset: 1 } + } + Image { + src: "icon.png" + filter: Reflection { offset: 1; alpha: 0.5 } + } + Image { + src: "icon.png" + filter: Reflection { offset: 1; alpha: 0.5; height: 50 } + } + Image { + src: "icon.png" + filter: Reflection { offset: 1; alpha: 0.5; height: 50; scale: 0.5 } + } +} + \endqml \image reflection_example.png @@ -149,13 +144,15 @@ void QFxReflectionFilter::setAlpha(qreal a) it is set to 50, the bottom 50 pixels of the item are reflected. Data binding could be used to reflect a percentage of the item. - \code - <Image id="myImage" src="album.png"> - <filter> - <Reflection height="{myImage.height * 0.5}" /> - </filter> - </Image> - \endcode + \qml +Image { + id: myImage + src: "album.png" + filter: Reflection { + height: myImage.height * 0.5 + } +} + \endqml */ /*! \qmlproperty int Reflection::offset diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index f9fc878..23b4e01 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -77,13 +77,13 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater); \qmlclass Repeater \inherits Item - \brief The Repeater element allows you to repeat a component based on a data source. + \brief The Repeater item allows you to repeat a component based on a data source. - The Repeater element is used when you want to create a large number of + The Repeater item is used when you want to create a large number of similar items. For each entry in the data source, an item is instantiated in a context seeded with data from the data source. If the repeater will be instantiating a large number of instances, it may be more efficient to - use one of Qt Declarative's \l {xmlViews}{view elements}. + use one of Qt Declarative's \l {xmlViews}{view items}. 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 @@ -92,7 +92,7 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater); 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. - Items instantiated by the Repeater elemented are inserted, in order, as + Items instantiated by the Repeater are inserted, in order, as children of the Repeater's parent. The insertion starts immediately after the repeater's position in its parent stacking list. This is to allow you to use a Repeater inside a layout. The following QML example shows how diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp index 38d1c31..4d34f74 100644 --- a/src/declarative/fx/qfxshadowfilter.cpp +++ b/src/declarative/fx/qfxshadowfilter.cpp @@ -73,14 +73,26 @@ public: \row \o \image shadow_example.png \o - \code - <Rect radius="5" color="lightsteelblue" width="100" height="100"> - <filter><Shadow yOffset="8" xOffset="8" /></filter> - </Rect> - <Image src="pics/qtlogo.png"> - <filter><Shadow yOffset="8" xOffset="8" /></filter> - </Image> - \endcode + \qml +Rect { + radius: 5 + color: "lightsteelblue" + width: 100 + height: 100 + filter: Shadow { + yOffset: 8 + xOffset: 8 + } +} + +Image { + src: "pics/qtlogo.png" + filter: Shadow { + yOffset: 8 + xOffset: 8 + } +} + \endqml \endtable Shadows are only supported when Qt Qt Declarative is compiled for OpenGL ES 2.0. diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index f1aefb9..a43219d 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -61,15 +61,15 @@ QML_DEFINE_TYPE(QFxText,Text); /*! \qmlclass Text QFxText - \brief The Text element allows you to add formatted text to a scene. + \brief The Text item allows you to add formatted text to a scene. \inherits Item It can display both plain and rich text. For example: - \code + \qml Text { text: "Hello World!"; font.family: "Helvetica"; font.size: 24; color: "red" } Text { text: "<b>Hello</b> <i>World!</i>" } - \endcode + \endqml \image declarative-text.png @@ -94,10 +94,10 @@ QML_DEFINE_TYPE(QFxText,Text); Text was designed for read-only text; it does not allow for any text editing. It can display both plain and rich text. For example: - \code + \qml Text { text: "Hello World!"; font.family: "Helvetica"; font.size: 24; color: "red" } Text { text: "<b>Hello</b> <i>World!</i>" } - \endcode + \endqml \image text.png @@ -105,7 +105,7 @@ QML_DEFINE_TYPE(QFxText,Text); much room is needed and set it accordingly. Unless \c wrap is set, it will always prefer width to height (all text will be placed on a single line). - The \c elideMode can alternatively be used to fit a line of plain text to a set width. + The \c elide property can alternatively be used to fit a line of plain text to a set width. A QFxText object can be instantiated in Qml using the tag \c Text. */ @@ -212,13 +212,13 @@ void QFxText::setColor(const QColor &color) The text color. - \code + \qml //green text using hexadecimal notation Text { color: "#00FF00"; ... } //steelblue text using SVG color name Text { color: "steelblue"; ... } - \endcode + \endqml */ QColor QFxText::color() const @@ -234,14 +234,14 @@ QColor QFxText::color() const Supported text styles are \c Normal, \c Outline, \c Raised and \c Sunken. - \code + \qml HorizontalLayout { Text { font.size: 24; text: "Normal" } Text { font.size: 24; text: "Raised"; style: "Raised"; styleColor: "#AAAAAA" } Text { font.size: 24; text: "Outline"; style: "Outline"; styleColor: "red" } Text { font.size: 24; text: "Sunken"; style: "Sunken"; styleColor: "#AAAAAA" } } - \endcode + \endqml \image declarative-textstyle.png */ @@ -302,7 +302,7 @@ QColor QFxText::styleColor() const \qmlproperty enumeration Text::hAlign \qmlproperty enumeration Text::vAlign - Sets the horizontal and vertical alignment of the text within the Text elements + Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is top-left aligned. The valid values for \c hAlign are \c AlignLeft, \c AlignRight and @@ -349,7 +349,7 @@ void QFxText::setVAlign(VAlignment align) /*! \qmlproperty bool Text::wrap - Set this property to wrap the text to the Text element's width. The text will only + Set this property to wrap the text to the Text item's width. The text will only wrap if an explicit width has been set. Wrapping is done on word boundaries (i.e. it is a "word-wrap"). If the text cannot be @@ -378,9 +378,9 @@ void QFxText::setWrap(bool w) } /*! - \qmlproperty Qt::TextElideMode Text::elideMode + \qmlproperty Qt::TextElideMode Text::elide - Set this property to elide parts of the text fit to the Text element's width. + Set this property to elide parts of the text fit to the Text item's width. The text will only elide if an explicit width has been set. This property cannot be used with wrap enabled or with rich text. diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 807fcbf..84e209b 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -62,15 +62,21 @@ QML_DEFINE_TYPE(QFxTextEdit, TextEdit); /*! \qmlclass TextEdit - \brief The TextEdit element allows you to add editable formatted text to a scene. + \brief The TextEdit item allows you to add editable formatted text to a scene. It can display both plain and rich text. For example: \qml - <TextEdit id="edit" focus="true" focusable="true" - font.family="Helvetica" font.size="20" color="blue" width="240"> - <![CDATA[<b>Hello</b> <i>World!</i>]]/> - </TextEdit> +TextEdit { + id: edit + text: "<b>Hello</b> <i>World!</i>" + focus: true + focusable: true + font.family: "Helvetica" + font.size: 20 + color: "blue" + width: 240 +} \endqml \image declarative-textedit.gif @@ -177,19 +183,24 @@ void QFxTextEdit::setText(const QString &text) \table \row \o - \code - <VerticalLayout> - <TextEdit font.size="24"> - <![CDATA[<b>Hello</b> <i>World!</i>]]]]><![CDATA[> - </TextEdit> - <TextEdit font.size="24" textFormat="RichText"> - <![CDATA[<b>Hello</b> <i>World!</i>]]]]><![CDATA[> - </TextEdit> - <TextEdit font.size="24" textFormat="PlainText"> - <![CDATA[<b>Hello</b> <i>World!</i>]]]]><![CDATA[> - </TextEdit> - </VerticalLayout> - \endcode + \qml +VerticalLayout { + TextEdit { + font.size: 24 + text: "<b>Hello</b> <i>World!</i>" + } + TextEdit { + font.size: 24 + textFormat: "RichText" + text: "<b>Hello</b> <i>World!</i>" + } + TextEdit { + font.size: 24 + textFormat: "PlainText" + text: "<b>Hello</b> <i>World!</i>" + } +} + \endqml \o \image declarative-textformat.png \endtable */ @@ -247,13 +258,13 @@ QmlFont *QFxTextEdit::font() The text color. - \code - <!-- green text using hexadecimal notation --> - <TextEdit color="#00FF00" .../> + \qml +// green text using hexadecimal notation +TextEdit { color: "#00FF00"; ... } - <!-- steelblue text using SVG color name--> - <TextEdit color="steelblue" .../> - \endcode +// steelblue text using SVG color name +TextEdit { color: "steelblue"; ... } + \endqml */ /*! @@ -284,7 +295,7 @@ void QFxTextEdit::setColor(const QColor &color) \qmlproperty enumeration TextEdit::hAlign \qmlproperty enumeration TextEdit::vAlign - Sets the horizontal and vertical alignment of the text within the TextEdit elements + Sets the horizontal and vertical alignment of the text within the TextEdit items width and height. By default, the text is top-left aligned. The valid values for \c hAlign are \c AlignLeft, \c AlignRight and @@ -345,7 +356,8 @@ bool QFxTextEdit::wrap() const /*! \qmlproperty bool TextEdit::wrap - Set this property to wrap the text to the TextEdit element's width. The text will only wrap if an explicit width has been set. + Set this property to wrap the text to the TextEdit item's width. + The text will only wrap if an explicit width has been set. Wrapping is done on word boundaries (i.e. it is a "word-wrap"). Wrapping is off by default. */ @@ -410,7 +422,7 @@ void QFxTextEdit::componentComplete() /*! \qmlproperty bool TextEdit::readOnly - Whether the user an interact with the TextEdit element. If this + Whether the user an interact with the TextEdit item. If this property is set to true the text cannot be edited by user interaction. By default this property is false. @@ -418,8 +430,7 @@ void QFxTextEdit::componentComplete() /*! \property QFxTextEdit::readOnly - \brief If this property is true the text can not be edited by - user interaction. + \brief If this property is true the text can not be edited by user interaction. Changing this property will modify the text interaction flags. If you require more specific control about how user interaction diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index 8ff4c54..1fe02d1 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -85,16 +85,16 @@ void QFxTransform::update() /*! \qmlclass Axis - \brief The Axis element defines an axis that can be used for rotation or translation. + \brief A Axis object defines an axis that can be used for rotation or translation. An axis is specified by 2 points in 3D space: a start point and an end point. While technically the axis is the line running through these two points (and thus many different sets of two points could define the same axis), the distance between the points does matter for translation along an axis. - \code + \qml Axis { startX: 0; startY: 0; endX: 20; endY: 30 } - \endcode + \endqml */ QML_DEFINE_TYPE(QFxAxis, Axis); @@ -179,7 +179,7 @@ void QFxAxis::setEndZ(qreal z) /*! \qmlclass Rotation3D - \brief The Rotation3D element provides a way to rotate an Item around an axis. + \brief A Rotation3D object provides a way to rotate an Item around an axis. Here is an example of various rotations applied to an \l Image. \snippet doc/src/snippets/declarative/rotation.qml 0 @@ -317,16 +317,23 @@ void QFxRotation3D::update() /*! \qmlclass Translation3D - \brief The Translation3D element provides a way to move an Item along an axis. + \brief A Translation3D object provides a way to move an Item along an axis. The following example translates the image to 10, 3. - \code - <Image src="logo.png"> - <transform> - <Translation3D axis.startX="0" axis.startY="0" axis.endX="1" axis.endY=".3" distance="10"/> - </transform> - </Image> - \endcode + \qml +Image { + src: "logo.png" + transform: [ + Translation3D { + axis.startX: 0 + axis.startY: 0 + axis.endX: 1 + axis.endY: .3 + distance: 10 + } + ] +} + \endqml */ QML_DEFINE_TYPE(QFxTranslation3D,Translation3D); @@ -367,9 +374,9 @@ QFxAxis *QFxTranslation3D::axis() in the example below, a distance of 1 would translate to 100, 50, while a distance of 0.5 would translate to 50, 25. - \code + \qml Translation3D { axis.startX: 0; axis.startY: 0; axis.endX: 100; axis.endY: 50 } - \endcode + \endqml */ qreal QFxTranslation3D::distance() const { @@ -444,7 +451,7 @@ void QFxTranslation3D::update() /*! \qmlclass Perspective - \brief The Perspective element specifies a perspective transformation. + \brief A Perspective object specifies a perspective transformation. A Perspective transform only affects an item when running under OpenGL; when running under software rasterization it has no effect. @@ -501,10 +508,10 @@ QMatrix4x4 QFxPerspective::transform() const /*! \qmlclass Squish - \brief The Squish element allows you to distort an items appearance by 'squishing' it. + \brief A Squish object allows you to distort an items appearance by 'squishing' it. Here is an example of various \l Image squishes. - \code + \qml Rect { id: Screen width: 360; height: 80 @@ -556,7 +563,7 @@ QMatrix4x4 QFxPerspective::transform() const } } } - \endcode + \endqml \image squish.png */ |