From 033d8aa03d9c741ba2b69b68b19ff2afcf52302c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Tue, 9 Jul 2024 20:11:44 +0200 Subject: [PATCH] Update keysview.cpp Add split action to right-click menu. --- src/app/GUI/keysview.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/app/GUI/keysview.cpp b/src/app/GUI/keysview.cpp index 435fbd8f8..388acbaf8 100644 --- a/src/app/GUI/keysview.cpp +++ b/src/app/GUI/keysview.cpp @@ -331,24 +331,30 @@ void KeysView::mousePressEvent(QMouseEvent *e) { } } } else { - if(mMovingKeys) { + if (mMovingKeys) { cancelTransform(); } else { - auto movable = getRectangleMovableAtPos( - posU.x(), posU.y(), - mPixelsPerFrame, - mMinViewedFrame); - if(!movable) { - } else if(movable->isDurationRect()) { + auto movable = getRectangleMovableAtPos(posU.x(), + posU.y(), + mPixelsPerFrame, + mMinViewedFrame); + if (!movable) { + } else if (movable->isDurationRect()) { QMenu menu; - menu.addAction(tr("Edit duration")); - // TODO: add split action + const QString editStr = tr("Edit duration"); + const QString splitStr = tr("Split Clip"); + menu.addAction(editStr); + menu.addAction(splitStr); const auto selectedAction = menu.exec(e->globalPos()); - if(selectedAction) { - const auto durRect = static_cast(movable); - if(!durRect) return; - const auto& instance = DialogsInterface::instance(); - instance.showDurationSettingsDialog(durRect); + if (selectedAction) { + if (selectedAction->text() == editStr) { + const auto durRect = static_cast(movable); + if (!durRect) { return; } + const auto& instance = DialogsInterface::instance(); + instance.showDurationSettingsDialog(durRect); + } else if (selectedAction->text() == splitStr) { + if (mCurrentScene) { mCurrentScene->splitAction(); } + } } } }