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

#include <kis_node_graph_listener.h>

+ Inheritance diagram for KisNodeGraphListener:

Public Member Functions

virtual void aboutToAddANode (KisNode *parent, int index)
 
virtual void aboutToMoveNode (KisNode *node, int oldIndex, int newIndex)
 
virtual void aboutToRemoveANode (KisNode *parent, int index)
 
virtual KisNodegraphOverlayNode () const
 
int graphSequenceNumber () const
 
virtual void invalidateAllFrames ()
 
virtual void invalidateFrames (const KisTimeSpan &range, const QRect &rect)
 
virtual void keyframeChannelAboutToBeRemoved (KisNode *node, KisKeyframeChannel *channel)
 
virtual void keyframeChannelHasBeenAdded (KisNode *node, KisKeyframeChannel *channel)
 
 KisNodeGraphListener ()
 
virtual void nodeChanged (KisNode *node)
 
virtual void nodeCollapsedChanged (KisNode *node)
 
virtual void nodeHasBeenAdded (KisNode *parent, int index, KisNodeAdditionFlags flags)
 
virtual void nodeHasBeenMoved (KisNode *node, int oldIndex, int newIndex)
 
virtual void nodeHasBeenRemoved (KisNode *parent, int index)
 
virtual void notifySelectionChanged ()
 
 Private ()
 
virtual void requestProjectionUpdate (KisNode *node, const QVector< QRect > &rects, KisProjectionUpdateFlags flags)
 
virtual void requestTimeSwitch (int time)
 
virtual ~KisNodeGraphListener ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Public Attributes

int sequenceNumber
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Private Attributes

QScopedPointer< Privatem_d
 

Detailed Description

Implementations of this class are called by nodes whenever the node graph changes. These implementations can then Q_EMIT the right signals so Qt interview models can be updated before and after changes.

The reason for this go-between is that we don't want our nodes to be QObjects, nor to have sig-slot connections between every node and every mode.

It also manages the sequence number of the graph. This is a number which can be used as a checksum for whether the graph has changed from some period of time or not.

See also
graphSequenceNumber()

Definition at line 15 of file kis_node_graph_listener.cpp.

Constructor & Destructor Documentation

◆ KisNodeGraphListener()

KisNodeGraphListener::KisNodeGraphListener ( )

Definition at line 21 of file kis_node_graph_listener.cpp.

22 : m_d(new Private())
23{
24}
QScopedPointer< Private > m_d

◆ ~KisNodeGraphListener()

KisNodeGraphListener::~KisNodeGraphListener ( )
virtual

Definition at line 26 of file kis_node_graph_listener.cpp.

27{
28}

Member Function Documentation

◆ aboutToAddANode()

void KisNodeGraphListener::aboutToAddANode ( KisNode * parent,
int index )
virtual

Inform the model that we're going to add a node.

Reimplemented in KisImage.

Definition at line 30 of file kis_node_graph_listener.cpp.

31{
32 m_d->sequenceNumber++;
33}

References m_d.

◆ aboutToMoveNode()

void KisNodeGraphListener::aboutToMoveNode ( KisNode * node,
int oldIndex,
int newIndex )
virtual

Inform the model we're about to start moving a node (which includes removing and adding the same node)

Definition at line 50 of file kis_node_graph_listener.cpp.

51{
52 m_d->sequenceNumber++;
53}

References m_d.

◆ aboutToRemoveANode()

void KisNodeGraphListener::aboutToRemoveANode ( KisNode * parent,
int index )
virtual

Inform the model we're going to remove a node.

Reimplemented in KisImage.

Definition at line 40 of file kis_node_graph_listener.cpp.

41{
42 m_d->sequenceNumber++;
43}

References m_d.

◆ graphOverlayNode()

KisNode * KisNodeGraphListener::graphOverlayNode ( ) const
virtual

Reimplemented in KisImage.

Definition at line 106 of file kis_node_graph_listener.cpp.

107{
108 return 0;
109}

◆ graphSequenceNumber()

int KisNodeGraphListener::graphSequenceNumber ( ) const

Returns the sequence of the graph.

Every time some operation performed, which might change the hierarchy of the nodes, the sequence number grows by one. So if you have any information about the graph which was acquired when the sequence number was X and now it has become Y, it means your information is outdated.

It is used in the scheduler for checking whether queued walkers should be regenerated.

Definition at line 60 of file kis_node_graph_listener.cpp.

61{
62 return m_d->sequenceNumber;
63}

References m_d.

◆ invalidateAllFrames()

void KisNodeGraphListener::invalidateAllFrames ( )
virtual

Reimplemented in KisImage.

Definition at line 83 of file kis_node_graph_listener.cpp.

84{
85}

◆ invalidateFrames()

void KisNodeGraphListener::invalidateFrames ( const KisTimeSpan & range,
const QRect & rect )
virtual

Reimplemented in KisImage.

Definition at line 95 of file kis_node_graph_listener.cpp.

96{
97 Q_UNUSED(range);
98 Q_UNUSED(rect);
99}

◆ keyframeChannelAboutToBeRemoved()

void KisNodeGraphListener::keyframeChannelAboutToBeRemoved ( KisNode * node,
KisKeyframeChannel * channel )
virtual

Reimplemented in KisImage.

Definition at line 70 of file kis_node_graph_listener.cpp.

71{
72
73}

◆ keyframeChannelHasBeenAdded()

void KisNodeGraphListener::keyframeChannelHasBeenAdded ( KisNode * node,
KisKeyframeChannel * channel )
virtual

Inform the model that a keyframe channel has been added or removed.

Reimplemented in KisImage.

Definition at line 65 of file kis_node_graph_listener.cpp.

66{
67
68}

◆ nodeChanged()

void KisNodeGraphListener::nodeChanged ( KisNode * node)
virtual

Reimplemented in KisImage.

Definition at line 75 of file kis_node_graph_listener.cpp.

76{
77}

◆ nodeCollapsedChanged()

void KisNodeGraphListener::nodeCollapsedChanged ( KisNode * node)
virtual

Reimplemented in KisImage.

Definition at line 79 of file kis_node_graph_listener.cpp.

80{
81}

◆ nodeHasBeenAdded()

void KisNodeGraphListener::nodeHasBeenAdded ( KisNode * parent,
int index,
KisNodeAdditionFlags flags )
virtual

Inform the model we're done adding a node.

Reimplemented in KisImage.

Definition at line 35 of file kis_node_graph_listener.cpp.

36{
37 m_d->sequenceNumber++;
38}

References m_d.

◆ nodeHasBeenMoved()

void KisNodeGraphListener::nodeHasBeenMoved ( KisNode * node,
int oldIndex,
int newIndex )
virtual

Inform the model we're done moving the node: it has been removed and added successfully

Definition at line 55 of file kis_node_graph_listener.cpp.

56{
57 m_d->sequenceNumber++;
58}

References m_d.

◆ nodeHasBeenRemoved()

void KisNodeGraphListener::nodeHasBeenRemoved ( KisNode * parent,
int index )
virtual

Inform the model we're done removing a node.

Definition at line 45 of file kis_node_graph_listener.cpp.

46{
47 m_d->sequenceNumber++;
48}

References m_d.

◆ notifySelectionChanged()

void KisNodeGraphListener::notifySelectionChanged ( )
virtual

Inform the model that one of the selections in the graph is changed. The sender is not passed to the function (at least for now) because the UI should decide itself whether it needs to fetch new selection of not.

Reimplemented in KisImage.

Definition at line 87 of file kis_node_graph_listener.cpp.

88{
89}

◆ Private()

KisNodeGraphListener::Private ( )
inline

◆ requestProjectionUpdate()

void KisNodeGraphListener::requestProjectionUpdate ( KisNode * node,
const QVector< QRect > & rects,
KisProjectionUpdateFlags flags )
virtual

Inform the model that a node has been changed (setDirty)

Reimplemented in KisImage, and KisScratchPadNodeListener.

Definition at line 91 of file kis_node_graph_listener.cpp.

92{
93}

◆ requestTimeSwitch()

void KisNodeGraphListener::requestTimeSwitch ( int time)
virtual

Reimplemented in KisImage.

Definition at line 101 of file kis_node_graph_listener.cpp.

102{
103 Q_UNUSED(time);
104}

Member Data Documentation

◆ m_d

QScopedPointer<Private> KisNodeGraphListener::m_d
private

Definition at line 121 of file kis_node_graph_listener.h.

◆ sequenceNumber

int KisNodeGraphListener::sequenceNumber

Definition at line 18 of file kis_node_graph_listener.cpp.


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