diff --git a/gui/include/gui/widgets/menuspinbox.h b/gui/include/gui/widgets/menuspinbox.h index 79e0b778b7..77f3930c41 100644 --- a/gui/include/gui/widgets/menuspinbox.h +++ b/gui/include/gui/widgets/menuspinbox.h @@ -100,7 +100,11 @@ class SCOPY_GUI_EXPORT IncrementStrategyPower2 : public IncrementStrategy class SCOPY_GUI_EXPORT IncrementStrategyFixed : public IncrementStrategy { public: - IncrementStrategyFixed(double k = 1) { m_k = k; }; + IncrementStrategyFixed(double k = 1) + { + m_k = k; + m_scale = 1; + }; ~IncrementStrategyFixed(){}; virtual double increment(double val) override { diff --git a/gui/src/widgets/menuspinbox.cpp b/gui/src/widgets/menuspinbox.cpp index 0186528c72..1829cfc9af 100644 --- a/gui/src/widgets/menuspinbox.cpp +++ b/gui/src/widgets/menuspinbox.cpp @@ -263,24 +263,27 @@ void MenuSpinbox::userInput(QString s) if(!ok) setValue(m_value); // reset - QString unit = s.mid(i + 1, 1); // isolate prefix and unit from the whole string (mV) - if(unit.length() > 0) { // user wrote a prefix and/or a unit - double scale = getScaleForPrefix(unit, Qt::CaseSensitive); // find the unit in the map - if(scale == -1) { - scale = getScaleForPrefix(unit, - Qt::CaseInsensitive); // the user may have written 30K instead of 30k - } + if(m_scalingEnabled) { + QString unit = s.mid(i + 1, 1); // isolate prefix and unit from the whole string (mV) + if(unit.length() > 0) { // user wrote a prefix and/or a unit + double scale = getScaleForPrefix(unit, Qt::CaseSensitive); // find the unit in the map + if(scale == -1) { + scale = getScaleForPrefix( + unit, + Qt::CaseInsensitive); // the user may have written 30K instead of 30k + } - if(scale == -1) { - scale = 1; // do not scale the value at all + if(scale == -1) { + scale = 1; // do not scale the value at all + } else { + val = val * scale; // scale accordingly + } } else { - val = val * scale; // scale accordingly + val = val * + m_scaleCb->currentData() + .toDouble(); // the user didnt write a scale => use scale in combobox } - } else { - val = val * - m_scaleCb->currentData().toDouble(); // the user didnt write a scale => use scale in combobox } - setValue(val); } diff --git a/plugins/adc/src/time/timeplotmanagersettings.cpp b/plugins/adc/src/time/timeplotmanagersettings.cpp index 9a3038d01d..6909aa68d2 100644 --- a/plugins/adc/src/time/timeplotmanagersettings.cpp +++ b/plugins/adc/src/time/timeplotmanagersettings.cpp @@ -177,7 +177,9 @@ QWidget *TimePlotManagerSettings::createXAxisMenu(QWidget *parent) if(xcb->itemData(idx) == XMODE_SAMPLES) { m_sampleRateSpin->setValue(1); m_xmin->setUnit("samples"); + m_xmin->setScaleRange(1, 1e6); m_xmax->setUnit("samples"); + m_xmax->setScaleRange(1, 1e6); m_plotManager->setXUnit("samples"); for(PlotComponent *plt : m_plotManager->plots()) { auto p = dynamic_cast(plt); @@ -190,7 +192,9 @@ QWidget *TimePlotManagerSettings::createXAxisMenu(QWidget *parent) m_sampleRateSpin->setEnabled(false); m_sampleRateSpin->setValue(readSampleRate()); m_xmin->setUnit("s"); + m_xmin->setScaleRange(0, 1); m_xmax->setUnit("s"); + m_xmax->setScaleRange(0, 1); m_plotManager->setXUnit("s"); for(PlotComponent *plt : m_plotManager->plots()) { @@ -205,7 +209,9 @@ QWidget *TimePlotManagerSettings::createXAxisMenu(QWidget *parent) m_sampleRateSpin->setEnabled(true); m_xmin->setUnit("s"); + m_xmin->setScaleRange(0, 1); m_xmax->setUnit("s"); + m_xmax->setScaleRange(0, 1); m_plotManager->setXUnit("s"); for(PlotComponent *plt : m_plotManager->plots()) { auto p = dynamic_cast(plt);