diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index e6b32a74..ba122978 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -1247,7 +1247,7 @@ QSizeF QskControl::effectiveSizeHint( Qt::SizeHint whichHint ) const if ( d_func()->blockedImplicitSize ) { - QskControl* that = const_cast< QskControl* >( this ); + auto that = const_cast< QskControl* >( this ); that->updateImplicitSize(); } @@ -1805,7 +1805,7 @@ void QskControl::updateImplicitSize() const auto dw = m.left() + m.right(); const auto dh = m.top() + m.bottom(); - const QSizeF hint = contentsSizeHint(); + const auto hint = contentsSizeHint(); const qreal w = ( hint.width() >= 0 ) ? dw + hint.width() : 0.0; const qreal h = ( hint.height() >= 0 ) ? dh + hint.height() : 0.0; diff --git a/src/layouts/QskLayoutItem.cpp b/src/layouts/QskLayoutItem.cpp index 2e6d0269..54fffd73 100644 --- a/src/layouts/QskLayoutItem.cpp +++ b/src/layouts/QskLayoutItem.cpp @@ -10,26 +10,26 @@ QskLayoutItem::QskLayoutItem( QQuickItem* item, int row, int column, int rowSpan, int columnSpan ) : Inherited( row, column, qMax( rowSpan, 1 ), qMax( columnSpan, 1 ), Qt::Alignment() ) + , m_item( item ) , m_isGeometryDirty( false ) , m_isStretchable( false ) , m_retainSizeWhenHidden( false ) , m_unlimitedRowSpan( rowSpan <= 0 ) , m_unlimitedColumnSpan( columnSpan <= 0 ) , m_updateMode( UpdateWhenVisible ) - , m_item( item ) { } QskLayoutItem::QskLayoutItem( const QSizeF& size, int stretch, int row, int column ) : Inherited( row, column, 1, 1, Qt::Alignment() ) + , m_item( nullptr ) + , m_spacingHint( size ) , m_isGeometryDirty( false ) , m_isStretchable( stretch > 0 ) , m_retainSizeWhenHidden( false ) , m_unlimitedRowSpan( false ) , m_unlimitedColumnSpan( false ) , m_updateMode( UpdateWhenVisible ) - , m_spacingHint( size ) - , m_item( nullptr ) { } @@ -150,8 +150,8 @@ QLayoutPolicy::Policy QskLayoutItem::sizePolicy( Qt::Orientation orientation ) c const QSizeF hint = QskLayoutConstraint::effectiveConstraint( m_item, Qt::PreferredSize ); - const qreal h = ( orientation == Qt::Horizontal ) ? hint.width() : hint.height(); - if ( h <= 0 ) + const qreal value = ( orientation == Qt::Horizontal ) ? hint.width() : hint.height(); + if ( value <= 0 ) policy = QskSizePolicy::Ignored; } #endif @@ -194,9 +194,10 @@ Qt::Orientation QskLayoutItem::dynamicConstraintOrientation() const { Qt::Orientation orientation = Qt::Vertical; - if ( const QskControl* control = qobject_cast< const QskControl* >( m_item ) ) + if ( auto control = qobject_cast< const QskControl* >( m_item ) ) { const QskSizePolicy& policy = control->sizePolicy(); + if ( policy.horizontalPolicy() == QskSizePolicy::Constrained ) return Qt::Horizontal; else diff --git a/src/layouts/QskLayoutItem.h b/src/layouts/QskLayoutItem.h index 5913140b..0f37a9b4 100644 --- a/src/layouts/QskLayoutItem.h +++ b/src/layouts/QskLayoutItem.h @@ -66,16 +66,15 @@ class QskLayoutItem : public QGridLayoutItem bool hasUnlimitedSpan( Qt::Orientation orientation ) const; private: + QQuickItem* m_item; + QSizeF m_spacingHint; + bool m_isGeometryDirty : 1; bool m_isStretchable : 1; bool m_retainSizeWhenHidden : 1; bool m_unlimitedRowSpan : 1; bool m_unlimitedColumnSpan : 1; UpdateMode m_updateMode : 2; - - QSizeF m_spacingHint; - - QQuickItem* m_item; }; inline QQuickItem* QskLayoutItem::item()