24 : mCurrentSortColumn( 0 ), mAscending( true )
35 if ( v1.type() == QVariant::String && v2.type() == QVariant::String )
37 less = v1.toString() < v2.toString();
41 less = v1.toDouble() < v2.toDouble();
51 , mMaximumNumberOfFeatures( 5 )
52 , mShowOnlyVisibleFeatures( true )
56 QMap<QString, QgsMapLayer*>::const_iterator mapIt = layerMap.constBegin();
57 for ( ; mapIt != layerMap.constEnd(); ++mapIt )
88 for (
int idx = 0; idx < fields.
count(); ++idx )
91 if ( !currentAlias.isEmpty() )
129 attributeMaps.clear();
153 if ( !selectionRect.
isEmpty() )
169 for (
int i = 0; i < f.
attributes().size(); i++ )
174 attributeMaps.last().insert( i, f.
attributes()[i] );
186 qStableSort( attributeMaps.begin(), attributeMaps.end(), c );
193 QMap<int, QString> header;
197 for (
int idx = 0; idx < vectorFields.
count(); ++idx )
229 if (( rectangle.height() - titleHeight ) > 0 )
243 QDomElement composerTableElem = doc.createElement(
"ComposerAttributeTable" );
249 composerTableElem.setAttribute(
"composerMap",
mComposerMap->
id() );
253 composerTableElem.setAttribute(
"composerMap", -1 );
257 composerTableElem.setAttribute(
"vectorLayer",
mVectorLayer->
id() );
261 QDomElement displayAttributesElem = doc.createElement(
"displayAttributes" );
265 QDomElement attributeIndexElem = doc.createElement(
"attributeEntry" );
266 attributeIndexElem.setAttribute(
"index", *attIt );
267 displayAttributesElem.appendChild( attributeIndexElem );
269 composerTableElem.appendChild( displayAttributesElem );
272 QDomElement aliasMapElem = doc.createElement(
"attributeAliasMap" );
273 QMap<int, QString>::const_iterator aliasIt =
mFieldAliasMap.constBegin();
276 QDomElement mapEntryElem = doc.createElement(
"aliasEntry" );
277 mapEntryElem.setAttribute(
"key", aliasIt.key() );
278 mapEntryElem.setAttribute(
"value", aliasIt.value() );
279 aliasMapElem.appendChild( mapEntryElem );
281 composerTableElem.appendChild( aliasMapElem );
284 QDomElement sortColumnsElem = doc.createElement(
"sortColumns" );
285 QList< QPair<int, bool> >::const_iterator sortIt =
mSortInformation.constBegin();
288 QDomElement columnElem = doc.createElement(
"column" );
289 columnElem.setAttribute(
"index", QString::number( sortIt->first ) );
290 columnElem.setAttribute(
"ascending", sortIt->second ==
true ?
"true" :
"false" );
291 sortColumnsElem.appendChild( columnElem );
293 composerTableElem.appendChild( sortColumnsElem );
294 elem.appendChild( composerTableElem );
301 if ( itemElem.isNull() )
309 int composerMapId = itemElem.attribute(
"composerMap",
"-1" ).toInt();
310 if ( composerMapId == -1 )
325 QString layerId = itemElem.attribute(
"vectorLayer",
"not_existing" );
326 if ( layerId ==
"not_existing" )
341 QDomNodeList displayAttributeList = itemElem.elementsByTagName(
"displayAttributes" );
342 if ( displayAttributeList.size() > 0 )
344 QDomElement displayAttributesElem = displayAttributeList.at( 0 ).toElement();
345 QDomNodeList attributeEntryList = displayAttributesElem.elementsByTagName(
"attributeEntry" );
346 for (
int i = 0; i < attributeEntryList.size(); ++i )
348 QDomElement attributeEntryElem = attributeEntryList.at( i ).toElement();
349 int index = attributeEntryElem.attribute(
"index",
"-1" ).toInt();
359 QDomNodeList aliasMapNodeList = itemElem.elementsByTagName(
"attributeAliasMap" );
360 if ( aliasMapNodeList.size() > 0 )
362 QDomElement attributeAliasMapElem = aliasMapNodeList.at( 0 ).toElement();
363 QDomNodeList aliasMepEntryList = attributeAliasMapElem.elementsByTagName(
"aliasEntry" );
364 for (
int i = 0; i < aliasMepEntryList.size(); ++i )
366 QDomElement aliasEntryElem = aliasMepEntryList.at( i ).toElement();
367 int key = aliasEntryElem.attribute(
"key",
"-1" ).toInt();
368 QString value = aliasEntryElem.attribute(
"value",
"" );
375 QDomElement sortColumnsElem = itemElem.firstChildElement(
"sortColumns" );
376 if ( !sortColumnsElem.isNull() )
378 QDomNodeList columns = sortColumnsElem.elementsByTagName(
"column" );
379 for (
int i = 0; i < columns.size(); ++i )
381 QDomElement columnElem = columns.at( i ).toElement();
382 int attribute = columnElem.attribute(
"index" ).toInt();
383 bool ascending = columnElem.attribute(
"ascending" ) ==
"true" ?
true :
false;