[Qgis-developer] FW: loadNamedStyle in QGIS 1.9

Adam Bioletti adamb at wilkinsonmurray.com.au
Thu Jun 6 00:01:24 PDT 2013


I just checked and it was not current.  I'm very pleased to report that I just updated and it works as expected.  Thanks and sorry for not updating QGIS before posting.

Regards
Adam
________________________________
From: Nathan Woodrow [mailto:madmanwoo at gmail.com]
Sent: Thursday, 6 June 2013 4:05 PM
To: Adam Bioletti
Cc: qgis-developer at lists.osgeo.org
Subject: Re: [Qgis-developer] FW: loadNamedStyle in QGIS 1.9

Hey Adam,

How recent is your build of QGIS?  I just fixed this a couple of days ago.

Regards,
Nathan

On Thu, Jun 6, 2013 at 4:01 PM, Adam Bioletti <adamb at wilkinsonmurray.com.au<mailto:adamb at wilkinsonmurray.com.au>> wrote:
I am updating a number of locally developed plugins to work with QGIS 1.9.  I am having trouble getting QgsVectorLayer.loadNamedStyle() to work.  I wish to use it from within a python plugin.

In troubleshooting the issue I have the following code which works from the python console in QGIS 1.8 but not in 1.9.

from qgis.utils import iface # redundant in QGIS 1.9 but doesn't hurt
layers = iface.legendInterface().layers()
style = QgsApplication.prefixPath() + "/python/plugins/Gopher2QGIS/styles/SourceLineVertice_Style.qml"
layer.loadNamedStyle(style)
layer.triggerRepaint()

At the loadNamedStyle point QGIS 1.8 returns:
(PyQt4.QtCore.QString(u''), True)

QGIS 1.9 returns:
(PyQt4.QtCore.QString(u'Loaded from Provider'), True)

Both appear to have loaded a style layer (returning a 'True' flag if I understand correctly) but the style of the layer in QGIS 1.9 is unchanged.

The style file referenced by each has been created by that version of qgis and loads correctly from the properties dialogue.  Any help that can be provided would be greatly appreciated.

Regards
Adam Bioletti


_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org<mailto:Qgis-developer at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130606/28b35578/attachment-0001.html>


More information about the Qgis-developer mailing list