From ddfb6dc73379e3d029dc25dfc201bf461ff04cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 19 Nov 2023 11:06:42 +0100 Subject: [PATCH] Hack steal click --- krokiet/ui/main_lists.slint | 12 ++++++++++-- krokiet/ui/selectable_tree_view.slint | 9 +++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 846fb5e..98cb1e3 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -5,8 +5,13 @@ import {CurrentTab, TypeOfOpenedItem} from "common.slint"; import {MainListModel} from "common.slint"; export component MainList { - in-out property active-tab; - in-out property <[MainListModel]> empty_folder_model; + in-out property active-tab: CurrentTab.EmptyFolders; + in-out property <[MainListModel]> empty_folder_model: [ + {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} + ]; in-out property <[MainListModel]> empty_files_model; in-out property <[MainListModel]> similar_images_model; callback changed_current_tab(); @@ -45,6 +50,9 @@ export component MainList { fileNameIdx: 4; } focus_item := FocusScope { + x:0; + width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503 + key-released(event) => { if (!self.visible || !self.has-focus) { return accept; diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index 96037d9..e8ee0ac 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -8,8 +8,13 @@ import {GuiState} from "gui_state.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); in property <[string]> columns; - in-out property <[MainListModel]> values; - in-out property <[length]> column_sizes; + in-out property <[MainListModel]> values: [ + {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} + ]; + in-out property <[length]> column_sizes: [30px, 80px, 150px, 160px]; private property column_number: column-sizes.length + 1; // This idx, starts from zero, but since first is always a checkbox, and is not in model.val values, remove 1 from idx in-out property parentPathIdx;