From 0fd2199112be88a17125ea5630ce6184eb0758ca Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 9 Oct 2019 19:34:57 +0200 Subject: [PATCH] Load content if no scrollbar is needed --- resources/qml/TimelineView.qml | 10 ++++++++++ src/timeline2/TimelineViewManager.cpp | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index a758db9a..ef1db0f0 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -44,6 +44,10 @@ Rectangle { } else { positionViewAtIndex(model.currentIndex, ListView.End) } + + if (contentHeight < height) { + model.fetchHistory(); + } } } @@ -63,8 +67,14 @@ Rectangle { currentIndex = newIndex model.currentIndex = newIndex } + + if (contentHeight < height) { + model.fetchHistory(); + } } + onAtYBeginningChanged: if (atYBeginning) model.fetchHistory() + function updatePosition() { for (var y = chat.contentY + chat.height; y > chat.height; y -= 5) { var i = chat.itemAt(100, y); diff --git a/src/timeline2/TimelineViewManager.cpp b/src/timeline2/TimelineViewManager.cpp index 29c52ac9..13025864 100644 --- a/src/timeline2/TimelineViewManager.cpp +++ b/src/timeline2/TimelineViewManager.cpp @@ -53,7 +53,6 @@ TimelineViewManager::setHistoryView(const QString &room_id) auto room = models.find(room_id); if (room != models.end()) { timeline_ = room.value().data(); - timeline_->fetchHistory(); emit activeTimelineChanged(timeline_); nhlog::ui()->info("Activated room {}", room_id.toStdString()); }