diff options
author | A-Team <ateam@pad.test.qt.nokia.com> | 2010-09-09 22:00:10 (GMT) |
---|---|---|
committer | A-Team <ateam@pad.test.qt.nokia.com> | 2010-09-09 22:00:10 (GMT) |
commit | 03c56248554b731356d283e467e1d31c54e78653 (patch) | |
tree | 5cfc5f5009f6534951f85257dddf1be1260b516f /src/declarative/graphicsitems | |
parent | dd387a0125b577fafc1a3363a4b8cd995053b7db (diff) | |
parent | 524379030503600bbca1a8e2b5889b91b0798203 (diff) | |
download | Qt-03c56248554b731356d283e467e1d31c54e78653.zip Qt-03c56248554b731356d283e467e1d31c54e78653.tar.gz Qt-03c56248554b731356d283e467e1d31c54e78653.tar.bz2 |
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/declarative/graphicsitems')
12 files changed, 521 insertions, 351 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index a95e944..12a820f 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -58,35 +58,32 @@ QT_BEGIN_NAMESPACE \inherits Image \since 4.7 \ingroup basic-visual-elements - - The AnimatedImage element provides for playing animations stored as images containing a series of frames, - such as GIF files. - + + The AnimatedImage element extends the features of the \l Image element, providing + a way to play animations stored as images containing a series of frames, + such as those stored in GIF files. + + Information about the current frame and totla length of the animation can be + obtained using the \l currentFrame and \l frameCount properties. You can + start, pause and stop the animation by changing the values of the \l playing + and \l paused properties. + The full list of supported formats can be determined with QMovie::supportedFormats(). - \table - \row - \o \image animatedimageitem.gif - \o - \qml - import Qt 4.7 + \section1 Example Usage - Rectangle { - width: animation.width; height: animation.height + 8 + \beginfloatleft + \image animatedimageitem.gif + \endfloat - AnimatedImage { id: animation; source: "animation.gif" } + The following QML shows how to display an animated image and obtain information + about its state, such as the current frame and total number of frames. + The result is an animated image with a simple progress indicator underneath it. - Rectangle { - property int frames: animation.frameCount + \clearfloat + \snippet doc/src/snippets/declarative/animatedimage.qml document - width: 4; height: 8 - x: (animation.width - width) * animation.currentFrame / frames - y: animation.height - color: "red" - } - } - \endqml - \endtable + \sa BorderImage, Image */ QDeclarativeAnimatedImage::QDeclarativeAnimatedImage(QDeclarativeItem *parent) @@ -104,7 +101,8 @@ QDeclarativeAnimatedImage::~QDeclarativeAnimatedImage() \qmlproperty bool AnimatedImage::paused This property holds whether the animated image is paused. - Defaults to false, and can be set to true when you want to pause. + By default, this property is false. Set it to true when you want to pause + the animation. */ bool QDeclarativeAnimatedImage::isPaused() const { @@ -128,7 +126,8 @@ void QDeclarativeAnimatedImage::setPaused(bool pause) \qmlproperty bool AnimatedImage::playing This property holds whether the animated image is playing. - Defaults to true, so as to start playing immediately. + By defaults, this property is true, meaning that the animation + will start playing immediately. */ bool QDeclarativeAnimatedImage::isPlaying() const { @@ -156,9 +155,11 @@ void QDeclarativeAnimatedImage::setPlaying(bool play) \qmlproperty int AnimatedImage::currentFrame \qmlproperty int AnimatedImage::frameCount - currentFrame is the frame that is currently visible. Watching when this changes can - allow other things to animate at the same time as the image. frameCount is the number - of frames in the animation. For some animation formats, frameCount is unknown and set to zero. + currentFrame is the frame that is currently visible. By monitoring this property + for changes, you can animate other items at the same time as the image. + + frameCount is the number of frames in the animation. For some animation formats, + frameCount is unknown and has a value of zero. */ int QDeclarativeAnimatedImage::currentFrame() const { diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index f16770b..c58a08d 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -56,27 +56,97 @@ QT_BEGIN_NAMESPACE \brief The BorderImage element provides an image that can be used as a border. \inherits Item \since 4.7 - \ingroup qm-basic-visual-elements + \ingroup qml-basic-visual-elements - A BorderImage breaks an image into 9 sections, as shown below: + The BorderImage element is used to create borders out of images by scaling or tiling + parts of each image. + + A BorderImage element breaks a source image, specified using the \l url property, + into 9 regions, as shown below: \image declarative-scalegrid.png - When the image is scaled: + When the image is scaled, regions of the source image are scaled or tiled to + create the displayed border image in the following way: + \list - \i the corners (sections 1, 3, 7, and 9) are not scaled at all - \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode} - \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode} - \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode} + \i The corners (regions 1, 3, 7, and 9) are not scaled at all. + \i Regions 2 and 8 are scaled according to + \l{BorderImage::horizontalTileMode}{horizontalTileMode}. + \i Regions 4 and 6 are scaled according to + \l{BorderImage::verticalTileMode}{verticalTileMode}. + \i The middle (region 5) is scaled according to both + \l{BorderImage::horizontalTileMode}{horizontalTileMode} and + \l{BorderImage::verticalTileMode}{verticalTileMode}. \endlist - Examples: - \snippet snippets/declarative/borderimage.qml 0 + The regions of the image are defined using the \l border property group, which + describes the distance from each edge of the source image to use as a border. + + \section1 Example Usage + + The following examples show the effects of the different modes on an image. + Guide lines are overlaid onto the image to show the different regions of the + image as described above. + + \beginfloatleft + \image qml-borderimage-normal-image.png + \endfloat + + An unscaled image is displayed using an Image element. The \l border property is + 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 + + \clearfloat + \beginfloatleft + \image qml-borderimage-scaled.png + \endfloat + + A BorderImage element is used to display the image, and it is given a size that is + larger than the original image. Since the \l horizontalTileMode property is set to + \l{BorderImage::horizontalTileMode}{BorderImage.Stretch}, the parts of image in + regions 2 and 8 are stretched horizontally. Since the \l verticalTileMode property + 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 + + \clearfloat + \beginfloatleft + \image qml-borderimage-tiled.png + \endfloat - \image BorderImage.png + Again, a large BorderImage element is used to display the image. With the + \l horizontalTileMode property set to \l{BorderImage::horizontalTileMode}{BorderImage.Repeat}, + the parts of image in regions 2 and 8 are tiled so that they fill the space at the + top and bottom of the element. Similarly, the \l verticalTileMode property is set to + \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. - The \l{declarative/imageelements/borderimage}{BorderImage example} shows how a BorderImage can be used to simulate a shadow effect on a - rectangular item. + \snippet doc/src/snippets/declarative/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 + of the corresponding regions in the source image. Similarly, the height of regions 4 and 6 + may not be an exact multiple of the height of the corresponding regions. It can be useful + to use \l{BorderImage::horizontalTileMode}{BorderImage.Round} instead of + \l{BorderImage::horizontalTileMode}{BorderImage.Repeat} in cases like these. + + The \l{declarative/imageelements/borderimage}{BorderImage example} shows how a BorderImage + can be used to simulate a shadow effect on a rectangular item. + + \section1 Quality and Performance + + By default, any scaled regions of the image are rendered without smoothing to improve + rendering speed. Setting the \l smooth property improves rendering quality of scaled + regions, but may slow down rendering. + + The source image may not be loaded instantaneously, depending on its original location. + Loading progress can be monitored with the \l progress property. + + \sa Image, AnimatedImage */ QDeclarativeBorderImage::QDeclarativeBorderImage(QDeclarativeItem *parent) @@ -93,7 +163,8 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() /*! \qmlproperty enumeration BorderImage::status - This property holds the status of image loading. It can be one of: + This property describes the status of image loading. It can be one of: + \list \o BorderImage.Null - no image has been set \o BorderImage.Ready - the image has been loaded @@ -121,20 +192,28 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() the image is displayed at its natural size, this property has no visual or performance effect. + By default, this property is set to false. + \note Generally scaling artifacts are only visible if the image is stationary on the screen. A common pattern when animating an image is to disable smooth - filtering at the beginning of the animation and reenable it at the conclusion. + filtering at the beginning of the animation and enable it at the conclusion. */ /*! \qmlproperty url BorderImage::source - BorderImage can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. + This property holds the URL that refers to the source image. + + BorderImage can handle any image format supported by Qt, loaded from any + URL scheme supported by Qt. - It can also handle .sci files, which are a QML-specific format. A .sci file uses a simple text-based format that specifies - the borders, the image file and the tile rules. + It can also handle .sci files, which are a QML-specific format. A .sci + file uses a simple text-based format that specifies the borders, the + image file and the tile rules. + + The following .sci file sets the borders to 10 on each side for the + image \c picture.png: - The following .sci file sets the borders to 10 on each side for the image \c picture.png: \qml border.left: 10 border.top: 10 @@ -245,17 +324,21 @@ void QDeclarativeBorderImage::load() \qmlproperty int BorderImage::border.top \qmlproperty int BorderImage::border.bottom - The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections, as shown below: + The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections, + as shown below: \image declarative-scalegrid.png - Each border line (left, right, top, and bottom) specifies an offset in pixels from the respective side. + Each border line (left, right, top, and bottom) specifies an offset in pixels + from the respective edge of the source image. By default, each border line has + a value of 0. + + For example, the following definition sets the bottom line 10 pixels up from + the bottom of the image: - For example: \qml border.bottom: 10 \endqml - sets the bottom line 10 pixels up from the bottom of the image. The border lines can also be specified using a \l {BorderImage::source}{.sci file}. @@ -274,7 +357,7 @@ QDeclarativeScaleGrid *QDeclarativeBorderImage::border() This property describes how to repeat or stretch the middle parts of the border image. \list - \o BorderImage.Stretch - Scale the image to fit to the available area. + \o BorderImage.Stretch - Scales the image to fit to the available area. \o BorderImage.Repeat - Tile the image until there is no more space. May crop the last image. \o BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped. \endlist diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index b302393..062bbfb 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -350,24 +350,34 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \brief The Flickable item provides a surface that can be "flicked". \inherits Item - Flickable places its children on a surface that can be dragged and flicked. + The Flickable item places its children on a surface that can be dragged + and flicked, causing the view onto the child items to scroll. This + behavior forms the basis of Items that are designed to show large numbers + of child items, such as \l ListView and \l GridView. - \code - import Qt 4.7 + In traditional user interfaces, views can be scrolled using standard + controls, such as scroll bars and arrow buttons. In some situations, it + is also possible to drag the view directly by pressing and holding a + mouse button while moving the cursor. In touch-based user interfaces, + this dragging action is often complemented with a flicking action, where + scrolling continues after the user has stopped touching the view. - Flickable { - width: 200; height: 200 - contentWidth: image.width; contentHeight: image.height + Flickable does not automatically clip its contents. If it is not used as + a full-screen item, you should consider setting the \l{Item::}{clip} property + to true. - Image { id: image; source: "bigImage.png" } - } - \endcode + \section1 Example Usage + + \beginfloatright + \inlineimage flickable.gif + \endfloat - \image flickable.gif + The following example shows a large - Flickable does not automatically clip its contents. If - it is not full-screen it is likely that \l {Item::clip}{clip} should be set - to \c true. + \clearfloat + \snippet doc/src/snippets/declarative/flickable.qml document + + \section1 Limitations \note Due to an implementation detail, items placed inside a Flickable cannot anchor to it by \c id. Use \c parent instead. @@ -491,12 +501,15 @@ void QDeclarativeFlickable::setContentY(qreal pos) /*! \qmlproperty bool Flickable::interactive - This property holds whether the user can interact with the Flickable. A user - cannot drag or flick a Flickable that is not interactive. + This property describes whether the user can interact with the Flickable. + A user cannot drag or flick a Flickable that is not interactive. + + By default, this property is true. This property is useful for temporarily disabling flicking. This allows - special interaction with Flickable's children: for example, you might want to - freeze a flickable map while scrolling through a pop-up dialog that is a child of the Flickable. + special interaction with Flickable's children; for example, you might want + to freeze a flickable map while scrolling through a pop-up dialog that + is a child of the Flickable. */ bool QDeclarativeFlickable::isInteractive() const { @@ -1333,8 +1346,8 @@ bool QDeclarativeFlickable::isFlicking() const \qmlproperty bool Flickable::flickingHorizontally \qmlproperty bool Flickable::flickingVertically - These properties hold whether the view is currently moving horizontally - or vertically due to the user flicking the view. + These properties describe whether the view is currently moving horizontally, + vertically or in either direction, due to the user flicking the view. */ bool QDeclarativeFlickable::isFlickingHorizontally() const { @@ -1386,8 +1399,9 @@ bool QDeclarativeFlickable::isMoving() const \qmlproperty bool Flickable::movingHorizontally \qmlproperty bool Flickable::movingVertically - These properties hold whether the view is currently moving horizontally - or vertically due to the user either dragging or flicking the view. + These properties describe whether the view is currently moving horizontally, + vertically or in either direction, due to the user either dragging or + flicking the view. */ bool QDeclarativeFlickable::isMovingHorizontally() const { diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 69dd66a..4ecf87b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -71,31 +71,40 @@ public: \qmlclass Flipable QDeclarativeFlipable \since 4.7 \ingroup qml-basic-interaction-elements - \brief The Flipable item provides a surface that can be flipped. \inherits Item Flipable is an item that can be visibly "flipped" between its front and - back sides. It is used together with \l Rotation and \l {State}/\l {Transition} to - produce a flipping effect. + back sides, like a card. It is used together with \l Rotation, \l State + and \l Transition elements to produce a flipping effect. + + The \l front and \l back properties are used to hold the items that are + shown respectively on the front and back sides of the flipable item. - Here is a Flipable that flips whenever it is clicked: + \section1 Example Usage - \snippet doc/src/snippets/declarative/flipable.qml 0 + \beginfloatright + \inlineimage flipable.gif + \endfloat - \image flipable.gif + The following example shows a Flipable item that flips whenever it is + clicked, rotating about the y-axis. The \l Rotation element is used to specify the angle and axis of the flip. - When \c flipped is \c true, the item changes to the "back" state, where + When \c flipped is true, the item changes to the "back" state, where the angle is changed to 180 degrees to produce the flipping effect. - Finally, the \l Transition creates the animation that changes the - angle over one second: when the item changes between its "back" and + + \clearfloat + \snippet doc/src/snippets/declarative/flipable/flipable-snippet.qml 0 + + The \l Transition creates the animation that changes the angle over the + duration of one second. When the item changes between its "back" and default states, the NumberAnimation animates the angle between its old and new values. See the \l {QML States} and \l {QML Animation} documentation for more details on state changes and how animations work within transitions. - + \sa {declarative/ui-components/flipable}{Flipable example} */ diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 7a88e78..9cd9ad6 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -51,34 +51,46 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Image QDeclarativeImage \since 4.7 - \ingroup qml-vasic-visual-elements - - \brief The Image element allows you to add bitmaps to a scene. + \ingroup qml-basic-visual-elements + \brief The Image element displays an image in a declarative user interface \inherits Item - An Image element displays a specified \l source image: + The Image element is used to display images in a declarative user interface. - \table - \row - \o \image declarative-qtlogo.png - \o \qml - import Qt 4.7 + The source of the image is specified as a URL using the \l source property. + Images can be supplied in any of the standard image formats supported by Qt, + including bitmap formats such as PNG and JPEG, and vector graphics formats + such as SVG. If you need to display animated images, use the \l AnimatedImage + element. - Image { source: "qtlogo.png" } - \endqml - \endtable + If the \l{Item::width}{width} and \l{Item::height}{height} properties are not + specified, the Image element automatically uses the size of the loaded image. + By default, specifying the width and height of the element causes the image + to be scaled to that size. This behavior can be changed by setting the + \l fillMode property, allowing the image to be stretched and tiled instead. + + \section1 Example Usage + + The following example shows the simplest usage of the Image element. + + \snippet doc/src/snippets/declarative/image.qml document + + \beginfloatleft + \image declarative-qtlogo.png + \endfloat + + \clearfloat - If the \l {Item::width}{width} and \l{Item::height}{height} properties are not specified, - the Image element is automatically sized to the loaded image. Image elements can be - stretched and tiled using the \l fillMode property. + \section1 Performance By default, locally available images are loaded immediately, and the user interface is blocked until loading is complete. If a large image is to be loaded, it may be preferable to load the image in a low priority thread, by enabling the \l asynchronous property. - If the image is from a network rather than a local resource, it is automatically loaded - asynchronously, and the \l progress and \l status properties are updated as appropriate. + If the image is obtained from a network rather than a local resource, it is + automatically loaded asynchronously, and the \l progress and \l status properties + are updated as appropriate. Images are cached and shared internally, so if several Image elements have the same \l source, only one copy of the image will be loaded. diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 228dd57..bd2d52c 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -830,259 +830,259 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) */ /*! - \qmlsignal Keys::onPressed(event) + \qmlsignal Keys::onPressed(KeyEvent event) This handler is called when a key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onReleased(event) + \qmlsignal Keys::onReleased(KeyEvent event) This handler is called when a key has been released. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit0Pressed(event) + \qmlsignal Keys::onDigit0Pressed(KeyEvent event) This handler is called when the digit '0' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit1Pressed(event) + \qmlsignal Keys::onDigit1Pressed(KeyEvent event) This handler is called when the digit '1' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit2Pressed(event) + \qmlsignal Keys::onDigit2Pressed(KeyEvent event) This handler is called when the digit '2' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit3Pressed(event) + \qmlsignal Keys::onDigit3Pressed(KeyEvent event) This handler is called when the digit '3' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit4Pressed(event) + \qmlsignal Keys::onDigit4Pressed(KeyEvent event) This handler is called when the digit '4' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit5Pressed(event) + \qmlsignal Keys::onDigit5Pressed(KeyEvent event) This handler is called when the digit '5' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit6Pressed(event) + \qmlsignal Keys::onDigit6Pressed(KeyEvent event) This handler is called when the digit '6' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit7Pressed(event) + \qmlsignal Keys::onDigit7Pressed(KeyEvent event) This handler is called when the digit '7' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit8Pressed(event) + \qmlsignal Keys::onDigit8Pressed(KeyEvent event) This handler is called when the digit '8' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit9Pressed(event) + \qmlsignal Keys::onDigit9Pressed(KeyEvent event) This handler is called when the digit '9' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onLeftPressed(event) + \qmlsignal Keys::onLeftPressed(KeyEvent event) This handler is called when the Left arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onRightPressed(event) + \qmlsignal Keys::onRightPressed(KeyEvent event) This handler is called when the Right arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onUpPressed(event) + \qmlsignal Keys::onUpPressed(KeyEvent event) This handler is called when the Up arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDownPressed(event) + \qmlsignal Keys::onDownPressed(KeyEvent event) This handler is called when the Down arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onAsteriskPressed(event) + \qmlsignal Keys::onAsteriskPressed(KeyEvent event) This handler is called when the Asterisk '*' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onEscapePressed(event) + \qmlsignal Keys::onEscapePressed(KeyEvent event) This handler is called when the Escape key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onReturnPressed(event) + \qmlsignal Keys::onReturnPressed(KeyEvent event) This handler is called when the Return key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onEnterPressed(event) + \qmlsignal Keys::onEnterPressed(KeyEvent event) This handler is called when the Enter key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDeletePressed(event) + \qmlsignal Keys::onDeletePressed(KeyEvent event) This handler is called when the Delete key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onSpacePressed(event) + \qmlsignal Keys::onSpacePressed(KeyEvent event) This handler is called when the Space key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onBackPressed(event) + \qmlsignal Keys::onBackPressed(KeyEvent event) This handler is called when the Back key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onCancelPressed(event) + \qmlsignal Keys::onCancelPressed(KeyEvent event) This handler is called when the Cancel key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onSelectPressed(event) + \qmlsignal Keys::onSelectPressed(KeyEvent event) This handler is called when the Select key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onYesPressed(event) + \qmlsignal Keys::onYesPressed(KeyEvent event) This handler is called when the Yes key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onNoPressed(event) + \qmlsignal Keys::onNoPressed(KeyEvent event) This handler is called when the No key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext1Pressed(event) + \qmlsignal Keys::onContext1Pressed(KeyEvent event) This handler is called when the Context1 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext2Pressed(event) + \qmlsignal Keys::onContext2Pressed(KeyEvent event) This handler is called when the Context2 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext3Pressed(event) + \qmlsignal Keys::onContext3Pressed(KeyEvent event) This handler is called when the Context3 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext4Pressed(event) + \qmlsignal Keys::onContext4Pressed(KeyEvent event) This handler is called when the Context4 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onCallPressed(event) + \qmlsignal Keys::onCallPressed(KeyEvent event) This handler is called when the Call key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onHangupPressed(event) + \qmlsignal Keys::onHangupPressed(KeyEvent event) This handler is called when the Hangup key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onFlipPressed(event) + \qmlsignal Keys::onFlipPressed(KeyEvent event) This handler is called when the Flip key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onMenuPressed(event) + \qmlsignal Keys::onMenuPressed(KeyEvent event) This handler is called when the Menu key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onVolumeUpPressed(event) + \qmlsignal Keys::onVolumeUpPressed(KeyEvent event) This handler is called when the VolumeUp key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onVolumeDownPressed(event) + \qmlsignal Keys::onVolumeDownPressed(KeyEvent event) This handler is called when the VolumeDown key has been pressed. The \a event parameter provides information about the event. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 2eae0af..177c5b3 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1432,7 +1432,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m to set \e {clip: true} in order to have the out of view items clipped nicely. - \sa {Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} + \sa {QML Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index ec01549..5516611 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -250,7 +250,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onClicked(mouse) + \qmlsignal MouseArea::onClicked(MouseEvent mouse) This handler is called when there is a click. A click is defined as a press followed by a release, both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and @@ -263,7 +263,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onPressed(mouse) + \qmlsignal MouseArea::onPressed(MouseEvent mouse) This handler is called when there is a press. The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y @@ -277,7 +277,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onReleased(mouse) + \qmlsignal MouseArea::onReleased(MouseEvent mouse) This handler is called when there is a release. The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y @@ -287,7 +287,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onPressAndHold(mouse) + \qmlsignal MouseArea::onPressAndHold(MouseEvent mouse) This handler is called when there is a long press (currently 800ms). The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y @@ -297,7 +297,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onDoubleClicked(mouse) + \qmlsignal MouseArea::onDoubleClicked(MouseEvent mouse) This handler is called when there is a double-click (a press followed by a release followed by a press). The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 77b26b9..e2a373f 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -323,58 +323,65 @@ void QDeclarativeBasePositioner::finishApplyTransitions() /*! \qmlclass Column QDeclarativeColumn - \ingroup qml-positioning-elements - \since 4.7 + \ingroup qml-positioning-elements + \since 4.7 \brief The Column item arranges its children vertically. \inherits Item The Column item positions its child items so that they are vertically - aligned and not overlapping. Spacing between items can be added. + aligned and not overlapping. - The below example positions differently shaped rectangles using a Column. - \table - \row - \o \image verticalpositioner_example.png - \o - \qml -Column { - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } -} - \endqml - \endtable + Spacing between items can be added using the \l spacing property. + Transitions can be used for cases where items managed by a Column are + added or moved. These are stored in the \l add and \l move properties + respectively. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example positions differently shaped rectangles using a Column + item. + + \image verticalpositioner_example.png + + \snippet doc/src/snippets/declarative/column/vertical-positioner.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Column item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Column item. + + The use of transitions with positioners is described in more detail in the + \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML + Positioner and Repeater Items} document. - Column also provides for transitions to be set when items are added, moved, - or removed in the positioner. Adding and removing apply both to items which are deleted - or have their position in the document changed so as to no longer be children of the positioner, - as well as to items which have their opacity set to or from zero so as to appear or disappear. + \image verticalpositioner_transition.gif - \table - \row - \o \image verticalpositioner_transition.gif - \o \qml -Column { - spacing: 2 - add: ... - move: ... - ... -} + Column { + spacing: 2 + add: ... + move: ... + ... + } \endqml - \endtable + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind the x or y properties, use anchors on a child of a positioner, or have the height of a child depend on the position of a child, then the - positioner may exhibit strange behaviour. If you need to perform any of these + positioner may exhibit strange behavior. If you need to perform any of these actions, consider positioning the items without the use of a Column. Items with a width or height of 0 will not be positioned. - \sa Row, {declarative/positioners}{Positioners example} + \sa Row, Grid, Flow, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Column::add @@ -382,55 +389,47 @@ Column { This property holds the transition to be applied when adding an item to the positioner. The transition will only be applied to the added item(s). Positioner transitions will only affect the - position (x,y) of items. - - Added can mean that either the object has been created or - reparented, and thus is now a child or the positioner, or that the - object has had its opacity increased from zero, and thus is now - visible. + position (x, y) of items. + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + \sa move */ /*! \qmlproperty Transition Column::move This property holds the transition to apply when moving an item within the positioner. Positioner transitions will only affect - the position (x,y) of items. + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. - This can happen when other items are added or removed from the - positioner, or when items resize themselves. + \image positioner-move.gif - \table - \row - \o \image positioner-move.gif - \o \qml -Column { - move: Transition { - NumberAnimation { - properties: "y" - easing.type: Easing.OutBounce + Column { + move: Transition { + NumberAnimation { + properties: "y" + easing.type: Easing.OutBounce + } } } -} \endqml - \endtable + + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Column::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. - - The below example places a \l Grid containing a red, a blue and a - green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. - - \image spacing_a.png - \image spacing_b.png + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. + \sa Grid::spacing */ QDeclarativeColumn::QDeclarativeColumn(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Vertical, parent) @@ -484,29 +483,38 @@ void QDeclarativeColumn::reportConflictingAnchors() /*! \qmlclass Row QDeclarativeRow - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Row item arranges its children horizontally. \inherits Item - The Row item positions its child items so that they are - horizontally aligned and not overlapping. + The Row item positions its child items so that they are horizontally + aligned and not overlapping. Use \l spacing to set the spacing between items in a Row, and use the \l add and \l move properties to set the transitions that should be applied when items are added to, removed from, or re-positioned within the Row. - The below example lays out differently shaped rectangles using a Row. - \qml -Row { - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } -} - \endqml + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example lays out differently shaped rectangles using a Row. + \image horizontalpositioner_example.png + \snippet doc/src/snippets/declarative/row/row.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Grid item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Row item. + + \section1 Limitations + Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind the x or y properties, use anchors on a child of a positioner, or have the @@ -516,56 +524,54 @@ Row { Items with a width or height of 0 will not be positioned. - \sa Column, {declarative/positioners}{Positioners example} + \sa Column, Grid, Flow, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Row::add - This property holds the transition to apply when adding an item to the positioner. - The transition will only be applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Row::move - This property holds the transition to apply when moving an item - within the positioner. Positioner transitions will only affect - the position (x,y) of items. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. - This can happen when other items are added or removed from the - positioner, or when items resize themselves. + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Row { - id: positioner - move: Transition { - NumberAnimation { - properties: "x" - ease: "easeOutBounce" + Row { + id: positioner + move: Transition { + NumberAnimation { + properties: "x" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Row::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. - - The below example places a \l Grid containing a red, a blue and a - green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. - - \image spacing_a.png - \image spacing_b.png + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. + \sa Grid::spacing */ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Horizontal, parent) @@ -618,47 +624,46 @@ void QDeclarativeRow::reportConflictingAnchors() /*! \qmlclass Grid QDeclarativeGrid - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Grid item positions its children in a grid. \inherits Item The Grid item positions its child items so that they are aligned in a grid and are not overlapping. - - Spacing can be added - between child items. It also provides for transitions to be set when items are - added, moved, or removed in the positioner. Adding and removing apply - both to items which are deleted or have their position in the - document changed so as to no longer be children of the positioner, as - well as to items which have their opacity set to or from zero so - as to appear or disappear. - - A Grid defaults to four columns, and as many rows as - are necessary to fit all child items. The number of rows - and/or the number of columns can be constrained by setting the \l rows - or \l columns properties. The grid positioner calculates a grid with - rectangular cells of sufficient size to hold all items, and then - places the items in the cells, going across then down, and - positioning each item at the (0,0) corner of the cell. The below - example demonstrates this. - - \table - \row - \o \image gridLayout_example.png - \o - \qml -Grid { - columns: 3 - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } - Rectangle { color: "cyan"; width: 50; height: 50 } - Rectangle { color: "magenta"; width: 10; height: 10 } -} - \endqml - \endtable + + The grid positioner calculates a grid of rectangular cells of sufficient + size to hold all items, placing the items in the cells, from left to right + and top to bottom. Each item is positioned in the top-left corner of its + cell with position (0, 0). + + A Grid defaults to four columns, and as many rows as are necessary to + fit all child items. The number of rows and columns can be constrained + by setting the \l rows and \l columns properties. + + Spacing can be added between child items by setting the \l spacing + property. The amount of spacing applied will be the same in the + horizontal and vertical directions. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example demonstrates this. + + \image gridLayout_example.png + + \snippet doc/src/snippets/declarative/grid/grid.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Grid item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Grid item. + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind @@ -669,55 +674,62 @@ Grid { Items with a width or height of 0 will not be positioned. - \sa Flow, {declarative/positioners}{Positioners example} + \sa Flow, Row, Column, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Grid::add - This property holds the transition to apply when adding an item to the positioner. - The transition is only applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items, - as that is all the positioners affect. To animate other property change - you will have to do so based on how you have changed those properties. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Grid::move - This property holds the transition to apply when moving an item within the positioner. - Positioner transitions will only affect the position (x,y) of items. - This can happen when other items are added or removed from the positioner, or - when items resize themselves. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Grid { - move: Transition { - NumberAnimation { - properties: "x,y" - ease: "easeOutBounce" + Grid { + move: Transition { + NumberAnimation { + properties: "x,y" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Grid::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. The below example places a Grid containing a red, a blue and a green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. + occupies is colored white. The positioner on the left has the + no spacing (the default), and the positioner on the right has + a spacing of 6. - \image spacing_a.png - \image spacing_b.png + \inlineimage qml-grid-no-spacing.png + \inlineimage qml-grid-spacing.png + \sa rows, columns */ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight) @@ -726,7 +738,9 @@ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : /*! \qmlproperty int Grid::columns - This property holds the number of columns in the grid. + + This property holds the number of columns in the grid. The default + number of columns is 4. If the grid does not have enough items to fill the specified number of columns, some columns will be of zero width. @@ -912,13 +926,43 @@ void QDeclarativeGrid::reportConflictingAnchors() /*! \qmlclass Flow QDeclarativeFlow - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Flow item arranges its children side by side, wrapping as necessary. \inherits Item - The Flow item positions its child items so that they are side by side and are - not overlapping. + The Flow item positions its child items like words on a page, wrapping them + to create rows or columns of items that do not overlap. + + Spacing between items can be added using the \l spacing property. + Transitions can be used for cases where items managed by a Column are + added or moved. These are stored in the \l add and \l move properties + respectively. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example positions \l Text items within a parent item using + a Flow item. + + \image qml-flow-snippet.png + + \snippet doc/src/snippets/declarative/flow.qml flow item + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Flow item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Flow item. + + The use of transitions with positioners is described in more detail in the + \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML + Positioner and Repeater Items} document. + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind @@ -929,38 +973,46 @@ void QDeclarativeGrid::reportConflictingAnchors() Items with a width or height of 0 will not be positioned. - \sa Grid, {declarative/positioners}{Positioners example} + \sa Column, Row, Grid, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Flow::add - This property holds the transition to apply when adding an item to the positioner. - The transition will only be applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Flow::move - This property holds the transition to apply when moving an item within the positioner. - Positioner transitions will only affect the position (x,y) of items. - This can happen when other items are added or removed from the positioner, or when items resize themselves. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Flow { - id: positioner - move: Transition { - NumberAnimation { - properties: "x,y" - ease: "easeOutBounce" + Flow { + id: positioner + move: Transition { + NumberAnimation { + properties: "x,y" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Flow::spacing @@ -968,6 +1020,7 @@ Flow { spacing is the amount in pixels left empty between each adjacent item, and defaults to 0. + \sa Grid::spacing */ class QDeclarativeFlowPrivate : public QDeclarativeBasePositionerPrivate diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 97cf05c..00f2848 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -78,9 +78,9 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() The following Repeater creates three instances of a \l Rectangle item within a \l Row: - \snippet doc/src/snippets/declarative/repeater.qml import + \snippet doc/src/snippets/declarative/repeaters/repeater.qml import \codeline - \snippet doc/src/snippets/declarative/repeater.qml simple + \snippet doc/src/snippets/declarative/repeaters/repeater.qml simple \image repeater-simple.png @@ -92,7 +92,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() 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/repeater.qml layout + \snippet doc/src/snippets/declarative/repeaters/repeater.qml layout \image repeater.png @@ -106,7 +106,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \table \row - \o \snippet doc/src/snippets/declarative/repeater.qml index + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index \o \image repeater-index.png \endtable @@ -115,7 +115,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \table \row - \o \snippet doc/src/snippets/declarative/repeater.qml modeldata + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata \o \image repeater-modeldata.png \endtable diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 83098ae..1f4c1c7 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -429,6 +429,9 @@ void QDeclarativeText::setStyle(QDeclarativeText::TextStyle style) if (d->style == style) return; + // changing to/from Normal requires the boundingRect() to change + if (isComponentComplete() && (d->style == Normal || style == Normal)) + prepareGeometryChange(); d->style = style; d->markImgDirty(); emit styleChanged(d->style); @@ -494,8 +497,9 @@ void QDeclarativeText::setHAlign(HAlignment align) if (d->hAlign == align) return; + if (isComponentComplete()) + prepareGeometryChange(); d->hAlign = align; - update(); emit horizontalAlignmentChanged(align); } @@ -511,8 +515,9 @@ void QDeclarativeText::setVAlign(VAlignment align) if (d->vAlign == align) return; + if (isComponentComplete()) + prepareGeometryChange(); d->vAlign = align; - update(); emit verticalAlignmentChanged(align); } @@ -805,7 +810,6 @@ void QDeclarativeTextPrivate::updateSize() else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) dy -= (int)doc->size().height(); - q->prepareGeometryChange(); QSize dsize = doc->size().toSize(); if (dsize != cachedLayoutSize) { q->prepareGeometryChange(); @@ -882,8 +886,6 @@ void QDeclarativeTextPrivate::drawOutline() ppm.drawPixmap(pos, imgCache); ppm.end(); - if (imgCache.size() != img.size()) - q_func()->prepareGeometryChange(); imgCache = img; } @@ -902,8 +904,6 @@ void QDeclarativeTextPrivate::drawOutline(int yOffset) ppm.drawPixmap(pos, imgCache); ppm.end(); - if (imgCache.size() != img.size()) - q_func()->prepareGeometryChange(); imgCache = img; } @@ -1054,8 +1054,6 @@ void QDeclarativeTextPrivate::checkImgCache() if (style != QDeclarativeText::Normal) imgStyleCache = wrappedTextImage(true); //### should use styleColor } - if (imgCache.size() != newImgCache.size()) - q_func()->prepareGeometryChange(); imgCache = newImgCache; if (!empty) switch (style) { @@ -1205,7 +1203,7 @@ void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event) } /*! - \qmlsignal Text::onLinkActivated(link) + \qmlsignal Text::onLinkActivated(string link) This handler is called when the user clicks on a link embedded in the text. The link must be in rich text or HTML format and the diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index b1c0fcd..3ac095c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -555,7 +555,7 @@ QRectF QDeclarativeTextEdit::positionToRectangle(int pos) const } /*! - \qmlmethod int TextEdit::positionAt(x,y) + \qmlmethod int TextEdit::positionAt(int x, int y) Returns the text position closest to pixel position (\a x, \a y). @@ -1018,7 +1018,7 @@ void QDeclarativeTextEdit::selectWord() } /*! - \qmlmethod void TextEdit::select(start,end) + \qmlmethod void TextEdit::select(int start, int end) Causes the text from \a start to \a end to be selected. |