[QGIS-trac] [Quantum GIS] #3713: Memory layer's fields not shown in attribute table (and layer properties) unless refreshed by entering the edit mode

Quantum GIS qgis at qgis.org
Fri Apr 8 18:12:14 EDT 2011


#3713: Memory layer's fields not shown in attribute table (and layer properties)
unless refreshed by entering the edit mode
------------------------------------------------+---------------------------
   Reporter:  borysiasty                        |              Owner:               
       Type:  bug                               |             Status:  new          
   Priority:  major: does not work as expected  |          Milestone:  Version 1.7.0
  Component:  Vectors                           |            Version:  Trunk        
   Keywords:                                    |   Platform_version:               
   Platform:  Debian                            |           Must_fix:  Yes          
Status_info:  0                                 |  
------------------------------------------------+---------------------------
 If I add a memory layer, it contains features with geometries, but seems
 the layer doesn't contain any field. In the attribute table the row
 headers are present, but the column headers are missing,  thus the records
 are empty. The same in Layer properties->Attributes, classification etc.
 Please note in the python console I can see the fields and attributes.

 Now, when I enter the edit mode, something refreshes and everything starts
 to work properly.



 Steps to reproduce:
 1. Add a memory layer, e.g from code below or any plugin

 {{{
 layer = QgsVectorLayer("Point","mylayer","memory")
 layer.dataProvider().addAttributes( [QgsField("foo", 2, "Int")] )
 f = QgsFeature()
 f.setGeometry(QgsGeometry.fromPoint(QgsPoint(0,0)))
 f.setAttributeMap( { 0 : 2 } )
 layer.dataProvider().addFeatures( [ f ] )
 QgsMapLayerRegistry.instance().addMapLayer(layer)
 }}}

 2. The attribute table is empty.

 3. Enter the edit mode

 4. Open the Attribute Table again - now everything works.

-- 
Ticket URL: <http://trac.osgeo.org/qgis/ticket/3713>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list