From 2959074125e532c20ebc50ced583dcbb761ff49f Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Thu, 20 Feb 2025 15:34:03 +0200 Subject: [PATCH 1/9] gui: remove StyleHelper function and fix add page URI font Signed-off-by: Andrei Popa --- core/src/iiotabwidget.cpp | 2 +- gui/include/gui/stylehelper.h | 1 - gui/src/stylehelper.cpp | 9 --------- plugins/datalogger/src/datamonitorstylehelper.cpp | 4 ++-- plugins/swiot/src/faults/faultsdevice.cpp | 2 +- 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/core/src/iiotabwidget.cpp b/core/src/iiotabwidget.cpp index 50b38f1775..f31c7e8093 100644 --- a/core/src/iiotabwidget.cpp +++ b/core/src/iiotabwidget.cpp @@ -408,7 +408,7 @@ QWidget *IioTabWidget::createUriWidget(QWidget *parent) Style::setStyle(w, style::properties::widget::border_interactive); QLabel *uriLabel = new QLabel("URI", w); - StyleHelper::MenuLargeLabel(uriLabel); + Style::setStyle(uriLabel, style::properties::label::menuMedium); m_uriEdit = new QLineEdit(w); m_uriEdit->setPlaceholderText("The device you are connecting to"); diff --git a/gui/include/gui/stylehelper.h b/gui/include/gui/stylehelper.h index 5a5141e9e2..de82e69ff1 100644 --- a/gui/include/gui/stylehelper.h +++ b/gui/include/gui/stylehelper.h @@ -76,7 +76,6 @@ class SCOPY_GUI_EXPORT StyleHelper : public QObject static void ColoredSquareCheckbox(QCheckBox *chk, QColor color, QString objectName = ""); static void MenuControlButton(QPushButton *btn, QString objectName = "", bool checkable = true); static void MenuControlWidget(QWidget *w, QColor color, QString objectName = ""); - static void MenuLargeLabel(QLabel *lbl, QString objectName = ""); static void MenuHeaderLine(QFrame *line, QPen pen, QString objectName = ""); static void MenuHeaderWidget(QWidget *w, QString objectName = ""); static void MenuSectionWidget(QWidget *w, QString objectName = ""); diff --git a/gui/src/stylehelper.cpp b/gui/src/stylehelper.cpp index 1c021c2a4b..6496b0decc 100644 --- a/gui/src/stylehelper.cpp +++ b/gui/src/stylehelper.cpp @@ -199,15 +199,6 @@ void StyleHelper::MenuControlWidget(QWidget *w, QColor color, QString objectName w->setStyleSheet(style); } -void StyleHelper::MenuLargeLabel(QLabel *m_lbl, QString objectName) -{ - if(!objectName.isEmpty()) - m_lbl->setObjectName(objectName); - m_lbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); - - Style::setStyle(m_lbl, style::properties::label::menuBig); -} - void StyleHelper::MenuHeaderLine(QFrame *m_line, QPen pen, QString objectName) { if(!objectName.isEmpty()) diff --git a/plugins/datalogger/src/datamonitorstylehelper.cpp b/plugins/datalogger/src/datamonitorstylehelper.cpp index 7c088f9071..9715fa7e7e 100644 --- a/plugins/datalogger/src/datamonitorstylehelper.cpp +++ b/plugins/datalogger/src/datamonitorstylehelper.cpp @@ -57,10 +57,10 @@ void DataMonitorStyleHelper::SevenSegmentMonitorsStyle(SevenSegmentMonitor *seve sevenSegmentMonitor->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - StyleHelper::MenuLargeLabel(sevenSegmentMonitor->name); + Style::setStyle(sevenSegmentMonitor->name, style::properties::label::menuBig); sevenSegmentMonitor->name->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - StyleHelper::MenuLargeLabel(sevenSegmentMonitor->unitOfMeasurement); + Style::setStyle(sevenSegmentMonitor->unitOfMeasurement, style::properties::label::menuBig); sevenSegmentMonitor->unitOfMeasurement->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); sevenSegmentMonitor->lcdNumber->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); diff --git a/plugins/swiot/src/faults/faultsdevice.cpp b/plugins/swiot/src/faults/faultsdevice.cpp index 04418de6ee..ae0ef2cace 100644 --- a/plugins/swiot/src/faults/faultsdevice.cpp +++ b/plugins/swiot/src/faults/faultsdevice.cpp @@ -273,7 +273,7 @@ QWidget *FaultsDevice::createTopWidget(QWidget *parent) layout->setContentsMargins(0, 0, 0, 0); QLabel *deviceNameLabel = new QLabel(w); - StyleHelper::MenuLargeLabel(deviceNameLabel); + Style::setStyle(deviceNameLabel, style::properties::label::menuBig); deviceNameLabel->setText(m_name); m_registerNoLineEdit = new QLineEdit(w); From cb9381aa3d68d1bf8e2bbbe714309c63c2874606 Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Fri, 21 Feb 2025 13:50:05 +0200 Subject: [PATCH 2/9] gui: style: fix macos property replacing Signed-off-by: Andrei Popa --- gui/src/style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/style.cpp b/gui/src/style.cpp index 321a3fb895..6ac33e8a98 100644 --- a/gui/src/style.cpp +++ b/gui/src/style.cpp @@ -279,8 +279,8 @@ const char *Style::replaceProperty(const char *prop) for(const QString &key : m_theme_json->object().keys()) { if(prop == key) { QJsonValue value = m_theme_json->object().value(key); - prop = value.toString().toLocal8Bit().data(); - return strdup(prop); + prop = strdup(value.toString().toLocal8Bit().data()); + return prop; } } From 5a6d5de1eb49b89de020dedc343c92541b92bc28 Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Fri, 21 Feb 2025 15:36:28 +0200 Subject: [PATCH 3/9] gui: menuspinbox: added large widget mode - spinboxes in debugger are now smaller Signed-off-by: Andrei Popa --- gui/include/gui/widgets/menuspinbox.h | 3 ++- gui/src/widgets/menuspinbox.cpp | 14 ++++++++++---- iio-widgets/src/guistrategy/rangeguistrategy.cpp | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gui/include/gui/widgets/menuspinbox.h b/gui/include/gui/widgets/menuspinbox.h index 77f3930c41..3d3fa1a9b1 100644 --- a/gui/include/gui/widgets/menuspinbox.h +++ b/gui/include/gui/widgets/menuspinbox.h @@ -149,7 +149,7 @@ class SCOPY_GUI_EXPORT MenuSpinbox : public QWidget } IncrementMode; MenuSpinbox(QString name, double val, QString unit, double min, double max, bool vertical = 0, bool left = 0, - QWidget *parent = nullptr); + bool large_widget = true, QWidget *parent = nullptr); ~MenuSpinbox(); double value() const; @@ -203,6 +203,7 @@ private Q_SLOTS: double m_value, m_min, m_max; double m_scaleMin, m_scaleMax; QString m_unit; + bool m_large_widget; QList m_scales; // QMap m_scaleMap; diff --git a/gui/src/widgets/menuspinbox.cpp b/gui/src/widgets/menuspinbox.cpp index 317543eb07..5acfd5364b 100644 --- a/gui/src/widgets/menuspinbox.cpp +++ b/gui/src/widgets/menuspinbox.cpp @@ -27,10 +27,10 @@ namespace scopy { namespace gui { MenuSpinbox::MenuSpinbox(QString name, double val, QString unit, double min, double max, bool vertical, bool left, - QWidget *parent) + bool large_widget, QWidget *parent) : QWidget(parent) { - + m_large_widget = large_widget; m_label = new QLabel(name, parent); m_edit = new QLineEdit("0", parent); m_scaleCb = new QComboBox(parent); @@ -121,10 +121,10 @@ void MenuSpinbox::layoutVertically(bool left) lay->addLayout(btnLay); } - Style::setStyle(m_label, style::properties::label::subtle); Style::setStyle(m_scaleCb, style::properties::widget::noBorder); + int size = m_large_widget ? Style::getDimension(json::global::unit_2_5) + : Style::getDimension(json::global::unit_1); - int size = Style::getDimension(json::global::unit_2_5); m_plus->setIcon(Style::getPixmap(":/gui/icons/plus.svg", Style::getColor(json::theme::content_inverse))); Style::setStyle(m_plus, style::properties::button::spinboxButton); m_plus->setFixedSize(size, size); @@ -132,6 +132,12 @@ void MenuSpinbox::layoutVertically(bool left) m_minus->setIcon(Style::getPixmap(":/gui/icons/minus.svg", Style::getColor(json::theme::content_inverse))); Style::setStyle(m_minus, style::properties::button::spinboxButton); m_minus->setFixedSize(size, size); + + if(!m_large_widget) { + int icon_size = Style::getDimension(json::global::unit_0_5); + m_plus->setIconSize(QSize(icon_size, icon_size)); + m_minus->setIconSize(QSize(icon_size, icon_size)); + } } void MenuSpinbox::layoutHorizontally(bool left) diff --git a/iio-widgets/src/guistrategy/rangeguistrategy.cpp b/iio-widgets/src/guistrategy/rangeguistrategy.cpp index 1a01bfcc45..e61d54fce5 100644 --- a/iio-widgets/src/guistrategy/rangeguistrategy.cpp +++ b/iio-widgets/src/guistrategy/rangeguistrategy.cpp @@ -38,7 +38,7 @@ RangeAttrUi::RangeAttrUi(IIOWidgetFactoryRecipe recipe, bool isCompact, QWidget m_ui->setLayout(new QVBoxLayout(m_ui)); m_ui->layout()->setContentsMargins(0, 0, 0, 0); - m_spinBox = new gui::MenuSpinbox(m_recipe.data.toUpper(), 0, "", 0, 1, true, false, m_ui); + m_spinBox = new gui::MenuSpinbox(m_recipe.data.toUpper(), 0, "", 0, 1, true, false, false, m_ui); m_spinBox->setIncrementMode(gui::MenuSpinbox::IS_FIXED); m_spinBox->setScaleRange(1, 1); m_spinBox->setScalingEnabled(false); From 88e54676250529bb206fc3f4825648810a54810b Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Tue, 25 Feb 2025 16:25:49 +0200 Subject: [PATCH 4/9] ADC: fix default ymode Signed-off-by: Andrei Popa --- plugins/adc/src/time/timeplotcomponentsettings.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/adc/src/time/timeplotcomponentsettings.cpp b/plugins/adc/src/time/timeplotcomponentsettings.cpp index 273fe95932..a1724fa6b8 100644 --- a/plugins/adc/src/time/timeplotcomponentsettings.cpp +++ b/plugins/adc/src/time/timeplotcomponentsettings.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace scopy; using namespace scopy::adc; @@ -183,6 +184,10 @@ TimePlotComponentSettings::TimePlotComponentSettings(TimePlotComponent *plt, QWi m_plotComponent->timePlot()->plotButtonManager()->add(m_deletePlotHover); m_plotComponent->timePlot()->plotButtonManager()->add(m_settingsPlotHover); m_autoscaleBtn->onOffswitch()->setChecked(true); + + m_ymode = static_cast(-1); + auto y = Preferences::get("adc_default_y_mode").toInt(); + m_yModeCb->combo()->setCurrentIndex(y); } void TimePlotComponentSettings::showDeleteButtons(bool b) From 2798492a4ce89b7a32545c2363be8ca2930c6bec Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Tue, 25 Feb 2025 17:34:56 +0200 Subject: [PATCH 5/9] ADC: adjust cursor and labels colors Signed-off-by: Andrei Popa --- gui/src/axishandle.cpp | 3 ++- gui/src/plotwidget.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/src/axishandle.cpp b/gui/src/axishandle.cpp index 5b8b3883e0..174372741b 100644 --- a/gui/src/axishandle.cpp +++ b/gui/src/axishandle.cpp @@ -24,6 +24,7 @@ #include "qpainter.h" #include #include +#include using namespace scopy; @@ -31,7 +32,7 @@ AxisHandle::AxisHandle(QwtAxisId axisId, HandlePos handlePos, QwtPlot *plot) : QWidget(plot->canvas()) , m_axisId(axisId) , m_plot(plot) - , m_color(Qt::gray) + , m_color(Style::getColor(json::theme::content_silent)) , m_handlePos(handlePos) , m_pos(QPoint(0, 0)) , m_handleMargins(6) diff --git a/gui/src/plotwidget.cpp b/gui/src/plotwidget.cpp index b71106644f..2d8f6cc222 100644 --- a/gui/src/plotwidget.cpp +++ b/gui/src/plotwidget.cpp @@ -282,7 +282,7 @@ void PlotWidget::setupAxes() m_xPosition = Preferences::get("adc_plot_xaxis_label_position").toInt(); m_yPosition = Preferences::get("adc_plot_yaxis_label_position").toInt(); - QPen pen(QColor(Style::getAttribute(json::theme::interactive_subtle_idle))); + QPen pen(QColor(Style::getAttribute(json::theme::content_subtle))); m_xAxis = new PlotAxis(m_xPosition, this, pen, this); m_yAxis = new PlotAxis(m_yPosition, this, pen, this); } From 7103e9e07e43f3a9c8329d7c6ad0d7cb9d27459b Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Tue, 25 Feb 2025 17:36:51 +0200 Subject: [PATCH 6/9] ADC: TimePlotComponent remove redunudant units Signed-off-by: Andrei Popa --- plugins/adc/src/time/grtimechannelcomponent.cpp | 1 - plugins/adc/src/time/timeplotcomponent.cpp | 3 --- plugins/adc/src/time/timeplotcomponentchannel.cpp | 2 -- tmp/grutil/src/grtimeplotaddonsettings.cpp | 1 - 4 files changed, 7 deletions(-) diff --git a/plugins/adc/src/time/grtimechannelcomponent.cpp b/plugins/adc/src/time/grtimechannelcomponent.cpp index 81c008a646..f78efe8655 100644 --- a/plugins/adc/src/time/grtimechannelcomponent.cpp +++ b/plugins/adc/src/time/grtimechannelcomponent.cpp @@ -265,7 +265,6 @@ void GRTimeChannelComponent::setYModeHelper(YMode mode) ymax = 1 << (fmt->bits); } m_timePlotComponentChannel->m_timePlotYAxis->setUnits(""); - m_timePlotComponentChannel->m_timePlotYAxis->setUnits(""); m_timePlotComponentChannel->m_timePlotYAxis->scaleDraw()->setFloatPrecision(3); m_timePlotComponentChannel->m_timePlotYAxis->getFormatter()->setTwoDecimalMode(false); break; diff --git a/plugins/adc/src/time/timeplotcomponent.cpp b/plugins/adc/src/time/timeplotcomponent.cpp index 8ac8b52ca7..5fb5dd1329 100644 --- a/plugins/adc/src/time/timeplotcomponent.cpp +++ b/plugins/adc/src/time/timeplotcomponent.cpp @@ -74,9 +74,6 @@ TimePlotComponent::TimePlotComponent(QString name, uint32_t uuid, QWidget *paren m_plotLayout->addWidget(m_timePlot); m_plotLayout->addWidget(m_xyPlot); - // Need to set this for some reason .. spinboxes should be refactored - m_timePlot->yAxis()->setUnits("V"); - m_plotMenu = new TimePlotComponentSettings(this, parent); addComponent(m_plotMenu); diff --git a/plugins/adc/src/time/timeplotcomponentchannel.cpp b/plugins/adc/src/time/timeplotcomponentchannel.cpp index 91ddb50820..b97f8ec261 100644 --- a/plugins/adc/src/time/timeplotcomponentchannel.cpp +++ b/plugins/adc/src/time/timeplotcomponentchannel.cpp @@ -41,8 +41,6 @@ adc::TimePlotComponentChannel::TimePlotComponentChannel(ChannelComponent *ch, Ti m_plotComponent = nullptr; initPlotComponent(plotComponent); - m_timePlotYAxis->setUnits("V"); - m_timePlotCh->xAxis()->setUnits("s"); m_timePlotYAxis->setInterval(-2048, 2048); m_xyPlotYAxis->setInterval(-2048, 2048); } diff --git a/tmp/grutil/src/grtimeplotaddonsettings.cpp b/tmp/grutil/src/grtimeplotaddonsettings.cpp index d77ff5524a..6fdc44d7f6 100644 --- a/tmp/grutil/src/grtimeplotaddonsettings.cpp +++ b/tmp/grutil/src/grtimeplotaddonsettings.cpp @@ -68,7 +68,6 @@ QWidget *GRTimePlotAddonSettings::createYAxisMenu(QWidget *parent) MenuCollapseSection *yaxis = new MenuCollapseSection("Y-AXIS", MenuCollapseSection::MHCW_NONE, MenuCollapseSection::MHW_BASEWIDGET, yaxiscontainer); - m_plot->plot()->yAxis()->setUnits("V"); m_yctrl = new MenuPlotAxisRangeControl(m_plot->plot()->yAxis(), yaxis); m_singleYModeSw = new MenuOnOffSwitch("Single Y Mode", yaxis); m_autoscaleBtn = new QPushButton("Autoscale", yaxis); From d46689860385ce86c497c09ac041cac2e9c46fa1 Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Wed, 26 Feb 2025 12:13:12 +0200 Subject: [PATCH 7/9] ADC: cursor readouts color change based on y axis Signed-off-by: Andrei Popa --- gui/include/gui/basicscaledraw.h | 1 + gui/include/gui/cursorcontroller.h | 1 + gui/include/gui/widgets/plotcursorreadouts.h | 2 ++ gui/src/basicscaledraw.cpp | 2 ++ gui/src/cursorcontroller.cpp | 30 +++++++++++--------- gui/src/plotwidget.cpp | 2 ++ gui/src/widgets/plotcursorreadouts.cpp | 2 ++ 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/gui/include/gui/basicscaledraw.h b/gui/include/gui/basicscaledraw.h index 6b79284536..c5de07fa3c 100644 --- a/gui/include/gui/basicscaledraw.h +++ b/gui/include/gui/basicscaledraw.h @@ -45,6 +45,7 @@ class SCOPY_GUI_EXPORT BasicScaleDraw : public QwtScaleDraw QString getUnitType() const; void setColor(QColor color); + QColor getColor(); void setDisplayScale(double value); void setFormatter(PrefixFormatter *formatter); diff --git a/gui/include/gui/cursorcontroller.h b/gui/include/gui/cursorcontroller.h index 1e4b32f582..dadbe91935 100644 --- a/gui/include/gui/cursorcontroller.h +++ b/gui/include/gui/cursorcontroller.h @@ -55,6 +55,7 @@ public Q_SLOTS: void readoutsDragToggled(bool toggled); void onAddedChannel(PlotChannel *ch); void onRemovedChannel(PlotChannel *ch); + void onSelectedChannel(PlotChannel *ch); void updateTracking(); Q_SIGNALS: diff --git a/gui/include/gui/widgets/plotcursorreadouts.h b/gui/include/gui/widgets/plotcursorreadouts.h index de5ba6d8f8..3e81e48a10 100644 --- a/gui/include/gui/widgets/plotcursorreadouts.h +++ b/gui/include/gui/widgets/plotcursorreadouts.h @@ -56,6 +56,8 @@ public Q_SLOTS: void setXFormatter(PrefixFormatter *formatter); void setYFormatter(PrefixFormatter *formatter); + void setColor(QColor color); + private: QWidget *y_contents; QWidget *x_contents; diff --git a/gui/src/basicscaledraw.cpp b/gui/src/basicscaledraw.cpp index b29bce482e..5f0ce85286 100644 --- a/gui/src/basicscaledraw.cpp +++ b/gui/src/basicscaledraw.cpp @@ -69,6 +69,8 @@ QString BasicScaleDraw::getUnitType() const { return m_unit; } void BasicScaleDraw::setColor(QColor color) { m_color = color; } +QColor BasicScaleDraw::getColor() { return m_color; } + void BasicScaleDraw::setDisplayScale(double value) { m_displayScale = value; } void BasicScaleDraw::setFormatter(PrefixFormatter *formatter) { m_formatter = formatter; } diff --git a/gui/src/cursorcontroller.cpp b/gui/src/cursorcontroller.cpp index 4f98879058..dd2bbdb132 100644 --- a/gui/src/cursorcontroller.cpp +++ b/gui/src/cursorcontroller.cpp @@ -121,19 +121,7 @@ void CursorController::connectSignals(CursorSettings *cursorSettings) } connect(m_plot, &PlotWidget::addedChannel, this, &CursorController::onAddedChannel); connect(m_plot, &PlotWidget::removedChannel, this, &CursorController::onRemovedChannel); - connect(m_plot, &PlotWidget::channelSelected, this, [=](PlotChannel *ch) { - PlotAxis *xAxis = m_plot->xAxis(); - PlotAxis *yAxis = m_plot->yAxis(); - if(ch != nullptr) { - xAxis = ch->xAxis(); - yAxis = ch->yAxis(); - } - - plotCursorReadouts->setXFormatter(xAxis->getFormatter()); - plotCursorReadouts->setYFormatter(yAxis->getFormatter()); - plotCursorReadouts->setXUnits(xAxis->getUnits()); - plotCursorReadouts->setYUnits(yAxis->getUnits()); - }); + connect(m_plot, &PlotWidget::channelSelected, this, &CursorController::onSelectedChannel); } void CursorController::xEnToggled(bool toggled) @@ -184,6 +172,22 @@ void CursorController::onAddedChannel(PlotChannel *ch) connect(ch->yAxis(), &PlotAxis::unitsChanged, plotCursorReadouts, &PlotCursorReadouts::setYUnits); } +void CursorController::onSelectedChannel(PlotChannel *ch) +{ + PlotAxis *xAxis = m_plot->xAxis(); + PlotAxis *yAxis = m_plot->yAxis(); + if(ch != nullptr) { + xAxis = ch->xAxis(); + yAxis = ch->yAxis(); + } + + plotCursorReadouts->setXFormatter(xAxis->getFormatter()); + plotCursorReadouts->setYFormatter(yAxis->getFormatter()); + plotCursorReadouts->setXUnits(xAxis->getUnits()); + plotCursorReadouts->setYUnits(yAxis->getUnits()); + plotCursorReadouts->setColor(yAxis->scaleDraw()->getColor()); +} + void CursorController::onRemovedChannel(PlotChannel *ch) { disconnect(ch->xAxis(), &PlotAxis::formatterChanged, plotCursorReadouts, nullptr); diff --git a/gui/src/plotwidget.cpp b/gui/src/plotwidget.cpp index 2d8f6cc222..fc2aac55e6 100644 --- a/gui/src/plotwidget.cpp +++ b/gui/src/plotwidget.cpp @@ -150,6 +150,8 @@ void PlotWidget::plotChannelChangeYAxis(PlotChannel *c, PlotAxis *y) m_navigator->addChannel(c); m_tracker->addChannel(c); showAxisLabels(); + + Q_EMIT channelSelected(c); } void PlotWidget::addPlotChannel(PlotChannel *ch) diff --git a/gui/src/widgets/plotcursorreadouts.cpp b/gui/src/widgets/plotcursorreadouts.cpp index 0727289f3b..3b657a074f 100644 --- a/gui/src/widgets/plotcursorreadouts.cpp +++ b/gui/src/widgets/plotcursorreadouts.cpp @@ -156,6 +156,8 @@ bool PlotCursorReadouts::isXVisible() { return x_contents->isVisible(); } bool PlotCursorReadouts::isYVisible() { return y_contents->isVisible(); } +void PlotCursorReadouts::setColor(QColor color) { setStyleSheet("color: " + color.name(QColor::HexRgb)); } + void PlotCursorReadouts::setYUnits(QString unit) { yUnit = unit; From 61e1229936d3383e8a05a2071e9a97901a2a748e Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Wed, 26 Feb 2025 14:50:59 +0200 Subject: [PATCH 8/9] Debugger: minor attributes section style adjustments - tab widget style changes Signed-off-by: Andrei Popa --- gui/src/widgets/menucombo.cpp | 3 +++ gui/src/widgets/menuspinbox.cpp | 6 ++++-- gui/style/json/Harmonic light.json | 4 ++-- gui/style/qss/generic/global.qss | 4 ++-- gui/style/qss/properties/label/iioCompactLabel.qss | 12 ------------ iio-widgets/src/guistrategy/comboguistrategy.cpp | 1 - iio-widgets/src/guistrategy/editableguistrategy.cpp | 3 ++- iio-widgets/src/guistrategy/rangeguistrategy.cpp | 2 +- plugins/debugger/src/iioexplorer/guidetailsview.cpp | 2 ++ 9 files changed, 16 insertions(+), 21 deletions(-) delete mode 100644 gui/style/qss/properties/label/iioCompactLabel.qss diff --git a/gui/src/widgets/menucombo.cpp b/gui/src/widgets/menucombo.cpp index 62968bef71..4d36146c57 100644 --- a/gui/src/widgets/menucombo.cpp +++ b/gui/src/widgets/menucombo.cpp @@ -20,6 +20,7 @@ */ #include +#include #include @@ -56,6 +57,8 @@ MenuCombo::MenuCombo(QString title, QWidget *parent) lay->setMargin(0); m_label = new QLabel(title, this); + Style::setStyle(m_label, style::properties::label::subtle); + m_combo = new QComboBox(this); lay->addWidget(m_label); diff --git a/gui/src/widgets/menuspinbox.cpp b/gui/src/widgets/menuspinbox.cpp index 5acfd5364b..a5a27eb361 100644 --- a/gui/src/widgets/menuspinbox.cpp +++ b/gui/src/widgets/menuspinbox.cpp @@ -32,6 +32,8 @@ MenuSpinbox::MenuSpinbox(QString name, double val, QString unit, double min, dou { m_large_widget = large_widget; m_label = new QLabel(name, parent); + Style::setStyle(m_label, style::properties::label::subtle); + m_edit = new QLineEdit("0", parent); m_scaleCb = new QComboBox(parent); m_plus = new QPushButton("", parent); @@ -91,7 +93,7 @@ void MenuSpinbox::layoutVertically(bool left) auto lay = new QHBoxLayout(this); setLayout(lay); - lay->setSpacing(5); + lay->setSpacing(0); lay->setMargin(0); QLayout *btnLay; @@ -101,7 +103,7 @@ void MenuSpinbox::layoutVertically(bool left) editLay = new QVBoxLayout(); btnLay->setSpacing(2); - btnLay->setMargin(0); + btnLay->setContentsMargins(5, 0, 0, 0); editLay->setSpacing(2); editLay->setMargin(0); diff --git a/gui/style/json/Harmonic light.json b/gui/style/json/Harmonic light.json index 51e4da7dfb..ecf2f8de2d 100644 --- a/gui/style/json/Harmonic light.json +++ b/gui/style/json/Harmonic light.json @@ -4,7 +4,7 @@ "interactive_subtle_idle": "#848B95", "interactive_subtle_hover": "#5E6773", "interactive_subtle_pressed": "#4b525c", -"interactive_subtle_disabled": "#c1c3c7", +"interactive_subtle_disabled": "#d5d7db", "interactive_focus": "#F6EEFC", "interactive_primary_idle": "#0067B9", "interactive_primary_hover": "#00427A", @@ -13,7 +13,7 @@ "interactive_secondary_idle": "#0067B9", "interactive_secondary_hover": "#00427A", "interactive_secondary_pressed": "#003969", -"interactive_secondary_disabled": "#c1c3c7", +"interactive_secondary_disabled": "#d5d7db", "content_default": "#101820", "content_subtle": "#5E6773", "content_silent": "#9FA4AD", diff --git a/gui/style/qss/generic/global.qss b/gui/style/qss/generic/global.qss index fad49b70b8..48e934da0e 100644 --- a/gui/style/qss/generic/global.qss +++ b/gui/style/qss/generic/global.qss @@ -204,8 +204,8 @@ QTabBar::tab { } QTabBar::tab:selected { - background: &background_primary&; - color: &interactive_primary_idle&; + background: &interactive_subtle_disabled&; + color: &content_default&; border-bottom: 1px solid &interactive_primary_idle&; } diff --git a/gui/style/qss/properties/label/iioCompactLabel.qss b/gui/style/qss/properties/label/iioCompactLabel.qss deleted file mode 100644 index 1f50a791ea..0000000000 --- a/gui/style/qss/properties/label/iioCompactLabel.qss +++ /dev/null @@ -1,12 +0,0 @@ -QLabel[&&property&&=true] { - color: &content_default&; - background-color: rgba(255,255,255,0); - font-weight: normal; - font-family: Open Sans; - font-size: &font_size_0_5&; - font-style: normal; -} - -QLabel[&&property&&=true]:disabled { - color: grey; -} diff --git a/iio-widgets/src/guistrategy/comboguistrategy.cpp b/iio-widgets/src/guistrategy/comboguistrategy.cpp index 78660b4010..ea243c611d 100644 --- a/iio-widgets/src/guistrategy/comboguistrategy.cpp +++ b/iio-widgets/src/guistrategy/comboguistrategy.cpp @@ -37,7 +37,6 @@ ComboAttrUi::ComboAttrUi(IIOWidgetFactoryRecipe recipe, bool isCompact, QWidget m_ui->layout()->setContentsMargins(0, 0, 0, 0); auto label = new QLabel(recipe.data, m_ui); - Style::setStyle(label, style::properties::label::iioCompactLabel); m_comboWidget = new QComboBox(m_ui); m_comboWidget->setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToContents); diff --git a/iio-widgets/src/guistrategy/editableguistrategy.cpp b/iio-widgets/src/guistrategy/editableguistrategy.cpp index bc70173ba2..013618cbe1 100644 --- a/iio-widgets/src/guistrategy/editableguistrategy.cpp +++ b/iio-widgets/src/guistrategy/editableguistrategy.cpp @@ -33,9 +33,9 @@ EditableGuiStrategy::EditableGuiStrategy(IIOWidgetFactoryRecipe recipe, bool isC if(isCompact) { m_ui->setLayout(new QHBoxLayout(m_ui)); - Style::setStyle(label, style::properties::label::iioCompactLabel); m_lineEdit->edit()->setAlignment(Qt::AlignRight); } else { + Style::setStyle(label, style::properties::label::subtle); m_ui->setLayout(new QVBoxLayout(m_ui)); } @@ -44,6 +44,7 @@ EditableGuiStrategy::EditableGuiStrategy(IIOWidgetFactoryRecipe recipe, bool isC m_ui->layout()->setContentsMargins(0, 0, 0, 0); m_ui->layout()->addWidget(label); m_ui->layout()->addWidget(m_lineEdit); + m_ui->layout()->setSpacing(0); connect(m_lineEdit->edit(), &QLineEdit::editingFinished, this, [this]() { QString currentText = m_lineEdit->edit()->text(); diff --git a/iio-widgets/src/guistrategy/rangeguistrategy.cpp b/iio-widgets/src/guistrategy/rangeguistrategy.cpp index e61d54fce5..a89263dd8e 100644 --- a/iio-widgets/src/guistrategy/rangeguistrategy.cpp +++ b/iio-widgets/src/guistrategy/rangeguistrategy.cpp @@ -38,7 +38,7 @@ RangeAttrUi::RangeAttrUi(IIOWidgetFactoryRecipe recipe, bool isCompact, QWidget m_ui->setLayout(new QVBoxLayout(m_ui)); m_ui->layout()->setContentsMargins(0, 0, 0, 0); - m_spinBox = new gui::MenuSpinbox(m_recipe.data.toUpper(), 0, "", 0, 1, true, false, false, m_ui); + m_spinBox = new gui::MenuSpinbox(m_recipe.data, 0, "", 0, 1, true, false, false, m_ui); m_spinBox->setIncrementMode(gui::MenuSpinbox::IS_FIXED); m_spinBox->setScaleRange(1, 1); m_spinBox->setScalingEnabled(false); diff --git a/plugins/debugger/src/iioexplorer/guidetailsview.cpp b/plugins/debugger/src/iioexplorer/guidetailsview.cpp index a105075cd4..4d59a2cbde 100644 --- a/plugins/debugger/src/iioexplorer/guidetailsview.cpp +++ b/plugins/debugger/src/iioexplorer/guidetailsview.cpp @@ -20,6 +20,7 @@ */ #include "guidetailsview.h" +#include "style.h" using namespace scopy::debugger; @@ -41,6 +42,7 @@ void GuiDetailsView::setupUi() m_scrollAreaContents->setLayout(new QVBoxLayout(m_scrollAreaContents)); m_scrollAreaContents->setObjectName("DetailsViewScrollAreaContents"); m_scrollAreaContents->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + m_scrollAreaContents->layout()->setSpacing(Style::getDimension(json::global::unit_1)); m_scrollArea->setWidgetResizable(true); m_scrollArea->setWidget(m_scrollAreaContents); From 0eaed1bceab274281a378979976bfb5e12a788a6 Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Thu, 27 Feb 2025 14:24:56 +0200 Subject: [PATCH 9/9] gui: measurements panel fix uninitialized variable - caused bad measurements placement in swiot plugin Signed-off-by: Andrei Popa --- gui/src/widgets/measurementpanel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/src/widgets/measurementpanel.cpp b/gui/src/widgets/measurementpanel.cpp index f13c57f523..54abf864c5 100644 --- a/gui/src/widgets/measurementpanel.cpp +++ b/gui/src/widgets/measurementpanel.cpp @@ -32,6 +32,7 @@ using namespace scopy; MeasurementsPanel::MeasurementsPanel(QWidget *parent) : QWidget(parent) + , m_inhibitUpdates(false) { QVBoxLayout *lay = new QVBoxLayout(this); setLayout(lay);