diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index 08a80a47..642b0915 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -711,13 +711,13 @@ qreal QskControl::heightForWidth( qreal width ) const d->blockLayoutRequestEvents = false; - if ( !d->autoLayoutChildren ) - return -1.0; + if ( d->autoLayoutChildren ) + { + return constrainedMetric( QskLayoutConstraint::HeightForWidth, + this, width, QskLayoutConstraint::constrainedChildrenMetric ); + } - using namespace QskLayoutConstraint; - - return constrainedMetric( - HeightForWidth, this, width, constrainedChildrenMetric ); + return -1.0; } qreal QskControl::widthForHeight( qreal height ) const @@ -726,13 +726,13 @@ qreal QskControl::widthForHeight( qreal height ) const d->blockLayoutRequestEvents = false; - if ( !d->autoLayoutChildren ) - return -1.0; + if ( d->autoLayoutChildren ) + { + return constrainedMetric( QskLayoutConstraint::WidthForHeight, + this, height, QskLayoutConstraint::constrainedChildrenMetric ); + } - using namespace QskLayoutConstraint; - - return constrainedMetric( - WidthForHeight, this, height, constrainedChildrenMetric ); + return -1.0; } bool QskControl::event( QEvent* event ) @@ -924,10 +924,13 @@ void QskControl::updateItemPolish() const auto children = childItems(); for ( auto child : children ) { + // checking qskIsVisibleToParent ??? if ( !qskIsTransparentForPositioner( child ) ) { - // rect = QskLayoutConstraint::itemRect( info.item, rect, ... ); - qskSetItemGeometry( child, rect ); + const auto itemRect = QskLayoutConstraint::boundedRect( + child, rect, QskLayoutConstraint::layoutAlignmentHint( child ) ); + + qskSetItemGeometry( child, itemRect ); } } } diff --git a/src/layouts/QskLayoutConstraint.cpp b/src/layouts/QskLayoutConstraint.cpp index 10857a34..2688ecb6 100644 --- a/src/layouts/QskLayoutConstraint.cpp +++ b/src/layouts/QskLayoutConstraint.cpp @@ -222,9 +222,12 @@ qreal QskLayoutConstraint::constrainedChildrenMetric( { if ( !qskIsTransparentForPositioner( child ) ) { - const auto v = constrainFunction( child, constraint ); - if ( v > constrainedValue ) - constrainedValue = v; + if ( qskIsVisibleToParent( child ) || retainSizeWhenHidden( child ) ) + { + const auto v = constrainFunction( child, constraint ); + if ( v > constrainedValue ) + constrainedValue = v; + } } }