Skip to content
Permalink
Browse files

Cleanup QgsProjectProperty headers and docs

  • Loading branch information
nyalldawson committed Jan 2, 2017
1 parent 89cfa68 commit 48e72999ab711794f1fee09a2439f05dc3c63b54
Showing with 154 additions and 143 deletions.
  1. +4 −0 doc/api_break.dox
  2. +3 −10 python/core/qgsprojectproperty.sip
  3. +24 −35 src/core/qgsprojectproperty.cpp
  4. +123 −98 src/core/qgsprojectproperty.h
@@ -1363,6 +1363,10 @@ QgsProject {#qgis_api_break_3_0_QgsProject}
- dirty( bool b ) was removed. Use setDirty() instead.
- clearProperties() was removed. Use clear() instead.

QgsProjectPropertyValue {#qgis_api_break_3_0_QgsProjectPropertyValue}
-----------------------

- The unused count() and entryList() methods were removed.

QgsRaster {#qgis_api_break_3_0_QgsRaster}
---------
@@ -34,7 +34,7 @@ class QgsProjectProperty
*
* Used for restoring properties from project file
*/
virtual bool readXml( QDomNode & keyNode ) = 0;
virtual bool readXml( const QDomNode& keyNode ) = 0;

/**
* adds property hierarchy to given Dom element
@@ -91,19 +91,12 @@ class QgsProjectPropertyValue : QgsProjectProperty

void dump( int tabs = 0 ) const;

bool readXml( QDomNode & keyNode );
bool readXml( const QDomNode& keyNode );

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

int count() const;

/** Return keys that do not contain other keys
* Since QgsPropertyValue isn't a key, don't do anything.
*/
void entryList( QStringList & keyName, QStringList & entries ) const;

};

class QgsProjectPropertyKey : QgsProjectProperty
@@ -155,7 +148,7 @@ class QgsProjectPropertyKey : QgsProjectProperty

void dump( int tabs = 0 ) const;

bool readXml( QDomNode & keyNode );
bool readXml( const QDomNode& keyNode );

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

@@ -43,10 +43,9 @@ void QgsProjectPropertyValue::dump( int tabs ) const
{
QgsDebugMsg( QString( "%1%2" ).arg( tabString, mValue.toString() ) );
}
} // QgsPropertyValue::dump()

}

bool QgsProjectPropertyValue::readXml( QDomNode & keyNode )
bool QgsProjectPropertyValue::readXml( const QDomNode& keyNode )
{
// this *should* be a Dom element node
QDomElement subkeyElement = keyNode.toElement();
@@ -203,30 +202,26 @@ bool QgsProjectPropertyValue::readXml( QDomNode & keyNode )
QgsDebugMsg( "no support for QVariant::Pen" );
return false;

//
// QGIS DIES NOT SUPPORT THESE VARIANT TYPES IN VERSION 3.1 DISABLING FOR NOW
//
/*
case QVariant::LongLong :
value_ = QVariant(subkeyElement.text()).toLongLong();
break;
case QVariant::ULongLong :
value_ = QVariant(subkeyElement.text()).toULongLong();
break;
*/
#if 0 // Currently unsupported variant types
case QVariant::LongLong :
value_ = QVariant( subkeyElement.text() ).toLongLong();
break;

case QVariant::ULongLong :
value_ = QVariant( subkeyElement.text() ).toULongLong();
break;
#endif

default :
QgsDebugMsg( QString( "unsupported value type %1 .. not propertly translated to QVariant" ).arg( typeString ) );
}

return true;

} // QgsPropertyValue::readXml
}


/**
keyElement created by parent QgsProjectPropertyKey
*/
// keyElement is created by parent QgsProjectPropertyKey
bool QgsProjectPropertyValue::writeXml( QString const & nodeName,
QDomElement & keyElement,
QDomDocument & document )
@@ -265,7 +260,7 @@ bool QgsProjectPropertyValue::writeXml( QString const & nodeName,
keyElement.appendChild( valueElement );

return true;
} // QgsPropertyValue::writeXml
}


QgsProjectPropertyKey::QgsProjectPropertyKey( const QString &name )
@@ -288,7 +283,7 @@ QVariant QgsProjectPropertyKey::value() const
}

return foundQgsProperty->value();
} // QVariant QgsPropertyKey::value()
}


void QgsProjectPropertyKey::dump( int tabs ) const
@@ -346,11 +341,11 @@ void QgsProjectPropertyKey::dump( int tabs ) const
}
}

} // QgsPropertyKey::dump
}



bool QgsProjectPropertyKey::readXml( QDomNode & keyNode )
bool QgsProjectPropertyKey::readXml( const QDomNode& keyNode )
{
int i = 0;
QDomNodeList subkeys = keyNode.childNodes();
@@ -390,10 +385,10 @@ bool QgsProjectPropertyKey::readXml( QDomNode & keyNode )
}

return true;
} // QgsPropertyKey::readXml(QDomNode & keyNode)
}


/**
/*
Property keys will always create a Dom element for itself and then
recursively call writeXml for any constituent properties.
*/
@@ -420,12 +415,8 @@ bool QgsProjectPropertyKey::writeXml( QString const &nodeName, QDomElement & ele
element.appendChild( keyElement );

return true;
} // QgsPropertyKey::writeXml


}

/** Return keys that do not contain other keys
*/
void QgsProjectPropertyKey::entryList( QStringList & entries ) const
{
// now add any leaf nodes to the entries list
@@ -438,9 +429,7 @@ void QgsProjectPropertyKey::entryList( QStringList & entries ) const
entries.append( i.key() );
}
}
} // QgsPropertyKey::entryList


}

void QgsProjectPropertyKey::subkeyList( QStringList & entries ) const
{
@@ -454,7 +443,7 @@ void QgsProjectPropertyKey::subkeyList( QStringList & entries ) const
entries.append( i.key() );
}
}
} // QgsPropertyKey::subkeyList
}


bool QgsProjectPropertyKey::isLeaf() const
@@ -479,4 +468,4 @@ bool QgsProjectPropertyKey::isLeaf() const
void QgsProjectPropertyKey::setName( const QString& name )
{
mName = name;
} // QgsPropertyKey::isLeaf
}

0 comments on commit 48e7299

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