#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
+#include <QDebug>
#include <QFormLayout>
#include <QGridLayout>
#include <QLabel>
using std::make_pair;
using std::min;
using std::numeric_limits;
+using std::out_of_range;
using std::pair;
using std::placeholders::_1;
using std::shared_ptr;
// Draw high/neutral/low areas
if (thresholds.size() == 2) {
- const double thr_lo = visual_y - thresholds[0] * scale_;
- const double thr_hi = visual_y - thresholds[1] * scale_;
+ int thr_lo = visual_y - thresholds[0] * scale_;
+ int thr_hi = visual_y - thresholds[1] * scale_;
+ thr_lo = min(max(thr_lo, top), btm);
+ thr_hi = min(max(thr_hi, top), btm);
p.fillRect(QRectF(pp.left(), top, pp.width(), thr_hi - top),
QBrush(ThresholdColorHi));
p.fillRect(QRectF(pp.left(), thr_lo, pp.width(), btm - thr_lo),
QBrush(ThresholdColorLo));
} else {
- const double thr = visual_y - thresholds[0] * scale_;
+ int thr = visual_y - thresholds[0] * scale_;
+ thr = min(max(thr, top), btm);
p.fillRect(QRectF(pp.left(), top, pp.width(), thr - top),
QBrush(ThresholdColorHi));
if (segments.empty())
return;
- const shared_ptr<pv::data::AnalogSegment> &segment =
- segments.front();
+ shared_ptr<pv::data::AnalogSegment> segment;
+ try {
+ segment = segments.at(current_segment_);
+ } catch (out_of_range) {
+ qDebug() << "Current analog segment out of range for signal" << base_->name();
+ return;
+ }
const double pixels_offset = pp.pixels_offset();
const double samplerate = max(1.0, segment->samplerate());
if (segments.empty())
return;
- const shared_ptr<pv::data::LogicSegment> &segment =
- segments.front();
+ shared_ptr<pv::data::LogicSegment> segment;
+ try {
+ segment = segments.at(current_segment_);
+ } catch (out_of_range) {
+ qDebug() << "Current logic segment out of range for signal" << base_->name();
+ return;
+ }
double samplerate = segment->samplerate();