-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Gui: Fix F2 for TreeView rename on MacOS #26146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- 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.
|
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) |
|
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 |
|
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. 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? |
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