Experimental: try to enforce a minimum partition size.
This breaks any hope of inline-resizing small partitions.
This commit is contained in:
parent
b3f86925a8
commit
08f9753aa2
@ -474,6 +474,19 @@ PartitionBarsView::computeItemsVector( const QModelIndex& parent ) const
|
|||||||
items[ row ] = { size, index };
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user