Don't call click on the delegate, when we just want it to become current item
AbandonedPublic

Authored by leinir on May 3 2019, 9:25 AM.

Details

Reviewers
ngraham
Summary

If you have any actions in your GridDelegate, activating them would previously
cause the delegate's onClicked signal to fire, which isn't always desirable.

The logic behind the original code was that it was supposed to set that item
as the current one in the gridview, so a little bit of working around nested
delegates (understandably) not forwarding models, and we have the ability to
set the delegate as the current item.

Test Plan

See any KCM which performs an action on clicking the thumbnail, and which has actions

  • Prior to patch, both the action and the thumbnail slot would be called
  • With this patch, only the action is called

Diff Detail

Repository
R296 KDeclarative
Branch
dont-click-just-set-current (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 11484
Build 11502: arc lint + arc unit
leinir created this revision.May 3 2019, 9:25 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 3 2019, 9:25 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
leinir requested review of this revision.May 3 2019, 9:25 AM
broulik added a subscriber: broulik.EditedMay 3 2019, 9:42 AM

-1

Most KCMs actually use onClicked to update the selected plugin and other bits. They don't actually set currentIndex on the ListView directly but have it updated based on whatever current scheme or theme etc is selected.

Can it be fixed such that the onClicked isn't fired when the action is invoked? From what I can see the actions don't rely on currentIndex

leinir added a comment.May 3 2019, 9:47 AM

-1

Most KCMs actually use onClicked to update the selected plugin and other bits. They don't actually set currentIndex on the ListView directly but have it updated based on whatever current scheme or theme etc is selected.

Can it be fixed such that the onClicked isn't fired when the action is invoked? From what I can see the actions don't rely on currentIndex

Unless i'm misunderstanding you, that's precisely what this code does - onClicked still gets triggered when clicking the thumbnail itself, this patch only affects the action buttons. The previous code was specifically added to set the current index, according to Nate in https://phabricator.kde.org/D18649#459586 :)

oh, crap, right, I thought that was the delegate code, not the buttons.

I think it just shouldn't do anything then since when changing the currentIndex if the KCM isn't prepared for that might cause the visual index and actual selected setting to become out of sync.

leinir abandoned this revision.Mar 23 2020, 1:24 PM

No longer needed