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
4
5component Button inherits Rectangle {
6 ta := TouchArea {}
7 background: ta.pressed ? blue: red;
8 callback clicked <=> ta.clicked;
9 in property <string> text;
10}
11
12
13 export AppWindow := Window {
14 property<int> counter: 42;
15 callback request-increase-value();
16 VerticalLayout {
17 Button {
18 text: "Increase value";
19 clicked => {
20 request-increase-value();
21 }
22 states [
23 highlight when counter > 45 : {
24 background: red;
25// ^error{Internal error: The expression for the default state currently cannot be represented: https://github.com/slint-ui/slint/issues/1461}
26 }
27 ]
28 }
29 }
30 }
31