@@ -76,6 +76,10 @@ QString QgsFilePickerWidget::filePath()
76
76
77
77
void QgsFilePickerWidget::setFilePath ( QString path )
78
78
{
79
+ if ( path == QSettings ().value ( " qgis/nullValue" , " NULL" ) )
80
+ {
81
+ path = " " ;
82
+ }
79
83
mFilePath = path;
80
84
mLineEdit ->setText ( path );
81
85
mLinkLabel ->setText ( toUrl ( path ) );
@@ -188,7 +192,12 @@ void QgsFilePickerWidget::openFileDialog()
188
192
QUrl theUrl = QUrl::fromUserInput ( oldPath );
189
193
if ( !theUrl.isValid () )
190
194
{
191
- oldPath = settings.value ( " /UI/lastExternalResourceWidgetDir" , QDir::cleanPath ( QgsProject::instance ()->fileInfo ().absolutePath () ) ).toString ();
195
+ QString defPath = QDir::cleanPath ( QgsProject::instance ()->fileInfo ().absolutePath () );
196
+ if ( defPath.isEmpty () )
197
+ {
198
+ defPath = QDir::homePath ();
199
+ }
200
+ oldPath = settings.value ( " /UI/lastExternalResourceWidgetDefaultPath" , defPath ).toString ();
192
201
}
193
202
194
203
// Handle Storage
@@ -219,7 +228,7 @@ void QgsFilePickerWidget::openFileDialog()
219
228
else if ( mStorageMode == Directory )
220
229
{
221
230
settings.setValue ( " /UI/lastFileNameWidgetDir" , fileName );
222
- }
231
+ }
223
232
224
233
// Handle relative Path storage
225
234
fileName = relativePath ( fileName, true );
@@ -252,7 +261,7 @@ QString QgsFilePickerWidget::relativePath( QString filePath, bool removeRelative
252
261
}
253
262
254
263
255
- QString QgsFilePickerWidget::toUrl (const QString& path ) const
264
+ QString QgsFilePickerWidget::toUrl ( const QString& path ) const
256
265
{
257
266
QString rep;
258
267
if ( path.isEmpty () )
0 commit comments