QskArcMetrics::toAbsolute version with qreal added

This commit is contained in:
Uwe Rathmann 2023-04-12 12:18:32 +02:00
parent 98cb1b256b
commit 76248e480b
2 changed files with 14 additions and 3 deletions

View File

@ -73,17 +73,27 @@ QVariant QskArcMetrics::interpolate(
}
QskArcMetrics QskArcMetrics::toAbsolute( const QSizeF& size ) const noexcept
{
if ( size.width() < 0.0 )
return toAbsolute( size.height() );
if ( size.height() < 0.0 )
return toAbsolute( size.width() );
return toAbsolute( qMin( size.width(), size.height() ) );
}
QskArcMetrics QskArcMetrics::toAbsolute( qreal size ) const noexcept
{
if ( m_sizeMode != Qt::RelativeSize )
return *this;
QskArcMetrics absoluted = *this;
const auto l = qMin( size.width(), size.height() );
if ( l <= 0.0 )
if ( size <= 0.0 )
absoluted.m_thickness = 0.0;
else
absoluted.m_thickness = qskAbsoluted( l, absoluted.m_thickness );
absoluted.m_thickness = qskAbsoluted( size, absoluted.m_thickness );
absoluted.m_sizeMode = Qt::AbsoluteSize;

View File

@ -55,6 +55,7 @@ class QSK_EXPORT QskArcMetrics
qreal value ) const noexcept;
QskArcMetrics toAbsolute( const QSizeF& ) const noexcept;
QskArcMetrics toAbsolute( qreal ) const noexcept;
QskHashValue hash( QskHashValue seed = 0 ) const noexcept;