Version: 8.3.0
YACS::HMI::EditionLoop Class Reference

#include <EditionLoop.hxx>

Inheritance diagram for YACS::HMI::EditionLoop:
Collaboration diagram for YACS::HMI::EditionLoop:

Public Slots

virtual void onNbStepsEdited ()
 

Public Member Functions

 EditionLoop (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionLoop ()
 
virtual void synchronize ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
- Public Member Functions inherited from YACS::HMI::EditionNode
 EditionNode (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionNode ()
 
- Public Member Functions inherited from YACS::HMI::ItemEdition
 ItemEdition (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~ItemEdition ()
 
virtual void select (bool isSelected)
 
virtual void setName (std::string name)
 
virtual void setEdited (bool isEdited)
 
- Public Member Functions inherited from FormEditItem
 FormEditItem (QWidget *parent=0)
 
virtual ~FormEditItem ()
 
- Public Member Functions inherited from YACS::HMI::ItemEditionBase
 ItemEditionBase (Subject *subject)
 
virtual ~ItemEditionBase ()
 
virtual SubjectgetSubject ()
 
- 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 Attributes

FormLoop_formLoop
 
QLineEdit_le_index
 
int _nbsteps
 
- Protected Attributes inherited from YACS::HMI::EditionNode
QLineEdit_le_fullName
 
SubjectNode_subjectNode
 
- Protected Attributes inherited from YACS::HMI::ItemEdition
bool _isEdited
 
bool _haveScript
 
- Protected Attributes inherited from FormEditItem
WidEditItem_wid
 
- Protected Attributes inherited from YACS::HMI::ItemEditionBase
Subject_subject
 
int _stackId
 
std::string _name
 
std::string _type
 
std::string _category
 
- Protected Attributes inherited from YACS::HMI::GuiObserver
std::set< Subject * > _subjectSet
 
bool _destructible
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::ItemEdition
static std::string filterName (const std::string &name)
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 31 of file EditionLoop.hxx.

Constructor & Destructor Documentation

EditionLoop::EditionLoop ( Subject subject,
QWidget parent = 0,
const char *  name = 0 
)

Definition at line 37 of file EditionLoop.cxx.

References _formLoop, _le_index, _nbsteps, FormEditItem::_wid, YACS::HMI::QtGuiContext::getQtCurrent(), and onNbStepsEdited().

40  : EditionNode(subject, parent, name)
41 {
42  _formLoop = new FormLoop(this);
43  _nbsteps = 0;
44  _wid->gridLayout1->addWidget(_formLoop);
45 
46  QHBoxLayout* _hbl_index = new QHBoxLayout();
47  QLabel* _la_index = new QLabel(this);
48  _hbl_index->addWidget(_la_index);
49  _la_index->setText("index:");
50  _le_index = new QLineEdit(this);
51  _le_index->setText(QString::number(0));
52  _le_index->setReadOnly(true);
53  _hbl_index->addWidget(_le_index);
54  _formLoop->gridLayout->addLayout(_hbl_index, 1, 0);
55 
56  _formLoop->sb_nsteps->setMinimum(0);
57  _formLoop->sb_nsteps->setMaximum(INT_MAX);
58  if (!QtGuiContext::getQtCurrent()->isEdition())
59  _formLoop->setEnabled (false);
60 
61  connect(_formLoop->sb_nsteps, SIGNAL(editingFinished()),
62  this, SLOT(onNbStepsEdited()));
63 }
EditionLoop::~EditionLoop ( )
virtual

Definition at line 65 of file EditionLoop.cxx.

66 {
67 }

Member Function Documentation

void EditionLoop::onNbStepsEdited ( )
virtualslot

Definition at line 69 of file EditionLoop.cxx.

References _formLoop, _nbsteps, YACS::HMI::ItemEditionBase::_subject, DEBTRACE, YACS::HMI::SubjectForLoop::setNbSteps(), and YASSERT.

Referenced by EditionLoop().

70 {
71  int newval = _formLoop->sb_nsteps->value();
72  DEBTRACE("EditionLoop::onNbStepsEdited " << _nbsteps << " --> " << newval);
73  if (newval != _nbsteps)
74  {
75  SubjectForLoop *sfl = dynamic_cast<SubjectForLoop*>(_subject);
76  YASSERT(sfl);
77  QString text = _formLoop->sb_nsteps->cleanText();
78  sfl->setNbSteps(text.toStdString());
79  }
80 }
void EditionLoop::synchronize ( )
virtual

used in derived nodes for synchronisation with schema model.

Reimplemented from YACS::HMI::ItemEdition.

Definition at line 82 of file EditionLoop.cxx.

References YACS::HMI::ItemEditionBase::_subject, YACS::HMI::SETVALUE, and YACS::HMI::Subject::update().

83 {
85 }
void EditionLoop::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

when loading a schema, creation of all edition widgets is time and memory consuming, so, widget edition creation is differed until user select an item in tree or 2D vue.

Reimplemented from YACS::HMI::EditionNode.

Definition at line 87 of file EditionLoop.cxx.

References _formLoop, _le_index, YACS::HMI::GuiContext::_mapOfSubjectDataPort, _nbsteps, YACS::HMI::ItemEditionBase::_subject, DEBTRACE, YACS::HMI::GuiObserver::eventName(), YACS::HMI::SubjectDataPort::getExecValue(), YACS::HMI::SubjectNode::getNode(), YACS::ENGINE::Node::getOutputPort(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::SubjectComposedNode::getValue(), CORBAEngineTest::i, YACS::HMI::SETVALUE, YACS::HMI::EditionNode::update(), and YACS::HMI::UPDATEPROGRESS.

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

88 {
89  DEBTRACE("EditionLoop::update " <<eventName(event) << " " << type);
90  EditionNode::update(event, type, son);
91  switch (event)
92  {
93  case SETVALUE:
94  {
95  SubjectComposedNode * scn = dynamic_cast<SubjectComposedNode*>(_subject);
96  string val = scn->getValue();
97  istringstream ss(val);
98  DEBTRACE(val);
99  int i = 0;
100  ss >> i;
101  DEBTRACE(i);
102  _formLoop->sb_nsteps->setValue(i);
103  _nbsteps = i;
104 
105  YACS::ENGINE::OutputPort* odp=scn->getNode()->getOutputPort("index");
107  _le_index->setText(QString::fromStdString(sodp->getExecValue()));
108  break;
109  }
110  case UPDATEPROGRESS:
111  {
112  SubjectComposedNode * scn = dynamic_cast<SubjectComposedNode*>(_subject);
113  YACS::ENGINE::OutputPort* odp=scn->getNode()->getOutputPort("index");
115  _le_index->setText(QString::fromStdString(sodp->getExecValue()));
116  break;
117  }
118  }
119 }

Member Data Documentation

FormLoop* YACS::HMI::EditionLoop::_formLoop
protected

Definition at line 47 of file EditionLoop.hxx.

Referenced by EditionLoop(), onNbStepsEdited(), and update().

QLineEdit* YACS::HMI::EditionLoop::_le_index
protected

Definition at line 48 of file EditionLoop.hxx.

Referenced by EditionLoop(), and update().

int YACS::HMI::EditionLoop::_nbsteps
protected

Definition at line 49 of file EditionLoop.hxx.

Referenced by EditionLoop(), onNbStepsEdited(), and update().


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