block resizing of children, when having no width/height
This commit is contained in:
parent
03c7913f18
commit
c6553c3310
@ -171,8 +171,6 @@ void QskControl::setMargins( const QMarginsF& margins )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
const auto subControl = effectiveSubcontrol( QskAspect::Control );
|
||||
|
||||
const QMarginsF m(
|
||||
qMax( qreal( margins.left() ), qreal( 0.0 ) ),
|
||||
qMax( qreal( margins.top() ), qreal( 0.0 ) ),
|
||||
@ -181,6 +179,8 @@ void QskControl::setMargins( const QMarginsF& margins )
|
||||
|
||||
if ( m != this->margins() )
|
||||
{
|
||||
const auto subControl = effectiveSubcontrol( QskAspect::Control );
|
||||
|
||||
setMarginsHint( subControl | Margin, m );
|
||||
resetImplicitSize();
|
||||
|
||||
@ -892,8 +892,11 @@ void QskControl::windowDeactivateEvent()
|
||||
|
||||
void QskControl::updateItemPolish()
|
||||
{
|
||||
if ( d_func()->autoLayoutChildren && !maybeUnresized()
|
||||
&& ( width() > 0.0 || height() > 0.0 ) )
|
||||
updateResources(); // an extra dirty bit for this ???
|
||||
|
||||
if ( width() >= 0.0 || height() >= 0.0 )
|
||||
{
|
||||
if ( d_func()->autoLayoutChildren && !maybeUnresized() )
|
||||
{
|
||||
const auto rect = layoutRect();
|
||||
|
||||
@ -913,8 +916,8 @@ void QskControl::updateItemPolish()
|
||||
}
|
||||
}
|
||||
|
||||
updateResources();
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
QSGNode* QskControl::updateItemPaintNode( QSGNode* node )
|
||||
@ -980,16 +983,29 @@ QSizeF QskControl::layoutSizeHint(
|
||||
qreal h = -1.0;
|
||||
|
||||
const auto children = childItems();
|
||||
|
||||
for ( const auto child : children )
|
||||
{
|
||||
if ( qskIsVisibleToLayout( child ) )
|
||||
if ( !qskIsVisibleToLayout( child ) )
|
||||
continue;
|
||||
|
||||
const auto policy = qskSizePolicy( child );
|
||||
|
||||
if ( constraint.width() >= 0.0 && policy.isConstrained( Qt::Vertical ) )
|
||||
{
|
||||
const auto hint = qskSizeConstraint( child, which, constraint );
|
||||
h = QskLayoutHint::combined( which, h, hint.height() );
|
||||
}
|
||||
else if ( constraint.height() >= 0.0 && policy.isConstrained( Qt::Horizontal ) )
|
||||
{
|
||||
const auto hint = qskSizeConstraint( child, which, constraint );
|
||||
|
||||
if ( constraint.width() < 0.0 )
|
||||
w = QskLayoutHint::combined( which, w, hint.width() );
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto hint = qskSizeConstraint( child, which, QSizeF() );
|
||||
|
||||
if ( constraint.height() < 0.0 )
|
||||
w = QskLayoutHint::combined( which, w, hint.width() );
|
||||
h = QskLayoutHint::combined( which, h, hint.height() );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user