34 if ( v1.type() == QVariant::String && v2.type() == QVariant::String )
36 less = v1.toString() < v2.toString();
40 less = v1.toDouble() < v2.toDouble();
47 mMaximumNumberOfFeatures( 5 ), mShowOnlyVisibleFeatures( true )
51 QMap<QString, QgsMapLayer*>::const_iterator mapIt = layerMap.constBegin();
52 for ( ; mapIt != layerMap.constEnd(); ++mapIt )
84 QgsFieldMap::const_iterator it = fieldMap.constBegin();
85 for ( ; it != fieldMap.constEnd(); ++it )
88 if ( !currentAlias.isEmpty() )
155 qStableSort( attributes.begin(), attributes.end(), c );
162 QMap<int, QString> header;
166 QgsFieldMap::const_iterator fieldIt = vectorFields.constBegin();
167 for ( ; fieldIt != vectorFields.constEnd(); ++fieldIt )
181 QMap<int, QString>::const_iterator it =
mFieldAliasMap.find( attributeIndex );
207 if (( rectangle.height() - titleHeight ) > 0 )
221 QDomElement composerTableElem = doc.createElement(
"ComposerAttributeTable" );
226 composerTableElem.setAttribute(
"composerMap",
mComposerMap->
id() );
230 composerTableElem.setAttribute(
"composerMap", -1 );
234 composerTableElem.setAttribute(
"vectorLayer",
mVectorLayer->
id() );
238 QDomElement displayAttributesElem = doc.createElement(
"displayAttributes" );
242 QDomElement attributeIndexElem = doc.createElement(
"attributeEntry" );
243 attributeIndexElem.setAttribute(
"index", *attIt );
244 displayAttributesElem.appendChild( attributeIndexElem );
246 composerTableElem.appendChild( displayAttributesElem );
249 QDomElement aliasMapElem = doc.createElement(
"attributeAliasMap" );
250 QMap<int, QString>::const_iterator aliasIt =
mFieldAliasMap.constBegin();
253 QDomElement mapEntryElem = doc.createElement(
"aliasEntry" );
254 mapEntryElem.setAttribute(
"key", aliasIt.key() );
255 mapEntryElem.setAttribute(
"value", aliasIt.value() );
256 aliasMapElem.appendChild( mapEntryElem );
258 composerTableElem.appendChild( aliasMapElem );
261 QDomElement sortColumnsElem = doc.createElement(
"sortColumns" );
262 QList< QPair<int, bool> >::const_iterator sortIt =
mSortInformation.constBegin();
265 QDomElement columnElem = doc.createElement(
"column" );
266 columnElem.setAttribute(
"index", QString::number( sortIt->first ) );
267 columnElem.setAttribute(
"ascending", sortIt->second ==
true ?
"true" :
"false" );
268 sortColumnsElem.appendChild( columnElem );
270 composerTableElem.appendChild( sortColumnsElem );
271 elem.appendChild( composerTableElem );
278 if ( itemElem.isNull() )
287 int composerMapId = itemElem.attribute(
"composerMap",
"-1" ).toInt();
288 if ( composerMapId == -1 )
303 QString layerId = itemElem.attribute(
"vectorLayer",
"not_existing" );
304 if ( layerId ==
"not_existing" )
319 QDomNodeList displayAttributeList = itemElem.elementsByTagName(
"displayAttributes" );
320 if ( displayAttributeList.size() > 0 )
322 QDomElement displayAttributesElem = displayAttributeList.at( 0 ).toElement();
323 QDomNodeList attributeEntryList = displayAttributesElem.elementsByTagName(
"attributeEntry" );
324 for (
int i = 0; i < attributeEntryList.size(); ++i )
326 QDomElement attributeEntryElem = attributeEntryList.at( i ).toElement();
327 int index = attributeEntryElem.attribute(
"index",
"-1" ).toInt();
337 QDomNodeList aliasMapNodeList = itemElem.elementsByTagName(
"attributeAliasMap" );
338 if ( aliasMapNodeList.size() > 0 )
340 QDomElement attributeAliasMapElem = aliasMapNodeList.at( 0 ).toElement();
341 QDomNodeList aliasMepEntryList = attributeAliasMapElem.elementsByTagName(
"aliasEntry" );
342 for (
int i = 0; i < aliasMepEntryList.size(); ++i )
344 QDomElement aliasEntryElem = aliasMepEntryList.at( i ).toElement();
345 int key = aliasEntryElem.attribute(
"key",
"-1" ).toInt();
346 QString value = aliasEntryElem.attribute(
"value",
"" );
353 QDomElement sortColumnsElem = itemElem.firstChildElement(
"sortColumns" );
354 if ( !sortColumnsElem.isNull() )
356 QDomNodeList columns = sortColumnsElem.elementsByTagName(
"column" );
357 for (
int i = 0; i < columns.size(); ++i )
359 QDomElement columnElem = columns.at( i ).toElement();
360 int attribute = columnElem.attribute(
"index" ).toInt();
361 bool ascending = columnElem.attribute(
"ascending" ) ==
"true" ?
true :
false;