Skip to content

Commit 20bf738

Browse files
committedJan 18, 2016
correctly save and restore last used dir when saving/loagin color map for singleband images (fix #12390)
1 parent aa417a1 commit 20bf738

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mLoadFromFileButton_clicked()
409409
bool importError = false;
410410
QString badLines;
411411
QSettings settings;
412-
QString lastDir = settings.value( "lastRasterFileFilterDir", QDir::homePath() ).toString();
412+
QString lastDir = settings.value( "lastColorMapDir", QDir::homePath() ).toString();
413413
QString fileName = QFileDialog::getOpenFileName( this, tr( "Open file" ), lastDir, tr( "Textfile (*.txt)" ) );
414414
QFile inputFile( fileName );
415415
if ( inputFile.open( QFile::ReadOnly ) )
@@ -478,6 +478,9 @@ void QgsSingleBandPseudoColorRendererWidget::on_mLoadFromFileButton_clicked()
478478
}
479479
populateColormapTreeWidget( colorRampItems );
480480

481+
QFileInfo fileInfo( fileName );
482+
settings.setValue( "lastColorMapDir", fileInfo.absoluteDir().absolutePath() );
483+
481484
if ( importError )
482485
{
483486
QMessageBox::warning( this, tr( "Import Error" ), tr( "The following lines contained errors\n\n" ) + badLines );
@@ -492,7 +495,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mLoadFromFileButton_clicked()
492495
void QgsSingleBandPseudoColorRendererWidget::on_mExportToFileButton_clicked()
493496
{
494497
QSettings settings;
495-
QString lastDir = settings.value( "lastRasterFileFilterDir", QDir::homePath() ).toString();
498+
QString lastDir = settings.value( "lastColorMapDir", QDir::homePath() ).toString();
496499
QString fileName = QFileDialog::getSaveFileName( this, tr( "Save file" ), lastDir, tr( "Textfile (*.txt)" ) );
497500
if ( !fileName.isEmpty() )
498501
{
@@ -544,6 +547,9 @@ void QgsSingleBandPseudoColorRendererWidget::on_mExportToFileButton_clicked()
544547
}
545548
outputStream.flush();
546549
outputFile.close();
550+
551+
QFileInfo fileInfo( fileName );
552+
settings.setValue( "lastColorMapDir", fileInfo.absoluteDir().absolutePath() );
547553
}
548554
else
549555
{

0 commit comments

Comments
 (0)
Please sign in to comment.