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.
Details
- Reviewers
mart - Commits
- R169:91ea75c37045: Allow creation of separator Actions
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.
isSeparator function has been added to ensure compatibility with QAction https://doc.qt.io/qt-5/qaction.html#isSeparator. We do not need it?
QAction::isSeparator() is for use in C++, that method is neither a slot nor Q_INVOKABLE so you cannot use it from QML anyway.
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
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.