Skip to content

Commit

Permalink
Hack steal click
Browse files Browse the repository at this point in the history
  • Loading branch information
qarmin committed Nov 19, 2023
1 parent dcd30dd commit ddfb6dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 10 additions & 2 deletions krokiet/ui/main_lists.slint
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import {CurrentTab, TypeOfOpenedItem} from "common.slint";
import {MainListModel} from "common.slint";

export component MainList {
in-out property <CurrentTab> active-tab;
in-out property <[MainListModel]> empty_folder_model;
in-out property <CurrentTab> 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();
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions krokiet/ui/selectable_tree_view.slint
Original file line number Diff line number Diff line change
Expand Up @@ -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 <int> 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 <int> parentPathIdx;
Expand Down

0 comments on commit ddfb6dc

Please sign in to comment.