minor changes
This commit is contained in:
parent
748bdebc61
commit
aecd7406f3
|
@ -250,7 +250,7 @@ QRectF QskLayoutBox::alignedLayoutRect( const QRectF& rect ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF QskLayoutBox::contentsSizeHint() const
|
QSizeF QskLayoutBox::contentsSizeHint() const
|
||||||
{
|
{
|
||||||
if ( !isActive() )
|
if ( !isActive() )
|
||||||
return QSizeF( -1, -1 );
|
return QSizeF( -1, -1 );
|
||||||
|
|
||||||
|
@ -269,25 +269,25 @@ qreal QskLayoutBox::heightForWidth( qreal width ) const
|
||||||
{
|
{
|
||||||
auto constrainedHeight =
|
auto constrainedHeight =
|
||||||
[this]( QskLayoutConstraint::Type, const QskControl*, qreal width )
|
[this]( QskLayoutConstraint::Type, const QskControl*, qreal width )
|
||||||
{
|
{
|
||||||
return engine().heightForWidth( width );
|
return engine().heightForWidth( width );
|
||||||
};
|
};
|
||||||
|
|
||||||
return QskLayoutConstraint::constrainedMetric(
|
return QskLayoutConstraint::constrainedMetric(
|
||||||
QskLayoutConstraint::HeightForWidth, this, width, constrainedHeight );
|
QskLayoutConstraint::HeightForWidth, this, width, constrainedHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskLayoutBox::widthForHeight( qreal height ) const
|
qreal QskLayoutBox::widthForHeight( qreal height ) const
|
||||||
{
|
{
|
||||||
auto constrainedWidth =
|
auto constrainedWidth =
|
||||||
[this]( QskLayoutConstraint::Type, const QskControl*, qreal height )
|
[this]( QskLayoutConstraint::Type, const QskControl*, qreal height )
|
||||||
{
|
{
|
||||||
return engine().widthForHeight( height );
|
return engine().widthForHeight( height );
|
||||||
};
|
};
|
||||||
|
|
||||||
return QskLayoutConstraint::constrainedMetric(
|
return QskLayoutConstraint::constrainedMetric(
|
||||||
QskLayoutConstraint::WidthForHeight, this, height, constrainedWidth );
|
QskLayoutConstraint::WidthForHeight, this, height, constrainedWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLayoutBox::geometryChangeEvent( QskGeometryChangeEvent* event )
|
void QskLayoutBox::geometryChangeEvent( QskGeometryChangeEvent* event )
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,12 +117,12 @@ qreal QskLayoutConstraint::constrainedMetric(
|
||||||
{
|
{
|
||||||
const QSizeF outer( widthOrHeight, upperLimit );
|
const QSizeF outer( widthOrHeight, upperLimit );
|
||||||
const QSizeF inner = control->layoutRectForSize( outer ).size();
|
const QSizeF inner = control->layoutRectForSize( outer ).size();
|
||||||
|
|
||||||
qreal height = constrainFunction( type, control, inner.width() );
|
qreal height = constrainFunction( type, control, inner.width() );
|
||||||
|
|
||||||
if ( height >= 0.0 )
|
if ( height >= 0.0 )
|
||||||
height += outer.height() - inner.height();
|
height += outer.height() - inner.height();
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,18 +202,18 @@ QSize QskLayoutEngine::requiredCells() const
|
||||||
|
|
||||||
for ( int i = 0; i < itemCount(); i++ )
|
for ( int i = 0; i < itemCount(); i++ )
|
||||||
{
|
{
|
||||||
const QskLayoutItem* l = layoutItemAt( i );
|
const auto layoutItem = layoutItemAt( i );
|
||||||
if ( l->isIgnored() )
|
if ( layoutItem->isIgnored() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const int col = l->hasUnlimitedSpan( Qt::Horizontal )
|
const int col = layoutItem->hasUnlimitedSpan( Qt::Horizontal )
|
||||||
? l->firstColumn() + 1 : l->lastColumn();
|
? layoutItem->firstColumn() + 1 : layoutItem->lastColumn();
|
||||||
|
|
||||||
if ( col > lastColumn )
|
if ( col > lastColumn )
|
||||||
lastColumn = col;
|
lastColumn = col;
|
||||||
|
|
||||||
const int row = l->hasUnlimitedSpan( Qt::Vertical )
|
const int row = layoutItem->hasUnlimitedSpan( Qt::Vertical )
|
||||||
? l->firstRow() + 1 : l->lastRow();
|
? layoutItem->firstRow() + 1 : layoutItem->lastRow();
|
||||||
|
|
||||||
if ( row > lastRow )
|
if ( row > lastRow )
|
||||||
lastRow = row;
|
lastRow = row;
|
||||||
|
@ -226,13 +226,13 @@ void QskLayoutEngine::adjustSpans( int numRows, int numColumns )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < itemCount(); i++ )
|
for ( int i = 0; i < itemCount(); i++ )
|
||||||
{
|
{
|
||||||
QskLayoutItem* l = layoutItemAt( i );
|
auto layoutItem = layoutItemAt( i );
|
||||||
|
|
||||||
if ( l->hasUnlimitedSpan( Qt::Horizontal ) )
|
if ( layoutItem->hasUnlimitedSpan( Qt::Horizontal ) )
|
||||||
l->setRowSpan( numColumns - l->firstColumn(), Qt::Horizontal );
|
layoutItem->setRowSpan( numColumns - layoutItem->firstColumn(), Qt::Horizontal );
|
||||||
|
|
||||||
if ( l->hasUnlimitedSpan( Qt::Vertical ) )
|
if ( layoutItem->hasUnlimitedSpan( Qt::Vertical ) )
|
||||||
l->setRowSpan( numRows - l->firstRow(), Qt::Vertical );
|
layoutItem->setRowSpan( numRows - layoutItem->firstRow(), Qt::Vertical );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,8 @@ void QskLinearBox::transpose()
|
||||||
{
|
{
|
||||||
QskLayoutItem* layoutItem = engine().layoutItemAt( i );
|
QskLayoutItem* layoutItem = engine().layoutItemAt( i );
|
||||||
|
|
||||||
const int row = layoutItem->firstRow( Qt::Horizontal );
|
const int row = layoutItem->firstColumn();
|
||||||
const int col = layoutItem->firstRow( Qt::Vertical );
|
const int col = layoutItem->firstRow();
|
||||||
|
|
||||||
engine().removeItem( layoutItem );
|
engine().removeItem( layoutItem );
|
||||||
|
|
||||||
|
@ -358,10 +358,9 @@ void QskLinearBox::rearrange()
|
||||||
if ( m_data->orientation == Qt::Vertical )
|
if ( m_data->orientation == Qt::Vertical )
|
||||||
qSwap( col, row );
|
qSwap( col, row );
|
||||||
|
|
||||||
QskLayoutItem* layoutItem = engine().layoutItemAt( i );
|
auto layoutItem = engine().layoutItemAt( i );
|
||||||
|
|
||||||
if ( layoutItem->firstRow( Qt::Horizontal ) != col ||
|
if ( layoutItem->firstColumn() != col || layoutItem->firstRow() != row )
|
||||||
layoutItem->firstRow( Qt::Vertical ) != row )
|
|
||||||
{
|
{
|
||||||
engine().removeItem( layoutItem );
|
engine().removeItem( layoutItem );
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ static qreal qskConstrainedValue( QskLayoutConstraint::Type type,
|
||||||
if ( v > constrainedValue )
|
if ( v > constrainedValue )
|
||||||
constrainedValue = v;
|
constrainedValue = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return constrainedValue;
|
return constrainedValue;
|
||||||
}
|
}
|
||||||
|
@ -139,12 +139,12 @@ void QskStackBox::layoutItemRemoved( QskLayoutItem*, int index )
|
||||||
Using QGridLayoutEngine for a stack layout is actually
|
Using QGridLayoutEngine for a stack layout is actually
|
||||||
not a good ideas. Until we have a new implementation,
|
not a good ideas. Until we have a new implementation,
|
||||||
we need to work around situations, where the layout does
|
we need to work around situations, where the layout does
|
||||||
not work properly with having several items in the
|
not work properly with having several items in the
|
||||||
same cell.
|
same cell.
|
||||||
In this particular situation we need to fix, that we lost
|
In this particular situation we need to fix, that we lost
|
||||||
the item from engine.q_grid[0].
|
the item from engine.q_grid[0].
|
||||||
Calling transpose has this side effect.
|
Calling transpose has this side effect.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
engine.transpose();
|
engine.transpose();
|
||||||
engine.transpose(); // reverting the call before
|
engine.transpose(); // reverting the call before
|
||||||
|
|
Loading…
Reference in New Issue