QmlDesigner: Transform keyframes to integer positions

Task-number: QDS-339
Change-Id: Iabfba5ef2ea78d86054de174a30c4ef8965dee34
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Knud Dollereder
2018-11-26 15:29:43 +01:00
committed by Thomas Hartmann
parent 3e9d7d290c
commit c4a3b770c7

View File

@@ -34,6 +34,7 @@
#include <utils/qtcassert.h>
#include <cmath>
#include <limits>
namespace QmlDesigner {
@@ -282,7 +283,7 @@ void QmlTimelineKeyframeGroup::moveAllKeyframes(qreal offset)
for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) {
auto property = childNode.variantProperty("frame");
if (property.isValid())
property.setValue(property.value().toReal() + offset);
property.setValue(std::round(property.value().toReal() + offset));
}
}
@@ -292,7 +293,7 @@ void QmlTimelineKeyframeGroup::scaleAllKeyframes(qreal factor)
auto property = childNode.variantProperty("frame");
if (property.isValid())
property.setValue(property.value().toReal() * factor);
property.setValue(std::round(property.value().toReal() * factor));
}
}