KDateComboBox: fix dateChanged() not emitted after typing a date
ClosedPublic

Authored by dfaure on Nov 19 2017, 11:45 PM.

Details

Summary

When editing an event in korganizer, if I was typing digits
to edit a date, rather than using another method (date popup; key_up;
etc.), then the change wouldn't be saved.

I would say that on focus-out or Key_Enter, we want to "commit"
the edited date into the final date as desired by the user, by emitting
dateEntered() and dateChanged(), to match the other edit methods.

The documentation clarifies what I think was the intent of the 3
signals, and the unittest checks that the signals are emitted
accordingly.

BUG: 364200

Test Plan

Unittest passes; korganizer use case is fixed.

Diff Detail

Repository
R236 KWidgetsAddons
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
dfaure created this revision.Nov 19 2017, 11:45 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptNov 19 2017, 11:45 PM
anthonyfieroni added inline comments.
src/kdatecombobox.cpp
350–351

Why not

d->enterDate(date());

?

dfaure added inline comments.Nov 20 2017, 8:25 AM
src/kdatecombobox.cpp
350–351

Good point, enterDate() enables the warning-on-invalid when this option is set, and I suppose we want that on Key_Return as well.
However I still need to emit dateChanged(), since setDate() doesn't do that in this case (it thinks the date hasn't changed, given that we're calling setDate(date())).

dfaure updated this revision to Diff 22624.Nov 20 2017, 8:26 AM

use enterDate; don't emit changed if nothing changed

mlaurent accepted this revision.Jan 15 2018, 4:02 PM
mlaurent added a subscriber: mlaurent.

Otherwise all is good. +2 with the QVERIFY(...)

autotests/kdatecomboboxtest.cpp
182

QVERIFY(QTest::qWa...)

This revision is now accepted and ready to land.Jan 15 2018, 4:02 PM
dfaure updated this revision to Diff 25443.Jan 16 2018, 8:56 AM

add QVERIFY

mlaurent accepted this revision.Jan 16 2018, 9:32 AM
dfaure closed this revision.Jan 24 2018, 10:36 AM