mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-22 16:22:17 +00:00

Adds a table editor based on the color picker floating draggable panel. This includes behaviours that keep the panel inside the bounds of the live preview window and light / dark mode.
45 lines
1.4 KiB
Text
45 lines
1.4 KiB
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 { ChildIndicator, NameLabel, ResettingLineEdit } from "./basics.slint";
|
|
|
|
import { PropertyValue, PreviewData } from "../../api.slint";
|
|
import { EditorSizeSettings, EditorSpaceSettings } from "../../components/styling.slint";
|
|
|
|
import { Button } from "std-widgets.slint";
|
|
|
|
export component MultiValueWidget inherits GridLayout {
|
|
in property <bool> enabled;
|
|
in property <string> property-name: preview-data.name;
|
|
in property <PropertyValue> property-value;
|
|
in property <PreviewData> preview-data;
|
|
in property <string> property-group-id;
|
|
|
|
callback edit-in-table-editor(property-group-id: string, data: PreviewData);
|
|
|
|
spacing-vertical: EditorSpaceSettings.default-spacing;
|
|
width: 100%;
|
|
|
|
Row {
|
|
NameLabel {
|
|
col: 1;
|
|
|
|
property-name: root.property-name;
|
|
property-value: root.property-value;
|
|
}
|
|
}
|
|
Row {
|
|
ChildIndicator {
|
|
horizontal-stretch: 0;
|
|
visible: false;
|
|
}
|
|
|
|
Button {
|
|
text: preview-data.has-setter ? @tr("Edit") : @tr("View");
|
|
clicked => {
|
|
root.edit-in-table-editor(root.property-group-id, root.preview-data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|