Ich hab mal kurz nen exporter geschriebn und seb ist nen nab

Jk ich meine basti 👍
This commit is contained in:
Jan Schuffenhauer
2019-12-05 14:00:20 +01:00
parent e881b5d16c
commit 6b599d429f
4 changed files with 377 additions and 16 deletions

View File

@@ -60,12 +60,14 @@ void IntelliPhotoGui::open()
// Called when the user clicks Save As in the menu
void IntelliPhotoGui::save()
{
// A QAction represents the action of the user clicking
QAction *action = qobject_cast<QAction *>(sender());
// Stores the array of bytes of the users data
QByteArray fileFormat = action->data().toByteArray();
// Pass it to be saved
saveFile(fileFormat);
}
@@ -141,6 +143,18 @@ void IntelliPhotoGui::createActions()
saveAsActs.append(action);
}
QAction *action = new QAction("PNG-8", this);
// Set an action for each file format
action->setData("PNG");
// When clicked call IntelliPhotoGui::save()
connect(action, SIGNAL(triggered()), this, SLOT(save()));
// Attach each file format option menu item to Save As
saveAsActs.append(action);
// Create exit action and tie to IntelliPhotoGui::close()
exitAct = new QAction(tr("E&xit"), this);
@@ -178,6 +192,7 @@ void IntelliPhotoGui::createMenus()
foreach (QAction *action, saveAsActs)
saveAsMenu->addAction(action);
// Attach all actions to File
fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(openAct);
@@ -261,6 +276,10 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat)
// Define path, name and default file type
QString initialPath = QDir::currentPath() + "/untitled." + fileFormat;
// Get selected file from dialog
// Add the proper file formats and extensions
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),