diff options
author | Knud Dollereder <knud.dollereder@qt.io> | 2021-10-06 13:54:19 +0200 |
---|---|---|
committer | Knud Dollereder <knud.dollereder@qt.io> | 2021-10-06 13:51:18 +0000 |
commit | ee6f3a8cc8eb59a09cec93a75a3013d731cb67d6 (patch) | |
tree | 475308f03e47542e5abd504536d5988699f63ece | |
parent | f3276a96e9d1b9c04fe8ff0b4ea37b126128f00b (diff) |
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 <thomas.hartmann@qt.io>
-rw-r--r-- | src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp index 704d7c2b0d..b3150e1e83 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<QmlTimelineKeyframeGroup> 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<QKeyEvent *>(event)->key() == deleteKey()) { + if (isDeleteKey(static_cast<QKeyEvent *>(event)->key())) { QGraphicsScene::keyPressEvent(static_cast<QKeyEvent *>(event)); event->accept(); return true; |