From 8555cc3cc4ab6eb0ddeb8ed10d04fe5fbecbf12b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 9 Jul 2019 14:49:24 +0200 Subject: [PATCH] convenience functions added --- src/layouts/QskLayoutHint.cpp | 6 ++++++ src/layouts/QskLayoutHint.h | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/layouts/QskLayoutHint.cpp b/src/layouts/QskLayoutHint.cpp index d4ae3a11..cdf6953e 100644 --- a/src/layouts/QskLayoutHint.cpp +++ b/src/layouts/QskLayoutHint.cpp @@ -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 diff --git a/src/layouts/QskLayoutHint.h b/src/layouts/QskLayoutHint.h index cd3667af..5e0d632a 100644 --- a/src/layouts/QskLayoutHint.h +++ b/src/layouts/QskLayoutHint.h @@ -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& );