Skip to content

Commit

Permalink
Scroll the tree view of srs to ensure that search results are visible
Browse files Browse the repository at this point in the history
Sort the results from the sqlite srs query to make best use of the caching
when populating the tree widget


git-svn-id: http://svn.osgeo.org/qgis/trunk@4645 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Jan 11, 2006
1 parent 6774759 commit 2bc9016
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/widgets/projectionselector/qgsprojectionselector.cpp
Expand Up @@ -61,7 +61,10 @@ void QgsProjectionSelector::setSelectedSRSName(QString theSRSNAme)
QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems(theSRSNAme, Qt::MatchExactly|Qt::MatchRecursive, 0);

if (nodes.count() == 1)
{
lstCoordinateSystems->setCurrentItem(nodes.first());
lstCoordinateSystems->scrollToItem(nodes.first());
}
else // unselect the selected item to avoid confusing the user
{
if (lstCoordinateSystems->currentItem() != NULL)
Expand All @@ -77,7 +80,10 @@ void QgsProjectionSelector::setSelectedSRSID(long theSRSID)
QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems(mySRSIDString, Qt::MatchExactly|Qt::MatchRecursive, 1);

if (nodes.count() == 1)
{
lstCoordinateSystems->setCurrentItem(nodes.first());
lstCoordinateSystems->scrollToItem(nodes.first());
}
else // unselect the selected item to avoid confusing the user
{
if (lstCoordinateSystems->currentItem() != NULL)
Expand Down Expand Up @@ -407,7 +413,7 @@ void QgsProjectionSelector::getProjList()
// Set up the query to retreive the projection information needed to populate the list
//note I am giving the full field names for clarity here and in case someown
//changes the underlying view TS
sql = "select description,srs_id,is_geo, name,parameters from vw_srs";
sql = "select description,srs_id,is_geo, name,parameters from vw_srs order by name, description";
#ifdef QGISDEBUG
std::cout << "SQL for projection list:\n" << sql.toLocal8Bit().data() << std::endl;
#endif
Expand Down Expand Up @@ -565,6 +571,8 @@ void QgsProjectionSelector::coordinateSystemSelected( QTreeWidgetItem * theItem)
myDescription+=(myProjString);
}
teProjection->setText(myDescription);
// This call seems not to work????
lstCoordinateSystems->scrollToItem(theItem);
}
else
teProjection->setText("");
Expand Down

0 comments on commit 2bc9016

Please sign in to comment.