From d9719f10374f4885a3ae3efd7e3b4f23e953e59d Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 17 Jan 2016 12:57:59 +0100 Subject: [PATCH] [Units] Return at least 1ms for durations Animators do not reliably work with a duration of 0 as can be seen in the linked bug report. Upstream bug report: QTBUG-39766 BUG: 357532 REVIEW: 126652 --- src/declarativeimports/core/units.cpp | 6 ++++-- src/declarativeimports/plasmacomponents/qml/PageStack.qml | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/declarativeimports/core/units.cpp b/src/declarativeimports/core/units.cpp index 17987274b..a16999e50 100644 --- a/src/declarativeimports/core/units.cpp +++ b/src/declarativeimports/core/units.cpp @@ -105,7 +105,9 @@ void Units::settingsFileChanged(const QString &file) void Units::updatePlasmaRCSettings() { KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig(plasmarc), groupName); - const int longDuration = cfg.readEntry("longDuration", defaultLongDuration); + // Animators with a duration of 0 do not fire reliably + // see Bug 357532 and QTBUG-39766 + const int longDuration = qMax(1, cfg.readEntry("longDuration", defaultLongDuration)); if (longDuration != m_longDuration) { m_longDuration = longDuration; @@ -257,7 +259,7 @@ int Units::longDuration() const int Units::shortDuration() const { - return m_longDuration / 5; + return qMax(1, m_longDuration / 5); } #include "moc_units.cpp" diff --git a/src/declarativeimports/plasmacomponents/qml/PageStack.qml b/src/declarativeimports/plasmacomponents/qml/PageStack.qml index cdb2a49b0..38a0b03d8 100644 --- a/src/declarativeimports/plasmacomponents/qml/PageStack.qml +++ b/src/declarativeimports/plasmacomponents/qml/PageStack.qml @@ -85,7 +85,7 @@ Item { /** * Should page transitions be animated? Default is true. */ - property bool animate: units.longDuration > 0 + property bool animate: units.longDuration > 1 /** * The page to be automatically loaded when this PageStack component gets @@ -271,7 +271,7 @@ Item { property int stackWidth: Math.max(root.width, root.height) // Duration of transition animation (in ms) - property int transitionDuration: units.longDuration / 2 + property int transitionDuration: Math.max(1, units.longDuration / 2) // Flag that indicates the container should be cleaned up after the transition has ended. property bool cleanupAfterTransition: false