diff options
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/kernel/qapplication.cpp | 13 | ||||
| -rw-r--r-- | src/widgets/styles/qfusionstyle_p_p.h | 3 | ||||
| -rw-r--r-- | src/widgets/widgets/qlcdnumber.cpp | 14 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index d2b0fb724ac..a735696adcb 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3741,6 +3741,14 @@ void QApplicationPrivate::cleanupMultitouch_sys() { } +/*! \internal + Check the target widgets of the active touchpoints of the given \a device, + and choose the widget that is closest to any of the points. This widget + will then get all the touchpoints, even if it would not otherwise be the + target for some of them. + + \sa translateRawTouchEvent() +*/ QWidget *QApplicationPrivate::findClosestTouchPointTarget(const QPointingDevice *device, const QEventPoint &touchPoint) { const QPointF globalPos = touchPoint.globalPosition(); @@ -3754,7 +3762,10 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(const QPointingDevice qreal dx = globalPos.x() - pt.globalPosition().x(); qreal dy = globalPos.y() - pt.globalPosition().y(); qreal distance = dx * dx + dy * dy; - if (closestTouchPointId == -1 || distance < closestDistance) { + // closestTouchPointId is -1 at the beginning. + // closestTouchPointId may be 0 if + // a synth-mouse eventPoint was found in activePoints: that's not relevant here. + if (closestTouchPointId <= 0 || distance < closestDistance) { closestTouchPointId = pt.id(); closestDistance = distance; closestTarget = QMutableEventPoint::target(pt); diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h index dcb79f9e93c..821be49b2fa 100644 --- a/src/widgets/styles/qfusionstyle_p_p.h +++ b/src/widgets/styles/qfusionstyle_p_p.h @@ -94,7 +94,8 @@ public: QColor buttonColor = pal.button().color(); int val = qGray(buttonColor.rgb()); buttonColor = buttonColor.lighter(100 + qMax(1, (180 - val)/6)); - buttonColor.setHsv(buttonColor.hue(), buttonColor.saturation() * 0.75, buttonColor.value()); + buttonColor.setHsv(buttonColor.hue(), buttonColor.saturation() * 0.75, + buttonColor.value(), buttonColor.alpha()); return buttonColor; } diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 2c4b4e334d5..ac8e00af95e 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -5,6 +5,7 @@ #include "qlcdnumber.h" #include "qbitarray.h" +#include "qnumeric.h" #include "qpainter.h" #include "private/qframe_p.h" @@ -110,22 +111,17 @@ public: */ -static QString int2string(int num, int base, int ndigits, bool *oflow) +static QString int2string(int number, int base, int ndigits, bool *oflow) { QString s; - bool negative; - if (num < 0) { - negative = true; - num = -num; - } else { - negative = false; - } + const bool negative = number < 0; + const uint num = QtPrivate::qUnsignedAbs(number); switch(base) { case QLCDNumber::Hex: s = QString::asprintf("%*x", ndigits, num); break; case QLCDNumber::Dec: - s = QString::asprintf("%*i", ndigits, num); + s = QString::asprintf("%*u", ndigits, num); break; case QLCDNumber::Oct: s = QString::asprintf("%*o", ndigits, num); |
