Skip to content

Commit c3c945b

Browse files
committed
[bookmark] use preset values instead of header name for tags when exporting in xml file
1 parent f2f4a39 commit c3c945b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/app/qgsbookmarks.cpp

+13-9
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,13 @@ void QgsBookmarks::importFromXML()
299299
for ( int i = 0;i < nodeList.count(); i++ )
300300
{
301301
QDomNode bookmark = nodeList.at( i );
302-
QDomElement name = bookmark.firstChildElement( "Name" );
303-
QDomElement prjname = bookmark.firstChildElement( "Project" );
304-
QDomElement xmin = bookmark.firstChildElement( "xMin" );
305-
QDomElement xmax = bookmark.firstChildElement( "xMax" );
306-
QDomElement ymin = bookmark.firstChildElement( "yMin" );
307-
QDomElement ymax = bookmark.firstChildElement( "yMax" );
308-
QDomElement srid = bookmark.firstChildElement( "SRID" );
302+
QDomElement name = bookmark.firstChildElement( "name" );
303+
QDomElement prjname = bookmark.firstChildElement( "project" );
304+
QDomElement xmin = bookmark.firstChildElement( "xmin" );
305+
QDomElement xmax = bookmark.firstChildElement( "xmax" );
306+
QDomElement ymin = bookmark.firstChildElement( "ymin" );
307+
QDomElement ymax = bookmark.firstChildElement( "ymax" );
308+
QDomElement srid = bookmark.firstChildElement( "sr_id" );
309309

310310
queries += "INSERT INTO tbl_bookmarks(bookmark_id,name,project_name,xmin,ymin,xmax,ymax,projection_srid)"
311311
" VALUES (NULL,"
@@ -364,6 +364,10 @@ void QgsBookmarks::exportToXML()
364364
int rowCount = lstBookmarks->model()->rowCount();
365365
int colCount = lstBookmarks->model()->columnCount();
366366

367+
QList<QString> headerList;
368+
headerList << "id" << "name" << "project" << "xmin"
369+
<< "ymin" << "xmax" << "ymax" << "sr_id";
370+
367371
for ( int i = 0; i < rowCount; ++i )
368372
{
369373
QDomElement bookmark = doc.createElement( "bookmark" );
@@ -375,8 +379,8 @@ void QgsBookmarks::exportToXML()
375379
{
376380
QString value = idx.data( Qt::DisplayRole ).toString();
377381
QDomText idText = doc.createTextNode( value );
378-
QVariant header = lstBookmarks->model()->headerData( j, Qt::Horizontal );
379-
QDomElement id = doc.createElement( header.toString() );
382+
QString header = headerList.at( j );
383+
QDomElement id = doc.createElement( header );
380384
id.appendChild( idText );
381385
bookmark.appendChild( id );
382386
}

0 commit comments

Comments
 (0)