[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
This commit is contained in:
Kai Uwe Broulik 2016-01-17 12:57:59 +01:00
parent c4c5e9090a
commit d9719f1037
2 changed files with 6 additions and 4 deletions

View File

@ -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"

View File

@ -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