Skip to content

Commit db6f436

Browse files
authored
ModalNavigationDrawer: add possibility to react on selection changes of group and item simultaneously (slint-ui#10008)
* ModalNavigationDrawer: add possibility to react on selection changes of group and item simultaneously like in NavigationDrawer * Add arguments and their description to the documentation * align style
1 parent e7313dd commit db6f436

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

ui-libraries/material/docs/src/content/docs/components/Navigation/modal_navigation_drawer.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Selects the navigation item at the specified group and item indices.
6464

6565
## Callbacks
6666

67-
### selected()
68-
Invoked when an item is selected
67+
### selected(group-index: int, item-index: int)
68+
Invoked when an item is selected. `group-index` is the index of the selected group and `item-index` the selected index in that group.
6969

7070
### item_pointer_event()
7171
Emitted on any mouse pointer event similar to `TouchArea`. Arguments are the group and item index associated with the event, the `PointerEvent` itself and the mouse position within the `NavigationDrawer`.

ui-libraries/material/docs/src/content/docs/components/Navigation/navigation_drawer.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ Selects the navigation item at the specified group and item indices.
5757

5858
## Callbacks
5959

60-
### selected()
61-
Invoked when an item is selected
60+
### selected(group-index: int, item-index: int)
61+
Invoked when an item is selected. `group-index` is the index of the selected group and `item-index` the selected index in that group.
6262

6363
### item_pointer_event()
6464
Emitted on any mouse pointer event similar to `TouchArea`. Arguments are the group and item index associated with the event, the `PointerEvent` itself and the mouse position within the `NavigationDrawer`.

ui-libraries/material/src/ui/components/navigation_drawer.slint

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ component NavigationGroupTemplate {
142142
}
143143

144144
export component NavigationDrawer inherits Drawer {
145-
callback selected(group-index: int, item_index: int);
145+
callback selected(group-index: int, item-index: int);
146146
callback item_pointer_event(group_index: int, item_index: int, event: PointerEvent, position: Point);
147147
in property <[NavigationGroup]> groups;
148148
in_out property <int> current_group;
@@ -179,6 +179,7 @@ export component NavigationDrawer inherits Drawer {
179179
}
180180

181181
export component ModalNavigationDrawer inherits ModalDrawer {
182+
callback selected(group-index: int, item-index: int);
182183
in property <[NavigationGroup]> groups;
183184
in_out property <int> current_group;
184185
in_out property <int> current_index;
@@ -207,5 +208,6 @@ export component ModalNavigationDrawer inherits ModalDrawer {
207208
root.current_group = group_index;
208209
root.current_index = item_index;
209210
root.close();
211+
root.selected(group_index, item_index);
210212
}
211213
}

0 commit comments

Comments
 (0)