forked from qt-creator/qt-creator
Enable step functions in the curve-editor
... and shut-up an annoying qDebug log in the transition-editor. Change-Id: Iea8b48e48bb7e52cd4c845f28c49f8a513785fab Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -100,7 +100,9 @@ QToolBar *CurveEditor::createToolBar(CurveEditorModel *model)
|
|||||||
auto setLinearInterpolation = [this]() {
|
auto setLinearInterpolation = [this]() {
|
||||||
m_view->setInterpolation(Keyframe::Interpolation::Linear);
|
m_view->setInterpolation(Keyframe::Interpolation::Linear);
|
||||||
};
|
};
|
||||||
auto setStepInterpolation = [this]() { m_view->setInterpolation(Keyframe::Interpolation::Step); };
|
auto setStepInterpolation = [this]() {
|
||||||
|
m_view->setInterpolation(Keyframe::Interpolation::Step);
|
||||||
|
};
|
||||||
auto setSplineInterpolation = [this]() {
|
auto setSplineInterpolation = [this]() {
|
||||||
m_view->setInterpolation(Keyframe::Interpolation::Bezier);
|
m_view->setInterpolation(Keyframe::Interpolation::Bezier);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -338,7 +338,8 @@ void CurveEditorView::commitKeyframes(TreeItem *item)
|
|||||||
group.setValue(QVariant(pos.y()), pos.x());
|
group.setValue(QVariant(pos.y()), pos.x());
|
||||||
|
|
||||||
if (previous.isValid()) {
|
if (previous.isValid()) {
|
||||||
if (frame.interpolation() == Keyframe::Interpolation::Bezier) {
|
if (frame.interpolation() == Keyframe::Interpolation::Bezier ||
|
||||||
|
frame.interpolation() == Keyframe::Interpolation::Step ) {
|
||||||
CurveSegment segment(previous, frame);
|
CurveSegment segment(previous, frame);
|
||||||
if (segment.isValid())
|
if (segment.isValid())
|
||||||
attachEasingCurve(group, pos.x(), segment.easingCurve());
|
attachEasingCurve(group, pos.x(), segment.easingCurve());
|
||||||
@@ -346,8 +347,6 @@ void CurveEditorView::commitKeyframes(TreeItem *item)
|
|||||||
QVariant data = frame.data();
|
QVariant data = frame.data();
|
||||||
if (data.type() == static_cast<int>(QMetaType::QEasingCurve))
|
if (data.type() == static_cast<int>(QMetaType::QEasingCurve))
|
||||||
attachEasingCurve(group, pos.x(), data.value<QEasingCurve>());
|
attachEasingCurve(group, pos.x(), data.value<QEasingCurve>());
|
||||||
} else if (frame.interpolation() == Keyframe::Interpolation::Step) {
|
|
||||||
// Warning: Keyframe::Interpolation::Step not yet implemented
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -294,6 +294,13 @@ void CurveSegment::extend(QPainterPath &path) const
|
|||||||
|
|
||||||
QEasingCurve CurveSegment::easingCurve() const
|
QEasingCurve CurveSegment::easingCurve() const
|
||||||
{
|
{
|
||||||
|
if (interpolation() == Keyframe::Interpolation::Step) {
|
||||||
|
QEasingCurve curve;
|
||||||
|
curve.addCubicBezierSegment(QPointF(0.1, 0.0), QPointF(0.9, 0.0), QPointF(1.0, 0.0));
|
||||||
|
curve.addCubicBezierSegment(QPointF(1.0, 0.1), QPointF(1.0, 0.9), QPointF(1.0, 1.0));
|
||||||
|
return curve;
|
||||||
|
}
|
||||||
|
|
||||||
auto mapPosition = [this](const QPointF &position) {
|
auto mapPosition = [this](const QPointF &position) {
|
||||||
QPointF min = m_left.position();
|
QPointF min = m_left.position();
|
||||||
QPointF max = m_right.position();
|
QPointF max = m_right.position();
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void TransitionEditorView::nodeReparented(const ModelNode &node,
|
|||||||
|
|
||||||
const ModelNode parent = newPropertyParent.parentModelNode();
|
const ModelNode parent = newPropertyParent.parentModelNode();
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << parent;
|
// qDebug() << Q_FUNC_INFO << parent;
|
||||||
if (parent.isValid() && parent.metaInfo().isValid()
|
if (parent.isValid() && parent.metaInfo().isValid()
|
||||||
&& parent.metaInfo().isSubclassOf("QtQuick.Transition")) {
|
&& parent.metaInfo().isSubclassOf("QtQuick.Transition")) {
|
||||||
asyncUpdate(parent);
|
asyncUpdate(parent);
|
||||||
|
|||||||
Reference in New Issue
Block a user