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

Sandro Santilli strk at kbt.io
Sat Aug 31 00:02:27 PDT 2019


On Thu, Aug 29, 2019 at 08:35:09PM +1000, Nyall Dawson wrote:
> On Thu, 29 Aug 2019 at 20:29, Sandro Santilli <strk at kbt.io> wrote:
> > On Thu, Aug 29, 2019 at 08:05:04PM +1000, Nyall Dawson wrote:
> > >
> > > It was the right move to drop this unused legacy code rather than
> > > waste the valuable maintainer power on something completely unused.
> >
> > It could have been moved to a convertion tool.
> 
> There was no volunteers to do this, and no sponsorship for work of
> this nature => no conversion tool. ;)

I'd think whoever introduced the _new_ format should have taken
care of providing an upgrade path for those with an old format.

Do you know which commit dropped the backward compatibility, exactly ?
Note that "something completely unused" (just re-reading your quoted
text) was actually still used by QGIS itself...

> > At least QGIS could warn user/error out when trying to open a file
> > older than 3.0, and give the hint about using 2.18 to convert them.
> 
> That's a good idea -- can you submit a PR?

I could try. My first exploration brought me in
src/core/qgsmaplayer.cpp, in this block:

  // get style file version string, if any
  QgsProjectVersion fileVersion( myRoot.attribute( QStringLiteral( "version" ) ) );
  QgsProjectVersion thisVersion( Qgis::QGIS_VERSION );

  if ( thisVersion > fileVersion )
  {
    QgsProjectFileTransform styleFile( myDocument, fileVersion );
    styleFile.updateRevision( thisVersion );
  }

It would sound like QgsProjectFileTransform::updateRevision should throw
an exception when unable to do what's been asked for ?

--strk;


More information about the QGIS-Developer mailing list