diff --git a/imports/Spectral/Component/AutoListView.qml b/imports/Spectral/Component/AutoListView.qml
new file mode 100644
index 000000000..2b6bddb85
--- /dev/null
+++ b/imports/Spectral/Component/AutoListView.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.9
+
+ListView {
+ ScrollHelper {
+ anchors.fill: parent
+
+ flickable: parent
+ }
+}
diff --git a/imports/Spectral/Component/ScrollHelper.qml b/imports/Spectral/Component/ScrollHelper.qml
index a61152715..923a141e9 100644
--- a/imports/Spectral/Component/ScrollHelper.qml
+++ b/imports/Spectral/Component/ScrollHelper.qml
@@ -13,7 +13,6 @@ MouseArea {
flickable.interactive = false
flickable.maximumFlickVelocity = 100000
flickable.boundsBehavior = Flickable.StopAtBounds
- root.parent = flickable
}
function scrollByPixelDelta(flickableItem, pixelDelta) {
diff --git a/imports/Spectral/Component/qmldir b/imports/Spectral/Component/qmldir
index 90ce0ea5f..a9bbe4503 100644
--- a/imports/Spectral/Component/qmldir
+++ b/imports/Spectral/Component/qmldir
@@ -6,3 +6,4 @@ AutoImage 2.0 AutoImage.qml
AutoLabel 2.0 AutoLabel.qml
AutoTextArea 2.0 AutoTextArea.qml
ScrollHelper 2.0 ScrollHelper.qml
+AutoListView 2.0 AutoListView.qml
diff --git a/imports/Spectral/Page/SettingAccountDelegate.qml b/imports/Spectral/Page/SettingAccountDelegate.qml
index 2c0a11602..a59b1ee08 100644
--- a/imports/Spectral/Page/SettingAccountDelegate.qml
+++ b/imports/Spectral/Page/SettingAccountDelegate.qml
@@ -52,7 +52,7 @@ Column {
clip: true
- ListView {
+ AutoListView {
Layout.fillWidth: true
Layout.preferredHeight: 24
diff --git a/imports/Spectral/Page/SettingForm.ui.qml b/imports/Spectral/Page/SettingForm.ui.qml
index a5d1e12f0..235573004 100644
--- a/imports/Spectral/Page/SettingForm.ui.qml
+++ b/imports/Spectral/Page/SettingForm.ui.qml
@@ -27,7 +27,7 @@ Page {
ColumnLayout {
anchors.fill: parent
- ListView {
+ AutoListView {
Layout.fillWidth: true
Layout.fillHeight: true
diff --git a/imports/Spectral/Panel/RoomDrawer.qml b/imports/Spectral/Panel/RoomDrawer.qml
index 17d88717b..fd809403c 100644
--- a/imports/Spectral/Panel/RoomDrawer.qml
+++ b/imports/Spectral/Panel/RoomDrawer.qml
@@ -100,7 +100,7 @@ Drawer {
}
}
- ListView {
+ AutoListView {
Layout.fillWidth: true
Layout.fillHeight: true
diff --git a/imports/Spectral/Panel/RoomListPanelForm.ui.qml b/imports/Spectral/Panel/RoomListPanelForm.ui.qml
index 3b555de93..60ef9b389 100644
--- a/imports/Spectral/Panel/RoomListPanelForm.ui.qml
+++ b/imports/Spectral/Panel/RoomListPanelForm.ui.qml
@@ -94,7 +94,7 @@ Rectangle {
]
}
- ListView {
+ AutoListView {
Layout.fillWidth: true
Layout.fillHeight: true
@@ -102,7 +102,6 @@ Rectangle {
spacing: 1
clip: true
- interactive: false
model: roomListProxyModel
@@ -137,12 +136,6 @@ Rectangle {
}
RoomContextMenu { id: roomContextMenu }
-
- ScrollHelper {
- anchors.fill: parent
-
- flickable: parent
- }
}
}
}
diff --git a/imports/Spectral/Panel/RoomPanel.qml b/imports/Spectral/Panel/RoomPanel.qml
index bcb58f4dc..a33ea1e0f 100644
--- a/imports/Spectral/Panel/RoomPanel.qml
+++ b/imports/Spectral/Panel/RoomPanel.qml
@@ -21,7 +21,6 @@ RoomPanelForm {
property int largestVisibleIndex: messageListView.count > 0 ? messageListView.indexAt(messageListView.contentX, messageListView.contentY + messageListView.height - 1) : -1
onContentYChanged: {
- console.log("Content Y changed.")
if(currentRoom && messageListView.contentY - 5000 < messageListView.originY)
currentRoom.getPreviousContent(50);
}
diff --git a/imports/Spectral/Panel/RoomPanelForm.ui.qml b/imports/Spectral/Panel/RoomPanelForm.ui.qml
index 42a85067c..2256ea074 100644
--- a/imports/Spectral/Panel/RoomPanelForm.ui.qml
+++ b/imports/Spectral/Panel/RoomPanelForm.ui.qml
@@ -65,7 +65,7 @@ Item {
id: roomHeader
}
- ListView {
+ AutoListView {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: 16
@@ -77,7 +77,6 @@ Item {
displayMarginEnd: 40
verticalLayoutDirection: ListView.BottomToTop
spacing: 8
- interactive: false
boundsBehavior: Flickable.DragOverBounds
@@ -157,12 +156,6 @@ Item {
}
}
- ScrollHelper {
- anchors.fill: parent
-
- flickable: parent
- }
-
RoundButton {
width: 64
height: 64
@@ -230,7 +223,7 @@ Item {
closePolicy: Dialog.CloseOnEscape | Dialog.CloseOnPressOutside
- contentItem: ListView {
+ contentItem: AutoListView {
implicitHeight: Math.min(window.height - 64,
readMarkerListView.contentHeight)
diff --git a/qml/main.qml b/qml/main.qml
index 1d738d5aa..1251aa52d 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -101,7 +101,7 @@ ApplicationWindow {
anchors.fill: parent
spacing: 0
- ListView {
+ AutoListView {
property var currentConnection: null
Layout.fillWidth: true
diff --git a/res.qrc b/res.qrc
index f0cd07095..66b41dd5f 100644
--- a/res.qrc
+++ b/res.qrc
@@ -52,5 +52,6 @@
imports/Spectral/Component/AutoLabel.qml
imports/Spectral/Component/AutoTextArea.qml
imports/Spectral/Component/ScrollHelper.qml
+ imports/Spectral/Component/AutoListView.qml