HAL
gatelibrary_frame_ram.cpp
Go to the documentation of this file.
4 
5 namespace hal
6 {
8  : GatelibraryComponentFrame("RAM", parent)
9  {
10  mBitSize = new GateLibraryLabel(true, " - ", this);
11 
12  mLayout->addRow(new GateLibraryLabel(false, "RAM bit size:", parent), mBitSize);
13 
15 
16  }
17 
19  {
21  {
22  auto ram = gt->get_component_as<RAMComponent>([](const GateTypeComponent* c) {return RAMComponent::is_class_of(c);});
23 
24  if(ram != nullptr)
25  {
26  mBitSize->setText(QString::fromStdString(std::to_string(ram->get_bit_size())));
27  show();
28  }
29  else
30  hide();
31  }
32  else
33  hide();
34  }
35 }
36 
GateLibraryFrameRAM(QWidget *parent=nullptr)
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
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()