• Skip to content
  • Skip to link menu
KDE API Documentation - Domino.qml Source File (GCompris-qt)
  • KDE Home
  • Contact Us
 

GCompris-qt

  • src
  • core
Domino.qml
1 /* GCompris - Domino.qml
2  *
3  * Copyright (C) 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
4  *
5  * Authors:
6  * Bruno Coudoin <bruno.coudoin@gcompris.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21 import QtQuick 2.2
22 import GCompris 1.0
23 
24 Flipable {
25  id: flipable
26 
27  property alias value1: number1.value
28  property alias value2: number2.value
29  property int valueMax: 9
30 
31  // Domino style
32  property color color: "white"
33  property color borderColor: "black"
34  property int borderWidth: 2
35  property int radius: width * 0.05
36  property color backColor: "white"
37  property color pointColor: "black"
38 
39  property bool flipEnabled: false
40  property bool flipped: true
41 
42  property bool isClickable: true
43  property GCAudio audioEffects
44 
45  front: Rectangle {
46  anchors.fill: parent
47  smooth: true;
48  color: flipable.color
49  border.color: "black"
50  border.width: flipable.borderWidth
51  radius: flipable.radius
52 
53  DominoNumber {
54  id: number1
55  width: parent.width / 2
56  height: parent.height
57  color: flipable.pointColor
58  borderColor: "black"
59  borderWidth: 0
60  radius: parent.height * 0.25
61  valueMax: flipable.valueMax
62  onValueChanged: if(flipEnabled) flipable.flipped = !flipable.flipped
63  isClickable: flipable.isClickable
64  audioEffects: flipable.audioEffects
65  }
66 
67  // Separation
68  Rectangle {
69  x: parent.width / 2
70  anchors.verticalCenter: parent.verticalCenter
71  width: 2
72  height: parent.height * 0.7
73  color: flipable.borderColor
74  }
75 
76  DominoNumber {
77  id: number2
78  x: parent.width / 2
79  width: parent.width / 2
80  height: parent.height
81  color: flipable.pointColor
82  borderColor: "black"
83  borderWidth: 0
84  radius: parent.height * 0.25
85  valueMax: flipable.valueMax
86  onValueChanged: if(flipEnabled) flipable.flipped = !flipable.flipped
87  isClickable: flipable.isClickable
88  audioEffects: flipable.audioEffects
89  }
90  }
91 
92  back: Rectangle {
93  anchors.fill: parent
94  smooth: true;
95  color: flipable.backColor
96  border.width: flipable.borderWidth
97  radius: flipable.radius
98  }
99 
100  transform: Rotation {
101  id: rotation
102  origin.x: flipable.width/2
103  origin.y: flipable.height/2
104  axis.x: 0; axis.y: 1; axis.z: 0 // set axis.y to 1 to rotate around y-axis
105  angle: 0 // the default angle
106  }
107 
108  states: State {
109  name: "back"
110  PropertyChanges { target: rotation; angle: 180 }
111  when: flipable.flipped
112  onCompleted: flipable.flipped = false
113  }
114 
115  transitions: Transition {
116  NumberAnimation { target: rotation; property: "angle"; duration: 250 }
117  }
118 }
QtQuick
GCAudio
A QML component for audio playback.
Definition: GCAudio.qml:44
GCompris
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Jun 2 2015 21:47:47 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GCompris-qt

Skip menu "GCompris-qt"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Modules

Class Picker

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal