#include "GraphicsConnectionItem.h"
Public Member Functions | |
GraphicsConnectionItem () | |
virtual | ~GraphicsConnectionItem () |
virtual QRectF | boundingRect (void) const override |
virtual void | paint (QPainter *_painter, const QStyleOptionGraphicsItem *_opt, QWidget *_widget) override |
virtual QVariant | itemChange (QGraphicsItem::GraphicsItemChange _change, const QVariant &_value) override |
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *_event) override |
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *_event) override |
virtual void | hoverEnterEvent (QGraphicsSceneHoverEvent *_event) override |
virtual void | hoverLeaveEvent (QGraphicsSceneHoverEvent *_event) override |
virtual qreal | calculateShortestDistanceToPoint (const QPointF &_pt) const override |
Calculates and returns the closest distance to the given point. Returns -1 if the distance is invalid (e.g. maximum distance exceeded). | |
virtual QGraphicsItem * | getQGraphicsItem (void) override |
Returns the QGraphicsItem. | |
virtual const QGraphicsItem * | getQGraphicsItem (void) const override |
Returns the const QGraphicsItem. | |
bool | setConfiguration (const ot::GraphicsConnectionCfg &_cfg) |
Will set the connection properties as provided in the configuration The origin and destination item won't be set! | |
const GraphicsConnectionCfg & | getConfiguration (void) const |
Creates a configuration object containing the items origin and destination information. | |
void | setLineShape (GraphicsConnectionCfg::ConnectionShape _shape) |
GraphicsConnectionCfg::ConnectionShape | getLineShape (void) const |
void | setLineWidth (double _width) |
double | getLineWidth (void) const |
void | setLineColor (const ot::Color &_color) |
void | setLinePainter (ot::Painter2D *_painter) |
Sets the line painter. The item takes ownership of the painter. | |
const ot::Painter2D * | getLinePainter (void) const |
Returns the current line painter. The item keeps ownership of the painter. | |
void | setLineStyle (const OutlineF &_style) |
const OutlineF & | getLineStyle (void) const |
void | setHandleState (bool _handlesState) |
bool | getHandleState (void) const |
void | updateConnectionView (void) |
void | connectItems (GraphicsItem *_origin, GraphicsItem *_dest) |
Sets the origin and destination items. Will call GraphicsItem::storeConnection for every connected item. Calls GraphicsConnectionItem::updateConnectionInformation. | |
void | disconnectItems (void) |
Unsets the origin and destination items. Will call GraphicsItem::forgetConnection for every connected item. Does not call GraphicsConnectionItem::updateConnectionInformation. | |
void | forgetItem (const GraphicsItem *_item) |
Sets the origin and/or destination to null. If the item is the origin item, origin will be set to null. If the item is the destination item, destination will be set to null. Does not call GraphicsConnectionItem::updateConnectionInformation. | |
GraphicsItem * | originItem (void) const |
GraphicsItem * | destItem (void) const |
void | updateConnectionInformation (void) |
Updates the configuration according to the origin and/or destination item. If no orgin is set the origin connectable name will be an empty string and the UID 0. Same applies to the destination. | |
Public Member Functions inherited from ot::GraphicsElement | |
GraphicsElement () | |
virtual | ~GraphicsElement () |
virtual void | setGraphicsScene (GraphicsScene *_scene) |
Set the GraphicsScene this element is placed at. | |
virtual GraphicsScene * | getGraphicsScene (void) const |
Returns the GraphicsScene this item is placed at. | |
void | setGraphicsElementState (GraphicsElementState _state, bool _active=true) |
Sets the provided state flag. | |
void | setGraphicsElementStateFlags (const GraphicsElementStateFlags &_state) |
Replaces the flags with the flags provided. | |
const GraphicsElementStateFlags & | getGraphicsElementState (void) const |
Returns the current GraphicsItemStateFlags set. | |
virtual std::list< GraphicsElement * > | getAllGraphicsElements (void) |
Returns all graphics elements nested in this element. The result contains this element and all of its childs. | |
virtual std::list< GraphicsElement * > | getAllDirectChildElements (void) |
Protected Member Functions | |
virtual void | graphicsElementStateChanged (const GraphicsElementStateFlags &_flags) override |
Additional Inherited Members | |
Public Types inherited from ot::GraphicsElement | |
enum | GraphicsElementState { NoState = 0x00 , HoverState = 0x01 , SelectedState = 0x02 } |
The GraphicsElementState is used to describe the current state of a GraphicsElement. More... | |
typedef Flags< GraphicsElementState > | GraphicsElementStateFlags |
ot::GraphicsConnectionItem::GraphicsConnectionItem | ( | ) |
|
virtual |
|
overridevirtual |
|
overridevirtual |
Calculates and returns the closest distance to the given point. Returns -1 if the distance is invalid (e.g. maximum distance exceeded).
_pt | Point in scene coordinates. |
Reimplemented from ot::GraphicsElement.
void ot::GraphicsConnectionItem::connectItems | ( | GraphicsItem * | _origin, |
GraphicsItem * | _dest ) |
Sets the origin and destination items. Will call GraphicsItem::storeConnection for every connected item. Calls GraphicsConnectionItem::updateConnectionInformation.
|
inline |
void ot::GraphicsConnectionItem::disconnectItems | ( | void | ) |
Unsets the origin and destination items. Will call GraphicsItem::forgetConnection for every connected item. Does not call GraphicsConnectionItem::updateConnectionInformation.
void ot::GraphicsConnectionItem::forgetItem | ( | const GraphicsItem * | _item | ) |
Sets the origin and/or destination to null. If the item is the origin item, origin will be set to null. If the item is the destination item, destination will be set to null. Does not call GraphicsConnectionItem::updateConnectionInformation.
|
inline |
Creates a configuration object containing the items origin and destination information.
bool ot::GraphicsConnectionItem::getHandleState | ( | void | ) | const |
|
inline |
Returns the current line painter. The item keeps ownership of the painter.
|
inline |
|
inline |
|
inline |
|
overridevirtual |
Returns the const QGraphicsItem.
Implements ot::GraphicsElement.
|
overridevirtual |
Returns the QGraphicsItem.
Implements ot::GraphicsElement.
|
overrideprotectedvirtual |
Reimplemented from ot::GraphicsElement.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
inline |
|
overridevirtual |
bool ot::GraphicsConnectionItem::setConfiguration | ( | const ot::GraphicsConnectionCfg & | _cfg | ) |
Will set the connection properties as provided in the configuration The origin and destination item won't be set!
void ot::GraphicsConnectionItem::setHandleState | ( | bool | _handlesState | ) |
|
inline |
|
inline |
Sets the line painter. The item takes ownership of the painter.
|
inline |
|
inline |
|
inline |
void ot::GraphicsConnectionItem::updateConnectionInformation | ( | void | ) |
Updates the configuration according to the origin and/or destination item. If no orgin is set the origin connectable name will be an empty string and the UID 0. Same applies to the destination.
void ot::GraphicsConnectionItem::updateConnectionView | ( | void | ) |