mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-29 03:02:06 +00:00
live-preview: Do not pass on signals from "invisible" widgets
This stops e.g. the color widget filling in default values for empty strings.
This commit is contained in:
parent
daba39e34b
commit
14b55e54b4
1 changed files with 70 additions and 20 deletions
|
|
@ -52,10 +52,12 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
property-value <=> root.property-value;
|
||||
|
||||
set-bool-binding(value) => {
|
||||
if root.property-value.kind == PropertyValueKind.boolean {
|
||||
root.set-bool-binding(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: (root.property-value.kind == PropertyValueKind.color) ? self.preferred-height : 0px;
|
||||
|
|
@ -69,20 +71,30 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
has-reset-action: root.has-reset-action;
|
||||
|
||||
test-color-binding(text) => {
|
||||
if root.property-value.kind == PropertyValueKind.color {
|
||||
return (root.test-color-binding(text));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
set-color-binding(text) => {
|
||||
if root.property-value.kind == PropertyValueKind.color {
|
||||
root.set-color-binding(text);
|
||||
}
|
||||
}
|
||||
|
||||
reset-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.color {
|
||||
root.reset-action();
|
||||
}
|
||||
}
|
||||
code-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.color {
|
||||
root.code-action();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: (root.property-value.kind == PropertyValueKind.brush) ? self.preferred-height : 0px;
|
||||
|
|
@ -96,20 +108,30 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
has-reset-action: root.has-reset-action;
|
||||
|
||||
test-brush-binding(kind, angle, color, stops) => {
|
||||
if root.property-value.kind == PropertyValueKind.brush {
|
||||
return root.test-brush-binding(kind, angle, color, stops);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
set-brush-binding(kind, angle, color, stops) => {
|
||||
if root.property-value.kind == PropertyValueKind.brush {
|
||||
root.set-brush-binding(kind, angle, color, stops);
|
||||
}
|
||||
}
|
||||
|
||||
reset-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.brush {
|
||||
root.reset-action();
|
||||
}
|
||||
}
|
||||
code-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.brush {
|
||||
root.code-action();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: root.property-value.kind == PropertyValueKind.code ? self.preferred-height : 0px;
|
||||
|
|
@ -120,13 +142,17 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
property-value <=> root.property-value;
|
||||
|
||||
reset-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.code {
|
||||
root.reset-action();
|
||||
}
|
||||
}
|
||||
code-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.code {
|
||||
root.code-action();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: root.property-value.kind == PropertyValueKind.enum ? self.preferred-height : 0px;
|
||||
|
|
@ -137,10 +163,12 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
property-value <=> root.property-value;
|
||||
|
||||
set-enum-binding(text) => {
|
||||
if root.property-value.kind == PropertyValueKind.enum {
|
||||
root.set-enum-binding(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: root.property-value.kind == PropertyValueKind.float ? self.preferred-height : 0px;
|
||||
|
|
@ -151,13 +179,19 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
property-value <=> root.property-value;
|
||||
|
||||
test-float-binding(text, unit) => {
|
||||
if root.property-value.kind == PropertyValueKind.float {
|
||||
return (root.test-float-binding(text, unit));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
set-float-binding(text, unit) => {
|
||||
if root.property-value.kind == PropertyValueKind.float {
|
||||
root.set-float-binding(text, unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: root.property-value.kind == PropertyValueKind.integer ? self.preferred-height : 0px;
|
||||
|
|
@ -168,13 +202,19 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
property-value <=> root.property-value;
|
||||
|
||||
test-integer-binding(text) => {
|
||||
if root.property-value.kind == PropertyValueKind.integer {
|
||||
return (root.test-code-binding(text));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
set-integer-binding(text) => {
|
||||
if root.property-value.kind == PropertyValueKind.integer {
|
||||
root.set-code-binding(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: root.property-value.kind == PropertyValueKind.string ? self.preferred-height : 0px;
|
||||
|
|
@ -189,20 +229,30 @@ export component PropertyValueWidget inherits VerticalLayout {
|
|||
is-translatable <=> root.strings-are-translatable;
|
||||
|
||||
reset-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.string {
|
||||
root.reset-action();
|
||||
}
|
||||
}
|
||||
code-action() => {
|
||||
if root.property-value.kind == PropertyValueKind.string {
|
||||
root.code-action();
|
||||
}
|
||||
}
|
||||
test-string-binding(text, is_translated) => {
|
||||
if root.property-value.kind == PropertyValueKind.string {
|
||||
return root.test-string-binding(text, is_translated);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
set-string-binding(text, is_translated) => {
|
||||
if root.property-value.kind == PropertyValueKind.string {
|
||||
root.set-string-binding(text, is_translated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component PropertyInformationWidget inherits VerticalLayout {
|
||||
in property <PropertyInformation> property-information;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue