Replace hardcoded shortcuts for X11 in QLineEdit with StandardKeys
Added Ctrl+E to the X11 shortcuts for "move to end of line" Added new StandardKey DeleteCompleteLine bound to Ctrl+U Updated QLineEdit to use these standard keys Change-Id: I24e5dd3b4fed9f6c15f0d1a00be682734e2485a4 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
parent
3edc1a4b91
commit
cab86ec3ed
@ -270,7 +270,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
\row \li MoveToNextPage \li PgDown \li PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\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 \li End
|
||||
\row \li MoveToEndOfLine \li End \li Ctrl+Right, Meta+Right \li End, Ctrl+E \li End, Ctrl+E
|
||||
\row \li MoveToStartOfBlock \li (none) \li Alt+Up, Meta+A \li (none) \li (none)
|
||||
\row \li MoveToEndOfBlock \li (none) \li Alt+Down, Meta+E \li (none) \li (none)
|
||||
\row \li MoveToStartOfDocument\li Ctrl+Home \li Ctrl+Up, Home \li Ctrl+Home \li Ctrl+Home
|
||||
@ -292,6 +292,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
|
||||
\row \li DeleteStartOfWord \li Ctrl+Backspace \li Alt+Backspace \li Ctrl+Backspace \li Ctrl+Backspace
|
||||
\row \li DeleteEndOfWord \li Ctrl+Del \li (none) \li Ctrl+Del \li Ctrl+Del
|
||||
\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
|
||||
\endtable
|
||||
@ -668,6 +669,7 @@ static const struct {
|
||||
\value DeleteEndOfLine Delete end of line.
|
||||
\value DeleteEndOfWord Delete word from the end of the cursor.
|
||||
\value DeleteStartOfWord Delete the beginning of a word up to the cursor.
|
||||
\value DeleteCompleteLine Delete the entire line.
|
||||
\value Find Find in document.
|
||||
\value FindNext Find next result.
|
||||
\value FindPrevious Find previous result.
|
||||
|
@ -141,7 +141,8 @@ public:
|
||||
Preferences,
|
||||
Quit,
|
||||
FullScreen,
|
||||
Deselect
|
||||
Deselect,
|
||||
DeleteCompleteLine
|
||||
};
|
||||
|
||||
enum SequenceFormat {
|
||||
|
@ -256,6 +256,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
|
||||
{QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, KB_Mac},
|
||||
{QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, KB_Mac },
|
||||
{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::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac},
|
||||
@ -311,7 +312,8 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
|
||||
{QKeySequence::FullScreen, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F, KB_KDE},
|
||||
{QKeySequence::FullScreen, 1, Qt::CTRL | Qt::Key_F11, KB_Gnome},
|
||||
{QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE},
|
||||
{QKeySequence::Deselect, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_A, KB_X11}
|
||||
{QKeySequence::Deselect, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_A, KB_X11},
|
||||
{QKeySequence::DeleteCompleteLine, 0, Qt::CTRL | Qt::Key_U, KB_X11}
|
||||
};
|
||||
|
||||
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
|
||||
|
@ -1773,6 +1773,14 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
||||
cursorWordBackward(true);
|
||||
del();
|
||||
}
|
||||
} else if (event == QKeySequence::DeleteCompleteLine) {
|
||||
if (!isReadOnly()) {
|
||||
setSelection(0, text().size());
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
copy();
|
||||
#endif
|
||||
del();
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_SHORTCUT
|
||||
else {
|
||||
@ -1810,20 +1818,6 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
||||
complete(event->key());
|
||||
break;
|
||||
#endif
|
||||
case Qt::Key_E:
|
||||
if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme)
|
||||
end(0);
|
||||
break;
|
||||
|
||||
case Qt::Key_U:
|
||||
if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme && !isReadOnly()) {
|
||||
setSelection(0, text().size());
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
copy();
|
||||
#endif
|
||||
del();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!handled)
|
||||
unknown = true;
|
||||
|
Loading…
Reference in New Issue
Block a user