mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00

When trying to reference an instance of a repeated item, for use with ItemRc or VRef<Item>, the item_index (or id) of the ElementRc is not directly what we want. Adjust any element references to the repeater to to the inner instance after creating them. Also make sure that the enclosing component is respected in the C++ and Rust generators. Fixes #422
52 lines
1.3 KiB
Text
52 lines
1.3 KiB
Text
/* LICENSE BEGIN
|
|
This file is part of the SixtyFPS Project -- https://sixtyfps.io
|
|
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
|
|
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
|
|
|
|
SPDX-License-Identifier: GPL-3.0-only
|
|
This file is also available under commercial licensing terms.
|
|
Please contact info@sixtyfps.io for more information.
|
|
LICENSE END */
|
|
|
|
// issue #422
|
|
|
|
export TestCase := Window {
|
|
width: 100phx;
|
|
height: 100phx;
|
|
|
|
property<bool> combo_has_focus;
|
|
|
|
if (true): combo := FocusScope {
|
|
if (true): TouchArea {
|
|
clicked => {
|
|
combo.focus();
|
|
root.combo_has_focus = combo.has-focus;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
|
|
```cpp
|
|
auto handle = TestCase::create();
|
|
const TestCase &instance = *handle;
|
|
assert(!instance.get_combo_has_focus());
|
|
sixtyfps::testing::send_mouse_click(&instance, 5., 5.);
|
|
assert(instance.get_combo_has_focus());
|
|
```
|
|
|
|
```rust
|
|
let instance = TestCase::new();
|
|
assert!(!instance.get_combo_has_focus());
|
|
sixtyfps::testing::send_mouse_click(&instance, 5., 5.);
|
|
assert!(instance.get_combo_has_focus());
|
|
```
|
|
|
|
```js
|
|
var instance = new sixtyfps.TestCase();
|
|
assert(!instance.combo_has_focus);
|
|
instance.send_mouse_click(5., 5.);
|
|
assert(instance.combo_has_focus);
|
|
```
|
|
*/
|