[QGIS-Developer] how compatible .qml files are ?

Nyall Dawson nyall.dawson at gmail.com
Wed Aug 28 15:41:03 PDT 2019


On Thu, 29 Aug 2019 at 02:44, Paolo Cavallini <cavallini at faunalia.it> wrote:
>
> Hi Sandro,
>
> On 28/08/19 17:43, Sandro Santilli wrote:
> > I just filed https://github.com/qgis/QGIS/issues/31471 after finding
> > out that a .qml file created with QGIS 1.9.0 is not fully honoured
> > with curretn QGIS master (and I think 3.4.0 as well).
> >
> > Yes, I know 1.9.0 is old but... is this level of backward
> > compatibility supposed to work ? Or are there tools to convert
> > saved styles across versions ?
>
> my understanding is that maintaining compatibility is just too hard to
> achieve, and we never promised to our users.

Yep - 1.9 to 3.x is a HUGE jump, especially if the project was first
created in an even earlier version (my timeline is shaky here, but it
likely could even be using symbology v1. ouch!). All this old 1.x
compatiblity code was dropped in the 2 -> 3 migration, with the
recommendation being that users who need to open a 1.x project first
load and resave it in 2.18.

> How are them converted ?

See above -- open in 2.18, save, open in 3.x, save.

> And note we're talking about styles, not full projects here. And styles that are shipped with QGIS itself (could this be automated, for shipped styles?).

I don't think it's worth the effort of automating a transition to be
honest. This situation occurs so infrequently (once in the past 10
years) that it's unlikely to pay off. If you want to ensure the style
is future proof, then I'd suggest building it dynamically when
required, and doing it in c++. Then it's effectively guaranteed to
keep working and if anyone changes API, they'll need to fix your code
in order to build....

Nyall


More information about the QGIS-Developer mailing list