gui: fix Process Manager scroll — use Flickable with contentHeight tracking

ScrollView + TextArea approach did not auto-scroll. Replaced with
Flickable that tracks contentHeight changes and scrolls to bottom
when pinned.
This commit is contained in:
Levi Neely 2026-07-17 22:22:49 +02:00
parent 6ea77c56c2
commit 3aa751d8de
2 changed files with 38 additions and 34 deletions

View File

@ -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
}
}
}

View File

@ -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
}
}
}