aboutsummaryrefslogtreecommitdiffstats log msg author committer range
diff options
 context: 12345678910152025303540 space: includeignore mode: unifiedssdiffstat only
-rw-r--r--doc/src/examples/tutorial.qdoc34
-rw-r--r--examples/tutorials/helloworld/tutorial1.qml2
-rw-r--r--examples/tutorials/helloworld/tutorial2.qml2
-rw-r--r--examples/tutorials/helloworld/tutorial3.qml2
4 files changed, 20 insertions, 20 deletions
 diff --git a/doc/src/examples/tutorial.qdoc b/doc/src/examples/tutorial.qdocindex d8d6e14f09..558b5bb6d9 100644--- a/doc/src/examples/tutorial.qdoc+++ b/doc/src/examples/tutorial.qdoc@@ -41,7 +41,7 @@ with properties and signals, and we will create a simple animation with the help Chapter one starts with a minimal "Hello world" program and the following chapters introduce new concepts. -The tutorial's source code is located in the \$QTDIR/examples/declarative/tutorials/helloworld directory.+The tutorial's source code is located in the \$QTDIR/examples/tutorials/helloworld directory. Tutorial chapters: @@ -68,7 +68,7 @@ The picture below is a screenshot of this program. Here is the QML code for the application: -\snippet examples/declarative/tutorials/helloworld/tutorial1.qml 0+\snippet examples/tutorials/helloworld/tutorial1.qml 0 \section1 Walkthrough @@ -77,11 +77,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 examples/declarative/tutorials/helloworld/tutorial1.qml 3+\snippet examples/tutorials/helloworld/tutorial1.qml 3 \section2 Rectangle element -\snippet examples/declarative/tutorials/helloworld/tutorial1.qml 1+\snippet examples/tutorials/helloworld/tutorial1.qml 1 We declare a root element 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 +90,7 @@ The \l{Rectangle} element contains many other properties (such as \c x and \c y) \section2 Text element -\snippet examples/declarative/tutorials/helloworld/tutorial1.qml 2+\snippet examples/tutorials/helloworld/tutorial1.qml 2 We add a \l Text element as a child of the root Rectangle element that displays the text 'Hello world!'. @@ -108,7 +108,7 @@ To view what you have created, run the \l{QML Viewer} tool (located in the \c bi For example, to run the provided completed Tutorial 1 example from the install location, you would type: \code-bin/qmlviewer \$QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml+bin/qmlviewer \$QTDIR/examples/tutorials/helloworld/tutorial1.qml \endcode */ @@ -133,37 +133,37 @@ The component's filename must always start with a capital letter. Here is the QML code for \c Cell.qml: -\snippet examples/declarative/tutorials/helloworld/Cell.qml 0+\snippet examples/tutorials/helloworld/Cell.qml 0 \section1 Walkthrough \section2 The Cell Component -\snippet examples/declarative/tutorials/helloworld/Cell.qml 1+\snippet examples/tutorials/helloworld/Cell.qml 1 The root element of our component is an \l Item with the \c id \e container. An \l Item is the most basic visual element in QML and is often used as a container for other elements. -\snippet examples/declarative/tutorials/helloworld/Cell.qml 4+\snippet examples/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 examples/declarative/tutorials/helloworld/Cell.qml 5+\snippet examples/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 examples/declarative/tutorials/helloworld/Cell.qml 2+\snippet examples/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 an element. In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-Based Layout}). -\snippet examples/declarative/tutorials/helloworld/Cell.qml 3+\snippet examples/tutorials/helloworld/Cell.qml 3 In order to change the color of the text when clicking on a cell, we create a \l MouseArea element with the same size as its parent.@@ -175,11 +175,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 examples/declarative/tutorials/helloworld/tutorial2.qml 0+\snippet examples/tutorials/helloworld/tutorial2.qml 0 We create the color picker by putting 6 cells with different colors in a grid. -\snippet examples/declarative/tutorials/helloworld/tutorial2.qml 1+\snippet examples/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 Handlers}).@@ -200,11 +200,11 @@ We want our text to move to the bottom of the screen, rotate and become red when Here is the QML code: -\snippet examples/declarative/tutorials/helloworld/tutorial3.qml 0+\snippet examples/tutorials/helloworld/tutorial3.qml 0 \section1 Walkthrough -\snippet examples/declarative/tutorials/helloworld/tutorial3.qml 2+\snippet examples/tutorials/helloworld/tutorial3.qml 2 First, we create a new \e down state for our text element. This state will be activated when the \l MouseArea is pressed, and deactivated when it is released.@@ -213,7 +213,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 examples/declarative/tutorials/helloworld/tutorial3.qml 3+\snippet examples/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.diff --git a/examples/tutorials/helloworld/tutorial1.qml b/examples/tutorials/helloworld/tutorial1.qmlindex f0eb42d696..3de79831f4 100644--- a/examples/tutorials/helloworld/tutorial1.qml+++ b/examples/tutorials/helloworld/tutorial1.qml@@ -46,7 +46,7 @@ import QtQuick 2.0 //![1] Rectangle { id: page- width: 500; height: 200+ width: 320; height: 480 color: "lightgray" //![1] diff --git a/examples/tutorials/helloworld/tutorial2.qml b/examples/tutorials/helloworld/tutorial2.qmlindex c5c045aace..3b44f5cf54 100644--- a/examples/tutorials/helloworld/tutorial2.qml+++ b/examples/tutorials/helloworld/tutorial2.qml@@ -43,7 +43,7 @@ import QtQuick 2.0 Rectangle { id: page- width: 500; height: 200+ width: 320; height: 480 color: "lightgray" Text {diff --git a/examples/tutorials/helloworld/tutorial3.qml b/examples/tutorials/helloworld/tutorial3.qmlindex c804bfca1d..c35420c1de 100644--- a/examples/tutorials/helloworld/tutorial3.qml+++ b/examples/tutorials/helloworld/tutorial3.qml@@ -43,7 +43,7 @@ import QtQuick 2.0 Rectangle { id: page- width: 500; height: 200+ width: 320; height: 480 color: "lightgray" Text {