Ticket #1644 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

QgsVectorLayer/Python: Vector layer has no display name

Reported by: cmoe Owned by: nobody
Priority: major: does not work as expected Milestone:
Component: Data Provider Version: Trunk
Keywords: python; QgsVectorLayer Cc:
Platform Version: Platform: RedHat
Must Fix for Release: Yes Awaiting user input: no

Description

If i'm loading a postgis layer with python, like

uri = QgsDataSourceURI()
uri.setConnection('host','port','mydb','public','')
uri.setDataSource('public','foo','wkb_geometry','')
layer = QgsVectorLayer(uri.uri(),'bar','postgres')
QgsMapLayerRegistry.instance().addMapLayer(layer);

the new layer has no display name in the legend and its properties (print layer.name() has also no output). If i'm setting the name by using layer.setLayerName('bar'), the name is there, but it would be cool, if the constructor sets the name itsself like before.

It works for raster data and it works also if i'm using the postgis connector tool.

regards

Cédric

Change History

Changed 3 years ago by jef

  • status changed from new to closed
  • resolution set to fixed

fixed in r10605

Changed 2 years ago by anonymous

  • milestone Version 1.1.0 deleted

Milestone Version 1.1.0 deleted

Note: See TracTickets for help on using tickets.