Revert "Remove ScrollHelper. Scrolling is fixed in Qt upstream."

This reverts commit 059d8da6b2
This commit is contained in:
Black Hat
2019-07-17 10:02:50 +00:00
parent 059d8da6b2
commit 9c8d77abdb
7 changed files with 130 additions and 10 deletions

View File

@@ -172,7 +172,7 @@ Drawer {
}
}
ListView {
AutoListView {
Layout.fillWidth: true
Layout.fillHeight: true
@@ -180,8 +180,6 @@ Drawer {
clip: true
pixelAligned: true
boundsBehavior: Flickable.DragOverBounds
model: UserListModel {

View File

@@ -185,7 +185,7 @@ Item {
}
}
ListView {
AutoListView {
Layout.fillWidth: true
Layout.fillHeight: true
@@ -197,8 +197,6 @@ Item {
model: sortedRoomListModel
pixelAligned: true
boundsBehavior: Flickable.DragOverBounds
ScrollBar.vertical: ScrollBar {}

View File

@@ -223,7 +223,7 @@ Item {
spacing: 16
ListView {
AutoListView {
readonly property int largestVisibleIndex: count > 0 ? indexAt(contentX + (width / 2), contentY + height - 1) : -1
readonly property bool noNeedMoreContent: !currentRoom || currentRoom.eventsHistoryJob || currentRoom.allHistoryLoaded
@@ -241,8 +241,6 @@ Item {
boundsBehavior: Flickable.DragOverBounds
pixelAligned: true
model: SortFilterProxyModel {
id: sortedMessageEventModel
@@ -256,10 +254,16 @@ Item {
onModelReset: {
movingTimer.stop()
messageListView.positionViewAtBeginning()
if (currentRoom) {
movingTimer.restart()
var lastScrollPosition = sortedMessageEventModel.mapFromSource(currentRoom.savedTopVisibleIndex())
if (lastScrollPosition === 0) {
messageListView.positionViewAtBeginning()
} else {
messageListView.currentIndex = lastScrollPosition
}
if (messageListView.contentY < messageListView.originY + 10 || currentRoom.timelineSize < 20)
currentRoom.getPreviousContent(50)
}