Do not risk a division by zero.
This commit is contained in:
parent
409bde6d1f
commit
cd0f5d8778
|
@ -110,6 +110,9 @@ void PartWidgetBase::positionChildren(const QWidget* destWidget, const Partition
|
||||||
foreach(const Partition * p, partitions)
|
foreach(const Partition * p, partitions)
|
||||||
totalLength += p->length();
|
totalLength += p->length();
|
||||||
|
|
||||||
|
if (totalLength < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
// calculate unleveled width for each child and store it
|
// calculate unleveled width for each child and store it
|
||||||
for (int i = 0; i < partitions.size(); i++) {
|
for (int i = 0; i < partitions.size(); i++) {
|
||||||
childrenWidth.append(partitions[i]->length() * destWidgetWidth / totalLength);
|
childrenWidth.append(partitions[i]->length() * destWidgetWidth / totalLength);
|
||||||
|
|
Loading…
Reference in New Issue