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

View widget used to display GraphicsItems Note that the View creates its own scene. More...

#include "GraphicsView.h"

Inheritance diagram for ot::GraphicsView:
ot::QWidgetInterface GraphicsItemDesignerPreview GraphicsItemDesignerView ot::VersionGraph

Public Types

enum  GraphicsViewFlag { NoViewFlags = 0x00 , ViewManagesSceneRect = 0x01 , IgnoreConnectionByUser = 0x02 }
 
enum  ViewStateFlag { DefaultState = 0 << 0 , ItemMoveInProgress = 1 << 0 , MiddleMousePressedState = 1 << 1 , ReadOnlyState = 1 << 2 }
 
typedef Flags< GraphicsViewFlagGraphicsViewFlags
 
typedef ot::Flags< ViewStateFlagViewStateFlags
 

Signals

void itemRequested (const QString &_name, const QPointF &_pos)
 Will be emitted when an item was dropped into the scene by the user.
 
void connectionRequested (const ot::UID &_fromUid, const std::string &_fromConnector, const ot::UID &_toUid, const std::string &_toConnector)
 Will be emitted when a connection was "dropped" by the user.
 
void connectionToConnectionRequested (const ot::UID &_fromItemUid, const std::string &_fromItemConnector, const ot::UID &_toConnectionUid, const ot::Point2DD &_newControlPoint)
 
void itemMoved (const ot::UID &_uid, const QPointF &_newPos)
 
void itemConfigurationChanged (const ot::GraphicsItemCfg *_newConfig)
 
void removeItemsRequested (const ot::UIDList &_items, const ot::UIDList &_connections)
 
void itemCopyRequested (const GraphicsCopyInformation *_info)
 

Public Member Functions

 GraphicsView (GraphicsScene *_scene=(GraphicsScene *) nullptr)
 
virtual ~GraphicsView ()
 
virtual QWidget * getQWidget (void) override
 Returns a pointer to the root widget of this object.
 
virtual const QWidget * getQWidget (void) const override
 
void resetView (void)
 
void ensureViewInBounds (void)
 
void setMouseWheelEnabled (bool _enabled)
 
bool getMouseWheelEnabled (void) const
 
void setOwner (const BasicServiceInformation &_owner)
 
const BasicServiceInformationgetOwner (void) const
 
void setGraphicsViewFlag (GraphicsViewFlag _flag, bool _active=true)
 
void setGraphicsViewFlags (const GraphicsViewFlags &_flags)
 
const GraphicsViewFlagsgetGraphicsViewFlags (void) const
 
void setGraphicsScene (GraphicsScene *_scene)
 
GraphicsScenegetGraphicsScene (void)
 
GraphicsItemgetItem (const ot::UID &_itemUid)
 
GraphicsConnectionItemgetConnection (const ot::UID &_connectionUid)
 
bool connectionAlreadyExists (const ot::GraphicsConnectionCfg &connection)
 
void setDropsEnabled (bool _enabled)
 
void setGraphicsViewName (const std::string &_name)
 
const std::string & getGraphicsViewName (void) const
 
void addItem (ot::GraphicsItem *_item)
 
void removeItem (const ot::UID &_itemUid, bool bufferConnections=false)
 
std::list< ot::UIDgetSelectedItemUIDs (void) const
 
std::list< GraphicsItem * > getSelectedGraphicsItems (void) const
 
void setSceneMargins (const QMarginsF &_margins)
 
const QMarginsF & getSceneMargins (void) const
 
bool addConnectionIfConnectedItemsExist (const GraphicsConnectionCfg &_config)
 
void removeConnection (const GraphicsConnectionCfg &_connectionInformation)
 
void removeConnection (const ot::UID &_connectionInformation)
 
ot::UIDList getSelectedConnectionUIDs (void) const
 
std::list< GraphicsConnectionItem * > getSelectedConnectionItems (void) const
 
void requestConnection (const ot::UID &_fromUid, const std::string &_fromConnector, const ot::UID &_toUid, const std::string &_toConnector)
 
void requestConnectionToConnection (const ot::UID &_fromItemUid, const std::string &_fromItemConnector, const ot::UID &_toConnectionUid, const ot::Point2DD &_newControlPoint)
 
void notifyItemMoved (const ot::GraphicsItem *_item)
 
void notifyItemConfigurationChanged (const ot::GraphicsItem *_item)
 
QRectF getVisibleSceneRect (void) const
 
void setReadOnly (bool _isReadOnly)
 
bool isReadOnly (void) const
 
- Public Member Functions inherited from ot::QWidgetInterface
 QWidgetInterface ()
 
virtual ~QWidgetInterface ()
 
void setOTWidgetFlags (const WidgetFlags &_flags)
 
const WidgetFlagsotWidgetFlags (void) const
 

Protected Member Functions

virtual void wheelEvent (QWheelEvent *_event) override
 
virtual void mousePressEvent (QMouseEvent *_event) override
 
virtual void mouseReleaseEvent (QMouseEvent *_event) override
 
virtual void mouseMoveEvent (QMouseEvent *_event) override
 
virtual void keyPressEvent (QKeyEvent *_event) override
 
virtual void keyReleaseEvent (QKeyEvent *_event) override
 
virtual void resizeEvent (QResizeEvent *_event) override
 
virtual void dragEnterEvent (QDragEnterEvent *_event) override
 
virtual void dropEvent (QDropEvent *_event) override
 
virtual void dragMoveEvent (QDragMoveEvent *_event) override
 
- Protected Member Functions inherited from ot::QWidgetInterface
virtual void otWidgetFlagsChanged (const WidgetFlags &_flags)
 

Detailed Description

View widget used to display GraphicsItems Note that the View creates its own scene.

Member Typedef Documentation

◆ GraphicsViewFlags

◆ ViewStateFlags

Member Enumeration Documentation

◆ GraphicsViewFlag

Enumerator
NoViewFlags 
ViewManagesSceneRect 

No flags.

IgnoreConnectionByUser 

If set the view manages the scene rect when zooming or panning.

◆ ViewStateFlag

Enumerator
DefaultState 
ItemMoveInProgress 
MiddleMousePressedState 
ReadOnlyState 

Constructor & Destructor Documentation

◆ GraphicsView()

ot::GraphicsView::GraphicsView ( GraphicsScene * _scene = (GraphicsScene*)nullptr)

◆ ~GraphicsView()

ot::GraphicsView::~GraphicsView ( )
virtual

Member Function Documentation

◆ addConnectionIfConnectedItemsExist()

bool ot::GraphicsView::addConnectionIfConnectedItemsExist ( const GraphicsConnectionCfg & _config)

◆ addItem()

void ot::GraphicsView::addItem ( ot::GraphicsItem * _item)

◆ connectionAlreadyExists()

bool ot::GraphicsView::connectionAlreadyExists ( const ot::GraphicsConnectionCfg & connection)

◆ connectionRequested

void ot::GraphicsView::connectionRequested ( const ot::UID & _fromUid,
const std::string & _fromConnector,
const ot::UID & _toUid,
const std::string & _toConnector )
signal

Will be emitted when a connection was "dropped" by the user.

Parameters
_fromUidSource item UID
_fromConnectorSource connector (child of source item)
_toUidDestination item UID
_toConnectorDestination connector (child of destination item)

◆ connectionToConnectionRequested

void ot::GraphicsView::connectionToConnectionRequested ( const ot::UID & _fromItemUid,
const std::string & _fromItemConnector,
const ot::UID & _toConnectionUid,
const ot::Point2DD & _newControlPoint )
signal

◆ dragEnterEvent()

void ot::GraphicsView::dragEnterEvent ( QDragEnterEvent * _event)
overrideprotectedvirtual

◆ dragMoveEvent()

void ot::GraphicsView::dragMoveEvent ( QDragMoveEvent * _event)
overrideprotectedvirtual

◆ dropEvent()

void ot::GraphicsView::dropEvent ( QDropEvent * _event)
overrideprotectedvirtual

◆ ensureViewInBounds()

void ot::GraphicsView::ensureViewInBounds ( void )

◆ getConnection()

ot::GraphicsConnectionItem * ot::GraphicsView::getConnection ( const ot::UID & _connectionUid)

◆ getGraphicsScene()

GraphicsScene * ot::GraphicsView::getGraphicsScene ( void )
inline

◆ getGraphicsViewFlags()

const GraphicsViewFlags & ot::GraphicsView::getGraphicsViewFlags ( void ) const
inline

◆ getGraphicsViewName()

const std::string & ot::GraphicsView::getGraphicsViewName ( void ) const
inline

◆ getItem()

ot::GraphicsItem * ot::GraphicsView::getItem ( const ot::UID & _itemUid)

◆ getMouseWheelEnabled()

bool ot::GraphicsView::getMouseWheelEnabled ( void ) const
inline

◆ getOwner()

const BasicServiceInformation & ot::GraphicsView::getOwner ( void ) const
inline

◆ getQWidget() [1/2]

virtual const QWidget * ot::GraphicsView::getQWidget ( void ) const
inlineoverridevirtual

Implements ot::QWidgetInterface.

◆ getQWidget() [2/2]

virtual QWidget * ot::GraphicsView::getQWidget ( void )
inlineoverridevirtual

Returns a pointer to the root widget of this object.

Implements ot::QWidgetInterface.

◆ getSceneMargins()

const QMarginsF & ot::GraphicsView::getSceneMargins ( void ) const
inline

◆ getSelectedConnectionItems()

std::list< ot::GraphicsConnectionItem * > ot::GraphicsView::getSelectedConnectionItems ( void ) const

◆ getSelectedConnectionUIDs()

ot::UIDList ot::GraphicsView::getSelectedConnectionUIDs ( void ) const

◆ getSelectedGraphicsItems()

std::list< ot::GraphicsItem * > ot::GraphicsView::getSelectedGraphicsItems ( void ) const

◆ getSelectedItemUIDs()

std::list< ot::UID > ot::GraphicsView::getSelectedItemUIDs ( void ) const

◆ getVisibleSceneRect()

QRectF ot::GraphicsView::getVisibleSceneRect ( void ) const

◆ isReadOnly()

bool ot::GraphicsView::isReadOnly ( void ) const
inline

◆ itemConfigurationChanged

void ot::GraphicsView::itemConfigurationChanged ( const ot::GraphicsItemCfg * _newConfig)
signal

◆ itemCopyRequested

void ot::GraphicsView::itemCopyRequested ( const GraphicsCopyInformation * _info)
signal

◆ itemMoved

void ot::GraphicsView::itemMoved ( const ot::UID & _uid,
const QPointF & _newPos )
signal

◆ itemRequested

void ot::GraphicsView::itemRequested ( const QString & _name,
const QPointF & _pos )
signal

Will be emitted when an item was dropped into the scene by the user.

Parameters
_nameItem name
_posItem scene position

◆ keyPressEvent()

void ot::GraphicsView::keyPressEvent ( QKeyEvent * _event)
overrideprotectedvirtual

Reimplemented in GraphicsItemDesignerView.

◆ keyReleaseEvent()

void ot::GraphicsView::keyReleaseEvent ( QKeyEvent * _event)
overrideprotectedvirtual

◆ mouseMoveEvent()

void ot::GraphicsView::mouseMoveEvent ( QMouseEvent * _event)
overrideprotectedvirtual

◆ mousePressEvent()

void ot::GraphicsView::mousePressEvent ( QMouseEvent * _event)
overrideprotectedvirtual

◆ mouseReleaseEvent()

void ot::GraphicsView::mouseReleaseEvent ( QMouseEvent * _event)
overrideprotectedvirtual

◆ notifyItemConfigurationChanged()

void ot::GraphicsView::notifyItemConfigurationChanged ( const ot::GraphicsItem * _item)

◆ notifyItemMoved()

void ot::GraphicsView::notifyItemMoved ( const ot::GraphicsItem * _item)

◆ removeConnection() [1/2]

void ot::GraphicsView::removeConnection ( const GraphicsConnectionCfg & _connectionInformation)

◆ removeConnection() [2/2]

void ot::GraphicsView::removeConnection ( const ot::UID & _connectionInformation)

◆ removeItem()

void ot::GraphicsView::removeItem ( const ot::UID & _itemUid,
bool bufferConnections = false )

◆ removeItemsRequested

void ot::GraphicsView::removeItemsRequested ( const ot::UIDList & _items,
const ot::UIDList & _connections )
signal

◆ requestConnection()

void ot::GraphicsView::requestConnection ( const ot::UID & _fromUid,
const std::string & _fromConnector,
const ot::UID & _toUid,
const std::string & _toConnector )

◆ requestConnectionToConnection()

void ot::GraphicsView::requestConnectionToConnection ( const ot::UID & _fromItemUid,
const std::string & _fromItemConnector,
const ot::UID & _toConnectionUid,
const ot::Point2DD & _newControlPoint )

◆ resetView()

void ot::GraphicsView::resetView ( void )

◆ resizeEvent()

void ot::GraphicsView::resizeEvent ( QResizeEvent * _event)
overrideprotectedvirtual

◆ setDropsEnabled()

void ot::GraphicsView::setDropsEnabled ( bool _enabled)
inline

◆ setGraphicsScene()

void ot::GraphicsView::setGraphicsScene ( GraphicsScene * _scene)

◆ setGraphicsViewFlag()

void ot::GraphicsView::setGraphicsViewFlag ( GraphicsViewFlag _flag,
bool _active = true )
inline

◆ setGraphicsViewFlags()

void ot::GraphicsView::setGraphicsViewFlags ( const GraphicsViewFlags & _flags)
inline

◆ setGraphicsViewName()

void ot::GraphicsView::setGraphicsViewName ( const std::string & _name)
inline

◆ setMouseWheelEnabled()

void ot::GraphicsView::setMouseWheelEnabled ( bool _enabled)
inline

◆ setOwner()

void ot::GraphicsView::setOwner ( const BasicServiceInformation & _owner)
inline

◆ setReadOnly()

void ot::GraphicsView::setReadOnly ( bool _isReadOnly)
inline

◆ setSceneMargins()

void ot::GraphicsView::setSceneMargins ( const QMarginsF & _margins)
inline

◆ wheelEvent()

void ot::GraphicsView::wheelEvent ( QWheelEvent * _event)
overrideprotectedvirtual

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