diff options
author | Marcel Krems <m.krems@software-vision.eu> | 2014-08-12 13:10:08 +0200 |
---|---|---|
committer | Marcel Krems <m.krems@software-vision.eu> | 2014-08-12 14:56:23 +0200 |
commit | 9f486efcbe5ca0f5bb8ba895c4931a5e30748ed6 (patch) | |
tree | d098eb86b3573cbf9d18aa74eca6c896b9fa45e3 | |
parent | 296142ba053309820ab25568e234dd24b15b3a91 (diff) |
Show the correct cursor for QLineEdit's side buttons.
Task-number: QTBUG-40708
Change-Id: I5869f42bab3a27085b5572a4b83b16c39a67f733
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r-- | src/widgets/widgets/qlineedit_p.cpp | 3 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 10689b2fc3..d19fe43eb2 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -309,7 +309,6 @@ QLineEditIconButton::QLineEditIconButton(QWidget *parent) : QToolButton(parent) , m_opacity(0) { - updateCursor(); setFocusPolicy(Qt::NoFocus); } @@ -333,6 +332,7 @@ void QLineEditIconButton::setOpacity(qreal value) { if (!qFuzzyCompare(m_opacity, value)) { m_opacity = value; + updateCursor(); update(); } } @@ -340,7 +340,6 @@ void QLineEditIconButton::setOpacity(qreal value) void QLineEditIconButton::startOpacityAnimation(qreal endValue) { QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity")); - connect(animation, &QAbstractAnimation::finished, this, &QLineEditIconButton::updateCursor); animation->setDuration(160); animation->setEndValue(endValue); animation->start(QAbstractAnimation::DeleteWhenStopped); diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 36f14cb1ba..2d050cd5fa 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -4182,10 +4182,12 @@ void tst_QLineEdit::clearButton() QVERIFY(clearButton); QCOMPARE(filterModel->rowCount(), 3); QTest::keyClick(filterLineEdit, 'a'); + QTRY_COMPARE(clearButton->cursor().shape(), Qt::ArrowCursor); QTRY_COMPARE(filterModel->rowCount(), 2); // matches 'aa', 'ab' QTest::keyClick(filterLineEdit, 'b'); QTRY_COMPARE(filterModel->rowCount(), 1); // matches 'ab' QTest::mouseClick(clearButton, Qt::LeftButton, 0, QRect(QPoint(0, 0), clearButton->size()).center()); + QTRY_COMPARE(clearButton->cursor().shape(), filterLineEdit->cursor().shape()); QTRY_COMPARE(filterModel->rowCount(), 3); filterLineEdit->setReadOnly(true); // QTBUG-34315 @@ -4215,6 +4217,8 @@ void tst_QLineEdit::sideWidgets() testWidget.move(300, 300); testWidget.show(); QVERIFY(QTest::qWaitForWindowExposed(&testWidget)); + foreach (QToolButton *button, lineEdit->findChildren<QToolButton *>()) + QCOMPARE(button->cursor().shape(), Qt::ArrowCursor); // Arbitrarily add/remove actions, trying to detect crashes. Add QTRY_VERIFY(false) to view the result. delete label3Action; lineEdit->removeAction(label2Action); |