Editor plugin: Bugfixing

This commit is contained in:
Jakub Melka 2024-06-22 17:59:45 +02:00
parent ba0dd9e891
commit 72962f2513
1 changed files with 16 additions and 1 deletions

View File

@ -170,6 +170,11 @@ void PDFPageContentEditorEditedItemSettings::loadFromElement(PDFPageContentEleme
QPen pen = pdf::PDFPainterHelper::createPenFromState(&graphicState, graphicState.getAlphaStroking());
QBrush brush = pdf::PDFPainterHelper::createBrushFromState(&graphicState, graphicState.getAlphaFilling());
if (element->asText())
{
pen.setColor(brush.color());
}
setPen(pen, true);
setBrush(brush, true);
}
@ -247,7 +252,7 @@ void PDFPageContentEditorEditedItemSettings::saveToElement(PDFPageContentElement
QTransform transform = PDFPainterHelper::composeTransform(decomposedTransformation);
editedElement->getElement()->setTransform(transform);
if (editedElement->getElement()->asText() || editedElement->getElement()->asPath())
if (editedElement->getElement()->asPath())
{
PDFPageContentProcessorState graphicState = editedElement->getElement()->getState();
@ -256,6 +261,16 @@ void PDFPageContentEditorEditedItemSettings::saveToElement(PDFPageContentElement
editedElement->getElement()->setState(graphicState);
}
if (editedElement->getElement()->asText())
{
PDFPageContentProcessorState graphicState = editedElement->getElement()->getState();
QBrush brush(m_pen.color(), Qt::SolidPattern);
PDFPainterHelper::applyBrushToGraphicState(&graphicState, brush);
editedElement->getElement()->setState(graphicState);
}
}
static int PDF_gcd(int a, int b)