diff --git a/src/pulsescopewidget.cpp b/src/pulsescopewidget.cpp index 836bb827e5395e7c251d08891e83be1ac7e08e20..8f2f1c2b8aef0c65430632f51f881ea31eb598d2 100644 --- a/src/pulsescopewidget.cpp +++ b/src/pulsescopewidget.cpp @@ -42,8 +42,8 @@ PulseScopeWidget::PulseScopeWidget(QWidget *parent) : QGraphicsView(parent), qWarning("Sorry, no multisampling support for pulse scope..."); } - m_scopeSizeH = 360; - m_scopeSizeV = 1; + m_scopeSizeH = 360.0f; + m_scopeSizeV = 1.0f; m_path = NULL; m_marker = m_scene.addLine(0.0f, 0.0f, 0.0f, m_scopeSizeV, QPen(Qt::red)); @@ -71,14 +71,9 @@ void PulseScopeWidget::drawCurve(const QVector<float>& vector) { m_data = vector; - // FIXME: to be removed later because amplitude should be normalized to 1! - QVector<float> test(vector); - qSort(test.begin(), test.end()); - if(test.last() > 1) m_scopeSizeV = 1-test.last(); - - QPainterPath pulsePath(QPoint(0.0f, 1.0f)); + QPainterPath pulsePath(QPoint(0.0f, m_scopeSizeV)); for(int i = 0; i < m_scopeSizeH; ++i) { - pulsePath.lineTo(i, 1-m_data.at(i)); + pulsePath.lineTo(i, m_scopeSizeV - m_data.at(i)); } if(m_path == NULL) { m_path = m_scene.addPath(pulsePath, QPen(Qt::yellow)); @@ -86,8 +81,6 @@ void PulseScopeWidget::drawCurve(const QVector<float>& vector) else { m_path->setPath(pulsePath); } - - fitInView(m_scene.itemsBoundingRect(), Qt::IgnoreAspectRatio); } void PulseScopeWidget::markerStep(float stepSize) { @@ -98,8 +91,7 @@ void PulseScopeWidget::markerStep(float stepSize) { m_marker->setLine(x, 0.0f, x, m_scopeSizeV); } else { - x = 0.0f; - markerReset(); + x -= m_scopeSizeH; } } diff --git a/src/pulsescopewidget.h b/src/pulsescopewidget.h index 9a3bb431fdfca0c100565d25f420da6a0760eaad..27537c7e67ab6fe9f0d2c78d8cdfae147662e0bf 100644 --- a/src/pulsescopewidget.h +++ b/src/pulsescopewidget.h @@ -51,7 +51,7 @@ private: QGraphicsPathItem *m_path; QGraphicsLineItem *m_marker; - int m_scopeSizeH; + float m_scopeSizeH; float m_scopeSizeV; };