6#ifndef QSK_ARC_METRICS_H
7#define QSK_ARC_METRICS_H
9#include "QskFunctions.h"
20 Q_PROPERTY( qreal startAngle READ startAngle WRITE setStartAngle )
21 Q_PROPERTY( qreal spanAngle READ spanAngle WRITE setSpanAngle )
23 Q_PROPERTY( qreal thickness READ thickness WRITE setThickness )
24 Q_PROPERTY( Qt::SizeMode sizeMode READ sizeMode WRITE setSizeMode )
30 Qt::SizeMode = Qt::AbsoluteSize )
noexcept;
32 constexpr QskArcMetrics( qreal startAngle, qreal spanAngle, qreal thickness,
33 Qt::SizeMode = Qt::AbsoluteSize )
noexcept;
38 constexpr bool isNull()
const noexcept;
40 void setStartAngle( qreal startAngle )
noexcept;
41 constexpr qreal startAngle()
const noexcept;
43 void setSpanAngle( qreal spanAngle )
noexcept;
44 constexpr qreal spanAngle()
const noexcept;
46 constexpr qreal endAngle()
const noexcept;
47 constexpr qreal angleAtRatio( qreal ratio )
const noexcept;
49 bool containsAngle( qreal )
const;
50 bool isClosed()
const;
52 void setThickness( qreal )
noexcept;
53 constexpr qreal thickness()
const noexcept;
55 void setSizeMode( Qt::SizeMode )
noexcept;
56 constexpr Qt::SizeMode sizeMode()
const noexcept;
59 qreal value )
const noexcept;
62 QskArcMetrics toAbsolute( qreal radiusX, qreal radiusY )
const noexcept;
80 QPainterPath painterPath(
const QRectF& ellipseRect,
bool radial =
false )
const;
82 QRectF boundingRect(
const QRectF& ellipseRect )
const;
83 QSizeF boundingSize(
const QSizeF& ellipseSize )
const;
85 QskHashValue hash( QskHashValue seed = 0 )
const noexcept;
91 qreal m_startAngle = 0.0;
92 qreal m_spanAngle = 0.0;
94 qreal m_thickness = 0.0;
96 bool m_relativeSize =
false;
99inline constexpr QskArcMetrics::QskArcMetrics(
100 qreal thickness, Qt::SizeMode sizeMode ) noexcept
105inline constexpr QskArcMetrics::QskArcMetrics( qreal startAngle, qreal spanAngle,
106 qreal thickness, Qt::SizeMode sizeMode ) noexcept
107 : m_startAngle( startAngle )
108 , m_spanAngle( spanAngle )
109 , m_thickness( thickness )
110 , m_relativeSize( sizeMode == Qt::RelativeSize )
114inline bool QskArcMetrics::operator==(
117 return qskFuzzyCompare( m_thickness, other.m_thickness )
118 && qskFuzzyCompare( m_startAngle, other.m_startAngle )
119 && qskFuzzyCompare( m_spanAngle, other.m_spanAngle )
120 && ( m_relativeSize == other.m_relativeSize );
123inline bool QskArcMetrics::operator!=(
126 return !( *
this == other );
129inline constexpr bool QskArcMetrics::isNull() const noexcept
131 return qFuzzyIsNull( m_thickness ) || qFuzzyIsNull( m_spanAngle );
134inline constexpr qreal QskArcMetrics::thickness() const noexcept
139inline constexpr qreal QskArcMetrics::startAngle() const noexcept
144inline constexpr qreal QskArcMetrics::spanAngle() const noexcept
149inline constexpr qreal QskArcMetrics::endAngle() const noexcept
151 return m_startAngle + m_spanAngle;
154inline constexpr qreal QskArcMetrics::angleAtRatio( qreal ratio )
const noexcept
156 return m_startAngle + ratio * m_spanAngle;
159inline constexpr Qt::SizeMode QskArcMetrics::sizeMode() const noexcept
161 return m_relativeSize ? Qt::RelativeSize : Qt::AbsoluteSize;
164#ifndef QT_NO_DEBUG_STREAM