aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/src/tutorial.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/doc/src/tutorial.qdoc')
-rw-r--r--src/quick/doc/src/tutorial.qdoc36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc
index b1f2304529..bd07c9a98d 100644
--- a/src/quick/doc/src/tutorial.qdoc
+++ b/src/quick/doc/src/tutorial.qdoc
@@ -27,13 +27,12 @@
/*!
\page qml-tutorial.html
-\inqmlmodule QtQuick 2
\title QML Tutorial
\brief An introduction to the basic concepts and features of QML.
\previouspage Introduction to the QML Language
\nextpage QML Tutorial 1 - Basic Types
-This tutorial gives an introduction to QML, the mark up language for Qt Quick. It doesn't cover everything;
+This tutorial gives an introduction to QML, the declarative language for Qt Quick. It doesn't cover everything;
the emphasis is on teaching the key principles, and features are introduced as needed.
Through the different steps of this tutorial we will learn about QML basic types, we will create our own QML component
@@ -55,7 +54,6 @@ Tutorial chapters:
/*!
\page qml-tutorial1.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 1 - Basic Types
\contentspage QML Tutorial
\previouspage QML Tutorial
@@ -68,7 +66,7 @@ The picture below is a screenshot of this program.
Here is the QML code for the application:
-\snippet quick/tutorials/helloworld/tutorial1.qml 0
+\snippet tutorials/helloworld/tutorial1.qml 0
\section1 Walkthrough
@@ -77,11 +75,11 @@ Here is the QML code for the application:
First, we need to import the types that we need for this example. Most QML files will import the built-in QML
types (like \l{Rectangle}, \l{Image}, ...) that come with Qt, using:
-\snippet quick/tutorials/helloworld/tutorial1.qml 3
+\snippet tutorials/helloworld/tutorial1.qml 3
\section2 Rectangle Type
-\snippet quick/tutorials/helloworld/tutorial1.qml 1
+\snippet tutorials/helloworld/tutorial1.qml 1
We declare a root object of type \l{Rectangle}. It is one of the basic building blocks you can use to create an application in QML.
We give it an \c{id} to be able to refer to it later. In this case, we call it "page".
@@ -90,7 +88,7 @@ The \l{Rectangle} type contains many other properties (such as \c x and \c y), b
\section2 Text Type
-\snippet quick/tutorials/helloworld/tutorial1.qml 2
+\snippet tutorials/helloworld/tutorial1.qml 2
We add a \l Text type as a child of the root Rectangle type that displays the text 'Hello world!'.
@@ -114,7 +112,6 @@ qmlscene tutorials/helloworld/tutorial1.qml
/*!
\page qml-tutorial2.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 2 - QML Components
\contentspage QML Tutorial
\previouspage QML Tutorial 1 - Basic Types
@@ -133,37 +130,37 @@ The component's filename must always start with a capital letter.
Here is the QML code for \c Cell.qml:
-\snippet quick/tutorials/helloworld/Cell.qml 0
+\snippet tutorials/helloworld/Cell.qml 0
\section1 Walkthrough
\section2 The Cell Component
-\snippet quick/tutorials/helloworld/Cell.qml 1
+\snippet tutorials/helloworld/Cell.qml 1
The root type of our component is an \l Item with the \c id \e container.
An \l Item is the most basic visual type in QML and is often used as a container for other types.
-\snippet quick/tutorials/helloworld/Cell.qml 4
+\snippet tutorials/helloworld/Cell.qml 4
We declare a \c cellColor property. This property is accessible from \e outside our component, this allows us
to instantiate the cells with different colors.
This property is just an alias to an existing property - the color of the rectangle that compose the cell
(see \l{Property Binding in QML}).
-\snippet quick/tutorials/helloworld/Cell.qml 5
+\snippet tutorials/helloworld/Cell.qml 5
We want our component to also have a signal that we call \e clicked with a \e cellColor parameter of type \e color.
We will use this signal to change the color of the text in the main QML file later.
-\snippet quick/tutorials/helloworld/Cell.qml 2
+\snippet tutorials/helloworld/Cell.qml 2
Our cell component is basically a colored rectangle with the \c id \e rectangle.
The \c anchors.fill property is a convenient way to set the size of a visual type.
In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-Based Layout}).
-\snippet quick/tutorials/helloworld/Cell.qml 3
+\snippet tutorials/helloworld/Cell.qml 3
In order to change the color of the text when clicking on a cell, we create a \l MouseArea type with
the same size as its parent.
@@ -175,11 +172,11 @@ When this signal is triggered we want to emit our own \e clicked signal with the
In our main QML file, we use our \c Cell component to create the color picker:
-\snippet quick/tutorials/helloworld/tutorial2.qml 0
+\snippet tutorials/helloworld/tutorial2.qml 0
We create the color picker by putting 6 cells with different colors in a grid.
-\snippet quick/tutorials/helloworld/tutorial2.qml 1
+\snippet tutorials/helloworld/tutorial2.qml 1
When the \e clicked signal of our cell is triggered, we want to set the color of the text to the \e cellColor passed as a parameter.
We can react to any signal of our component through a property of the name \e 'onSignalName' (see \l{Signal Attributes}).
@@ -187,7 +184,6 @@ We can react to any signal of our component through a property of the name \e 'o
/*!
\page qml-tutorial3.html
-\inqmlmodule QtQuick 2
\title QML Tutorial 3 - States and Transitions
\contentspage QML Tutorial
\previouspage QML Tutorial 2 - QML Components
@@ -200,11 +196,11 @@ We want our text to move to the bottom of the screen, rotate and become red when
Here is the QML code:
-\snippet quick/tutorials/helloworld/tutorial3.qml 0
+\snippet tutorials/helloworld/tutorial3.qml 0
\section1 Walkthrough
-\snippet quick/tutorials/helloworld/tutorial3.qml 2
+\snippet tutorials/helloworld/tutorial3.qml 2
First, we create a new \e down state for our text type.
This state will be activated when the \l MouseArea is pressed, and deactivated when it is released.
@@ -213,7 +209,7 @@ The \e down state includes a set of property changes from our implicit \e {defau
(the items as they were initially defined in the QML).
Specifically, we set the \c y property of the text to \c 160, the rotation to \c 180 and the \c color to red.
-\snippet quick/tutorials/helloworld/tutorial3.qml 3
+\snippet tutorials/helloworld/tutorial3.qml 3
Because we don't want the text to appear at the bottom instantly but rather move smoothly,
we add a transition between our two states.