slint/tests/cases/elements/dialog.slint
Olivier Goffart 3ea8be06e8
Make StandardButton focusable
Fixes #7230

ChangleLog: Fixed StandardButton not focusable
2024-12-30 13:33:15 +01:00

40 lines
995 B
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
import { StandardButton, Button, GridBox } from "std-widgets.slint";
TestCase := Dialog {
Rectangle {
background: red;
preferred-width: 600px;
preferred-height: 600px;
}
forward-focus: ok-button;
StandardButton { kind: help; }
ok-button := StandardButton { kind: ok; }
StandardButton { kind: cancel; }
StandardButton { kind: apply; }
StandardButton { kind: reset; }
StandardButton { kind: yes; }
Button {
text: "Action";
dialog-button-role: action;
}
}
/*
```rust
let instance = TestCase::new().unwrap();
instance.on_help_clicked(|| { dbg!() });
instance.on_cancel_clicked(|| { dbg!() });
```
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
instance.on_help_clicked([] { });
instance.on_cancel_clicked([] { });
```
*/