mirror of https://github.com/CGAL/cgal
Let the application remember in which directory lies the last open file.
That directory is used to load new files.
This commit is contained in:
parent
9e64a530f6
commit
acf4ea73d5
|
|
@ -151,15 +151,19 @@ void MainWindow::updateViewerBBox()
|
|||
|
||||
void MainWindow::open(QString filename)
|
||||
{
|
||||
int index = scene->open(filename);
|
||||
if(index >= 0) {
|
||||
setCurrentFile(filename);
|
||||
selectPolyhedron(index);
|
||||
QFileInfo fileinfo(filename);
|
||||
if(fileinfo.isFile() && fileinfo.isReadable()) {
|
||||
int index = scene->open(filename);
|
||||
if(index >= 0) {
|
||||
QSettings settings;
|
||||
settings.setValue("OFF open directory",
|
||||
fileinfo.absoluteDir().absolutePath());
|
||||
setCurrentFile(filename);
|
||||
selectPolyhedron(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::selectPolyhedron(int i)
|
||||
{
|
||||
treeView->selectionModel()->select(scene->createSelection(i),
|
||||
|
|
@ -286,10 +290,13 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
|
||||
void MainWindow::on_actionLoadPolyhedron_triggered()
|
||||
{
|
||||
QSettings settings;
|
||||
QString directory = settings.value("OFF open directory",
|
||||
QDir::current().dirName()).toString();
|
||||
QStringList filenames =
|
||||
QFileDialog::getOpenFileNames(this,
|
||||
tr("Load polyhedron..."),
|
||||
QString(),
|
||||
directory,
|
||||
tr("OFF files (*.off)\n"
|
||||
"All files (*)"));
|
||||
if(!filenames.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue