From 386b578e47146f848da390063a70f50442787635 Mon Sep 17 00:00:00 2001
From: Andreas Hatziiliou <andreas.hatziiliou@savoirfairelinux.com>
Date: Fri, 4 Oct 2024 13:18:01 -0400
Subject: [PATCH] UX: fix behavior with lists scrolling offscreen

Fixes behavior introduced in Qt where flickables (list) can scroll
infinitely off screen. Temporary fix to have more polished feel to
the app. Functionality to have a soft overscroll is supposedly fixed
in Qt 6.7 onward.

Change-Id: I031c590e1a351a0fe0d0ea1ea9ed17c24c5c572b
---
 src/app/commoncomponents/JamiFlickable.qml                  | 3 +++
 src/app/commoncomponents/JamiListView.qml                   | 3 +++
 src/app/mainview/components/MessageBarTextArea.qml          | 5 +++--
 src/app/mainview/components/MessagesResearchView.qml        | 4 ++++
 src/app/settingsview/SettingsSidePanel.qml                  | 6 ++++++
 .../settingsview/components/ConnectionMonitoringTable.qml   | 6 ++++++
 6 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/app/commoncomponents/JamiFlickable.qml b/src/app/commoncomponents/JamiFlickable.qml
index 8ca8a1f0..8dd40129 100644
--- a/src/app/commoncomponents/JamiFlickable.qml
+++ b/src/app/commoncomponents/JamiFlickable.qml
@@ -40,6 +40,9 @@ Flickable {
         orientation: Qt.Horizontal
     }
 
+    // HACK: remove after migration to Qt 6.7+
+    boundsBehavior: Flickable.StopAtBounds
+
     Keys.onLeftPressed: horizontalScrollBar.decrease()
     Keys.onRightPressed: horizontalScrollBar.increase()
     Keys.onUpPressed: verticalScrollBar.decrease()
diff --git a/src/app/commoncomponents/JamiListView.qml b/src/app/commoncomponents/JamiListView.qml
index 22b3b2b7..ecc7a1fe 100644
--- a/src/app/commoncomponents/JamiListView.qml
+++ b/src/app/commoncomponents/JamiListView.qml
@@ -34,6 +34,9 @@ ListView {
         attachedFlickableMoving: root.moving
     }
 
+    // HACK: remove after migration to Qt 6.7+
+    boundsBehavior: Flickable.StopAtBounds
+
     Keys.onUpPressed: verticalScrollBar.decrease()
     Keys.onDownPressed: verticalScrollBar.increase()
 }
diff --git a/src/app/mainview/components/MessageBarTextArea.qml b/src/app/mainview/components/MessageBarTextArea.qml
index 2b1c3007..5d5cf378 100644
--- a/src/app/mainview/components/MessageBarTextArea.qml
+++ b/src/app/mainview/components/MessageBarTextArea.qml
@@ -82,8 +82,9 @@ JamiFlickable {
     ScrollBar.vertical.visible: text
     ScrollBar.horizontal.visible: text
 
-    boundsMovement: Flickable.StopAtBounds
-    boundsBehavior: Flickable.DragOverBounds
+    // HACK: remove after migration to Qt 6.7+
+    boundsBehavior: Flickable.StopAtBounds
+
     interactive: true
 
     function resetEditableText() {
diff --git a/src/app/mainview/components/MessagesResearchView.qml b/src/app/mainview/components/MessagesResearchView.qml
index c8e045eb..0459c868 100644
--- a/src/app/mainview/components/MessagesResearchView.qml
+++ b/src/app/mainview/components/MessagesResearchView.qml
@@ -30,6 +30,10 @@ ListView {
     id: root
 
     spacing: 10
+
+    // HACK: remove after migration to Qt 6.7+
+    boundsBehavior: Flickable.StopAtBounds
+
     model: SortFilterProxyModel {
         id: proxyModel
 
diff --git a/src/app/settingsview/SettingsSidePanel.qml b/src/app/settingsview/SettingsSidePanel.qml
index 4f4ee4a7..5f62f018 100644
--- a/src/app/settingsview/SettingsSidePanel.qml
+++ b/src/app/settingsview/SettingsSidePanel.qml
@@ -281,6 +281,9 @@ SidePanelBase {
             clip: true
             contentHeight: contentItem.childrenRect.height
 
+            // HACK: remove after migration to Qt 6.7+
+            boundsBehavior: Flickable.StopAtBounds
+
             model: getHeaders()
             delegate: ColumnLayout {
                 id: col
@@ -329,6 +332,9 @@ SidePanelBase {
                     clip: true
                     visible: isChildSelected
 
+                    // HACK: remove after migration to Qt 6.7+
+                    boundsBehavior: Flickable.StopAtBounds
+
                     model: modelData.children
                     delegate: ColumnLayout {
                         id: childCol
diff --git a/src/app/settingsview/components/ConnectionMonitoringTable.qml b/src/app/settingsview/components/ConnectionMonitoringTable.qml
index 99321770..749c3e80 100644
--- a/src/app/settingsview/components/ConnectionMonitoringTable.qml
+++ b/src/app/settingsview/components/ConnectionMonitoringTable.qml
@@ -37,6 +37,9 @@ ListView {
     spacing: 5
     cacheBuffer: 10
 
+    // HACK: remove after migration to Qt 6.7+
+    boundsBehavior: Flickable.StopAtBounds
+
     property int rota: 0
 
     header: Rectangle {
@@ -141,6 +144,9 @@ ListView {
 
             model: Count
 
+            // HACK: remove after migration to Qt 6.7+
+            boundsBehavior: Flickable.StopAtBounds
+
             delegate: RowLayout {
                 id: rowLayoutDelegate
                 height: 40
-- 
GitLab