[fixed] Ticket #4683 - Mac keyboard Delete button unrecognized within Tools->Customize->Keyboard
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
[fixed] Ticket #4683 - Mac keyboard Delete button unrecognized within Tools->Customize->Keyboard
Hi, I try to set some custom keyboard shortcuts and would like to set the deletion of objects to the Delete key. On Mac, the default Delete key is not recognized.
Only if pressed in combination with the Fn key. Could this be a bug?
I am using the ProDark theme, but the behavior is reproducible with no style sheet set as well.
OS: 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)
Only if pressed in combination with the Fn key. Could this be a bug?
I am using the ProDark theme, but the behavior is reproducible with no style sheet set as well.
OS: 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)
Last edited by doia on Wed Mar 09, 2022 9:27 pm, edited 3 times in total.
-
- Veteran
- Posts: 3107
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button
It is standard Mac keyboard mapping. Mac delete = PC backspace, Mac Fn-Delete = PC Delete https://support.apple.com/en-gb/HT201236
I thought ctrl-d might work for Fn-delete, but it doesn't seem to.
Full-size Mac external keyboards have a delete-right key.
I thought ctrl-d might work for Fn-delete, but it doesn't seem to.
Full-size Mac external keyboards have a delete-right key.
Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button
Understood and correct.edwilliams16 wrote: ↑Mon May 31, 2021 9:16 pm It is standard Mac keyboard mapping. Mac delete = PC backspace, Mac Fn-Delete = PC Delete https://support.apple.com/en-gb/HT201236
But shouldn't I be able to set Mac Delete/PC Backspace as a valid single key for triggering the Delete action? Yet FC does not recognize this single key, just displays "none". I don't know if it is possible on a Linux/Windows system. Could you check, if you work on such a system?
The why: Just a personal preference/habit known from other software, e.g. Revit allows deleting an element by pressing the Mac Delete key.
Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button
This is out of the scope of FreeCAD: you can freely configure the keyboard layout on MacOS with a keyboard layout XML file.doia wrote: ↑Tue Jun 01, 2021 7:44 am But shouldn't I be able to set Mac Delete/PC Backspace as a valid single key for triggering the Delete action? Yet FC does not recognize this single key, just displays "none". I don't know if it is possible on a Linux/Windows system. Could you check, if you work on such a system?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button
I don't think it has anything to do with keyboard layout definitions, as I will not change the layout (e.g. map the backspace key to the x key). Maybe I misstated my problem. The Mac Delete key is not recognized within the FC Tools->Customize->Keyboard screen.
The key is recognized in other screens or workbenches, as I can use Mac Delete within the Spreadsheet WB or in any other WB where I have to enter a value into a field. If pressed, the character left of the cursor gets deleted. Just as expected.
Other programs like Blender or Inkscape recognize the Mac Delete key for keyboard shortcut settings, without any change in keyboard layout XML files.
The key is recognized in other screens or workbenches, as I can use Mac Delete within the Spreadsheet WB or in any other WB where I have to enter a value into a field. If pressed, the character left of the cursor gets deleted. Just as expected.
Other programs like Blender or Inkscape recognize the Mac Delete key for keyboard shortcut settings, without any change in keyboard layout XML files.
Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu
Editing FreeCAD's user.cfg file to remap the delete key worked for me:
<FCParamGroup Name="Shortcut">
<FCText Name="Std_Delete">Backspace</FCText>
</FCParamGroup>
<FCParamGroup Name="Shortcut">
<FCText Name="Std_Delete">Backspace</FCText>
</FCParamGroup>
Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu
Thank you @martin51, that works. I can now delete elements with just pressing the Mac Delete key, e.g. deleting lines in the Sketcher WB.
So the bug is confirmed. FC on Mac can read and interpret the Mac Delete (aka Backspace) key without additionally pressing the FN key, if set manually in the Library/Preferences/Freecad/user.cfg file. But this key is not recognised within the FC Tools->Customize->Keyboard interface, which should be able use this key to set it in the user.cfg file.
I will file a bug in the tracker.
So the bug is confirmed. FC on Mac can read and interpret the Mac Delete (aka Backspace) key without additionally pressing the FN key, if set manually in the Library/Preferences/Freecad/user.cfg file. But this key is not recognised within the FC Tools->Customize->Keyboard interface, which should be able use this key to set it in the user.cfg file.
I will file a bug in the tracker.
-
- Veteran
- Posts: 3107
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu
If anybody else wants to do this, note that FreeCAD cannot be open when you edit user.cfg or your changes will be over-written when FreeCAD closes.
Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu
Yep, had to learn that too. Took me 3 attempts until I closed FC before editing user.cfg
Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu
The culprit here seems to be the following code in AccelLineEdit.cpp:
So it is not possible to set "Backspace" (Mac "Delete") as a keyboard shortcut on any OS, it would appear -- not because of a Qt limitation, but because that's explicitly how the Accelerator line edit work.
Code: Select all
// Backspace clears the 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);
}