including the margins to heightForWidth/widthForHeight calculations
This commit is contained in:
parent
a3fea8413c
commit
116dd01b94
@ -438,14 +438,26 @@ QSizeF QskGridBox::contentsSizeHint() const
|
|||||||
|
|
||||||
qreal QskGridBox::heightForWidth( qreal width ) const
|
qreal QskGridBox::heightForWidth( qreal width ) const
|
||||||
{
|
{
|
||||||
|
const auto m = margins();
|
||||||
|
width -= m.left() + m.right();
|
||||||
|
|
||||||
const QSizeF constraint( width, -1 );
|
const QSizeF constraint( width, -1 );
|
||||||
return engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
qreal height = engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
||||||
|
|
||||||
|
height += m.top() + m.bottom();
|
||||||
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskGridBox::widthForHeight( qreal height ) const
|
qreal QskGridBox::widthForHeight( qreal height ) const
|
||||||
{
|
{
|
||||||
|
const auto m = margins();
|
||||||
|
height -= m.top() + m.bottom();
|
||||||
|
|
||||||
const QSizeF constraint( -1, height );
|
const QSizeF constraint( -1, height );
|
||||||
return engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
qreal width = engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
||||||
|
|
||||||
|
width += m.left() + m.right();
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskGridBox::setRowSizeHint(
|
void QskGridBox::setRowSizeHint(
|
||||||
|
@ -333,14 +333,26 @@ QSizeF QskLinearBox::contentsSizeHint() const
|
|||||||
|
|
||||||
qreal QskLinearBox::heightForWidth( qreal width ) const
|
qreal QskLinearBox::heightForWidth( qreal width ) const
|
||||||
{
|
{
|
||||||
|
const auto m = margins();
|
||||||
|
width -= m.left() + m.right();
|
||||||
|
|
||||||
const QSizeF constraint( width, -1 );
|
const QSizeF constraint( width, -1 );
|
||||||
return engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
qreal height = engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
||||||
|
|
||||||
|
height += m.top() + m.bottom();
|
||||||
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskLinearBox::widthForHeight( qreal height ) const
|
qreal QskLinearBox::widthForHeight( qreal height ) const
|
||||||
{
|
{
|
||||||
|
const auto m = margins();
|
||||||
|
height -= m.top() + m.bottom();
|
||||||
|
|
||||||
const QSizeF constraint( -1, height );
|
const QSizeF constraint( -1, height );
|
||||||
return engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
qreal width = engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
||||||
|
|
||||||
|
width += m.left() + m.right();
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearBox::setupLayoutItem( QskLayoutItem* layoutItem, int index )
|
void QskLinearBox::setupLayoutItem( QskLayoutItem* layoutItem, int index )
|
||||||
|
@ -240,6 +240,9 @@ QSizeF QskStackBox::contentsSizeHint() const
|
|||||||
|
|
||||||
qreal QskStackBox::heightForWidth( qreal width ) const
|
qreal QskStackBox::heightForWidth( qreal width ) const
|
||||||
{
|
{
|
||||||
|
const auto m = margins();
|
||||||
|
width -= m.left() + m.right();
|
||||||
|
|
||||||
qreal height = -1;
|
qreal height = -1;
|
||||||
|
|
||||||
const QskLayoutEngine& engine = this->engine();
|
const QskLayoutEngine& engine = this->engine();
|
||||||
@ -250,11 +253,15 @@ qreal QskStackBox::heightForWidth( qreal width ) const
|
|||||||
height = qMax( height, QskLayoutConstraint::heightForWidth( item, width ) );
|
height = qMax( height, QskLayoutConstraint::heightForWidth( item, width ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
height += m.top() + m.bottom();
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskStackBox::widthForHeight( qreal height ) const
|
qreal QskStackBox::widthForHeight( qreal height ) const
|
||||||
{
|
{
|
||||||
|
const auto m = margins();
|
||||||
|
height -= m.top() + m.bottom();
|
||||||
|
|
||||||
qreal width = -1;
|
qreal width = -1;
|
||||||
|
|
||||||
const QskLayoutEngine& engine = this->engine();
|
const QskLayoutEngine& engine = this->engine();
|
||||||
@ -265,6 +272,7 @@ qreal QskStackBox::widthForHeight( qreal height ) const
|
|||||||
width = qMax( width, QskLayoutConstraint::widthForHeight( item, height ) );
|
width = qMax( width, QskLayoutConstraint::widthForHeight( item, height ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width += m.left() + m.right();
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user