Fix scrolling in RoomPage

This now use the ScrollablePage native scroll effect when the ScrollPage
only have one scrollview has child item.
This commit is contained in:
Carl Schwan
2020-11-22 15:09:02 +01:00
parent e778c18913
commit beafc572c4

View File

@@ -28,6 +28,7 @@ Kirigami.ScrollablePage {
title: currentRoom.name title: currentRoom.name
ListView {
MessageEventModel { MessageEventModel {
id: messageEventModel id: messageEventModel
@@ -101,8 +102,6 @@ Kirigami.ScrollablePage {
return messageEventModel.data(messageEventModel.index(row, 0), MessageEventModel.MessageRole) !== 0x10 && messageEventModel.data(messageEventModel.index(row, 0), MessageEventModel.EventTypeRole) !== "other" return messageEventModel.data(messageEventModel.index(row, 0), MessageEventModel.MessageRole) !== 0x10 && messageEventModel.data(messageEventModel.index(row, 0), MessageEventModel.EventTypeRole) !== "other"
} }
} }
ListView {
readonly property int largestVisibleIndex: count > 0 ? indexAt(contentX + (width / 2), contentY + height - 1) : -1 readonly property int largestVisibleIndex: count > 0 ? indexAt(contentX + (width / 2), contentY + height - 1) : -1
readonly property bool noNeedMoreContent: !currentRoom || currentRoom.eventsHistoryJob || currentRoom.allHistoryLoaded readonly property bool noNeedMoreContent: !currentRoom || currentRoom.eventsHistoryJob || currentRoom.allHistoryLoaded
@@ -309,10 +308,11 @@ Kirigami.ScrollablePage {
} }
} }
QQC2.Button { QQC2.RoundButton {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 16 anchors.topMargin: Kirigami.Units.largeSpacing
anchors.rightMargin: Kirigami.Units.largeSpacing
padding: 8 padding: 8
@@ -356,7 +356,6 @@ Kirigami.ScrollablePage {
positionViewAtBeginning() positionViewAtBeginning()
} }
}
DropArea { DropArea {
id: dropAreaFile id: dropAreaFile
@@ -378,6 +377,19 @@ Kirigami.ScrollablePage {
} }
} }
Component {
id: messageDelegateContextMenu
MessageDelegateContextMenu {}
}
Component {
id: messageSourceSheet
MessageSourceSheet {}
}
}
footer: ChatTextInput { footer: ChatTextInput {
id: chatTextInput id: chatTextInput
Layout.fillWidth: true Layout.fillWidth: true
@@ -432,16 +444,4 @@ Kirigami.ScrollablePage {
}) })
contextMenu.open() contextMenu.open()
} }
Component {
id: messageDelegateContextMenu
MessageDelegateContextMenu {}
}
Component {
id: messageSourceSheet
MessageSourceSheet {}
}
} }