D29148: [KJotsWidget] Don't switch focus to KJotsEdit on dataChanged
Igor Poboiko
noreply at phabricator.kde.org
Fri Apr 24 11:50:37 BST 2020
poboiko created this revision.
poboiko added a reviewer: dvratil.
Herald added a project: KDE PIM.
poboiko requested review of this revision.
REVISION SUMMARY
It's reasonable to switch focus to `KJotsEdit` when user changes selection,
so it's possible to start editing the note immediately after selecting it.
However, it's unreasonable to do it on `dataChange`, as it's not necessarily associated
with some explicit user action (and we don't want focus to randomly jump unless user exlicitly wants it).
Also, don't use `const_cast` for `QAbstractSelectionModel::model()` and use `non-const` overload instead.
This fixes following frustrating issue:
1. User tries to switch focus i.e. to `KFontChooser` to pick font he wants
2. `KJotsEdit` catches `focusOutEvent` and does the autosave (`savePage` call)
3. Autosave modifies the underlying data in the model via `model()->setData()`
4. Selection model inside `KJotsWidget` catches `dataChanged` signal and calls `renderSelection` slot
5. It switches focus back to `KJotsEdit`
so user has to press onto the `KFontChooser` second time (the same issue does not trigger again
because autosave is skipped when document is not modified)
TEST PLAN
The described issue does not trigger again
REPOSITORY
R573 KJots
BRANCH
focus (branched from master)
REVISION DETAIL
https://phabricator.kde.org/D29148
AFFECTED FILES
src/kjotsedit.cpp
src/kjotswidget.cpp
src/kjotswidget.h
To: poboiko, dvratil
Cc: kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200424/c3006ce3/attachment.html>
More information about the kde-pim
mailing list