mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-03 05:12:55 +00:00
live-preview: Add EditMultiValueWidget
back in. It should open a spreadsheet view for table-like data in the live data preview.
This commit is contained in:
parent
5fcf6da7d2
commit
b706e7a019
1 changed files with 26 additions and 0 deletions
|
|
@ -875,6 +875,27 @@ component BooleanWidget inherits VerticalLayout {
|
|||
}
|
||||
}
|
||||
|
||||
component EditMultiValueWidget inherits VerticalLayout {
|
||||
in property <bool> enabled;
|
||||
in property <string> property-name;
|
||||
in property <PropertyValue> property-value;
|
||||
in property <PreviewData> preview-data;
|
||||
in property <string> property-group-name;
|
||||
|
||||
callback edit-in-spreadsheet(property-group-name: string, data: PreviewData, values: [[PropertyValue]]);
|
||||
|
||||
NameLabel {
|
||||
property-name: root.property-name;
|
||||
property-value: root.property-value;
|
||||
}
|
||||
Button {
|
||||
text: preview-data.has-setter ? @tr("Edit") : @tr("View");
|
||||
clicked => {
|
||||
root.edit-in-spreadsheet(root.property-group-name, root.preview-data, [[ ]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component EditJsonWidget inherits VerticalLayout {
|
||||
in property <bool> enabled;
|
||||
in property <string> property-name;
|
||||
|
|
@ -1264,6 +1285,11 @@ export component PreviewDataPropertyValueWidget inherits VerticalLayout {
|
|||
return(root.set-code-binding(is_translated ? "\"\{text}\"" : text));
|
||||
}
|
||||
}
|
||||
if root.preview-data.kind == PreviewDataKind.Table: EditMultiValueWidget {
|
||||
edit-in-spreadsheet(property-group-name, data, values) => {
|
||||
debug("edit-in-spreadsheet TRIGGERED: ", property-group-name, data, values);
|
||||
}
|
||||
}
|
||||
if root.preview-data.kind == PreviewDataKind.Json: EditJsonWidget {
|
||||
enabled: root.preview-data.has-setter;
|
||||
property-name: root.preview-data.name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue