HAL
gatelibrary_frame_state.cpp
Go to the documentation of this file.
1
#include "
gui/gatelibrary_management/gatelibrary_frames/gatelibrary_frame_state.h
"
2
#include "
gui/gatelibrary_management/gatelibrary_label.h
"
3
#include "
hal_core/netlist/gate_library/gate_type_component/state_component.h
"
4
5
namespace
hal
6
{
7
GatelibraryFrameState::GatelibraryFrameState
(
QWidget
* parent)
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
16
mLayout
->
setFieldGrowthPolicy
(
QFormLayout::AllNonFixedFieldsGrow
);
17
18
}
19
20
void
GatelibraryFrameState::update
(
GateType
* gt)
21
{
22
if
(gt->
has_component_of_type
(
GateTypeComponent::ComponentType::state
))
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
hal::GateLibraryLabel
Definition:
gatelibrary_label.h:34
hal::GateTypeComponent
Definition:
gate_type_component.h:40
hal::GateTypeComponent::ComponentType::state
@ state
hal::GateType
Definition:
gate_type.h:52
hal::GateType::has_component_of_type
bool has_component_of_type(const GateTypeComponent::ComponentType type) const
Definition:
gate_type.cpp:54
hal::GateType::get_component_as
T * get_component_as(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const
Definition:
gate_type.h:89
hal::GatelibraryComponentFrame
Definition:
gatelibrary_component_frame.h:38
hal::GatelibraryComponentFrame::mLayout
QFormLayout * mLayout
Definition:
gatelibrary_component_frame.h:43
hal::GatelibraryFrameState::GatelibraryFrameState
GatelibraryFrameState(QWidget *parent=nullptr)
Definition:
gatelibrary_frame_state.cpp:7
hal::StateComponent
Definition:
state_component.h:34
hal::StateComponent::is_class_of
static bool is_class_of(const GateTypeComponent *component)
Definition:
state_component.cpp:15
gatelibrary_frame_state.h
gatelibrary_label.h
hal
Definition:
parser_liberty.cpp:10
QFormLayout::AllNonFixedFieldsGrow
AllNonFixedFieldsGrow
QFormLayout::addRow
void addRow(QWidget *label, QWidget *field)
QFormLayout::setFieldGrowthPolicy
void setFieldGrowthPolicy(QFormLayout::FieldGrowthPolicy policy)
QLabel::setText
void setText(const QString &)
QObject::parent
QObject * parent() const const
QString::fromStdString
QString fromStdString(const std::string &str)
QWidget
QWidget::hide
void hide()
QWidget::show
void show()
QWidget::update
void update()
state_component.h
plugins
gui
src
gatelibrary_management
gatelibrary_frames
gatelibrary_frame_state.cpp
Generated on Fri Feb 14 2025 14:22:42 for HAL by
1.9.1