summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/widgets/qlineedit.cpp3
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp40
2 files changed, 42 insertions, 1 deletions
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index aad75207a1..a193e6d576 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1747,12 +1747,13 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
/*!
\reimp
*/
-void QLineEdit::keyReleaseEvent(QKeyEvent *)
+void QLineEdit::keyReleaseEvent(QKeyEvent *e)
{
Q_D(QLineEdit);
if (!isReadOnly())
d->handleSoftwareInputPanel();
d->control->updateCursorBlinking();
+ QWidget::keyReleaseEvent(e);
}
/*!
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index efd59059d0..0a4b33553d 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -292,6 +292,8 @@ private slots:
void QTBUG_60319_setInputMaskCheckImSurroundingText();
void testQuickSelectionWithMouse();
void inputRejected();
+ void keyReleasePropagates();
+
protected slots:
void editingFinished();
@@ -5143,5 +5145,43 @@ void tst_QLineEdit::inputRejected()
QCOMPARE(spyInputRejected.size(), 2);
}
+void tst_QLineEdit::keyReleasePropagates()
+{
+ struct Dialog : QWidget
+ {
+ QLineEdit *lineEdit;
+ int releasedKey = {};
+
+ Dialog()
+ {
+ lineEdit = new QLineEdit;
+ QHBoxLayout *hbox = new QHBoxLayout;
+
+ hbox->addWidget(lineEdit);
+ setLayout(hbox);
+ }
+
+ protected:
+ void keyReleaseEvent(QKeyEvent *e)
+ {
+ releasedKey = e->key();
+ }
+ } dialog;
+
+ dialog.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+
+ QTest::keyPress(dialog.lineEdit, Qt::Key_A);
+ QTest::keyRelease(dialog.lineEdit, Qt::Key_A);
+
+ QCOMPARE(dialog.releasedKey, Qt::Key_A);
+
+ QTest::keyPress(dialog.lineEdit, Qt::Key_Alt);
+ QTest::keyRelease(dialog.lineEdit, Qt::Key_Alt);
+
+ QCOMPARE(dialog.releasedKey, Qt::Key_Alt);
+}
+
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"