#include <NodeGraphicsItem.h>


Public Types | |
| enum | PinDisplayMode { PDM_All, PDM_Connected, PDM_Collapsed } |
| Nested enumeration of pin display modes that define how many pins will be displayed in the node graphics item. More... | |
Public Slots | |
| void | setSelected (bool selected) |
| Removes the association to the given ConnectionGraphicsItem from the node graphics item. | |
| void | createConnection (PinGraphicsItem *pinItem, Parameter *parameter) |
| Begins or ends creating a connection between nodes. Is called when a parameter represented by a pin has been clicked. | |
| void | refresh () |
| Refresh the graphics item to reflect changes in the node that it represents. | |
Signals | |
| void | connectionRequested (Parameter *sourceParameter, Parameter *targetParameter) |
| Signal that is emitted when a connection between the given parameters should be created. | |
| void | connectionRequested (Node *sourceNode, Node *targetNode) |
| Signal that is emitted when a connection between the given nodes should be created. (connect by name). | |
| void | nodeGraphicsItemMoved (const QPointF &pos) |
| Signal that is emitted when the item has been moved to a new position. | |
Public Member Functions | |
| NodeGraphicsItem (Node *node, QPointF position, const QColor &color) | |
| Constructor of the NodeGraphicsItem class. | |
| ~NodeGraphicsItem () | |
| Destructor of the NodeGraphicsItem class. | |
| void | setEnabled (bool enabled) |
| Enables or disables the graphics item. | |
| void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) |
| Paints the graphics item into a graphics view. | |
| Node * | getNode () const |
| Returns the node that the graphics item represents. | |
| void | resetNode () |
| Resets the node to 0. | |
| void | bringToFront () |
| Sets the z-index of the graphics item so that it will be drawn over all other graphics items in the scene. | |
| void | addConnectionItem (ConnectionGraphicsItem *item) |
| Associates a ConnectionGraphicsItem with the node graphics item. | |
| void | removeConnectionItem (ConnectionGraphicsItem *item) |
| Removes the association to the given ConnectionGraphicsItem from the node graphics item. | |
| void | removeConnectionItems () |
| Removes all ConnectionGraphicsItem associations from the node graphics item. | |
| void | setPinDisplayMode (PinDisplayMode pinDisplayMode) |
| Sets the pin display mode for the item to the given mode. | |
Static Public Attributes | |
| static const int | ItemWidth = 60 |
| The standard width for the items. | |
| static const int | ItemBaseHeight = 44 |
| The base height for the items. | |
| static const int | ItemPinRowHeight = 12 |
| The height of a row of pins. | |
Protected Member Functions | |
| void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
| Event handler that reacts to mouse press events. | |
| void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
| Event handler that reacts to mouse release events. | |
| void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) |
| Event handler that reacts to context menu events. | |
| QVariant | itemChange (GraphicsItemChange change, const QVariant &value) |
| Processing on changed item. | |
Private Slots | |
| void | connectByNameClicked () |
| Connect by name has been clicked in context menu. | |
| void | updatePinDisplayMode (QAction *action) |
| Updates the node's pin display mode according to the triggered action. | |
Private Member Functions | |
| void | updatePins () |
| Updates the item according to the pin display mode set to display all pins, only connected pins, or all pins in one collapsed pin. | |
| void | disableOtherPins (PinGraphicsItem *pinItem, Parameter *parameter) |
| Disables all pins in the node item that are of a different parameter type or the same connector types as the parameter that was clicked. Also disables all of the node item's flags. The whole node will be disabled if there are no enabled pins left. | |
| void | beginCreatingConnection (PinGraphicsItem *pinItem, Parameter *parameter) |
| Begins creating a connection between parameters of nodes by creating a new (temporary) connection graphics item that has the given pin as one of its end points. Is called when a parameter represented by a pin is clicked. | |
| void | endCreatingConnection (PinGraphicsItem *pinItem, Parameter *parameter) |
| Ends creating a connection between parameters of nodes by keeping the temporarily created connection graphics item that has the given pin as one of its end points, or destroying it when creating the connection is aborted. Is called when a parameter represented by a pin is clicked. | |
Private Attributes | |
| Node * | m_node |
| The node that the graphics item represents. | |
| FlagGraphicsItem * | m_evalFlagItem |
| The node's eval flag item. | |
| ViewFlagGraphicsItem * | m_viewFlagItem |
| The node's view flag item. | |
| PinDisplayMode | m_pinDisplayMode |
| The pin display mode that defines how many pins will be displayed in the node graphics item. | |
| QList< PinGraphicsItem * > | m_inputPins |
| The list of input pins to display in the item. | |
| QList< PinGraphicsItem * > | m_outputPins |
| The list of output pins to display in the item. | |
| QMap< unsigned int, ConnectionGraphicsItem * > | m_connectionItems |
| All ConnectionGraphicsItems connected to this item. | |
| QMenu | m_nodeContextMenu |
| The node context menu. | |
| QMenu | m_pinContextMenu |
| The pin context menu. | |
Static Private Attributes | |
| static int | s_numberOfNodeGraphicsItems = 0 |
| The number of node graphics items created for the current scene. | |
| NodeGraphicsItem::NodeGraphicsItem | ( | Node * | node, | |
| QPointF | position, | |||
| const QColor & | color | |||
| ) |
Constructor of the NodeGraphicsItem class.
Constructors and Destructors.
| node | The node that the graphics item represents. | |
| position | The initial position for the graphics item. | |
| color | The color in which to draw the graphics item. |
| node | The node that the graphics item represents. | |
| position | The initial position for the graphics item. | |
| color | The color in which to draw the graphics item. |
| NodeGraphicsItem::~NodeGraphicsItem | ( | ) |
Destructor of the NodeGraphicsItem class.
| void NodeGraphicsItem::setEnabled | ( | bool | enabled | ) |
Enables or disables the graphics item.
Public Functions.
| enabled | The new enabled state for the item. |
| enabled | The new enabled state for the item. |
| void NodeGraphicsItem::paint | ( | QPainter * | painter, | |
| const QStyleOptionGraphicsItem * | option, | |||
| QWidget * | widget = 0 | |||
| ) | [virtual] |
Paints the graphics item into a graphics view.
| painter | The object to use for painting. | |
| option | Style options for painting the graphics item. | |
| widget | The widget into which to paint the graphics item. |
Implements BaseRectItem.
| Node * NodeGraphicsItem::getNode | ( | ) | const |
Returns the node that the graphics item represents.
| void NodeGraphicsItem::resetNode | ( | ) |
Resets the node to 0.
Should be called when the node that the graphics item represents will be destroyed.
Temporary. Should be replaced by improved code when destroying nodes in the scene model.
| void NodeGraphicsItem::bringToFront | ( | ) |
Sets the z-index of the graphics item so that it will be drawn over all other graphics items in the scene.
| void NodeGraphicsItem::addConnectionItem | ( | ConnectionGraphicsItem * | item | ) |
Associates a ConnectionGraphicsItem with the node graphics item.
| item | The item to associate with the node graphics item. |
| void NodeGraphicsItem::removeConnectionItem | ( | ConnectionGraphicsItem * | item | ) |
Removes the association to the given ConnectionGraphicsItem from the node graphics item.
| item | The item to no longer associate with the node graphics item. |
| void NodeGraphicsItem::removeConnectionItems | ( | ) |
Removes all ConnectionGraphicsItem associations from the node graphics item.
| void NodeGraphicsItem::setPinDisplayMode | ( | NodeGraphicsItem::PinDisplayMode | pinDisplayMode | ) |
Sets the pin display mode for the item to the given mode.
| pinDisplayMode | The pin display mode to set for the item. |
| void NodeGraphicsItem::setSelected | ( | bool | selected | ) | [slot] |
Removes the association to the given ConnectionGraphicsItem from the node graphics item.
Public Slots.
| item | The item to no longer associate with the node graphics item. Updates the selected state of the graphics item according to the given value. |
| selected | The new selected state for the graphics item. |
This function is needed because QGraphicsItem::setSelected() is not a slot.
| selected | The new selected state for the graphics item. |
| void NodeGraphicsItem::createConnection | ( | PinGraphicsItem * | pinItem, | |
| Parameter * | parameter | |||
| ) | [slot] |
Begins or ends creating a connection between nodes. Is called when a parameter represented by a pin has been clicked.
| pinItem | The pin graphics item representing the parameter. | |
| parameter | The parameter that was clicked. |
| void NodeGraphicsItem::refresh | ( | ) | [slot] |
Refresh the graphics item to reflect changes in the node that it represents.
| void NodeGraphicsItem::connectionRequested | ( | Parameter * | sourceParameter, | |
| Parameter * | targetParameter | |||
| ) | [signal] |
Signal that is emitted when a connection between the given parameters should be created.
The parameters to be connected must have the same parameter type.
| sourceParameter | The output parameter of the source node to connect. | |
| targetParameter | The input parameter of the target node to connect. |
Signal that is emitted when a connection between the given nodes should be created. (connect by name).
The parameters to be connected must have the same parameter type.
| sourceNode | The source node. | |
| targetNode | The target node. |
| void NodeGraphicsItem::nodeGraphicsItemMoved | ( | const QPointF & | pos | ) | [signal] |
Signal that is emitted when the item has been moved to a new position.
| pos | The position that the item has moved to. |
| void NodeGraphicsItem::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Event handler that reacts to mouse press events.
Protected Functions.
| event | The object containing details about the event. |
| event | The object containing details about the event. |
Reimplemented from BaseRectItem.
| void NodeGraphicsItem::mouseReleaseEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Event handler that reacts to mouse release events.
| event | The object containing details about the event. |
Reimplemented from BaseRectItem.
| void NodeGraphicsItem::contextMenuEvent | ( | QGraphicsSceneContextMenuEvent * | event | ) | [protected] |
Event handler that reacts to context menu events.
| event | The object containing details about the event. |
| QVariant NodeGraphicsItem::itemChange | ( | GraphicsItemChange | change, | |
| const QVariant & | value | |||
| ) | [protected] |
Processing on changed item.
| void NodeGraphicsItem::updatePins | ( | ) | [private] |
Updates the item according to the pin display mode set to display all pins, only connected pins, or all pins in one collapsed pin.
Private Functions.
| void NodeGraphicsItem::disableOtherPins | ( | PinGraphicsItem * | pinItem, | |
| Parameter * | parameter | |||
| ) | [private] |
Disables all pins in the node item that are of a different parameter type or the same connector types as the parameter that was clicked. Also disables all of the node item's flags. The whole node will be disabled if there are no enabled pins left.
Disables all pins in the node item that are of a different parameter type or the same pin types as the parameter that was clicked. Also disables all of the node item's flags. The whole node will be disabled if there are no enabled pins left.
| pinItem | The pin graphics item representing the parameter that was clicked. | |
| parameter | The parameter that was clicked. |
| void NodeGraphicsItem::beginCreatingConnection | ( | PinGraphicsItem * | pinItem, | |
| Parameter * | parameter | |||
| ) | [private] |
Begins creating a connection between parameters of nodes by creating a new (temporary) connection graphics item that has the given pin as one of its end points. Is called when a parameter represented by a pin is clicked.
| pinItem | The pin graphics item representing the parameter that was clicked. | |
| parameter | The parameter that was clicked. |
| void NodeGraphicsItem::endCreatingConnection | ( | PinGraphicsItem * | pinItem, | |
| Parameter * | parameter | |||
| ) | [private] |
Ends creating a connection between parameters of nodes by keeping the temporarily created connection graphics item that has the given pin as one of its end points, or destroying it when creating the connection is aborted. Is called when a parameter represented by a pin is clicked.
| pinItem | The pin graphics item representing the parameter that was clicked. | |
| parameter | The parameter that was clicked. |
| void NodeGraphicsItem::connectByNameClicked | ( | ) | [private, slot] |
Connect by name has been clicked in context menu.
| void NodeGraphicsItem::updatePinDisplayMode | ( | QAction * | action | ) | [private, slot] |
Updates the node's pin display mode according to the triggered action.
Private Slots.
| action | The action that was triggered. |
| action | The action that was triggered. |
const int NodeGraphicsItem::ItemWidth = 60 [static] |
The standard width for the items.
const int NodeGraphicsItem::ItemBaseHeight = 44 [static] |
The base height for the items.
const int NodeGraphicsItem::ItemPinRowHeight = 12 [static] |
The height of a row of pins.
int NodeGraphicsItem::s_numberOfNodeGraphicsItems = 0 [static, private] |
The number of node graphics items created for the current scene.
Private Static Data.
Node* NodeGraphicsItem::m_node [private] |
The node that the graphics item represents.
FlagGraphicsItem* NodeGraphicsItem::m_evalFlagItem [private] |
The node's eval flag item.
The node's view flag item.
The pin display mode that defines how many pins will be displayed in the node graphics item.
QList<PinGraphicsItem *> NodeGraphicsItem::m_inputPins [private] |
The list of input pins to display in the item.
QList<PinGraphicsItem *> NodeGraphicsItem::m_outputPins [private] |
The list of output pins to display in the item.
QMap<unsigned int, ConnectionGraphicsItem *> NodeGraphicsItem::m_connectionItems [private] |
All ConnectionGraphicsItems connected to this item.
QMenu NodeGraphicsItem::m_nodeContextMenu [private] |
The node context menu.
QMenu NodeGraphicsItem::m_pinContextMenu [private] |
The pin context menu.
1.5.9