From 284392e8aaa183a67662114dc788a114d651d74f Mon Sep 17 00:00:00 2001 From: IonutMuthi Date: Thu, 14 Nov 2024 04:22:39 -0500 Subject: [PATCH] regmap: style updates Signed-off-by: IonutMuthi --- plugins/regmap/src/deviceregistermap.cpp | 9 ++++++--- .../src/register/registerdetailedwidget.cpp | 16 +++++++++++----- .../regmap/src/register/registersimplewidget.cpp | 2 +- plugins/regmap/src/registercontroller.cpp | 2 -- plugins/regmap/src/registermaptool.cpp | 3 +++ plugins/regmap/src/regmapstylehelper.cpp | 5 ++--- plugins/regmap/src/titlespinbox.cpp | 7 +++---- .../qss/properties/regmap/registercontroller.qss | 4 ++-- .../style/qss/properties/regmap/regmapSlider.qss | 8 ++++---- .../style/qss/properties/regmap/titleSpinbox.qss | 2 +- 10 files changed, 33 insertions(+), 25 deletions(-) diff --git a/plugins/regmap/src/deviceregistermap.cpp b/plugins/regmap/src/deviceregistermap.cpp index 807da275d9..1b654b6708 100644 --- a/plugins/regmap/src/deviceregistermap.cpp +++ b/plugins/regmap/src/deviceregistermap.cpp @@ -77,7 +77,7 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R tool->bottomCentral()->setVisible(true); layout->addWidget(tool); - Style::setBackgroundColor(this, Style::getAttribute(json::theme::interactive_primary_disabled)); + Style::setBackgroundColor(this, Style::getAttribute(json::theme::interactive_secondary_disabled)); initSettings(); @@ -96,6 +96,8 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R QWidget *registerMapTable = new QWidget(); QVBoxLayout *registerMapTableLayout = new QVBoxLayout(registerMapTable); + registerMapTableLayout->setMargin(0); + registerMapTableLayout->setSpacing(0); Utils::removeLayoutMargins(registerMapTableLayout); registerMapTable->setLayout(registerMapTableLayout); tool->addWidgetToCentralContainerHelper(registerMapTable); @@ -108,7 +110,7 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R QWidget *registerTableHead = new QWidget(tableHeadWidget); Style::setBackgroundColor(registerTableHead, - Style::getAttribute(json::theme::interactive_subtle_disabled)); + Style::getAttribute(json::theme::interactive_secondary_disabled)); QHBoxLayout *registerTableHeadLayout = new QHBoxLayout(registerTableHead); registerTableHeadLayout->setSpacing(0); @@ -119,7 +121,8 @@ DeviceRegisterMap::DeviceRegisterMap(RegisterMapTemplate *registerMapTemplate, R registerTableHead->setFixedWidth(180); QWidget *colBitCount = new QWidget(tableHeadWidget); - Style::setBackgroundColor(colBitCount, Style::getAttribute(json::theme::interactive_subtle_disabled)); + Style::setBackgroundColor(colBitCount, + Style::getAttribute(json::theme::interactive_secondary_disabled)); QHBoxLayout *tableHead = new QHBoxLayout(colBitCount); colBitCount->setLayout(tableHead); diff --git a/plugins/regmap/src/register/registerdetailedwidget.cpp b/plugins/regmap/src/register/registerdetailedwidget.cpp index b26e195903..88ecb9bc1a 100644 --- a/plugins/regmap/src/register/registerdetailedwidget.cpp +++ b/plugins/regmap/src/register/registerdetailedwidget.cpp @@ -49,19 +49,22 @@ RegisterDetailedWidget::RegisterDetailedWidget(RegisterModel *regModel, QWidget QVBoxLayout *layout = new QVBoxLayout(this); Utils::removeLayoutMargins(layout); setLayout(layout); - layout->setSpacing(5); + layout->setSpacing(0); regWidth = regModel->getWidth(); QWidget *nameDescriptionWidget = new QWidget(this); - Style::setBackgroundColor(nameDescriptionWidget, Style::getAttribute(json::theme::interactive_subtle_disabled)); + Style::setBackgroundColor(nameDescriptionWidget, + Style::getAttribute(json::theme::interactive_secondary_disabled)); QHBoxLayout *nameDescriptionLayout = new QHBoxLayout(nameDescriptionWidget); nameDescriptionWidget->setLayout(nameDescriptionLayout); + // nameDescriptionLayout->setMargin(10); + QLabel *nameLabel = new QLabel("Name: " + regModel->getName(), this); QLabel *descriptionLabel = new QLabel("Description: " + regModel->getDescription(), this); nameDescriptionLayout->addWidget(nameLabel); nameDescriptionLayout->addWidget(descriptionLabel); - setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); QGridLayout *bitFieldsWidgetLayout = new QGridLayout(); bitFieldsWidgetLayout->setMargin(0); @@ -70,12 +73,15 @@ RegisterDetailedWidget::RegisterDetailedWidget(RegisterModel *regModel, QWidget bitFieldList = new QVector(); BitFieldDetailedWidgetFactory bitFieldDetailedWidgetFactory; QWidget *bitFieldsWidget = new QWidget(); + bitFieldsWidget->setContentsMargins(0, 0, 2, 0); bitFieldsWidget->setLayout(bitFieldsWidgetLayout); VerticalScrollArea *scrollArea = new VerticalScrollArea(); scrollArea->setWidget(bitFieldsWidget); + + // layout->addWidget(nameDescriptionWidget); layout->addWidget(scrollArea); - bitFieldsWidgetLayout->addWidget(nameDescriptionWidget, 0, 0, 1, 8); + bitFieldsWidgetLayout->addWidget(nameDescriptionWidget, 0, 0, 1, 3); int currentBitFieldCount = 0; int row = 1; int col = 0; @@ -106,7 +112,7 @@ RegisterDetailedWidget::RegisterDetailedWidget(RegisterModel *regModel, QWidget bitFieldsWidgetLayout->setColumnStretch(col, 1); col++; } - bitFieldsWidgetLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Expanding), + bitFieldsWidgetLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding), row + 1, col); } } diff --git a/plugins/regmap/src/register/registersimplewidget.cpp b/plugins/regmap/src/register/registersimplewidget.cpp index b8567bcb8d..51825c2721 100644 --- a/plugins/regmap/src/register/registersimplewidget.cpp +++ b/plugins/regmap/src/register/registersimplewidget.cpp @@ -57,7 +57,7 @@ RegisterSimpleWidget::RegisterSimpleWidget(RegisterModel *registerModel, QVector setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); QHBoxLayout *layout = new QHBoxLayout(); - layout->setMargin(2); + layout->setContentsMargins(0, 2, 0, 2); layout->setSpacing(4); setLayout(layout); diff --git a/plugins/regmap/src/registercontroller.cpp b/plugins/regmap/src/registercontroller.cpp index 2c19d2e472..081d49c9cf 100644 --- a/plugins/regmap/src/registercontroller.cpp +++ b/plugins/regmap/src/registercontroller.cpp @@ -181,8 +181,6 @@ void RegisterController::applyStyle() Style::setStyle(writeButton, style::properties::button::basicButton, true, true); writeButton->setFixedHeight(40); Style::setStyle(valueLabel, style::properties::label::menuSmall); - - // setStyleSheet(RegmapStyleHelper::regmapControllerStyle(nullptr)); } void RegisterController::startTutorial() diff --git a/plugins/regmap/src/registermaptool.cpp b/plugins/regmap/src/registermaptool.cpp index f6b3be8a85..21ab2f0a09 100644 --- a/plugins/regmap/src/registermaptool.cpp +++ b/plugins/regmap/src/registermaptool.cpp @@ -63,6 +63,9 @@ RegisterMapTool::RegisterMapTool(QWidget *parent) tool->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tool->topContainer()->setVisible(true); tool->rightContainer()->setVisible(true); + tool->layout()->setMargin(4); + tool->layout()->setSpacing(2); + tool->centralContainer()->layout()->setSpacing(0); lay->addWidget(tool); InfoBtn *infoBtn = new InfoBtn(this); diff --git a/plugins/regmap/src/regmapstylehelper.cpp b/plugins/regmap/src/regmapstylehelper.cpp index af9fa2b76e..c7612d1097 100644 --- a/plugins/regmap/src/regmapstylehelper.cpp +++ b/plugins/regmap/src/regmapstylehelper.cpp @@ -64,8 +64,7 @@ void RegmapStyleHelper::toggleSelectedRegister(QWidget *widget, bool toggle) { QString styleSheet = ""; if(toggle) { - styleSheet = - "background-color:" + Style::getAttribute(json::theme::interactive_primary_disabled) + " ;"; + styleSheet = "background-color:" + Style::getAttribute(json::theme::interactive_primary_idle) + " ;"; } else { styleSheet = "background-color:" + Style::getAttribute(json::theme::background_primary) + " ;"; } @@ -134,7 +133,7 @@ void RegmapStyleHelper::BitFieldDetailedWidgetStyle(BitFieldDetailedWidget *widg } )css"); - style.replace("&&frameBackground&&", Style::getAttribute(json::theme::interactive_subtle_disabled)); + style.replace("&&frameBackground&&", Style::getAttribute(json::theme::interactive_secondary_disabled)); widget->setMinimumWidth(10); widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); diff --git a/plugins/regmap/src/titlespinbox.cpp b/plugins/regmap/src/titlespinbox.cpp index a6032cbb39..71ce86556f 100644 --- a/plugins/regmap/src/titlespinbox.cpp +++ b/plugins/regmap/src/titlespinbox.cpp @@ -41,13 +41,13 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent) setLayout(mainLayout); QWidget *spinboxWidget = new QWidget(this); - Style::setBackgroundColor(spinboxWidget, json::theme::interactive_subtle_disabled); + Style::setBackgroundColor(spinboxWidget, json::theme::interactive_secondary_disabled); QVBoxLayout *spinboxWidgetLayout = new QVBoxLayout(spinboxWidget); spinboxWidgetLayout->setSpacing(0); spinboxWidgetLayout->setMargin(0); QWidget *buttonWidget = new QWidget(this); - Style::setBackgroundColor(buttonWidget, json::theme::interactive_subtle_disabled); + Style::setBackgroundColor(buttonWidget, json::theme::interactive_secondary_disabled); QVBoxLayout *buttonWidgetLayout = new QVBoxLayout(buttonWidget); buttonWidgetLayout->setSpacing(0); buttonWidgetLayout->setMargin(0); @@ -63,7 +63,7 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent) titleLabel = new QLabel(title); Style::setStyle(titleLabel, style::properties::label::menuSmall); - Style::setBackgroundColor(titleLabel, json::theme::interactive_subtle_disabled); + Style::setBackgroundColor(titleLabel, json::theme::interactive_secondary_disabled); spinBox = new QSpinBox(spinboxWidget); spinBox->setButtonSymbols(spinBox->ButtonSymbols::NoButtons); @@ -78,7 +78,6 @@ TitleSpinBox::TitleSpinBox(QString title, QWidget *parent) Style::setStyle(this, style::properties::regmap::titleSpinbox, true, true); Style::setStyle(spinBox, style::properties::regmap::titleSpinbox, true, true); - // RegmapStyleHelper::titleSpinBoxStyle(this); } TitleSpinBox::~TitleSpinBox() {} diff --git a/plugins/regmap/style/qss/properties/regmap/registercontroller.qss b/plugins/regmap/style/qss/properties/regmap/registercontroller.qss index 83629daf9f..841975bb77 100644 --- a/plugins/regmap/style/qss/properties/regmap/registercontroller.qss +++ b/plugins/regmap/style/qss/properties/regmap/registercontroller.qss @@ -3,11 +3,11 @@ QWidget[&&property&&=true] { margin-top: 4px ; margin-bottom: 4px ; border-radius: 4px; - background-color: &interactive_subtle_disabled& ; + background-color: &interactive_secondary_disabled& ; } QWidget[&&property&&=true] { - background-color: &interactive_subtle_disabled& ; + background-color: &interactive_secondary_disabled& ; border-radius: 4px; } diff --git a/plugins/regmap/style/qss/properties/regmap/regmapSlider.qss b/plugins/regmap/style/qss/properties/regmap/regmapSlider.qss index 4511fbce92..86eb1a8151 100644 --- a/plugins/regmap/style/qss/properties/regmap/regmapSlider.qss +++ b/plugins/regmap/style/qss/properties/regmap/regmapSlider.qss @@ -1,5 +1,5 @@ QSlider[&&property&&=true]:handle { - background: #404040; + color: &interactive_subtle_idle&; border: 0px; max-width: 8px; margin: -8px 0; @@ -7,13 +7,13 @@ QSlider[&&property&&=true]:handle { } QSlider[&&property&&=true]:handle:vertical:hover { - background: #4a4a4b; + background-color: #4a4a4b; } QSlider[&&property&&=true]:groove { border: 0px; - background: Transparent ; + background-color: &interactive_secondary_disabled& ; margin: 2px 0; border-radius: 0px; max-width: 8px; -} \ No newline at end of file +} diff --git a/plugins/regmap/style/qss/properties/regmap/titleSpinbox.qss b/plugins/regmap/style/qss/properties/regmap/titleSpinbox.qss index dba9b0da3b..137605ee5f 100644 --- a/plugins/regmap/style/qss/properties/regmap/titleSpinbox.qss +++ b/plugins/regmap/style/qss/properties/regmap/titleSpinbox.qss @@ -4,7 +4,7 @@ QWidget[&&property&&=true] { font-weight: normal; text-align: left; color: &content_default& ; - background-color: &interactive_subtle_disabled& ; + background-color: &interactive_secondary_disabled& ; } QSpinBox[&&property&&=true] {