[PC3 Button] Don't remain in a pressed state after press
AcceptedPublic

Authored by filipf on May 14 2020, 10:30 AM.

Details

Reviewers
davidedmundson
mart
ngraham
Group Reviewers
Plasma
Summary

We have two interfering button background items right now:

  • surfaceNormal when it has activeFocus and is using using the "focus-background" item
  • surfacePressed

After a button is pressed surfacePressed correctly disappears but surfaceNormal remains in the "focus-background" state, thereby making the button still look pressed.

The problem is that the button still has activeFocus even after a press.

To solve this we switch the "focus-background" to only show up on visualFocus. Per Qt documentation on visual Focus:
"In general, for visualizing key focus, this property is preferred over Item::activeFocus. This ensures that key focus is only visualized when interacting with keys - not when interacting via touch or mouse."

Given that we have surfacePressed for focus accomplished with a mouse or touch, visualFocus will only detect tabbing and therefore the button no longer remains pressed after a press and now behaves like its PC2 counterpart.

Test Plan

Tabbed and pressed a PC3 button.

Diff Detail

Repository
R242 Plasma Framework (Library)
Branch
dont-remain-pressed (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26889
Build 26907: arc lint + arc unit
filipf created this revision.May 14 2020, 10:30 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 14 2020, 10:30 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
filipf requested review of this revision.May 14 2020, 10:30 AM
filipf edited the summary of this revision. (Show Details)May 14 2020, 10:33 AM
filipf edited the test plan for this revision. (Show Details)
filipf added reviewers: davidedmundson, mart, Plasma.
ngraham accepted this revision.May 14 2020, 2:59 PM
This revision is now accepted and ready to land.May 14 2020, 2:59 PM

The more I think about this the more it feels like a workaround. Presuming QQC2's behavior of leaving a pressed button focused after press is correct, perhaps we are at fault for providing the same svg for focus-background and pressed.

ndavis added a subscriber: ndavis.EditedMay 14 2020, 7:08 PM

The more I think about this the more it feels like a workaround. Presuming QQC2's behavior of leaving a pressed button focused after press is correct, perhaps we are at fault for providing the same svg for focus-background and pressed.

That was one of the issues I was trying to fix while working on a new style for buttons in the QStyle. I believe one of the things I tried was making a special pressed and focused state.