distributing extra space at the borders fixed
This commit is contained in:
parent
c1861f45b0
commit
958e087943
|
@ -441,8 +441,7 @@ qreal QskGridBox::heightForWidth( qreal width ) const
|
||||||
const auto m = margins();
|
const auto m = margins();
|
||||||
width -= m.left() + m.right();
|
width -= m.left() + m.right();
|
||||||
|
|
||||||
const QSizeF constraint( width, -1 );
|
qreal height = engine().heightForWidth( width );
|
||||||
qreal height = engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
|
||||||
|
|
||||||
height += m.top() + m.bottom();
|
height += m.top() + m.bottom();
|
||||||
return height;
|
return height;
|
||||||
|
@ -453,8 +452,7 @@ qreal QskGridBox::widthForHeight( qreal height ) const
|
||||||
const auto m = margins();
|
const auto m = margins();
|
||||||
height -= m.top() + m.bottom();
|
height -= m.top() + m.bottom();
|
||||||
|
|
||||||
const QSizeF constraint( -1, height );
|
qreal width = engine().widthForHeight( height );
|
||||||
qreal width = engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
|
||||||
|
|
||||||
width += m.left() + m.right();
|
width += m.left() + m.right();
|
||||||
return width;
|
return width;
|
||||||
|
|
|
@ -165,6 +165,18 @@ QSizeF QskLayoutEngine::sizeHint( Qt::SizeHint which, const QSizeF& constraint )
|
||||||
return QGridLayoutEngine::sizeHint( which, constraint, &styleInfo );
|
return QGridLayoutEngine::sizeHint( which, constraint, &styleInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal QskLayoutEngine::widthForHeight( qreal height ) const
|
||||||
|
{
|
||||||
|
const QSizeF constraint( -1, height );
|
||||||
|
return sizeHint( Qt::PreferredSize, constraint ).width();
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal QskLayoutEngine::heightForWidth( qreal width ) const
|
||||||
|
{
|
||||||
|
const QSizeF constraint( width, -1 );
|
||||||
|
return sizeHint( Qt::PreferredSize, constraint ).height();
|
||||||
|
}
|
||||||
|
|
||||||
qreal QskLayoutEngine::spacing( Qt::Orientation orientation ) const
|
qreal QskLayoutEngine::spacing( Qt::Orientation orientation ) const
|
||||||
{
|
{
|
||||||
const LayoutStyleInfo styleInfo;
|
const LayoutStyleInfo styleInfo;
|
||||||
|
|
|
@ -41,6 +41,9 @@ class QskLayoutEngine : public QGridLayoutEngine
|
||||||
|
|
||||||
QSizeF sizeHint( Qt::SizeHint, const QSizeF& constraint = QSizeF() ) const;
|
QSizeF sizeHint( Qt::SizeHint, const QSizeF& constraint = QSizeF() ) const;
|
||||||
|
|
||||||
|
qreal widthForHeight( qreal height ) const;
|
||||||
|
qreal heightForWidth( qreal width ) const;
|
||||||
|
|
||||||
qreal spacing( Qt::Orientation ) const;
|
qreal spacing( Qt::Orientation ) const;
|
||||||
static qreal defaultSpacing( Qt::Orientation );
|
static qreal defaultSpacing( Qt::Orientation );
|
||||||
|
|
||||||
|
|
|
@ -336,8 +336,7 @@ qreal QskLinearBox::heightForWidth( qreal width ) const
|
||||||
const auto m = margins();
|
const auto m = margins();
|
||||||
width -= m.left() + m.right();
|
width -= m.left() + m.right();
|
||||||
|
|
||||||
const QSizeF constraint( width, -1 );
|
qreal height = engine().heightForWidth( width );
|
||||||
qreal height = engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
|
||||||
|
|
||||||
height += m.top() + m.bottom();
|
height += m.top() + m.bottom();
|
||||||
return height;
|
return height;
|
||||||
|
@ -348,8 +347,7 @@ qreal QskLinearBox::widthForHeight( qreal height ) const
|
||||||
const auto m = margins();
|
const auto m = margins();
|
||||||
height -= m.top() + m.bottom();
|
height -= m.top() + m.bottom();
|
||||||
|
|
||||||
const QSizeF constraint( -1, height );
|
qreal width = engine().widthForHeight( height );
|
||||||
qreal width = engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
|
||||||
|
|
||||||
width += m.left() + m.right();
|
width += m.left() + m.right();
|
||||||
return width;
|
return width;
|
||||||
|
@ -444,7 +442,7 @@ QRectF QskLinearBox::alignedLayoutRect( const QRectF& rect ) const
|
||||||
|
|
||||||
if ( !isExpandable )
|
if ( !isExpandable )
|
||||||
{
|
{
|
||||||
const qreal w = widthForHeight( r.height() );
|
const qreal w = engine.widthForHeight( r.height() );
|
||||||
|
|
||||||
if ( m_data->extraSpacingAt & Qt::LeftEdge )
|
if ( m_data->extraSpacingAt & Qt::LeftEdge )
|
||||||
{
|
{
|
||||||
|
@ -484,7 +482,7 @@ QRectF QskLinearBox::alignedLayoutRect( const QRectF& rect ) const
|
||||||
|
|
||||||
if ( !isExpandable )
|
if ( !isExpandable )
|
||||||
{
|
{
|
||||||
const qreal h = heightForWidth( r.width() );
|
const qreal h = engine.heightForWidth( r.width() );
|
||||||
|
|
||||||
if ( m_data->extraSpacingAt & Qt::TopEdge )
|
if ( m_data->extraSpacingAt & Qt::TopEdge )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue