Simplify chat pane scrolling

This commit is contained in:
Levi Neely 2026-08-16 13:02:46 +02:00
parent 8103d80df2
commit b28330b5d5
2 changed files with 7 additions and 97 deletions

View File

@ -13,9 +13,6 @@ Column {
required property var blockSegments required property var blockSegments
required property string blockRenderedHtml required property string blockRenderedHtml
// Reference to parent ListView for scroll control
property ListView parentListView: null
// Expand state based on block type // Expand state based on block type
property bool blockExpanded: { property bool blockExpanded: {
switch (blockType) { switch (blockType) {
@ -137,26 +134,6 @@ Column {
selectionColor: theme.highlightColor selectionColor: theme.highlightColor
selectedTextColor: theme.highlightedTextColor selectedTextColor: theme.highlightedTextColor
onActiveFocusChanged: {
if (!activeFocus && root.parentListView)
root.parentListView.interactive = true
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
propagateComposedEvents: true
cursorShape: Qt.IBeamCursor
onPressed: function(mouse) {
if (root.parentListView) root.parentListView.interactive = false
mouse.accepted = false
}
onReleased: function(mouse) {
if (root.parentListView) root.parentListView.interactive = true
mouse.accepted = false
}
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
@ -211,27 +188,7 @@ Column {
selectionColor: theme.highlightColor selectionColor: theme.highlightColor
selectedTextColor: theme.highlightedTextColor selectedTextColor: theme.highlightedTextColor
onActiveFocusChanged: {
if (!activeFocus && root.parentListView)
root.parentListView.interactive = true
}
// Left-click: disable ListView flick while selecting text // Left-click: disable ListView flick while selecting text
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
propagateComposedEvents: true
cursorShape: Qt.IBeamCursor
onPressed: function(mouse) {
if (root.parentListView) root.parentListView.interactive = false
mouse.accepted = false
}
onReleased: function(mouse) {
if (root.parentListView) root.parentListView.interactive = true
mouse.accepted = false
}
}
// Right-click: lazy context menu // Right-click: lazy context menu
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -355,18 +312,16 @@ Column {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.RightButton
propagateComposedEvents: true
cursorShape: Qt.IBeamCursor cursorShape: Qt.IBeamCursor
onPressed: function(mouse) { onClicked: {
if (root.parentListView) root.parentListView.interactive = false if (!sourceEdit._menu) {
mouse.accepted = false sourceEdit._menu = contextMenuComponent.createObject(sourceEdit)
} }
onReleased: function(mouse) { sourceEdit._menu.popup()
if (root.parentListView) root.parentListView.interactive = true
mouse.accepted = false
} }
} }
property Menu _menu: null
} }
Column { Column {

View File

@ -115,57 +115,12 @@ Item {
spacing: 4 spacing: 4
anchors.fill: parent anchors.fill: parent
anchors.margins: 4 anchors.margins: 4
boundsBehavior: Flickable.StopAtBounds
visible: ollie.daemonConnected && ollie.activeAgentId !== "" visible: ollie.daemonConnected && ollie.activeAgentId !== ""
property bool followTail: true
reuseItems: true
onCountChanged: {
if (followTail)
scrollTimer.restart()
}
onContentHeightChanged: {
if (followTail)
scrollTimer.restart()
}
onMovementEnded: followTail = atYEnd
Timer {
id: scrollTimer
interval: 16
onTriggered: {
if (chatView.followTail && chatView.contentHeight > chatView.height)
chatView.positionViewAtEnd()
}
}
delegate: ChatBlockDelegate { delegate: ChatBlockDelegate {
width: chatView.width - 8 width: chatView.width - 8
parentListView: chatView
} }
} }
// Scroll to bottom button
Button {
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 12
text: "↓"
font.pixelSize: 16
implicitWidth: 36
implicitHeight: 36
visible: chatView.visible && !chatView.followTail
onClicked: {
chatView.followTail = true
chatView.positionViewAtEnd()
}
ToolTip.text: "Scroll to bottom"
ToolTip.visible: hovered
}
} }
Rectangle { Layout.fillWidth: true; height: 1; color: theme.midColor } Rectangle { Layout.fillWidth: true; height: 1; color: theme.midColor }