toolbarlayout: addAction(): return early if action is empty
In my applications I have a component/file where I declare all the actions and I also add them to a QQmlPropertyMap for easy access throught the app (qml side).
The problem is with adding these actions to a Kirigami.ActionToolBar, I keep getting lots of unknown() : QObject::connect(QObject, ToolBarLayout): invalid nullptr parameter
messages in the terminal.
// main.cpp
engine.rootContext()->setContextProperty("appActions", new QQmlPropertyMap);
// Actions.qml
Kirigami.Action {
objectName: "openSettingsAction"
...
Component.onCompleted: appActions[objectName] = this
}
// Header.qml
Kirigami.ActionToolBar {
actions: [
appActions.openSettingsAction,
...
]
}
The issue, I think, is that when Kirigami.ActionToolBar
is created the actions are not ready so an empty action (nullptr) is passed to the ToolBarLayout::addAction(QObject *action)
method, resulting in the above warning message.