Skip to content
Permalink
Browse files

Use a checkbox instead of tree item for "no projection" option

Makes this option more visible and easier to associate with the
old "OTF off" option
  • Loading branch information
nyalldawson committed Mar 7, 2017
1 parent 7dbe494 commit cc0007c380df1d94fc5caed71264182f31361ff0
@@ -65,8 +65,8 @@ QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget( QWidget *par

mRecentProjections = QgsCoordinateReferenceSystem::recentProjections();

mNoProjItem = new QTreeWidgetItem( lstCoordinateSystems, QStringList( tr( "No projection" ) ) );
mNoProjItem->setHidden( true );
mCheckBoxNoProjection->setHidden( true );
connect( mCheckBoxNoProjection, &QCheckBox::toggled, mFrameProjections, &QFrame::setDisabled );
}

QgsProjectionSelectionTreeWidget::~QgsProjectionSelectionTreeWidget()
@@ -273,10 +273,11 @@ void QgsProjectionSelectionTreeWidget::setCrs( const QgsCoordinateReferenceSyste
{
if ( !crs.isValid() )
{
lstCoordinateSystems->setCurrentItem( mNoProjItem );
mCheckBoxNoProjection->setChecked( true );
}
else
{
mCheckBoxNoProjection->setChecked( false );
applySelection( AuthidColumn, crs.authid() );
}
}
@@ -424,7 +425,7 @@ QString QgsProjectionSelectionTreeWidget::getSelectedExpression( const QString &

QgsCoordinateReferenceSystem QgsProjectionSelectionTreeWidget::crs() const
{
if ( lstCoordinateSystems->currentItem() == mNoProjItem )
if ( mCheckBoxNoProjection->isChecked() )
return QgsCoordinateReferenceSystem();

int srid = getSelectedExpression( QStringLiteral( "srs_id" ) ).toLong();
@@ -436,18 +437,18 @@ QgsCoordinateReferenceSystem QgsProjectionSelectionTreeWidget::crs() const

void QgsProjectionSelectionTreeWidget::setShowNoProjection( bool show )
{
mNoProjItem->setHidden( !show );
mCheckBoxNoProjection->setHidden( !show );
}

bool QgsProjectionSelectionTreeWidget::showNoProjection() const
{
return !mNoProjItem->isHidden();
return !mCheckBoxNoProjection->isHidden();
}

bool QgsProjectionSelectionTreeWidget::hasValidSelection() const
{
QTreeWidgetItem *item = lstCoordinateSystems->currentItem();
if ( item == mNoProjItem )
if ( mCheckBoxNoProjection->isChecked() )
return true;
else
return item && !item->text( QgisCrsIdColumn ).isEmpty();
@@ -213,8 +213,6 @@ class GUI_EXPORT QgsProjectionSelectionTreeWidget : public QWidget, private Ui::
QTreeWidgetItem *mGeoList = nullptr;
//! PROJCS node
QTreeWidgetItem *mProjList = nullptr;
//! "No projection" item
QTreeWidgetItem *mNoProjItem = nullptr;

//! Users custom coordinate system file
QString mCustomCsFile;

0 comments on commit cc0007c

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