Skip to content
Permalink
Browse files

fix #8298 ignored first selection of recently used CRS in projection …

…selector
  • Loading branch information
mwa committed Mar 26, 2014
1 parent 19da71c commit abc7b9b807a222a3331ed73197b73067c7b50851
Showing with 29 additions and 8 deletions.
  1. +6 −0 src/app/qgsprojectproperties.cpp
  2. +19 −7 src/gui/qgsprojectionselector.cpp
  3. +4 −1 src/gui/qgsprojectionselector.h
@@ -602,6 +602,12 @@ void QgsProjectProperties::apply()
if ( srs.mapUnits() != QGis::UnknownUnit )
mMapCanvas->setMapUnits( srs.mapUnits() );
}

if ( cbxProjectionEnabled->isChecked() )
{
// mark selected projection for push to front
projectionSelector->pushProjectionToFront();
}
}

// Set the project title
@@ -32,11 +32,17 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name,
, mUserProjListDone( false )
, mRecentProjListDone( false )
, mSearchColumn( NONE )
, mSkipFirstRecent( true )
, mPushProjectionToFront( false )
{
Q_UNUSED( name );
setupUi( this );

if ( qobject_cast<QDialog*>( parent ) )
{
// mark selected projection for push to front if parent dialog is accepted
connect( parent, SIGNAL( accepted() ), this, SLOT( pushProjectionToFront() ) );
}

// Get the full path name to the sqlite3 spatial reference database.
mSrsDatabaseFileName = QgsApplication::srsDbFilePath();

@@ -94,6 +100,11 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name,

QgsProjectionSelector::~QgsProjectionSelector()
{
if ( !mPushProjectionToFront )
{
return;
}

// Push current projection to front, only if set
long crsId = selectedCrsId();
if ( crsId == 0 )
@@ -750,12 +761,6 @@ void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *cu
{
QgsDebugMsg( "Entered." );

if ( mSkipFirstRecent )
{
mSkipFirstRecent = false;
return;
}

if ( !current )
{
QgsDebugMsg( "no current item" );
@@ -862,6 +867,13 @@ void QgsProjectionSelector::on_leSearch_textChanged( const QString & theFilterTx
}


void QgsProjectionSelector::pushProjectionToFront()
{
// set flag to push selected projection to front in destructor
mPushProjectionToFront = true;
}


long QgsProjectionSelector::getLargestCRSIDMatch( QString theSql )
{
long srsId = 0;
@@ -104,6 +104,9 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti
void on_cbxHideDeprecated_stateChanged();
void on_leSearch_textChanged( const QString & );

//! mark selected projection for push to front
void pushProjectionToFront();

protected:
/** Used to ensure the projection list view is actually populated */
void showEvent( QShowEvent * theEvent );
@@ -181,7 +184,7 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti
int mSearchColumn;
QString mSearchValue;

bool mSkipFirstRecent;
bool mPushProjectionToFront;

//! The set of OGC WMS CRSs that want to be applied to this widget
QSet<QString> mCrsFilter;

0 comments on commit abc7b9b

Please sign in to comment.
You can’t perform that action at this time.