summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/timeline/TimelineView.cpp8
-rw-r--r--src/timeline/TimelineView.h11
2 files changed, 12 insertions, 7 deletions
diff --git a/src/timeline/TimelineView.cpp b/src/timeline/TimelineView.cpp
index e6c36165..887d4d4f 100644
--- a/src/timeline/TimelineView.cpp
+++ b/src/timeline/TimelineView.cpp
@@ -634,11 +634,11 @@ TimelineView::addTimelineItem(QWidget *item, TimelineDirection direction)
                                 auto separator = new DateSeparator(newDate, this);
 
                                 if (separator)
-                                        pushTimelineItem(separator);
+                                        pushTimelineItem(separator, direction);
                         }
                 }
 
-                pushTimelineItem(item);
+                pushTimelineItem(item, direction);
         } else {
                 if (scroll_layout_->count() > 0) {
                         const auto firstItem = scroll_layout_->itemAt(0)->widget();
@@ -650,12 +650,12 @@ TimelineView::addTimelineItem(QWidget *item, TimelineDirection direction)
                                         auto separator = new DateSeparator(oldDate);
 
                                         if (separator)
-                                                scroll_layout_->insertWidget(0, separator);
+                                                pushTimelineItem(separator, direction);
                                 }
                         }
                 }
 
-                scroll_layout_->insertWidget(0, item);
+                pushTimelineItem(item, direction);
         }
 }
 
diff --git a/src/timeline/TimelineView.h b/src/timeline/TimelineView.h
index 46facd7e..c1d36cf8 100644
--- a/src/timeline/TimelineView.h
+++ b/src/timeline/TimelineView.h
@@ -194,17 +194,22 @@ private:
         void getMessages();
         //! HACK: Fixing layout flickering when adding to the bottom
         //! of the timeline.
-        void pushTimelineItem(QWidget *item)
+        void pushTimelineItem(QWidget *item, TimelineDirection dir)
         {
                 setUpdatesEnabled(false);
                 item->hide();
-                scroll_layout_->addWidget(item);
+
+                if (dir == TimelineDirection::Top)
+                        scroll_layout_->insertWidget(0, item);
+                else
+                        scroll_layout_->addWidget(item);
+
                 QTimer::singleShot(0, this, [item, this]() {
                         item->show();
                         item->adjustSize();
                         setUpdatesEnabled(true);
                 });
-        };
+        }
 
         //! Decides whether or not to show or hide the scroll down button.
         void toggleScrollDownButton();