Doc: Enabling Qt QML linking to Qt Quick.
[profile/ivi/qtdeclarative.git] / tools / qmleasing / preview.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtQml module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.  For licensing terms and
14 ** conditions see http://qt.digia.com/licensing.  For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights.  These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file.  Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 import QtQuick 2.0
43
44 Item {
45     id: root
46     width:  800
47     height: 100
48
49     Rectangle {
50         gradient: Gradient {
51             GradientStop {
52                 position: 0
53                 color: "#aaa7a7"
54             }
55
56             GradientStop {
57                 position: 0.340
58                 color: "#a4a4a4"
59             }
60
61             GradientStop {
62                 position: 1
63                 color: "#6b6b6b"
64             }
65         }
66         anchors.fill: parent
67     }
68
69     Button {
70         id: button
71
72         x: 19
73         y: 20
74         width: 133
75         height: 61
76         onClicked: {
77             if (root.state ==="")
78                 root.state = "moved";
79             else
80                 root.state = "";
81         }
82     }
83
84     Rectangle {
85         id: groove
86         x: 163
87         y: 20
88         width: 622
89         height: 61
90         color: "#919191"
91         radius: 4
92         border.color: "#adadad"
93
94         Rectangle {
95             id: rectangle
96             x: 9
97             y: 9
98             width: 46
99             height: 46
100             color: "#3045b7"
101             radius: 4
102             border.width: 2
103             smooth: true
104             border.color: "#9ea0bb"
105             anchors.bottomMargin: 6
106             anchors.topMargin: 9
107             anchors.top: parent.top
108             anchors.bottom: parent.bottom
109         }
110     }
111     states: [
112         State {
113             name: "moved"
114
115             PropertyChanges {
116                 target: rectangle
117                 x: 567
118                 y: 9
119                 anchors.bottomMargin: 6
120                 anchors.topMargin: 9
121             }
122         }
123     ]
124
125     transitions: [
126         Transition {
127             from: ""
128             to: "moved"
129             SequentialAnimation {
130                 PropertyAnimation {
131                     easing: editor.easingCurve
132                     property: "x"
133                     duration: spinBox.value
134                 }
135             }
136         },
137         Transition {
138             from: "moved"
139             to: ""
140             PropertyAnimation {
141                 easing: editor.easingCurve
142                 property: "x"
143                 duration: spinBox.value
144             }
145
146         }
147     ]
148 }