Changeset View
Changeset View
Standalone View
Standalone View
src/activities/scalesboard/Question.qml
Show All 20 Lines | |||||
21 | import QtQuick 2.6 | 21 | import QtQuick 2.6 | ||
22 | 22 | | |||
23 | import "../../core" | 23 | import "../../core" | ||
24 | 24 | | |||
25 | Item { | 25 | Item { | ||
26 | id: question | 26 | id: question | ||
27 | 27 | | |||
28 | property string text | 28 | property string text | ||
29 | property bool displayed: text != "" ? true : false | | |||
30 | property string answer | 29 | property string answer | ||
31 | property string userEntry | 30 | property string userEntry | ||
32 | 31 | | |||
33 | Rectangle { | 32 | Rectangle { | ||
34 | id: questionBg | 33 | id: questionBg | ||
35 | x: questionText.x - 4 | 34 | x: questionText.x - 4 | ||
36 | y: questionText.y - 4 | 35 | y: questionText.y - 4 | ||
37 | width: questionText.width + 8 | 36 | width: questionText.width + 8 | ||
38 | height: questionText.height + 8 | 37 | height: questionText.height + 8 | ||
39 | border.color: "black" | 38 | border.color: "black" | ||
40 | border.width: 2 | 39 | border.width: 2 | ||
41 | radius: 8 | 40 | radius: 8 | ||
42 | opacity: question.displayed ? 1 : 0 | | |||
43 | 41 | | |||
jjazeix: you don't need to set the opacity to 0 if it is not visible | |||||
I forget to update this. Sorry for that. I would change the opacity and update the diff. dekumar: I forget to update this. Sorry for that. I would change the opacity and update the diff.
| |||||
44 | gradient: Gradient { | 42 | gradient: Gradient { | ||
45 | GradientStop { position: 0.0; color: "#F0FFFFFF" } | 43 | GradientStop { position: 0.0; color: "#F0FFFFFF" } | ||
46 | GradientStop { position: 0.9; color: "#F0F0F0F0" } | 44 | GradientStop { position: 0.9; color: "#F0F0F0F0" } | ||
47 | GradientStop { position: 1.0; color: "#F0CECECE" } | 45 | GradientStop { position: 1.0; color: "#F0CECECE" } | ||
48 | } | 46 | } | ||
49 | 47 | | |||
50 | Behavior on opacity { NumberAnimation { duration: 100 } } | 48 | Behavior on opacity { NumberAnimation { duration: 100 } } | ||
51 | } | 49 | } | ||
52 | 50 | | |||
53 | GCText { | 51 | GCText { | ||
54 | id: questionText | 52 | id: questionText | ||
55 | color: "black" | 53 | color: "black" | ||
56 | fontSize: largeSize | 54 | fontSize: largeSize | ||
57 | width: parent.width | 55 | width: parent.width | ||
58 | horizontalAlignment: Text.AlignHCenter | 56 | horizontalAlignment: Text.AlignHCenter | ||
59 | verticalAlignment: Text.AlignVCenter | 57 | verticalAlignment: Text.AlignVCenter | ||
60 | wrapMode: TextEdit.WordWrap | 58 | wrapMode: TextEdit.WordWrap | ||
61 | opacity: question.displayed ? 1 : 0 | | |||
62 | text: question.text != "" ? question.text.arg(question.userEntry) : "" | 59 | text: question.text != "" ? question.text.arg(question.userEntry) : "" | ||
jjazeix: same as above + opacity is a real between 0.0 and 1.0, not a boolean | |||||
yeah, I forgot to change this and by removing the displayed property. Would change the opacity to value between 0 to 1. dekumar: yeah, I forgot to change this and by removing the displayed property. Would change the opacity… | |||||
63 | Behavior on opacity { NumberAnimation { duration: 100 } } | 60 | Behavior on opacity { NumberAnimation { duration: 100 } } | ||
64 | 61 | | |||
65 | } | 62 | } | ||
66 | | ||||
67 | onUserEntryChanged: { | | |||
68 | if(userEntry === question.answer) | | |||
69 | bonus.good("flower") | | |||
70 | } | | |||
71 | } | 63 | } |
you don't need to set the opacity to 0 if it is not visible