Skip to content

Commit

Permalink
[ADDITIVE] Hide old std options in field editor, when 2022 std compon…
Browse files Browse the repository at this point in the history
…ent is being edited.
  • Loading branch information
hagantsa committed Aug 8, 2023
1 parent 3586dcb commit 550372c
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions editors/ComponentEditor/memoryMaps/SingleFieldEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ void SingleFieldEditor::connectSignals()
//-----------------------------------------------------------------------------
void SingleFieldEditor::setupLayout()
{
bool showStd14 = component()->getRevision() == Document::Revision::Std14;

QScrollArea* scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setFrameShape(QFrame::NoFrame);
Expand All @@ -500,9 +502,13 @@ void SingleFieldEditor::setupLayout()
QFormLayout* fieldDefinitionLayout = new QFormLayout(fieldDefinitionGroup);
fieldDefinitionLayout->addRow(tr("Offset [bits], f(x):"), offsetEditor_);
fieldDefinitionLayout->addRow(tr("Width [bits], f(x):"), widthEditor_);
fieldDefinitionLayout->addRow(tr("Is present, f(x):"), isPresentEditor_);
fieldDefinitionLayout->addRow(tr("Reserved, f(x):"), reservedEditor_);
fieldDefinitionLayout->addRow(tr("Field ID:"), fieldIdEditor_);

if (showStd14)
{
fieldDefinitionLayout->addRow(tr("Is present, f(x):"), isPresentEditor_);
fieldDefinitionLayout->addRow(tr("Reserved, f(x):"), reservedEditor_);
fieldDefinitionLayout->addRow(tr("Field ID:"), fieldIdEditor_);
}

QGroupBox* fieldConstraintGroup = new QGroupBox(tr("Field constraints"));
QFormLayout* fieldConstraintLayout = new QFormLayout(fieldConstraintGroup);
Expand Down Expand Up @@ -541,12 +547,22 @@ void SingleFieldEditor::setupLayout()
fieldConstraintLayout->addRow(tr("Write constraint minimum, f(x):"), writeConstraintMinLimit_);
fieldConstraintLayout->addRow(tr("Write constraint maximum, f(x):"), writeConstraintMaxLimit_);

fieldConstraintGroup->setVisible(showStd14);

QGridLayout* topOfPageLayout = new QGridLayout();
topOfPageLayout->addWidget(&nameEditor_, 0, 0);
topOfPageLayout->addWidget(fieldConstraintGroup, 0, 1);
topOfPageLayout->addWidget(fieldDefinitionGroup, 1, 0);
topOfPageLayout->addWidget(resetsEditor_, 1, 1);

if (showStd14)
{
topOfPageLayout->addWidget(fieldConstraintGroup, 0, 1);
topOfPageLayout->addWidget(resetsEditor_, 1, 1);
}
else
{
topOfPageLayout->addWidget(resetsEditor_, 0, 1, 2, 1);
}

QWidget* topOfPageWidget = new QWidget();
topOfPageWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
topOfPageWidget->setLayout(topOfPageLayout);
Expand Down

0 comments on commit 550372c

Please sign in to comment.