Version: 8.3.0
YACS::HMI::SceneCtrlInPortItem Class Reference

#include <SceneCtrlInPortItem.hxx>

Inheritance diagram for YACS::HMI::SceneCtrlInPortItem:
Collaboration diagram for YACS::HMI::SceneCtrlInPortItem:

Public Member Functions

 SceneCtrlInPortItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~SceneCtrlInPortItem ()
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
- Public Member Functions inherited from YACS::HMI::SceneCtrlPortItem
 SceneCtrlPortItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~SceneCtrlPortItem ()
 
virtual void setText (QString label)
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
virtual SceneNodeItemgetParentNode ()
 
SubjectNodegetSubjectNode ()
 
- Public Member Functions inherited from YACS::HMI::SceneItem
 SceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~SceneItem ()
 
virtual QRectF boundingRect () const
 
virtual QRectF childrenBoundingRect () const
 
virtual void setTopLeft (QPointF topLeft)
 
virtual void checkGeometryChange ()
 
void setParent (SceneItem *parent)
 
virtual QString getToolTip ()
 
void setEventPos (QPointF point)
 
virtual void updateChildItems ()
 
virtual void updateLinks ()
 
virtual void shrinkExpandLink (bool se)
 
virtual void shrinkExpandRecursive (bool isExpanding, bool fromHere, ShrinkMode theShrinkMode)
 
bool isAncestorShrinked ()
 
- Public Member Functions inherited from YACS::HMI::AbstractSceneItem
 AbstractSceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~AbstractSceneItem ()
 
int getLevel ()
 
void setLevel ()
 
virtual void reorganize ()
 
virtual QString getLabel ()
 
virtual void addHeader ()
 
virtual void addProgressItem ()
 
virtual qreal getHeaderBottom ()
 
qreal getWidth ()
 
qreal getHeight ()
 
virtual void setWidth (qreal width)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void setHeight (qreal height)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void activateSelection (bool selected)
 
virtual void setGeometryOptimization (bool optimize)
 
SceneItemgetParent ()
 
- Public Member Functions inherited from YACS::HMI::ScenePortItem
 ScenePortItem (QString label)
 
virtual ~ScenePortItem ()
 

Protected Member Functions

void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 
void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 
void dropEvent (QGraphicsSceneDragDropEvent *event)
 
- Protected Member Functions inherited from YACS::HMI::SceneCtrlPortItem
virtual QString getMimeFormat ()
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
- Protected Member Functions inherited from YACS::HMI::SceneItem
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 
virtual QColor getPenColor ()
 
virtual QColor getBrushColor ()
 
QColor hoverColor (QColor origColor)
 
- Protected Member Functions inherited from YACS::HMI::AbstractSceneItem
virtual QRectF childBoundingRect (AbstractSceneItem *child) const
 

Protected Attributes

bool _dragOver
 
- Protected Attributes inherited from YACS::HMI::SceneCtrlPortItem
bool _draging
 
bool _dragModifier
 
- Protected Attributes inherited from YACS::HMI::SceneItem
bool _hover
 
bool _ancestorShrinked
 
QPointF _eventPos
 
- Protected Attributes inherited from YACS::HMI::AbstractSceneItem
SceneItem_parent
 
YACS::HMI::Scene_scene
 
QString _label
 
int _level
 
qreal _width
 
qreal _height
 
qreal _incHeight
 
QColor _penColor
 
QColor _brushColor
 
QColor _hiPenColor
 
QColor _hiBrushColor
 
bool _hasHeader
 
bool _optimize
 
bool _dragable
 
enum Qt::MouseButton _dragButton
 
- Protected Attributes inherited from YACS::HMI::ScenePortItem
SceneTextItem_text
 

Additional Inherited Members

- Public Attributes inherited from YACS::HMI::SceneItem
bool _blocX
 
bool _blocY
 

Detailed Description

Definition at line 29 of file SceneCtrlInPortItem.hxx.

Constructor & Destructor Documentation

SceneCtrlInPortItem::SceneCtrlInPortItem ( QGraphicsScene scene,
SceneItem parent,
QString  label 
)

Definition at line 38 of file SceneCtrlInPortItem.cxx.

References _dragOver.

40  : SceneCtrlPortItem(scene, parent, label)
41 {
42  _dragOver = false;
43  setAcceptDrops(true);
44 }
SceneCtrlInPortItem::~SceneCtrlInPortItem ( )
virtual

Definition at line 46 of file SceneCtrlInPortItem.cxx.

47 {
48 }

Member Function Documentation

void SceneCtrlInPortItem::dragEnterEvent ( QGraphicsSceneDragDropEvent *  event)
protected

Definition at line 56 of file SceneCtrlInPortItem.cxx.

References _dragOver, and YACS::HMI::ItemMimeData::getSubject().

57 {
58  bool accepted = false;
59  const ItemMimeData *myData = dynamic_cast<const ItemMimeData*>(event->mimeData());
60  if (myData && myData->hasFormat("yacs/subjectOutGate"))
61  {
62  Subject *sub = myData->getSubject();
63  if (sub && dynamic_cast<SubjectNode*>(sub))
64  {
65  event->setAccepted(true);
66  _dragOver = true;
67  QGraphicsItem::update();
68  return;
69  }
70  }
71  event->setAccepted(accepted);
72 }
void SceneCtrlInPortItem::dragLeaveEvent ( QGraphicsSceneDragDropEvent *  event)
protected

Definition at line 74 of file SceneCtrlInPortItem.cxx.

References _dragOver.

75 {
76  Q_UNUSED(event);
77  _dragOver = false;
78  QGraphicsItem::update();
79 }
void SceneCtrlInPortItem::dropEvent ( QGraphicsSceneDragDropEvent *  event)
protected

Definition at line 81 of file SceneCtrlInPortItem.cxx.

References _dragOver, YACS::HMI::QtGuiContext::_mapOfSceneItem, YACS::HMI::SceneCtrlPortItem::getParentNode(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::SceneObserverItem::getSubject(), YACS::HMI::ItemMimeData::getSubject(), and YACS::HMI::SubjectNode::tryCreateLink().

82 {
83  Q_UNUSED(event);
84  _dragOver = false;
85  QGraphicsItem::update();
86 
87  const ItemMimeData *myData = dynamic_cast<const ItemMimeData*>(event->mimeData());
88  if (!myData) return;
89  if(!myData->hasFormat("yacs/subjectOutGate")) return;
90  Subject *sub = myData->getSubject();
91  if (!sub) return;
93  if (!item) return;
94  SceneNodeItem* outItem = dynamic_cast<SceneNodeItem*>(item);
95  if (!outItem) return;
96 
97  Subject *subFrom = outItem->getSubject();
98  if (!this->getParentNode()) return;
99  Subject *subTo = this->getParentNode()->getSubject();
100  SubjectNode* from = dynamic_cast<SubjectNode*>(subFrom);
101  SubjectNode* to = dynamic_cast<SubjectNode*>(subTo);
102  if (from && to)
103  {
104  if (!SubjectNode::tryCreateLink(from, to))
105  Message mess;
106  }
107 }
void SceneCtrlInPortItem::popupMenu ( QWidget caller,
const QPoint &  globalPos 
)
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 50 of file SceneCtrlInPortItem.cxx.

References gui.GraphViewer::m, and YACS::HMI::CtrlInPortMenu::popupMenu().

51 {
53  m.popupMenu(caller, globalPos);
54 }

Member Data Documentation

bool YACS::HMI::SceneCtrlInPortItem::_dragOver
protected

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