Version: 8.3.0
YACS::HMI::SchemaOutPortItem Class Reference

#include <SchemaOutPortItem.hxx>

Inheritance diagram for YACS::HMI::SchemaOutPortItem:
Collaboration diagram for YACS::HMI::SchemaOutPortItem:

Public Member Functions

 SchemaOutPortItem (SchemaItem *parent, QString label, Subject *subject)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual Qt::ItemFlags flags (const QModelIndex &index)
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
- Public Member Functions inherited from YACS::HMI::SchemaItem
 SchemaItem (SchemaItem *parent, QString label, Subject *subject)
 
virtual ~SchemaItem ()
 
virtual void appendChild (SchemaItem *child)
 
virtual void removeChild (SchemaItem *child)
 
virtual void insertChild (int row, SchemaItem *child)
 
virtual SchemaItemchild (int row)
 
virtual int childCount () const
 
virtual int columnCount () const
 
virtual QVariant data (int column, int role) const
 
virtual int row () const
 
virtual SchemaItemparent ()
 
virtual SubjectgetSubject ()
 
virtual void select (bool isSelected)
 
virtual void toggleState ()
 
QModelIndex modelIndex (int column=0)
 
virtual ItemMimeDatamimeData (ItemMimeData *mime)
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action)
 
virtual void reparent (SchemaItem *parent)
 
virtual void setCaseValue ()
 used in node derived classes More...
 
bool isEmphasized ()
 
void setEmphasize (bool emphasize)
 
- Public Member Functions inherited from YACS::HMI::GuiObserver
 GuiObserver ()
 
virtual ~GuiObserver ()
 
virtual void incrementSubjects (Subject *subject)
 
virtual void decrementSubjects (Subject *subject)
 
int getNbSubjects ()
 
bool isDestructible ()
 

Protected Member Functions

virtual QString getMimeFormat ()
 
- Protected Member Functions inherited from YACS::HMI::SchemaItem
virtual QVariant editionToolTip (int column) const
 
virtual QVariant runToolTip (int column) const
 
virtual QVariant editionWhatsThis (int column) const
 
virtual QVariant runWhatsThis (int column) const
 
virtual void setExecState (int execState)
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::GuiObserver
static std::string eventName (GuiEvent event)
 
static void setEventMap ()
 
- Protected Attributes inherited from YACS::HMI::SchemaItem
QList< SchemaItem * > _childItems
 
QList< QVariant > _itemData
 
QList< QVariant > _itemDeco
 
QList< QVariant > _itemForeground
 
QList< QVariant > _itemBackground
 
QList< QVariant > _itemCheckState
 
QList< QVariant > _itemToolTip
 
QList< QVariant > _itemWhatsThis
 
QString _label
 
SchemaItem_parentItem
 
Subject_subject
 
int _execState
 
bool _emphasized
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 29 of file SchemaOutPortItem.hxx.

Constructor & Destructor Documentation

SchemaOutPortItem::SchemaOutPortItem ( SchemaItem parent,
QString  label,
Subject subject 
)

column 1: YLabel = name, set in SchemaItem, column 2: YType = data type, never editable, column 3: YValue = value

Definition at line 47 of file SchemaOutPortItem.cxx.

References YACS::HMI::SchemaItem::_itemData, YACS::HMI::SchemaItem::_itemDeco, YACS::HMI::SchemaItem::_itemForeground, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::DataPort::getAsString(), YACS::HMI::SubjectDataPort::getPort(), YACS::HMI::ProcInvoc::getTypeOfPort(), YACS::ENGINE::TypeCode::name(), YACS::HMI::OUTPUTDATASTREAMPORT, YACS::HMI::OUTPUTPORT, YACS::HMI::YLabel, YACS::HMI::YType, and YACS::HMI::YValue.

48  : SchemaItem(parent, label, subject)
49 {
50  SubjectDataPort *subPort = dynamic_cast<SubjectDataPort*>(subject);
51  if (subPort)
52  {
53  DataPort *dport = subPort->getPort();
54  TypeOfElem typort = ProcInvoc::getTypeOfPort(dport);
55 // _itemData.replace(YType, dport->edGetType()->getKindRepr());
56  _itemData.replace(YType, dport->edGetType()->name());
57  _itemForeground.replace(YType, QColor("black"));
58  OutputPort * outport = 0;
59 
60  switch (typort)
61  {
63  _itemDeco.replace(YLabel, QIcon("icons:out_port.png"));
64  outport = dynamic_cast<OutputPort*>(dport);
65  _itemData.replace(YValue, outport->getAsString().c_str());
66  break;
68  _itemDeco.replace(YLabel, QIcon("icons:out_port.png"));
69  _itemData.replace(YValue, "stream");
70  _itemForeground.replace(YValue, QColor("grey"));
71  //_itemDeco.replace(YValue, QColor("grey"));
72  break;
73  }
74  }
75 }

Member Function Documentation

Qt::ItemFlags SchemaOutPortItem::flags ( const QModelIndex &  index)
virtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 123 of file SchemaOutPortItem.cxx.

References YACS::HMI::SchemaItem::_subject, YACS::ENGINE::Port::getNode(), YACS::HMI::SubjectDataPort::getPort(), YACS::HMI::QtGuiContext::getQtCurrent(), and YACS::HMI::SchemaItem::parent().

124 {
125  //DEBTRACE("SchemaOutPortItem::flags");
126  Qt::ItemFlags pflag = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
127  if (QtGuiContext::getQtCurrent()->isEdition())
128  pflag = pflag | Qt::ItemIsDragEnabled;
129  else
130  return pflag;
131 
132  Qt::ItemFlags flagEdit = 0;
133  int column = index.column();
134  switch (column)
135  {
136  case 0:
137  {
138  SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(_subject);
139  Node *parent = sdp->getPort()->getNode();
140  if (parent)
141  if (dynamic_cast<DataNode*>(parent) || dynamic_cast<InlineNode*>(parent))
142  flagEdit = Qt::ItemIsEditable; // --- port name editable
143  }
144  break;
145  case 2:
146  SubjectDataPort *sdp = dynamic_cast<SubjectDataPort*>(_subject);
147  Node *node = sdp->getPort()->getNode();
148  //PresetNode *pnode = dynamic_cast<PresetNode*>(node);
149  DataNode *pnode = dynamic_cast<DataNode*>(node);
150  if (! pnode) break;
151  flagEdit = Qt::ItemIsEditable; // --- port value editable for preset node
152  break;
153  }
154  return pflag | flagEdit;
155 }
QString SchemaOutPortItem::getMimeFormat ( )
protectedvirtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 163 of file SchemaOutPortItem.cxx.

164 {
165  return "yacs/subjectOutPort";
166 }
void SchemaOutPortItem::popupMenu ( QWidget caller,
const QPoint &  globalPos 
)
virtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 157 of file SchemaOutPortItem.cxx.

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

158 {
159  OutPortMenu m;
160  m.popupMenu(caller, globalPos);
161 }
void SchemaOutPortItem::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 77 of file SchemaOutPortItem.cxx.

References YACS::HMI::SchemaItem::_itemData, YACS::HMI::SchemaItem::_itemForeground, DEBTRACE, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::DataPort::getAsString(), YACS::HMI::SubjectDataPort::getExecValue(), YACS::HMI::SubjectDataPort::getPort(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::QtGuiContext::getSchemaModel(), YACS::HMI::SchemaItem::modelIndex(), YACS::ENGINE::TypeCode::name(), YACS::HMI::SchemaModel::setData(), YACS::HMI::SETVALUE, YACS::HMI::SchemaItem::update(), YACS::HMI::UPDATE, YACS::HMI::UPDATEPROGRESS, YACS::HMI::YType, and YACS::HMI::YValue.

Referenced by gui.graph.MyCanvas::customEvent().

78 {
79  DEBTRACE("SchemaOutPortItem::update");
80  SchemaItem::update(event, type, son);
81  QModelIndex index = QModelIndex();
83  switch (event)
84  {
85  case SETVALUE:
86  {
87  SubjectOutputPort *sop = dynamic_cast<SubjectOutputPort*>(son);
88  if (sop)
89  {
90  DataFlowPort *port = dynamic_cast<DataFlowPort*>(sop->getPort());
91  DEBTRACE(port->getAsString());
92  _itemData.replace(YValue, port->getAsString().c_str());
93  _itemForeground.replace(YValue, QColor("green"));
94  model->setData(modelIndex(YValue), 0); // --- to emit dataChanged signal
95  }
96  }
97  break;
98  case UPDATE:
99  {
100  SubjectOutputPort *sop = dynamic_cast<SubjectOutputPort*>(son);
101  if (sop)
102  {
103  DataFlowPort *port = dynamic_cast<DataFlowPort*>(sop->getPort());
104  _itemData.replace(YType, port->edGetType()->name());
105  _itemForeground.replace(YType, QColor("black"));
106  }
107  }
108  break;
109  case UPDATEPROGRESS:
110  {
111  SubjectOutputPort *sip = dynamic_cast<SubjectOutputPort*>(son);
112  if (sip)
113  {
114  _itemData.replace(YValue, sip->getExecValue().c_str());
115  _itemForeground.replace(YValue, QColor("darkMagenta"));
116  model->setData(modelIndex(YValue), 0); // --- to emit dataChanged signal
117  }
118  }
119  break;
120  }
121 }

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