Skip to content

Conversation

@timpieces
Copy link
Contributor

  • In online tutorials, people often say 'press F2 to rename'. This is confusing for me as I'm on MacOS and I'm not sure if I'm being gaslit.
  • The code has this commented out, saying that it 'doesn't work'. On further debugging, it appears that this is because we only add it as an action when the context menu is pressed, which means the shortcut never gets routed.
  • It's not clear to me why this behaviour is MacOS specific, and nothing online explains this.
  • I've done my best to check regressions (on MacOS) and as far as I can tell there are no observable differences but the F2 key no works. I'll need others help to see if it causes issues on other platforms.
  • If this is approved, I'll look to make the changes to the few other places where F2 is disabled on macos.

Simple change to register the existing action under the actual tree view widget. This gets it working on MacOS with (AFAICT) no other undesirable changes. Would need help from other users/devs to test on other platforms.

Issues

fixes #26145

Before and After Images

- In online tutorials, people often say 'press F2 to rename'. This is
  confusing for me as I'm on MacOS and I'm not sure if I'm being gaslit.
- The code has this commented out, saying that it 'doesn't work'. On
  further debugging, it appears that this is because we only add it as
  an action when the context menu is pressed, which means the shortcut
  never gets routed.
- It's not clear to me why this behaviour is MacOS specific, and nothing
  online explains this.
- I've done my best to check regressions (on MacOS) and as far as I can
  tell there are no observable differences but the F2 key no works. I'll
  need others help to see if it causes issues on other platforms.
- If this is approved, I'll look to make the changes to the few other
  places where F2 is disabled on macos.
@github-actions github-actions bot added the Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD label Dec 14, 2025
@maxwxyz maxwxyz added Type: Other Tasks, refactoring, quality improvement, actions, dependencies, packaging, translations or other... backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 labels Dec 14, 2025
@maxwxyz maxwxyz added this to the 1.1 milestone Dec 14, 2025
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Dec 14, 2025
@adrianinsaval
Copy link
Member

consider doing this in https://github.com/timpieces/FreeCAD/blob/9625a71d8d8c499b75147231ad86b51d3e71a359/src/Gui/DAGView/DAGModel.cpp#L124-L126 too, I wish we had context on when/how/why that was considered to not work

@timpieces
Copy link
Contributor Author

consider doing this in https://github.com/timpieces/FreeCAD/blob/9625a71d8d8c499b75147231ad86b51d3e71a359/src/Gui/DAGView/DAGModel.cpp#L124-L126 too, I wish we had context on when/how/why that was considered to not work

Yep that's the plan :) . Agree it would be nice to have the context, but I think it's easy to miss that on macos this needs to be added as a widget action (although my understanding in proper qt usage is that it should be added as an action to the widget on all platforms anyway)

@chennes
Copy link
Member

chennes commented Dec 16, 2025

They key that is pressed to edit the name of an object is the "platform edit key" -- it's F2 on Windows and Linux, and Enter on macOS. See https://doc.qt.io/qt-6/qabstractitemview.html#EditTrigger-enum

@timpieces
Copy link
Contributor Author

Hey @chennes thanks for the link, that's interesting.

Well if this is common usage/knowledge among other mac users, then I'm fine to abandon this change, although I do still think there is a problem to be solved here which is highlighted in the linked threads on the PR.
If we think it's better to leave this as the platform default, then I'd suggest adding the keyboard shortcut text to the context menu entry for 'Rename'. I think it's quite easy to do.
I'd find this rather annoying when switching between platforms, which I do often with many tools, but FreeCAD isn't one of them (I plan to only use it on MacOS) so I don't care that much to be honest.

As an aside, the Enter/Return key still works for rename after this change, as I expect that QT itself handles it. And it's weird to me that this code exists at all for Linux/Windows given that's the case. Based on what you're saying and what I'm observing, I think none of the existing code should be necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Type: Other Tasks, refactoring, quality improvement, actions, dependencies, packaging, translations or other...

Projects

Status: Merge Meeting

Development

Successfully merging this pull request may close these issues.

MacOS: F2 Does Not Rename Items in tree view

4 participants