checkable FormLayout items
ClosedPublic

Authored by progwolff on Mar 13 2018, 3:12 PM.

Details

Summary

In some cases, form items go together with a checkbox which can be used to disable the item.
An example for such an item is the line edit in the first row of the screenlocker kcm.
Here, a checkbox is prepended to the line edit's label.

In Kirigami, there is (afaik) no way to add a widget to a FormLayout item's buddyComponent.
This patch adds an optional checkbox to the buddyComponent.

A place where I would like to use this is the fonts kcm: https://phabricator.kde.org/T7927#132277

Test Plan

I added a checkable item to the FormLayout gallery page.

I also rewrote the fonts kcm (not comitted yet), which now looks like this:

Diff Detail

Repository
R169 Kirigami
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
progwolff created this revision.Mar 13 2018, 3:12 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptMar 13 2018, 3:12 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
progwolff requested review of this revision.Mar 13 2018, 3:12 PM
progwolff edited the summary of this revision. (Show Details)Mar 13 2018, 3:13 PM
progwolff edited the summary of this revision. (Show Details)Mar 13 2018, 3:18 PM
mart added a subscriber: mart.Mar 19 2018, 4:20 PM

can you provide screenshots as well t see how does it look?

src/controls/templates/FormLayout.qml
189

what i'm concerned is that this makes every field a checkbox, no matter if it should or should not be one.

217

should the behavior of the shortcut change to toggle the checkbox instead when the item is checkable?

230

What's this rectangle about?

src/formlayoutattached.h
110

api wise an "enabled" property doesn't have anything to do with checkboxes

progwolff edited the test plan for this revision. (Show Details)Mar 19 2018, 4:57 PM
progwolff planned changes to this revision.Mar 19 2018, 5:00 PM
In D11289#229340, @mart wrote:

can you provide screenshots as well t see how does it look?

I added one under "test plan".

src/controls/templates/FormLayout.qml
217

Good idea!

230

It highlights the label when the checkbox is in focus. You can see it in the new screenshot under "test plan".
This part is stolen from PlasmaComponents: https://api.kde.org/frameworks/plasma-framework/html/CheckBoxStyle_8qml_source.html line 30

src/formlayoutattached.h
110

It has nothing to do with checkboxes in particular. Here it is used as a combined enabled for the buddy component.
How would you call it?

progwolff updated this revision to Diff 29937.Mar 19 2018, 5:50 PM
progwolff marked 3 inline comments as done.
  • split buddyComponent and checkableBuddyComponent
  • toggle checkbox on shortcut activated
mart accepted this revision.Apr 9 2018, 3:31 PM
This revision is now accepted and ready to land.Apr 9 2018, 3:31 PM
This revision was automatically updated to reflect the committed changes.