TechDraw: Fix MultiValueSchema formatting

Multi Value schemas cannot be forced to use Format::FORMATTED.
This commit is contained in:
Ladislav Michl
2025-12-01 17:07:23 +01:00
parent 867309b0d4
commit 57977bbdaf
2 changed files with 4 additions and 11 deletions

View File

@@ -77,7 +77,7 @@ std::string DimensionFormatter::formatValue(const qreal value,
// won't give more than Global_Decimals precision
std::string basicString = formatPrefix + asQuantity.getUserString() + formatSuffix;
if (isMultiValueSchema() && partial == Format::UNALTERED) {
if (isMultiValueSchema() || partial == Format::UNALTERED) {
return basicString; // Don't even try to use Alt Decimals or hide units
}

View File

@@ -273,22 +273,15 @@ void QGIViewDimension::updateDim()
return;
}
QString labelText =
// what about fromStdString?
QString::fromUtf8(dim->getFormattedDimensionValue(Format::FORMATTED).c_str());// pre value [unit] post
if (dim->isMultiValueSchema()) {
labelText =
QString::fromUtf8(dim->getFormattedDimensionValue(Format::UNALTERED).c_str());//don't format multis
}
QFont font = datumLabel->getFont();
auto labelText = dim->getFormattedDimensionValue(Format::FORMATTED);
auto font = datumLabel->getFont();
font.setFamily(QString::fromUtf8(vp->Font.getValue()));
int fontSize = QGIView::exactFontSize(vp->Font.getValue(), std::max(1.0, vp->Fontsize.getValue()));
font.setPixelSize(fontSize);
datumLabel->setFont(font);
prepareGeometryChange();
datumLabel->setDimString(labelText);
datumLabel->setDimString(QString::fromStdString(labelText));
datumLabel->setToleranceString();
datumLabel->setFramed(dim->TheoreticalExact.getValue());