diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-04-24 04:29:31 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-04-24 04:29:31 (GMT) |
commit | 0c5f0baa59ae56749707c9f73754132cd9b4a44d (patch) | |
tree | cc8e8ca8d889a64ee5cdaa91647b2cf221c8edf3 /src/declarative | |
parent | 363265d790c9f6b69d5a706209b28e467de3a2d6 (diff) | |
parent | db815819dae525c64575de38b92afa4cf092ce06 (diff) | |
download | Qt-0c5f0baa59ae56749707c9f73754132cd9b4a44d.zip Qt-0c5f0baa59ae56749707c9f73754132cd9b4a44d.tar.gz Qt-0c5f0baa59ae56749707c9f73754132cd9b4a44d.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
demos/declarative/webbrowser/WebBrowser.qml
demos/declarative/webbrowser/content/pics/addressbar-filled.png
demos/declarative/webbrowser/content/pics/addressbar.png
demos/declarative/webbrowser/content/pics/back-disabled.png
demos/declarative/webbrowser/content/pics/back.png
demos/declarative/webbrowser/content/pics/footer.png
demos/declarative/webbrowser/content/pics/forward-disabled.png
demos/declarative/webbrowser/content/pics/forward.png
demos/declarative/webbrowser/content/pics/header.png
demos/declarative/webbrowser/content/pics/reload.png
Diffstat (limited to 'src/declarative')
50 files changed, 564 insertions, 518 deletions
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index 3d3bf84..5e4b5fa 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -238,15 +238,15 @@ QPointF QSimpleCanvasItem::scenePos() const Controls the point about which simple transforms like scale apply. - \o TopLeft The top-left corner of the item. - \o TopCenter The center point of the top of the item. - \o TopRight The top-right corner of the item. - \o MiddleLeft The left most point of the vertical middle. - \o Center The center of the item. - \o MiddleRight The right most point of the vertical middle. - \o BottomLeft The bottom-left corner of the item. - \o BottomCenter The center point of the bottom of the item. - \o BottomRight The bottom-right corner of the item. + \value TopLeft The top-left corner of the item. + \value TopCenter The center point of the top of the item. + \value TopRight The top-right corner of the item. + \value MiddleLeft The left most point of the vertical middle. + \value Center The center of the item. + \value MiddleRight The right most point of the vertical middle. + \value BottomLeft The bottom-left corner of the item. + \value BottomCenter The center point of the bottom of the item. + \value BottomRight The bottom-right corner of the item. */ /*! diff --git a/src/declarative/extra/qmlnumberformatter.cpp b/src/declarative/extra/qmlnumberformatter.cpp index a12c4e6..60b154d 100644 --- a/src/declarative/extra/qmlnumberformatter.cpp +++ b/src/declarative/extra/qmlnumberformatter.cpp @@ -79,7 +79,7 @@ public: */ /*! \class QmlNumberFormatter - \ingroup utility + \ingroup group_utility \brief The QmlNumberFormatter class allows you to format a number to a particular string format/locale specific number format. */ diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index b7a7dd2..7372866 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -122,7 +122,7 @@ static qreal adjustedPosition(QFxItem *item, QFxAnchorLine::AnchorLine anchorLin /*! \internal \class QFxAnchors - \ingroup layouts + \ingroup group_layouts \brief The QFxAnchors class provides a way to lay out items relative to other items. \warning Currently, only anchoring to siblings or parent is supported. diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp index 773018f..9a3bb72 100644 --- a/src/declarative/fx/qfxblendedimage.cpp +++ b/src/declarative/fx/qfxblendedimage.cpp @@ -97,7 +97,7 @@ void QFxBlendedImage::setPrimaryUrl(const QString &url) } /*! - \property QFxBlendedImage::secondaryFile + \property QFxBlendedImage::secondaryUrl \brief the URL of the second image to be displayed in this item. */ QString QFxBlendedImage::secondaryUrl() const diff --git a/src/declarative/fx/qfxblurfilter.cpp b/src/declarative/fx/qfxblurfilter.cpp index 8cc9380..748fd8b 100644 --- a/src/declarative/fx/qfxblurfilter.cpp +++ b/src/declarative/fx/qfxblurfilter.cpp @@ -93,7 +93,7 @@ public: /*! \internal \class QFxBlurFilter - \ingroup effects + \ingroup group_effects \brief The QFxBlurFilter class allows you to blur an item. */ diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp index d561d05..b456716 100644 --- a/src/declarative/fx/qfxcomponentinstance.cpp +++ b/src/declarative/fx/qfxcomponentinstance.cpp @@ -60,6 +60,16 @@ QML_DEFINE_TYPE(QFxComponentInstance,ComponentInstance); /*! \qmlclass ComponentInstance QFxComponentInstance \brief The ComponentInstance element allows you to instantiate an arbitrary component. + + \code + <Item> + <Component id="RedSquare"> + <Rect color="red" width="10" height="10"/> + </Component> + + <ComponentInstance component="{RedSquare}"/> + </Item> + \endcode */ QFxComponentInstance::QFxComponentInstance(QFxItem *parent) : QFxItem(*(new QFxComponentInstancePrivate), parent) @@ -73,6 +83,11 @@ QFxComponentInstance::QFxComponentInstance(QFxComponentInstancePrivate &dd, QFxI setOptions(IsFocusRealm); } +/*! + \qmlproperty Component QFxComponentInstance::component + + This property holds the component to instantiate. +*/ QmlComponent *QFxComponentInstance::component() const { Q_D(const QFxComponentInstance); @@ -123,6 +138,11 @@ void QFxComponentInstance::updateSize() } } +/*! + \qmlproperty Item QFxComponentInstance::instance + + This property holds the instantiated component. +*/ QFxItem *QFxComponentInstance::instance() const { Q_D(const QFxComponentInstance); diff --git a/src/declarative/fx/qfxcontentwrapper.cpp b/src/declarative/fx/qfxcontentwrapper.cpp index 80710ca..5ce5430 100644 --- a/src/declarative/fx/qfxcontentwrapper.cpp +++ b/src/declarative/fx/qfxcontentwrapper.cpp @@ -95,7 +95,7 @@ QML_DEFINE_TYPE(QFxContent,Content); /*! \qmlclass Content QFxContent - \ingroup utility + \ingroup group_utility \brief Content is used as a placeholder for the content of a component. \inherits Item diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 7e13036..e35d6cf 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -253,7 +253,7 @@ QML_DEFINE_TYPE(QFxFlickable,Flickable); \class QFxFlickable \brief The QFxFlickable class provides a view that can be "flicked". - \ingroup widgets + \ingroup group_widgets QFxFlickable allows its children to be dragged and flicked. diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp index 6c6277a..d1ff3d3 100644 --- a/src/declarative/fx/qfxhighlightfilter.cpp +++ b/src/declarative/fx/qfxhighlightfilter.cpp @@ -96,7 +96,7 @@ public: /*! \internal \class QFxHighlightFilter - \ingroup effects + \ingroup group_effects \brief The QFxHightlightFilter class allows you to add a highlight to an item. */ diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index a137bc3..9fe491c 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -99,7 +99,7 @@ QML_DEFINE_TYPE(QFxImage,Image); \class QFxImage Image \brief The QFxImage class provides an image item that you can add to a QFxView. - \ingroup coreitems + \ingroup group_coreitems Example: \code diff --git a/src/declarative/fx/qfximageitem.cpp b/src/declarative/fx/qfximageitem.cpp index 6c257fa..a6f6d8f 100644 --- a/src/declarative/fx/qfximageitem.cpp +++ b/src/declarative/fx/qfximageitem.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE /*! \class QFxImageItem \brief The QFxImageItem class is an abstract base class for QFxView items that render using QPainter. - \ingroup coreitems + \ingroup group_coreitems This is a convenience class allowing easy use of a QPainter within a custom item. The contents of the item are are cached behind the scenes. diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 2406597..ade7d77 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -74,20 +74,49 @@ QML_DEFINE_TYPE(QFxItem,Item); QML_DEFINE_NOCREATE_TYPE(QSimpleCanvasFilter); /*! - \defgroup animation Animation - \defgroup coreitems Basic Items - \defgroup effects Effects - \defgroup layouts Layouts - \defgroup states States and Transitions - \defgroup utility Utility - \defgroup views Views - \defgroup widgets Widgets + \group group_animation + \title Animation +*/ + +/*! + \group group_coreitems + \title Basic Items +*/ + +/*! + \group group_effects + \title Effects +*/ + +/*! + \group group_layouts + \title Layouts +*/ + +/*! + \group group_states + \title States and Transitions +*/ + +/*! + \group group_utility + \title Utility +*/ + +/*! + \group group_views + \title Views +*/ + +/*! + \group group_widgets + \title Widgets */ /*! \internal \class QFxContents - \ingroup utility + \ingroup group_utility \brief The QFxContents class gives access to the height and width of an item's contents. */ @@ -194,7 +223,7 @@ void QFxContents::setItem(QFxItem *item) \endqml \endqmltext - \ingroup coreitems + \ingroup group_coreitems */ /*! @@ -291,7 +320,7 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::keyPress() + \fn void QFxItem::keyPress(QObject *event) This signal is emitted when a key is pressed. @@ -306,7 +335,7 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::keyRelease() + \fn void QFxItem::keyRelease(QObject *event) This signal is emitted when a key is released. @@ -751,10 +780,10 @@ void QFxItem::setQml(const QString &qml) } else { d->_qmlcomp = new QmlComponent(itemContext()->engine(), d->_qmlurl, this); - if(d->_qmlcomp->isReady()) + if(!d->_qmlcomp->isLoading()) qmlLoaded(); else - QObject::connect(d->_qmlcomp, SIGNAL(readyChanged()), + QObject::connect(d->_qmlcomp, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(qmlLoaded())); } } @@ -768,7 +797,7 @@ void QFxItem::qmlLoaded() // ### for (int i=0; i<d->_qmlnewloading.length(); ++i) { QmlComponent *c = d->_qmlnewcomp.at(i); - if(!c->isReady()) + if(c->isLoading()) continue; QmlContext *ctxt = new QmlContext(itemContext()); @@ -1618,10 +1647,10 @@ void QFxItem::newChild(const QString &type) d->_qmlnewloading.append(url); d->_qmlnewcomp.append(new QmlComponent(itemContext()->engine(), url, this)); - if(d->_qmlnewcomp.last()->isReady()) + if(!d->_qmlnewcomp.last()->isLoading()) qmlLoaded(); else - connect(d->_qmlnewcomp.last(), SIGNAL(readyChanged()), + connect(d->_qmlnewcomp.last(), SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(qmlLoaded())); } diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp index 8598ad6..7d5726f 100644 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ b/src/declarative/fx/qfxkeyproxy.cpp @@ -56,7 +56,7 @@ QML_DEFINE_TYPE(QFxKeyProxy,KeyProxy); \internal \class QFxKeyProxy \brief The QFxKeyProxy class proxies key presses to a number of other elements. - \ingroup utility + \ingroup group_utility */ class QFxKeyProxyPrivate diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp index 455b8a5..b89e795 100644 --- a/src/declarative/fx/qfxlayouts.cpp +++ b/src/declarative/fx/qfxlayouts.cpp @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE that you use the move, remove and add transitions when those conditions arise. - \ingroup layouts + \ingroup group_layouts */ QFxBaseLayout::QFxBaseLayout(AutoUpdateType at, QFxItem *parent) : QFxItem(*(new QFxBaseLayoutPrivate), parent) @@ -577,7 +577,7 @@ QML_DEFINE_TYPE(QFxVerticalLayout, VerticalLayout); \internal \class QFxVerticalLayout \brief The QFxVerticalLayout class lines up items vertically. - \ingroup layouts + \ingroup group_layouts */ QFxVerticalLayout::QFxVerticalLayout(QFxItem *parent) : QFxBaseLayout(Vertical, parent) @@ -612,7 +612,6 @@ void QFxVerticalLayout::doLayout() setMovingItem(child); child->setY(voffset); setMovingItem(0); - child->setX(0); } voffset += child->height(); voffset += spacing(); @@ -731,7 +730,7 @@ QML_DEFINE_TYPE(QFxHorizontalLayout,HorizontalLayout); \internal \class QFxHorizontalLayout \brief The QFxHorizontalLayout class lines up items horizontally. - \ingroup layouts + \ingroup group_layouts */ QFxHorizontalLayout::QFxHorizontalLayout(QFxItem *parent) : QFxBaseLayout(Horizontal, parent) @@ -766,7 +765,6 @@ void QFxHorizontalLayout::doLayout() setMovingItem(child); child->setX(hoffset); setMovingItem(0); - child->setY(0); } hoffset += child->width(); hoffset += spacing(); @@ -910,7 +908,7 @@ QML_DEFINE_TYPE(QFxGridLayout,GridLayout); \internal \class QFxGridLayout \brief The QFxGridLayout class lays out items in a grid. - \ingroup layouts + \ingroup group_layouts */ QFxGridLayout::QFxGridLayout(QFxItem *parent) : diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp index 2bf7aa7..c6a7f96 100644 --- a/src/declarative/fx/qfxmouseregion.cpp +++ b/src/declarative/fx/qfxmouseregion.cpp @@ -242,7 +242,7 @@ QML_DEFINE_TYPE(QFxMouseRegion,MouseRegion); \class QFxMouseRegion \brief The QFxMouseRegion class provides a simple mouse handling abstraction for use within Qml. - \ingroup coreitems + \ingroup group_coreitems All QFxItem derived classes can do mouse handling but the QFxMouseRegion class exposes mouse handling data as properties and tracks flicking and dragging of the mouse. diff --git a/src/declarative/fx/qfxpainted.cpp b/src/declarative/fx/qfxpainted.cpp index a1eec69..8109efa 100644 --- a/src/declarative/fx/qfxpainted.cpp +++ b/src/declarative/fx/qfxpainted.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \class QFxPainted \brief QFxPainted is an abstract base class for QFxView items that paint using QPainter. - \ingroup coreitems + \ingroup group_coreitems This is a convenience class allowing easy use of QPainter within a custom item. The contents of the item are cached behind the scenes. Any time you change the contents diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 3526541..939afba 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -110,7 +110,7 @@ QML_DEFINE_TYPE(QFxParticleMotion,ParticleMotion); /*! \class QFxParticleMotion - \ingroup effects + \ingroup group_effects \brief The QFxParticleMotion class is the base class for particle motion. This class causes the particles to remain static. @@ -160,7 +160,7 @@ void QFxParticleMotion::destroy(QFxParticle &particle) /*! \internal \class QFxParticleMotionLinear - \ingroup effects + \ingroup group_effects \brief The QFxParticleMotionLinear class moves the particles linearly. \sa QFxParticles @@ -184,7 +184,7 @@ void QFxParticleMotionLinear::advance(QFxParticle &p, int interval) /*! \internal \class QFxParticleMotionGravity - \ingroup effects + \ingroup group_effects \brief The QFxParticleMotionGravity class moves the particles towards a point. \sa QFxParticles @@ -259,7 +259,7 @@ void QFxParticleMotionGravity::advance(QFxParticle &p, int interval) /*! \internal \class QFxParticleMotionWander - \ingroup effects + \ingroup group_effects \brief The QFxParticleMotionWander class moves particles in a somewhat random fashion. The particles will continue roughly in the original direction, however will randomly @@ -544,7 +544,7 @@ QML_DEFINE_TYPE(QFxParticles,Particles); /*! \internal \class QFxParticles - \ingroup effects + \ingroup group_effects \brief The QFxParticles class generates and moves particles. */ diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp index 199f5fb..14c06bb 100644 --- a/src/declarative/fx/qfxpath.cpp +++ b/src/declarative/fx/qfxpath.cpp @@ -65,7 +65,7 @@ QML_DEFINE_TYPE(QFxPathCubic,PathCubic); /*! \internal \class QFxPath - \ingroup utility + \ingroup group_utility \brief The QFxPath class defines a path. \sa QFxPathView */ @@ -469,7 +469,7 @@ void QFxCurve::setY(int y) /*! \internal \class QFxPathAttribute - \ingroup utility + \ingroup group_utility \brief The QFxPathAttribute class allows to set the value of an attribute at a given position in the path. \sa QFxPath @@ -527,7 +527,7 @@ void QFxPathAttribute::setValue(qreal value) /*! \internal \class QFxPathLine - \ingroup utility + \ingroup group_utility \brief The QFxPathLine class defines a straight line. \sa QFxPath @@ -549,7 +549,7 @@ void QFxPathLine::addToPath(QPainterPath &path) /*! \internal \class QFxPathQuad - \ingroup utility + \ingroup group_utility \brief The QFxPathQuad class defines a quadratic Bezier curve with a control point. \sa QFxPath @@ -613,7 +613,7 @@ void QFxPathQuad::addToPath(QPainterPath &path) /*! \internal \class QFxPathCubic - \ingroup utility + \ingroup group_utility \brief The QFxPathCubic class defines a cubic Bezier curve with two control points. \sa QFxPath @@ -723,7 +723,7 @@ void QFxPathCubic::addToPath(QPainterPath &path) /*! \internal \class QFxPathPercent - \ingroup utility + \ingroup group_utility \brief The QFxPathPercent class manipulates the way a path is interpreted. QFxPathPercent allows you to bunch up items (or spread out items) along various diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 79b0f8e..99f6e86 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -88,7 +88,7 @@ private: \class QFxPathView \brief The QFxPathView class lays out items provided by a model on a path. - \ingroup views + \ingroup group_views The model must be a \l QListModelInterface subclass. diff --git a/src/declarative/fx/qfxpixmap.cpp b/src/declarative/fx/qfxpixmap.cpp index 883dbdf..5a08679 100644 --- a/src/declarative/fx/qfxpixmap.cpp +++ b/src/declarative/fx/qfxpixmap.cpp @@ -85,7 +85,7 @@ public: /*! \internal \class QFxPixmap - \ingroup utility + \ingroup group_utility \brief Enacapsultes a pixmap for QFx items. This class is NOT reentrant. diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 718dc76..2e84c74 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -49,7 +49,7 @@ QML_DEFINE_TYPE(QFxPen,Pen); /*! \internal \class QFxPen - \ingroup utility + \ingroup group_utility \brief The QFxPen class provides a pen used for drawing rect borders on a QFxView. Example: @@ -126,7 +126,7 @@ QML_DEFINE_TYPE(QFxRect,Rect); A QFxRect object can be instantiated in Qml using the tag \l Rect. - \ingroup coreitems + \ingroup group_coreitems */ QFxRect::QFxRect(QFxItem *parent) : QFxItem(*(new QFxRectPrivate), parent) diff --git a/src/declarative/fx/qfxreflectionfilter.cpp b/src/declarative/fx/qfxreflectionfilter.cpp index a541083..d67095b 100644 --- a/src/declarative/fx/qfxreflectionfilter.cpp +++ b/src/declarative/fx/qfxreflectionfilter.cpp @@ -111,7 +111,7 @@ public: /*! \internal \class QFxReflectionFilter - \ingroup effects + \ingroup group_effects \brief The QFxReflectionFilter class allows you to add a reflection to an item. */ QFxReflectionFilter::QFxReflectionFilter(QObject *parent) diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 823932c..ec1d88c 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -122,7 +122,7 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater); /*! \internal \class QFxRepeater - \ingroup utility + \ingroup group_utility \qmlclass Repeater \brief The QFxRepeater class allows you to repeat a component based on a diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp index d10899f..3760a4d 100644 --- a/src/declarative/fx/qfxshadowfilter.cpp +++ b/src/declarative/fx/qfxshadowfilter.cpp @@ -90,7 +90,7 @@ public: /*! \internal \class QFxShadowFilter - \ingroup effects + \ingroup group_effects \brief The QFxShadowFilter class allows you to add a shadow to an item. */ @@ -128,7 +128,7 @@ void QFxShadowFilter::setXOffset(int offset) } /*! - \property QFxShadowFilter::xOffset + \property QFxShadowFilter::yOffset \brief the y offset of the shadow relative to the item. */ int QFxShadowFilter::yOffset() const diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 9cf1bb0..bc03d7c 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -93,7 +93,7 @@ QML_DEFINE_TYPE(QFxText,Text); \internal \class QFxText \qmlclass Text - \ingroup coreitems + \ingroup group_coreitems \brief The QFxText class provides a formatted text item that you can add to a QFxView. diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index ebfe799..96ebe0d 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -83,7 +83,7 @@ QML_DEFINE_TYPE(QFxTextEdit, TextEdit); \internal \class QFxTextEdit \qmlclass TextEdit - \ingroup coreitems + \ingroup group_coreitems \brief The QFxTextEdit class provides an editable formatted text item that you can add to a QFxView. diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index 8d8e5b4..90875a6 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -344,7 +344,7 @@ public: \class QFxFlipable \brief The QFxFlipable class provides a flipable surface. - \ingroup widgets + \ingroup group_widgets QFxFlipable allows you to specify a front and a back, as well as an axis for the flip. diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index c4a2750..a5d2ac3 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -243,7 +243,7 @@ void QFxWebView::componentComplete() This property holds the progress of loading the current URL, from 0 to 1. */ /*! - \property qreal QFxWebView::progress + \property QFxWebView::progress \brief the progress of loading the current URL, from 0 to 1. */ qreal QFxWebView::progress() const @@ -284,7 +284,7 @@ void QFxWebView::doLoadFinished(bool ok) loading of the URL successfully starts. */ /*! - \property QString QFxWebView::url + \property QFxWebView::url \brief the URL to the page displayed in this item. \sa urlChanged() @@ -330,7 +330,7 @@ void QFxWebView::setUrl(const QString &n) This property holds the ideal width for displaying the current URL. */ /*! - \property int QFxWebView::idealWidth + \property QFxWebView::idealWidth \brief the ideal width for displaying the current URL. */ int QFxWebView::idealWidth() const @@ -353,7 +353,7 @@ void QFxWebView::setIdealWidth(int iw) This property holds the ideal height for displaying the current URL. */ /*! - \property int QFxWebView::idealHeight + \property QFxWebView::idealHeight \brief the ideal height for displaying the current URL. */ int QFxWebView::idealHeight() const @@ -376,7 +376,7 @@ void QFxWebView::setIdealHeight(int ih) This property holds controls whether the item responds to mouse and key events. */ /*! - \property bool QFxWebView::interactive + \property QFxWebView::interactive \brief controls whether the item responds to mouse and key events. */ bool QFxWebView::interactive() const @@ -398,7 +398,7 @@ void QFxWebView::setInteractive(bool i) This property holds hints as to whether the item should be drawn anti-aliased. */ /*! - \property bool QFxWebView::smooth + \property QFxWebView::smooth \brief hints as to whether the item should be drawn anti-aliased. */ bool QFxWebView::smooth() const @@ -466,7 +466,7 @@ void QFxWebView::paintPage(const QRect& r) The cache will not be larger than the (unscaled) size of the WebView. */ /*! - \property int QFxWebView::cacheSize + \property QFxWebView::cacheSize \brief the maximum number of pixels of image cache to allow The default is 0.1 megapixels. @@ -1029,7 +1029,7 @@ public: QmlEngine *engine = webview->itemContext()->engine(); component = new QmlComponent(engine, url, this); item = 0; - connect(engine, SIGNAL(readyChanged()), this, SLOT(qmlLoaded())); + connect(engine, SIGNAL(statusChanged(Status)), this, SLOT(qmlLoaded())); } public Q_SLOTS: diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 9af0a06..f03ce20 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -448,7 +448,7 @@ void QmlCompiler::reset(QmlCompiledComponent *cc, bool deleteMemory) } bool QmlCompiler::compile(QmlEngine *engine, - QmlCompositeTypeManager::TypeData *unit, + QmlCompositeTypeData *unit, QmlCompiledComponent *out) { #ifdef Q_ENABLE_PERFORMANCE_LOG @@ -463,7 +463,7 @@ bool QmlCompiler::compile(QmlEngine *engine, // Compile types for(int ii = 0; ii < unit->types.count(); ++ii) { - QmlCompositeTypeManager::TypeData::TypeReference &tref = unit->types[ii]; + QmlCompositeTypeData::TypeReference &tref = unit->types[ii]; QmlCompiledComponent::TypeReference ref; if(tref.type) ref.type = tref.type; diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 732d9ea..754e284 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -112,7 +112,7 @@ class Q_DECLARATIVE_EXPORT QmlCompiler public: QmlCompiler(); - bool compile(QmlEngine *, QmlCompositeTypeManager::TypeData *, QmlCompiledComponent *); + bool compile(QmlEngine *, QmlCompositeTypeData *, QmlCompiledComponent *); bool isError() const; qint64 errorLine() const; diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index c863a00..83d500c 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -65,8 +65,43 @@ class QByteArray; \brief The QmlComponent class encapsulates a QML component description. \mainclass */ + +/*! + \qmlclass Component QmlComponent + \brief The Component element encapsulates a QML component description. + + Components are reusable, encapsulated Qml element with a well-defined interface. + They are often defined in \l {components}{Component Files}. + + The \e Component element allows defining components within a QML file. + This can be useful for reusing a small component within a single QML + file, or for defining a component that logically belongs with the + file containing it. + + \code + <Item> + <Component id="RedSquare"> + <Rect color="red" width="10" height="10"/> + </Component> + + <ComponentInstance component="{RedSquare}"/> + <ComponentInstance component="{RedSquare}" x="20"/> + </Item> + \endcode +*/ QML_DEFINE_TYPE(QmlComponent,Component); +/*! + \enum QmlComponent::Status + + Specifies the loading status of the QmlComponent. + + \value Null This QmlComponent has no data. Call loadUrl() or setData() to add QML content. + \value Ready This QmlComponent is ready and create() may be called. + \value Loading This QmlComponent is loading network data. + \value Error An error has occured. Calling errorDescription() to retrieve a description. +*/ + void QmlComponentPrivate::typeDataReady() { Q_Q(QmlComponent); @@ -76,19 +111,21 @@ void QmlComponentPrivate::typeDataReady() fromTypeData(typeData); typeData = 0; - emit q->readyChanged(); + emit q->statusChanged(q->status()); } -void QmlComponentPrivate::fromTypeData(QmlCompositeTypeManager::TypeData *data) +void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data) { - name = data->url; + url = QUrl(data->url); QmlCompiledComponent *c = data->toCompiledComponent(engine); if(!c) { - Q_ASSERT(data->status == QmlCompositeTypeManager::TypeData::Error); + Q_ASSERT(data->status == QmlCompositeTypeData::Error); + errorDescription = data->errorDescription; qWarning().nospace() << "QmlComponent: " << data->errorDescription.toLatin1().constData(); + } else { cc = c; @@ -98,14 +135,26 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeManager::TypeData *data) data->release(); } +void QmlComponentPrivate::clear() +{ + if(typeData) { + typeData->remWaiter(this); + typeData->release(); + typeData = 0; + } + + if(cc) { + cc->release(); + cc = 0; + } +} + /*! - Construct a null QmlComponent. + \internal */ QmlComponent::QmlComponent(QObject *parent) : QObject(*(new QmlComponentPrivate), parent) { - Q_D(QmlComponent); - d->name = QLatin1String("<unspecified file>"); } /*! @@ -122,62 +171,66 @@ QmlComponent::~QmlComponent() d->cc->release(); } -/*! - \property QmlComponent::name - \brief the component's name. - - The component's name is used in error and warning messages. If available, - the XML source file name is used as the component's name, otherwise it is - set to "<unspecified file>". -*/ -QString QmlComponent::name() const +QmlComponent::Status QmlComponent::status() const { Q_D(const QmlComponent); - return d->name; -} -void QmlComponent::setName(const QString &name) -{ - Q_D(QmlComponent); - d->name = name; + if(d->typeData) + return Loading; + else if(d->engine && d->cc) + return Ready; + else if(!d->errorDescription.isEmpty()) + return Error; + else + return Null; } /*! - \internal + Returns true if the component is in the Null state, false otherwise. + + Equivalent to status() == QmlComponent::Null. */ -QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledComponent *cc, int start, int count, QObject *parent) - : QObject(*(new QmlComponentPrivate), parent) +bool QmlComponent::isNull() const { - Q_D(QmlComponent); - d->engine = engine; - d->name = QLatin1String("<unspecified file>"); - d->cc = cc; - cc->addref(); - d->start = start; - d->count = count; + return status() == Null; } -QmlComponent::QmlComponent(QmlEngine *engine, const QUrl &url, QObject *parent) -: QObject(*(new QmlComponentPrivate), parent) +/*! + Returns true if the component is in the Ready state, false otherwise. + + Equivalent to status() == QmlComponent::Ready. +*/ +bool QmlComponent::isReady() const { - Q_D(QmlComponent); - d->engine = engine; - d->name = url.toString(); + return status() == Ready; +} - QmlCompositeTypeManager::TypeData *data = - engine->d_func()->typeManager.get(url); +/*! + Returns true if the component is in the Error state, false otherwise. - if(data->status == QmlCompositeTypeManager::TypeData::Waiting) { + Equivalent to status() == QmlComponent::Error. +*/ +bool QmlComponent::isError() const +{ + return status() == Error; +} - d->typeData = data; - d->typeData->addWaiter(d); +/*! + Returns true if the component is in the Loading state, false otherwise. - } else { + Equivalent to status() == QmlComponent::Loading. +*/ +bool QmlComponent::isLoading() const +{ + return status() == Loading; +} - d->fromTypeData(data); +/*! + \fn void QmlComponent::statusChanged(QmlComponent::Status status) - } -} + Emitted whenever the component's status changes. \a status will be the + new status. +*/ /*! Create a QmlComponent with no data. Set setData(). @@ -190,6 +243,17 @@ QmlComponent::QmlComponent(QmlEngine *engine, QObject *parent) } /*! + Create a QmlComponent from the given \a url. +*/ +QmlComponent::QmlComponent(QmlEngine *engine, const QUrl &url, QObject *parent) +: QObject(*(new QmlComponentPrivate), parent) +{ + Q_D(QmlComponent); + d->engine = engine; + loadUrl(url); +} + +/*! Create a QmlComponent from the given XML \a data. If provided, \a filename is used to set the component name, and to provide a base path for items resolved by this component. @@ -203,27 +267,36 @@ QmlComponent::QmlComponent(QmlEngine *engine, const QByteArray &data, const QUrl } /*! - Sets the QmlComponent to use the given XML \a data. If provided, \a filename - is used to set the component name, and to provide a base path for items - resolved by this component. + \internal +*/ +QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledComponent *cc, int start, int count, QObject *parent) + : QObject(*(new QmlComponentPrivate), parent) +{ + Q_D(QmlComponent); + d->engine = engine; + d->cc = cc; + cc->addref(); + d->start = start; + d->count = count; +} - Currently only supported to call once per component. +/*! + Sets the QmlComponent to use the given XML \a data. If provided, + \a filename is used to set the component name, and to provide a base path + for items resolved by this component. */ void QmlComponent::setData(const QByteArray &data, const QUrl &url) { Q_D(QmlComponent); - if(d->cc) d->cc->release(); - if(d->typeData) d->typeData->release(); - d->cc = 0; - d->typeData = 0; + d->clear(); - d->name = url.toString(); + d->url = url; - QmlCompositeTypeManager::TypeData *typeData = + QmlCompositeTypeData *typeData = d->engine->d_func()->typeManager.getImmediate(data, url); - if(typeData->status == QmlCompositeTypeManager::TypeData::Waiting) { + if(typeData->status == QmlCompositeTypeData::Waiting) { d->typeData = typeData; d->typeData->addWaiter(d); @@ -234,13 +307,54 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url) } + emit statusChanged(status()); } -bool QmlComponent::isReady() const +/*! + Load the QmlComponent from the provided \a url. +*/ +void QmlComponent::loadUrl(const QUrl &url) +{ + Q_D(QmlComponent); + + d->clear(); + + d->url = url; + + QmlCompositeTypeData *data = + d->engine->d_func()->typeManager.get(url); + + if(data->status == QmlCompositeTypeData::Waiting) { + + d->typeData = data; + d->typeData->addWaiter(d); + + } else { + + d->fromTypeData(data); + + } + + emit statusChanged(status()); +} + +QString QmlComponent::errorDescription() const { Q_D(const QmlComponent); + if(isError()) + return d->errorDescription; + else + return QString(); +} - return d->engine && !d->typeData; +/*! + Return the component URL. This is the URL passed to either the constructor, + or the loadUrl() or setData() methods. +*/ +QUrl QmlComponent::url() const +{ + Q_D(const QmlComponent); + return d->url; } /*! @@ -249,9 +363,6 @@ bool QmlComponent::isReady() const QmlComponent::QmlComponent(QmlComponentPrivate &dd, QObject *parent) : QObject(dd, parent) { - Q_D(QmlComponent); - d->name = QLatin1String("<unspecified file>"); - d->cc = new QmlCompiledComponent; } /*! @@ -320,8 +431,9 @@ QObject *QmlComponent::beginCreate(QmlContext *context) qWarning("QmlComponent: Cannot create new component instance before completing the previous"); return 0; } - if (!d->cc) { - qWarning("QmlComponent: Cannot load component data"); + + if(!isReady()) { + qWarning("QmlComponent: Cannot create un-ready component"); return 0; } @@ -345,7 +457,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context) << "QmlComponent: " #endif << vme.errorDescription().toLatin1().constData() << " @" - << d->name.toLatin1().constData() << ":" << vme.errorLine(); + << d->url.toString().toLatin1().constData() << ":" << vme.errorLine(); } diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h index 1a74fe9..83d08ea 100644 --- a/src/declarative/qml/qmlcomponent.h +++ b/src/declarative/qml/qmlcomponent.h @@ -62,36 +62,43 @@ class Q_DECLARATIVE_EXPORT QmlComponent : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QmlComponent); - Q_PROPERTY(QString name READ name WRITE setName); - public: - QmlComponent(QObject *parent=0); + QmlComponent(QObject *parent = 0); QmlComponent(QmlEngine *, QObject *parent=0); QmlComponent(QmlEngine *, const QUrl &url, QObject *parent = 0); - QmlComponent(QmlEngine *, const QByteArray &, const QUrl &url=QUrl(), QObject *parent=0); - ~QmlComponent(); + QmlComponent(QmlEngine *, const QByteArray &data, + const QUrl &baseUrl=QUrl(), QObject *parent=0); + virtual ~QmlComponent(); - virtual QObject *create(QmlContext *context = 0); - virtual QObject *beginCreate(QmlContext *); - virtual void completeCreate(); + enum Status { Null, Ready, Loading, Error }; + Status status() const; - QString name() const; - void setName(const QString &name); + bool isNull() const; + bool isReady() const; + bool isError() const; + bool isLoading() const; + QString errorDescription() const; - void setData(const QByteArray &, const QUrl &url); + QUrl url() const; - bool isReady() const; + virtual QObject *create(QmlContext *context = 0); + virtual QObject *beginCreate(QmlContext *); + virtual void completeCreate(); - QmlComponent(QmlEngine *, QmlCompiledComponent *, int, int, QObject *parent); + void loadUrl(const QUrl &url); + void setData(const QByteArray &, const QUrl &baseUrl = QUrl()); Q_SIGNALS: - void readyChanged(); + void statusChanged(QmlComponent::Status); protected: QmlComponent(QmlComponentPrivate &dd, QObject* parent); private: + QmlComponent(QmlEngine *, QmlCompiledComponent *, int, int, QObject *parent); + friend class QmlVME; + friend class QmlCompositeTypeData; }; QML_DECLARE_TYPE(QmlComponent); diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h index e97ec67..8074775 100644 --- a/src/declarative/qml/qmlcomponent_p.h +++ b/src/declarative/qml/qmlcomponent_p.h @@ -63,12 +63,13 @@ class QmlComponentPrivate : public QObjectPrivate public: QmlComponentPrivate() : typeData(0), start(-1), count(-1), cc(0), completePending(false), engine(0) {} - QmlCompositeTypeManager::TypeData *typeData; + QmlCompositeTypeData *typeData; void typeDataReady(); - void fromTypeData(QmlCompositeTypeManager::TypeData *data); + void fromTypeData(QmlCompositeTypeData *data); - QString name; + QString errorDescription; + QUrl url; int start; int count; @@ -78,6 +79,8 @@ public: bool completePending; QmlEngine *engine; + + void clear(); }; #endif // QMLCOMPONENT_P_H diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index 65596ae..b0d121c 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -50,12 +50,12 @@ #include <QtDeclarative/qmlcomponent.h> #include <private/qmlcomponent_p.h> -QmlCompositeTypeManager::TypeData::TypeData() +QmlCompositeTypeData::QmlCompositeTypeData() : status(Invalid), component(0), compiledComponent(0) { } -QmlCompositeTypeManager::TypeData::~TypeData() +QmlCompositeTypeData::~QmlCompositeTypeData() { for(int ii = 0; ii < dependants.count(); ++ii) dependants.at(ii)->release(); @@ -67,17 +67,17 @@ QmlCompositeTypeManager::TypeData::~TypeData() delete component; } -void QmlCompositeTypeManager::TypeData::addWaiter(QmlComponentPrivate *p) +void QmlCompositeTypeData::addWaiter(QmlComponentPrivate *p) { waiters << p; } -void QmlCompositeTypeManager::TypeData::remWaiter(QmlComponentPrivate *p) +void QmlCompositeTypeData::remWaiter(QmlComponentPrivate *p) { waiters.removeAll(p); } -QmlComponent *QmlCompositeTypeManager::TypeData::toComponent(QmlEngine *engine) +QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine) { if(!component) { @@ -94,7 +94,7 @@ QmlComponent *QmlCompositeTypeManager::TypeData::toComponent(QmlEngine *engine) } QmlCompiledComponent * -QmlCompositeTypeManager::TypeData::toCompiledComponent(QmlEngine *engine) +QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine) { if(status == Complete && !compiledComponent) { @@ -123,7 +123,7 @@ QmlCompositeTypeManager::TypeData::toCompiledComponent(QmlEngine *engine) return compiledComponent; } -QmlCompositeTypeManager::TypeData::TypeReference::TypeReference() +QmlCompositeTypeData::TypeReference::TypeReference() : type(0), unit(0), parser(0) { } @@ -133,13 +133,13 @@ QmlCompositeTypeManager::QmlCompositeTypeManager(QmlEngine *e) { } -QmlCompositeTypeManager::TypeData *QmlCompositeTypeManager::get(const QUrl &url) +QmlCompositeTypeData *QmlCompositeTypeManager::get(const QUrl &url) { - TypeData *unit = components.value(url.toString()); + QmlCompositeTypeData *unit = components.value(url.toString()); if(!unit) { - unit = new TypeData; - unit->status = TypeData::Waiting; + unit = new QmlCompositeTypeData; + unit->status = QmlCompositeTypeData::Waiting; unit->url = url.toString(); components.insert(url.toString(), unit); @@ -150,11 +150,11 @@ QmlCompositeTypeManager::TypeData *QmlCompositeTypeManager::get(const QUrl &url) return unit; } -QmlCompositeTypeManager::TypeData * +QmlCompositeTypeData * QmlCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url) { - TypeData *unit = new TypeData; - unit->status = TypeData::Waiting; + QmlCompositeTypeData *unit = new QmlCompositeTypeData; + unit->status = QmlCompositeTypeData::Waiting; unit->url = url.toString(); setData(unit, data, url); return unit; @@ -163,7 +163,7 @@ QmlCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url) void QmlCompositeTypeManager::clearCache() { for(Components::Iterator iter = components.begin(); iter != components.end();) { - if((*iter)->status != TypeData::Waiting) { + if((*iter)->status != QmlCompositeTypeData::Waiting) { (*iter)->release(); iter = components.erase(iter); } else { @@ -177,7 +177,7 @@ void QmlCompositeTypeManager::replyFinished() { QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); - TypeData *unit = components.value(reply->url().toString()); + QmlCompositeTypeData *unit = components.value(reply->url().toString()); Q_ASSERT(unit); if(reply->error() != QNetworkReply::NoError) { @@ -187,7 +187,7 @@ void QmlCompositeTypeManager::replyFinished() errorDescription = QLatin1String("Network error for URL ") + reply->url().toString(); - unit->status = TypeData::Error; + unit->status = QmlCompositeTypeData::Error; unit->errorDescription = errorDescription; doComplete(unit); @@ -200,7 +200,7 @@ void QmlCompositeTypeManager::replyFinished() reply->deleteLater(); } -void QmlCompositeTypeManager::loadSource(TypeData *unit) +void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit) { QUrl url(unit->url); @@ -214,7 +214,7 @@ void QmlCompositeTypeManager::loadSource(TypeData *unit) QString errorDescription; // ### - Fill in error errorDescription = QLatin1String("File error for URL ") + url.toString(); - unit->status = TypeData::Error; + unit->status = QmlCompositeTypeData::Error; unit->errorDescription = errorDescription; doComplete(unit); } @@ -227,12 +227,13 @@ void QmlCompositeTypeManager::loadSource(TypeData *unit) } } -void QmlCompositeTypeManager::setData(TypeData *unit, const QByteArray &data, - const QUrl &url) +void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit, + const QByteArray &data, + const QUrl &url) { if(!unit->data.parse(data, url)) { - unit->status = TypeData::Error; + unit->status = QmlCompositeTypeData::Error; unit->errorDescription = unit->data.errorDescription(); doComplete(unit); @@ -244,7 +245,7 @@ void QmlCompositeTypeManager::setData(TypeData *unit, const QByteArray &data, } } -void QmlCompositeTypeManager::doComplete(TypeData *unit) +void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit) { for(int ii = 0; ii < unit->dependants.count(); ++ii) { checkComplete(unit->dependants.at(ii)); @@ -258,34 +259,34 @@ void QmlCompositeTypeManager::doComplete(TypeData *unit) } } -void QmlCompositeTypeManager::checkComplete(TypeData *unit) +void QmlCompositeTypeManager::checkComplete(QmlCompositeTypeData *unit) { - if(unit->status != TypeData::Waiting) + if(unit->status != QmlCompositeTypeData::Waiting) return; int waiting = 0; for(int ii = 0; ii < unit->types.count(); ++ii) { - TypeData *u = unit->types.at(ii).unit; + QmlCompositeTypeData *u = unit->types.at(ii).unit; if(!u) continue; - if(u->status == TypeData::Error) { - unit->status = TypeData::Error; + if(u->status == QmlCompositeTypeData::Error) { + unit->status = QmlCompositeTypeData::Error; unit->errorDescription = u->errorDescription; doComplete(unit); return; - } else if(u->status == TypeData::Waiting) { + } else if(u->status == QmlCompositeTypeData::Waiting) { waiting++; } } if(!waiting) { - unit->status = TypeData::Complete; + unit->status = QmlCompositeTypeData::Complete; doComplete(unit); } } -void QmlCompositeTypeManager::compile(TypeData *unit) +void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) { QStringList typeNames = unit->data.types(); @@ -293,7 +294,7 @@ void QmlCompositeTypeManager::compile(TypeData *unit) for(int ii = 0; ii < typeNames.count(); ++ii) { QByteArray type = typeNames.at(ii).toLatin1(); - TypeData::TypeReference ref; + QmlCompositeTypeData::TypeReference ref; if (type == QByteArray("Property") || type == QByteArray("Signal")) { unit->types << ref; @@ -317,11 +318,11 @@ void QmlCompositeTypeManager::compile(TypeData *unit) } QUrl url = engine->componentUrl(QUrl(type + ".qml"), QUrl(unit->url)); - TypeData *urlUnit = components.value(url.toString()); + QmlCompositeTypeData *urlUnit = components.value(url.toString()); if(!urlUnit) { - urlUnit = new TypeData; - urlUnit->status = TypeData::Waiting; + urlUnit = new QmlCompositeTypeData; + urlUnit->status = QmlCompositeTypeData::Waiting; urlUnit->url = url.toString(); components.insert(url.toString(), urlUnit); @@ -330,17 +331,17 @@ void QmlCompositeTypeManager::compile(TypeData *unit) ref.unit = urlUnit; switch(urlUnit->status) { - case TypeData::Invalid: - case TypeData::Error: - unit->status = TypeData::Error; + case QmlCompositeTypeData::Invalid: + case QmlCompositeTypeData::Error: + unit->status = QmlCompositeTypeData::Error; unit->errorDescription = urlUnit->errorDescription; doComplete(unit); return; - case TypeData::Complete: + case QmlCompositeTypeData::Complete: break; - case TypeData::Waiting: + case QmlCompositeTypeData::Waiting: unit->addref(); ref.unit->dependants << unit; waiting++; @@ -351,9 +352,9 @@ void QmlCompositeTypeManager::compile(TypeData *unit) } if(waiting) { - unit->status = TypeData::Waiting; + unit->status = QmlCompositeTypeData::Waiting; } else { - unit->status = TypeData::Complete; + unit->status = QmlCompositeTypeData::Complete; doComplete(unit); } } diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h index 6982844..814e753 100644 --- a/src/declarative/qml/qmlcompositetypemanager_p.h +++ b/src/declarative/qml/qmlcompositetypemanager_p.h @@ -53,70 +53,71 @@ class QmlEngine; class QmlCompiledComponent; class QmlComponentPrivate; class QmlComponent; +struct QmlCompositeTypeData : public QmlRefCount +{ + QmlCompositeTypeData(); + virtual ~QmlCompositeTypeData(); + + enum Status { + Invalid, + Complete, + Error, + Waiting + }; + Status status; + QString errorDescription; + + QString url; + QList<QmlCompositeTypeData *> dependants; + + // Return a QmlComponent if the QmlCompositeTypeData is not in the Waiting + // state. The QmlComponent is owned by the QmlCompositeTypeData, so a + // reference should be kept to keep the QmlComponent alive. + QmlComponent *toComponent(QmlEngine *); + // Return a QmlCompiledComponent if possible, or 0 if an error + // occurs + QmlCompiledComponent *toCompiledComponent(QmlEngine *); + + struct TypeReference + { + TypeReference(); + + QmlType *type; + QmlCompositeTypeData *unit; + QmlCustomParser *parser; + }; + + QList<TypeReference> types; + + // Add or remove p as a waiter. When the QmlCompositeTypeData becomes + // ready, the QmlComponentPrivate::typeDataReady() method will be invoked on + // p. The waiter is automatically removed when the typeDataReady() method + // is invoked, so there is no need to call remWaiter() in this case. + void addWaiter(QmlComponentPrivate *p); + void remWaiter(QmlComponentPrivate *p); + +private: + friend class QmlCompositeTypeManager; + friend class QmlCompiler; + + QmlXmlParser data; + QList<QmlComponentPrivate *> waiters; + QmlComponent *component; + QmlCompiledComponent *compiledComponent; +}; + class QmlCompositeTypeManager : public QObject { Q_OBJECT public: QmlCompositeTypeManager(QmlEngine *); - struct TypeData : public QmlRefCount - { - TypeData(); - virtual ~TypeData(); - - enum Status { - Invalid, - Complete, - Error, - Waiting - }; - Status status; - QString errorDescription; - - QString url; - QList<TypeData *> dependants; - - // Return a QmlComponent if the TypeData is not in the Waiting state. - // The QmlComponent is owned by the TypeData, so a reference should be - // kept to keep the QmlComponent alive. - QmlComponent *toComponent(QmlEngine *); - // Return a QmlCompiledComponent if possible, or 0 if an error - // occurs - QmlCompiledComponent *toCompiledComponent(QmlEngine *); - - struct TypeReference - { - TypeReference(); - - QmlType *type; - TypeData *unit; - QmlCustomParser *parser; - }; - - QList<TypeReference> types; - - // Add or remove p as a waiter. When the TypeData becomes ready, the - // QmlComponentPrivate::typeDataReady() method will be invoked on p. - // The waiter is automatically removed when the typeDataReady() method - // is invoked, so there is no need to call remWaiter() in this case. - void addWaiter(QmlComponentPrivate *p); - void remWaiter(QmlComponentPrivate *p); - - private: - friend class QmlCompositeTypeManager; - friend class QmlCompiler; - - QmlXmlParser data; - QList<QmlComponentPrivate *> waiters; - QmlComponent *component; - QmlCompiledComponent *compiledComponent; - }; - - // Return a TypeData for url. The TypeData may be cached. - TypeData *get(const QUrl &url); - // Return a TypeData for data, with the provided base url. The TypeData - // will not be cached. - TypeData *getImmediate(const QByteArray &data, const QUrl &url); + // Return a QmlCompositeTypeData for url. The QmlCompositeTypeData may be + // cached. + QmlCompositeTypeData *get(const QUrl &url); + // Return a QmlCompositeTypeData for data, with the provided base url. The + // QmlCompositeTypeData will not be cached. + QmlCompositeTypeData *getImmediate(const QByteArray &data, const QUrl &url); // Clear cached types. Only types that aren't in the Waiting state will // be cleared. @@ -126,15 +127,15 @@ private Q_SLOTS: void replyFinished(); private: - void loadSource(TypeData *); - void compile(TypeData *); - void setData(TypeData *, const QByteArray &, const QUrl &); + void loadSource(QmlCompositeTypeData *); + void compile(QmlCompositeTypeData *); + void setData(QmlCompositeTypeData *, const QByteArray &, const QUrl &); - void doComplete(TypeData *); - void checkComplete(TypeData *); + void doComplete(QmlCompositeTypeData *); + void checkComplete(QmlCompositeTypeData *); QmlEngine *engine; - typedef QHash<QString, TypeData *> Components; + typedef QHash<QString, QmlCompositeTypeData *> Components; Components components; }; diff --git a/src/declarative/qml/qmllist.h b/src/declarative/qml/qmllist.h index 3a1e665..cc13924 100644 --- a/src/declarative/qml/qmllist.h +++ b/src/declarative/qml/qmllist.h @@ -56,7 +56,9 @@ class QmlList : private QmlPrivate::ListInterface public: virtual void append(T) = 0; virtual void insert(int, T) = 0; + virtual void removeAt(int) = 0; virtual T at(int) const = 0; + virtual int count() const = 0; virtual void clear() = 0; QmlList<T> &operator<<(T t) { append(t); return *this; } diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 584ccde..51d5607 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -667,11 +667,6 @@ QmlMetaType::attachedPropertiesFunc(const QByteArray &name) QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject) { int idx = metaObject->indexOfClassInfo("DefaultProperty"); - while(idx == -1 && metaObject) { - metaObject = metaObject->superClass(); - if(metaObject) - idx = metaObject->indexOfClassInfo("DefaultProperty"); - } if(-1 == idx) return QMetaProperty(); @@ -698,11 +693,6 @@ QMetaProperty QmlMetaType::defaultProperty(QObject *obj) QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject) { int idx = metaObject->indexOfClassInfo("DefaultMethod"); - while(idx == -1 && metaObject) { - metaObject = metaObject->superClass(); - if(metaObject) - idx = metaObject->indexOfClassInfo("DefaultMethod"); - } if(-1 == idx) return QMetaMethod(); diff --git a/src/declarative/qml/script/tokens.cpp b/src/declarative/qml/script/tokens.cpp index 51b46f0..a2fb100 100644 --- a/src/declarative/qml/script/tokens.cpp +++ b/src/declarative/qml/script/tokens.cpp @@ -12,7 +12,6 @@ /*! - \relates <tokens.h> Returns a string representation of token \a tok. */ const char *tokenToString(Token tok) diff --git a/src/declarative/timeline/gfxeasing.cpp b/src/declarative/timeline/gfxeasing.cpp index c89ba88..45b84eb 100644 --- a/src/declarative/timeline/gfxeasing.cpp +++ b/src/declarative/timeline/gfxeasing.cpp @@ -357,7 +357,7 @@ Q_GLOBAL_STATIC(ConfigFunctionMap, configFunctionMap); /*! \class GfxEasing - \ingroup animation + \ingroup group_animation \brief The GfxEasing class provides easing curves for controlling animation. Easing curves describe a function that controls how a value changes over @@ -454,169 +454,134 @@ Q_GLOBAL_STATIC(ConfigFunctionMap, configFunctionMap); \enum GfxEasing::Curve The type of easing curve. -*/ -/*! - \var GfxEasing::Curve GfxEasing::None + + \value None Easing equation function for a simple linear tweening, with no easing. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InQuad + + \value InQuad Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutQuad + + \value OutQuad Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutQuad + + \value InOutQuad Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInQuad + + \value OutInQuad Easing equation function for a quadratic (t^2) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InCubic + + \value InCubic Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutCubic + + \value OutCubic Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutCubic + + \value InOutCubic Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInCubic + + \value OutInCubic Easing equation function for a cubic (t^3) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InQuart + + \value InQuart Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutQuart + + \value OutQuart Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutQuart + + \value InOutQuart Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInQuart + + \value OutInQuart Easing equation function for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InQuint + + \value InQuint Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutQuint + + \value OutQuint Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutQuint + + \value InOutQuint Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInQuint + + \value OutInQuint Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InSine + + \value InSine Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutSine + + \value OutSine Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutSine + + \value InOutSine Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInSine + + \value OutInSine Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InExpo + + \value InExpo Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutExpo + + \value OutExpo Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutExpo + + \value InOutExpo Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInExpo + + \value OutInExpo Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InCirc + + \value InCirc Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutCirc + + \value OutCirc Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutCirc + + \value InOutCirc Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInCirc + + \value OutInCirc Easing equation function for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. The peak amplitude can be set with the \i amplitude parameter, and the period of decay by the \i period parameter. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. The peak amplitude can be set with the \i amplitude parameter, and the period of decay by the \i period parameter. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutElastic + + \value InElastic + Easing equation function for an elastic (exponentially decaying + sine wave) easing in: accelerating from zero velocity. The peak + amplitude can be set with the \e amplitude parameter, and the + period of decay by the \e period parameter. + + \value OutElastic + Easing equation function for an elastic (exponentially decaying + sine wave) easing out: decelerating from zero velocity. The peak + amplitude can be set with the \e amplitude parameter, and the + period of decay by the \e period parameter. + + \value InOutElastic Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInElastic + + \value OutInElastic Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InBack + + \value InBack Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutBack + + \value OutBack Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutBack + + \value InOutBack Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInBack + + \value OutInBack Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutBounce + + \value OutBounce Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InBounce + + \value InBounce Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. -*/ -/*! - \var GfxEasing::Curve GfxEasing::InOutBounce + + \value InOutBounce Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. -*/ -/*! - \var GfxEasing::Curve GfxEasing::OutInBounce + + \value OutInBounce Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration. */ @@ -647,7 +612,7 @@ GfxEasing::GfxEasing(Curve curve) Curve names have the form \c {ease<CurveName>[(<arg>: <arg value>[, <arg2>: <arg value>])]}. The - \i CurveName is equivalent to the GfxEasing::Curve enum name. Some more + \e CurveName is equivalent to the GfxEasing::Curve enum name. Some more advanced curves can take arguments to further refine their behaviour. Where applicable, these parameters are described in the corresponding GfxEasing::Curve value documentation. diff --git a/src/declarative/timeline/gfxtimeline.cpp b/src/declarative/timeline/gfxtimeline.cpp index 36b18d0..3e84df8 100644 --- a/src/declarative/timeline/gfxtimeline.cpp +++ b/src/declarative/timeline/gfxtimeline.cpp @@ -261,7 +261,7 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change /*! \class QmlTimeLine - \ingroup animation + \ingroup group_animation \brief The QmlTimeLine class provides a timeline for controlling animations. QmlTimeLine is similar to QTimeLine except: @@ -872,7 +872,7 @@ void QmlTimeLine::remove(QmlTimeLineObject *v) /*! \class GfxValue - \ingroup animation + \ingroup group_animation \brief The GfxValue class is modified by QmlTimeLine. */ diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index 3fb30e9..a8b8eea 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -200,16 +200,16 @@ void QFxView::execute() d->component = new QmlComponent(&d->engine, d->xml.toUtf8(), d->source); } - if(d->component->isReady()) { + if(!d->component->isLoading()) { continueExecute(); } else { - connect(d->component, SIGNAL(readyChanged()), this, SLOT(continueExecute())); + connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute())); } } void QFxView::continueExecute() { - disconnect(d->component, SIGNAL(readyChanged()), this, SLOT(continueExecute())); + disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute())); if(!d->component){ qWarning() << "Error in loading" << d->source; diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 729d53a..ede4008 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -55,6 +55,7 @@ #include <QtCore/qset.h> #include <QtDeclarative/qmlexpression.h> #include <private/qmlstringconverters_p.h> +#include <private/qvariantanimation_p.h> /* TODO: Check for any memory leaks @@ -538,14 +539,15 @@ void QmlAbstractAnimation::timelineComplete() /*! \internal \class QmlPauseAnimation - \ingroup animation states + \ingroup group_animation + \ingroup group_states \brief The QmlPauseAnimation class provides a pause for an animation. When used in a QmlSequentialAnimation, QmlPauseAnimation is a step when nothing happens, for a specified duration. A QmlPauseAnimation object can be instantiated in Qml using the tag - \ref xmlPauseAnimation "<PauseAnimation>". + \l{xmlPauseAnimation} {<PauseAnimation>}. */ QML_DEFINE_TYPE(QmlPauseAnimation,PauseAnimation); @@ -629,11 +631,12 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation() /*! \internal \class QmlColorAnimation - \ingroup animation states + \ingroup group_animation + \ingroup group_states \brief The QmlColorAnimation class allows you to animate color changes. A QmlColorAnimation object can be instantiated in Qml using the tag - \ref xmlColorAnimation "<ColorAnimation>". + \l{xmlColorAnimation} {<ColorAnimation>}. */ QmlColorAnimation::QmlColorAnimation(QObject *parent) @@ -930,9 +933,9 @@ QML_DEFINE_TYPE(QmlColorAnimation,ColorAnimation); /*! \internal \class QmlRunScriptAction - \brief The QmlRunScriptAction class allows scropts to be run during transitions + \brief The QmlRunScriptAction class allows scripts to be run during transitions - \ref xmlRunScriptAction + \sa xmlRunScriptAction */ QmlRunScriptAction::QmlRunScriptAction(QObject *parent) :QmlAbstractAnimation(*(new QmlRunScriptActionPrivate), parent) @@ -1039,7 +1042,7 @@ QML_DEFINE_TYPE(QmlRunScriptAction, RunScriptAction); \brief The QmlSetPropertyAction class allows property changes during transitions. A QmlSetPropertyAction object can be instantiated in Qml using the tag - \ref xmlSetPropertyAction "<SetPropertyAction>". + \l{xmlSetPropertyAction} {<SetPropertyAction>}. */ QmlSetPropertyAction::QmlSetPropertyAction(QObject *parent) : QmlAbstractAnimation(*(new QmlSetPropertyActionPrivate), parent) @@ -1337,11 +1340,12 @@ QML_DEFINE_TYPE(QmlParentChangeAction,ParentChangeAction); /*! \internal \class QmlNumericAnimation - \ingroup animation states + \ingroup group_animation + \ingroup group_states \brief The QmlNumericAnimation class allows you to animate changes in properties of type qreal. A QmlNumericAnimation object can be instantiated in Qml using the tag - \ref xmlNumericAnimation "<NumericAnimation>". + \l{xmlNumericAnimation} {<NumericAnimation>}. */ QmlNumericAnimation::QmlNumericAnimation(QObject *parent) @@ -1766,7 +1770,8 @@ QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation); /*! \internal \class QmlParallelAnimation - \ingroup animation states + \ingroup group_animation + \ingroup group_states \brief The QmlParallelAnimation class allows you to run animations in parallel. Animations controlled by QmlParallelAnimation will be run at the same time. @@ -1774,7 +1779,7 @@ QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation); \sa QmlSequentialAnimation A QmlParallelAnimation object can be instantiated in Qml using the tag - \ref xmlParallelAnimation "<ParallelAnimation>". + \l{xmlParallelAnimation} {<ParallelAnimation>}. */ QmlParallelAnimation::QmlParallelAnimation(QObject *parent) : @@ -1819,99 +1824,13 @@ void QmlParallelAnimation::transition(QmlStateActions &actions, QML_DEFINE_TYPE(QmlParallelAnimation,ParallelAnimation); -//XXX it would be good to use QVariantAnimation's interpolators if possible QVariant QmlVariantAnimationPrivate::interpolateVariant(const QVariant &from, const QVariant &to, qreal progress) { if (from.userType() != to.userType()) return QVariant(); - QVariant res; - switch (from.userType()) { - case QVariant::Int: { - int f = from.toInt(); - int t = to.toInt(); - res = f + (t - f) * progress; - break; - } - case QVariant::Double: { - double f = from.toDouble(); - double t = to.toDouble(); - res = f + (t - f) * progress; - break; - } - case QMetaType::Float: { - float f = from.toDouble(); - float t = to.toDouble(); - res = f + (t - f) * progress; - break; - } - case QVariant::Color: { - QColor f = from.value<QColor>(); - QColor t = to.value<QColor>(); - uint red = uint(qreal(f.red()) + progress * (qreal(t.red()) - qreal(f.red()))); - uint green = uint(qreal(f.green()) + progress * (qreal(t.green()) - qreal(f.green()))); - uint blue = uint(qreal(f.blue()) + progress * (qreal(t.blue()) - qreal(f.blue()))); - res = QColor(red,green,blue); - break; - } - case QVariant::Rect: { - QRect f = from.value<QRect>(); - QRect t = to.value<QRect>(); - int x = f.x() + (t.x() - f.x()) * progress; - int y = f.y() + (t.y() - f.y()) * progress; - int w = f.width() + (t.width() - f.width()) * progress; - int h = f.height() + (t.height() - f.height()) * progress; - res = QRect(x, y, w, h); - break; - } - case QVariant::RectF: { - QRectF f = from.value<QRectF>(); - QRectF t = to.value<QRectF>(); - qreal x = f.x() + (t.x() - f.x()) * progress; - qreal y = f.y() + (t.y() - f.y()) * progress; - qreal w = f.width() + (t.width() - f.width()) * progress; - qreal h = f.height() + (t.height() - f.height()) * progress; - res = QRectF(x, y, w, h); - break; - } - case QVariant::Point: { - QPoint f = from.value<QPoint>(); - QPoint t = to.value<QPoint>(); - int x = f.x() + (t.x() - f.x()) * progress; - int y = f.y() + (t.y() - f.y()) * progress; - res = QPointF(x, y); - break; - } - case QVariant::PointF: { - QPointF f = from.value<QPointF>(); - QPointF t = to.value<QPointF>(); - qreal x = f.x() + (t.x() - f.x()) * progress; - qreal y = f.y() + (t.y() - f.y()) * progress; - res = QPointF(x, y); - break; - } - case QVariant::Size: { - QSize f = from.value<QSize>(); - QSize t = to.value<QSize>(); - int w = f.width() + (t.width() - f.width()) * progress; - int h = f.height() + (t.height() - f.height()) * progress; - res = QSize(w, h); - break; - } - case QVariant::SizeF: { - QSizeF f = from.value<QSizeF>(); - QSizeF t = to.value<QSizeF>(); - qreal w = f.width() + (t.width() - f.width()) * progress; - qreal h = f.height() + (t.height() - f.height()) * progress; - res = QSizeF(w, h); - break; - } - default: - res = to; - break; - } - - return res; + QVariantAnimation::Interpolator interpolator = QVariantAnimationPrivate::getInterpolator(from.userType()); + return interpolator(from.constData(), to.constData(), progress); } //convert a variant from string type to another animatable type diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp index d71d711..4451ca2 100644 --- a/src/declarative/util/qmlbind.cpp +++ b/src/declarative/util/qmlbind.cpp @@ -77,10 +77,10 @@ QML_DEFINE_TYPE(QmlBind,Bind); property into QML. You could use Bind to update the enteredText property like this. \code - <LineEdit id="myTextField" text="Please type here..." /> + <TextEdit id="myTextField" text="Please type here..." /> <Bind target="{app}" property="enteredText" value="{myTextField.text}" /> \endcode - Whenever the text in the LineEdit is updated, the C++ property will be + Whenever the text in the TextEdit is updated, the C++ property will be updated also. If the bind target or bind property is changed, the bound value is @@ -91,7 +91,7 @@ QML_DEFINE_TYPE(QmlBind,Bind); /*! \internal \class QmlBind - \ingroup utility + \ingroup group_utility \brief The QmlBind class allows arbitrary property bindings to be created. Simple bindings are usually earier to do in-place rather than creating a diff --git a/src/declarative/util/qmldatetimeformatter.cpp b/src/declarative/util/qmldatetimeformatter.cpp index 138f68b..efddd81 100644 --- a/src/declarative/util/qmldatetimeformatter.cpp +++ b/src/declarative/util/qmldatetimeformatter.cpp @@ -85,7 +85,7 @@ public: /*! \internal \class QmlDateTimeFormatter - \ingroup utility + \ingroup group_utility \brief The QmlDateTimeFormatter class allows you to format a date string. */ diff --git a/src/declarative/util/qmlfont.cpp b/src/declarative/util/qmlfont.cpp index ad91edd..9f3225a 100644 --- a/src/declarative/util/qmlfont.cpp +++ b/src/declarative/util/qmlfont.cpp @@ -56,7 +56,7 @@ QML_DEFINE_TYPE(QmlFont,Font); /*! \internal \class QmlFont - \ingroup utility + \ingroup group_utility \brief The QmlFont class provides a font used for drawing text on a QFxView. */ QmlFont::QmlFont(QObject *parent) diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index a24c427..859e21e 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -79,7 +79,7 @@ public: /*! \qmlclass Script QmlScript \brief The Script element adds JavaScript snippets. - \ingroup utility + \ingroup group_utility QmlScript is used to add convenient JavaScript "glue" methods to your Qt Declarative application or component. While you can have any JavaScript code @@ -139,7 +139,7 @@ void QmlScript::setScript(const QString &script) the file specified. */ /*! - \property QmlScript::source + \property QmlScript::src \brief the path to a script file. */ QString QmlScript::source() const diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp index f385391..61890b9 100644 --- a/src/declarative/util/qmlsetproperties.cpp +++ b/src/declarative/util/qmlsetproperties.cpp @@ -122,7 +122,7 @@ void QmlSetPropertiesMetaObject::propertyWrite(int id) \class QmlSetProperties \brief The QmlSetProperties class describes new property values for a state. - \ingroup states + \ingroup group_states QmlSetProperties is a convenience class for changing many properties on a single object. It allows you to specify the property names and values similar to how diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index 50ae6b5..f07fecb 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -97,7 +97,7 @@ QmlStateOperation::QmlStateOperation(QObjectPrivate &dd, QObject *parent) \class QmlState \brief The QmlState class allows you to define configurations of objects and properties. - \ingroup states + \ingroup group_states QmlState allows you to specify a state as a set of batched changes from the default configuration. diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index c2ba4b8..a8779f9 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -236,7 +236,7 @@ QmlRunScript::ActionList QmlRunScript::actions() \class QmlSetProperty \brief The QmlSetProperty class describes a new property value or binding for a state. - \ingroup states + \ingroup group_states \sa QmlSetProperties */ diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp index fb09e32..181fdb9 100644 --- a/src/declarative/util/qmltransition.cpp +++ b/src/declarative/util/qmltransition.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE \class QmlTransition \brief The QmlTransition class allows you to define animated transitions that occur on state changes. - \ingroup states + \ingroup group_states */ //ParallelAnimationWrapperallows us to do a "callback" when the animation finishes, rather than connecting |