diff --git a/tools/lsp/ui/main.slint b/tools/lsp/ui/main.slint index 19bdb6717cb..ca4afb9ab8c 100644 --- a/tools/lsp/ui/main.slint +++ b/tools/lsp/ui/main.slint @@ -16,6 +16,7 @@ import { PropertyView } from "./views/property-view.slint"; export { Api } + export component PreviewUi inherits Window { property border: 20px; property visible-component: { @@ -25,8 +26,9 @@ export component PreviewUi inherits Window { is-user-defined: false, is-currently-shown: false, }; - property show-left-sidebar: true; - property show-right-sidebar: true; + property show-left-sidebar; + property show-right-sidebar; + title: "Slint Live-Preview"; icon: @image-url("assets/slint-logo-small-light.png"); @@ -63,20 +65,22 @@ export component PreviewUi inherits Window { Api.style-changed(); } - Button { + edit:=Button { icon: Icons.inspect; - colorize-icon: true; + colorize-icon: preview.select-mode ? false : true; checkable: true; checked <=> preview.select-mode; enabled: !preview.design-mode; visible: !preview.design-mode; + primary: preview.select-mode; } } + HorizontalLayout { spacing: EditorSpaceSettings.default-spacing; - if Api.design-mode && root.show-left-sidebar: LibraryView { + if root.show-left-sidebar: LibraryView { known-components: Api.known-components; preview-area-position-x: preview.preview-area-position-x; preview-area-position-y: preview.preview-area-position-y; @@ -101,7 +105,7 @@ export component PreviewUi inherits Window { visible-component <=> root.visible-component; } - if Api.design-mode && root.show-right-sidebar: PropertyView { } + if root.show-right-sidebar: PropertyView { } } StatusLine { } diff --git a/tools/lsp/ui/views/header-view.slint b/tools/lsp/ui/views/header-view.slint index b4f5b9b102d..e539b62905e 100644 --- a/tools/lsp/ui/views/header-view.slint +++ b/tools/lsp/ui/views/header-view.slint @@ -47,16 +47,16 @@ export component HeaderView { spacing: EditorSpaceSettings.default-spacing; HorizontalLayout { + visible: false; spacing: EditorSpaceSettings.default-spacing / 2; - horizontal-stretch: 0; - - @children + horizontal-stretch: 1; BodyText { text: @tr("Interact"); } interaction-switch := Switch { + checked: true; toggled => { root.edit-mode-toggled(); } @@ -66,6 +66,7 @@ export component HeaderView { text: @tr("Edit"); } } + @children left-panel-button := Button { horizontal-stretch: 0; @@ -73,7 +74,6 @@ export component HeaderView { checkable: true; icon: self.checked ? Icons.sidebar-left : Icons.sidebar-left-off; colorize-icon: true; - visible:root.edit-mode; } right-panel-button := Button { @@ -82,7 +82,7 @@ export component HeaderView { checkable: true; icon: self.checked ? Icons.sidebar-right : Icons.sidebar-right-off; colorize-icon: true; - visible: root.edit-mode; + // visible: root.edit-mode; } }