View Issue Details

IDProjectCategoryView StatusLast Update
0004683FreeCADBugpublic2022-01-24 15:39
Reporterdoia Assigned To 
Status closedResolutionfixed 
Product Version0.19 
Target Version0.20Fixed in Version0.20 
Summary0004683: Mac Delete button (Backspace) is not recognized within Tools->Customize->Keyboard, only in combination with Fn button
DescriptionThe Mac Delete key (Backspace) is not recognized within the Tools->Customize->Keyboard screen to set the key as a shortcut to delete elements in the work benches. The key is only recognises in conjunction with pressing the Fn key on a Mac keyboard.

The key is recognized in other screens or workbenches, as it can be used e.g. within the Spreadsheet WB or in any other WB where the user has to enter a value into a field. If pressed (without additionally pressing the Fn key), the character left of the cursor gets deleted.

The Mac Delete key however can be set manually within the user preference configuration file under ~/Library/Preferences/FreeCAD/user.cfg. If adding the following lines in user.cfg:

<FCParamGroup Name="Shortcut">
    <FCText Name="Std_Delete">Backspace</FCText>

On new start up the Mac Delete key is read and interpreted by FC without additionally pressing the FN key.
Steps To Reproduce- open Tools->Customize->Keyboard
- select the Edit submenu under Category
- select the &Delete command
- try pressing the Mac Delete key (Backspace) under the "Press new shortcut" field
- the field shows the value "None"
Tagskeyboard, macOS, shortcuts
FreeCAD InformationOS: macOS 10.16
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)



2021-06-07 09:32

reporter   ~0015704



2021-09-16 04:18

administrator   ~0015934

"Backspace"/"Delete (Mac)" is hardcoded in AccelLineEdit.cpp to clear the contents of the line edit, which means it cannot be used alone as a shortcut except by manually setting it in your user.cfg file. The only way around this would be to eliminate that feature and making it so you have to have an external button click to clear the field. I don't see that as a viable path forward.


2021-09-16 07:52

reporter   ~0015936

Thanks for the info. I didn't know where to look for this in source.
There is no file AccelLineEdit.cpp in source, but there is src/Gui/Widgets.cpp with class AccelLineEdit.

The code in question would be in method AccelLineEdit::keyPressEvent in line 402-406:

case Qt::Key_Backspace:
    if (state == Qt::NoModifier) {
        keyPressedCount = 0;

I think a solution would be to not just delete the string, if Key_Backspace is pressed, but instead check the current content of the string:
- if string contains some characters -> delete
- is string is empty -> set BACKSPACE as content

I will try that and see if that works on Mac.


2022-01-24 15:39

administrator   ~0016268

Issue History

Date Modified Username Field Change
2021-06-07 09:30 doia New Issue
2021-06-07 09:30 doia Tag Attached: keyboard
2021-06-07 09:30 doia Tag Attached: macOS
2021-06-07 09:30 doia Tag Attached: shortcuts
2021-06-07 09:32 doia Note Added: 0015704
2021-08-25 14:18 Kunda1 Status new => confirmed
2021-08-25 14:18 Kunda1 Target Version => 0.20
2021-09-16 04:18 chennes Note Added: 0015934
2021-09-16 07:52 doia Note Added: 0015936
2022-01-24 15:39 wmayer Status confirmed => closed
2022-01-24 15:39 wmayer Resolution open => fixed
2022-01-24 15:39 wmayer Fixed in Version => 0.20
2022-01-24 15:39 wmayer Note Added: 0016268