From d70f057db1b5765764257530c88f5c0350cf9146 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 13 Nov 2009 13:30:27 +1000 Subject: doc --- doc/src/declarative/extending.qdoc | 1 + doc/src/declarative/globalobject.qdoc | 1 - doc/src/snippets/declarative/border-image.qml | 31 +++++++++++ .../graphicsitems/qmlgraphicsborderimage.cpp | 2 +- src/declarative/graphicsitems/qmlgraphicsitem.cpp | 64 ++++++++++++++++------ .../graphicsitems/qmlgraphicswebview.cpp | 20 +++---- src/declarative/qml/qmlcomponent.cpp | 16 ++++-- src/declarative/qml/qmlinfo.cpp | 2 +- src/declarative/util/qmlstategroup.cpp | 2 +- src/declarative/util/qmltimer.cpp | 2 +- 10 files changed, 105 insertions(+), 36 deletions(-) create mode 100644 doc/src/snippets/declarative/border-image.qml diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 7a4e51c..7a9de60 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -849,6 +849,7 @@ Item { \endcode \section1 Defining new Components +\target components A component is a reusable type with a well-defined interface built entirely in QML. Components appear as regular QML elements, and can be used interchangably diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 06f6bdc..a39d858 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -122,7 +122,6 @@ This function plays the audio file located at \c soundLocation. Only .wav files \section3 Qt.openUrlExternally(url target) This function attempts to open the specified \c target url in an external application, based on the user's desktop preferences. It will return true if it succeeds, and false otherwise. -\endlist \section1 Dynamic Object Creation The following functions on the global object allow you to dynamically create QML diff --git a/doc/src/snippets/declarative/border-image.qml b/doc/src/snippets/declarative/border-image.qml new file mode 100644 index 0000000..c4215cd --- /dev/null +++ b/doc/src/snippets/declarative/border-image.qml @@ -0,0 +1,31 @@ +import Qt 4.6 + +Rectangle { + id: page + color: "white" + width: 520; height: 280 + + Row { + anchors.centerIn: parent + spacing: 50 +//! [0] + BorderImage { + width: 180; height: 180 + border.left: 30; border.top: 30 + border.right: 30; border.bottom: 30 + horizontalTileMode: BorderImage.Stretch + verticalTileMode: BorderImage.Stretch + source: "content/colors.png" + } + + BorderImage { + width: 180; height: 180 + border.left: 30; border.top: 30 + border.right: 30; border.bottom: 30 + horizontalTileMode: BorderImage.Round + verticalTileMode: BorderImage.Round + source: "content/colors.png" + } +//! [0] + } +} diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp index 634215e..04e79f9 100644 --- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp @@ -55,7 +55,7 @@ QML_DEFINE_TYPE(Qt,4,6,BorderImage,QmlGraphicsBorderImage) \brief The BorderImage element provides an image that can be used as a border. \inherits Item - \snippet examples/declarative/border-image/example.qml 0 + \snippet snippets/declarative/border-image.qml 0 \image BorderImage.png diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp index 69564c4..ca45f62 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp @@ -1325,6 +1325,24 @@ QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject } \endqml + \section1 Identity + + Each item has an "id" - the identifier of the Item. + + The identifier can be used in bindings and other expressions to + refer to the item. For example: + + \qml + Text { id: myText; ... } + Text { text: myText.text } + \endqml + + The identifier is available throughout to the \l {components}{component} + where it is declared. The identifier must be unique in the component. + + The id should not be thought of as a "property" - it makes no sense + to write \c myText.id, for example. + \section1 Key Handling Key handling is available to all Item-based visual elements via the \l {Keys}{Keys} @@ -1510,6 +1528,14 @@ void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent) } /*! + \fn void QmlGraphicsItem::setParent(QmlGraphicsItem *parent) + \overload + Sets both the parent object and parent item to \a parent. This + function avoids the programming error of calling setParent() + when you mean setParentItem(). +*/ + +/*! Returns the QmlGraphicsItem parent of this item. */ QmlGraphicsItem *QmlGraphicsItem::parentItem() const @@ -1994,22 +2020,6 @@ QVariant QmlGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const } /*! - \qmlproperty string Item::id - This property holds the identifier for the item. - - The identifier can be used in bindings and other expressions to - refer to the item. For example: - - \qml - Text { id: myText; ... } - Text { text: myText.text } - \endqml - - The identifier is available throughout to the \l {components}{component} - where it is declared. The identifier must be unique in thecomponent. -*/ - -/*! \internal */ QmlGraphicsAnchorLine QmlGraphicsItem::left() const @@ -2357,7 +2367,7 @@ bool QmlGraphicsItem::keepMouseGrab() const to steal a mouse grab if it detects that the user has begun to move the viewport. - \sa keepMouseGrab + \sa keepMouseGrab() */ void QmlGraphicsItem::setKeepMouseGrab(bool keep) { @@ -2801,12 +2811,19 @@ void QmlGraphicsItem::resetWidth() setImplicitWidth(implicitWidth()); } +/*! + Returns the width of the item that is implied by other properties that determine the content. +*/ qreal QmlGraphicsItem::implicitWidth() const { Q_D(const QmlGraphicsItem); return d->implicitWidth; } +/*! + Sets the implied width of the item to \a w. + This is the width implied by other properties that determine the content. +*/ void QmlGraphicsItem::setImplicitWidth(qreal w) { Q_D(QmlGraphicsItem); @@ -2824,6 +2841,9 @@ void QmlGraphicsItem::setImplicitWidth(qreal w) QRectF(x(), y(), oldWidth, height())); } +/*! + Returns whether the width property has been set explicitly. +*/ bool QmlGraphicsItem::widthValid() const { Q_D(const QmlGraphicsItem); @@ -2860,12 +2880,19 @@ void QmlGraphicsItem::resetHeight() setImplicitHeight(implicitHeight()); } +/*! + Returns the height of the item that is implied by other properties that determine the content. +*/ qreal QmlGraphicsItem::implicitHeight() const { Q_D(const QmlGraphicsItem); return d->implicitHeight; } +/*! + Sets the implied height of the item to \a h. + This is the height implied by other properties that determine the content. +*/ void QmlGraphicsItem::setImplicitHeight(qreal h) { Q_D(QmlGraphicsItem); @@ -2883,6 +2910,9 @@ void QmlGraphicsItem::setImplicitHeight(qreal h) QRectF(x(), y(), width(), oldHeight)); } +/*! + Returns whether the height property has been set explicitly. +*/ bool QmlGraphicsItem::heightValid() const { Q_D(const QmlGraphicsItem); diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index 14c4352..6dbf053 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -309,7 +309,8 @@ QmlGraphicsWebView::Status QmlGraphicsWebView::status() const \qmlproperty real WebView::progress This property holds the progress of loading the current URL, from 0 to 1. - \sa onLoadFinished() onLoadFailed() + If you just want to know when progress gets to 1, use + WebView::onLoadFinished() or WebView::onLoadFailed() instead. */ qreal QmlGraphicsWebView::progress() const { @@ -1057,27 +1058,26 @@ void QmlGraphicsWebView::setPage(QWebPage *page) \qmlsignal WebView::onLoadStarted() This handler is called when the web engine begins loading - a page. - - \sa progress onLoadFinished() onLoadFailed() + a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() + will be emitted. */ /*! \qmlsignal WebView::onLoadFinished() - This handler is called when the web engine finishes loading - a page, including any component content. + This handler is called when the web engine \e successfully + finishes loading a page, including any component content + (WebView::onLoadFailed() will be emitted otherwise). - \sa progress onLoadFailed() + \sa progress */ /*! \qmlsignal WebView::onLoadFailed() This handler is called when the web engine fails loading - a page or any component content. - - \sa progress onLoadFinished() + a page or any component content + (WebView::onLoadFinished() will be emitted on success). */ void QmlGraphicsWebView::load(const QNetworkRequest &request, diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 3c142a7..e31a1b5 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -236,7 +236,9 @@ QmlComponent::Status QmlComponent::status() const } /*! - Returns true if the component is in the Null state, false otherwise. + \property QmlComponent::isNull + + Is true if the component is in the Null state, false otherwise. Equivalent to status() == QmlComponent::Null. */ @@ -246,7 +248,9 @@ bool QmlComponent::isNull() const } /*! - Returns true if the component is in the Ready state, false otherwise. + \property QmlComponent::isReady + + Is true if the component is in the Ready state, false otherwise. Equivalent to status() == QmlComponent::Ready. */ @@ -256,7 +260,9 @@ bool QmlComponent::isReady() const } /*! - Returns true if the component is in the Error state, false otherwise. + \property QmlComponent::isError + + Is true if the component is in the Error state, false otherwise. Equivalent to status() == QmlComponent::Error. */ @@ -266,7 +272,9 @@ bool QmlComponent::isError() const } /*! - Returns true if the component is in the Loading state, false otherwise. + \property QmlComponent::isLoading + + Is true if the component is in the Loading state, false otherwise. Equivalent to status() == QmlComponent::Loading. */ diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp index 7a194e0..bbd6022 100644 --- a/src/declarative/qml/qmlinfo.cpp +++ b/src/declarative/qml/qmlinfo.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE /*! - \fn void qmlInfo(const QString& message, const QObject *object) + \fn QmlInfo qmlInfo(const QObject *object) \brief Prints warnings messages that include the file and line number for QML types. diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index 2d3ca4c..506ab82 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -109,7 +109,7 @@ public: } \endqml - \sa {qmlstate}{States} and {state-transitions}{Transitions} + \sa {qmlstate}{States} {state-transitions}{Transitions} */ QmlStateGroup::QmlStateGroup(QObject *parent) diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index c1b3504..0be62f4 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -260,7 +260,7 @@ void QmlTimer::componentComplete() } /*! - \qmlsignal Timer::onTriggered + \qmlsignal Timer::onTriggered() This handler is called when the Timer is triggered. */ -- cgit v0.12