Skip to content
Permalink
Browse files

Save project properties in predictable order

  • Loading branch information
m-kuhn committed Apr 9, 2019
1 parent 5a85e20 commit fa850a11ba88b9ead5662657b4a9d8d5f2fffe3b
Showing with 11 additions and 7 deletions.
  1. +8 −7 src/core/qgsprojectproperty.cpp
  2. +3 −0 src/core/qgsprojectproperty.h
@@ -17,6 +17,8 @@

#include "qgsprojectproperty.h"
#include "qgslogger.h"
#include "qgis.h"
#include "qgsmessagelog.h"

#include <QDomDocument>
#include <QStringList>
@@ -407,14 +409,13 @@ bool QgsProjectPropertyKey::writeXml( QString const &nodeName, QDomElement &elem

if ( ! mProperties.isEmpty() )
{
QHashIterator < QString, QgsProjectProperty * > i( mProperties );
while ( i.hasNext() )
auto keys = mProperties.keys();
std::sort( keys.begin(), keys.end() );

for ( const auto &key : qgis::as_const( keys ) )
{
i.next();
if ( !i.value()->writeXml( i.key(), keyElement, document ) )
{
return false;
}
if ( !mProperties.value( key )->writeXml( key, keyElement, document ) )
QgsMessageLog::logMessage( tr( "Failed to save project property %1" ).arg( key ) );
}
}

@@ -25,6 +25,7 @@
#include <QHash>
#include <QVariant>
#include <QStringList>
#include <QCoreApplication>

#include "qgis_core.h"

@@ -181,6 +182,8 @@ class CORE_EXPORT QgsProjectPropertyValue : public QgsProjectProperty
*/
class CORE_EXPORT QgsProjectPropertyKey : public QgsProjectProperty
{
Q_DECLARE_TR_FUNCTIONS( QgsProjectPropertyKey )

public:

/**

0 comments on commit fa850a1

Please sign in to comment.
You can’t perform that action at this time.