mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-03 21:24:17 +00:00
material: SegmentedButton: Add index-changed callback. (https://github.com/slint-ui/material-components/issues/149)
Imported from 67d5871e56
This commit is contained in:
parent
4a9192883a
commit
eb105c8593
2 changed files with 8 additions and 0 deletions
|
|
@ -39,6 +39,11 @@ The index of the currently selected item.
|
|||
An array of segmented items, each containing an icon and text.
|
||||
</SlintProperty>
|
||||
|
||||
## Callbacks
|
||||
|
||||
### index-changed(index: int)
|
||||
Invoked when the current-index changes.
|
||||
|
||||
## Functions
|
||||
|
||||
### select(index: int)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ export component SegmentedButton {
|
|||
in property <[SegmentedItem]> model;
|
||||
in_out property <int> current_index;
|
||||
|
||||
callback index_changed(index: int);
|
||||
|
||||
min_width: max(2 * MaterialStyleMetrics.size_40, layout.min_width);
|
||||
min_height: max(MaterialStyleMetrics.size_40, layout.min_height);
|
||||
|
||||
|
|
@ -96,5 +98,6 @@ export component SegmentedButton {
|
|||
}
|
||||
|
||||
root.current_index = index;
|
||||
root.index_changed(index);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue