OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::GraphicsConnectionItem Class Reference

#include "GraphicsConnectionItem.h"

Inheritance diagram for ot::GraphicsConnectionItem:
ot::GraphicsElement

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 GraphicsConnectionCfggetConfiguration (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::Painter2DgetLinePainter (void) const
 Returns the current line painter. The item keeps ownership of the painter.
 
void setLineStyle (const OutlineF &_style)
 
const OutlineFgetLineStyle (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.
 
GraphicsItemoriginItem (void) const
 
GraphicsItemdestItem (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 GraphicsScenegetGraphicsScene (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 GraphicsElementStateFlagsgetGraphicsElementState (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< GraphicsElementStateGraphicsElementStateFlags
 

Constructor & Destructor Documentation

◆ GraphicsConnectionItem()

ot::GraphicsConnectionItem::GraphicsConnectionItem ( )

◆ ~GraphicsConnectionItem()

ot::GraphicsConnectionItem::~GraphicsConnectionItem ( )
virtual

Member Function Documentation

◆ boundingRect()

QRectF ot::GraphicsConnectionItem::boundingRect ( void ) const
overridevirtual

◆ calculateShortestDistanceToPoint()

qreal ot::GraphicsConnectionItem::calculateShortestDistanceToPoint ( const QPointF & _pt) const
overridevirtual

Calculates and returns the closest distance to the given point. Returns -1 if the distance is invalid (e.g. maximum distance exceeded).

Parameters
_ptPoint in scene coordinates.

Reimplemented from ot::GraphicsElement.

◆ connectItems()

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.

◆ destItem()

GraphicsItem * ot::GraphicsConnectionItem::destItem ( void ) const
inline

◆ disconnectItems()

void ot::GraphicsConnectionItem::disconnectItems ( void )

Unsets the origin and destination items. Will call GraphicsItem::forgetConnection for every connected item. Does not call GraphicsConnectionItem::updateConnectionInformation.

◆ forgetItem()

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.

◆ getConfiguration()

const GraphicsConnectionCfg & ot::GraphicsConnectionItem::getConfiguration ( void ) const
inline

Creates a configuration object containing the items origin and destination information.

◆ getHandleState()

bool ot::GraphicsConnectionItem::getHandleState ( void ) const

◆ getLinePainter()

const ot::Painter2D * ot::GraphicsConnectionItem::getLinePainter ( void ) const
inline

Returns the current line painter. The item keeps ownership of the painter.

◆ getLineShape()

GraphicsConnectionCfg::ConnectionShape ot::GraphicsConnectionItem::getLineShape ( void ) const
inline

◆ getLineStyle()

const OutlineF & ot::GraphicsConnectionItem::getLineStyle ( void ) const
inline

◆ getLineWidth()

double ot::GraphicsConnectionItem::getLineWidth ( void ) const
inline

◆ getQGraphicsItem() [1/2]

const QGraphicsItem * ot::GraphicsConnectionItem::getQGraphicsItem ( void ) const
overridevirtual

Returns the const QGraphicsItem.

Implements ot::GraphicsElement.

◆ getQGraphicsItem() [2/2]

QGraphicsItem * ot::GraphicsConnectionItem::getQGraphicsItem ( void )
overridevirtual

Returns the QGraphicsItem.

Implements ot::GraphicsElement.

◆ graphicsElementStateChanged()

void ot::GraphicsConnectionItem::graphicsElementStateChanged ( const GraphicsElementStateFlags & _flags)
overrideprotectedvirtual

Reimplemented from ot::GraphicsElement.

◆ hoverEnterEvent()

void ot::GraphicsConnectionItem::hoverEnterEvent ( QGraphicsSceneHoverEvent * _event)
overridevirtual

◆ hoverLeaveEvent()

void ot::GraphicsConnectionItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent * _event)
overridevirtual

◆ itemChange()

QVariant ot::GraphicsConnectionItem::itemChange ( QGraphicsItem::GraphicsItemChange _change,
const QVariant & _value )
overridevirtual

◆ mousePressEvent()

void ot::GraphicsConnectionItem::mousePressEvent ( QGraphicsSceneMouseEvent * _event)
overridevirtual

◆ mouseReleaseEvent()

void ot::GraphicsConnectionItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * _event)
overridevirtual

◆ originItem()

GraphicsItem * ot::GraphicsConnectionItem::originItem ( void ) const
inline

◆ paint()

void ot::GraphicsConnectionItem::paint ( QPainter * _painter,
const QStyleOptionGraphicsItem * _opt,
QWidget * _widget )
overridevirtual

◆ setConfiguration()

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!

◆ setHandleState()

void ot::GraphicsConnectionItem::setHandleState ( bool _handlesState)

◆ setLineColor()

void ot::GraphicsConnectionItem::setLineColor ( const ot::Color & _color)
inline

◆ setLinePainter()

void ot::GraphicsConnectionItem::setLinePainter ( ot::Painter2D * _painter)
inline

Sets the line painter. The item takes ownership of the painter.

◆ setLineShape()

void ot::GraphicsConnectionItem::setLineShape ( GraphicsConnectionCfg::ConnectionShape _shape)
inline

◆ setLineStyle()

void ot::GraphicsConnectionItem::setLineStyle ( const OutlineF & _style)
inline

◆ setLineWidth()

void ot::GraphicsConnectionItem::setLineWidth ( double _width)
inline

◆ updateConnectionInformation()

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.

◆ updateConnectionView()

void ot::GraphicsConnectionItem::updateConnectionView ( void )

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