[plasma/plasma-workspace] components/calendar/qml: InfiniteList: fix calendar changing views when dragging it between displays

Nate Graham <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit d610eac44f25b7208aae743043a4cdf56fec4310 by Nate Graham, on behalf of Antti Savolainen.
Committed on 17/08/2026 at 19:36.
Pushed by ngraham into branch 'master'.

InfiniteList: fix calendar changing views when dragging it between displays

When dragging the calendar between displays, the view jumps one month and
11 years. This is because during the reparenting of the widget the width
and height briefly goes to 0. The widget interprets this as the view
having reached the edge on the month, year, and decade views, resulting
in said time jump. Might be possible to fix the root cause within the
shell in the future.

Previously the code ate one event at startup to prevent it from jumping
when dragging the widget to desktop.

BUG: 472360

M  +5    -10   components/calendar/qml/InfiniteList.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/d610eac44f25b7208aae743043a4cdf56fec4310

diff --git a/components/calendar/qml/InfiniteList.qml b/components/calendar/qml/InfiniteList.qml
index df8e809b2b..0da650a1b1 100644
--- a/components/calendar/qml/InfiniteList.qml
+++ b/components/calendar/qml/InfiniteList.qml
@@ -51,7 +51,6 @@ ListView {
         DecadeView
     }
 
-    property bool changeDate: false // To control whether to animate or animate + date change after start up complete. Should always be false on start up.
     property bool dragHandled: false
 
     highlightRangeMode: ListView.StrictlyEnforceRange
@@ -96,27 +95,23 @@ ListView {
         if (handleDrag()) {
             return;
         }
-        if (changeDate) {
-            if (direction < 0) {
-                previousView();
-            } else {
-                nextView();
-            }
+        if (direction < 0) {
+            previousView();
         } else {
-            changeDate = true;
+            nextView();
         }
         resetViewPosition();
     }
 
     // These signal handlers animate the view. They are the only ones through which date (and should as well) changes.
     onAtYEndChanged: {
-        if (atYEnd) {
+        if (atYEnd && width > 0 && height > 0) {
             handleDateChange(1);
         }
     }
 
     onAtYBeginningChanged: {
-        if (atYBeginning) {
+        if (atYBeginning && width > 0 && height > 0) {
             handleDateChange(-1);
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.