forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -591,6 +591,11 @@ void TimelineWidget::setTimelineActive(bool b)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::setFocus()
|
||||
{
|
||||
m_graphicsView->setFocus();
|
||||
}
|
||||
|
||||
void TimelineWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
void setTimelineId(const QString &id);
|
||||
|
||||
void setTimelineActive(bool b);
|
||||
void setFocus();
|
||||
|
||||
public slots:
|
||||
void selectionChanged();
|
||||
|
||||
Reference in New Issue
Block a user