minor changes

This commit is contained in:
Uwe Rathmann 2019-05-06 16:36:52 +02:00
parent 748bdebc61
commit aecd7406f3
5 changed files with 31 additions and 32 deletions

View File

@ -269,9 +269,9 @@ qreal QskLayoutBox::heightForWidth( qreal width ) const
{
auto constrainedHeight =
[this]( QskLayoutConstraint::Type, const QskControl*, qreal width )
{
return engine().heightForWidth( width );
};
{
return engine().heightForWidth( width );
};
return QskLayoutConstraint::constrainedMetric(
QskLayoutConstraint::HeightForWidth, this, width, constrainedHeight );
@ -281,9 +281,9 @@ qreal QskLayoutBox::widthForHeight( qreal height ) const
{
auto constrainedWidth =
[this]( QskLayoutConstraint::Type, const QskControl*, qreal height )
{
return engine().widthForHeight( height );
};
{
return engine().widthForHeight( height );
};
return QskLayoutConstraint::constrainedMetric(
QskLayoutConstraint::WidthForHeight, this, height, constrainedWidth );

View File

@ -202,18 +202,18 @@ QSize QskLayoutEngine::requiredCells() const
for ( int i = 0; i < itemCount(); i++ )
{
const QskLayoutItem* l = layoutItemAt( i );
if ( l->isIgnored() )
const auto layoutItem = layoutItemAt( i );
if ( layoutItem->isIgnored() )
continue;
const int col = l->hasUnlimitedSpan( Qt::Horizontal )
? l->firstColumn() + 1 : l->lastColumn();
const int col = layoutItem->hasUnlimitedSpan( Qt::Horizontal )
? layoutItem->firstColumn() + 1 : layoutItem->lastColumn();
if ( col > lastColumn )
lastColumn = col;
const int row = l->hasUnlimitedSpan( Qt::Vertical )
? l->firstRow() + 1 : l->lastRow();
const int row = layoutItem->hasUnlimitedSpan( Qt::Vertical )
? layoutItem->firstRow() + 1 : layoutItem->lastRow();
if ( row > lastRow )
lastRow = row;
@ -226,13 +226,13 @@ void QskLayoutEngine::adjustSpans( int numRows, int numColumns )
{
for ( int i = 0; i < itemCount(); i++ )
{
QskLayoutItem* l = layoutItemAt( i );
auto layoutItem = layoutItemAt( i );
if ( l->hasUnlimitedSpan( Qt::Horizontal ) )
l->setRowSpan( numColumns - l->firstColumn(), Qt::Horizontal );
if ( layoutItem->hasUnlimitedSpan( Qt::Horizontal ) )
layoutItem->setRowSpan( numColumns - layoutItem->firstColumn(), Qt::Horizontal );
if ( l->hasUnlimitedSpan( Qt::Vertical ) )
l->setRowSpan( numRows - l->firstRow(), Qt::Vertical );
if ( layoutItem->hasUnlimitedSpan( Qt::Vertical ) )
layoutItem->setRowSpan( numRows - layoutItem->firstRow(), Qt::Vertical );
}
}

View File

@ -90,8 +90,8 @@ void QskLinearBox::transpose()
{
QskLayoutItem* layoutItem = engine().layoutItemAt( i );
const int row = layoutItem->firstRow( Qt::Horizontal );
const int col = layoutItem->firstRow( Qt::Vertical );
const int row = layoutItem->firstColumn();
const int col = layoutItem->firstRow();
engine().removeItem( layoutItem );
@ -358,10 +358,9 @@ void QskLinearBox::rearrange()
if ( m_data->orientation == Qt::Vertical )
qSwap( col, row );
QskLayoutItem* layoutItem = engine().layoutItemAt( i );
auto layoutItem = engine().layoutItemAt( i );
if ( layoutItem->firstRow( Qt::Horizontal ) != col ||
layoutItem->firstRow( Qt::Vertical ) != row )
if ( layoutItem->firstColumn() != col || layoutItem->firstRow() != row )
{
engine().removeItem( layoutItem );