Skip to content
Permalink
Browse files

Don't force users to make a choice in the datum transform dialog

It's possible to get a situation where none of the options can be
selected, because they all require a grid which isn't available on
the system. So always allow users to close the dialog to dismiss it
(which has the same effect as picking the default selection from
the dialog when possible, or giving null transforms if NO transforms
are available at all...)

Fixes #34234
  • Loading branch information
nyalldawson committed Feb 4, 2020
1 parent 941f59f commit 644a5525ec08a77b4c703a7066c94802bbfa1036
@@ -27,8 +27,9 @@ QgsDatumTransformTableModel::QgsDatumTransformTableModel( QObject *parent )

void QgsDatumTransformTableModel::setTransformContext( const QgsCoordinateTransformContext &context )
{
beginResetModel();
mTransformContext = context;
reset();
endResetModel();
}

void QgsDatumTransformTableModel::removeTransform( const QModelIndexList &indexes )
@@ -47,8 +48,9 @@ void QgsDatumTransformTableModel::removeTransform( const QModelIndexList &indexe
}
if ( sourceCrs.isValid() && destinationCrs.isValid() )
{
beginResetModel();
mTransformContext.removeCoordinateOperation( sourceCrs, destinationCrs );
reset();
endResetModel();
break;
}
}
@@ -282,7 +284,7 @@ void QgsDatumTransformTableWidget::editDatumTransform( const QModelIndex &index
#endif

#if PROJ_VERSION_MAJOR>=6
if ( sourceCrs.isValid() && destinationCrs.isValid() && !proj.isEmpty() )
if ( sourceCrs.isValid() && destinationCrs.isValid() )
#else
if ( sourceCrs.isValid() && destinationCrs.isValid() &&
( sourceTransform != -1 || destinationTransform != -1 ) )
@@ -44,7 +44,7 @@ bool QgsDatumTransformDialog::run( const QgsCoordinateReferenceSystem &sourceCrs
return true;
}

QgsDatumTransformDialog dlg( sourceCrs, destinationCrs, false, true, true, qMakePair( -1, -1 ), parent, nullptr, QString(), mapCanvas );
QgsDatumTransformDialog dlg( sourceCrs, destinationCrs, false, true, false, qMakePair( -1, -1 ), parent, nullptr, QString(), mapCanvas );
if ( !windowTitle.isEmpty() )
dlg.setWindowTitle( windowTitle );

@@ -75,7 +75,7 @@ class GUI_EXPORT QgsDatumTransformDialog : public QDialog, private Ui::QgsDatumT
QgsMapCanvas *mapCanvas = nullptr,
const QString &windowTitle = QString() );

// TODO QGIS 4.0 - remove selectedDatumTransform
// TODO QGIS 4.0 - remove selectedDatumTransform, forceChoice

/**
* Constructor for QgsDatumTransformDialog.

0 comments on commit 644a552

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