diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index bab98d197..7dbca591e 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -634,6 +634,7 @@ void DialogPatternProperties::InitImage() showImageAction = new QAction("Show image", this); connect(deleteAction, &QAction::triggered, this, &DialogPatternProperties::DeleteImage); connect(changeImageAction, &QAction::triggered, this, &DialogPatternProperties::SetNewImage); + connect(saveImageAction, &QAction::triggered, this, &DialogPatternProperties::SaveImage); } //--------------------------------------------------------------------------------------------------------------------- @@ -671,6 +672,23 @@ void DialogPatternProperties::DeleteImage() ui->imageLabel->setText("Change image"); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogPatternProperties::SaveImage() +{ + QByteArray byteArray; + byteArray.append(doc->GetImage().toUtf8()); + QByteArray ba = QByteArray::fromBase64(byteArray); + + QString extension = ".PNG"; + QString filename = QFileDialog::getSaveFileName(this, tr("Save File")); + QFile file(filename + extension); + if (file.open(QIODevice::WriteOnly)) + { + file.write(ba); + file.close(); + } +} + //--------------------------------------------------------------------------------------------------------------------- void DialogPatternProperties::ShowContextMenu() { diff --git a/src/app/valentina/dialogs/dialogpatternproperties.h b/src/app/valentina/dialogs/dialogpatternproperties.h index 80c58bc66..ae1b8cbc1 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.h +++ b/src/app/valentina/dialogs/dialogpatternproperties.h @@ -66,6 +66,7 @@ private slots: void DefValueChanged(); void SecurityValueChanged(); void DeleteImage(); + void SaveImage(); private: Q_DISABLE_COPY(DialogPatternProperties) Ui::DialogPatternProperties *ui;