[Qgis-developer] Re: [PyQGIS] - Change VertexMarkerType

Martin Dobias wonder.sk at gmail.com
Tue Feb 22 05:18:43 EST 2011


On Tue, Feb 22, 2011 at 10:50 AM, Salvatore Larosa <s_larosa at libero.it> wrote:
>
>
> Martin Dobias wrote:
>>
>> Hi Salvatore
>>
>> to use semi-transparent circles as vertex markers:
>>
>> settings = QSettings()
>> settings.setValue("/qgis/digitizing/marker_style",
>> "SemiTransparentCircle")
>>
>> That code can be put somewhere in the application's initialization.
>> Other values are "Cross" and "None". You can also change the size of
>> the marker:
>>
>> settigs.setValue("/qgis/digitizing/marker_size", 3)
>>
>>
>> Martin
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>
> Thank for your reply, Martin
>
> I put in the my script the code you posted, but it not works.
>
> I have imported QSettings() from PyQt4.QtCore and put the code
> in class MainWindow and I get this error:
>
> File "/home/sam/dev_qgis/src/mainwintest.py", line 32, in __init__
> settings.setValue("/qgis/digitizing/marker_style", "SemiTransparentCircle")
> TypeError: argument 2 of QSettings.setValue() has an invalid type
>
> Any hint?

You probably need to wrap the second parameter into QVariant class (I
think newer PyQt versions have this conversion automatically):

settings.setValue("/qgis/digitizing/marker_style",
QVariant("SemiTransparentCircle"))

Martin


More information about the Qgis-developer mailing list