forked from qt-creator/qt-creator
FancyLineEdit: Fix camel case navigation with shift modifier
Fixes: QTCREATORBUG-23370 Change-Id: Ie96f642f0b964499ded830ae6eabfc86ef31fabd Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
0d005b7057
commit
7e4cd9b368
@@ -370,15 +370,20 @@ void FancyLineEdit::onEditingFinished()
|
||||
|
||||
void FancyLineEdit::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
const QTextCursor::MoveMode mode = (event->modifiers() & Qt::ShiftModifier)
|
||||
? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor;
|
||||
|
||||
if (camelCaseNavigation && event == QKeySequence::MoveToPreviousWord)
|
||||
CamelCaseCursor::left(this, mode);
|
||||
else if (camelCaseNavigation && event == QKeySequence::MoveToNextWord)
|
||||
CamelCaseCursor::right(this, mode);
|
||||
else
|
||||
if (camelCaseNavigation) {
|
||||
if (event == QKeySequence::MoveToPreviousWord)
|
||||
CamelCaseCursor::left(this, QTextCursor::MoveAnchor);
|
||||
else if (event == QKeySequence::SelectPreviousWord)
|
||||
CamelCaseCursor::left(this, QTextCursor::KeepAnchor);
|
||||
else if (event == QKeySequence::MoveToNextWord)
|
||||
CamelCaseCursor::right(this, QTextCursor::MoveAnchor);
|
||||
else if (event == QKeySequence::SelectNextWord)
|
||||
CamelCaseCursor::right(this, QTextCursor::KeepAnchor);
|
||||
else
|
||||
QLineEdit::keyPressEvent(event);
|
||||
} else {
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void FancyLineEdit::setCamelCaseNavigationEnabled(bool enabled)
|
||||
|
Reference in New Issue
Block a user