GCompris-qt
31 property string textLabel
32 property bool isCorrectAnswer:
false
34 property color normalStateColor:
"#fff"
35 property color correctStateColor:
"#ffa"
36 property color wrongStateColor:
"#f66"
37 property bool blockClicks:
false
39 property int wrongAnswerShakeAmplitudeCalc: width * 0.2
40 property int wrongAnswerShakeAmplitudeMin: 45
41 property int wrongAnswerShakeAmplitude: wrongAnswerShakeAmplitudeCalc < wrongAnswerShakeAmplitudeMin ? wrongAnswerShakeAmplitudeMin : wrongAnswerShakeAmplitudeCalc
46 signal correctlyPressed
47 signal incorrectlyPressed
52 if (isCorrectAnswer) {
54 audioEffects.
play(
"qrc:/gcompris/src/core/resource/sounds/win.wav")
55 correctAnswerAnimation.start();
58 audioEffects.play(
"qrc:/gcompris/src/core/resource/sounds/crash.wav")
59 wrongAnswerAnimation.start();
67 color: normalStateColor
74 source:
"qrc:/gcompris/src/core/resource/button.svg"
75 sourceSize { height: parent.height; width: parent.width }
76 width: sourceSize.width
77 height: sourceSize.height
82 anchors.verticalCenter: parent.verticalCenter
85 property int horizontallyCenteredX: (button.width - width) >> 1;
86 x: horizontallyCenteredX;
95 onPressed: button.pressed()
99 id: correctAnswerAnimation
102 if (typeof(feedback) ===
"object")
103 feedback.playCorrectSound();
105 if (typeof(particles) ===
"object")
112 value: correctStateColor
131 SequentialAnimation {
132 id: wrongAnswerAnimation
134 SequentialAnimation {
138 value: wrongStateColor
142 if (typeof(feedback) ===
"object")
143 feedback.playIncorrectSound();
153 SequentialAnimation {
157 to: label.horizontallyCenteredX - wrongAnswerShakeAmplitude
158 easing.type: Easing.InCubic
164 to: label.horizontallyCenteredX + wrongAnswerShakeAmplitude
165 easing.type: Easing.InOutCubic
171 to: label.horizontallyCenteredX
172 easing { type: Easing.OutBack; overshoot: 3 }
185 incorrectlyPressed();
A QML component unifying text presentation in GCompris.
A QML component for audio playback.
void play(string file)
When mute is changed we set the volume to 0 to mute a potential playing sound.
A QML loader that wraps ParticleSystemStar.
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.