OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
WrappedLineItem Class Reference

#include "WrappedLineItem.h"

Inheritance diagram for WrappedLineItem:
ot::GraphicsLineItem GraphicsItemDesignerItemBase ot::CustomGraphicsItem GraphicsItemDesignerPropertyHandler ot::GraphicsItem ot::GraphicsElement

Public Member Functions

 WrappedLineItem ()
 
virtual ~WrappedLineItem ()
 
virtual bool isDesignedItemCompleted (void) const override
 Returns true if the current item is completed. A completed item has all required control points set (e.g. Line start and Line end) and no more points may be set.
 
virtual bool isDesignedItemValid (void) const override
 Returns true if the current item is valid. A valid item has all required control points set (e.g. Line start and Line end). More points may be added (e.g. Polygon).
 
virtual ot::GraphicsItemgetGraphicsItem (void) override
 Returns the actual GraphicsItem.
 
virtual QString getDefaultItemName (void) const override
 Returns the default item name.
 
virtual ot::TreeWidgetItemInfo createNavigationInformation (void) override
 Creates the navigation information for this item and its childs.
 
virtual void setupDesignerItemFromConfig (const ot::GraphicsItemCfg *_config) override
 
- Public Member Functions inherited from ot::GraphicsLineItem
 GraphicsLineItem ()
 
virtual ~GraphicsLineItem ()
 
virtual bool setupFromConfig (const GraphicsItemCfg *_cfg) override
 Will setup the item from the provided configuration and store a copy. The previously stored configuration will be destroyed. Default 0.
 
virtual QSizeF getPreferredGraphicsItemSize (void) const override
 
void setLine (qreal _x1, qreal _y1, qreal _x2, qreal _y2)
 
void setLine (const Point2DD &_from, const Point2DD &_to)
 
void setLine (const QPointF &_from, const QPointF &_to)
 
void setLine (const QLineF &_line)
 
const Point2DDgetFrom (void) const
 
const Point2DDgetTo (void) const
 
QLineF getLine (void) const
 
void setLineStyle (const OutlineF &_style)
 
const OutlineFgetLineStyle (void) const
 
- Public Member Functions inherited from ot::CustomGraphicsItem
 CustomGraphicsItem (GraphicsItemCfg *_configuration)
 
virtual ~CustomGraphicsItem ()
 
virtual void prepareGraphicsItemGeometryChange (void) override
 Calls QGraphicsLayoutItem::prepareGeometryChange().
 
virtual void callPaint (QPainter *_painter, const QStyleOptionGraphicsItem *_opt, QWidget *_widget) override
 Calls QGraphicsItem::paint().
 
virtual QGraphicsLayoutItem * getQGraphicsLayoutItem (void) override
 Returns the QGraphicsLayoutItem.
 
virtual QGraphicsItem * getQGraphicsItem (void) override
 Returns the QGraphicsItem.
 
virtual const QGraphicsItem * getQGraphicsItem (void) const override
 Returns the const QGraphicsItem.
 
virtual QSizeF graphicsItemSizeHint (Qt::SizeHint _hint, const QSizeF &_constrains) const override
 Calls QGraphicsLayoutItem::sizeHint().
 
virtual QSizeF sizeHint (Qt::SizeHint _hint, const QSizeF &_constrains) const override
 
virtual void setGeometry (const QRectF &_rect) override
 
virtual QRectF boundingRect (void) const override
 
virtual void paint (QPainter *_painter, const QStyleOptionGraphicsItem *_opt, QWidget *_widget) override
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *_event) override
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *_event) override
 
- Public Member Functions inherited from ot::GraphicsItem
 GraphicsItem (GraphicsItemCfg *_configuration)
 Constructor.
 
virtual ~GraphicsItem ()
 Destructor.
 
virtual void graphicsItemEventHandler (GraphicsItem *_sender, GraphicsItemEvent _event)
 Will be called when this item was registered as an event handler and the child raised an event.
 
virtual void graphicsItemFlagsChanged (const GraphicsItemCfg::GraphicsItemFlags &_flags)
 Will be called whenever the GraphicsItem flags have changed.
 
virtual void graphicsItemConfigurationChanged (const GraphicsItemCfg *_config)
 Will be called whenever the GraphicsItem configuration has changed.
 
virtual ot::GraphicsItemfindItem (const std::string &_itemName)
 Will return any child item that matches the _itemName.
 
virtual void removeAllConnections (void)
 Removes all connections to or from this item.
 
virtual bool graphicsItemRequiresHover (void) const
 
virtual void finalizeGraphicsItem (void)
 Will be called after setupFromConfig (i.e. if the item is completely created). Here the item structure is complete and the item may adjust settings that depend on parent items (e.g. Text reference for GraphicsTextItem). Container items must override this method to forward the call to their child items.
 
void handleMousePressEvent (QGraphicsSceneMouseEvent *_event)
 
bool handleMouseMoveEvent (QGraphicsSceneMouseEvent *_event)
 General event handler for mouse move events.
 
void handleMouseReleaseEvent (QGraphicsSceneMouseEvent *_event)
 
void handleHoverEnterEvent (QGraphicsSceneHoverEvent *_event)
 
void handleToolTip (QGraphicsSceneHoverEvent *_event)
 
void handleHoverLeaveEvent (QGraphicsSceneHoverEvent *_event)
 
QSizeF handleGetGraphicsItemSizeHint (Qt::SizeHint _hint, const QSizeF &_sizeHint) const
 Will expand the size according to the margins.
 
QRectF handleGetGraphicsItemBoundingRect (const QRectF &_rect) const
 Calculates the actual bounding rect including margins and requested size.
 
void handleItemChange (QGraphicsItem::GraphicsItemChange _change, const QVariant &_value)
 Handles general item updates. The selected state will be forwarded to the GraphicsHighlightItem. Position updates will update the connections and call GraphicsItem::graphicsItemEventHandler() with GraphicsItem::ItemMoved.
 
void handleSetItemGeometry (const QRectF &_geom)
 
void raiseEvent (ot::GraphicsItem::GraphicsItemEvent _event)
 
virtual qreal calculateShortestDistanceToPoint (const QPointF &_pt) const override
 Calculates and returns the shortest distance to the given point. Returns -1 if the distance is invalid (e.g. maximum distance exceeded).
 
QRectF calculatePaintArea (const QSizeF &_innerSize)
 Calculates the draw rect for the item The inner rect takes into account the item geometry, alignment, margins and the actual inner size.
 
virtual GraphicsScenegetGraphicsScene (void) const override
 Returns the GraphicsScene this item is placed at.
 
GraphicsItemgetRootItem (void)
 
const GraphicsItemgetRootItem (void) const
 
void setConfiguration (GraphicsItemCfg *_config)
 Replaces the current configuration with the configuration prvided. The item takes ownership of the configuration.
 
const GraphicsItemCfg *const getConfiguration (void) const
 Returns the current configuration.
 
void setGraphicsItemPos (const QPointF &_pos)
 This function will update the position in the configuration and call QGraphicsItem::setPos.
 
void setGraphicsItemPos (const Point2DD &_pos)
 This function will update the position in the configuration and call QGraphicsItem::setPos.
 
const Point2DDgetGraphicsItemPos (void) const
 Returns the current position set in the configuration.
 
virtual void setParentGraphicsItem (GraphicsItem *_itm)
 
GraphicsItemgetParentGraphicsItem (void) const
 
void setGraphicsItemFlag (ot::GraphicsItemCfg::GraphicsItemFlag _flag, bool _active=true)
 Sets the provided flag.
 
void setGraphicsItemFlags (ot::GraphicsItemCfg::GraphicsItemFlags _flags)
 Replaces the flags with the flags provided.
 
const GraphicsItemCfg::GraphicsItemFlagsgetGraphicsItemFlags (void) const
 Returns the current GraphicsItemFlags set.
 
void setGraphicsItemUid (const ot::UID &_uid)
 Sets the GraphicsItem UID.
 
const ot::UIDgetGraphicsItemUid (void) const
 
virtual void setGraphicsItemName (const std::string &_name)
 
const std::string & getGraphicsItemName (void) const
 
void setGraphicsItemToolTip (const std::string &_toolTip)
 
const std::string & getGraphicsItemToolTip (void) const
 
void setAdditionalTriggerDistance (const ot::MarginsD &_distance)
 
const ot::MarginsDgetAdditionalTriggerDistance (void) const
 
virtual double getMaxAdditionalTriggerDistance (void) const
 Returns the maximum trigger distance in any direction of this item and its childs.
 
void setGraphicsItemMinimumSize (double _width, double _height)
 
void setGraphicsItemMinimumSize (const QSizeF &_size)
 
QSizeF getGraphicsItemMinimumSize (void) const
 
void setGraphicsItemMaximumSize (double _width, double _height)
 
void setGraphicsItemMaximumSize (const QSizeF &_size)
 
QSizeF getGraphicsItemMaximumSize (void) const
 
void setGraphicsItemSizePolicy (ot::SizePolicy _policy)
 
ot::SizePolicy getGraphicsItemSizePolicy (void) const
 
void setGraphicsItemAlignment (ot::Alignment _align)
 
ot::Alignment getGraphicsItemAlignment (void) const
 
void setGraphicsItemMargins (const ot::MarginsD &_margins)
 
const ot::MarginsDgetGraphicsItemMargins (void) const
 
void setConnectionDirection (ot::ConnectionDirection _direction)
 
ot::ConnectionDirection getConnectionDirection (void) const
 
void setStringMap (const std::map< std::string, std::string > &_map)
 
const std::map< std::string, std::string > & getStringMap (void) const
 
void setGraphicsItemTransform (const Transform &_transform)
 
const TransformgetGraphicsItemTransform (void) const
 
void setForwardSizeChanges (bool _forward)
 
bool getForwardSizeChanges (void) const
 
void storeConnection (GraphicsConnectionItem *_connection)
 
void forgetConnection (GraphicsConnectionItem *_connection)
 Removes the collection from the list (item will not be destroyed)
 
void addGraphicsItemEventHandler (ot::GraphicsItem *_handler)
 
void removeGraphicsItemEventHandler (ot::GraphicsItem *_handler)
 
QSizeF applyGraphicsItemMargins (const QSizeF &_size) const
 
QSizeF removeGraphicsItemMargins (const QSizeF &_size) const
 
virtual void setGraphicsItemRequestedSize (const QSizeF &_size)
 
const QSizeF & graphicsItemRequestedSize (void) const
 
std::list< ot::GraphicsConnectionCfggetConnectionCfgs ()
 
void setGraphicsItemSelected (bool _selected)
 
bool getGraphicsItemSelected (void) const
 
void setBlockFlagNotifications (bool _block)
 
bool getBlockFlagNotifications (void) const
 If enabled the item will not call graphicsItemFlagsChanged() when the flags have changed.
 
void setBlockConfigurationNotifications (bool _block)
 
bool getBlockConfigurationNotifications (void) const
 If enabled the item will not call graphicsItemConfigurationChanged() when the flags have changed.
 
void setCurrentPosAsMoveStart (void)
 Sets the current item position as move start point.
 
void notifyMoveIfRequired (void)
 Notifies the view if the items current position changed relative to the move start point.
 
void parentItemTransformChanged (const QTransform &_parentTransform)
 
QRectF getTriggerBoundingRect (void) const
 Returns the bounding rect in scene coordinates which was expanded by the additional trigger distance according to the config.
 
- Public Member Functions inherited from ot::GraphicsElement
 GraphicsElement ()
 
virtual ~GraphicsElement ()
 
virtual void setGraphicsScene (GraphicsScene *_scene)
 Set the GraphicsScene this element 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)
 
- Public Member Functions inherited from GraphicsItemDesignerItemBase
 GraphicsItemDesignerItemBase ()
 
virtual ~GraphicsItemDesignerItemBase ()
 
void addControlPoint (const QPointF &_pt)
 \breif Adds the provided control point and calls controlPointsChanged().
 
void setControlPoints (const QList< QPointF > &_points)
 Sets the current list of control points and calls controlPointsChanged().
 
void updateControlPoints (const QList< QPointF > &_points)
 Replaces the current list of control points. This method does not call controlPointsChanged().
 
const QList< QPointF > & getControlPoints (void) const
 Returns a list containing the currently set control points.
 
void setLastPos (const QPointF &_pos)
 Sets the last position.
 
const QPointF & getLastPos (void) const
 Returns the last position. The last position ist the last position of this graphics item. The position is used to adjust the control points.
 
void setDesignerItemFlag (DesignerItemFlag _flag, bool _active=true)
 
void setDesignerItemFlags (const DesignerItemFlags &_flags)
 
const DesignerItemFlagsgetDesignerItemFlags (void) const
 
void graphicsItemWasMoved (const QPointF &_newPos)
 Will move all control points by the move delta (lastPos - newPos). The method will set the last pos after moving.
 
virtual void makeItemTransparent (void)
 Will make the item transparent.
 
- Public Member Functions inherited from GraphicsItemDesignerPropertyHandler
 GraphicsItemDesignerPropertyHandler ()
 
virtual ~GraphicsItemDesignerPropertyHandler ()
 
void setNavigation (GraphicsItemDesignerNavigation *_navigation)
 
GraphicsItemDesignerNavigationgetNavigation (void) const
 
void setNavigationItem (QTreeWidgetItem *_item)
 
QTreeWidgetItem * getNavigationItem (void) const
 
void setPropertyGrid (ot::PropertyGrid *_grid)
 
void unsetPropertyGrid (void)
 
ot::PropertyGridgetPropertyGrid (void) const
 
virtual void itemAboutToBeDestroyed (void)
 

Protected Member Functions

virtual void controlPointsChanged (void) override
 Is called whenever the control points have changed (except when calling updateControlPoints()).
 
virtual void fillPropertyGrid (void) override
 Is called when the property grid needs to be filled.
 
virtual void propertyChanged (const ot::Property *_property) override
 
virtual void propertyDeleteRequested (const ot::Property *_property) override
 
virtual QVariant itemChange (QGraphicsItem::GraphicsItemChange _change, const QVariant &_constrains) override
 
- Protected Member Functions inherited from ot::GraphicsLineItem
virtual void paintCustomItem (QPainter *_painter, const QStyleOptionGraphicsItem *_opt, QWidget *_widget, const QRectF &_rect) override
 Paint the item inside the provided rect.
 
- Protected Member Functions inherited from ot::CustomGraphicsItem
virtual void graphicsElementStateChanged (const GraphicsElementStateFlags &_state) override
 
void updateItemGeometry (void)
 
- Protected Member Functions inherited from ot::GraphicsItem
template<class T >
T * getItemConfiguration (void)
 Returns the configuration for the current item. The configuration may be modified. The function will cast the current configuration to the type provided. The method will return 0 if the cast failed.
 
template<class T >
const T * getItemConfiguration (void) const
 Returns the configuration for the current item. The configuration may be modified. The function will cast the current configuration to the type provided. The method will return 0 if the cast failed.
 
virtual void applyGraphicsItemTransform (void)
 
virtual void notifyChildsAboutTransformChange (const QTransform &_newTransform)
 
- Protected Member Functions inherited from GraphicsItemDesignerItemBase
void initializeBaseData (const QList< QPointF > &_controlPoints, const QPointF &_pos)
 
void fillBasePropertyGrid (ot::PropertyGridCfg &_config)
 Adds the default properties. Creates the "General" and "Transform" groups.
 
bool basePropertyChanged (const ot::Property *_property)
 Handles base properties. Returns true if the changed property was handled.
 
bool basePropertyDeleteRequested (const ot::Property *_property)
 Handles base properties. Returns true if the requested property was handled.
 

Additional Inherited Members

- Public Types inherited from ot::GraphicsItem
enum  GraphicsItemEvent { ItemMoved , ItemResized }
 The GraphicsItemEvent is used to describe the type of an event that occured. More...
 
- 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
 
- Public Types inherited from GraphicsItemDesignerItemBase
enum class  DesignerItemFlag { NoDesignerItemFlags = 0x00 , DesignerItemIgnoreEvents = 0x01 }
 
typedef ot::Flags< DesignerItemFlagDesignerItemFlags
 
- Static Public Member Functions inherited from ot::GraphicsItem
static Painter2DcreateSelectionBorderPainter (void)
 Creates a StyleRefPainter2D painter referencing ot::ColorStyleValueEntry::GraphicsItemSelectionBorder. The caller takes ownership of the painter.
 
static Painter2DcreateHoverBorderPainter (void)
 Creates a StyleRefPainter2D painter referencing ot::ColorStyleValueEntry::GraphicsItemHoverBorder. The caller takes ownership of the painter.
 

Constructor & Destructor Documentation

◆ WrappedLineItem()

WrappedLineItem::WrappedLineItem ( )

◆ ~WrappedLineItem()

WrappedLineItem::~WrappedLineItem ( )
virtual

Member Function Documentation

◆ controlPointsChanged()

void WrappedLineItem::controlPointsChanged ( void )
overrideprotectedvirtual

Is called whenever the control points have changed (except when calling updateControlPoints()).

Implements GraphicsItemDesignerItemBase.

◆ createNavigationInformation()

ot::TreeWidgetItemInfo WrappedLineItem::createNavigationInformation ( void )
overridevirtual

Creates the navigation information for this item and its childs.

Implements GraphicsItemDesignerItemBase.

◆ fillPropertyGrid()

void WrappedLineItem::fillPropertyGrid ( void )
overrideprotectedvirtual

Is called when the property grid needs to be filled.

Implements GraphicsItemDesignerItemBase.

◆ getDefaultItemName()

virtual QString WrappedLineItem::getDefaultItemName ( void ) const
inlineoverridevirtual

Returns the default item name.

Implements GraphicsItemDesignerItemBase.

◆ getGraphicsItem()

virtual ot::GraphicsItem * WrappedLineItem::getGraphicsItem ( void )
inlineoverridevirtual

Returns the actual GraphicsItem.

Implements GraphicsItemDesignerItemBase.

◆ isDesignedItemCompleted()

virtual bool WrappedLineItem::isDesignedItemCompleted ( void ) const
inlineoverridevirtual

Returns true if the current item is completed. A completed item has all required control points set (e.g. Line start and Line end) and no more points may be set.

Implements GraphicsItemDesignerItemBase.

◆ isDesignedItemValid()

virtual bool WrappedLineItem::isDesignedItemValid ( void ) const
inlineoverridevirtual

Returns true if the current item is valid. A valid item has all required control points set (e.g. Line start and Line end). More points may be added (e.g. Polygon).

Implements GraphicsItemDesignerItemBase.

◆ itemChange()

QVariant WrappedLineItem::itemChange ( QGraphicsItem::GraphicsItemChange _change,
const QVariant & _constrains )
overrideprotectedvirtual

Reimplemented from ot::CustomGraphicsItem.

◆ propertyChanged()

void WrappedLineItem::propertyChanged ( const ot::Property * _property)
overrideprotectedvirtual

◆ propertyDeleteRequested()

void WrappedLineItem::propertyDeleteRequested ( const ot::Property * _property)
overrideprotectedvirtual

◆ setupDesignerItemFromConfig()

void WrappedLineItem::setupDesignerItemFromConfig ( const ot::GraphicsItemCfg * _config)
overridevirtual

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