mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-13 18:14:13 +02:00
Report "no constraint" (still needs the translations; to be added in the next translation round I guess) from minimumWidth() for a title template instead of an arbitrary value.
Following up on the earlier division-by-zero fix: return -1 from the bad denominator branch of minimumWidth(), matching the "no constraint" convention maximumWidth() already uses, instead of std::numeric_limits<int>::max() or 0. Update TitleBlockTemplateView::updateDisplayedMinMaxWidth() to skip the "Longueur minimale" line when minimumWidth() reports -1, mirroring its existing handling of maximumWidth() == -1.
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <limits>
|
||||
/**
|
||||
@brief TitleBlockTemplate::TitleBlockTemplate
|
||||
Constructor
|
||||
@@ -980,11 +979,10 @@ int TitleBlockTemplate::minimumWidth()
|
||||
if (denominator <= 0.0) {
|
||||
// The relative-to-total-length columns alone already consume
|
||||
// 100% (or more) of the available width, so the formula above
|
||||
// would divide by zero (or go negative). If there are no
|
||||
// absolute-width columns, there is no meaningful minimum width
|
||||
// to enforce; if there are, the template is asking for more
|
||||
// than 100% of its own width, which cannot be satisfied.
|
||||
return abs_total > 0 ? std::numeric_limits<int>::max() : 0;
|
||||
// would divide by zero (or go negative). There is no finite
|
||||
// minimum width this formula can determine. Report "no
|
||||
// constraint", the same convention maximumWidth() uses.
|
||||
return -1;
|
||||
}
|
||||
|
||||
return(qRound(abs_total / denominator));
|
||||
|
||||
Reference in New Issue
Block a user