[Qgis-user] Reading Qsettings outside QGis

Etienne Tourigny etourigny.dev at gmail.com
Thu Oct 11 07:12:38 PDT 2012


Hi Pierre,

yes this is the right approach.  However, you must make sure that the
proper organisation (QuantumGIS) and application (QGIS) are set.  Your
problem is probably because the QSettings is initialized with some
default values.

This is done automatically when using plugins in the qgis app, but not
if your are creating an external app.

Although it should happen when calling QgsApplication.initQgis() - you
might want to file a bug report for that.

BTW - you might get more feedback if posting to the qgis-devel mailing list.

Etienne

On Thu, Oct 11, 2012 at 6:34 AM, PIERRE Sylvain <sylvain.pierre at cg67.fr> wrote:
> I’m developping a standalone application (Python, Qt, Qgis) and I would like
> to read some settings that I currently use in my Qgis projects : PostGis and
> Spatialite connections.
>
> I suppose I can get this values with QSettings, but I’m not sure.
>
> Is it the right way to do this ?
>
> I’m testing with the code below, with no result :
>
>         settings = QSettings()
>
>         settings.beginGroup("/PostgreSQL/connections")
>
>         keys = settings.childGroups()
>
>
>
>         for name in keys:
>
>             QMessageBox.warning(self,"Information",str(name))
>
>
>
>
>
> Any idea ?
>
>
>
> Thanks
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>



More information about the Qgis-user mailing list