Skip to content

Commit 06baa97

Browse files
authored
Merge pull request #3930 from nyalldawson/rename_qgsproject
Rename QgsProperty to QgsProjectProperty
2 parents d12c41f + 48e7299 commit 06baa97

7 files changed

Lines changed: 271 additions & 267 deletions

File tree

‎doc/api_break.dox‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ Renamed Classes {#qgis_api_break_3_0_renamed_classes}
115115
<tr><td>QgsMultiLineStringV2<td>QgsMultiLineString
116116
<tr><td>QgsMultiSurfaceV2<td>QgsMultiSurface
117117
<tr><td>QgsPointSequenceV2<td>QgsPointSequence
118+
<tr><td>QgsProperty<td>QgsProjectProperty
119+
<tr><td>QgsPropertyKey<td>QgsProjectPropertyKey
120+
<tr><td>QgsPropertyValue<td>QgsProjectPropertyValue
118121
<tr><td>QgsRandomColorsV2<td>QgsRandomColorRamp
119122
<tr><td>QgsRendererCategoryV2<td>QgsRendererCategory
120123
<tr><td>QgsRendererRangeV2<td>QgsRendererRange
@@ -1360,6 +1363,10 @@ QgsProject {#qgis_api_break_3_0_QgsProject}
13601363
- dirty( bool b ) was removed. Use setDirty() instead.
13611364
- clearProperties() was removed. Use clear() instead.
13621365

1366+
QgsProjectPropertyValue {#qgis_api_break_3_0_QgsProjectPropertyValue}
1367+
-----------------------
1368+
1369+
- The unused count() and entryList() methods were removed.
13631370

13641371
QgsRaster {#qgis_api_break_3_0_QgsRaster}
13651372
---------

‎python/core/qgsprojectproperty.sip‎

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
class QgsProperty
1+
class QgsProjectProperty
22
{
33
%TypeHeaderCode
44
#include <qgsprojectproperty.h>
55
%End
66

77
public:
8-
QgsProperty();
9-
virtual ~QgsProperty();
8+
QgsProjectProperty();
9+
virtual ~QgsProjectProperty();
1010

1111
/** Dumps out the keys and values
1212
*
@@ -34,7 +34,7 @@ class QgsProperty
3434
*
3535
* Used for restoring properties from project file
3636
*/
37-
virtual bool readXml( QDomNode & keyNode ) = 0;
37+
virtual bool readXml( const QDomNode& keyNode ) = 0;
3838

3939
/**
4040
* adds property hierarchy to given Dom element
@@ -63,16 +63,16 @@ class QgsProperty
6363
}; // class QgsProperty
6464

6565

66-
class QgsPropertyValue : QgsProperty
66+
class QgsProjectPropertyValue : QgsProjectProperty
6767
{
6868
%TypeHeaderCode
6969
#include <qgsprojectproperty.h>
7070
%End
7171

7272
public:
73-
QgsPropertyValue();
74-
QgsPropertyValue( const QVariant &value );
75-
virtual ~QgsPropertyValue();
73+
QgsProjectPropertyValue();
74+
QgsProjectPropertyValue( const QVariant &value );
75+
virtual ~QgsProjectPropertyValue();
7676

7777
/** Returns true if is a QgsPropertyKey */
7878
virtual bool isKey() const;
@@ -91,30 +91,23 @@ class QgsPropertyValue : QgsProperty
9191

9292
void dump( int tabs = 0 ) const;
9393

94-
bool readXml( QDomNode & keyNode );
94+
bool readXml( const QDomNode& keyNode );
9595

9696
bool writeXml( const QString & nodeName,
9797
QDomElement & element,
9898
QDomDocument & document );
9999

100-
int count() const;
101-
102-
/** Return keys that do not contain other keys
103-
* Since QgsPropertyValue isn't a key, don't do anything.
104-
*/
105-
void entryList( QStringList & keyName, QStringList & entries ) const;
106-
107100
};
108101

109-
class QgsPropertyKey : QgsProperty
102+
class QgsProjectPropertyKey : QgsProjectProperty
110103
{
111104
%TypeHeaderCode
112105
#include <qgsprojectproperty.h>
113106
%End
114107

115108
public:
116-
QgsPropertyKey( const QString& name = QString() );
117-
virtual ~QgsPropertyKey();
109+
QgsProjectPropertyKey( const QString& name = QString() );
110+
virtual ~QgsProjectPropertyKey();
118111

119112
/**
120113
* The name of the property is used as identifier.
@@ -133,7 +126,7 @@ class QgsPropertyKey : QgsProperty
133126

134127

135128
/// add the given property key
136-
QgsPropertyKey * addKey( const QString & keyName );
129+
QgsProjectPropertyKey * addKey( const QString & keyName );
137130

138131
/// remove the given key
139132
void removeKey( const QString & keyName );
@@ -143,19 +136,19 @@ class QgsPropertyKey : QgsProperty
143136
* @param value is the value to set
144137
* @return pointer to property value
145138
*/
146-
QgsPropertyValue * setValue( const QString & name, const QVariant & value );
139+
QgsProjectPropertyValue * setValue( const QString & name, const QVariant & value );
147140

148141
/** Set the value associated with this key
149142
*
150143
* @note that the single value node associated with each key is always
151144
* stored keyed by the current key name
152145
*/
153-
QgsPropertyValue * setValue( const QVariant & value );
146+
QgsProjectPropertyValue * setValue( const QVariant & value );
154147

155148

156149
void dump( int tabs = 0 ) const;
157150

158-
bool readXml( QDomNode & keyNode );
151+
bool readXml( const QDomNode& keyNode );
159152

160153
bool writeXml( const QString &nodeName, QDomElement & element, QDomDocument & document );
161154

@@ -189,5 +182,5 @@ class QgsPropertyKey : QgsProperty
189182
/// delete any sub-nodes
190183
virtual void clearKeys();
191184

192-
QgsProperty * find( QString & propertyName );
185+
QgsProjectProperty * find( QString & propertyName );
193186
}; // class QgsPropertyKey

‎src/core/qgsproject.cpp‎

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ QStringList makeKeyTokens_( const QString& scope, const QString& key )
106106
107107
@param scope scope of key
108108
@param key keyname
109-
@param rootProperty is likely to be the top level QgsPropertyKey in QgsProject:e:Imp.
109+
@param rootProperty is likely to be the top level QgsProjectPropertyKey in QgsProject:e:Imp.
110110
111111
@return null if not found, otherwise located Property
112112
*/
113-
QgsProperty* findKey_( const QString& scope,
114-
const QString& key,
115-
QgsPropertyKey& rootProperty )
113+
QgsProjectProperty* findKey_( const QString& scope,
114+
const QString& key,
115+
QgsProjectPropertyKey& rootProperty )
116116
{
117-
QgsPropertyKey* currentProperty = &rootProperty;
118-
QgsProperty* nextProperty; // link to next property down hiearchy
117+
QgsProjectPropertyKey* currentProperty = &rootProperty;
118+
QgsProjectProperty* nextProperty; // link to next property down hiearchy
119119

120120
QStringList keySequence = makeKeyTokens_( scope, key );
121121

@@ -144,7 +144,7 @@ QgsProperty* findKey_( const QString& scope,
144144
{
145145
if ( nextProperty->isKey() )
146146
{
147-
currentProperty = static_cast<QgsPropertyKey*>( nextProperty );
147+
currentProperty = static_cast<QgsProjectPropertyKey*>( nextProperty );
148148
}
149149
else if ( nextProperty->isValue() && 1 == keySequence.count() )
150150
{
@@ -156,7 +156,7 @@ QgsProperty* findKey_( const QString& scope,
156156
}
157157
else
158158
{
159-
// QgsPropertyValue not Key, so return null
159+
// QgsProjectPropertyValue not Key, so return null
160160
return nullptr;
161161
}
162162
}
@@ -185,17 +185,17 @@ QgsProperty* findKey_( const QString& scope,
185185
@param rootProperty is the property from which to start adding
186186
@param value the value associated with the key
187187
*/
188-
QgsProperty *addKey_( const QString& scope,
189-
const QString& key,
190-
QgsPropertyKey* rootProperty,
191-
const QVariant& value )
188+
QgsProjectProperty *addKey_( const QString& scope,
189+
const QString& key,
190+
QgsProjectPropertyKey* rootProperty,
191+
const QVariant& value )
192192
{
193193
QStringList keySequence = makeKeyTokens_( scope, key );
194194

195195
// cursor through property key/value hierarchy
196-
QgsPropertyKey *currentProperty = rootProperty;
197-
QgsProperty *nextProperty; // link to next property down hiearchy
198-
QgsPropertyKey* newPropertyKey;
196+
QgsProjectPropertyKey *currentProperty = rootProperty;
197+
QgsProjectProperty *nextProperty; // link to next property down hiearchy
198+
QgsProjectPropertyKey* newPropertyKey;
199199

200200
while ( ! keySequence.isEmpty() )
201201
{
@@ -223,13 +223,13 @@ QgsProperty *addKey_( const QString& scope,
223223
}
224224
else if (( nextProperty = currentProperty->find( keySequence.first() ) ) )
225225
{
226-
currentProperty = dynamic_cast<QgsPropertyKey*>( nextProperty );
226+
currentProperty = dynamic_cast<QgsProjectPropertyKey*>( nextProperty );
227227

228228
if ( currentProperty )
229229
{
230230
continue;
231231
}
232-
else // QgsPropertyValue not Key, so return null
232+
else // QgsProjectPropertyValue not Key, so return null
233233
{
234234
return nullptr;
235235
}
@@ -256,12 +256,12 @@ QgsProperty *addKey_( const QString& scope,
256256

257257
void removeKey_( const QString& scope,
258258
const QString& key,
259-
QgsPropertyKey &rootProperty )
259+
QgsProjectPropertyKey &rootProperty )
260260
{
261-
QgsPropertyKey *currentProperty = &rootProperty;
261+
QgsProjectPropertyKey *currentProperty = &rootProperty;
262262

263-
QgsProperty *nextProperty = nullptr; // link to next property down hiearchy
264-
QgsPropertyKey *previousQgsPropertyKey = nullptr; // link to previous property up hiearchy
263+
QgsProjectProperty *nextProperty = nullptr; // link to next property down hiearchy
264+
QgsProjectPropertyKey *previousQgsPropertyKey = nullptr; // link to previous property up hiearchy
265265

266266
QStringList keySequence = makeKeyTokens_( scope, key );
267267

@@ -290,13 +290,13 @@ void removeKey_( const QString& scope,
290290
else if (( nextProperty = currentProperty->find( keySequence.first() ) ) )
291291
{
292292
previousQgsPropertyKey = currentProperty;
293-
currentProperty = dynamic_cast<QgsPropertyKey*>( nextProperty );
293+
currentProperty = dynamic_cast<QgsProjectPropertyKey*>( nextProperty );
294294

295295
if ( currentProperty )
296296
{
297297
continue;
298298
}
299-
else // QgsPropertyValue not Key, so return null
299+
else // QgsProjectPropertyValue not Key, so return null
300300
{
301301
return;
302302
}
@@ -475,7 +475,7 @@ void QgsProject::clear()
475475
}
476476

477477
// basically a debugging tool to dump property list values
478-
void dump_( const QgsPropertyKey& topQgsPropertyKey )
478+
void dump_( const QgsProjectPropertyKey& topQgsPropertyKey )
479479
{
480480
QgsDebugMsg( "current properties:" );
481481
topQgsPropertyKey.dump();
@@ -509,10 +509,10 @@ scope. "layers" is a list containing three string values.
509509
\endcode
510510
511511
@param doc xml document
512-
@param project_properties should be the top QgsPropertyKey node.
512+
@param project_properties should be the top QgsProjectPropertyKey node.
513513
514514
*/
515-
void _getProperties( const QDomDocument& doc, QgsPropertyKey& project_properties )
515+
void _getProperties( const QDomDocument& doc, QgsProjectPropertyKey& project_properties )
516516
{
517517
QDomNodeList properties = doc.elementsByTagName( QStringLiteral( "properties" ) );
518518

@@ -1397,7 +1397,7 @@ QStringList QgsProject::readListEntry( const QString& scope,
13971397
const QStringList& def,
13981398
bool* ok ) const
13991399
{
1400-
QgsProperty* property = findKey_( scope, key, mProperties );
1400+
QgsProjectProperty* property = findKey_( scope, key, mProperties );
14011401

14021402
QVariant value;
14031403

@@ -1424,7 +1424,7 @@ QString QgsProject::readEntry( const QString& scope,
14241424
const QString& def,
14251425
bool* ok ) const
14261426
{
1427-
QgsProperty *property = findKey_( scope, key, mProperties );
1427+
QgsProjectProperty *property = findKey_( scope, key, mProperties );
14281428

14291429
QVariant value;
14301430

@@ -1446,7 +1446,7 @@ QString QgsProject::readEntry( const QString& scope,
14461446
int QgsProject::readNumEntry( const QString& scope, const QString &key, int def,
14471447
bool* ok ) const
14481448
{
1449-
QgsProperty *property = findKey_( scope, key, mProperties );
1449+
QgsProjectProperty *property = findKey_( scope, key, mProperties );
14501450

14511451
QVariant value;
14521452

@@ -1474,7 +1474,7 @@ double QgsProject::readDoubleEntry( const QString& scope, const QString& key,
14741474
double def,
14751475
bool* ok ) const
14761476
{
1477-
QgsProperty *property = findKey_( scope, key, mProperties );
1477+
QgsProjectProperty *property = findKey_( scope, key, mProperties );
14781478
if ( property )
14791479
{
14801480
QVariant value = property->value();
@@ -1493,7 +1493,7 @@ double QgsProject::readDoubleEntry( const QString& scope, const QString& key,
14931493
bool QgsProject::readBoolEntry( const QString& scope, const QString &key, bool def,
14941494
bool* ok ) const
14951495
{
1496-
QgsProperty *property = findKey_( scope, key, mProperties );
1496+
QgsProjectProperty *property = findKey_( scope, key, mProperties );
14971497

14981498
if ( property )
14991499
{
@@ -1523,13 +1523,13 @@ bool QgsProject::removeEntry( const QString& scope, const QString& key )
15231523

15241524
QStringList QgsProject::entryList( const QString& scope, const QString& key ) const
15251525
{
1526-
QgsProperty *foundProperty = findKey_( scope, key, mProperties );
1526+
QgsProjectProperty *foundProperty = findKey_( scope, key, mProperties );
15271527

15281528
QStringList entries;
15291529

15301530
if ( foundProperty )
15311531
{
1532-
QgsPropertyKey *propertyKey = dynamic_cast<QgsPropertyKey*>( foundProperty );
1532+
QgsProjectPropertyKey *propertyKey = dynamic_cast<QgsProjectPropertyKey*>( foundProperty );
15331533

15341534
if ( propertyKey )
15351535
{ propertyKey->entryList( entries ); }
@@ -1540,13 +1540,13 @@ QStringList QgsProject::entryList( const QString& scope, const QString& key ) co
15401540

15411541
QStringList QgsProject::subkeyList( const QString& scope, const QString& key ) const
15421542
{
1543-
QgsProperty *foundProperty = findKey_( scope, key, mProperties );
1543+
QgsProjectProperty *foundProperty = findKey_( scope, key, mProperties );
15441544

15451545
QStringList entries;
15461546

15471547
if ( foundProperty )
15481548
{
1549-
QgsPropertyKey *propertyKey = dynamic_cast<QgsPropertyKey*>( foundProperty );
1549+
QgsProjectPropertyKey *propertyKey = dynamic_cast<QgsProjectPropertyKey*>( foundProperty );
15501550

15511551
if ( propertyKey )
15521552
{ propertyKey->subkeyList( entries ); }

‎src/core/qgsproject.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
997997
QVariantMap mCustomVariables;
998998

999999
QFile mFile; // current physical project file
1000-
mutable QgsPropertyKey mProperties; // property hierarchy, TODO: this shouldn't be mutable
1000+
mutable QgsProjectPropertyKey mProperties; // property hierarchy, TODO: this shouldn't be mutable
10011001
QString mTitle; // project title
10021002
bool mAutoTransaction; // transaction grouped editing
10031003
bool mEvaluateDefaultValues; // evaluate default values immediately

‎src/core/qgsprojectfiletransform.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ void QgsProjectFileTransform::transform1100to1200()
404404
for ( int i = 0; i < tolList.childNodes().count(); i++ )
405405
units << QStringLiteral( "0" );
406406

407-
QgsPropertyValue value( units );
407+
QgsProjectPropertyValue value( units );
408408
value.writeXml( QStringLiteral( "LayerSnappingToleranceUnitList" ), digitizing, mDom );
409409
}
410410

0 commit comments

Comments
 (0)