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)
|
void FancyLineEdit::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
const QTextCursor::MoveMode mode = (event->modifiers() & Qt::ShiftModifier)
|
if (camelCaseNavigation) {
|
||||||
? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor;
|
if (event == QKeySequence::MoveToPreviousWord)
|
||||||
|
CamelCaseCursor::left(this, QTextCursor::MoveAnchor);
|
||||||
if (camelCaseNavigation && event == QKeySequence::MoveToPreviousWord)
|
else if (event == QKeySequence::SelectPreviousWord)
|
||||||
CamelCaseCursor::left(this, mode);
|
CamelCaseCursor::left(this, QTextCursor::KeepAnchor);
|
||||||
else if (camelCaseNavigation && event == QKeySequence::MoveToNextWord)
|
else if (event == QKeySequence::MoveToNextWord)
|
||||||
CamelCaseCursor::right(this, mode);
|
CamelCaseCursor::right(this, QTextCursor::MoveAnchor);
|
||||||
else
|
else if (event == QKeySequence::SelectNextWord)
|
||||||
|
CamelCaseCursor::right(this, QTextCursor::KeepAnchor);
|
||||||
|
else
|
||||||
|
QLineEdit::keyPressEvent(event);
|
||||||
|
} else {
|
||||||
QLineEdit::keyPressEvent(event);
|
QLineEdit::keyPressEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyLineEdit::setCamelCaseNavigationEnabled(bool enabled)
|
void FancyLineEdit::setCamelCaseNavigationEnabled(bool enabled)
|
||||||
|
Reference in New Issue
Block a user