OS X: Add more text editing key bindings.

ctrl + K : Cut
ctrl + Y : Paste
ctrl + F : Cursor right
ctrl + B : Cursor left
ctrl + N : Cursor down
ctrl + P : Cursor up
ctrl + V : Cursor next page
ctrl + O : Insert line separator

(ctrl as in the key, not Qt::CTRL)

These are low-priority (0) key sequences. Add them to the
end of each StandardKey range and change the priority
of an existing item to 1 where it makes sense.

Task-number: QTBUG-32837
Change-Id: Id321e6c6ad4277d729b27297a1de66c4628e4201
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Morten Johan Sørvig 2014-04-02 09:12:20 +02:00 committed by The Qt Project
parent 3876a05adf
commit 63e33bfdab
2 changed files with 25 additions and 17 deletions

View File

@ -238,9 +238,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \li SaveAs \li \li Ctrl+Shift+S \li \li Ctrl+Shift+S
\row \li New \li Ctrl+N \li Ctrl+N \li Ctrl+N \li Ctrl+N
\row \li Delete \li Del \li Del, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D
\row \li Cut \li Ctrl+X, Shift+Del \li Ctrl+X \li Ctrl+X, F20, Shift+Del \li Ctrl+X, F20, Shift+Del
\row \li Cut \li Ctrl+X, Shift+Del \li Ctrl+X, Meta+K \li Ctrl+X, F20, Shift+Del \li Ctrl+X, F20, Shift+Del
\row \li Copy \li Ctrl+C, Ctrl+Ins \li Ctrl+C \li Ctrl+C, F16, Ctrl+Ins \li Ctrl+C, F16, Ctrl+Ins
\row \li Paste \li Ctrl+V, Shift+Ins \li Ctrl+V \li Ctrl+V, F18, Shift+Ins \li Ctrl+V, F18, Shift+Ins
\row \li Paste \li Ctrl+V, Shift+Ins \li Ctrl+V, Meta+Y \li Ctrl+V, F18, Shift+Ins \li Ctrl+V, F18, Shift+Ins
\row \li Preferences \li \li Ctrl+, \li \li
\row \li Undo \li Ctrl+Z, Alt+Backspace \li Ctrl+Z \li Ctrl+Z, F14 \li Ctrl+Z, F14
\row \li Redo \li Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \li Ctrl+Shift+Z \li Ctrl+Shift+Z \li Ctrl+Shift+Z
@ -263,13 +263,13 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \li Bold \li Ctrl+B \li Ctrl+B \li Ctrl+B \li Ctrl+B
\row \li Italic \li Ctrl+I \li Ctrl+I \li Ctrl+I \li Ctrl+I
\row \li Underline \li Ctrl+U \li Ctrl+U \li Ctrl+U \li Ctrl+U
\row \li MoveToNextChar \li Right \li Right \li Right \li Right
\row \li MoveToPreviousChar \li Left \li Left \li Left \li Left
\row \li MoveToNextChar \li Right \li Right, Meta+F \li Right \li Right
\row \li MoveToPreviousChar \li Left \li Left, Meta+B \li Left \li Left
\row \li MoveToNextWord \li Ctrl+Right \li Alt+Right \li Ctrl+Right \li Ctrl+Right
\row \li MoveToPreviousWord \li Ctrl+Left \li Alt+Left \li Ctrl+Left \li Ctrl+Left
\row \li MoveToNextLine \li Down \li Down \li Down \li Down
\row \li MoveToPreviousLine \li Up \li Up \li Up \li Up
\row \li MoveToNextPage \li PgDown \li PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\li PgDown \li PgDown
\row \li MoveToNextLine \li Down \li Down, Meta+N \li Down \li Down
\row \li MoveToPreviousLine \li Up \li Up, Meta+P \li Up \li Up
\row \li MoveToNextPage \li PgDown \li PgDown, Alt+PgDown, Meta+Down, Meta+PgDown, Meta+V \li PgDown \li PgDown
\row \li MoveToPreviousPage \li PgUp \li PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \li PgUp \li PgUp
\row \li MoveToStartOfLine \li Home \li Ctrl+Left, Meta+Left \li Home \li Home
\row \li MoveToEndOfLine \li End \li Ctrl+Right, Meta+Right \li End, Ctrl+E \li End, Ctrl+E
@ -296,7 +296,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \li DeleteEndOfLine \li (none) \li (none) \li Ctrl+K \li Ctrl+K
\row \li DeleteCompleteLine \li (none) \li (none) \li Ctrl+U \li Ctrl+U
\row \li InsertParagraphSeparator \li Enter \li Enter \li Enter \li Enter
\row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter \li Shift+Enter \li Shift+Enter
\row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter, Meta+O \li Shift+Enter \li Shift+Enter
\endtable
Note that, since the key sequences used for the standard shortcuts differ

View File

@ -178,12 +178,13 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, KB_Win | KB_X11},
{QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, KB_All},
{QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, KB_All},
{QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac},
{QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, KB_X11}, //emacs (line edit only)
{QKeySequence::Delete, 1, Qt::Key_Delete, KB_All},
{QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac},
{QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, KB_All},
{QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, KB_Win | KB_X11}, //## Check if this should work on mac
{QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, //Cut on sun keyboards
{QKeySequence::Cut, 0, Qt::META | Qt::Key_K, KB_Mac},
{QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, KB_X11 | KB_Win},
{QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, KB_All},
{QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards
@ -191,6 +192,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, KB_All},
{QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, KB_Win | KB_X11},
{QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards
{QKeySequence::Paste, 0, Qt::META | Qt::Key_Y, KB_Mac},
{QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win},
{QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, KB_All},
{QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards
@ -241,16 +243,21 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, KB_All},
{QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, KB_All},
{QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, KB_All},
{QKeySequence::MoveToNextChar, 0, Qt::Key_Right, KB_All},
{QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, KB_All},
{QKeySequence::MoveToNextChar, 1, Qt::Key_Right, KB_All},
{QKeySequence::MoveToNextChar, 0, Qt::META | Qt::Key_F, KB_Mac},
{QKeySequence::MoveToPreviousChar, 1, Qt::Key_Left, KB_All},
{QKeySequence::MoveToPreviousChar, 0, Qt::META | Qt::Key_B, KB_Mac},
{QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, KB_Mac},
{QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, KB_Win | KB_X11},
{QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac},
{QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, KB_Win | KB_X11},
{QKeySequence::MoveToNextLine, 0, Qt::Key_Down, KB_All},
{QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, KB_All},
{QKeySequence::MoveToNextLine, 1, Qt::Key_Down, KB_All},
{QKeySequence::MoveToNextLine, 0, Qt::META | Qt::Key_N, KB_Mac},
{QKeySequence::MoveToPreviousLine, 1, Qt::Key_Up, KB_All},
{QKeySequence::MoveToPreviousLine, 0, Qt::META | Qt::Key_P, KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_V, KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, KB_Mac },
{QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, KB_All},
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, KB_Mac},
@ -265,9 +272,9 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11},
{QKeySequence::MoveToEndOfLine, 0, Qt::CTRL + Qt::Key_E, KB_X11},
{QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac},
{QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only
{QKeySequence::MoveToStartOfBlock, 1, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only
{QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac},
{QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only
{QKeySequence::MoveToEndOfBlock, 1, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only
{QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, KB_Mac},
{QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, KB_Win | KB_X11},
{QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, KB_Mac},
@ -290,10 +297,10 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac},
{QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Mac },
{QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11},
{QKeySequence::SelectStartOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only
{QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac},
{QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only
{QKeySequence::SelectEndOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only
{QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac},
{QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only
{QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, KB_Mac},
{QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11},
{QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, KB_Mac},
@ -311,6 +318,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, KB_Mac},
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All},
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All},
{QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_O, KB_Mac},
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac},
{QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac},
{QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_Gnome | KB_KDE | KB_Mac},