summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Griebl <rgriebl@trolltech.com>2010-04-19 14:52:03 +0200
committerRobert Griebl <rgriebl@trolltech.com>2010-04-19 14:52:03 +0200
commit86b3be1d424eb563cd4150d87b9c4a823abca9d8 (patch)
tree6a26d3cae8b7e3e421cc8fac13c5dbea8a8817d5
parentb2fb433835862236e9182b879165b703a881e937 (diff)
plot widget update
-rw-r--r--testapp/plotwidget.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/testapp/plotwidget.cpp b/testapp/plotwidget.cpp
index 0564df2..019c3c8 100644
--- a/testapp/plotwidget.cpp
+++ b/testapp/plotwidget.cpp
@@ -56,8 +56,8 @@ PlotWidget::PlotWidget(QKineticScroller *scroller)
QString legend;
QTextStream ts(&legend);
ts << "<table border=\"0\">";
- ts << "<tr><td width=\"30\" bgcolor=\"" << QColor(Qt::red).light().name() << "\" /><td>releaseVelocity X</td></tr>";
- ts << "<tr><td width=\"30\" bgcolor=\"" << QColor(Qt::red).dark().name() << "\" /><td>releaseVelocity Y</td></tr>";
+ ts << "<tr><td width=\"30\" bgcolor=\"" << QColor(Qt::red).light().name() << "\" /><td>Velocity X</td></tr>";
+ ts << "<tr><td width=\"30\" bgcolor=\"" << QColor(Qt::red).dark().name() << "\" /><td>Velocity Y</td></tr>";
ts << "<tr><td width=\"30\" bgcolor=\"" << QColor(Qt::green).light().name() << "\" /><td>Content Position X</td></tr>";
ts << "<tr><td width=\"30\" bgcolor=\"" << QColor(Qt::green).dark().name() << "\" /><td>Content Position Y</td></tr>";
ts << "<tr><td width=\"30\" bgcolor=\"" << QColor(Qt::blue).light().name() << "\" /><td>Overshoot Position X</td></tr>";
@@ -121,6 +121,9 @@ void PlotWidget::paintEvent(QPaintEvent *)
p.setRenderHints(QPainter::Antialiasing);
p.fillRect(rect(), Qt::white);
+ p.setPen(Qt::black);
+ p.drawLine(0, SCALE(0, 1), width(), SCALE(0, 1));
+
if (m_plotitems.isEmpty())
return;
@@ -157,5 +160,12 @@ void PlotWidget::paintEvent(QPaintEvent *)
last = &(*it++);
x += 2;
}
+
+ QString toptext = QString("%1 [m/s] / %2 [pix]").arg(minMaxVelocity, 0, 'f', 2).arg(minMaxPosition, 0, 'f', 2);
+ QString bottomtext = QString("-%1 [m/s] / -%2 [pix]").arg(minMaxVelocity, 0, 'f', 2).arg(minMaxPosition, 0, 'f', 2);
+
+ p.setPen(Qt::black);
+ p.drawText(rect(), Qt::AlignTop | Qt::AlignHCenter, toptext);
+ p.drawText(rect(), Qt::AlignBottom | Qt::AlignHCenter, bottomtext);
#undef SCALE
}