XFA: Minor bugfixing

This commit is contained in:
Jakub Melka 2022-01-27 20:06:12 +01:00
parent 4035b26615
commit 04ad80ee81
1 changed files with 25 additions and 10 deletions

View File

@ -11851,7 +11851,7 @@ void PDFXFAEngineImpl::drawItemValue(const xfa::XFA_value* value,
{ {
QString textValue = integer->getNodeValue() ? *integer->getNodeValue() : QString(); QString textValue = integer->getNodeValue() ? *integer->getNodeValue() : QString();
nodeValue.emplace(); nodeValue.emplace();
nodeValue->value = textValue.toInt(); nodeValue->value = textValue.isEmpty() ? QVariant() : textValue.toInt();
} }
else if (const xfa::XFA_boolean* boolean = value->getBoolean()) else if (const xfa::XFA_boolean* boolean = value->getBoolean())
{ {
@ -11865,7 +11865,7 @@ void PDFXFAEngineImpl::drawItemValue(const xfa::XFA_value* value,
nodeValue.emplace(); nodeValue.emplace();
nodeValue->hintFloatFracDigits = decimal->getFracDigits(); nodeValue->hintFloatFracDigits = decimal->getFracDigits();
nodeValue->hintFloatLeadDigits = decimal->getLeadDigits(); nodeValue->hintFloatLeadDigits = decimal->getLeadDigits();
nodeValue->value = textValue.toDouble(); nodeValue->value = textValue.isEmpty() ? QVariant() : textValue.toDouble();
} }
else if (const xfa::XFA_float* floatItem = value->getFloat()) else if (const xfa::XFA_float* floatItem = value->getFloat())
{ {
@ -11873,7 +11873,7 @@ void PDFXFAEngineImpl::drawItemValue(const xfa::XFA_value* value,
nodeValue.emplace(); nodeValue.emplace();
nodeValue->hintFloatFracDigits = -1; nodeValue->hintFloatFracDigits = -1;
nodeValue->hintFloatLeadDigits = -1; nodeValue->hintFloatLeadDigits = -1;
nodeValue->value = textValue.toDouble(); nodeValue->value = textValue.isEmpty() ? QVariant() : textValue.toDouble();
} }
else if (const xfa::XFA_dateTime* dateTime = value->getDateTime()) else if (const xfa::XFA_dateTime* dateTime = value->getDateTime())
{ {
@ -12429,6 +12429,11 @@ void PDFXFAEngineImpl::drawUiNumericEdit(const xfa::XFA_numericEdit* numericEdit
drawItemBorder(numericEdit->getBorder(), errors, nominalExtentArea, painter); drawItemBorder(numericEdit->getBorder(), errors, nominalExtentArea, painter);
} }
if (!value.value.isValid())
{
return;
}
QString text; QString text;
if (value.hintFloatFracDigits != -1) if (value.hintFloatFracDigits != -1)
@ -12561,6 +12566,15 @@ void PDFXFAEngineImpl::drawUiCheckButton(const xfa::XFA_checkButton* checkButton
painter->setPen(pen); painter->setPen(pen);
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
bool showBorder = true;
if (const xfa::XFA_border* border = checkButton->getBorder())
{
const xfa::XFA_BaseNode::PRESENCE presence = border->getPresence();
showBorder = presence == xfa::XFA_BaseNode::PRESENCE::Visible;
}
if (showBorder)
{
switch (shape) switch (shape)
{ {
case pdf::xfa::XFA_BaseNode::SHAPE::Square: case pdf::xfa::XFA_BaseNode::SHAPE::Square:
@ -12570,6 +12584,7 @@ void PDFXFAEngineImpl::drawUiCheckButton(const xfa::XFA_checkButton* checkButton
painter->drawEllipse(checkBoxRect); painter->drawEllipse(checkBoxRect);
break; break;
} }
}
if (value.value.toBool()) if (value.value.toBool())
{ {