diff options
author | Daniel Teske <qt@squorn.de> | 2017-06-15 15:07:35 +0200 |
---|---|---|
committer | Daniel Teske <qt@squorn.de> | 2019-11-15 13:40:05 +0200 |
commit | 9f48f1ebc21f783cd8bb7daab942d70aebf085bc (patch) | |
tree | 1b1642291122889739d39168e6b47527605f2ccf /tests/auto/widgets/widgets | |
parent | c15a069830baf87f57c84e86326cf86ba9a39713 (diff) |
QLineEdit: Fix End key for input masks
Consider this simple example:
QLineEdit edit;
edit.setInputMask( "9-9-9-9-9-9" );
edit.show();
Without any input, m_text will contain: " - - - - - ". text() removes
the input mask's mask characters from that and returns " ". A string
with 6 spaces. Thus currently the End key jumps to position 6, which is
in the middle of the string. Using m_text the End key jumps to the actual
end.
[ChangeLog][QtWidgets][QLineEdit] Fixed End key in combination with
certain input masks.
Task-number: QTBUG-16187
Task-number: QTBUG-20414
Change-Id: Ibb30a1dfa2f78103611b5afc9971dc43e8bdcc4a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r-- | tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 0cfbc651ad..d37fb5c173 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -762,6 +762,14 @@ void tst_QLineEdit::keypress_inputMask_data() } { QTestEventList keys; + // inserting at end + addKeySequenceStandardKey(keys, QKeySequence::MoveToEndOfLine); + keys.addKeyClick(Qt::Key_Left); + keys.addKeyClick(Qt::Key_0); + QTest::newRow("insert at end") << QString("9-9-9") << keys << QString("--0") << QString(" - -0"); + } + { + QTestEventList keys; // inserting '12.12' then two backspaces addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine); keys.addKeyClick(Qt::Key_1); |