6#ifndef QSK_LAYOUT_METRICS_H
7#define QSK_LAYOUT_METRICS_H
18 Q_PROPERTY( qreal minimum READ minimum WRITE setMinimum )
19 Q_PROPERTY( qreal preferred READ preferred WRITE setPreferred )
20 Q_PROPERTY( qreal maximum READ maximum WRITE setMaximum )
24 constexpr QskLayoutMetrics( qreal minimum, qreal preferred, qreal maximum )
noexcept;
26 void normalize()
noexcept;
29 constexpr bool isDefault()
const noexcept;
31 qreal metric(
int which )
const noexcept;
32 void setMetric(
int which, qreal metric )
noexcept;
37 void setMinimum( qreal value )
noexcept;
38 constexpr qreal minimum()
const noexcept;
40 void setPreferred( qreal value )
noexcept;
41 constexpr qreal preferred()
const noexcept;
43 void setMaximum( qreal value )
noexcept;
44 constexpr qreal maximum()
const noexcept;
46 void setMetrics( qreal minimum, qreal preferred, qreal maximum )
noexcept;
49 void expandMinimum( qreal value )
noexcept;
50 void expandPreferred( qreal value )
noexcept;
51 void expandMaximum( qreal value )
noexcept;
53 static qreal combined(
int which, qreal value1, qreal value2 )
noexcept;
54 static constexpr qreal unlimited = std::numeric_limits< float >::max();
57 qreal m_minimum = 0.0;
58 qreal m_preferred = 0.0;
59 qreal m_maximum = QskLayoutMetrics::unlimited;
66QT_WARNING_DISABLE_CLANG(
"-Wfloat-equal")
67QT_WARNING_DISABLE_GCC("-Wfloat-equal")
68QT_WARNING_DISABLE_INTEL(1572)
71 qreal minimum, qreal preferred, qreal maximum ) noexcept
72 : m_minimum( minimum )
73 , m_preferred( preferred )
74 , m_maximum( maximum )
78inline constexpr qreal QskLayoutMetrics::minimum() const noexcept
83inline void QskLayoutMetrics::setMinimum( qreal value )
noexcept
88inline constexpr qreal QskLayoutMetrics::preferred() const noexcept
93inline void QskLayoutMetrics::setPreferred( qreal value )
noexcept
98inline constexpr qreal QskLayoutMetrics::maximum() const noexcept
103inline void QskLayoutMetrics::setMaximum( qreal value )
noexcept
108inline void QskLayoutMetrics::expandMinimum( qreal value )
noexcept
110 if ( value > m_minimum )
114inline void QskLayoutMetrics::expandPreferred( qreal value )
noexcept
116 if ( value > m_preferred )
120inline void QskLayoutMetrics::expandMaximum( qreal value )
noexcept
122 if ( value > m_maximum )
126inline void QskLayoutMetrics::setMetrics(
127 qreal minimum, qreal preferred, qreal maximum )
noexcept
130 m_preferred = preferred;
134inline qreal QskLayoutMetrics::metric(
int which )
const noexcept
138 case Qt::MinimumSize:
141 case Qt::PreferredSize:
144 case Qt::MaximumSize:
151inline constexpr bool QskLayoutMetrics::isDefault() const noexcept
153 return ( m_minimum == 0.0 ) && ( m_preferred == 0.0 )
154 && ( m_maximum == QskLayoutMetrics::unlimited );
157inline constexpr bool QskLayoutMetrics::operator==(
160 return ( m_preferred == other.m_preferred )
161 && ( m_minimum == other.m_minimum )
162 && ( m_maximum == other.m_maximum );
165inline constexpr bool QskLayoutMetrics::operator!=(
168 return !( *
this == other );
180#ifndef QT_NO_DEBUG_STREAM