Class for graphical representation of scene objects.
More...
#include <NodeGraphicsItem.h>
|
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.
|
|
|
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.
|
|
|
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.
|
|
|
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.
|
|
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) |
| Event handler that reacts to hover enter events.
|
|
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) |
| Event handler that reacts to hover leave events.
|
|
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 | 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.
|
|
|
QColor | m_color |
| The item's base color.
|
|
bool | m_actAsButton |
| Flag that states whether the item should act as a button.
|
|
bool | m_hovered |
| Flag that states whether the item is currently hovered by the mouse pointer.
|
|
bool | m_clicked |
| Flag that states whether the item is currently clicked by the mouse pointer (i.e. a mouse button is pressed).
|
|
Class for graphical representation of scene objects.
Inheritance Diagram
Nested enumeration of pin display modes that define how many pins will be displayed in the node graphics item.
- Enumerator:
PDM_All |
|
PDM_Connected |
|
PDM_Collapsed |
|
Frapper::NodeGraphicsItem::NodeGraphicsItem |
( |
Node * |
node, |
|
|
QPointF |
position, |
|
|
const QColor & |
color |
|
) |
| |
Constructor of the NodeGraphicsItem class.
Constructors and Destructors.
- Parameters
-
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. |
Constructor of the NodeGraphicsItem class.
- Parameters
-
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. |
Frapper::NodeGraphicsItem::~NodeGraphicsItem |
( |
| ) |
|
void Frapper::NodeGraphicsItem::setEnabled |
( |
bool |
enabled | ) |
|
Enables or disables the graphics item.
Public Functions.
- Parameters
-
enabled | The new enabled state for the item. |
Enables or disables the graphics item.
- Parameters
-
enabled | The new enabled state for the item. |
void Frapper::NodeGraphicsItem::paint |
( |
QPainter * |
painter, |
|
|
const QStyleOptionGraphicsItem * |
option, |
|
|
QWidget * |
widget = 0 |
|
) |
| |
|
virtual |
Paints the graphics item into a graphics view.
- Parameters
-
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 Frapper::BaseRectItem.
Node * Frapper::NodeGraphicsItem::getNode |
( |
| ) |
const |
Returns the node that the graphics item represents.
- Returns
- The node that the graphics item represents.
void Frapper::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 Frapper::NodeGraphicsItem::bringToFront |
( |
| ) |
|
Sets the z-index of the graphics item so that it will be drawn over all other graphics items in the scene.
Associates a ConnectionGraphicsItem with the node graphics item.
- Parameters
-
item | The item to associate with the node graphics item. |
Removes the association to the given ConnectionGraphicsItem from the node graphics item.
- Parameters
-
item | The item to no longer associate with the node graphics item. |
void Frapper::NodeGraphicsItem::removeConnectionItems |
( |
| ) |
|
Sets the pin display mode for the item to the given mode.
- Parameters
-
pinDisplayMode | The pin display mode to set for the item. |
void Frapper::NodeGraphicsItem::setSelected |
( |
bool |
selected | ) |
|
|
slot |
Removes the association to the given ConnectionGraphicsItem from the node graphics item.
Public Slots.
- Parameters
-
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. |
This function is needed because QGraphicsItem::setSelected() is not a slot.
- Parameters
-
selected | The new selected state for the graphics item. |
Updates the selected state of the graphics item according to the given value.
This function is needed because QGraphicsItem::setSelected() is not a slot.
- Parameters
-
selected | The new selected state for the graphics item. |
Begins or ends creating a connection between nodes. Is called when a parameter represented by a pin has been clicked.
- Parameters
-
pinItem | The pin graphics item representing the parameter. |
parameter | The parameter that was clicked. |
void Frapper::NodeGraphicsItem::refresh |
( |
| ) |
|
|
slot |
Refresh the graphics item to reflect changes in the node that it represents.
void Frapper::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.
- Parameters
-
sourceParameter | The output parameter of the source node to connect. |
targetParameter | The input parameter of the target node to connect. |
void Frapper::NodeGraphicsItem::connectionRequested |
( |
Node * |
sourceNode, |
|
|
Node * |
targetNode |
|
) |
| |
|
signal |
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.
- Parameters
-
sourceNode | The source node. |
targetNode | The target node. |
void Frapper::NodeGraphicsItem::nodeGraphicsItemMoved |
( |
const QPointF & |
pos | ) |
|
|
signal |
Signal that is emitted when the item has been moved to a new position.
- Parameters
-
pos | The position that the item has moved to. |
void Frapper::NodeGraphicsItem::mousePressEvent |
( |
QGraphicsSceneMouseEvent * |
event | ) |
|
|
protected |
Event handler that reacts to mouse press events.
Protected Functions.
- Parameters
-
event | The object containing details about the event. |
Event handler that reacts to mouse press events.
- Parameters
-
event | The object containing details about the event. |
void Frapper::NodeGraphicsItem::mouseReleaseEvent |
( |
QGraphicsSceneMouseEvent * |
event | ) |
|
|
protected |
Event handler that reacts to mouse release events.
- Parameters
-
event | The object containing details about the event. |
void Frapper::NodeGraphicsItem::contextMenuEvent |
( |
QGraphicsSceneContextMenuEvent * |
event | ) |
|
|
protected |
Event handler that reacts to context menu events.
- Parameters
-
event | The object containing details about the event. |
QVariant Frapper::NodeGraphicsItem::itemChange |
( |
GraphicsItemChange |
change, |
|
|
const QVariant & |
value |
|
) |
| |
|
protected |
Processing on changed item.
void Frapper::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.
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.
- Parameters
-
pinItem | The pin graphics item representing the parameter that was clicked. |
parameter | The parameter that was clicked. |
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.
- Parameters
-
pinItem | The pin graphics item representing the parameter that was clicked. |
parameter | The parameter that was clicked. |
- See Also
- parameterClicked
-
endCreatingConnection
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.
- Parameters
-
pinItem | The pin graphics item representing the parameter that was clicked. |
parameter | The parameter that was clicked. |
- See Also
- parameterClicked
-
beginCreatingConnection
void Frapper::NodeGraphicsItem::connectByNameClicked |
( |
| ) |
|
|
privateslot |
Connect by name has been clicked in context menu.
void Frapper::NodeGraphicsItem::updatePinDisplayMode |
( |
QAction * |
action | ) |
|
|
privateslot |
Updates the node's pin display mode according to the triggered action.
Private Slots.
- Parameters
-
action | The action that was triggered. |
Updates the node's pin display mode according to the triggered action.
- Parameters
-
action | The action that was triggered. |
const int Frapper::NodeGraphicsItem::ItemWidth = 60 |
|
static |
The standard width for the items.
const int Frapper::NodeGraphicsItem::ItemBaseHeight = 44 |
|
static |
The base height for the items.
const int Frapper::NodeGraphicsItem::ItemPinRowHeight = 12 |
|
static |
The height of a row of pins.
int Frapper::NodeGraphicsItem::s_numberOfNodeGraphicsItems = 0 |
|
staticprivate |
The number of node graphics items created for the current scene.
Private Static Data.
Node* Frapper::NodeGraphicsItem::m_node |
|
private |
The node that the graphics item represents.
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.
The list of input pins to display in the item.
The list of output pins to display in the item.
All ConnectionGraphicsItems connected to this item.
QMenu Frapper::NodeGraphicsItem::m_nodeContextMenu |
|
private |
QMenu Frapper::NodeGraphicsItem::m_pinContextMenu |
|
private |
The documentation for this class was generated from the following files: