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.
- Group Reviewers
- 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.
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.
Can you check that we're not missing some API? is ActionIconGroup a subset of what Qt offers?
If ourAction doesn't have a visible property, won't ourAction.visible be undefined?
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.
from Kirigami actionIconGroup:
from QQC2 icon property:
I think it then gets marked as visible = true
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.
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.