Allow creation of separator Actions
ClosedPublic

Authored by dkardarakos on Aug 29 2018, 12:16 PM.

Details

Summary

The QAction class allows an action to be considered a separator. In Kirigami Action the separator property has been added to serve the same purpose. A set of delegates have been changed to draw a separator in case that an Action with separator:true has been found in the model.

Test Plan

Add contextual or global actions like this:

Kirigami.Action {

separator: true

}

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.
dkardarakos created this revision.Aug 29 2018, 12:16 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptAug 29 2018, 12:16 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
dkardarakos requested review of this revision.Aug 29 2018, 12:16 PM
broulik added inline comments.
src/controls/Action.qml
172

That function is superfluous, you have the property after all

src/controls/private/ActionsMenu.qml
55

if (action.separator)?

isSeparator function has been added to ensure compatibility with QAction https://doc.qt.io/qt-5/qaction.html#isSeparator. We do not need it?

broulik added a comment.EditedAug 29 2018, 1:02 PM

QAction::isSeparator() is for use in C++, that method is neither a slot nor Q_INVOKABLE so you cannot use it from QML anyway.

dkardarakos edited the summary of this revision. (Show Details)

Function isSeparator removed

mart requested changes to this revision.Sep 24 2018, 11:53 AM

i don't think it's necessary to put separatordelegate in the public api, it can be something local in globaldrawer and contextdrawer directly, without adding new properties that will be needed only there

This revision now requires changes to proceed.Sep 24 2018, 11:53 AM

Previously introduced "separator mode" removed from AbstractListItem and BasicListItem.

Instead of a solution totally inside globaldrawer and contextdrawer I opted for a new BasicListItem alias property (reserveSpaceForLabel) similar to the existing reserveSpaceForIcon. With this approach we have more control when adding new items (like the Separator) to BasicListItems.

mart accepted this revision.Oct 1 2018, 9:51 AM

Previously introduced "separator mode" removed from AbstractListItem and BasicListItem.

Instead of a solution totally inside globaldrawer and contextdrawer I opted for a new BasicListItem alias property (reserveSpaceForLabel) similar to the existing reserveSpaceForIcon. With this approach we have more control when adding new items (like the Separator) to BasicListItems.

hmm, ok, let's try to go with this

This revision is now accepted and ready to land.Oct 1 2018, 9:51 AM
This revision was automatically updated to reflect the committed changes.