mirror of
https://github.com/Luca1991/NDSFactory.git
synced 2026-02-04 05:36:15 +01:00
Remember last used path in file/directory picker
This commit is contained in:
21
ui/utils/filepicker.h
Normal file
21
ui/utils/filepicker.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
QString customSaveFileDialog(const QString& title, const QString& defaultName, const QString& filter)
|
||||
{
|
||||
|
||||
static QString lastUsedPath;
|
||||
|
||||
QString selectedPath = QFileDialog::getSaveFileName(
|
||||
Q_NULLPTR,
|
||||
title,
|
||||
lastUsedPath + defaultName,
|
||||
filter);
|
||||
|
||||
if (!selectedPath.isNull())
|
||||
lastUsedPath = selectedPath.mid(0, selectedPath.lastIndexOf('/', Qt::CaseInsensitive)+1);
|
||||
|
||||
return selectedPath;
|
||||
}
|
||||
Reference in New Issue
Block a user