Use default filepath of item when saving if exists, if not use last path used when save_as in the current session if exists, if not use build dir like before.

This commit is contained in:
Maxime Gimeno 2018-02-14 14:12:31 +01:00
parent b50fddc9d8
commit 4cb8afebee
2 changed files with 9 additions and 1 deletions

View File

@ -1606,12 +1606,19 @@ void MainWindow::on_actionSaveAs_triggered()
continue;
}
QString caption = tr("Save %1 to File...").arg(item->name());
QString dir = item->property("source filename").toString();
if(dir.isEmpty())
dir = QString("%1/%2").arg(last_saved_dir).arg(item->name());
if(dir.isEmpty())
dir = item->name();
QString filename =
QFileDialog::getSaveFileName(this,
caption,
QString("%1").arg(item->name()),
dir,
filters.join(";;"),
&sf);
last_saved_dir = QFileInfo(dir).absoluteDir().path();
extensions.indexIn(sf.split(";;").first());
ext1 = extensions.cap();
//remove `)`

View File

@ -402,6 +402,7 @@ private:
QTreeView* sceneView;
Ui::MainWindow* ui;
QVector<CGAL::Three::Polyhedron_demo_io_plugin_interface*> io_plugins;
QString last_saved_dir;
QMap<QString,QString> default_plugin_selection;
// typedef to make Q_FOREACH work
typedef QPair<CGAL::Three::Polyhedron_demo_plugin_interface*, QString> PluginNamePair;