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:
@@ -580,6 +580,7 @@ void TimelineGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
/* The tool has handle the event last. */
|
/* The tool has handle the event last. */
|
||||||
QGraphicsScene::mouseReleaseEvent(event);
|
QGraphicsScene::mouseReleaseEvent(event);
|
||||||
m_tools.mouseReleaseEvent(topItem, event);
|
m_tools.mouseReleaseEvent(topItem, event);
|
||||||
|
m_parent->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
void TimelineGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||||
@@ -733,7 +734,6 @@ void TimelineGraphicsScene::deleteKeyframeGroup(const ModelNode &group)
|
|||||||
ModelNode nonConst = group;
|
ModelNode nonConst = group;
|
||||||
nonConst.destroy();
|
nonConst.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineGraphicsScene::deleteKeyframes(const QList<ModelNode> &frames)
|
void TimelineGraphicsScene::deleteKeyframes(const QList<ModelNode> &frames)
|
||||||
|
|||||||
@@ -59,13 +59,20 @@ void TimelineToolDelegate::mousePressEvent(TimelineMovableAbstractItem *item,
|
|||||||
QGraphicsSceneMouseEvent *event)
|
QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->buttons() == Qt::LeftButton && hitCanvas(event)) {
|
if (event->buttons() == Qt::LeftButton && hitCanvas(event)) {
|
||||||
m_start = event->scenePos();
|
|
||||||
|
|
||||||
|
m_start = event->scenePos();
|
||||||
if (item) {
|
if (item) {
|
||||||
setItem(item, event->modifiers());
|
setItem(item, event->modifiers());
|
||||||
m_currentTool = m_moveTool.get();
|
m_currentTool = m_moveTool.get();
|
||||||
} else
|
} else
|
||||||
m_currentTool = m_selectTool.get();
|
m_currentTool = m_selectTool.get();
|
||||||
|
|
||||||
|
} else if (event->buttons() == Qt::RightButton && event->modifiers() == Qt::NoModifier
|
||||||
|
&& hitCanvas(event) && item) {
|
||||||
|
|
||||||
|
setItem(item, Qt::NoModifier);
|
||||||
|
reset();
|
||||||
|
|
||||||
} else
|
} else
|
||||||
m_currentTool = nullptr;
|
m_currentTool = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ void TimelineView::instancePropertyChanged(const QList<QPair<ModelNode, Property
|
|||||||
} else if (pair.second == "currentFrame") {
|
} else if (pair.second == "currentFrame") {
|
||||||
if (QmlTimeline::isValidQmlTimeline(pair.first)) {
|
if (QmlTimeline::isValidQmlTimeline(pair.first)) {
|
||||||
m_timelineWidget->invalidateTimelinePosition(pair.first);
|
m_timelineWidget->invalidateTimelinePosition(pair.first);
|
||||||
|
updateAnimationCurveEditor();
|
||||||
}
|
}
|
||||||
} else if (!updated && timeline.hasTimeline(pair.first, pair.second)) {
|
} else if (!updated && timeline.hasTimeline(pair.first, pair.second)) {
|
||||||
m_timelineWidget->graphicsScene()->invalidateCurrentValues();
|
m_timelineWidget->graphicsScene()->invalidateCurrentValues();
|
||||||
@@ -198,7 +199,7 @@ void TimelineView::variantPropertiesChanged(const QList<VariantProperty> &proper
|
|||||||
AbstractView::PropertyChangeFlags /*propertyChange*/)
|
AbstractView::PropertyChangeFlags /*propertyChange*/)
|
||||||
{
|
{
|
||||||
for (const auto &property : propertyList) {
|
for (const auto &property : propertyList) {
|
||||||
if (property.name() == "frame"
|
if ((property.name() == "frame" || property.name() == "value")
|
||||||
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
|
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
|
||||||
&& property.parentModelNode().isValid()
|
&& property.parentModelNode().isValid()
|
||||||
&& property.parentModelNode().hasParentProperty()) {
|
&& property.parentModelNode().hasParentProperty()) {
|
||||||
|
|||||||
@@ -591,6 +591,11 @@ void TimelineWidget::setTimelineActive(bool b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimelineWidget::setFocus()
|
||||||
|
{
|
||||||
|
m_graphicsView->setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
void TimelineWidget::showEvent(QShowEvent *event)
|
void TimelineWidget::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public:
|
|||||||
void setTimelineId(const QString &id);
|
void setTimelineId(const QString &id);
|
||||||
|
|
||||||
void setTimelineActive(bool b);
|
void setTimelineActive(bool b);
|
||||||
|
void setFocus();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
|||||||
Reference in New Issue
Block a user