[Qgis-developer] getting the selected filter from the Save style filedialog

Giuseppe Sucameli brush.tyler at gmail.com
Thu Mar 8 20:29:53 EST 2012


Hi Nathan,

On Fri, Mar 9, 2012 at 2:09 AM, Nathan Woodrow <madmanwoo at gmail.com> wrote:
> Can you use:
>
> QDir::Filters QFileDialog::filter () const
>
> or
>
> void QFileDialog::filterSelected ( const QString & filter ) [signal]

yes I know, those methods are for QFileDialog objects.
If I remember well, creating a QFileDialog instance results in a
non-native filedialog.

I'm talking about the static method and of course I have no QFileDialog
instance I can call those methods on.

NB: the static method should return the selected filter as well using a
in/out parameter (QString *selectedFilter = 0), but the problem is due
to a bug and I don't know if it was fixed and in which QT version.

Regards.

> - Nathan
>
>
>
> On Fri, Mar 9, 2012 at 11:00 AM, Giuseppe Sucameli <brush.tyler at gmail.com>
> wrote:
>>
>> Hi all,
>>
>> yesterday night I pushed to master the support to SLD.
>> The feature is available from the Save style/Load style buttons in vector
>> layer properties.
>>
>> BTW, there's a problem [1]: you need to add ".sld" extension to the
>> output filename when saving because there's no way to distinguish what
>> format was selected in the native file dialog (see [2]).
>>
>> I remember this was a QT issue (right?) using the
>> QFileDialog::getSaveFileName static method and this problem was already
>> handled in more than a place using 2 different solutions:
>>
>> - adding a combo to select the format before selecting the filename (e.g.
>> "Save as..."),
>> - using the non-native filedialog (e.g. "Save image...")
>>
>> Of course I cannot add the format combo to the Vector layer property GUI
>> (where should I put it?), but I would avoid the second solution because
>> there are some tickets about using the non-native filedialogs (see [3],
>> [4]).
>>
>> Does anybody here know a better solution?
>> Otherwise I'm going to switch that filedialog to the non-native one.
>>
>> Regards.
>>
>> [1] http://hub.qgis.org/issues/5136
>> [2] http://hub.qgis.org/issues/2298
>> [3] http://hub.qgis.org/issues/5096
>> [4] http://hub.qgis.org/issues/3763
>>
>> --
>> Giuseppe Sucameli
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Giuseppe Sucameli


More information about the Qgis-developer mailing list