summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/styles/qstylehelper.cpp14
-rw-r--r--src/gui/widgets/qlcdnumber.cpp12
2 files changed, 15 insertions, 11 deletions
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 79a1075..bd67f93 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -84,13 +84,13 @@ int QStyleHelper::calcBigLineSize(int radius)
return bigLineSize;
}
-static QPointF calcRadialPos(const QStyleOptionSlider *dial, float offset)
+static QPointF calcRadialPos(const QStyleOptionSlider *dial, qreal offset)
{
const int width = dial->rect.width();
const int height = dial->rect.height();
const int r = qMin(width, height) / 2;
const int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
- float a = 0;
+ qreal a = 0;
if (dial->maximum == dial->minimum)
a = Q_PI / 2;
else if (dial->dialWrapping)
@@ -99,10 +99,10 @@ static QPointF calcRadialPos(const QStyleOptionSlider *dial, float offset)
else
a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI
/ (dial->maximum - dial->minimum)) / 6;
- float xc = width / 2.0;
- float yc = height / 2.0;
- float len = r - QStyleHelper::calcBigLineSize(r) - 3;
- float back = offset * len;
+ qreal xc = width / 2.0;
+ qreal yc = height / 2.0;
+ qreal len = r - QStyleHelper::calcBigLineSize(r) - 3;
+ qreal back = offset * len;
QPointF pos(QPointF(xc + back * qCos(a), yc - back * qSin(a)));
return pos;
}
@@ -268,7 +268,7 @@ void QStyleHelper::drawDial(const QStyleOptionSlider *option, QPainter *painter)
QPointF dp = calcRadialPos(option, 0.70);
buttonColor = buttonColor.lighter(104);
buttonColor.setAlphaF(0.8);
- const float ds = r/7.0;
+ const qreal ds = r/7.0;
QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
dialRect.center().y() + dialRect.width(),
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.