6#include "QskLayoutMetrics.h"
11static void qskRegisterLayoutMetrics()
13 qRegisterMetaType< QskLayoutMetrics >();
15#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
16 QMetaType::registerEqualsComparator< QskLayoutMetrics >();
20Q_CONSTRUCTOR_FUNCTION( qskRegisterLayoutMetrics )
22void QskLayoutMetrics::setMetric(
int which, qreal metric )
noexcept
30 case Qt::PreferredSize:
45 m_minimum = std::max( m_minimum, other.m_minimum );
46 m_preferred = std::max( m_preferred, other.m_preferred );
47 m_maximum = std::max( m_maximum, other.m_maximum );
50void QskLayoutMetrics::normalize() noexcept
52 m_minimum = std::max( m_minimum, qreal( 0.0 ) );
53 m_maximum = std::max( m_minimum, m_maximum );
54 m_preferred = qBound( m_minimum, m_preferred, m_maximum );
57qreal QskLayoutMetrics::combined(
int which, qreal value1, qreal value2 )
noexcept
59 if ( which == Qt::MaximumSize )
67 return std::min( value1, value2 );
70 return std::max( value1, value2 );
73#ifndef QT_NO_DEBUG_STREAM
77static inline QString qskHintValueString( qreal value )
79 if ( value >= QskLayoutMetrics::unlimited )
80 return QStringLiteral(
"unlimited" );
82 return QString::number( value );
87 QDebugStateSaver saver( debug );
90 debug <<
"LayoutMetrics" <<
"( "
91 << qskHintValueString( metrics.minimum() ) <<
", "
92 << qskHintValueString( metrics.preferred() ) <<
", "
93 << qskHintValueString( metrics.maximum() ) <<
" )";
100#include "moc_QskLayoutMetrics.cpp"