[Qgis-developer] controlling visibility

Carson Farmer carson.farmer at gmail.com
Tue Mar 10 11:40:08 EDT 2009


Hello devs,

I am very close to having a QgsTableProvider for loading, accessing, 
editing, and visualising non-spatial tables in QGIS. It is really quite 
simple, and essentially is an ogr provider for non-spatial data (i.e. 
can read dbf, csv, and probably postgres eventually as well). Currently, 
I can create a QgsVectorLayer with the 'table' provider, which is 
essentially just a normal QgsVectorLayer that has no spatial information 
(i.e. extent, geometries). You can do most things, including access the 
provider, and 'select', 'nextFeature', 'featureAtId', etc from there. 
The only problems that I have noticed so far are:

a) If Options > Rendering > 'By default new layers added to the map 
should be displayed' is checked, QGIS crashes when the table is loaded.
b) When added to the layer list, a polygon icon is displayed (I would 
like to change this to a attribute table icon).
c) Currently, when right clicking the table layer, all context menu 
items are visible (I would like to remove some of these options: remove 
everything except open attribute table, remove, toggle editing, and rename).

To address a), I would like to figure out how to automatically set the 
visibility of these 'table' layers to False, and keep it this way. I 
haven't really looked too much into b) and c), but if someone has a 
quick suggestion that would greatly help me out.

The reasons for attempting to implement a QgsTableProvider are several: 
1) It allows people to view non-spatial tables, edit them, and all sorts 
of useful things all from one place, and more importantly: 2) It will 
make joining and relating tables possible/much easier: OGR has the 
ability to join tables using SQL like queries, by I think this would 
make it possible to create non-permanent table joins in QGIS (an often 
requested feature).

My eventual goal would be to allow table joins, appending the additional 
tables to the Files list of a layer...

Anyway, any input/help is greatly appreciated, especially regarding the 
above items ;-)

Carson

-- 
Carson J. Q. Farmer
ISSP Doctoral Fellow
National Centre for Geocomputation (NCG),
Email: Carson.Farmer at gmail.com
Web:   http://www.carsonfarmer.com/
       http://www.ftools.ca/




More information about the Qgis-developer mailing list