From 782a62585e8b9db4412ea5ebbb384b2bc55db025 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 21 Jun 2020 19:10:06 -0400 Subject: [PATCH] Preserves open path between launches. --- OSBindings/Qt/mainwindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 781a2a007..2c1040e25 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -74,8 +74,13 @@ void MainWindow::createActions() { } void MainWindow::open() { - QString fileName = QFileDialog::getOpenFileName(this); + Settings settings; + + // Use the Settings to get a default open path; write it back afterwards. + QString fileName = QFileDialog::getOpenFileName(this, tr("Open..."), settings.value("openPath").toString()); if(!fileName.isEmpty()) { + settings.setValue("openPath", QFileInfo(fileName).absoluteDir().path()); + // My understanding of SDI: if a file was opened for a 'vacant' window, launch it directly there; // otherwise create a new window for it. if(machine) {