Skip to content

Commit 47a5086

Browse files

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎src/composer/qgscomposerpicture.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <QMessageBox>
2424
#include <QPainter>
2525
#include <QImageWriter>
26+
#include <QSettings>
2627

2728
#include <cmath>
2829
#include <iostream>
@@ -493,11 +494,21 @@ QString QgsComposerPicture::pictureDialog ( void )
493494
}
494495
filters += " )";
495496

497+
// Retrieve the last used directory
498+
QSettings settings;
499+
QString lastUsedDir = settings.readEntry("/UI/lastComposerPictureDir", ".");
500+
496501
QString file = QFileDialog::getOpenFileName(
497502
0,
498503
tr("Choose a file"),
499-
".",
504+
lastUsedDir,
500505
filters );
506+
if (file.length() != 0)
507+
{
508+
QFileInfo myFile(file);
509+
QString myPath = myFile.dirPath();
510+
settings.writeEntry("/UI/lastComposerPictureDir", myPath);
511+
}
501512

502513
return file;
503514
}

0 commit comments

Comments
 (0)
Please sign in to comment.