summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlcdnumber.cpp
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-03-30 10:34:06 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2009-03-30 10:44:16 (GMT)
commit65d7c21bd2338e9bb65a0bca11dad1e26bb9f554 (patch)
treedbaa46df886d12d529943b1eccc647ffa2b18e91 /src/gui/widgets/qlcdnumber.cpp
parentb86c9738c296574e0bdcaa2aa4c15a4736b656b4 (diff)
downloadQt-65d7c21bd2338e9bb65a0bca11dad1e26bb9f554.zip
Qt-65d7c21bd2338e9bb65a0bca11dad1e26bb9f554.tar.gz
Qt-65d7c21bd2338e9bb65a0bca11dad1e26bb9f554.tar.bz2
Make LCD segments filled by default
This changes the LCD segments to filled by default to make them more readable. It also enables antialiasing for the rendering. The change might be somewhat controversial but since the segments are hardly readable in many styles while using Outline it does not make sense as a default. Reviewed-by: nrc
Diffstat (limited to 'src/gui/widgets/qlcdnumber.cpp')
-rw-r--r--src/gui/widgets/qlcdnumber.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/widgets/qlcdnumber.cpp b/src/gui/widgets/qlcdnumber.cpp
index 0136f1a..9d98dbc 100644
--- a/src/gui/widgets/qlcdnumber.cpp
+++ b/src/gui/widgets/qlcdnumber.cpp
@@ -403,7 +403,7 @@ QLCDNumber::QLCDNumber(QWidget *parent)
Constructs an LCD number, sets the number of digits to \a
numDigits, the base to decimal, the decimal point mode to 'small'
and the frame style to a raised box. The segmentStyle() is set to
- \c Outline.
+ \c Filled.
The \a parent argument is passed to the QFrame constructor.
@@ -427,7 +427,7 @@ void QLCDNumberPrivate::init()
base = QLCDNumber::Dec;
smallPoint = false;
q->setNumDigits(ndigits);
- q->setSegmentStyle(QLCDNumber::Outline);
+ q->setSegmentStyle(QLCDNumber::Filled);
q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
}
@@ -756,6 +756,10 @@ void QLCDNumber::paintEvent(QPaintEvent *)
Q_D(QLCDNumber);
QPainter p(this);
drawFrame(&p);
+ p.setRenderHint(QPainter::Antialiasing);
+ if (d->shadow)
+ p.translate(0.5, 0.5);
+
if (d->smallPoint)
d->drawString(d->digitStr, p, &d->points, false);
else
@@ -1070,7 +1074,7 @@ void QLCDNumberPrivate::drawSegment(const QPoint &pos, char segmentNo, QPainter
q->objectName().toLocal8Bit().constData(), segmentNo);
}
// End exact copy
- p.setPen(fgColor);
+ p.setPen(Qt::NoPen);
p.setBrush(fgColor);
p.drawPolygon(a);
p.setBrush(Qt::NoBrush);
@@ -1218,8 +1222,8 @@ void QLCDNumberPrivate::drawSegment(const QPoint &pos, char segmentNo, QPainter
\header \i Style \i Result
\row \i \c Outline
\i Produces raised segments filled with the background color
- (this is the default).
\row \i \c Filled
+ (this is the default).
\i Produces raised segments filled with the foreground color.
\row \i \c Flat
\i Produces flat segments filled with the foreground color.