From 3aa751d8ded30f4ea60c2df4ffeacb2f17838e3c Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 17 Jul 2026 22:22:49 +0200 Subject: [PATCH] =?UTF-8?q?gui:=20fix=20Process=20Manager=20scroll=20?= =?UTF-8?q?=E2=80=94=20use=20Flickable=20with=20contentHeight=20tracking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ScrollView + TextArea approach did not auto-scroll. Replaced with Flickable that tracks contentHeight changes and scrolls to bottom when pinned. --- gui/main-kf5.qml | 36 +++++++++++++++++++----------------- gui/main.qml | 36 +++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/gui/main-kf5.qml b/gui/main-kf5.qml index 9b324ae..aa71fd5 100644 --- a/gui/main-kf5.qml +++ b/gui/main-kf5.qml @@ -1861,35 +1861,37 @@ ApplicationWindow { font.pixelSize: Qt.application.font.pixelSize * 0.85 } - ScrollView { - id: outputScroll + Flickable { + id: outputFlick Layout.fillWidth: true Layout.fillHeight: true + clip: true + contentWidth: width + contentHeight: outputArea.implicitHeight + boundsBehavior: Flickable.StopAtBounds property bool atBottom: true + onContentYChanged: { + var bottom = contentHeight - height + atBottom = (bottom <= 0 || contentY >= bottom - 4) + } + + onContentHeightChanged: { + if (atBottom) { + contentY = Math.max(0, contentHeight - height) + } + } + TextArea { id: outputArea + width: outputFlick.width readOnly: true font.family: "monospace" font.pixelSize: Qt.application.font.pixelSize * 0.9 text: processManagerWindow.selectedOutput wrapMode: TextEdit.Wrap - - onTextChanged: { - if (outputScroll.atBottom) { - cursorPosition = length - ensureVisible(length) - } - } - - onCursorRectangleChanged: { - var flickable = outputScroll.contentItem - if (flickable) { - var bottom = flickable.contentHeight - flickable.height - outputScroll.atBottom = (bottom <= 0 || flickable.contentY >= bottom - 4) - } - } + background: null } } } diff --git a/gui/main.qml b/gui/main.qml index 3fbe2f5..e79b592 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -671,35 +671,37 @@ ApplicationWindow { font.pixelSize: Qt.application.font.pixelSize * 0.85 } - ScrollView { - id: outputScroll + Flickable { + id: outputFlick Layout.fillWidth: true Layout.fillHeight: true + clip: true + contentWidth: width + contentHeight: outputArea.implicitHeight + boundsBehavior: Flickable.StopAtBounds property bool atBottom: true + onContentYChanged: { + let bottom = contentHeight - height + atBottom = (bottom <= 0 || contentY >= bottom - 4) + } + + onContentHeightChanged: { + if (atBottom) { + contentY = Math.max(0, contentHeight - height) + } + } + TextArea { id: outputArea + width: outputFlick.width readOnly: true font.family: "monospace" font.pixelSize: Qt.application.font.pixelSize * 0.9 text: processManagerWindow.selectedOutput wrapMode: TextEdit.Wrap - - onTextChanged: { - if (outputScroll.atBottom) { - cursorPosition = length - ensureVisible(length) - } - } - - onCursorRectangleChanged: { - let flickable = outputScroll.contentItem - if (flickable) { - let bottom = flickable.contentHeight - flickable.height - outputScroll.atBottom = (bottom <= 0 || flickable.contentY >= bottom - 4) - } - } + background: null } } }