On 21 March 2018 at 04:30, KOHLMANN Hannes <h.kohlm...@ove.at> wrote:
> Hello again!
>
>
>
> I do the following to add a QgsRasterLayer:
>
> l = QgsRasterLayer("/path/file.dat", "Density")
>
>
>
> Now I am struggling with a problem, that has somehow always the same
> suggested solution in all fora, namely to get rid of the prompt that appears
>
> when adding a QgsRasterLayer, by using:
>
> s = QSettings()
>
> oldValidation = s.value( "/Projections/defaultBehaviour" )
>
> s.setValue( "/Projections/defaultBehaviour", "useGlobal" ) # it doesn’t
> matter what property to take, be it “useProject”, “useGlobal” or “prompt” …
>
> … before adding the layer. But on my Linux environment, this does not work –
> and also not on my collegue’s Windows system.
>
> Has there something changed with the usage of QSettings w.r.t. to its usage
> in QGIS in the step from QGIS 2 to QGIS 3?
>

That should still work.

Try using QgsSettings instead (but I don't think this should be necessary):

s = QgsSettings()


Nyall
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to