diff options
Diffstat (limited to 'src/gui/widgets/qlineedit.cpp')
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 2d2df92278..f041a36d86 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -738,8 +738,14 @@ bool QLineEdit::validateAndSet(const QString &newText, int newPos, setText(oldText); return false; } - setCursorPosition(newPos); - setSelection(qMin(newMarkAnchor, newMarkDrag), qAbs(newMarkAnchor - newMarkDrag)); + int selstart = qMin(newMarkAnchor, newMarkDrag); + int sellength = qAbs(newMarkAnchor - newMarkDrag); + if (selstart == newPos) { + selstart = qMax(newMarkAnchor, newMarkDrag); + sellength = -sellength; + } + //setSelection also set the position + setSelection(selstart, sellength); return true; } #endif //QT3_SUPPORT |