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?

(Re)setting the layer CRS of course works normally and works as expected!

l.setCrs(QgsCoordinateReferenceSystem(31287))
QgsProject.instance().addMapLayer(l)

Do you have any suggestions, how I could tackle the problem?

Thank you very much in advance!

Best regards,
Hannes
_______________________________________________
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