Version: 9.15.0
YACS::HMI::SchemaItem Class Reference

#include <SchemaItem.hxx>

Inheritance diagram for YACS::HMI::SchemaItem:
Collaboration diagram for YACS::HMI::SchemaItem:

Public Member Functions

 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 Qt::ItemFlags flags (const QModelIndex &index)
 
virtual int row () const
 
virtual SchemaItemparent ()
 
virtual SubjectgetSubject ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual void select (bool isSelected)
 
virtual void toggleState ()
 
QModelIndex modelIndex (int column=0)
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
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 QVariant editionToolTip (int column) const
 
virtual QVariant runToolTip (int column) const
 
virtual QVariant editionWhatsThis (int column) const
 
virtual QVariant runWhatsThis (int column) const
 
virtual QString getMimeFormat ()
 
virtual void setExecState (int execState)
 

Protected Attributes

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
 
- Protected Attributes inherited from YACS::HMI::GuiObserver
std::set< Subject * > _subjectSet
 
bool _destructible
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::GuiObserver
static std::string eventName (GuiEvent event)
 
static void setEventMap ()
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 36 of file SchemaItem.hxx.

Constructor & Destructor Documentation

◆ SchemaItem()

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

Definition at line 39 of file SchemaItem.cxx.

40 {
41  DEBTRACE("SchemaItem::SchemaItem " << label.toStdString() << " " << this);
43  _label = label;
44  _subject = subject;
45 
46  _itemData << QVariant() << QVariant() << QVariant(); // --- 3 columns max
47  _itemDeco << QVariant() << QVariant() << QVariant(); // --- 3 columns max
48  _itemForeground << QVariant() << QVariant() << QVariant(); // --- 3 columns max
49  _itemBackground << QVariant() << QVariant() << QVariant(); // --- 3 columns max
50  _itemCheckState << QVariant() << QVariant() << QVariant(); // --- 3 columns max
51  _itemToolTip << QVariant() << QVariant() << QVariant(); // --- 3 columns max
52  _itemWhatsThis << QVariant() << QVariant() << QVariant(); // --- 3 columns max
53  _itemData.replace(YLabel, label);
54  _itemToolTip.replace(YLabel, label);
55  _itemWhatsThis.replace(YLabel, QString("This is the default WhatsThis of ") + label);
56 
57  _itemForeground.replace(YLabel, QColor("blue"));
58  _itemBackground.replace(YLabel, QtGuiContext::getQtCurrent()->getSchemaModel()->stdBackBrush());
59  //_itemCheckState.replace(YLabel, Qt::Unchecked); // --- only for item with checkbox
60 
61  if (_subject)
62  {
63  _subject->attach(this);
65  }
66 
67  if (_parentItem)
68  _parentItem->appendChild(this);
70  _emphasized = false;
71 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::map< YACS::HMI::Subject *, YACS::HMI::SchemaItem * > _mapOfSchemaItem
static QtGuiContext * getQtCurrent()
virtual void appendChild(SchemaItem *child)
Definition: SchemaItem.cxx:87
QList< QVariant > _itemToolTip
Definition: SchemaItem.hxx:82
QList< QVariant > _itemCheckState
Definition: SchemaItem.hxx:81
QList< QVariant > _itemDeco
Definition: SchemaItem.hxx:78
virtual SchemaItem * parent()
Definition: SchemaItem.cxx:163
QList< QVariant > _itemBackground
Definition: SchemaItem.hxx:80
SchemaItem * _parentItem
Definition: SchemaItem.hxx:85
QList< QVariant > _itemForeground
Definition: SchemaItem.hxx:79
QList< QVariant > _itemData
Definition: SchemaItem.hxx:77
QList< QVariant > _itemWhatsThis
Definition: SchemaItem.hxx:83
virtual void attach(GuiObserver *obs)
@ UNDEFINED
Definition: define.hxx:35

References DEBTRACE, YACS::UNDEFINED, and YACS::HMI::YLabel.

◆ ~SchemaItem()

SchemaItem::~SchemaItem ( )
virtual

Definition at line 73 of file SchemaItem.cxx.

74 {
75  DEBTRACE("SchemaItem::~SchemaItem " << _label.toStdString() << " " << this);
76  if (_parentItem)
77  {
79  int position = row();
80  model->beginRemoveRows(_parentItem->modelIndex(), position, position);
82  _parentItem->removeChild(this);
83  model->endRemoveRows();
84  }
85 }
YACS::HMI::SchemaModel * getSchemaModel()
virtual int row() const
Definition: SchemaItem.cxx:154
QModelIndex modelIndex(int column=0)
Definition: SchemaItem.cxx:253
virtual void removeChild(SchemaItem *child)
Definition: SchemaItem.cxx:93

References DEBTRACE.

Member Function Documentation

◆ appendChild()

void SchemaItem::appendChild ( SchemaItem child)
virtual

Definition at line 87 of file SchemaItem.cxx.

88 {
89  DEBTRACE("SchemaItem::appendChild");
90  _childItems.append(child);
91 }
QList< SchemaItem * > _childItems
Definition: SchemaItem.hxx:76
virtual SchemaItem * child(int row)
Definition: SchemaItem.cxx:105

References DEBTRACE.

Referenced by reparent(), and YACS::HMI::SchemaNodeItem::update().

◆ child()

SchemaItem * SchemaItem::child ( int  row)
virtual

Definition at line 105 of file SchemaItem.cxx.

106 {
107  //DEBTRACE("SchemaItem::child");
108  return _childItems.value(row);
109 }

Referenced by YACS::HMI::SchemaModel::index(), and YACS::HMI::SchemaNodeItem::update().

◆ childCount()

◆ columnCount()

int SchemaItem::columnCount ( ) const
virtual

Definition at line 117 of file SchemaItem.cxx.

118 {
119  //DEBTRACE("SchemaItem::columnCount " << _itemData.count());
120  return _itemData.count();
121 }

◆ data()

QVariant SchemaItem::data ( int  column,
int  role 
) const
virtual

Definition at line 123 of file SchemaItem.cxx.

124 {
125  //DEBTRACE("SchemaItem::data "<< column);
126  if (role == Qt::DisplayRole)
127  return _itemData.value(column);
128  if (role == Qt::DecorationRole)
129  return _itemDeco.value(column);
130  if (role == Qt::ForegroundRole)
131  return _itemForeground.value(column);
132  if (role == Qt::BackgroundRole)
133  return _itemBackground.value(column);
134  if (role == Qt::CheckStateRole)
135  return _itemCheckState.value(column);
136  if (role == Qt::ToolTipRole)
137  if (QtGuiContext::getQtCurrent()->isEdition())
138  return editionToolTip(column);
139  else
140  return runToolTip(column);
141  if (role == Qt::WhatsThisRole)
142  if (QtGuiContext::getQtCurrent()->isEdition())
143  return editionWhatsThis(column);
144  else
145  return runWhatsThis(column);
146  return QVariant();
147 }
virtual QVariant runToolTip(int column) const
Definition: SchemaItem.cxx:311
virtual QVariant editionWhatsThis(int column) const
Definition: SchemaItem.cxx:321
virtual QVariant runWhatsThis(int column) const
Definition: SchemaItem.cxx:327
virtual QVariant editionToolTip(int column) const
Definition: SchemaItem.cxx:301

Referenced by YACS::HMI::SchemaModel::data(), YACS::HMI::SchemaComposedNodeItem::dropMimeData(), YACS::HMI::SchemaDirTypesItem::dropMimeData(), YACS::HMI::SchemaInPortItem::dropMimeData(), YACS::HMI::SchemaNodeItem::dropMimeData(), and YACS::HMI::SceneObserverItem::getToolTip().

◆ dropMimeData()

bool SchemaItem::dropMimeData ( const QMimeData data,
Qt::DropAction  action 
)
virtual

◆ editionToolTip()

QVariant SchemaItem::editionToolTip ( int  column) const
protectedvirtual

Reimplemented in YACS::HMI::SchemaProcItem.

Definition at line 301 of file SchemaItem.cxx.

302 {
303  QString val = QString("Edition: ") + _itemData.value(0).toString();
304  QString val1 = _itemData.value(1).toString();
305  QString val2 = _itemData.value(2).toString();
306  if (!val1.isEmpty()) val += QString(" | ") + val1;
307  if (!val2.isEmpty()) val += QString(" | ") + val2;
308  return val;
309 }

◆ editionWhatsThis()

QVariant SchemaItem::editionWhatsThis ( int  column) const
protectedvirtual

◆ flags()

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

Reimplemented in YACS::HMI::SchemaOutPortItem, YACS::HMI::SchemaNodeItem, YACS::HMI::SchemaInPortItem, YACS::HMI::SchemaDirTypesItem, YACS::HMI::SchemaDirLinksItem, and YACS::HMI::SchemaComposedNodeItem.

Definition at line 149 of file SchemaItem.cxx.

150 {
151  return Qt::ItemIsEnabled | Qt::ItemIsSelectable;// | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
152 }

Referenced by YACS::HMI::SchemaModel::flags().

◆ getMimeFormat()

QString SchemaItem::getMimeFormat ( )
protectedvirtual

Reimplemented in YACS::HMI::SchemaOutPortItem, YACS::HMI::SchemaNodeItem, and YACS::HMI::SchemaComposedNodeItem.

Definition at line 333 of file SchemaItem.cxx.

334 {
335  return "yacs/subject";
336 }

◆ getSubject()

◆ insertChild()

void SchemaItem::insertChild ( int  row,
SchemaItem child 
)
virtual

Definition at line 99 of file SchemaItem.cxx.

100 {
101  DEBTRACE("SchemaItem::insertChild");
102  _childItems.insert(row, child);
103 }

References DEBTRACE.

◆ isEmphasized()

bool YACS::HMI::SchemaItem::isEmphasized ( )
inline

Definition at line 66 of file SchemaItem.hxx.

66 {return _emphasized; };

References _emphasized.

◆ mimeData()

ItemMimeData * SchemaItem::mimeData ( ItemMimeData mime)
virtual

setData mime type must be coherent with SchemaModel::mimeTypes

Definition at line 276 of file SchemaItem.cxx.

277 {
278  DEBTRACE("SchemaItem::mimeData");
279  mime->setSubject(_subject);
280  mime->setData(getMimeFormat(), "_subject");
281  return mime;
282 }
virtual void setSubject(Subject *sub)
virtual QString getMimeFormat()
Definition: SchemaItem.cxx:333

References DEBTRACE, and YACS::HMI::ItemMimeData::setSubject().

Referenced by YACS::HMI::SchemaModel::mimeData().

◆ modelIndex()

QModelIndex SchemaItem::modelIndex ( int  column = 0)

Definition at line 253 of file SchemaItem.cxx.

254 {
255  //DEBTRACE("SchemaItem::modelIndex " << _label.toStdString() << " " << column);
257  if (_parentItem && (_parentItem !=schema->getRootItem()))
258  return schema->index(row(),
259  column,
261  else
262  return schema->index(row(),
263  column,
264  QModelIndex());
265 }
SchemaItem * getRootItem()
Definition: SchemaModel.hxx:78
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: SchemaModel.cxx:60

References YACS::HMI::SchemaModel::getRootItem(), and YACS::HMI::SchemaModel::index().

Referenced by YACS::HMI::SchemaContainerItem::addComponentInstance(), YACS::HMI::SchemaDirContainersItem::addContainerItem(), YACS::HMI::SchemaDirLinksItem::addLinkItem(), YACS::HMI::SchemaDirTypesItem::addTypeItem(), YACS::HMI::SchemaDirTypesItem::removeTypeItem(), YACS::HMI::TreeView::resizeColumns(), YACS::HMI::SchemaComposedNodeItem::SchemaComposedNodeItem(), YACS::HMI::SchemaComposedNodeItem::setCaseValue(), YACS::HMI::SchemaNodeItem::setCaseValue(), YACS::HMI::ItemEdition::setEdited(), YACS::HMI::EditionElementaryNode::synchronize(), YACS::HMI::EditionSwitch::synchronize(), YACS::HMI::SchemaComponentItem::update(), YACS::HMI::SchemaComposedNodeItem::update(), YACS::HMI::SchemaContainerItem::update(), YACS::HMI::SchemaInPortItem::update(), YACS::HMI::SchemaNodeItem::update(), YACS::HMI::SchemaOutPortItem::update(), YACS::HMI::SchemaReferenceItem::update(), and YACS::HMI::TablePortsEdition::upOrDown().

◆ parent()

◆ popupMenu()

◆ removeChild()

void SchemaItem::removeChild ( SchemaItem child)
virtual

◆ reparent()

void SchemaItem::reparent ( SchemaItem parent)
virtual

◆ row()

int SchemaItem::row ( ) const
virtual

Definition at line 154 of file SchemaItem.cxx.

155 {
156  //DEBTRACE("SchemaItem::row");
157  int row=0;
158  if (_parentItem)
159  row = _parentItem->_childItems.indexOf(const_cast<SchemaItem*>(this));
160  return row;
161 }

Referenced by YACS::HMI::SchemaModel::parent(), YACS::HMI::SchemaDirTypesItem::removeTypeItem(), YACS::HMI::SchemaComponentItem::update(), YACS::HMI::SchemaComposedNodeItem::update(), and YACS::HMI::SchemaContainerItem::update().

◆ runToolTip()

QVariant SchemaItem::runToolTip ( int  column) const
protectedvirtual

Reimplemented in YACS::HMI::SchemaProcItem.

Definition at line 311 of file SchemaItem.cxx.

312 {
313  QString val = QString("Execution: ") + _itemData.value(0).toString();
314  QString val1 = _itemData.value(1).toString();
315  QString val2 = _itemData.value(2).toString();
316  if (!val1.isEmpty()) val += QString(" | ") + val1;
317  if (!val2.isEmpty()) val += QString(" | ") + val2;
318  return val;
319 }

◆ runWhatsThis()

QVariant SchemaItem::runWhatsThis ( int  column) const
protectedvirtual

Definition at line 327 of file SchemaItem.cxx.

328 {
329  QString val = QString("Execution help: ") + _itemWhatsThis.value(column).toString();
330  return val;
331 }

◆ select()

void SchemaItem::select ( bool  isSelected)
virtual

Reimplemented from YACS::HMI::GuiObserver.

Definition at line 206 of file SchemaItem.cxx.

207 {
208  DEBTRACE("SchemaItem::select " << _label.toStdString() << " " << isSelected);
209  QItemSelectionModel* selectionModel = QtGuiContext::getQtCurrent()->getSelectionModel();
210  QModelIndex anIndex = modelIndex();
211  QItemSelection newSelection(anIndex, anIndex);
212 
213  if (isSelected)
214  {
215  if (!QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(_subject))
216  {
217  int elemType = _subject->getType();
219  if (elemType == YACS::HMI::DATALINK) event = YACS::HMI::ADDLINK;
220  else if (elemType == YACS::HMI::CONTROLLINK) event = YACS::HMI::ADDCONTROLLINK;
222  }
223 
225  QItemSelection currentSelected = selectionModel->selection();
226  if (currentSelected != newSelection)
227  {
228  DEBTRACE("currentSelected != newSelection");
229  // selectionModel->select(newSelection, QItemSelectionModel::ClearAndSelect);
230  selectionModel->select(newSelection, QItemSelectionModel::Clear);
231  selectionModel->select(newSelection, QItemSelectionModel::Select);
232  }
234  }
235  else
236  selectionModel->select(newSelection, QItemSelectionModel::Deselect);
237 }
virtual void update(GuiEvent event, int type, Subject *son)
void setSelectedSubject(YACS::HMI::Subject *sub)
QItemSelectionModel * getSelectionModel()
YACS::HMI::ItemEditionRoot * getEditionRoot()
YACS::HMI::GenericGui * getGMain()
virtual TypeOfElem getType()

References YACS::HMI::ADD, YACS::HMI::ADDCONTROLLINK, YACS::HMI::ADDLINK, YACS::HMI::CONTROLLINK, YACS::HMI::DATALINK, and DEBTRACE.

◆ setCaseValue()

void SchemaItem::setCaseValue ( )
virtual

used in node derived classes

Reimplemented in YACS::HMI::SchemaNodeItem, and YACS::HMI::SchemaComposedNodeItem.

Definition at line 297 of file SchemaItem.cxx.

298 {
299 }

Referenced by YACS::HMI::SchemaComposedNodeItem::update().

◆ setEmphasize()

void YACS::HMI::SchemaItem::setEmphasize ( bool  emphasize)
inline

Definition at line 67 of file SchemaItem.hxx.

67 {_emphasized = emphasize; };

References _emphasized.

◆ setExecState()

void SchemaItem::setExecState ( int  execState)
protectedvirtual

Reimplemented in YACS::HMI::SchemaProcItem.

Definition at line 338 of file SchemaItem.cxx.

339 {
340  DEBTRACE("SchemaItem::setExecState " << execState);
341  _execState = execState;
342  QString stateDef;
343  QColor sc;
344  switch (_execState)
345  {
346  case YACS::UNDEFINED: sc = Resource::UNDEFINED ; stateDef = "UNDEFINED" ; break;
347  case YACS::INVALID: sc = Resource::INVALID ; stateDef = "INVALID" ; break;
348  case YACS::READY: sc = Resource::READY ; stateDef = "READY" ; break;
349  case YACS::TOLOAD: sc = Resource::TOLOAD ; stateDef = "TOLOAD" ; break;
350  case YACS::LOADED: sc = Resource::LOADED ; stateDef = "LOADED" ; break;
351  case YACS::TOACTIVATE: sc = Resource::TOACTIVATE ; stateDef = "TOACTIVATE" ; break;
352  case YACS::ACTIVATED: sc = Resource::ACTIVATED ; stateDef = "ACTIVATED" ; break;
353  case YACS::DESACTIVATED: sc = Resource::DESACTIVATED; stateDef = "DESACTIVATED"; break;
354  case YACS::DONE: sc = Resource::DONE ; stateDef = "DONE" ; break;
355  case YACS::SUSPENDED: sc = Resource::SUSPENDED ; stateDef = "SUSPENDED" ; break;
356  case YACS::LOADFAILED: sc = Resource::LOADFAILED ; stateDef = "LOADFAILED" ; break;
357  case YACS::EXECFAILED: sc = Resource::EXECFAILED ; stateDef = "EXECFAILED" ; break;
358  case YACS::PAUSE: sc = Resource::PAUSE ; stateDef = "PAUSE" ; break;
359  case YACS::INTERNALERR: sc = Resource::INTERNALERR ; stateDef = "INTERNALERR" ; break;
360  case YACS::DISABLED: sc = Resource::DISABLED ; stateDef = "DISABLED" ; break;
361  case YACS::FAILED: sc = Resource::FAILED ; stateDef = "FAILED" ; break;
362  case YACS::ERROR: sc = Resource::ERROR ; stateDef = "ERROR" ; break;
363  default: sc = Resource::DEFAULT ; stateDef = "---" ;
364  }
365  _itemData.replace(YState, stateDef);
366  _itemForeground.replace(YState, sc);
367 }
static QColor DESACTIVATED
Definition: Resource.hxx:243
static QColor DONE
Definition: Resource.hxx:244
static QColor ACTIVATED
Definition: Resource.hxx:242
static QColor DISABLED
Definition: Resource.hxx:250
static QColor FAILED
Definition: Resource.hxx:251
static QColor INVALID
Definition: Resource.hxx:237
static QColor EXECFAILED
Definition: Resource.hxx:247
static QColor UNDEFINED
Definition: Resource.hxx:236
static QColor INTERNALERR
Definition: Resource.hxx:249
static QColor LOADED
Definition: Resource.hxx:240
static QColor READY
Definition: Resource.hxx:238
static QColor DEFAULT
Definition: Resource.hxx:253
static QColor TOACTIVATE
Definition: Resource.hxx:241
static QColor LOADFAILED
Definition: Resource.hxx:246
static QColor SUSPENDED
Definition: Resource.hxx:245
static QColor TOLOAD
Definition: Resource.hxx:239
static QColor ERROR
Definition: Resource.hxx:252
static QColor PAUSE
Definition: Resource.hxx:248
@ INVALID
Definition: define.hxx:36
@ FAILED
Definition: define.hxx:51
@ DESACTIVATED
Definition: define.hxx:42
@ EXECFAILED
Definition: define.hxx:46
@ TOLOAD
Definition: define.hxx:38
@ LOADED
Definition: define.hxx:39
@ READY
Definition: define.hxx:37
@ ACTIVATED
Definition: define.hxx:41
@ INTERNALERR
Definition: define.hxx:49
@ DONE
Definition: define.hxx:43
@ TOACTIVATE
Definition: define.hxx:40
@ SUSPENDED
Definition: define.hxx:44
@ PAUSE
Definition: define.hxx:47
@ DISABLED
Definition: define.hxx:50
@ LOADFAILED
Definition: define.hxx:45
@ ERROR
Definition: define.hxx:52

References YACS::ACTIVATED, DEBTRACE, YACS::DESACTIVATED, YACS::DISABLED, YACS::DONE, YACS::ERROR, YACS::EXECFAILED, YACS::FAILED, YACS::INTERNALERR, YACS::INVALID, YACS::LOADED, YACS::LOADFAILED, YACS::PAUSE, YACS::READY, YACS::SUSPENDED, YACS::TOACTIVATE, YACS::TOLOAD, YACS::UNDEFINED, and YACS::HMI::YState.

Referenced by YACS::HMI::SchemaComposedNodeItem::SchemaComposedNodeItem(), YACS::HMI::SchemaNodeItem::SchemaNodeItem(), YACS::HMI::SchemaComposedNodeItem::update(), and YACS::HMI::SchemaNodeItem::update().

◆ toggleState()

void SchemaItem::toggleState ( )
virtual

Reimplemented in YACS::HMI::SchemaNodeItem.

Definition at line 239 of file SchemaItem.cxx.

240 {
241  if (_itemCheckState.value(YLabel) == Qt::Unchecked)
242  {
243  DEBTRACE("SchemaItem::toggleState true");
244  _itemCheckState.replace(YLabel, Qt::Checked);
245  }
246  else
247  {
248  DEBTRACE("SchemaItem::toggleState false");
249  _itemCheckState.replace(YLabel, Qt::Unchecked);
250  }
251 }

References DEBTRACE, and YACS::HMI::YLabel.

Referenced by YACS::HMI::SchemaModel::setData(), and YACS::HMI::SchemaNodeItem::toggleState().

◆ update()

void SchemaItem::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

Reimplemented from YACS::HMI::GuiObserver.

Reimplemented in YACS::HMI::SchemaReferenceItem, YACS::HMI::SchemaOutPortItem, YACS::HMI::SchemaNodeItem, YACS::HMI::SchemaLinkItem, YACS::HMI::SchemaInPortItem, YACS::HMI::SchemaDataTypeItem, YACS::HMI::SchemaContainerItem, YACS::HMI::SchemaComposedNodeItem, and YACS::HMI::SchemaComponentItem.

Definition at line 174 of file SchemaItem.cxx.

175 {
176  //DEBTRACE("SchemaItem::update "<< eventName(event) <<" "<<type<<" "<<son);
177  QModelIndex index = QModelIndex();
179  switch (event)
180  {
181  case RENAME:
182  DEBTRACE("SchemaItem::update RENAME " << _subject->getName());
183  _label = _subject->getName().c_str();
184  _itemData.replace(YLabel, _label);
185  model->setData(modelIndex(YLabel), 0); // --- to emit dataChanged signal
186  break;
187  case EDIT:
188  if (type)
189  _itemBackground.replace(YLabel, model->editedBackBrush());
190  else
191  _itemBackground.replace(YLabel, model->stdBackBrush());
192  model->setData(modelIndex(YLabel), 0); // --- to emit dataChanged signal
193  break;
194  case EMPHASIZE:
195  if (type)
196  _itemBackground.replace(YLabel, model->emphasizeBackBrush());
197  else
198  _itemBackground.replace(YLabel, model->stdBackBrush());
199  model->setData(modelIndex(YLabel), 0); // --- to emit dataChanged signal
200  break;
201  default:
202  break;
203  }
204 }
const QBrush & emphasizeBackBrush()
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
const QBrush & editedBackBrush()
const QBrush & stdBackBrush()
virtual std::string getName()

References DEBTRACE, YACS::HMI::EDIT, YACS::HMI::SchemaModel::editedBackBrush(), YACS::HMI::EMPHASIZE, YACS::HMI::SchemaModel::emphasizeBackBrush(), YACS::HMI::RENAME, YACS::HMI::SchemaModel::setData(), YACS::HMI::SchemaModel::stdBackBrush(), and YACS::HMI::YLabel.

Referenced by gui.graph.MyCanvas::customEvent(), YACS::HMI::SchemaComposedNodeItem::update(), YACS::HMI::SchemaContainerItem::update(), YACS::HMI::SchemaDataTypeItem::update(), YACS::HMI::SchemaInPortItem::update(), YACS::HMI::SchemaLinkItem::update(), YACS::HMI::SchemaNodeItem::update(), YACS::HMI::SchemaOutPortItem::update(), and YACS::HMI::SchemaReferenceItem::update().

Member Data Documentation

◆ _childItems

QList<SchemaItem*> YACS::HMI::SchemaItem::_childItems
protected

Definition at line 76 of file SchemaItem.hxx.

◆ _emphasized

bool YACS::HMI::SchemaItem::_emphasized
protected

Definition at line 88 of file SchemaItem.hxx.

Referenced by isEmphasized(), and setEmphasize().

◆ _execState

int YACS::HMI::SchemaItem::_execState
protected

Definition at line 87 of file SchemaItem.hxx.

Referenced by YACS::HMI::SchemaProcItem::setExecState().

◆ _itemBackground

QList<QVariant> YACS::HMI::SchemaItem::_itemBackground
protected

Definition at line 80 of file SchemaItem.hxx.

Referenced by YACS::HMI::SchemaProcItem::setExecState().

◆ _itemCheckState

QList<QVariant> YACS::HMI::SchemaItem::_itemCheckState
protected

◆ _itemData

◆ _itemDeco

◆ _itemForeground

◆ _itemToolTip

QList<QVariant> YACS::HMI::SchemaItem::_itemToolTip
protected

Definition at line 82 of file SchemaItem.hxx.

◆ _itemWhatsThis

QList<QVariant> YACS::HMI::SchemaItem::_itemWhatsThis
protected

Definition at line 83 of file SchemaItem.hxx.

◆ _label

QString YACS::HMI::SchemaItem::_label
protected

Definition at line 84 of file SchemaItem.hxx.

Referenced by YACS::HMI::SchemaReferenceItem::update().

◆ _parentItem

SchemaItem* YACS::HMI::SchemaItem::_parentItem
protected

◆ _subject


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