From 1f32cae256b11ea9411d4ed990761bc169a41bd4 Mon Sep 17 00:00:00 2001 From: Dirk Olbrich Date: Mon, 24 Jan 2022 13:37:11 +0100 Subject: [PATCH] [Core] set Backspace key as shortcut --- src/Gui/Widgets.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 9debd6de02..e085f95119 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -397,14 +397,19 @@ void AccelLineEdit::keyPressEvent ( QKeyEvent * e) int key = e->key(); Qt::KeyboardModifiers state = e->modifiers(); - // Backspace clears the shortcut + // Backspace clears the shortcut if text is present, else sets Backspace as shortcut. // If a modifier is pressed without any other key, return. // AltGr is not a modifier but doesn't have a QtSring representation. switch(key) { case Qt::Key_Backspace: if (state == Qt::NoModifier) { keyPressedCount = 0; - setText(noneStr); + if (isNone()) { + QKeySequence ks(key); + setText(ks.toString(QKeySequence::NativeText)); + } else { + setText(noneStr); + } } case Qt::Key_Control: case Qt::Key_Shift: