summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/doc/examples/componentset
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/qdoc/doc/examples/componentset')
-rw-r--r--src/tools/qdoc/doc/examples/componentset/ProgressBar.qml135
-rw-r--r--src/tools/qdoc/doc/examples/componentset/Switch.qml142
-rw-r--r--src/tools/qdoc/doc/examples/componentset/TabWidget.qml183
-rw-r--r--src/tools/qdoc/doc/examples/componentset/componentset.pro5
-rw-r--r--src/tools/qdoc/doc/examples/componentset/uicomponents.qdoc37
5 files changed, 502 insertions, 0 deletions
diff --git a/src/tools/qdoc/doc/examples/componentset/ProgressBar.qml b/src/tools/qdoc/doc/examples/componentset/ProgressBar.qml
new file mode 100644
index 0000000000..5255e864ac
--- /dev/null
+++ b/src/tools/qdoc/doc/examples/componentset/ProgressBar.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+/*!
+ \qmlclass ProgressBar
+ \inqmlmodule UIComponents 1.0
+ \brief A component that shows the progress of an event
+
+ A ProgressBar shows the linear progress of an event as its \l value.
+ The range is specified using the \l {minimum} and the \l{maximum} values.
+
+ The ProgressBar component is part of the \l {UI Components} module.
+
+ This documentation is part of the \l{componentset}{UIComponents} example.
+*/
+Item {
+ id: progressbar
+
+ /*!
+ The minumum value of the ProgressBar range.
+ The \l value must not be less than this value.
+ */
+ property int minimum: 0
+
+ /*!
+ The maximum value of the ProgressBar range.
+ The \l value must not be more than this value.
+ */
+ property int maximum: 100
+
+ /*!
+ The value of the progress.
+ */
+ property int value: 0
+
+ /*!
+ \qmlproperty color ProgressBar::color
+ The color of the ProgressBar's gradient. Must bind to a color type.
+
+ \omit
+ The "\qmlproperty <type> <property name>" is needed because
+ property alias need to have their types manually entered.
+
+ QDoc will not publish the documentation within omit and endomit.
+ \endomit
+
+ \sa secondColor
+ */
+ property alias color: gradient1.color
+
+ /*!
+ \qmlproperty color ProgressBar::secondColor
+ The second color of the ProgressBar's gradient.
+ Must bind to a color type.
+
+ \omit
+ The "\qmlproperty <type> <property name>" is needed because
+ property alias need to have their types manually entered.
+
+ QDoc will not publish the documentation within omit and endomit.
+ \endomit
+
+ \sa color
+ */
+ property alias secondColor: gradient2.color
+
+ width: 250; height: 23
+ clip: true
+
+ Rectangle {
+ id: highlight
+
+ /*!
+ An internal documentation comment. The widthDest property is not
+ a public API and therefore will not be exposed.
+ */
+ property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6)
+
+ width: highlight.widthDest
+ Behavior on width { SmoothedAnimation { velocity: 1200 } }
+
+ anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 }
+ radius: 1
+ gradient: Gradient {
+ GradientStop { id: gradient1; position: 0.0 }
+ GradientStop { id: gradient2; position: 1.0 }
+ }
+
+ }
+ Text {
+ anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter }
+ color: "white"
+ font.bold: true
+ text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%'
+ }
+}
diff --git a/src/tools/qdoc/doc/examples/componentset/Switch.qml b/src/tools/qdoc/doc/examples/componentset/Switch.qml
new file mode 100644
index 0000000000..31153d6252
--- /dev/null
+++ b/src/tools/qdoc/doc/examples/componentset/Switch.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+/*!
+ \qmlclass ToggleSwitch
+ \inqmlmodule UIComponents 1.0
+ \brief A component that can be turned on or off
+
+ A toggle switch has two states: an \c on and an \c off state. The \c off
+ state is when the \l on property is set to \c false.
+
+ The ToggleSwitch component is part of the \l {UI Components} module.
+
+ This documentation is part of the \l{componentset}{UIComponents} example.
+
+*/
+Item {
+ id: toggleswitch
+ width: background.width; height: background.height
+
+ /*!
+ Indicates the state of the switch. If \c false, then the switch is in
+ the \c off state.
+
+ \omit
+ The \qmlproperty <type> <propertyname> is not necessary as QDoc
+ will associate this property to the ToggleSwitch
+
+ QDoc will not publish the documentation within omit and endomit.
+ \endomit
+ */
+ property bool on: false
+
+
+ /*!
+ A method to toggle the switch. If the switch is \c on, the toggling it
+ will turn it \c off. Toggling a switch in the \c off position will
+ turn it \c on.
+ */
+ function toggle() {
+ if (toggleswitch.state == "on")
+ toggleswitch.state = "off";
+ else
+ toggleswitch.state = "on";
+ }
+
+
+ /*!
+ \internal
+
+ An internal function to synchronize the switch's internals. This
+ function is not for public access. The \internal command will
+ prevent QDoc from publishing this comment in the public API.
+ */
+ function releaseSwitch() {
+ if (knob.x == 1) {
+ if (toggleswitch.state == "off") return;
+ }
+ if (knob.x == 78) {
+ if (toggleswitch.state == "on") return;
+ }
+ toggle();
+ }
+
+ Rectangle {
+ id: background
+ width: 130; height: 48
+ radius: 48
+ color: "lightsteelblue"
+ MouseArea { anchors.fill: parent; onClicked: toggle() }
+ }
+
+ Rectangle {
+ id: knob
+ width: 48; height: 48
+ radius: width
+ color: "lightblue"
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78
+ onClicked: toggle()
+ onReleased: releaseSwitch()
+ }
+ }
+
+ states: [
+ State {
+ name: "on"
+ PropertyChanges { target: knob; x: 78 }
+ PropertyChanges { target: toggleswitch; on: true }
+ },
+ State {
+ name: "off"
+ PropertyChanges { target: knob; x: 1 }
+ PropertyChanges { target: toggleswitch; on: false }
+ }
+ ]
+
+ transitions: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad; duration: 200 }
+ }
+}
diff --git a/src/tools/qdoc/doc/examples/componentset/TabWidget.qml b/src/tools/qdoc/doc/examples/componentset/TabWidget.qml
new file mode 100644
index 0000000000..eb64979fb2
--- /dev/null
+++ b/src/tools/qdoc/doc/examples/componentset/TabWidget.qml
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+
+/*!
+ \qmlclass TabWidget
+ \inqmlmodule UIComponents 1.0
+ \brief A widget that places its children as tabs
+
+ A TabWidget places its children as tabs in a view. Selecting
+ a tab involves selecting the tab at the top.
+
+ The TabWidget component is part of the \l {UI Components} module.
+
+ This documentation is part of the \l{componentset}{UIComponents} example.
+
+ \section1 Adding Tabs
+
+ To add a tab, declare the tab as a child of the TabWidget.
+
+ \code
+ TabWidget {
+ id: tabwidget
+
+ Rectangle {
+ id: tab1
+ color: "red"
+ //... omitted
+ }
+ Rectangle {
+ id: tab2
+ color: "blue"
+ //... omitted
+ }
+
+ }
+ \endcode
+
+*/
+Item {
+ id: tabWidget
+
+ /*!
+ \internal
+
+ Setting the default property to stack.children means any child items
+ of the TabWidget are actually added to the 'stack' item's children.
+
+ See the \l{"Property Binding in QML"}
+ documentation for details on default properties.
+
+ This is an implementation detail, not meant for public knowledge. Putting
+ the \internal command at the beginning will cause QDoc to not publish this
+ documentation in the public API page.
+
+ Normally, a property alias needs to have a
+ "\qmlproperty <type> <propertyname>" to assign the alias a type.
+
+ */
+ default property alias content: stack.children
+
+
+ /*!
+ The currently active tab in the TabWidget.
+ */
+ property int current: 0
+
+ /*!
+ A sample \c{read-only} property.
+ A contrived property to demonstrate QDoc's ability to detect
+ read-only properties.
+
+ The signature is:
+ \code
+ readonly property int sampleReadOnlyProperty: 0
+ \endcode
+
+ Note that the property must be initialized to a value.
+
+ */
+ readonly property int sampleReadOnlyProperty: 0
+
+ /*!
+ \internal
+
+ This handler is an implementation
+ detail. The \c{\internal} command will prevent QDoc from publishing this
+ documentation on the public API.
+ */
+ onCurrentChanged: setOpacities()
+ Component.onCompleted: setOpacities()
+
+ /*!
+ \internal
+
+ An internal function to set the opacity.
+ The \internal command will prevent QDoc from publishing this
+ documentation on the public API.
+ */
+ function setOpacities() {
+ for (var i = 0; i < stack.children.length; ++i) {
+ stack.children[i].opacity = (i == current ? 1 : 0)
+ }
+ }
+
+ Row {
+ id: header
+
+ Repeater {
+ model: stack.children.length
+ delegate: Rectangle {
+ width: tabWidget.width / stack.children.length; height: 36
+
+ Rectangle {
+ width: parent.width; height: 1
+ anchors { bottom: parent.bottom; bottomMargin: 1 }
+ color: "#acb2c2"
+ }
+ BorderImage {
+ anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
+ border { left: 7; right: 7 }
+ source: "tab.png"
+ visible: tabWidget.current == index
+ }
+ Text {
+ horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
+ anchors.fill: parent
+ text: stack.children[index].title
+ elide: Text.ElideRight
+ font.bold: tabWidget.current == index
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: tabWidget.current = index
+ }
+ }
+ }
+ }
+
+ Item {
+ id: stack
+ width: tabWidget.width
+ anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
+ }
+}
diff --git a/src/tools/qdoc/doc/examples/componentset/componentset.pro b/src/tools/qdoc/doc/examples/componentset/componentset.pro
new file mode 100644
index 0000000000..5b44737c2d
--- /dev/null
+++ b/src/tools/qdoc/doc/examples/componentset/componentset.pro
@@ -0,0 +1,5 @@
+SOURCES = componentset.pro \
+ ProgressBar.qml \
+ Switch.qml \
+ TabWidget.qml \
+ uicomponents.qdoc
diff --git a/src/tools/qdoc/doc/examples/componentset/uicomponents.qdoc b/src/tools/qdoc/doc/examples/componentset/uicomponents.qdoc
new file mode 100644
index 0000000000..10c23c7c0f
--- /dev/null
+++ b/src/tools/qdoc/doc/examples/componentset/uicomponents.qdoc
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule UIComponents 1.0
+ \title UI Components
+ \brief Basic set of QML Components
+
+ This is a listing of a list of QML components. These files are available
+ for general import and they are based off the \l{Qt Quick Code Samples}.
+
+ This module is part of the \l{componentset}{UIComponents} example.
+*/