FreeCAD icon indicating copy to clipboard operation
FreeCAD copied to clipboard

Spreadsheet: Delete key doesn't clear contents in selected cells

Open hooperbloob opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Problem description

Hitting the delete key when one or more cells are selected will normally clear their contents. This doesn't seem to be happening at the moment.

Full version info

OS: macOS 12.7.5
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37898 (Git)
Build type: Release
Branch: main
Hash: 308013fb975ec3bf0dc5cb616ef76a4095e71cc5
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Installed mods: 
  * A2plus 0.4.64

Subproject(s) affected?

None

Anything else?

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

hooperbloob avatar Jun 28 '24 18:06 hooperbloob

I cannot reproduce on Windows and

OS: macOS 13.6.7
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37898 (Git)
Build type: Release
Branch: main
Hash: 308013fb975ec3bf0dc5cb616ef76a4095e71cc5
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Installed mods: 
  * freecad.gears 1.2.0
  * OpenTheme 2024.6.22
  * CfdOF 1.26.1
  * Defeaturing 1.2.2
  * Manipulator 1.5.7
  * fasteners 0.5.24
  * CurvedShapes 1.0.9
  * sheetmetal 0.4.20
  * Curves 0.6.40

maxwxyz avatar Jun 29 '24 06:06 maxwxyz

I can confirm. Would not surprise me if this is a Macintosh specific issue.

OS: macOS 14.5
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37928 (Git)
Build type: Release
Branch: main
Hash: e7699b531eba4bee262f7214699f07b96f66ba7b
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: C/Default (C)
Installed mods: 
  * FeedsAndSpeeds 0.5.0
  * OpenTheme 2024.6.22

JohnOCFII avatar Jun 30 '24 01:06 JohnOCFII

The context menu of the spread sheet has a Delete command. When clicking on it does it clear the selection?

wwmayer avatar Jun 30 '24 09:06 wwmayer

The problem is the implementation of SheetTableView::event(). It compares the value of the key event with Qt::Key_Delete and this works fine for Windows and Linux but not for macOS because it defines a different shortcut (Forward Delete or Meta + D)

So, the platform-independent implementation should be:

        if (kevent->matches(QKeySequence::Delete)) {
            deleteSelection();
        }

wwmayer avatar Jun 30 '24 09:06 wwmayer

Please test: https://github.com/FreeCAD/FreeCAD/pull/15057

wwmayer avatar Jun 30 '24 09:06 wwmayer

This looks like the same problem in the Sketcher: #15068

hooperbloob avatar Jun 30 '24 19:06 hooperbloob