I made a small program that saves a file, but people who use Ubuntu say that they can't properly save the file without manually putting a file extension in the save file name. I tried using the setDefaultSuffix function though I don't see how it would fit with the getSaveFileName function that I'm using.
Here's my code for the save button:
void MainWindow::on_save_clicked()
{
if (pngData.isEmpty())
{
QPixmap noSaveData
(":/graphic/noSaveData.png");
ui->preview->setStyleSheet("background: transparent ;");
ui->preview->setPixmap(noSaveData);
return;
}
QString filename
= QFileDialog::getSaveFileName(this,
("Save Skin"),
"C:/Users/",
("PNG Image (*.png)"));
file.write(pngData);
file.close();
}
void MainWindow::on_save_clicked()
{
if (pngData.isEmpty())
{
QPixmap noSaveData(":/graphic/noSaveData.png");
ui->preview->setStyleSheet("background: transparent ;");
ui->preview->setPixmap(noSaveData);
return;
}
QString filename = QFileDialog::getSaveFileName(this, ("Save Skin"), "C:/Users/", ("PNG Image (*.png)"));
QFile file(filename);
file.open(QIODevice::WriteOnly);
file.write(pngData);
file.close();
}
To copy to clipboard, switch view to plain text mode
Bookmarks