Krita Source Code Documentation
Loading...
Searching...
No Matches
KisNodeActivationActionCreatorVisitor.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Halla Rempt <halla@valdyas.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
7
8#include <kis_node_manager.h>
9#include <klocalizedstring.h>
10#include <kactioncollection.h>
11#include <QObject>
12#include <kis_projection_leaf.h>
13
15 : m_nodeManager(nodeManager)
16 , m_actionCollection(actionCollection)
17{
18}
19
20
22{
23 if (!node->projectionLeaf()->isRoot()) {
24 QAction *action = new QAction(i18nc("A temporary action that actives a layer or mask",
25 "Activate %1", node->name()),
27 action->setObjectName(QString("select_%1").arg(node->name()));
28 action->setProperty("node", node->name());
29 action->setIcon(node->icon());
30 QObject::connect(action, SIGNAL(triggered()), m_nodeManager, SLOT(slotUiActivateNode()));
31 m_actionCollection->addAction(action->objectName(), action);
32 }
33
34 visitAll(node);
35
36 return true;
37}
A container for a set of QAction objects.
Q_INVOKABLE QAction * addAction(const QString &name, QAction *action)
KisNodeActivationActionCreatorVisitor(KisKActionCollection *actionCollection, KisNodeManager *nodeManager)
bool visitAll(KisNode *node, bool breakOnFail=false)
QString name() const
virtual QIcon icon() const
KisProjectionLeafSP projectionLeaf
Definition kis_node.cpp:93