fix: The cursor visited a invalid channel

This commit is contained in:
dreamsourcelabTAI 2023-04-23 17:53:37 +08:00
parent 51290b4bf6
commit a7b806ec3a

View File

@ -1309,11 +1309,19 @@ void DsoSignal::paint_hover_measure(QPainter &p, QColor fore, QColor back)
while (i != cursor_list.end()) { while (i != cursor_list.end()) {
float pt_value; float pt_value;
const QPointF pt = get_point((*i)->index(), pt_value);
int chan_index = (*i)->index();
if (_data->has_data(chan_index) == false){
i++;
continue;
}
const QPointF pt = get_point(chan_index, pt_value);
if (pt == QPointF(-1, -1)) { if (pt == QPointF(-1, -1)) {
i++; i++;
continue; continue;
} }
QString pt_str = get_voltage(hw_offset - pt_value, 2); QString pt_str = get_voltage(hw_offset - pt_value, 2);
const int pt_width = p.boundingRect(0, 0, INT_MAX, INT_MAX, const int pt_width = p.boundingRect(0, 0, INT_MAX, INT_MAX,
Qt::AlignLeft | Qt::AlignTop, pt_str).width() + 10; Qt::AlignLeft | Qt::AlignTop, pt_str).width() + 10;