Fix KEditListWidget losing the focus on click of buttons
ClosedPublic

Authored by kossebau on Feb 1 2017, 12:33 PM.

Details

Summary

E.g. when the user triggers the Add button by keyboard focus or mouse,
the button has focus when it gets disabled in the addItem() handler.
Which results in the focus being passed on, to whatever next widget
in the tab focus order(?) which can get focus. Inside KEditListWidget
these are only the other buttons, which are usually disabled when an
item is added, so the focus is moved out of the KEditListWidget.
Which usually makes no sense, as the user may want to do more actions
on the list, until explicitly leaving the scene.
Same for Remove button, which on removing the last item before also
dropped the focus to the outside.
There is some flawed logic in updateButtonState() WRT up/down button
enabling compared to enableMoveButtons(), but to fix/improve this
is left to another patch/person.

Test Plan

Usages of KListEditWidget in KDevelop's "New from Template..." dialog,
e.g. in the test cases of class data pages, no longer are frustrating,
as no longer will the focus move to the "Back" dialog button after
clicking "Add" or when removing the last item by the "Remove" button.

Diff Detail

Repository
R236 KWidgetsAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau updated this revision to Diff 10811.Feb 1 2017, 12:33 PM
kossebau retitled this revision from to Fix KEditListWidget losing the focus on click of Add button.
kossebau updated this object.
kossebau edited the test plan for this revision. (Show Details)
kossebau added a reviewer: Frameworks.
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 1 2017, 12:33 PM
kossebau updated this revision to Diff 10817.Feb 1 2017, 1:28 PM

Update to catch some more unwanted focus losts

kossebau updated this revision to Diff 10818.Feb 1 2017, 1:29 PM

remove QDebug include again

kossebau retitled this revision from Fix KEditListWidget losing the focus on click of Add button to Fix KEditListWidget losing the focus on click of buttons.Feb 1 2017, 1:38 PM
kossebau updated this object.
kossebau edited the test plan for this revision. (Show Details)
cfeck added a subscriber: cfeck.Feb 2 2017, 12:50 AM
cfeck added inline comments.
src/keditlistwidget.cpp
153

Please use "Type *ptr" instead of "Type* ptr" throughout.

kossebau updated this revision to Diff 10836.Feb 2 2017, 1:34 AM
kossebau marked an inline comment as done.

adapt to local syntax style for pointer types

@cfeck, thanks for review so far. No(one a) further comment on this fix? Will push on Feb 15th then unless someone objects.

dfaure accepted this revision.Feb 12 2017, 8:48 AM
dfaure added a reviewer: dfaure.
This revision is now accepted and ready to land.Feb 12 2017, 8:48 AM
This revision was automatically updated to reflect the committed changes.