Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_node_shape.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#include "kis_node_shape.h"
8
9#include <KoCanvasBase.h>
10#include <KoCanvasController.h>
11#include <KoSelection.h>
12#include <KoToolManager.h>
13
14#include <kis_types.h>
15#include <kis_layer.h>
16#include <kis_node.h>
17
19#include "kis_shape_layer.h"
20
21
23{
24public:
26};
27
29 : KoShapeLayer()
30 , m_d(new Private())
31{
32
33 m_d->node = node;
34
36
37 setSelectable(false);
38
39 connect(node, SIGNAL(sigNodeChangedInternal()), SLOT(editabilityChanged()));
40 editabilityChanged(); // Correctly set the lock at loading
41}
42
44{
45 delete m_d;
46}
47
49{
50 return m_d->node;
51}
52
54{
55 bool found(false);
56 KoShapeLayer *layer = activeLayer;
57
58 while(layer && !(found = layer == this)) {
59 layer = dynamic_cast<KoShapeLayer*>(layer->parent());
60 }
61
62 return found;
63}
64
66{
67 if (m_d->node->inherits("KisShapeLayer")) {
69 } else {
71 }
72
73 Q_FOREACH (KoShape *shape, this->shapes()) {
74 KisNodeShape *node = dynamic_cast<KisNodeShape*>(shape);
75 KIS_SAFE_ASSERT_RECOVER(node) { continue; }
76 if (node) {
77 node->editabilityChanged();
78 }
79 }
80}
81
82QSizeF KisNodeShape::size() const
83{
84 return boundingRect().size();
85}
86
88{
89 return QRectF();
90}
91
92void KisNodeShape::setPosition(const QPointF &)
93{
94}
95
96void KisNodeShape::paint(QPainter &) const
97{
98}
void editabilityChanged()
QSizeF size() const override
Get the size of the shape in pt.
void paint(QPainter &painter) const override
Paint the shape fill The class extending this one is responsible for painting itself....
KisNodeSP node()
Private *const m_d
void setPosition(const QPointF &) override
Set the position of the shape in pt.
bool checkIfDescendant(KoShapeLayer *activeLayer)
QRectF boundingRect() const override
Get the bounding box of the shape.
KisNodeShape(KisNodeSP node)
~KisNodeShape() override
QList< KoShape * > shapes() const
void setSelectable(bool selectable)
Definition KoShape.cpp:827
KoShapeContainer * parent() const
Definition KoShape.cpp:860
void setGeometryProtected(bool on)
Definition KoShape.cpp:837
void setShapeId(const QString &id)
Definition KoShape.cpp:883
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
#define KIS_NODE_SHAPE_ID
bool isEditable(bool checkVisibility=true) const