summaryrefslogtreecommitdiffstats
path: root/demos/chip/chip.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-22 09:28:05 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-22 09:28:05 (GMT)
commitd0ac49ec731f0781ba48f8f5d8ce04e19ce0010d (patch)
treeba6df139b3c343bb9352423770a99f218f62bd45 /demos/chip/chip.cpp
parent72798fc4dfc1af73cde542f9017dfec5cb020173 (diff)
parent8ad5020940f10d4ecc5c5e8b3b9656531cb84ef3 (diff)
downloadQt-d0ac49ec731f0781ba48f8f5d8ce04e19ce0010d.zip
Qt-d0ac49ec731f0781ba48f8f5d8ce04e19ce0010d.tar.gz
Qt-d0ac49ec731f0781ba48f8f5d8ce04e19ce0010d.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-animations
Conflicts: src/corelib/kernel/kernel.pri src/corelib/kernel/qvariant_p.h src/corelib/tools/tools.pri src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsitem.h src/gui/graphicsview/qgraphicswidget.h src/gui/gui.pro
Diffstat (limited to 'demos/chip/chip.cpp')
-rw-r--r--demos/chip/chip.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/demos/chip/chip.cpp b/demos/chip/chip.cpp
index c2b22da..4b6579e 100644
--- a/demos/chip/chip.cpp
+++ b/demos/chip/chip.cpp
@@ -74,8 +74,9 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
if (option->state & QStyle::State_MouseOver)
fillColor = fillColor.light(125);
- if (option->levelOfDetail < 0.2) {
- if (option->levelOfDetail < 0.125) {
+ const qreal lod = option->levelOfDetailFromTransform(painter->worldTransform());
+ if (lod < 0.2) {
+ if (lod < 0.125) {
painter->fillRect(QRectF(0, 0, 110, 70), fillColor);
return;
}
@@ -100,7 +101,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
painter->drawRect(QRect(14, 14, 79, 39));
painter->setBrush(b);
- if (option->levelOfDetail >= 1) {
+ if (lod >= 1) {
painter->setPen(QPen(Qt::gray, 1));
painter->drawLine(15, 54, 94, 54);
painter->drawLine(94, 53, 94, 15);
@@ -108,7 +109,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
}
// Draw text
- if (option->levelOfDetail >= 2) {
+ if (lod >= 2) {
QFont font("Times", 10);
font.setStyleStrategy(QFont::ForceOutline);
painter->setFont(font);
@@ -122,17 +123,17 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
// Draw lines
QVarLengthArray<QLineF, 36> lines;
- if (option->levelOfDetail >= 0.5) {
- for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) {
+ if (lod >= 0.5) {
+ for (int i = 0; i <= 10; i += (lod > 0.5 ? 1 : 2)) {
lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5));
lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62));
}
- for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) {
+ for (int i = 0; i <= 6; i += (lod > 0.5 ? 1 : 2)) {
lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5));
lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5));
}
}
- if (option->levelOfDetail >= 0.4) {
+ if (lod >= 0.4) {
const QLineF lineData[] = {
QLineF(25, 35, 35, 35),
QLineF(35, 30, 35, 40),