Krita Source Code Documentation
Loading...
Searching...
No Matches
KisNodeDummy Class Reference

#include <kis_node_dummies_graph.h>

+ Inheritance diagram for KisNodeDummy:

Public Member Functions

KisNodeDummyat (int index) const
 
int childCount () const
 
KisNodeDummyfirstChild () const
 
int indexOf (KisNodeDummy *child) const
 
bool isGUIVisible (bool showGlobalSelection) const
 
 KisNodeDummy (KisNodeShape *nodeShape, KisNodeSP node)
 
KisNodeDummylastChild () const
 
KisNodeDummynextSibling () const
 
KisNodeSP node () const
 
KisNodeDummyparent () const
 
KisNodeDummyprevSibling () const
 
 ~KisNodeDummy () override
 

Private Member Functions

KisNodeShapenodeShape () const
 

Private Attributes

QList< KisNodeDummy * > m_children
 
KisNodeSP m_node
 
KisNodeShapem_nodeShape
 

Friends

class KisNodeDummiesGraph
 
class KisNodeShapesGraph
 
class KisNodeShapesGraphTest
 

Detailed Description

KisNodeDummy is a simplified representation of a node in the node stack. It stores all the hierarchy information about the node, so you needn't access from the node directly (actually, you cannot do it usually, because UI works in a different thread and race conditions are possible).

The dummy stores a KisNodeShape which can store a pointer to to node. You can access to the node data through it, but take care – not all the information is accessible in multithreading environment.

The ownership on the KisNodeShape is taken by the dummy. The ownership on the children of the dummy is taken as well.

Definition at line 35 of file kis_node_dummies_graph.h.

Constructor & Destructor Documentation

◆ KisNodeDummy()

KisNodeDummy::KisNodeDummy ( KisNodeShape * nodeShape,
KisNodeSP node )

Take care that KisNodeDummy does not take ownership over the nodeShape since the handling of the removal of the children of the shape is done by flake. So please handle it manually.

The children dummies of the dummy are still owned by the dummy and are deleted automatically.

Definition at line 16 of file kis_node_dummies_graph.cpp.

19{
20}
KisNodeShape * nodeShape() const
KisNodeSP node() const
KisNodeShape * m_nodeShape

◆ ~KisNodeDummy()

KisNodeDummy::~KisNodeDummy ( )
override

Definition at line 22 of file kis_node_dummies_graph.cpp.

23{
24 qDeleteAll(m_children);
25}
QList< KisNodeDummy * > m_children

References m_children.

Member Function Documentation

◆ at()

KisNodeDummy * KisNodeDummy::at ( int index) const

Definition at line 87 of file kis_node_dummies_graph.cpp.

88{
89 return m_children.at(index);
90}

References m_children.

◆ childCount()

int KisNodeDummy::childCount ( ) const

Definition at line 92 of file kis_node_dummies_graph.cpp.

93{
94 return m_children.size();
95}

References m_children.

◆ firstChild()

KisNodeDummy * KisNodeDummy::firstChild ( ) const

Definition at line 27 of file kis_node_dummies_graph.cpp.

28{
29 return !m_children.isEmpty() ? m_children.first() : 0;
30}

References m_children.

◆ indexOf()

int KisNodeDummy::indexOf ( KisNodeDummy * child) const

Definition at line 97 of file kis_node_dummies_graph.cpp.

98{
99 return m_children.indexOf(child);
100}

References m_children.

◆ isGUIVisible()

bool KisNodeDummy::isGUIVisible ( bool showGlobalSelection) const

Definition at line 75 of file kis_node_dummies_graph.cpp.

76{
77 if (!showGlobalSelection &&
78 parent() && !parent()->parent() &&
79 dynamic_cast<const KisSelectionMask*>(m_node.data())) {
80
81 return false;
82 }
83
84 return parent() && !m_node->isFakeNode();
85}
KisNodeDummy * parent() const
virtual bool isFakeNode() const

References KisSharedPtr< T >::data(), KisBaseNode::isFakeNode(), m_node, and parent().

◆ lastChild()

KisNodeDummy * KisNodeDummy::lastChild ( ) const

Definition at line 32 of file kis_node_dummies_graph.cpp.

33{
34 return !m_children.isEmpty() ? m_children.last() : 0;
35}

References m_children.

◆ nextSibling()

KisNodeDummy * KisNodeDummy::nextSibling ( ) const

Definition at line 37 of file kis_node_dummies_graph.cpp.

38{
39 if(!parent()) return 0;
40
41 int index = parent()->m_children.indexOf(const_cast<KisNodeDummy*>(this));
42 Q_ASSERT(index >= 0);
43
44 index++;
45 return index < parent()->m_children.size() ?
46 parent()->m_children[index] : 0;
47}

References m_children, and parent().

◆ node()

KisNodeSP KisNodeDummy::node ( ) const

Definition at line 70 of file kis_node_dummies_graph.cpp.

71{
72 return m_node;
73}

References m_node.

◆ nodeShape()

KisNodeShape * KisNodeDummy::nodeShape ( ) const
private

Definition at line 65 of file kis_node_dummies_graph.cpp.

66{
67 return m_nodeShape;
68}

References m_nodeShape.

◆ parent()

KisNodeDummy * KisNodeDummy::parent ( ) const

Definition at line 60 of file kis_node_dummies_graph.cpp.

61{
62 return qobject_cast<KisNodeDummy*>(QObject::parent());
63}

◆ prevSibling()

KisNodeDummy * KisNodeDummy::prevSibling ( ) const

Definition at line 49 of file kis_node_dummies_graph.cpp.

50{
51 if(!parent()) return 0;
52
53 int index = parent()->m_children.indexOf(const_cast<KisNodeDummy*>(this));
54 Q_ASSERT(index >= 0);
55
56 index--;
57 return index >= 0 ? parent()->m_children[index] : 0;
58}

References m_children, and parent().

Friends And Related Symbol Documentation

◆ KisNodeDummiesGraph

friend class KisNodeDummiesGraph
friend

Definition at line 71 of file kis_node_dummies_graph.h.

◆ KisNodeShapesGraph

friend class KisNodeShapesGraph
friend

Definition at line 67 of file kis_node_dummies_graph.h.

◆ KisNodeShapesGraphTest

friend class KisNodeShapesGraphTest
friend

Definition at line 68 of file kis_node_dummies_graph.h.

Member Data Documentation

◆ m_children

QList<KisNodeDummy*> KisNodeDummy::m_children
private

Definition at line 72 of file kis_node_dummies_graph.h.

◆ m_node

KisNodeSP KisNodeDummy::m_node
private

Definition at line 75 of file kis_node_dummies_graph.h.

◆ m_nodeShape

KisNodeShape* KisNodeDummy::m_nodeShape
private

Definition at line 74 of file kis_node_dummies_graph.h.


The documentation for this class was generated from the following files: