HAL
gatelibrary_frame_state.cpp
Go to the documentation of this file.
4 
5 namespace hal
6 {
8  : GatelibraryComponentFrame("Internal States", parent)
9  {
10  mStateIdentifier = new GateLibraryLabel(true, " - ", this);
11  mNegStateIdentifier = new GateLibraryLabel(true, " - ", this);
12 
13  mLayout->addRow(new GateLibraryLabel(false, "State identifier:", parent), mStateIdentifier);
14  mLayout->addRow(new GateLibraryLabel(false, "Neg. state identifier:", parent), mNegStateIdentifier);
15 
17 
18  }
19 
21  {
23  {
24  auto stat = gt->get_component_as<StateComponent>([](const GateTypeComponent* c) { return StateComponent::is_class_of(c); });
25 
26  if(stat != nullptr)
27  {
28  mStateIdentifier->setText(QString::fromStdString(stat->get_state_identifier()));
29  mNegStateIdentifier->setText(QString::fromStdString(stat->get_neg_state_identifier()));
30  show();
31  }
32  else hide();
33  }
34  else hide();
35  }
36 }
37 
bool has_component_of_type(const GateTypeComponent::ComponentType type) const
Definition: gate_type.cpp:54
T * get_component_as(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const
Definition: gate_type.h:89
GatelibraryFrameState(QWidget *parent=nullptr)
static bool is_class_of(const GateTypeComponent *component)
void addRow(QWidget *label, QWidget *field)
void setFieldGrowthPolicy(QFormLayout::FieldGrowthPolicy policy)
void setText(const QString &)
QObject * parent() const const
QString fromStdString(const std::string &str)
void hide()
void show()
void update()