Add a displayHint property to Action
ClosedPublic

Authored by ahiemstra on Nov 6 2019, 6:40 PM.

Details

Summary

This property can be used to indicate preferences on how to display the
action to implementations using Action. It mimics some of the behaviour
of QAction's priority property, but is more explicit and allows some
behaviour the priority property would not.

Additionally, this changes PrivateActionToolButton to make use of the
displayHint property for its showText and showMenuArrow properties.

Test Plan

Tool buttons created through actions in Kirigami gallery still show
their text and menu arrows.

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.
ahiemstra created this revision.Nov 6 2019, 6:40 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptNov 6 2019, 6:40 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ahiemstra requested review of this revision.Nov 6 2019, 6:40 PM
leinir added a subscriber: leinir.Nov 7 2019, 9:40 AM
leinir added inline comments.
src/controls/Action.qml
128

Might be nice to have a DisplayHint.NoHint value, to make it more explicit what that 0 means

broulik added inline comments.
src/controls/Action.qml
128

Isn't it more like a "no preference" value?
Also, please document the default value

leinir added inline comments.Nov 7 2019, 11:00 AM
src/controls/Action.qml
128

You're right, NoPreference would probably be more linguistically correct... i was more thinking along the lines of, if the default means there is no preferred hint, then NoHint would be it... either would be fine for me, though :)

ahiemstra updated this revision to Diff 69462.Nov 8 2019, 4:02 PM
  • Add and use DisplayHint.NoPreference value for displayHint default
ahiemstra marked 3 inline comments as done.Nov 8 2019, 4:04 PM
ahiemstra added inline comments.
src/controls/Action.qml
128

I have added a NoPreference value which is now the default and documented as such. I went with the NoPreference suggestion since that makes it more clear when overriding displayHint in other places.

mart accepted this revision.Nov 11 2019, 11:43 AM
This revision is now accepted and ready to land.Nov 11 2019, 11:43 AM
This revision was automatically updated to reflect the committed changes.
ahiemstra marked an inline comment as done.