1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4export TestCase := Rectangle {
5 property<bool> checked;
6 property <int> border;
7 states [
8 checked when checked: {
9 color: blue; // same as root.color
10 text.color: red;
11 border: 42;
12 }
13 pressed when touch.pressed: {
14 color: green;
15 border: 88;
16 text.foo.bar: 0;
17/// ^error{'text.foo.bar' is not a valid property}
18 colour: yellow;
19/// ^error{'colour' is not a valid property}
20/// ^^error{Unknown unqualified identifier 'yellow'}
21 fox.color: yellow;
22/// ^error{'fox' is not a valid element id}
23 text.fox: yellow;
24/// ^error{'fox' not found in 'text'}
25/// ^^error{Unknown unqualified identifier 'yellow'}
26 }
27 ]
28
29 transitions [
30 in pressed: {
31 animate * { duration: 88ms; }
32 animate color { duration: 88ms; }
33 }
34 out pressed: {
35 animate color, foo.x { duration: 300ms; }
36/// ^error{'foo' is not a valid element id}
37 //pause: 20ms;
38 animate border { duration: 120ms; }
39 animate color, text.text { duration: 300ms; }
40/// ^error{'text.text' is not a property that can be animated}
41
42 }
43 ]
44
45 text := Text {}
46 touch := TouchArea {}
47
48}
49
50
51export component NewSyntax {
52 property<bool> checked;
53 property <int> border;
54 property <color> color;
55 states [
56 checked when checked: {
57 color: blue; // same as root.color
58 text.color: red;
59 border: 42;
60 }
61 pressed when touch.pressed: {
62 color: green;
63 border: 88;
64 text.foo.bar: 0;
65/// ^error{'text.foo.bar' is not a valid property}
66 colour: yellow;
67/// ^error{'colour' is not a valid property}
68/// ^^error{Unknown unqualified identifier 'yellow'}
69 fox.color: yellow;
70/// ^error{'fox' is not a valid element id}
71 text.fox: yellow;
72/// ^error{'fox' not found in 'text'}
73/// ^^error{Unknown unqualified identifier 'yellow'}
74
75 in {
76 animate * { duration: 88ms; }
77 animate color { duration: 88ms; }
78 }
79 out {
80 animate color, foo.x { duration: 300ms; }
81/// ^error{'foo' is not a valid element id}
82 animate border { duration: 120ms; }
83 animate color, text.text { duration: 300ms; }
84/// ^error{'text.text' is not a property that can be animated}
85 }
86 }
87 ]
88
89 text := Text {}
90 touch := TouchArea {}
91
92}
93
94export component OldInNewSyntax {
95 property<bool> checked;
96 property <int> border;
97 property <color> color;
98 states [
99 checked when checked: {
100 color: blue; // same as root.color
101 text.color: red;
102 border: 42;
103 }
104 pressed when touch.pressed: {
105 color: green;
106 border: 88;
107 text.foo.bar: 0;
108/// ^error{'text.foo.bar' is not a valid property}
109 colour: yellow;
110/// ^error{'colour' is not a valid property}
111/// ^^error{Unknown unqualified identifier 'yellow'}
112 fox.color: yellow;
113/// ^error{'fox' is not a valid element id}
114 text.fox: yellow;
115/// ^error{'fox' not found in 'text'}
116/// ^^error{Unknown unqualified identifier 'yellow'}
117 }
118 ]
119
120 transitions [
121/// ^error{'transitions' block are no longer supported. Use 'in \{...\}' and 'out \{...\}' directly in the state definition}
122 in pressed: {
123 animate * { duration: 88ms; }
124 animate color { duration: 88ms; }
125 }
126 out pressed: {
127 animate color, foo.x { duration: 300ms; }
128/// ^error{'foo' is not a valid element id}
129 animate border { duration: 120ms; }
130 animate color, text.text { duration: 300ms; }
131/// ^error{'text.text' is not a property that can be animated}
132
133 }
134 ]
135
136 text := Text {}
137 touch := TouchArea {}
138
139}
140