Added saveImage button to context menu
--HG-- branch : feature
This commit is contained in:
parent
58b1e84917
commit
a2619d8584
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ private slots:
|
|||
void DefValueChanged();
|
||||
void SecurityValueChanged();
|
||||
void DeleteImage();
|
||||
void SaveImage();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPatternProperties)
|
||||
Ui::DialogPatternProperties *ui;
|
||||
|
|
Loading…
Reference in New Issue
Block a user