Skip to content

Commit

Permalink
Gallery: don't hinerit from layout
Browse files Browse the repository at this point in the history
it has performences implication as if you inherit from a layout it is always inlined
Since this component is used many times, it makes a difference
  • Loading branch information
ogoffart committed Nov 7, 2023
1 parent 2f64105 commit f4591d4
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions examples/gallery/ui/pages/easings_page.slint
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import { Page } from "page.slint";
import { Button, HorizontalBox, Slider, ScrollView } from "std-widgets.slint";

component EaseTest inherits HorizontalLayout {
padding: 10px;
spacing: 10px;
component EaseTest {

in property <string> label: "None";
in property <easing> easing: linear;
Expand All @@ -19,28 +17,32 @@ component EaseTest inherits HorizontalLayout {
ball.x = 0;
}
}
HorizontalLayout {
padding: 10px;
spacing: 10px;

Button {
width: 140px;
horizontal-stretch: 0;
text: label; clicked => { root.animate(); }
}
Button {
width: 140px;
horizontal-stretch: 0;
text: label; clicked => { root.animate(); }
}

VerticalLayout {
alignment: center;
container := Rectangle {
horizontal-stretch: 1;
height: 4px;
border-radius: 2px;
background: grey;

ball := Rectangle {
x: 0px;
width: 16px;
height: 16px;
border-radius: 5px;
background: blue;
animate x { duration: duration * 1ms; easing: easing; }
VerticalLayout {
alignment: center;
container := Rectangle {
horizontal-stretch: 1;
height: 4px;
border-radius: 2px;
background: grey;

ball := Rectangle {
x: 0px;
width: 16px;
height: 16px;
border-radius: 5px;
background: blue;
animate x { duration: duration * 1ms; easing: easing; }
}
}
}
}
Expand Down

0 comments on commit f4591d4

Please sign in to comment.