diff options
author | Knud Dollereder <knud.dollereder@qt.io> | 2020-06-03 15:22:54 +0200 |
---|---|---|
committer | Knud Dollereder <knud.dollereder@qt.io> | 2020-06-15 09:35:38 +0000 |
commit | db3b60d780ce2d5181837dbcb4ac4626fb23feea (patch) | |
tree | f6123090b81901eef5c354de553c0b5fcf058df9 /src/plugins/qmldesigner/components/timelineeditor | |
parent | 8b8ecfa28f85236e67417934bc6e9820e9011842 (diff) |
Improve usability of the timeline
Keep focus in the lower graphicsview when dragging the playhead
Update the timeline and curve editor when a keyframe value has changed
Select the keyframe when right clicking on an unselected one
Task-number: QDS-1417
Task-number: QDS-2129
Task-number: QDS-670
Task-number: QDS-919
Change-Id: Ic37816c03447b7a7deedce360795fa25805df315
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/components/timelineeditor')
5 files changed, 20 insertions, 6 deletions
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp index 6c25256249..326fa7d44b 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp @@ -71,10 +71,10 @@ namespace QmlDesigner { static int deleteKey() { - if (Utils::HostOsInfo::isMacHost()) - return Qt::Key_Backspace; + if (Utils::HostOsInfo::isMacHost()) + return Qt::Key_Backspace; - return Qt::Key_Delete; + return Qt::Key_Delete; } QList<QmlTimelineKeyframeGroup> allTimelineFrames(const QmlTimeline &timeline) @@ -580,6 +580,7 @@ void TimelineGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) /* The tool has handle the event last. */ QGraphicsScene::mouseReleaseEvent(event); m_tools.mouseReleaseEvent(topItem, event); + m_parent->setFocus(); } void TimelineGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) @@ -733,7 +734,6 @@ void TimelineGraphicsScene::deleteKeyframeGroup(const ModelNode &group) ModelNode nonConst = group; nonConst.destroy(); }); - } void TimelineGraphicsScene::deleteKeyframes(const QList<ModelNode> &frames) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.cpp index d84a461999..cbf1177912 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinetooldelegate.cpp @@ -59,13 +59,20 @@ void TimelineToolDelegate::mousePressEvent(TimelineMovableAbstractItem *item, QGraphicsSceneMouseEvent *event) { if (event->buttons() == Qt::LeftButton && hitCanvas(event)) { - m_start = event->scenePos(); + m_start = event->scenePos(); if (item) { setItem(item, event->modifiers()); m_currentTool = m_moveTool.get(); } else m_currentTool = m_selectTool.get(); + + } else if (event->buttons() == Qt::RightButton && event->modifiers() == Qt::NoModifier + && hitCanvas(event) && item) { + + setItem(item, Qt::NoModifier); + reset(); + } else m_currentTool = nullptr; diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp index 1ba0d60342..a1de7bca1a 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelineview.cpp @@ -181,6 +181,7 @@ void TimelineView::instancePropertyChanged(const QList<QPair<ModelNode, Property } else if (pair.second == "currentFrame") { if (QmlTimeline::isValidQmlTimeline(pair.first)) { m_timelineWidget->invalidateTimelinePosition(pair.first); + updateAnimationCurveEditor(); } } else if (!updated && timeline.hasTimeline(pair.first, pair.second)) { m_timelineWidget->graphicsScene()->invalidateCurrentValues(); @@ -198,7 +199,7 @@ void TimelineView::variantPropertiesChanged(const QList<VariantProperty> &proper AbstractView::PropertyChangeFlags /*propertyChange*/) { for (const auto &property : propertyList) { - if (property.name() == "frame" + if ((property.name() == "frame" || property.name() == "value") && property.parentModelNode().type() == "QtQuick.Timeline.Keyframe" && property.parentModelNode().isValid() && property.parentModelNode().hasParentProperty()) { diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp index ed727dc4cc..2360f01b7a 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp @@ -591,6 +591,11 @@ void TimelineWidget::setTimelineActive(bool b) } } +void TimelineWidget::setFocus() +{ + m_graphicsView->setFocus(); +} + void TimelineWidget::showEvent(QShowEvent *event) { Q_UNUSED(event) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h index 4d0e4711cb..23cd338d61 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h @@ -70,6 +70,7 @@ public: void setTimelineId(const QString &id); void setTimelineActive(bool b); + void setFocus(); public slots: void selectionChanged(); |