Page 1 of 1

Feature request: stable XML attribute order

Posted: Sat Apr 18, 2015 2:42 pm
by sparkyb
This is a bit of a nitpicky request, but it would really be nice if the XML attributes in .qxw files always saved in a consistent order. I check my QLC files into version control, share editing of them with several people, and have written tools to automatically edit them in certain ways. I would really like to be able to diff my files to see what has changed but because the attributes change their order every time, it isn't possible to see real differences. Most people wouldn't care, but for those of us who do need to diff these files it would be really nice if the attribute order was fixed. I looked at the code and it seems you're using Qt's QtDomDocument-based XML library. That library is documented as not guaranteeing attribute order. However according to this page that library is deprecated now anyway and they suggest replacing it with QXmlStreamReader and QXmlStreamWriter which also have the benefit of preserving attribute order. Any chance that you'd consider making the switch? I realize it is a pretty big task. If not, is it something you'd accept a merge for if I did it myself?

Re: Feature request: stable XML attribute order

Posted: Sat Apr 18, 2015 5:19 pm
by plugz
I noticed this too, it's a little annoying :)

I suppose you could propose a PR, I'll be happy to test it

It's going to be a huge change though.

Testing will be more complex than writing the code :/

Re: Feature request: stable XML attribute order

Posted: Sat Apr 18, 2015 7:38 pm
by mcallegari
I agree. It's annoying but as David said this change is a huge work.
XML read/write is all over QLC+ (might be in 50 different files)

For other projects I've used the QXmlStream classes so I would already be able to do the conversion.
My problem at the moment is the time available :(

Re: Feature request: stable XML attribute order

Posted: Wed May 13, 2015 1:21 pm
by mcallegari
Further note. Apprently the XmlStreamReader/Writer classes have been introduced with Qt5.
Problem is that the QLC+ Linux version is still released on Qt4, so switching to Qt5 would mean breaking the compatibility with old distros.

Re: Feature request: stable XML attribute order

Posted: Wed May 13, 2015 5:28 pm
by plugz
"Since version 4.3, Qt provides two new classes for reading and writing XML: QXmlStreamReader and QXmlStreamWriter."

http://doc.qt.io/qt-5/qxmlstreamreader.html

http://doc.qt.io/qt-4.8/qxmlstreamwriter.html

:)

Re: Feature request: stable XML attribute order

Posted: Thu May 14, 2015 7:56 am
by mcallegari
I'll shut up then ! :P
Probably what I meant in my mind was "the QtXml module is deprecated since Qt5, in favour of XmlStreamReader/Writer (which are in QtCore)"