From 2429f28b7f782842e8df38b6c5c607f04836ca5f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 25 Jan 2022 18:31:43 +0100 Subject: [PATCH] Limit column widths to not exceed the total width of the table A bit clunky, but very effective! This way we don't have to deal with clipping or scrolling horizontally. Contributes to issue CURA-8686. --- plugins/DigitalLibrary/resources/qml/Table.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/DigitalLibrary/resources/qml/Table.qml b/plugins/DigitalLibrary/resources/qml/Table.qml index 5ace6a823a..ea379b0885 100644 --- a/plugins/DigitalLibrary/resources/qml/Table.qml +++ b/plugins/DigitalLibrary/resources/qml/Table.qml @@ -80,6 +80,15 @@ Item if(drag.active) { parent.parent.width = Math.max(10, parent.parent.width + mouseX); //Don't go smaller than 10 pixels, to make sure you can still scale it back. + let sum_widths = 0; + for(let i = 0; i < headerBar.children.length; ++i) + { + sum_widths += headerBar.children[i].width; + } + if(sum_widths > tableScrollView.width) + { + parent.parent.width -= sum_widths - tableScrollView.width; //Limit the total width to not exceed the view. + } } tableView.forceLayout(); }