From ee6f3a8cc8eb59a09cec93a75a3013d731cb67d6 Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Wed, 6 Oct 2021 13:54:19 +0200 Subject: [PATCH] Consider Qt::Key_Backspace and Qt::Key_Delete as delete keys Both keys where set as a global shortcut for deletion. The timeline considered only one of them. Change-Id: I5d27221a371535e94751ffcd0f6d4420978d0f81 Reviewed-by: Thomas Hartmann --- .../timelineeditor/timelinegraphicsscene.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp index 704d7c2b0d0..b3150e1e832 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp @@ -70,12 +70,9 @@ namespace QmlDesigner { -static int deleteKey() +static bool isDeleteKey(int key) { - if (Utils::HostOsInfo::isMacHost()) - return Qt::Key_Backspace; - - return Qt::Key_Delete; + return (key == Qt::Key_Backspace) | (key == Qt::Key_Delete); } QList allTimelineFrames(const QmlTimeline &timeline) @@ -674,7 +671,7 @@ void TimelineGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent) return; } - if (deleteKey() == keyEvent->key()) + if (isDeleteKey(keyEvent->key())) handleKeyframeDeletion(); QGraphicsScene::keyReleaseEvent(keyEvent); @@ -838,7 +835,7 @@ bool TimelineGraphicsScene::event(QEvent *event) { switch (event->type()) { case QEvent::ShortcutOverride: - if (static_cast(event)->key() == deleteKey()) { + if (isDeleteKey(static_cast(event)->key())) { QGraphicsScene::keyPressEvent(static_cast(event)); event->accept(); return true;