summaryrefslogtreecommitdiffstats
path: root/examples/animation
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-06-08 12:27:51 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-06-08 12:27:51 (GMT)
commit4003ec67b479ae9bb14d65464403fcdad6e9f394 (patch)
tree0d89f14cbb351f32b95845797445e406da2c080d /examples/animation
parentf75ff5e473c2a8fea0092d12c289698e90bff297 (diff)
downloadQt-4003ec67b479ae9bb14d65464403fcdad6e9f394.zip
Qt-4003ec67b479ae9bb14d65464403fcdad6e9f394.tar.gz
Qt-4003ec67b479ae9bb14d65464403fcdad6e9f394.tar.bz2
Use a QPainterPath instead to draw the graph.
This enables the antialiazing to be done on the graph as a whole, and not on every tiny line segment. The result is that the curve is painter prettier.
Diffstat (limited to 'examples/animation')
-rw-r--r--examples/animation/easing/window.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/animation/easing/window.cpp b/examples/animation/easing/window.cpp
index 5a1f764..8a6d850 100644
--- a/examples/animation/easing/window.cpp
+++ b/examples/animation/easing/window.cpp
@@ -109,16 +109,16 @@ void Window::createCurveIcons()
QPoint end(yAxis + curveScale, xAxis - curveScale * curve.valueForProgress(1));
painter.drawRect(end.x() - 1, end.y() - 1, 3, 3);
- painter.setPen(QColor(32, 32, 32));
- painter.setRenderHint(QPainter::Antialiasing, true);
- QPoint currentPos(start);
+ QPainterPath curvePath;
+ curvePath.moveTo(start);
for (qreal t = 0; t < 1.0; t+=1.0/curveScale) {
QPoint to;
to.setX(yAxis + curveScale * t);
to.setY(xAxis - curveScale * curve.valueForProgress(t));
- painter.drawLine(currentPos, to);
- currentPos = to;
+ curvePath.lineTo(to);
}
+ painter.setRenderHint(QPainter::Antialiasing, true);
+ painter.strokePath(curvePath, QColor(32, 32, 32));
painter.setRenderHint(QPainter::Antialiasing, false);
QListWidgetItem *item = new QListWidgetItem;
item->setIcon(QIcon(pix));