diff --git a/src/plotcontrolpanel.cpp b/src/plotcontrolpanel.cpp --- a/src/plotcontrolpanel.cpp +++ b/src/plotcontrolpanel.cpp @@ -61,6 +61,12 @@ PlotControlPanel::PlotControlPanel(QWidg ui->spYmax->setRange((-1) * std::numeric_limits::max(), std::numeric_limits::max()); + ui->spXmin->setRange((-1) * std::numeric_limits::max(), + std::numeric_limits::max()); + + ui->spXmax->setRange((-1) * std::numeric_limits::max(), + std::numeric_limits::max()); + // connect signals connect(ui->spNumOfSamples, SIGNAL(valueChanged(int)), this, SLOT(onNumOfSamples(int))); @@ -74,6 +80,15 @@ PlotControlPanel::PlotControlPanel(QWidg connect(ui->spYmin, SIGNAL(valueChanged(double)), this, SLOT(onYScaleChanged())); + connect(ui->cbIndex, &QCheckBox::toggled, + this, &PlotControlPanel::onIndexChecked); + + connect(ui->spXmax, SIGNAL(valueChanged(double)), + this, SLOT(onXScaleChanged())); + + connect(ui->spXmin, SIGNAL(valueChanged(double)), + this, SLOT(onXScaleChanged())); + // init scale range preset list for (int nbits = 8; nbits <= 24; nbits++) // signed binary formats { @@ -222,6 +237,33 @@ void PlotControlPanel::onRangeSelected() ui->cbAutoScale->setChecked(false); } +void PlotControlPanel::onIndexChecked(bool checked) +{ + if (checked) + { + ui->lXmin->setEnabled(false); + ui->lXmax->setEnabled(false); + ui->spXmin->setEnabled(false); + ui->spXmax->setEnabled(false); + + emit xScaleChanged(true); // use index + } + else + { + ui->lXmin->setEnabled(true); + ui->lXmax->setEnabled(true); + ui->spXmin->setEnabled(true); + ui->spXmax->setEnabled(true); + + emit xScaleChanged(false, ui->spXmin->value(), ui->spXmax->value()); + } +} + +void PlotControlPanel::onXScaleChanged() +{ + emit xScaleChanged(false, ui->spXmin->value(), ui->spXmax->value()); +} + void PlotControlPanel::setChannelInfoModel(ChannelInfoModel* model) { ui->tvChannelInfo->setModel(model);