const of QgsProperty and some styling

This commit is contained in:
David Signer 2020-05-14 09:48:41 +02:00
parent 8824d06dd3
commit 7c0d3b5829
4 changed files with 6 additions and 7 deletions

View File

@ -430,7 +430,7 @@ implying a hierarchy of keys and corresponding values
int readNumEntry( const QString &scope, const QString &key, int def = 0, bool *ok = 0 ) const; int readNumEntry( const QString &scope, const QString &key, int def = 0, bool *ok = 0 ) const;
double readDoubleEntry( const QString &scope, const QString &key, double def = 0, bool *ok = 0 ) const; double readDoubleEntry( const QString &scope, const QString &key, double def = 0, bool *ok = 0 ) const;
bool readBoolEntry( const QString &scope, const QString &key, bool def = false, bool *ok = 0 ) const; bool readBoolEntry( const QString &scope, const QString &key, bool def = false, bool *ok = 0 ) const;
QgsProperty readPropertyEntry( const QString &scope, const QString &key, QgsProperty def = QgsProperty(), bool *ok = 0 ) const; QgsProperty readPropertyEntry( const QString &scope, const QString &key, const QgsProperty &def = QgsProperty(), bool *ok = 0 ) const;
bool removeEntry( const QString &scope, const QString &key ); bool removeEntry( const QString &scope, const QString &key );

View File

@ -2488,20 +2488,20 @@ bool QgsProject::readBoolEntry( const QString &scope, const QString &key, bool d
return def; return def;
} }
QgsProperty QgsProject::readPropertyEntry( const QString &scope, const QString &key, QgsProperty def, bool *ok ) const QgsProperty QgsProject::readPropertyEntry( const QString &scope, const QString &key, const QgsProperty &def, bool *ok ) const
{ {
QgsProjectProperty *property = findKey_( scope, key, mProperties ); QgsProjectProperty *property = findKey_( scope, key, mProperties );
if ( property ) if ( property )
{ {
QgsProperty qgsproperty; QgsProperty propertyValue;
QVariant value = property->value(); QVariant value = property->value();
bool loaded = qgsproperty.loadVariant( value ); bool loaded = propertyValue.loadVariant( value );
if ( ok ) if ( ok )
*ok = loaded; *ok = loaded;
if ( loaded ) if ( loaded )
return qgsproperty; return propertyValue;
} }
return def; return def;

View File

@ -445,7 +445,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
int readNumEntry( const QString &scope, const QString &key, int def = 0, bool *ok = nullptr ) const; int readNumEntry( const QString &scope, const QString &key, int def = 0, bool *ok = nullptr ) const;
double readDoubleEntry( const QString &scope, const QString &key, double def = 0, bool *ok = nullptr ) const; double readDoubleEntry( const QString &scope, const QString &key, double def = 0, bool *ok = nullptr ) const;
bool readBoolEntry( const QString &scope, const QString &key, bool def = false, bool *ok = nullptr ) const; bool readBoolEntry( const QString &scope, const QString &key, bool def = false, bool *ok = nullptr ) const;
QgsProperty readPropertyEntry( const QString &scope, const QString &key, QgsProperty def = QgsProperty(), bool *ok = nullptr ) const; QgsProperty readPropertyEntry( const QString &scope, const QString &key, const QgsProperty &def = QgsProperty(), bool *ok = nullptr ) const;
//! Remove the given key //! Remove the given key

View File

@ -88,7 +88,6 @@ bool QgsProjectPropertyValue::readXml( const QDomNode &keyNode )
return false; return false;
case QVariant::Map: case QVariant::Map:
//it's a property
mValue = QgsXmlUtils::readVariant( subkeyElement.firstChild().toElement() ).toMap(); mValue = QgsXmlUtils::readVariant( subkeyElement.firstChild().toElement() ).toMap();
break; break;