[Qgis-developer] Get rasters/vectors format name from selected file filter

Giuseppe Sucameli brush.tyler at gmail.com
Mon Jan 18 17:19:01 EST 2010


Hi all,

I would to retrieve the rasters/vectors format name
from the selected filter in a save file dialog. This to
choose automatically the right output format
depending on the selected filter.

To avoid duplicated code, I used as dialog filter the
qgis functions:
QgsRasterLayer::buildSupportedRasterFileFilter()
QgsProviderRegistry::instance().fileVectorFilters()

I cannot use the file info because I want to create it
and it may not exists.

By the way, I get the rasters format short name
using the filter in this manner:
1. get the filter name,
2. for each GDAL driver search the one that have
as long name the filter name
3. return the driver short name

For vectors this not works. Infact the filter name is
not related with the OGR driver but it is harded in
code.

It's not important, but the code is in python.

Any ideas? Thanks in advance!

-- 
Giuseppe Sucameli


More information about the Qgis-developer mailing list