HAL
gatelibrary_frame_init.cpp
Go to the documentation of this file.
1
#include "
gui/gatelibrary_management/gatelibrary_frames/gatelibrary_frame_init.h
"
2
#include "
gui/gatelibrary_management/gatelibrary_label.h
"
3
#include "
hal_core/netlist/gate_library/gate_type_component/init_component.h
"
4
5
namespace
hal
6
{
7
GatelibraryFrameInit::GatelibraryFrameInit
(
QWidget
* parent)
8
:
GatelibraryComponentFrame
(
"Init from Data Field"
, parent)
9
{
10
mCategoryLabel =
new
GateLibraryLabel
(
true
,
" - "
,
this
);
11
mIdentifiersLabel =
new
GateLibraryLabel
(
true
,
" - "
,
this
);
12
13
mLayout
->
addRow
(
new
GateLibraryLabel
(
false
,
"Category:"
,
parent
), mCategoryLabel);
14
mLayout
->
addRow
(
new
GateLibraryLabel
(
false
,
"Identifiers:"
,
parent
), mIdentifiersLabel);
15
16
mLayout
->
setFieldGrowthPolicy
(
QFormLayout::AllNonFixedFieldsGrow
);
17
18
}
19
20
void
GatelibraryFrameInit::update
(
GateType
* gt)
21
{
22
if
(gt->
has_component_of_type
(
GateTypeComponent::ComponentType::init
))
23
{
24
auto
init = gt->
get_component_as
<
InitComponent
>([](
const
GateTypeComponent
* c) {
return
InitComponent::is_class_of
(c); });
25
26
if
(init !=
nullptr
)
27
{
28
mCategoryLabel->
setText
(
QString::fromStdString
(init->get_init_category()));
29
QString
ids =
""
;
30
31
bool
first =
true
;
32
for
(std::string i : init->get_init_identifiers()) {
33
if
(first)
34
first =
false
;
35
else
36
ids.
append
(
"\n"
);
37
38
ids.
append
(
QString::fromStdString
(i));
39
}
40
mIdentifiersLabel->
setText
(ids);
41
show
();
42
}
43
else
hide
();
44
}
45
else
hide
();
46
}
47
}
48
hal::GateLibraryLabel
Definition:
gatelibrary_label.h:34
hal::GateTypeComponent
Definition:
gate_type_component.h:40
hal::GateTypeComponent::ComponentType::init
@ init
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::GatelibraryFrameInit::GatelibraryFrameInit
GatelibraryFrameInit(QWidget *parent=nullptr)
Definition:
gatelibrary_frame_init.cpp:7
hal::InitComponent
Definition:
init_component.h:33
hal::InitComponent::is_class_of
static bool is_class_of(const GateTypeComponent *component)
Definition:
init_component.cpp:14
gatelibrary_frame_init.h
gatelibrary_label.h
init_component.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
QString::append
QString & append(QChar ch)
QString::fromStdString
QString fromStdString(const std::string &str)
QWidget
QWidget::hide
void hide()
QWidget::show
void show()
QWidget::update
void update()
plugins
gui
src
gatelibrary_management
gatelibrary_frames
gatelibrary_frame_init.cpp
Generated on Fri Feb 14 2025 14:22:42 for HAL by
1.9.1