Version: 9.16.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 select (bool isSelected)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
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)
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 _emphasized, _execState, _itemBackground, _itemCheckState, _itemData, _itemDeco, _itemForeground, _itemToolTip, _itemWhatsThis, _label, YACS::HMI::QtGuiContext::_mapOfSchemaItem, _parentItem, _subject, appendChild(), YACS::HMI::Subject::attach(), DEBTRACE, YACS::HMI::QtGuiContext::getQtCurrent(), parent(), 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);
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 _label, YACS::HMI::QtGuiContext::_mapOfSchemaItem, _parentItem, _subject, DEBTRACE, YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::QtGuiContext::getSchemaModel(), modelIndex(), removeChild(), and row().

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 _childItems, child(), and DEBTRACE.

Referenced by reparent(), SchemaItem(), 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}

References _childItems, and row().

Referenced by appendChild(), YACS::HMI::SchemaModel::index(), insertChild(), removeChild(), 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}

References _itemData.

◆ 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

References _itemBackground, _itemCheckState, _itemData, _itemDeco, _itemForeground, editionToolTip(), editionWhatsThis(), YACS::HMI::QtGuiContext::getQtCurrent(), runToolTip(), and runWhatsThis().

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}

References _itemData.

Referenced by data().

◆ editionWhatsThis()

QVariant SchemaItem::editionWhatsThis ( int  column) const
protectedvirtual

◆ flags()

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

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

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::SchemaComposedNodeItem, YACS::HMI::SchemaNodeItem, and YACS::HMI::SchemaOutPortItem.

Definition at line 333 of file SchemaItem.cxx.

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

Referenced by mimeData().

◆ 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 _childItems, child(), DEBTRACE, and row().

◆ 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 _subject, DEBTRACE, getMimeFormat(), 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 _parentItem, YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::SchemaModel::getRootItem(), YACS::HMI::QtGuiContext::getSchemaModel(), YACS::HMI::SchemaModel::index(), modelIndex(), and row().

Referenced by YACS::HMI::SchemaContainerItem::addComponentInstance(), YACS::HMI::SchemaDirContainersItem::addContainerItem(), YACS::HMI::SchemaDirLinksItem::addLinkItem(), YACS::HMI::SchemaDirTypesItem::addTypeItem(), modelIndex(), YACS::HMI::SchemaDirTypesItem::removeTypeItem(), YACS::HMI::TreeView::resizeColumns(), YACS::HMI::SchemaComposedNodeItem::SchemaComposedNodeItem(), select(), 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(), update(), YACS::HMI::SchemaNodeItem::update(), YACS::HMI::SchemaOutPortItem::update(), YACS::HMI::SchemaReferenceItem::update(), YACS::HMI::TablePortsEdition::upOrDown(), and ~SchemaItem().

◆ parent()

◆ popupMenu()

◆ removeChild()

◆ reparent()

void SchemaItem::reparent ( SchemaItem parent)
virtual

◆ row()

int SchemaItem::row ( ) const
virtual

◆ 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}

References _itemData.

Referenced by data().

◆ 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}

References _itemWhatsThis.

Referenced by data().

◆ 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)
YACS::HMI::GenericGui * getGMain()
YACS::HMI::ItemEditionRoot * getEditionRoot()
QItemSelectionModel * getSelectionModel()
virtual TypeOfElem getType()

References _label, _subject, YACS::HMI::ADD, YACS::HMI::ADDCONTROLLINK, YACS::HMI::ADDLINK, YACS::HMI::CONTROLLINK, YACS::HMI::DATALINK, DEBTRACE, YACS::HMI::QtGuiContext::getEditionRoot(), YACS::HMI::QtGuiContext::getGMain(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::QtGuiContext::getSelectionModel(), YACS::HMI::Subject::getType(), modelIndex(), YACS::HMI::GenericGui::raiseStacked(), YACS::HMI::QtGuiContext::setSelectedSubject(), and YACS::HMI::ItemEdition::update().

◆ setCaseValue()

void SchemaItem::setCaseValue ( )
virtual

used in node derived classes

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

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 _execState, _itemData, _itemForeground, YACS::ACTIVATED, YACS::HMI::Resource::ACTIVATED, DEBTRACE, YACS::HMI::Resource::DEFAULT, YACS::DESACTIVATED, YACS::HMI::Resource::DESACTIVATED, YACS::DISABLED, YACS::HMI::Resource::DISABLED, YACS::DONE, YACS::HMI::Resource::DONE, YACS::ERROR, YACS::HMI::Resource::ERROR, YACS::EXECFAILED, YACS::HMI::Resource::EXECFAILED, YACS::FAILED, YACS::HMI::Resource::FAILED, YACS::INTERNALERR, YACS::HMI::Resource::INTERNALERR, YACS::INVALID, YACS::HMI::Resource::INVALID, YACS::LOADED, YACS::HMI::Resource::LOADED, YACS::LOADFAILED, YACS::HMI::Resource::LOADFAILED, YACS::PAUSE, YACS::HMI::Resource::PAUSE, YACS::READY, YACS::HMI::Resource::READY, YACS::SUSPENDED, YACS::HMI::Resource::SUSPENDED, YACS::TOACTIVATE, YACS::HMI::Resource::TOACTIVATE, YACS::TOLOAD, YACS::HMI::Resource::TOLOAD, YACS::UNDEFINED, YACS::HMI::Resource::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 _itemCheckState, 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::SchemaComponentItem, YACS::HMI::SchemaComposedNodeItem, YACS::HMI::SchemaContainerItem, YACS::HMI::SchemaDataTypeItem, YACS::HMI::SchemaInPortItem, YACS::HMI::SchemaLinkItem, YACS::HMI::SchemaNodeItem, YACS::HMI::SchemaOutPortItem, and YACS::HMI::SchemaReferenceItem.

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 _itemBackground, _itemData, _label, _subject, DEBTRACE, YACS::HMI::EDIT, YACS::HMI::SchemaModel::editedBackBrush(), YACS::HMI::EMPHASIZE, YACS::HMI::SchemaModel::emphasizeBackBrush(), YACS::HMI::Subject::getName(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::QtGuiContext::getSchemaModel(), modelIndex(), 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.

Referenced by appendChild(), child(), childCount(), insertChild(), removeChild(), and row().

◆ _emphasized

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

Definition at line 88 of file SchemaItem.hxx.

Referenced by isEmphasized(), SchemaItem(), and setEmphasize().

◆ _execState

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

◆ _itemBackground

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

Definition at line 80 of file SchemaItem.hxx.

Referenced by data(), SchemaItem(), YACS::HMI::SchemaProcItem::setExecState(), and update().

◆ _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.

Referenced by SchemaItem().

◆ _itemWhatsThis

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

Definition at line 83 of file SchemaItem.hxx.

Referenced by editionWhatsThis(), runWhatsThis(), and SchemaItem().

◆ _label

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

◆ _parentItem

◆ _subject


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