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;
|
using namespace QskAspect;
|
||||||
|
|
||||||
const auto subControl = effectiveSubcontrol( QskAspect::Control );
|
|
||||||
|
|
||||||
const QMarginsF m(
|
const QMarginsF m(
|
||||||
qMax( qreal( margins.left() ), qreal( 0.0 ) ),
|
qMax( qreal( margins.left() ), qreal( 0.0 ) ),
|
||||||
qMax( qreal( margins.top() ), qreal( 0.0 ) ),
|
qMax( qreal( margins.top() ), qreal( 0.0 ) ),
|
||||||
@ -181,6 +179,8 @@ void QskControl::setMargins( const QMarginsF& margins )
|
|||||||
|
|
||||||
if ( m != this->margins() )
|
if ( m != this->margins() )
|
||||||
{
|
{
|
||||||
|
const auto subControl = effectiveSubcontrol( QskAspect::Control );
|
||||||
|
|
||||||
setMarginsHint( subControl | Margin, m );
|
setMarginsHint( subControl | Margin, m );
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
|
|
||||||
@ -892,29 +892,32 @@ void QskControl::windowDeactivateEvent()
|
|||||||
|
|
||||||
void QskControl::updateItemPolish()
|
void QskControl::updateItemPolish()
|
||||||
{
|
{
|
||||||
if ( d_func()->autoLayoutChildren && !maybeUnresized()
|
updateResources(); // an extra dirty bit for this ???
|
||||||
&& ( width() > 0.0 || height() > 0.0 ) )
|
|
||||||
{
|
|
||||||
const auto rect = layoutRect();
|
|
||||||
|
|
||||||
const auto children = childItems();
|
if ( width() >= 0.0 || height() >= 0.0 )
|
||||||
for ( auto child : children )
|
{
|
||||||
|
if ( d_func()->autoLayoutChildren && !maybeUnresized() )
|
||||||
{
|
{
|
||||||
/*
|
const auto rect = layoutRect();
|
||||||
We don't want to resize invisible children, but then
|
|
||||||
we would need to set up connections to know when a child
|
const auto children = childItems();
|
||||||
becomes visible. So we don't use qskIsVisibleToLayout here.
|
for ( auto child : children )
|
||||||
*/
|
|
||||||
if ( !qskIsTransparentForPositioner( child ) )
|
|
||||||
{
|
{
|
||||||
const auto r = qskConstrainedItemRect( child, rect );
|
/*
|
||||||
qskSetItemGeometry( child, r );
|
We don't want to resize invisible children, but then
|
||||||
|
we would need to set up connections to know when a child
|
||||||
|
becomes visible. So we don't use qskIsVisibleToLayout here.
|
||||||
|
*/
|
||||||
|
if ( !qskIsTransparentForPositioner( child ) )
|
||||||
|
{
|
||||||
|
const auto r = qskConstrainedItemRect( child, rect );
|
||||||
|
qskSetItemGeometry( child, r );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
updateResources();
|
updateLayout();
|
||||||
updateLayout();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskControl::updateItemPaintNode( QSGNode* node )
|
QSGNode* QskControl::updateItemPaintNode( QSGNode* node )
|
||||||
@ -980,17 +983,30 @@ QSizeF QskControl::layoutSizeHint(
|
|||||||
qreal h = -1.0;
|
qreal h = -1.0;
|
||||||
|
|
||||||
const auto children = childItems();
|
const auto children = childItems();
|
||||||
|
|
||||||
for ( const auto child : children )
|
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 );
|
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 );
|
||||||
|
w = QskLayoutHint::combined( which, w, hint.width() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto hint = qskSizeConstraint( child, which, QSizeF() );
|
||||||
|
|
||||||
if ( constraint.width() < 0.0 )
|
w = QskLayoutHint::combined( which, w, hint.width() );
|
||||||
w = QskLayoutHint::combined( which, w, hint.width() );
|
h = QskLayoutHint::combined( which, h, hint.height() );
|
||||||
|
|
||||||
if ( constraint.height() < 0.0 )
|
|
||||||
h = QskLayoutHint::combined( which, h, hint.height() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user