Commit 784454e3 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix groups keeping keyboard grab state on unselect,

add Shift modifier to move items faster with keyboard
Related to #203 #216
parent c6561575
Pipeline #4054 passed with stage
in 29 minutes
......@@ -3115,22 +3115,27 @@ bool TimelineModel::requestClearSelection(bool onDeletion)
return true;
}
if (isGroup(m_currentSelection)) {
if (m_groups->getType(m_currentSelection) == GroupType::Selection) {
// Reset offset display on clips
std::unordered_set<int> items = getCurrentSelection();
for (auto &id : items) {
if (isClip(id)) {
m_allClips[id]->clearOffset();
if (m_allClips[id]->isGrabbed()) {
m_allClips[id]->setGrab(false);
}
} else if (isComposition(id)) {
if (m_allCompositions[id]->isGrabbed()) {
m_allCompositions[id]->setGrab(false);
}
// Reset offset display on clips
std::unordered_set<int> items = getCurrentSelection();
for (auto &id : items) {
if (isGroup(id)) {
std::unordered_set<int> children = m_groups->getLeaves(id);
for (int c : children) {
items.insert(c);
}
} else if (isClip(id)) {
m_allClips[id]->clearOffset();
if (m_allClips[id]->isGrabbed()) {
m_allClips[id]->setGrab(false);
}
} else if (isComposition(id)) {
if (m_allCompositions[id]->isGrabbed()) {
m_allCompositions[id]->setGrab(false);
}
}
if (m_groups->getType(m_currentSelection) == GroupType::Selection) {
m_groups->destructGroupItem(m_currentSelection);
}
m_groups->destructGroupItem(m_currentSelection);
}
} else {
if (isClip(m_currentSelection)) {
......
......@@ -255,10 +255,12 @@ Rectangle {
}
Keys.onShortcutOverride: event.accepted = clipRoot.isGrabbed && (event.key === Qt.Key_Left || event.key === Qt.Key_Right || event.key === Qt.Key_Up || event.key === Qt.Key_Down)
Keys.onLeftPressed: {
controller.requestClipMove(clipRoot.clipId, clipRoot.trackId, clipRoot.modelStart - 1, true, true, true);
var offset = event.modifiers === Qt.ShiftModifier ? timeline.fps() : 1
controller.requestClipMove(clipRoot.clipId, clipRoot.trackId, clipRoot.modelStart - offset, true, true, true);
}
Keys.onRightPressed: {
controller.requestClipMove(clipRoot.clipId, clipRoot.trackId, clipRoot.modelStart + 1, true, true, true);
var offset = event.modifiers === Qt.ShiftModifier ? timeline.fps() : 1
controller.requestClipMove(clipRoot.clipId, clipRoot.trackId, clipRoot.modelStart + offset, true, true, true);
}
Keys.onUpPressed: {
controller.requestClipMove(clipRoot.clipId, controller.getNextTrackId(clipRoot.trackId), clipRoot.modelStart, true, true, true);
......
......@@ -122,10 +122,12 @@ Item {
hoverEnabled: true
Keys.onShortcutOverride: event.accepted = compositionRoot.isGrabbed && (event.key === Qt.Key_Left || event.key === Qt.Key_Right || event.key === Qt.Key_Up || event.key === Qt.Key_Down)
Keys.onLeftPressed: {
controller.requestCompositionMove(compositionRoot.clipId, compositionRoot.originalTrackId, compositionRoot.modelStart - 1, true, true)
var offset = event.modifiers === Qt.ShiftModifier ? timeline.fps() : 1
controller.requestCompositionMove(compositionRoot.clipId, compositionRoot.originalTrackId, compositionRoot.modelStart - offset, true, true)
}
Keys.onRightPressed: {
controller.requestCompositionMove(compositionRoot.clipId, compositionRoot.originalTrackId, compositionRoot.modelStart + 1, true, true)
var offset = event.modifiers === Qt.ShiftModifier ? timeline.fps() : 1
controller.requestCompositionMove(compositionRoot.clipId, compositionRoot.originalTrackId, compositionRoot.modelStart + offset, true, true)
}
Keys.onUpPressed: {
controller.requestCompositionMove(compositionRoot.clipId, controller.getNextTrackId(compositionRoot.originalTrackId), compositionRoot.modelStart, true, true)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment