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();
|
||||
width -= m.left() + m.right();
|
||||
|
||||
const QSizeF constraint( width, -1 );
|
||||
qreal height = engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
||||
qreal height = engine().heightForWidth( width );
|
||||
|
||||
height += m.top() + m.bottom();
|
||||
return height;
|
||||
|
@ -453,8 +452,7 @@ qreal QskGridBox::widthForHeight( qreal height ) const
|
|||
const auto m = margins();
|
||||
height -= m.top() + m.bottom();
|
||||
|
||||
const QSizeF constraint( -1, height );
|
||||
qreal width = engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
||||
qreal width = engine().widthForHeight( height );
|
||||
|
||||
width += m.left() + m.right();
|
||||
return width;
|
||||
|
|
|
@ -165,6 +165,18 @@ QSizeF QskLayoutEngine::sizeHint( Qt::SizeHint which, const QSizeF& constraint )
|
|||
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
|
||||
{
|
||||
const LayoutStyleInfo styleInfo;
|
||||
|
|
|
@ -41,6 +41,9 @@ class QskLayoutEngine : public QGridLayoutEngine
|
|||
|
||||
QSizeF sizeHint( Qt::SizeHint, const QSizeF& constraint = QSizeF() ) const;
|
||||
|
||||
qreal widthForHeight( qreal height ) const;
|
||||
qreal heightForWidth( qreal width ) const;
|
||||
|
||||
qreal spacing( Qt::Orientation ) const;
|
||||
static qreal defaultSpacing( Qt::Orientation );
|
||||
|
||||
|
|
|
@ -336,8 +336,7 @@ qreal QskLinearBox::heightForWidth( qreal width ) const
|
|||
const auto m = margins();
|
||||
width -= m.left() + m.right();
|
||||
|
||||
const QSizeF constraint( width, -1 );
|
||||
qreal height = engine().sizeHint( Qt::PreferredSize, constraint ).height();
|
||||
qreal height = engine().heightForWidth( width );
|
||||
|
||||
height += m.top() + m.bottom();
|
||||
return height;
|
||||
|
@ -348,8 +347,7 @@ qreal QskLinearBox::widthForHeight( qreal height ) const
|
|||
const auto m = margins();
|
||||
height -= m.top() + m.bottom();
|
||||
|
||||
const QSizeF constraint( -1, height );
|
||||
qreal width = engine().sizeHint( Qt::PreferredSize, constraint ).width();
|
||||
qreal width = engine().widthForHeight( height );
|
||||
|
||||
width += m.left() + m.right();
|
||||
return width;
|
||||
|
@ -444,7 +442,7 @@ QRectF QskLinearBox::alignedLayoutRect( const QRectF& rect ) const
|
|||
|
||||
if ( !isExpandable )
|
||||
{
|
||||
const qreal w = widthForHeight( r.height() );
|
||||
const qreal w = engine.widthForHeight( r.height() );
|
||||
|
||||
if ( m_data->extraSpacingAt & Qt::LeftEdge )
|
||||
{
|
||||
|
@ -484,7 +482,7 @@ QRectF QskLinearBox::alignedLayoutRect( const QRectF& rect ) const
|
|||
|
||||
if ( !isExpandable )
|
||||
{
|
||||
const qreal h = heightForWidth( r.width() );
|
||||
const qreal h = engine.heightForWidth( r.width() );
|
||||
|
||||
if ( m_data->extraSpacingAt & Qt::TopEdge )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue