division by zero fixed

This commit is contained in:
Uwe Rathmann 2023-04-21 08:58:37 +02:00
parent 9f74523b88
commit f0f2df43c0
1 changed files with 29 additions and 21 deletions

View File

@ -381,6 +381,9 @@ QskLayoutChain::Segments QskLayoutChain::preferredStretched( qreal size ) const
{
const int count = m_cells.size();
if ( count == 0 )
return Segments();
qreal sumFactors = 0.0;
QVarLengthArray< qreal > factors( count );
@ -413,7 +416,11 @@ QskLayoutChain::Segments QskLayoutChain::preferredStretched( qreal size ) const
sumFactors += factors[i];
}
auto sumSizes = size - ( m_validCells - 1 ) * m_spacing;
qreal sumSizes = 0.0;
if ( sumFactors > 0.0 )
{
sumSizes = size - ( m_validCells - 1 ) * m_spacing;
Q_FOREVER
{
@ -444,6 +451,7 @@ QskLayoutChain::Segments QskLayoutChain::preferredStretched( qreal size ) const
if ( done )
break;
}
}
qreal offset = 0;
qreal fillSpacing = 0.0;