From f92bf115994fd251bb1bba3bc223468f0ec3efb2 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Fri, 20 Mar 2026 18:03:24 +0100 Subject: [PATCH 01/12] added a draft version of a new selectable table view --- src/EasyApp/Gui/Components/NewTableView.qml | 132 ++++++++++++++++++++ src/EasyApp/Gui/Components/TableView.qml | 1 + src/EasyApp/Gui/Components/qmldir | 1 + 3 files changed, 134 insertions(+) create mode 100644 src/EasyApp/Gui/Components/NewTableView.qml diff --git a/src/EasyApp/Gui/Components/NewTableView.qml b/src/EasyApp/Gui/Components/NewTableView.qml new file mode 100644 index 00000000..9d0eb8e9 --- /dev/null +++ b/src/EasyApp/Gui/Components/NewTableView.qml @@ -0,0 +1,132 @@ +import QtQuick +import QtQuick.Controls + +import EasyApp.Gui.Globals as EaGlobals +import EasyApp.Gui.Style as EaStyle +import EasyApp.Gui.Animations as EaAnimations +import EasyApp.Gui.Elements as EaElements +import EasyApp.Gui.Components as EaComponents + +Item { + id: newTableView + height: 200 + width: EaStyle.Sizes.sideBarContentWidth + + // exposing underlying tableview API + property alias showHeader: nestedTableView.showHeader + property alias tallRows: nestedTableView.tallRows + property alias maxRowCountShow: nestedTableView.maxRowCountShow + property alias defaultInfoText: nestedTableView.defaultInfoText + property alias header: nestedTableView.header + property alias model: nestedTableView.model + property alias delegate: nestedTableView.delegate + + ItemSelectionModel { + id: selectionModel + model: nestedTableView.model + } + + // --- helper: convert row -> QModelIndex --- + function _index(row) { + if (!selectionModel.model) + return null + return selectionModel.model.index(row, 0) + } + + // --- public API --- + function isSelected(row) { + let idx = _index(row) + return idx ? selectionModel.isSelected(idx) : false + } + + function select(row) { + let idx = _index(row) + if (!idx) + return + + selectionModel.select( + idx, + ItemSelectionModel.Select | ItemSelectionModel.Rows + ) + } + + function selectSingle(row) { + let idx = _index(row) + if (!idx) + return + + selectionModel.clearSelection() + selectionModel.select( + idx, + ItemSelectionModel.Select | ItemSelectionModel.Rows + ) + } + + function toggleSelection(row) { + let idx = _index(row) + if (!idx) + return + + if (selectionModel.isSelected(idx)) { + selectionModel.select( + idx, + ItemSelectionModel.Deselect | ItemSelectionModel.Rows + ) + } else { + selectionModel.select( + idx, + ItemSelectionModel.Select | ItemSelectionModel.Rows + ) + } + } + + function clearSelection() { + selectionModel.clearSelection() + } + + + EaComponents.TableView { + id: nestedTableView + clip: true + antialiasing: true + anchors.fill: parent + anchors.margins: 1 + + delegate: EaComponents.TableViewDelegate { + + required property int index + required property string name + required property string structure_type + required property string description + + color: newTableView.isSelected(index) + ? EaStyle.Colors.themeAccentMinor + : (index % 2 + ? EaStyle.Colors.themeBackgroundHovered2 + : EaStyle.Colors.themeBackgroundHovered1) + + EaComponents.TableViewLabel { + id: modelNameColumn + width: EaStyle.Sizes.fontPixelSize * 10 + text: name + leftPadding: EaStyle.Sizes.fontPixelSize * 0.7 + } + + EaComponents.TableViewLabel { + id: typeColumn + width: EaStyle.Sizes.fontPixelSize * 6 + text: structure_type + } + + EaComponents.TableViewLabel { + id: descrColumn + width: EaStyle.Sizes.fontPixelSize * 22 + text: description + } + + mouseArea.onPressed: (mouse) => { + newTableView.select(index) + } + } + } +} diff --git a/src/EasyApp/Gui/Components/TableView.qml b/src/EasyApp/Gui/Components/TableView.qml index c3d538ec..bd02319f 100644 --- a/src/EasyApp/Gui/Components/TableView.qml +++ b/src/EasyApp/Gui/Components/TableView.qml @@ -57,6 +57,7 @@ ListView { Rectangle { anchors.fill: listView color: "transparent" + //antialiasing: true border.color: EaStyle.Colors.appBarComboBoxBorder Behavior on border.color { EaAnimations.ThemeChange {} } } diff --git a/src/EasyApp/Gui/Components/qmldir b/src/EasyApp/Gui/Components/qmldir index 55a7dd24..608c090a 100644 --- a/src/EasyApp/Gui/Components/qmldir +++ b/src/EasyApp/Gui/Components/qmldir @@ -21,6 +21,7 @@ SideBarColumn 1.0 SideBarColumn.qml PreferencesDialog 1.0 PreferencesDialog.qml ProjectDescriptionDialog 1.0 ProjectDescriptionDialog.qml +NewTableView 1.0 NewTableView.qml TableView 1.0 TableView.qml TableViewHeader 1.0 TableViewHeader.qml TableViewDelegate 1.0 TableViewDelegate.qml From 50f4f4891c8a42f3d567a127dd1672ae654091d0 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Sun, 22 Mar 2026 15:08:56 +0100 Subject: [PATCH 02/12] Removed delegate to a separate file --- src/EasyApp/Gui/Components/NewTableView.qml | 98 +++++++++++-------- .../Gui/Components/NewTableViewDelegate.qml | 63 ++++++++++++ src/EasyApp/Gui/Components/qmldir | 1 + 3 files changed, 121 insertions(+), 41 deletions(-) create mode 100644 src/EasyApp/Gui/Components/NewTableViewDelegate.qml diff --git a/src/EasyApp/Gui/Components/NewTableView.qml b/src/EasyApp/Gui/Components/NewTableView.qml index 9d0eb8e9..05d38b3f 100644 --- a/src/EasyApp/Gui/Components/NewTableView.qml +++ b/src/EasyApp/Gui/Components/NewTableView.qml @@ -9,10 +9,15 @@ import EasyApp.Gui.Components as EaComponents Item { id: newTableView - height: 200 + height: count === 0 ? + 2 * EaStyle.Sizes.tableRowHeight : + showHeader ? + nestedTableView.tableRowHeight * (Math.min(count, maxRowCountShow) + 1 ) : + nestedTableView.tableRowHeight * (Math.min(count, maxRowCountShow)) width: EaStyle.Sizes.sideBarContentWidth // exposing underlying tableview API + property alias count: nestedTableView.count property alias showHeader: nestedTableView.showHeader property alias tallRows: nestedTableView.tallRows property alias maxRowCountShow: nestedTableView.maxRowCountShow @@ -21,11 +26,24 @@ Item { property alias model: nestedTableView.model property alias delegate: nestedTableView.delegate + // trigger for bindings + property int selectionRevision: 0 + // idx for shift-selection + property int anchorRow: -1 + ItemSelectionModel { id: selectionModel model: nestedTableView.model } + Connections { + target: selectionModel + + function onSelectionChanged() { + newTableView.selectionRevision++ + } + } + // --- helper: convert row -> QModelIndex --- function _index(row) { if (!selectionModel.model) @@ -39,45 +57,53 @@ Item { return idx ? selectionModel.isSelected(idx) : false } - function select(row) { + function selectWithModifiers(row, modifiers) { let idx = _index(row) - if (!idx) - return + if (!idx) return - selectionModel.select( - idx, - ItemSelectionModel.Select | ItemSelectionModel.Rows - ) - } + // --- SHIFT: range selection --- + if (modifiers & Qt.ShiftModifier) { + if (anchorRow < 0) { + anchorRow = row + } - function selectSingle(row) { - let idx = _index(row) - if (!idx) - return + let from = Math.min(anchorRow, row) + let to = Math.max(anchorRow, row) - selectionModel.clearSelection() - selectionModel.select( - idx, - ItemSelectionModel.Select | ItemSelectionModel.Rows - ) - } + // If Ctrl is NOT pressed → replace selection + if (!(modifiers & Qt.ControlModifier)) { + selectionModel.clearSelection() + } + + for (let i = from; i <= to; i++) { + let rIdx = _index(i) + if (rIdx) { + selectionModel.select( + rIdx, + ItemSelectionModel.Select | ItemSelectionModel.Rows + ) + } + } - function toggleSelection(row) { - let idx = _index(row) - if (!idx) return + } - if (selectionModel.isSelected(idx)) { + // --- CTRL: toggle --- + if (modifiers & Qt.ControlModifier) { selectionModel.select( idx, - ItemSelectionModel.Deselect | ItemSelectionModel.Rows - ) - } else { - selectionModel.select( - idx, - ItemSelectionModel.Select | ItemSelectionModel.Rows + ItemSelectionModel.Toggle | ItemSelectionModel.Rows ) + anchorRow = row + return } + + // --- DEFAULT: single selection --- + selectionModel.select( + idx, + ItemSelectionModel.ClearAndSelect | ItemSelectionModel.Rows + ) + anchorRow = row } function clearSelection() { @@ -92,18 +118,12 @@ Item { anchors.fill: parent anchors.margins: 1 - delegate: EaComponents.TableViewDelegate { - + delegate: EaComponents.NewTableViewDelegate { required property int index required property string name required property string structure_type required property string description - - color: newTableView.isSelected(index) - ? EaStyle.Colors.themeAccentMinor - : (index % 2 - ? EaStyle.Colors.themeBackgroundHovered2 - : EaStyle.Colors.themeBackgroundHovered1) + tableView: nestedTableView EaComponents.TableViewLabel { id: modelNameColumn @@ -123,10 +143,6 @@ Item { width: EaStyle.Sizes.fontPixelSize * 22 text: description } - - mouseArea.onPressed: (mouse) => { - newTableView.select(index) - } } } } diff --git a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml new file mode 100644 index 00000000..36aea81e --- /dev/null +++ b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml @@ -0,0 +1,63 @@ +import QtQuick + +import EasyApp.Gui.Style as EaStyle +import EasyApp.Gui.Animations as EaAnimations + +Rectangle { + id: control + + default property alias contentRowData: contentRow.data + property alias mouseArea: mouseArea + property Item tableView: parent === null ? null : parent.parent + + implicitWidth: parent == null ? 0 : parent.width + implicitHeight: tableView === null ? EaStyle.Sizes.tableRowHeight : tableView.tableRowHeight + + color: { + newTableView.selectionRevision + + let selected = newTableView.isSelected(index) + let c1 = EaStyle.Colors.themeAccentMinor || "lightblue" + let c2 = EaStyle.Colors.themeBackgroundHovered2 || "#eeeeee" + let c3 = EaStyle.Colors.themeBackgroundHovered1 || "#dddddd" + + return selected + ? c1 + : (index % 2 ? c2 : c3) + } + Behavior on color { EaAnimations.ThemeChange {} } + + Row { + id: contentRow + + height: parent.height + spacing: EaStyle.Sizes.tableColumnSpacing + } + + //Mouse area to react on click events + MouseArea { + id: mouseArea + anchors.fill: parent + propagateComposedEvents: true + cursorShape: undefined //Qt.PointingHandCursor + hoverEnabled: false + onPressed: (mouse) => { + parent.ListView.view.selectWithModifiers(index, mouse.modifiers) + } + } + + // HoverHandler to react on hover events + HoverHandler { + id: mouseHoverHandler + acceptedDevices: PointerDevice.AllDevices + cursorShape: Qt.PointingHandCursor + blocking: false + onHoveredChanged: { + if (hovered) { + //console.error(`${control} [TableViewDelegate.qml] hovered`) + parent.ListView.view.currentIndex = index + } + } + } + +} diff --git a/src/EasyApp/Gui/Components/qmldir b/src/EasyApp/Gui/Components/qmldir index 608c090a..7437af08 100644 --- a/src/EasyApp/Gui/Components/qmldir +++ b/src/EasyApp/Gui/Components/qmldir @@ -22,6 +22,7 @@ PreferencesDialog 1.0 PreferencesDialog.qml ProjectDescriptionDialog 1.0 ProjectDescriptionDialog.qml NewTableView 1.0 NewTableView.qml +NewTableViewDelegate 1.0 NewTableViewDelegate.qml TableView 1.0 TableView.qml TableViewHeader 1.0 TableViewHeader.qml TableViewDelegate 1.0 TableViewDelegate.qml From a947f3d29c4d9847b3e426bab12a02f177e5c985 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Mon, 23 Mar 2026 13:28:39 +0100 Subject: [PATCH 03/12] delegate not working fix --- src/EasyApp/Gui/Components/NewTableView.qml | 1 - src/EasyApp/Gui/Components/NewTableViewDelegate.qml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/EasyApp/Gui/Components/NewTableView.qml b/src/EasyApp/Gui/Components/NewTableView.qml index 05d38b3f..d9e2f308 100644 --- a/src/EasyApp/Gui/Components/NewTableView.qml +++ b/src/EasyApp/Gui/Components/NewTableView.qml @@ -123,7 +123,6 @@ Item { required property string name required property string structure_type required property string description - tableView: nestedTableView EaComponents.TableViewLabel { id: modelNameColumn diff --git a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml index 36aea81e..b74dbb6a 100644 --- a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml +++ b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml @@ -17,7 +17,7 @@ Rectangle { newTableView.selectionRevision let selected = newTableView.isSelected(index) - let c1 = EaStyle.Colors.themeAccentMinor || "lightblue" + let c1 = EaStyle.Colors.themeAccentMinor || "#4d9dbd" let c2 = EaStyle.Colors.themeBackgroundHovered2 || "#eeeeee" let c3 = EaStyle.Colors.themeBackgroundHovered1 || "#dddddd" @@ -42,7 +42,7 @@ Rectangle { cursorShape: undefined //Qt.PointingHandCursor hoverEnabled: false onPressed: (mouse) => { - parent.ListView.view.selectWithModifiers(index, mouse.modifiers) + control.ListView.view.parent.selectWithModifiers(index, mouse.modifiers) } } From 27240b0c305627de79ab51926bcd5b6e7fd9e541 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Mon, 23 Mar 2026 14:42:10 +0100 Subject: [PATCH 04/12] removed the initialized delegate from NewTableView component --- src/EasyApp/Gui/Components/NewTableView.qml | 24 ------------------- .../Gui/Components/NewTableViewDelegate.qml | 8 +++---- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/src/EasyApp/Gui/Components/NewTableView.qml b/src/EasyApp/Gui/Components/NewTableView.qml index d9e2f308..db42847f 100644 --- a/src/EasyApp/Gui/Components/NewTableView.qml +++ b/src/EasyApp/Gui/Components/NewTableView.qml @@ -118,30 +118,6 @@ Item { anchors.fill: parent anchors.margins: 1 - delegate: EaComponents.NewTableViewDelegate { - required property int index - required property string name - required property string structure_type - required property string description - - EaComponents.TableViewLabel { - id: modelNameColumn - width: EaStyle.Sizes.fontPixelSize * 10 - text: name - leftPadding: EaStyle.Sizes.fontPixelSize * 0.7 - } - - EaComponents.TableViewLabel { - id: typeColumn - width: EaStyle.Sizes.fontPixelSize * 6 - text: structure_type - } - EaComponents.TableViewLabel { - id: descrColumn - width: EaStyle.Sizes.fontPixelSize * 22 - text: description - } - } } } diff --git a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml index b74dbb6a..c1d30f4a 100644 --- a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml +++ b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml @@ -14,10 +14,11 @@ Rectangle { implicitHeight: tableView === null ? EaStyle.Sizes.tableRowHeight : tableView.tableRowHeight color: { - newTableView.selectionRevision + ListView.view.parent.selectionRevision - let selected = newTableView.isSelected(index) - let c1 = EaStyle.Colors.themeAccentMinor || "#4d9dbd" + let selected = ListView.view.parent.isSelected(index) + // quickfix until new color accent PR is accepted + let c1 = EaStyle.Colors.themeAccentMinor || "#4d9dbd" // "#8ad6ed" for light or "#4d9dbd" for dark let c2 = EaStyle.Colors.themeBackgroundHovered2 || "#eeeeee" let c3 = EaStyle.Colors.themeBackgroundHovered1 || "#dddddd" @@ -59,5 +60,4 @@ Rectangle { } } } - } From 8c86671bfb758e36625a16e83166a571b020f4b4 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Tue, 24 Mar 2026 11:54:59 +0100 Subject: [PATCH 05/12] changes to the scrollbar --- src/EasyApp/Gui/Components/NewTableView.qml | 38 ++++++++++++++++++- .../Gui/Components/NewTableViewDelegate.qml | 13 +++++-- src/EasyApp/Gui/Components/TableView.qml | 2 +- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/EasyApp/Gui/Components/NewTableView.qml b/src/EasyApp/Gui/Components/NewTableView.qml index db42847f..8fbc8a69 100644 --- a/src/EasyApp/Gui/Components/NewTableView.qml +++ b/src/EasyApp/Gui/Components/NewTableView.qml @@ -110,14 +110,48 @@ Item { selectionModel.clearSelection() } + // ScrollView{ + // width: nestedTableView.width + // height: nestedTableView.height + + // ScrollBar.vertical: EaElements.ScrollBar { + // id: scrollBar + // anchors.right: parent.right + // // anchors.top: parent.header.bottom + // topPadding: parent.showHeader ? parent.tableRowHeight : 0 + // background.anchors.top: parent.parent.header.bottom + // //anchors.bottom: parent.bottom + // policy: ScrollBar.AlwaysOn // ScrollBar.AsNeeded + // width: 6 + // } EaComponents.TableView { id: nestedTableView clip: true antialiasing: true - anchors.fill: parent - anchors.margins: 1 + anchors { + fill: parent + margins: 1 + // rightMargin: 1 // scrollBar.width + } + + ScrollBar.vertical: EaElements.ScrollBar { + id: scrollBar + // anchors.right: parent.right + // anchors.top: parent.header.bottom + topInset: parent.showHeader ? parent.tableRowHeight : 0 + background.anchors.top: parent.parent.header.bottom + //anchors.bottom: parent.bottom + policy: ScrollBar.AsNeeded // ScrollBar.AsNeeded + width: 6 + } + // fixes an issue of clicks not registering right after scroll + // does not give too much delay due to selection animation playing anyway + // somehow value doesn't affect anything, just fixes the missing clicks issue + // even 10000 delay doesn't create a long delay, just fixes the issue + pressDelay: 10 } + } diff --git a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml index c1d30f4a..1ea668ee 100644 --- a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml +++ b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml @@ -7,10 +7,10 @@ Rectangle { id: control default property alias contentRowData: contentRow.data - property alias mouseArea: mouseArea + //property alias mouseArea: mouseArea property Item tableView: parent === null ? null : parent.parent - implicitWidth: parent == null ? 0 : parent.width + implicitWidth: ListView.view.parent.width implicitHeight: tableView === null ? EaStyle.Sizes.tableRowHeight : tableView.tableRowHeight color: { @@ -42,11 +42,18 @@ Rectangle { propagateComposedEvents: true cursorShape: undefined //Qt.PointingHandCursor hoverEnabled: false - onPressed: (mouse) => { + onReleased: (mouse) => { control.ListView.view.parent.selectWithModifiers(index, mouse.modifiers) } } + // TapHandler { + // acceptedButtons: Qt.LeftButton // | Qt.RightButton // match whatever you need + // onTapped: (eventPoint, button) => { + // control.ListView.view.parent.selectWithModifiers(index, eventPoint.modifiers) + // } + // } + // HoverHandler to react on hover events HoverHandler { id: mouseHoverHandler diff --git a/src/EasyApp/Gui/Components/TableView.qml b/src/EasyApp/Gui/Components/TableView.qml index bd02319f..4472dbb9 100644 --- a/src/EasyApp/Gui/Components/TableView.qml +++ b/src/EasyApp/Gui/Components/TableView.qml @@ -57,7 +57,7 @@ ListView { Rectangle { anchors.fill: listView color: "transparent" - //antialiasing: true + antialiasing: true border.color: EaStyle.Colors.appBarComboBoxBorder Behavior on border.color { EaAnimations.ThemeChange {} } } From fb10fa268c7bb06196ed2d7533f9d55d1e8e293a Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Tue, 24 Mar 2026 13:41:22 +0100 Subject: [PATCH 06/12] updating scrollbar in the tableview --- src/EasyApp/Gui/Components/NewTableView.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/EasyApp/Gui/Components/NewTableView.qml b/src/EasyApp/Gui/Components/NewTableView.qml index 8fbc8a69..86dd0cb7 100644 --- a/src/EasyApp/Gui/Components/NewTableView.qml +++ b/src/EasyApp/Gui/Components/NewTableView.qml @@ -131,7 +131,7 @@ Item { antialiasing: true anchors { fill: parent - margins: 1 + // margins: 1 // rightMargin: 1 // scrollBar.width } @@ -139,10 +139,12 @@ Item { id: scrollBar // anchors.right: parent.right // anchors.top: parent.header.bottom + anchors.topMargin: 1 topInset: parent.showHeader ? parent.tableRowHeight : 0 - background.anchors.top: parent.parent.header.bottom - //anchors.bottom: parent.bottom - policy: ScrollBar.AsNeeded // ScrollBar.AsNeeded + topPadding: parent.showHeader ? parent.tableRowHeight + 1 : 0 + //background.anchors.top: parent.parent.header.bottom + anchors.bottom: parent.bottom + policy: ScrollBar.AlwaysOn // ScrollBar.AsNeeded // AlwaysOn width: 6 } From fd20025d721b4e989a0f90345ffa98806be1e5e0 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Tue, 24 Mar 2026 14:36:17 +0100 Subject: [PATCH 07/12] removed the color safeguards in the tableview --- src/EasyApp/Gui/Components/NewTableViewDelegate.qml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml index 1ea668ee..97acc8be 100644 --- a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml +++ b/src/EasyApp/Gui/Components/NewTableViewDelegate.qml @@ -17,14 +17,11 @@ Rectangle { ListView.view.parent.selectionRevision let selected = ListView.view.parent.isSelected(index) - // quickfix until new color accent PR is accepted - let c1 = EaStyle.Colors.themeAccentMinor || "#4d9dbd" // "#8ad6ed" for light or "#4d9dbd" for dark - let c2 = EaStyle.Colors.themeBackgroundHovered2 || "#eeeeee" - let c3 = EaStyle.Colors.themeBackgroundHovered1 || "#dddddd" + let c1 = EaStyle.Colors.themeAccentMinor + let c2 = EaStyle.Colors.themeBackgroundHovered2 + let c3 = EaStyle.Colors.themeBackgroundHovered1 - return selected - ? c1 - : (index % 2 ? c2 : c3) + return selected ? c1 : (index % 2 ? c2 : c3) } Behavior on color { EaAnimations.ThemeChange {} } From 3fcb201d663ca3d9d39546d5f3da98b1ebc97fcf Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Tue, 24 Mar 2026 14:37:13 +0100 Subject: [PATCH 08/12] removed antialiasing in tableview as there is another pr for that --- src/EasyApp/Gui/Components/TableView.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EasyApp/Gui/Components/TableView.qml b/src/EasyApp/Gui/Components/TableView.qml index 4472dbb9..c3d538ec 100644 --- a/src/EasyApp/Gui/Components/TableView.qml +++ b/src/EasyApp/Gui/Components/TableView.qml @@ -57,7 +57,6 @@ ListView { Rectangle { anchors.fill: listView color: "transparent" - antialiasing: true border.color: EaStyle.Colors.appBarComboBoxBorder Behavior on border.color { EaAnimations.ThemeChange {} } } From e15579d6867ca7fe7dcce1c693fa8570544c9cd6 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Fri, 27 Mar 2026 11:26:47 +0100 Subject: [PATCH 09/12] make scrollbar and scroll indicator optional in ListView via verticalScrollBar/verticalScrollIndicator properties Co-Authored-By: Claude Sonnet 4.6 --- .../{NewTableView.qml => ListView.qml} | 60 ++++++------------- ...eViewDelegate.qml => ListViewDelegate.qml} | 0 src/EasyApp/Gui/Components/qmldir | 4 +- 3 files changed, 21 insertions(+), 43 deletions(-) rename src/EasyApp/Gui/Components/{NewTableView.qml => ListView.qml} (61%) rename src/EasyApp/Gui/Components/{NewTableViewDelegate.qml => ListViewDelegate.qml} (100%) diff --git a/src/EasyApp/Gui/Components/NewTableView.qml b/src/EasyApp/Gui/Components/ListView.qml similarity index 61% rename from src/EasyApp/Gui/Components/NewTableView.qml rename to src/EasyApp/Gui/Components/ListView.qml index 86dd0cb7..5ec8d709 100644 --- a/src/EasyApp/Gui/Components/NewTableView.qml +++ b/src/EasyApp/Gui/Components/ListView.qml @@ -8,23 +8,26 @@ import EasyApp.Gui.Elements as EaElements import EasyApp.Gui.Components as EaComponents Item { - id: newTableView + id: listView height: count === 0 ? 2 * EaStyle.Sizes.tableRowHeight : showHeader ? - nestedTableView.tableRowHeight * (Math.min(count, maxRowCountShow) + 1 ) : - nestedTableView.tableRowHeight * (Math.min(count, maxRowCountShow)) + nestedListView.tableRowHeight * (Math.min(count, maxRowCountShow) + 1 ) : + nestedListView.tableRowHeight * (Math.min(count, maxRowCountShow)) width: EaStyle.Sizes.sideBarContentWidth // exposing underlying tableview API - property alias count: nestedTableView.count - property alias showHeader: nestedTableView.showHeader - property alias tallRows: nestedTableView.tallRows - property alias maxRowCountShow: nestedTableView.maxRowCountShow - property alias defaultInfoText: nestedTableView.defaultInfoText - property alias header: nestedTableView.header - property alias model: nestedTableView.model - property alias delegate: nestedTableView.delegate + property alias count: nestedListView.count + property alias showHeader: nestedListView.showHeader + property alias tallRows: nestedListView.tallRows + property alias maxRowCountShow: nestedListView.maxRowCountShow + property alias defaultInfoText: nestedListView.defaultInfoText + property alias header: nestedListView.header + property alias model: nestedListView.model + property alias delegate: nestedListView.delegate + + property ScrollBar verticalScrollBar: null + property ScrollIndicator verticalScrollIndicator: null // trigger for bindings property int selectionRevision: 0 @@ -33,14 +36,14 @@ Item { ItemSelectionModel { id: selectionModel - model: nestedTableView.model + model: nestedListView.model } Connections { target: selectionModel function onSelectionChanged() { - newTableView.selectionRevision++ + listView.selectionRevision++ } } @@ -110,23 +113,8 @@ Item { selectionModel.clearSelection() } - // ScrollView{ - // width: nestedTableView.width - // height: nestedTableView.height - - // ScrollBar.vertical: EaElements.ScrollBar { - // id: scrollBar - // anchors.right: parent.right - // // anchors.top: parent.header.bottom - // topPadding: parent.showHeader ? parent.tableRowHeight : 0 - // background.anchors.top: parent.parent.header.bottom - // //anchors.bottom: parent.bottom - // policy: ScrollBar.AlwaysOn // ScrollBar.AsNeeded - // width: 6 - // } - EaComponents.TableView { - id: nestedTableView + id: nestedListView clip: true antialiasing: true anchors { @@ -135,18 +123,8 @@ Item { // rightMargin: 1 // scrollBar.width } - ScrollBar.vertical: EaElements.ScrollBar { - id: scrollBar - // anchors.right: parent.right - // anchors.top: parent.header.bottom - anchors.topMargin: 1 - topInset: parent.showHeader ? parent.tableRowHeight : 0 - topPadding: parent.showHeader ? parent.tableRowHeight + 1 : 0 - //background.anchors.top: parent.parent.header.bottom - anchors.bottom: parent.bottom - policy: ScrollBar.AlwaysOn // ScrollBar.AsNeeded // AlwaysOn - width: 6 - } + ScrollBar.vertical: listView.verticalScrollBar + ScrollIndicator.vertical: listView.verticalScrollIndicator // fixes an issue of clicks not registering right after scroll // does not give too much delay due to selection animation playing anyway diff --git a/src/EasyApp/Gui/Components/NewTableViewDelegate.qml b/src/EasyApp/Gui/Components/ListViewDelegate.qml similarity index 100% rename from src/EasyApp/Gui/Components/NewTableViewDelegate.qml rename to src/EasyApp/Gui/Components/ListViewDelegate.qml diff --git a/src/EasyApp/Gui/Components/qmldir b/src/EasyApp/Gui/Components/qmldir index 7437af08..d72f5978 100644 --- a/src/EasyApp/Gui/Components/qmldir +++ b/src/EasyApp/Gui/Components/qmldir @@ -21,8 +21,8 @@ SideBarColumn 1.0 SideBarColumn.qml PreferencesDialog 1.0 PreferencesDialog.qml ProjectDescriptionDialog 1.0 ProjectDescriptionDialog.qml -NewTableView 1.0 NewTableView.qml -NewTableViewDelegate 1.0 NewTableViewDelegate.qml +ListView 1.0 ListView.qml +ListViewDelegate 1.0 ListViewDelegate.qml TableView 1.0 TableView.qml TableViewHeader 1.0 TableViewHeader.qml TableViewDelegate 1.0 TableViewDelegate.qml From 6877173fd6c3763a2aa7aed6d4980181bc2ad9fb Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Fri, 27 Mar 2026 11:35:03 +0100 Subject: [PATCH 10/12] Added a flag to enable/disable multiselection --- src/EasyApp/Gui/Components/ListView.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EasyApp/Gui/Components/ListView.qml b/src/EasyApp/Gui/Components/ListView.qml index 5ec8d709..d36b2bd6 100644 --- a/src/EasyApp/Gui/Components/ListView.qml +++ b/src/EasyApp/Gui/Components/ListView.qml @@ -28,6 +28,7 @@ Item { property ScrollBar verticalScrollBar: null property ScrollIndicator verticalScrollIndicator: null + property bool multiSelection: false // trigger for bindings property int selectionRevision: 0 @@ -65,7 +66,7 @@ Item { if (!idx) return // --- SHIFT: range selection --- - if (modifiers & Qt.ShiftModifier) { + if (listView.multiSelection && modifiers & Qt.ShiftModifier) { if (anchorRow < 0) { anchorRow = row } @@ -92,7 +93,7 @@ Item { } // --- CTRL: toggle --- - if (modifiers & Qt.ControlModifier) { + if (listView.multiSelection && modifiers & Qt.ControlModifier) { selectionModel.select( idx, ItemSelectionModel.Toggle | ItemSelectionModel.Rows From aca84182dbe4697fb3a64bfceee48e38326f42e8 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Fri, 27 Mar 2026 11:44:48 +0100 Subject: [PATCH 11/12] Added a 0.5 row length to listview Height to visually indicate that there are more items available even in abscence of scrollbar/scrollindicator --- src/EasyApp/Gui/Components/ListView.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EasyApp/Gui/Components/ListView.qml b/src/EasyApp/Gui/Components/ListView.qml index d36b2bd6..01dd29d8 100644 --- a/src/EasyApp/Gui/Components/ListView.qml +++ b/src/EasyApp/Gui/Components/ListView.qml @@ -12,8 +12,8 @@ Item { height: count === 0 ? 2 * EaStyle.Sizes.tableRowHeight : showHeader ? - nestedListView.tableRowHeight * (Math.min(count, maxRowCountShow) + 1 ) : - nestedListView.tableRowHeight * (Math.min(count, maxRowCountShow)) + nestedListView.tableRowHeight * (Math.min(count, maxRowCountShow + 0.5) + 1 ) : + nestedListView.tableRowHeight * (Math.min(count, maxRowCountShow + 0.5)) width: EaStyle.Sizes.sideBarContentWidth // exposing underlying tableview API @@ -28,7 +28,7 @@ Item { property ScrollBar verticalScrollBar: null property ScrollIndicator verticalScrollIndicator: null - property bool multiSelection: false + property bool multiSelection: true // trigger for bindings property int selectionRevision: 0 From a24d708b198efbad22eba717a31085ffd4ad7de0 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Fri, 27 Mar 2026 12:05:50 +0100 Subject: [PATCH 12/12] Cleaned the interface of the delegate to use listView property --- src/EasyApp/Gui/Components/ListView.qml | 2 ++ .../Gui/Components/ListViewDelegate.qml | 22 ++++++------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/EasyApp/Gui/Components/ListView.qml b/src/EasyApp/Gui/Components/ListView.qml index 01dd29d8..43127b05 100644 --- a/src/EasyApp/Gui/Components/ListView.qml +++ b/src/EasyApp/Gui/Components/ListView.qml @@ -18,6 +18,8 @@ Item { // exposing underlying tableview API property alias count: nestedListView.count + property alias currentIndex: nestedListView.currentIndex + property alias tableRowHeight: nestedListView.tableRowHeight property alias showHeader: nestedListView.showHeader property alias tallRows: nestedListView.tallRows property alias maxRowCountShow: nestedListView.maxRowCountShow diff --git a/src/EasyApp/Gui/Components/ListViewDelegate.qml b/src/EasyApp/Gui/Components/ListViewDelegate.qml index 97acc8be..ad778c1b 100644 --- a/src/EasyApp/Gui/Components/ListViewDelegate.qml +++ b/src/EasyApp/Gui/Components/ListViewDelegate.qml @@ -7,16 +7,15 @@ Rectangle { id: control default property alias contentRowData: contentRow.data - //property alias mouseArea: mouseArea - property Item tableView: parent === null ? null : parent.parent + property Item listView: ListView.view.parent - implicitWidth: ListView.view.parent.width - implicitHeight: tableView === null ? EaStyle.Sizes.tableRowHeight : tableView.tableRowHeight + implicitWidth: listView.width + implicitHeight: listView.tableRowHeight color: { - ListView.view.parent.selectionRevision + listView.selectionRevision - let selected = ListView.view.parent.isSelected(index) + let selected = listView.isSelected(index) let c1 = EaStyle.Colors.themeAccentMinor let c2 = EaStyle.Colors.themeBackgroundHovered2 let c3 = EaStyle.Colors.themeBackgroundHovered1 @@ -40,17 +39,10 @@ Rectangle { cursorShape: undefined //Qt.PointingHandCursor hoverEnabled: false onReleased: (mouse) => { - control.ListView.view.parent.selectWithModifiers(index, mouse.modifiers) + listView.selectWithModifiers(index, mouse.modifiers) } } - // TapHandler { - // acceptedButtons: Qt.LeftButton // | Qt.RightButton // match whatever you need - // onTapped: (eventPoint, button) => { - // control.ListView.view.parent.selectWithModifiers(index, eventPoint.modifiers) - // } - // } - // HoverHandler to react on hover events HoverHandler { id: mouseHoverHandler @@ -60,7 +52,7 @@ Rectangle { onHoveredChanged: { if (hovered) { //console.error(`${control} [TableViewDelegate.qml] hovered`) - parent.ListView.view.currentIndex = index + listView.currentIndex = index } } }