Skip to content

Commit

Permalink
Merge pull request #2297 from nirvn/fix_recent_project_sort
Browse files Browse the repository at this point in the history
[welcome page] fix sorting of recent projects on startup
  • Loading branch information
NathanW2 committed Sep 8, 2015
2 parents 94badce + 4c81803 commit c3a1415
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,12 +1174,20 @@ void QgisApp::readSettings()
settings.endGroup();

settings.beginGroup( "/UI/recentProjects" );
QStringList projectKeys = settings.childGroups();
QStringList projectKeysList = settings.childGroups();

Q_FOREACH ( const QString& key, projectKeys )
//convert list to int values to obtain proper order
QList<int> projectKeys;
Q_FOREACH ( const QString& key, projectKeysList )
{
projectKeys.append( key.toInt() );
}
qSort( projectKeys );

Q_FOREACH ( const int& key, projectKeys )
{
QgsWelcomePageItemsModel::RecentProjectData data;
settings.beginGroup( key );
settings.beginGroup( QString::number( key ) );
data.title = settings.value( "title" ).toString();
data.path = settings.value( "path" ).toString();
data.previewImagePath = settings.value( "previewImage" ).toString();
Expand Down Expand Up @@ -10758,4 +10766,3 @@ LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
return EXCEPTION_EXECUTE_HANDLER;
}
#endif

0 comments on commit c3a1415

Please sign in to comment.