From 550372ca0278d5ad418798eb2830353f45f783cf Mon Sep 17 00:00:00 2001 From: hagantsa Date: Tue, 8 Aug 2023 13:40:30 +0300 Subject: [PATCH] [ADDITIVE] Hide old std options in field editor, when 2022 std component is being edited. --- .../memoryMaps/SingleFieldEditor.cpp | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/editors/ComponentEditor/memoryMaps/SingleFieldEditor.cpp b/editors/ComponentEditor/memoryMaps/SingleFieldEditor.cpp index d96586ae5..2adf496c5 100644 --- a/editors/ComponentEditor/memoryMaps/SingleFieldEditor.cpp +++ b/editors/ComponentEditor/memoryMaps/SingleFieldEditor.cpp @@ -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); @@ -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); @@ -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);