diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp
index 8412ccc34..9b5e739a7 100644
--- a/src/app/valentina/dialogs/dialogpatternproperties.cpp
+++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp
@@ -65,6 +65,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
connect(ui->plainTextEditTechNotes, &QPlainTextEdit::textChanged, this, &DialogPatternProperties::DescEdited);
InitImage();
+ connect(ui->deleteImageButton, &QPushButton::clicked, this, &DialogPatternProperties::DeleteImage);
connect(ui->buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &DialogPatternProperties::Ok);
connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this,
@@ -649,5 +650,11 @@ void DialogPatternProperties::SetNewImage()
// save our image to file.val
doc->SetImage(iconBase64);
}
-
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogPatternProperties::DeleteImage()
+{
+ doc->DeleteImage();
+ ui->imageLabel->setText("Change image");
}
diff --git a/src/app/valentina/dialogs/dialogpatternproperties.h b/src/app/valentina/dialogs/dialogpatternproperties.h
index 3453f570f..4e504b840 100644
--- a/src/app/valentina/dialogs/dialogpatternproperties.h
+++ b/src/app/valentina/dialogs/dialogpatternproperties.h
@@ -64,6 +64,7 @@ private slots:
void ToggleComboBox();
void DefValueChanged();
void SecurityValueChanged();
+ void DeleteImage();
private:
Q_DISABLE_COPY(DialogPatternProperties)
Ui::DialogPatternProperties *ui;
diff --git a/src/app/valentina/dialogs/dialogpatternproperties.ui b/src/app/valentina/dialogs/dialogpatternproperties.ui
index ac9be310b..e814be49a 100644
--- a/src/app/valentina/dialogs/dialogpatternproperties.ui
+++ b/src/app/valentina/dialogs/dialogpatternproperties.ui
@@ -106,6 +106,13 @@
+ -
+
+
+ delete image
+
+
+
diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp
index 6302d7989..d36482adf 100644
--- a/src/app/valentina/xml/vpattern.cpp
+++ b/src/app/valentina/xml/vpattern.cpp
@@ -86,7 +86,6 @@ void VPattern::CreateEmptyFile()
patternElement.appendChild(createElement(TagAuthor));
patternElement.appendChild(createElement(TagDescription));
patternElement.appendChild(createElement(TagNotes));
- patternElement.appendChild(createElement(TagImage));
patternElement.appendChild(createElement(TagMeasurements));
patternElement.appendChild(createElement(TagIncrements));
@@ -128,7 +127,7 @@ void VPattern::Parse(const Document &parse)
SCASSERT(sceneDraw != nullptr);
SCASSERT(sceneDetail != nullptr);
QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes
- << TagImage << TagMeasurements << TagVersion << TagGradation << TagUnit;
+ << TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit;
PrepareForParse(parse);
QDomNode domNode = documentElement().firstChild();
while (domNode.isNull() == false)
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index 223733165..424d4dd9f 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -932,6 +932,20 @@ void VAbstractPattern::SetImage(const QString &text)
emit patternChanged(false);
}
+//---------------------------------------------------------------------------------------------------------------------
+void VAbstractPattern::DeleteImage()
+{
+ QDomElement pattern = documentElement();
+ QDomNodeList images = this->elementsByTagName(TagImage);
+ for (int i=0; i