Skip to content
Permalink
Browse files

[projection selector] apply selected projection on double click

  • Loading branch information
nirvn committed Dec 14, 2015
1 parent 576875e commit 84d2e954bce8c56ea81e7a03eef5fd8fb588ddbd
@@ -105,4 +105,7 @@ class QgsProjectionSelector : QWidget
//! Notify others that the widget is now fully initialized, including deferred selection of projection
//! @note added in 2.4
void initialized();
//! Apply projection on double click
//! @note added in 2.14
void projectionDoubleClicked();
};
@@ -36,6 +36,9 @@ QgsGenericProjectionSelector::QgsGenericProjectionSelector( QWidget *parent,

//we will show this only when a message is set
textEdit->hide();

//apply selected projection upon double click on item
connect( projectionSelector, SIGNAL( projectionDoubleClicked() ), this, SLOT( accept() ) );
}

void QgsGenericProjectionSelector::setMessage( QString theMessage )
@@ -18,6 +18,7 @@
#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsmessagelog.h"

//qt includes
#include <QFileInfo>
@@ -718,6 +719,24 @@ void QgsProjectionSelector::on_lstCoordinateSystems_currentItemChanged( QTreeWid
}
}

void QgsProjectionSelector::on_lstCoordinateSystems_itemDoubleClicked( QTreeWidgetItem *current, int column )
{
Q_UNUSED( column );

QgsDebugMsg( "Entered." );

if ( !current )
{
QgsDebugMsg( "no current item" );
return;
}

// If the item has children, it's not an end node in the tree, and
// hence is just a grouping thingy, not an actual CRS.
if ( current->childCount() == 0 )
emit projectionDoubleClicked();
}

void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem * )
{
QgsDebugMsg( "Entered." );
@@ -735,6 +754,23 @@ void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *cu
lstCoordinateSystems->setCurrentItem( nodes.first() );
}

void QgsProjectionSelector::on_lstRecent_itemDoubleClicked( QTreeWidgetItem *current, int column )
{
Q_UNUSED( column );

QgsDebugMsg( "Entered." );

if ( !current )
{
QgsDebugMsg( "no current item" );
return;
}

QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems( current->text( QGIS_CRS_ID_COLUMN ), Qt::MatchExactly | Qt::MatchRecursive, QGIS_CRS_ID_COLUMN );
if ( !nodes.isEmpty() )
emit projectionDoubleClicked();
}

void QgsProjectionSelector::hideDeprecated( QTreeWidgetItem *item )
{
if ( item->data( 0, Qt::UserRole ).toBool() )
@@ -100,7 +100,9 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti
*/
void setOgcWmsCrsFilter( const QSet<QString>& crsFilter );
void on_lstCoordinateSystems_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev );
void on_lstCoordinateSystems_itemDoubleClicked( QTreeWidgetItem *current, int column );
void on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *prev );
void on_lstRecent_itemDoubleClicked( QTreeWidgetItem *current, int column );
void on_cbxHideDeprecated_stateChanged();
void on_leSearch_textChanged( const QString & );

@@ -208,6 +210,9 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti
//! Notify others that the widget is now fully initialized, including deferred selection of projection
//! @note added in 2.4
void initialized();
//! Apply projection on double click
//! @note added in 2.14
void projectionDoubleClicked();
};

#endif

0 comments on commit 84d2e95

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