convenience functions added

This commit is contained in:
Uwe Rathmann 2019-07-09 14:49:24 +02:00
parent 6838260606
commit 8555cc3cc4
2 changed files with 16 additions and 0 deletions

View File

@ -76,6 +76,12 @@ void QskLayoutHint::normalize()
m_preferred = qBound( m_minimum, m_preferred, m_maximum );
}
bool QskLayoutHint::isDefault() const
{
return ( m_minimum == 0.0 ) && (m_preferred == 0.0 )
&& ( m_maximum == QskLayoutConstraint::unlimited );
}
#ifndef QT_NO_DEBUG_STREAM
#include <qdebug.h>

View File

@ -20,6 +20,9 @@ class QSK_EXPORT QskLayoutHint
void intersect( const QskLayoutHint& );
void normalize();
QskLayoutHint normalized() const;
bool isDefault() const;
qreal size( int which ) const;
void setSize( int which, qreal size );
@ -83,6 +86,13 @@ inline bool QskLayoutHint::operator!=( const QskLayoutHint& other ) const
return !( *this == other );
}
inline QskLayoutHint QskLayoutHint::normalized() const
{
auto hint = *this;
hint.normalize();
return hint;
}
#ifndef QT_NO_DEBUG_STREAM
QSK_EXPORT QDebug operator<<( QDebug, const QskLayoutHint& );