The ideal is to be able to add regular qqc2 actions to the actiontoolbar, pageheaders, globaldrawers and different components, and make kirigami.action based on qqc2.action, so implementations are not duplicated.
Details
- Reviewers
mart - Group Reviewers
Kirigami - Commits
- R169:fd8fec5b8923: Allow usage of QQC2 actions on Kirigami components and now make K.Action based…
So far i have tested this with different kirigami components, such as pageheadertoolbar, globaldrawers, kirigamiactiontoolbar, and it is working.
There is an issue now with the PrivateActionToolButton, since K.Actions is based on QQC2.Action, it make sthe control to draw two icons, one from PrivateActionToolBar own contentItem implementation and another one from the style background
I will continue testing this, and pls let me know how i could proceed better with the PrivateActionToolButton issue.
Diff Detail
- Repository
- R169 Kirigami
- Branch
- k-action-to-qqc2-action (branched from master)
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 15089 Build 15107: arc lint + arc unit
WRT the two icons, maybe it would make sense to populate only the bits we want instead of using the action property? i.e. we can keep a kirigamiAction property for now. This patch is far too big as is already. I would even suggest doing the Kirigami.Action rebase first and then do the other one in different commits.
src/controls/Action.qml | ||
---|---|---|
51–52 | Can you check that we're not missing some API? is ActionIconGroup a subset of what Qt offers? | |
src/controls/ActionToolBar.qml | ||
184 | If ourAction doesn't have a visible property, won't ourAction.visible be undefined? | |
src/controls/private/PrivateActionToolButton.qml | ||
25–26 | Remove TODO? | |
26 | Wouldn't it be control.action.icon.name? |
I have worked on the duplicating icons, by not using the contentItem to draw the icons and label, and instead use the style implementation. The only thing missing would be the dropdown icon for actions with submenus, I'm anchoring that icon to the right con the contentItem. I will update this patch.
I will push my proposal for duplicating icons, it can be reviewed. And then I can split this patch into different parts as suggested by Aleix.
src/controls/Action.qml | ||
---|---|---|
51–52 | from Kirigami actionIconGroup: from QQC2 icon property: | |
src/controls/ActionToolBar.qml | ||
184 | I think it then gets marked as visible = true | |
src/controls/private/PrivateActionToolButton.qml | ||
26 | yes. fixed now on new commit |
further changes to make components work with new Kirigami.Action based on QQC2.Action, and proposed solution to draw the PrivateActionToolButton.
The dropDown icon for PrivateActionToolButton is not yet perfect. I'm trying new things to make it fit the actual ToolButton background.
I've tried to be super careful with the changes, and have tested them over the kirigami examples, kirigami-gallery and Maui apps, and it all seems to work okay, except, the dropDown icon overlapping.
src/controls/ActionToolBar.qml | ||
---|---|---|
184 | You were right, I have now fixed it. |
good direction, unfortunately we can't remove the custom toolbutton contentitem yet, so for now let's keep the custom icon group
src/controls/Action.qml | ||
---|---|---|
51–52 | ok, please remove all code that you commented out |
fallback to custom kirigamiAction property for PrivateActionToolButton
- useage of the fallback property due to: if we use QQC2.ToolButton default action property then the style will draw the content, and since this component draws the dropDown icon it still needs to be able to draw its own content in place, so the kirigamiAction hides the action prop and then avoids duplicating of icons.
Still, an ideal solution would be to be able to let the style draw the content, but there was not an easy way to anchors the dropDown icon in a nice manner by relaying on the style.
The solution here was to add back the kirigamiAction property to the PrivateActionToolButton, so it avoids the QQC2.ToolButton action prop
This patch breaks compatibility with Qt5.11 where Qt Quick Controls2 is in version 2.4.
I noticed it after Debian upgraded the package and I am unable to let Elisa run with it. I will try to work on a fix.