slint/tests/cases/focus/initial_focus_through_layout.slint
Aurindam Jana 3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00

45 lines
1 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
TextComponent := GridLayout {
property<bool> has_focus: my_text_input.has_focus;
forward-focus: my_text_input;
Row {
my_text_input := TextInput { }
}
}
TestCase := Rectangle {
width: 400phx;
height: 400phx;
forward-focus: input2;
input1 := TextComponent {
}
input2 := TextComponent {
}
property<bool> input1_focused: input1.has_focus;
property<bool> input2_focused: input2.has_focus;
}
/*
```rust
let instance = TestCase::new().unwrap();
assert!(!instance.get_input1_focused());
assert!(instance.get_input2_focused());
```
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert(!instance.get_input1_focused());
assert(instance.get_input2_focused());
```
```js
var instance = new slint.TestCase();
assert(!instance.input1_focused);
assert(instance.input2_focused);
```
*/