Fixed little bug when we try to save image

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-03-27 14:51:36 +03:00
parent e838ae811e
commit b22c5b656a

View File

@ -703,15 +703,18 @@ void DialogPatternProperties::SaveImage()
const QString extension = "." + doc->GetImageExtension(); const QString extension = "." + doc->GetImageExtension();
QString filter = tr("Images (*") + extension + ")"; QString filter = tr("Images (*") + extension + ")";
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter); QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter);
if (not filename.endsWith(extension.toUpper())) if (not filename.isEmpty())
{ {
filename.append(extension); if (not filename.endsWith(extension.toUpper()))
} {
QFile file(filename); filename.append(extension);
if (file.open(QIODevice::WriteOnly)) }
{ QFile file(filename);
file.write(ba); if (file.open(QIODevice::WriteOnly))
file.close(); {
file.write(ba);
file.close();
}
} }
} }