Hello Devels,<br><br>I am inserting a bookmark in a folder with name folderName which is stored in GeoDataDocument inside BookmarkManager class(submitted a patch to reviewboard). Please suggest me how can I do that.<br><br>
I tried it with the following approach but I realized that it have some really big bugs. In my approach I used folders() function of GeoDataContainer which will return a QVector having all the folders. Then I compared with the name and when it matched append bookmark( which is GeoDataPlacemark ) in the folder.<br>
wrote following code for that :<br><br>void BookmarkManager::addBookmark( const GeoDataPlacemark &bookmark, const QString &folderName )<br>{<br> QVector<GeoDataFolder> bookmarkFolders = folders();<br> QVector<GeoDataFolder>::const_iterator i = bookmarkFolders.constBegin();<br>
QVector<GeoDataFolder>::const_iterator end = bookmarkFolders.constEnd();<br><br> for (; i != end; ++i ) {<br> //Folder found where bookmark should be inserted<br> if( !folderName.compare( i->name() ) ){<br>
// i->append(bookmark); uncommenting gives compiler error<br> break;<br> }<br> }<br>}<br><br>QVector<GeoDataFolder> BookmarkManager::folders() const<br>{<br> return d->m_bookmarkDocument->folders();<br>
}<br><br>The problem I see is folders() function creates a local copy of QVector and return that. so adding bookmark to that folder might not work since it is local copy. So please tell me what should I do and why I am getting compiler error when I uncomment the line.<br>
<br>The one way I can think of is declare m_vector as a QVector having pointer to GeoDataFeature ( QVector<GeoDataFeature*> m_vector ) so I can add more child nodes ( like placemarks in folders ) from outside and the changes can be reflected in document. Please suggest me and let me know if I'm not clear with my problem.<br>
<br clear="all"><br>Thanks,<br>Gaurav Gupta<br>Final Year Undergraduate<br>IT BHU<br>GSOC 10 KDE marble<br>Email : <a href="mailto:1989.gaurav@gmail.com">1989.gaurav@gmail.com</a><br> <a href="mailto:gaurav.gupta@acm.org">gaurav.gupta@acm.org</a><br>