Skip to content
Snippets Groups Projects
Commit ef1356c2 authored by Oliver Bock's avatar Oliver Bock
Browse files

Improved curve/marker updates

* Removed workaround code (now normalized values: [0,1])
* Pending: marker sync issue (see previous commit)
parent 003b56a2
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
......
......@@ -51,7 +51,7 @@ private:
QGraphicsPathItem *m_path;
QGraphicsLineItem *m_marker;
int m_scopeSizeH;
float m_scopeSizeH;
float m_scopeSizeV;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment