clang-tidy: fix bugprone-integer-division

An example of one of the warnings:

qquickfusiondial.cpp:87:15: warning: result of integer division used in
a floating point context; possible loss of
precision [bugprone-integer-division]

Change-Id: I9d225e8149935a8f8dde6e8b0657c1406676b7f1
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This commit is contained in:
Mitch Curtis 2019-12-12 13:50:03 +01:00
parent 025f938c1b
commit e7a9691481
3 changed files with 3 additions and 3 deletions

View File

@ -84,7 +84,7 @@ void QQuickFusionDial::paint(QPainter *painter)
QColor buttonColor = m_palette.button().color();
const bool enabled = isEnabled();
qreal r = qMin(width, height) / 2;
qreal r = qMin(width, height) / 2.0;
r -= r/50;
const qreal penSize = r/20.0;

View File

@ -124,7 +124,7 @@ void QQuickDefaultBusyIndicatorNode::sync(QQuickItem *item)
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
QPointF pos = QPointF(sz / 2 - circleRadius, sz / 2 - circleRadius);
pos = moveCircle(pos, 360 / CircleCount * i, sz / 2 - circleRadius);
pos = moveCircle(pos, 360.0 / CircleCount * i, sz / 2 - circleRadius);
QMatrix4x4 m;
m.translate(dx + pos.x(), dy + pos.y());

View File

@ -59,7 +59,7 @@ static inline qreal blockStartX(int blockIndex)
static inline qreal blockRestX(int blockIndex, qreal availableWidth)
{
const qreal spanRightEdgePos = availableWidth / 2 + BlockSpan / 2;
const qreal spanRightEdgePos = availableWidth / 2 + BlockSpan / 2.0;
return spanRightEdgePos - (blockIndex + 1) * BlockWidth - (blockIndex * BlockRestingSpacing);
}