diff --git a/gui/ChatPane.qml b/gui/ChatPane.qml index 8e25e19..1afd68c 100644 --- a/gui/ChatPane.qml +++ b/gui/ChatPane.qml @@ -179,7 +179,6 @@ Item { contentWidth: width contentHeight: paneColumn.implicitHeight boundsBehavior: Flickable.StopAtBounds - interactive: false // scroll via wheel MouseArea; enables text selection property bool _settingY: false @@ -187,6 +186,17 @@ Item { if (_settingY) return let bottom = contentHeight - height parent.atBottom = (bottom <= 0 || contentY >= bottom - 4) + + // Lazy-load earlier blocks when near top + if (contentY < 80 && contentY >= 0 && !_settingY) { + let oldHeight = contentHeight + if (paneModel.loadEarlier()) { + // Preserve scroll position + _settingY = true + contentY += (contentHeight - oldHeight) + _settingY = false + } + } } onContentHeightChanged: { @@ -197,6 +207,10 @@ Item { } } + ScrollBar.vertical: ScrollBar { + policy: ScrollBar.AsNeeded + } + MouseArea { anchors.fill: parent acceptedButtons: Qt.NoButton @@ -214,7 +228,7 @@ Item { Column { id: paneColumn - width: paneFlick.width + width: paneFlick.width - 12 // leave room for scrollbar spacing: 8 Label { diff --git a/gui/main-kf5.qml b/gui/main-kf5.qml index d7aa7e9..e7731f7 100644 --- a/gui/main-kf5.qml +++ b/gui/main-kf5.qml @@ -978,7 +978,6 @@ ApplicationWindow { contentWidth: width contentHeight: paneColumn.implicitHeight boundsBehavior: Flickable.StopAtBounds - interactive: false // scroll via wheel; text not selectable in Qt5 Text property bool _settingY: false @@ -986,6 +985,16 @@ ApplicationWindow { if (_settingY) return var bottom = contentHeight - height parent.atBottom = (bottom <= 0 || contentY >= bottom - 4) + + // Lazy-load earlier blocks when near top + if (contentY < 80 && contentY >= 0 && !_settingY) { + var oldHeight = contentHeight + if (paneRoot.paneModel.loadEarlier()) { + _settingY = true + contentY += (contentHeight - oldHeight) + _settingY = false + } + } } onContentHeightChanged: { @@ -996,6 +1005,10 @@ ApplicationWindow { } } + ScrollBar.vertical: ScrollBar { + policy: ScrollBar.AsNeeded + } + MouseArea { anchors.fill: parent acceptedButtons: Qt.NoButton @@ -1012,7 +1025,7 @@ ApplicationWindow { Column { id: paneColumn - width: paneFlick.width + width: paneFlick.width - 12 // leave room for scrollbar spacing: 8 Label {