Opened 8 years ago
Closed 8 years ago
#824 closed defect (fixed)
New Edit menu interferes with text copy
Reported by: | Elaine Meng | Owned by: | pett |
---|---|---|---|
Priority: | minor | Milestone: | Alpha 3 |
Component: | Core | Version: | |
Keywords: | Cc: | oc2188@… | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
I don't know if this is fixable, but Mac clover-c after highlighting some text in the Log or Help Viewer gives in the Log:
QAction::eventFilter: Ambiguous shortcut overload: ?C
(and I couldn't copy that to paste here, had to just type the whole thing... outrageous!)
Reclassify as appropriate.
Change History (8)
comment:1 by , 8 years ago
Cc: | added |
---|---|
Component: | Input/Output → Core |
Milestone: | → Alpha 3 |
Owner: | changed from | to
Summary: | can't copy text from Log or Help Viewer → New Edit menu interferes with text copy |
comment:2 by , 8 years ago
comment:3 by , 8 years ago
As far as I can tell, there is no Qt functionality for forwarding cut-copy-paste events to focus widgets. The current code just posts two events: ctrl-? press/release where ? is X,C and V for cut, copy and paste, respectively. Now the issues:
- Everything works find on Windows. The behavior described above happens on Mac. Don't know about Linux.
- I don't know how to turn QKeySequence instances into event instances for posting.
- I think removing the shortcut designation for the menu items will make things work better but you won't see Ctrl-C next to the Copy menu item. This is in the current daily build.
- Eric wants the Ctrl-C shortcut info on the menu and thinks that the right way to handle event-forwarding by finding the focus widget and checking for "cut", "copy" and "paste" methods. In my experiments, the widgets that are returned (in the Python layer) look like generic QWidget instances and do not have these methods.
follow-up: 4 comment:4 by , 8 years ago
My two cents’ worth is that this problem is EXTREMELY annoying, at least to me! No text-copy from Log ruins it for my notebook purposes (unlike some people, I do not want to save the whole Log, which would be 1000x more stuff) and makes it impossible to copy tracebacks for bug reporting. Elaine
comment:5 by , 8 years ago
Owner: | changed from | to
---|
More work needs to be done to use predefined QKeySequence's for Undo and Redo instead of hardwiring Ctrl-Z and Ctrl-R/Y.
Also need to re-investigate how to define shortcuts for Cut/Copy/Paste and properly forward actions to widget with focus.
comment:6 by , 8 years ago
Status: | assigned → accepted |
---|
comment:7 by , 8 years ago
Cc: | added; removed |
---|
comment:8 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Undo/Redo now use the standard Qt key sequences which typically matches the platform defaults. Previously, some standard key sequences (Undo) did not work when the focus is in the command line, which grabs key events and did not handle Undo/Redo at all. That has been fixed.
Cut/Copy/Paste has been removed from the Edit menu because Qt and Apple disagree on the meaning of selecting the action from the application menu. Qt suggests that it should always apply to the application main window, while Apple expects the focus widget to handle the event. Unfortunately, it is very difficult to make Qt emulate Mac, and keeping the Qt style will be very confusing for Mac users. The simple solution taken is to not have Cut/Copy/Paste menu items and each widget (command line, log, html viewer, etc) will have to deal with keyboard shortcuts themselves. In the future, it may be possible to have the main graphics window support cut/copy/paste in terms of image, atomic data, volume data, etc.
Also, it seems like you should be using QKeySequence.Copy/Cut/Paste/Undo/Redo instead of hard-coded key codes.