Experimental: try to enforce a minimum partition size.

This breaks any hope of inline-resizing small partitions.
This commit is contained in:
Teo Mrnjavac 2016-01-08 17:55:04 +01:00
parent b3f86925a8
commit 08f9753aa2

View File

@ -474,6 +474,19 @@ PartitionBarsView::computeItemsVector( const QModelIndex& parent ) const
items[ row ] = { size, index };
}
return qMakePair( items, total );
// The sizes we have are perfect, but now we have to hardcode a minimum size for small
// partitions and compensate for it in the total.
qreal adjustedTotal = total;
for ( int row = 0; row < count; ++row )
{
if ( items[ row ].size < 0.01 * total ) // if this item is smaller than 5% of everything
{
adjustedTotal -= items[ row ].size;
items[ row ].size = qRound( 0.01 * total );
adjustedTotal += items[ row ].size;
}
}
return qMakePair( items, adjustedTotal );
}