diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-12 00:45:41 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-12 00:45:41 +0200 |
commit | 03d607e379ac9fe48315ce121ada76338ed6686d (patch) | |
tree | 756e2e8c5786f6019368245d5d41834af7d0237f /framework/qml/ConversationView.qml | |
parent | cc9a3b98d143b921388725b55e99ae9e151e525b (diff) | |
download | kube-03d607e379ac9fe48315ce121ada76338ed6686d.tar.gz kube-03d607e379ac9fe48315ce121ada76338ed6686d.zip |
Instead of emulating it we can also just layout the items in reverse
order
Diffstat (limited to 'framework/qml/ConversationView.qml')
-rw-r--r-- | framework/qml/ConversationView.qml | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index d5b64ea4..2f499752 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml | |||
@@ -17,7 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | import QtQuick 2.7 | 19 | import QtQuick 2.7 |
20 | import QtQuick.Controls 1.3 as Controls1 | ||
21 | import QtQuick.Controls 2 | 20 | import QtQuick.Controls 2 |
22 | import QtQuick.Layouts 1.1 | 21 | import QtQuick.Layouts 1.1 |
23 | import org.kube.framework 1.0 as Kube | 22 | import org.kube.framework 1.0 as Kube |
@@ -65,6 +64,8 @@ Rectangle { | |||
65 | 64 | ||
66 | anchors.fill: parent | 65 | anchors.fill: parent |
67 | 66 | ||
67 | verticalLayoutDirection: ListView.BottomToTop | ||
68 | |||
68 | function setCurrentIndex() | 69 | function setCurrentIndex() |
69 | { | 70 | { |
70 | /** | 71 | /** |
@@ -117,33 +118,6 @@ Rectangle { | |||
117 | //Optimize for view quality | 118 | //Optimize for view quality |
118 | pixelAligned: true | 119 | pixelAligned: true |
119 | 120 | ||
120 | Timer { | ||
121 | id: scrollToEndTimer | ||
122 | interval: 10 | ||
123 | running: false | ||
124 | repeat: false | ||
125 | onTriggered: { | ||
126 | //Only do this once per conversation | ||
127 | root.scrollToEnd = false; | ||
128 | root.currentIndex = listView.count - 1 | ||
129 | //positionViewAtEnd/Index don't work | ||
130 | listView.contentY = Math.max(listView.contentHeight - listView.height, 0) | ||
131 | } | ||
132 | } | ||
133 | |||
134 | onCountChanged: { | ||
135 | if (root.scrollToEnd) { | ||
136 | scrollToEndTimer.restart() | ||
137 | } | ||
138 | } | ||
139 | |||
140 | onContentHeightChanged: { | ||
141 | //Initially it will resize a lot, so we keep waiting | ||
142 | if (root.scrollToEnd) { | ||
143 | scrollToEndTimer.restart() | ||
144 | } | ||
145 | } | ||
146 | |||
147 | onContentYChanged: { | 121 | onContentYChanged: { |
148 | //We have to track our current mail manually | 122 | //We have to track our current mail manually |
149 | setCurrentIndex(); | 123 | setCurrentIndex(); |