aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-06 23:05:39 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-07 16:41:45 +0000
commit8ca88664aceeb4e1b3ebd51c0e8400a6af20da71 (patch)
tree171cc0567ac1c763431a113011d2f719953c3b66 /src
parent93a79811137172275ab87fbfc61355f56da07397 (diff)
Material: fix BusyIndicator on high DPI
Take the device pixel ratio into account Change-Id: Icd2aa70018254975675d284ce77f6db02af9517a Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp
index 54728686..c11a347f 100644
--- a/src/imports/controls/material/qquickmaterialprogressring.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressring.cpp
@@ -74,6 +74,7 @@ public:
void afterNodeSync() Q_DECL_OVERRIDE;
private:
+ qreal m_devicePixelRatio;
QSGNode *m_containerNode;
QQuickWindow *m_window;
};
@@ -165,6 +166,7 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const
}
QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() :
+ m_devicePixelRatio(1.0),
m_containerNode(Q_NULLPTR),
m_window(Q_NULLPTR)
{
@@ -179,6 +181,7 @@ void QQuickMaterialRingAnimatorJob::initialize(QQuickAnimatorController *control
QQuickAnimatorJob::initialize(controller);
m_containerNode = QQuickItemPrivate::get(m_target)->childContainerNode();
m_window = m_target->window();
+ m_devicePixelRatio = m_window->effectiveDevicePixelRatio();
}
void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time)
@@ -192,8 +195,8 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time)
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
- const qreal width = rectNode->rect().width();
- const qreal height = rectNode->rect().height();
+ const qreal width = rectNode->rect().width() * m_devicePixelRatio;
+ const qreal height = rectNode->rect().height() * m_devicePixelRatio;
QImage image(width, height, QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent);
@@ -203,7 +206,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time)
QPen pen;
QQuickMaterialRingTexture *textureNode = static_cast<QQuickMaterialRingTexture*>(rectNode->firstChild());
pen.setColor(textureNode->color());
- pen.setWidth(4);
+ pen.setWidth(4 * m_devicePixelRatio);
painter.setPen(pen);
const qreal percentageComplete = time / qreal(rotationAnimationDuration);
@@ -237,7 +240,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time)
}
const int halfPen = pen.width() / 2;
- const QRectF arcBounds = QRectF(rectNode->rect().adjusted(halfPen, halfPen, -halfPen, -halfPen));
+ const QRectF arcBounds = QRectF(halfPen, halfPen, width - pen.width(), height - pen.width());
// The current angle of the rotation animation.
const qreal rotation = oneDegree * percentageComplete * -targetRotation;
startAngle -= rotation;