diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-04-21 08:43:54 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-04-21 07:32:55 +0000 |
commit | d07341340e7cee1e266254ec5e4bb38848e6a47f (patch) | |
tree | 484b9ac01022da359ab03aa79c5df49ce5ef3d31 | |
parent | a3b57a000eb1ffd7038b8d92c062a32c254a4c9f (diff) |
Fix rendering of squished default Dial
Change-Id: Iffa49532b1137b89cf305fd5663658baa52bc13b
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r-- | src/imports/controls/Dial.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/qquickdialring.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml index 50f7ea7e..44862c69 100644 --- a/src/imports/controls/Dial.qml +++ b/src/imports/controls/Dial.qml @@ -66,7 +66,7 @@ T.Dial { opacity: control.enabled ? 1 : 0.3 transform: [ Translate { - y: -background.height * 0.4 + handle.height / 2 + y: -Math.min(background.width, background.height) * 0.4 + handle.height / 2 }, Rotation { angle: control.angle diff --git a/src/imports/controls/qquickdialring.cpp b/src/imports/controls/qquickdialring.cpp index d2d5defd..77239a62 100644 --- a/src/imports/controls/qquickdialring.cpp +++ b/src/imports/controls/qquickdialring.cpp @@ -92,6 +92,7 @@ void QQuickDialRing::paint(QPainter *painter) const QRectF bounds = boundingRect(); const qreal smallest = qMin(bounds.width(), bounds.height()); QRectF rect = QRectF(pen.widthF() / 2.0 + 1, pen.widthF() / 2.0 + 1, smallest - pen.widthF() - 2, smallest - pen.widthF() - 2); + rect.moveCenter(bounds.center()); // Make sure the arc is aligned to whole pixels. if (rect.x() - int(rect.x()) > 0) @@ -112,10 +113,10 @@ void QQuickDialRing::paint(QPainter *painter) path.arcTo(rect, startAngle, spanAngle); painter->drawPath(path); + rect.adjust(-pen.widthF() / 2.0, -pen.widthF() / 2.0, pen.widthF() / 2.0, pen.widthF() / 2.0); pen.setWidth(1); painter->setPen(pen); - rect = QRectF(1, 1, width() - 2, height() - 2); path = QPainterPath(); path.arcMoveTo(rect, 0); path.arcTo(rect, 0, 360); |