[Qgis-user] Limiting File Choices

Richard Duivenvoorde rdmailings at duif.net
Mon Jul 18 02:23:02 PDT 2016


On 17-07-16 23:02, Michael Jabot wrote:
> I am working with elementary students in using QGIS to develop spatial
> reasoning.
> 
> I have created .shp files for them to use but when they go to the folder
> to add the .shp, all the supporting files are also present, so we are
> struggling. Is there a way to set the settings so that only the .shp
> appears as an option to them?
> 
> Thank you in advance for your help and I apologize if this is a silly
> question

Nope, not a silly one, but also not trivial to fix, as the list is
populated based on the capabilities of your used OGR library...

And indeed, your last choice is remembered in the Setting key
'UI/lastVectorFileFilter', which you can see when you open the 'Advanced
Settings Editor' in your options.

Apperently when this key is not present (when a new configuration/user
starts QGIS), it opens with the first option:
"All files (*)"
which is currently set as default, see

https://github.com/qgis/QGIS/blob/master/src/providers/ogr/qgsogrprovider.cpp#L2302

while you would want it to be:
"ESRI Shapefiles (*.shp *.SHP)"

We (as QGIS ) could set another type of file as default ogr vector
format (though I do not want to start the discussion which one :-) ):

Or you could create a startup python file which hardcoded can set this
'UI/lastVectorFileFilter' value at startup of QGIS (thereby overriding
the remembering part of QGIS). Please let me know if you want me to show
this to you (haven't tried it myself) ...

I do not think there is an easy way to make the number of filetypes
smaller...

Regards,

Richard








More information about the Qgis-user mailing list