mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Editor plugin: Bugfixing
This commit is contained in:
@@ -48,14 +48,12 @@ PDFPageContentEditorEditedItemSettings::PDFPageContentEditorEditedItemSettings(Q
|
||||
ui->brushColorCombo->addItem(icon, colorName, color);
|
||||
}
|
||||
|
||||
ui->penStyleCombo->addItem(tr("None"), int(Qt::NoPen));
|
||||
ui->penStyleCombo->addItem(tr("Solid"), int(Qt::SolidLine));
|
||||
ui->penStyleCombo->addItem(tr("Dashed"), int(Qt::DashLine));
|
||||
ui->penStyleCombo->addItem(tr("Dotted"), int(Qt::DotLine));
|
||||
ui->penStyleCombo->addItem(tr("Dash-dot"), int(Qt::DashDotLine));
|
||||
ui->penStyleCombo->addItem(tr("Dash-dot-dot"), int(Qt::DashDotDotLine));
|
||||
|
||||
ui->brushStyleCombo->addItem(tr("None"), int(Qt::NoBrush));
|
||||
ui->penStyleCombo->addItem(tr("Custom"), int(Qt::CustomDashLine));
|
||||
ui->brushStyleCombo->addItem(tr("Solid"), int(Qt::SolidPattern));
|
||||
|
||||
connect(ui->selectPenColorButton, &QToolButton::clicked, this, &PDFPageContentEditorEditedItemSettings::onSelectPenColorButtonClicked);
|
||||
@@ -137,6 +135,7 @@ void PDFPageContentEditorEditedItemSettings::loadFromElement(PDFPageContentEleme
|
||||
features.setFlag(Pen);
|
||||
features.setFlag(PenColor);
|
||||
features.setFlag(Brush);
|
||||
features.setFlag(StrokeFill);
|
||||
}
|
||||
|
||||
if (element->asText())
|
||||
@@ -147,6 +146,7 @@ void PDFPageContentEditorEditedItemSettings::loadFromElement(PDFPageContentEleme
|
||||
const bool hasPen = features.testFlag(Pen);
|
||||
const bool hasPenColor = features.testFlag(PenColor);
|
||||
const bool hasBrush = features.testFlag(Brush);
|
||||
const bool hasStrokeFill = features.testFlag(StrokeFill);
|
||||
|
||||
ui->penWidthEdit->setEnabled(hasPen);
|
||||
ui->penWidthLabel->setEnabled(hasPen);
|
||||
@@ -165,6 +165,15 @@ void PDFPageContentEditorEditedItemSettings::loadFromElement(PDFPageContentEleme
|
||||
ui->brushColorLabel->setEnabled(hasBrush);
|
||||
ui->selectBrushColorButton->setEnabled(hasBrush);
|
||||
|
||||
ui->strokePathCheckBox->setEnabled(hasStrokeFill);
|
||||
ui->fillPathCheckBox->setEnabled(hasStrokeFill);
|
||||
|
||||
if (const PDFEditedPageContentElementPath* pathElement = element->asPath())
|
||||
{
|
||||
ui->strokePathCheckBox->setChecked(pathElement->getStrokePath());
|
||||
ui->fillPathCheckBox->setChecked(pathElement->getFillPath());
|
||||
}
|
||||
|
||||
const PDFPageContentProcessorState& graphicState = element->getState();
|
||||
|
||||
QPen pen = pdf::PDFPainterHelper::createPenFromState(&graphicState, graphicState.getAlphaStroking());
|
||||
@@ -241,6 +250,12 @@ void PDFPageContentEditorEditedItemSettings::saveToElement(PDFPageContentElement
|
||||
textElement->setItemsAsText(ui->plainTextEdit->toPlainText());
|
||||
}
|
||||
|
||||
if (PDFEditedPageContentElementPath* pathElement = editedElement->getElement()->asPath())
|
||||
{
|
||||
pathElement->setStrokePath(ui->strokePathCheckBox->isChecked());
|
||||
pathElement->setFillPath(ui->fillPathCheckBox->isChecked());
|
||||
}
|
||||
|
||||
PDFTransformationDecomposition decomposedTransformation;
|
||||
decomposedTransformation.rotationAngle = ui->rotationAngleEdit->value();
|
||||
decomposedTransformation.shearFactor = ui->shearFactorEdit->value();
|
||||
|
@@ -69,7 +69,8 @@ private:
|
||||
None = 0,
|
||||
Pen = 1 << 0,
|
||||
PenColor = 1 << 1,
|
||||
Brush = 1 << 2
|
||||
Brush = 1 << 2,
|
||||
StrokeFill = 1 << 3,
|
||||
};
|
||||
Q_DECLARE_FLAGS(StyleFeatures, StyleFeature)
|
||||
|
||||
|
@@ -139,13 +139,16 @@
|
||||
<string>Style</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="penColorCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="selectBrushColorButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="brushStyleCombo"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="penStyleLabel">
|
||||
<property name="text">
|
||||
@@ -153,20 +156,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="penWidthEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="brushColorLabel">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="penColorLabel">
|
||||
<property name="text">
|
||||
<string>Brush Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="selectBrushColorButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string>Pen Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -180,13 +173,6 @@
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="penStyleCombo"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="penWidthLabel">
|
||||
<property name="text">
|
||||
<string>Pen Width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="brushStyleLabel">
|
||||
<property name="text">
|
||||
@@ -194,24 +180,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="penColorLabel">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="penWidthLabel">
|
||||
<property name="text">
|
||||
<string>Pen Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="brushStyleCombo"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="brushColorCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
<string>Pen Width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="strokePathCheckBox">
|
||||
<property name="text">
|
||||
<string>Stroke path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -224,6 +207,37 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="penWidthEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="brushColorLabel">
|
||||
<property name="text">
|
||||
<string>Brush Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="penColorCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="brushColorCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="fillPathCheckBox">
|
||||
<property name="text">
|
||||
<string>Fill path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="transformationTab">
|
||||
|
Reference in New Issue
Block a user