[QGIS Commit] r12220 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Nov 21 21:42:55 EST 2009


Author: jef
Date: 2009-11-21 21:42:53 -0500 (Sat, 21 Nov 2009)
New Revision: 12220

Modified:
   trunk/qgis/src/app/qgsattributedialog.cpp
Log:
set working directory for ui loader

Modified: trunk/qgis/src/app/qgsattributedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributedialog.cpp	2009-11-21 22:01:22 UTC (rev 12219)
+++ trunk/qgis/src/app/qgsattributedialog.cpp	2009-11-22 02:42:53 UTC (rev 12220)
@@ -33,6 +33,8 @@
 #include <QFrame>
 #include <QScrollArea>
 #include <QFile>
+#include <QFileInfo>
+#include <QDir>
 #include <QDialogButtonBox>
 #include <QUiLoader>
 #include <QDialog>
@@ -58,13 +60,19 @@
   if ( !vl->editForm().isEmpty() )
   {
     QFile file( vl->editForm() );
-    file.open( QFile::ReadOnly );
-    QUiLoader loader;
-    QWidget *myWidget = loader.load( &file, NULL );
-    file.close();
 
-    mDialog = qobject_cast<QDialog*>( myWidget );
-    buttonBox = myWidget->findChild<QDialogButtonBox*>();
+    if( file.open( QFile::ReadOnly ) )
+    {
+    	QUiLoader loader;
+
+    	QFileInfo fi( vl->editForm() );
+    	loader.setWorkingDirectory( fi.dir() );
+    	QWidget *myWidget = loader.load( &file, NULL );
+    	file.close();
+
+    	mDialog = qobject_cast<QDialog*>( myWidget );
+    	buttonBox = myWidget->findChild<QDialogButtonBox*>();
+    }
   }
 
   if ( !mDialog )



More information about the QGIS-commit mailing list