summaryrefslogtreecommitdiffstats
path: root/examples/animation
diff options
context:
space:
mode:
authorAriya Hidayat <ariya.hidayat@nokia.com>2009-06-08 12:00:42 (GMT)
committerAriya Hidayat <ariya.hidayat@nokia.com>2009-06-08 12:17:40 (GMT)
commite0405b6b42ddf794935af27a0265ca259c73ce4c (patch)
tree50c73354c47afa7d3e5c5f307b59e20a4619893f /examples/animation
parentcbb9af732fee50010bb540d0a3dc39e67f2e4e7e (diff)
downloadQt-e0405b6b42ddf794935af27a0265ca259c73ce4c.zip
Qt-e0405b6b42ddf794935af27a0265ca259c73ce4c.tar.gz
Qt-e0405b6b42ddf794935af27a0265ca259c73ce4c.tar.bz2
Make the easing curve icons more beautiful.
Draw the curve with anti-aliasing. Do not use absolute black, but rather a dark black color for the lines. Draw the red and blue dots, indicating the start and end points. Reviewed-by: Jan-Arve
Diffstat (limited to 'examples/animation')
-rw-r--r--examples/animation/easing/window.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/examples/animation/easing/window.cpp b/examples/animation/easing/window.cpp
index cf4be15..f575483 100644
--- a/examples/animation/easing/window.cpp
+++ b/examples/animation/easing/window.cpp
@@ -94,11 +94,24 @@ void Window::createCurveIcons()
qreal yAxis = m_iconSize.width()/3;
painter.drawLine(0, xAxis, m_iconSize.width(), xAxis);
painter.drawLine(yAxis, 0, yAxis, m_iconSize.height());
- painter.setPen(Qt::black);
qreal curveScale = m_iconSize.height()/2;
- QPoint currentPos(yAxis, xAxis);
-
+
+ painter.setPen(Qt::NoPen);
+
+ // start point
+ painter.setBrush(Qt::red);
+ QPoint start(yAxis, xAxis - curveScale * curve.valueForProgress(0));
+ painter.drawRect(start.x() - 1, start.y() - 1, 3, 3);
+
+ // end point
+ painter.setBrush(Qt::blue);
+ 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);
for (qreal t = 0; t < 1.0; t+=1.0/curveScale) {
QPoint to;
to.setX(yAxis + curveScale * t);
@@ -106,6 +119,7 @@ void Window::createCurveIcons()
painter.drawLine(currentPos, to);
currentPos = to;
}
+ painter.setRenderHint(QPainter::Antialiasing, false);
QListWidgetItem *item = new QListWidgetItem;
item->setIcon(QIcon(pix));
item->setText(metaEnum.key(i));