Skip to content
Permalink
Browse files

Fix datum transform dialog sometimes does not correct respond

to changes in the available transform table

Sponsored by ICSM
  • Loading branch information
nyalldawson committed Mar 12, 2019
1 parent eab08d0 commit f0f825ac996196ea3bfe5ae59dfabf68497df0c8
Showing with 22 additions and 6 deletions.
  1. +22 −6 src/gui/qgsdatumtransformdialog.cpp
@@ -82,6 +82,7 @@ void QgsDatumTransformDialog::load( QPair<int, int> selectedDatumTransforms )
mDatumTransformTableWidget->setRowCount( 0 );

int row = 0;
int preferredInitialRow = -1;

for ( const QgsDatumTransform::TransformPair &transform : qgis::as_const( mDatumTransforms ) )
{
@@ -111,6 +112,12 @@ void QgsDatumTransformDialog::load( QPair<int, int> selectedDatumTransforms )
item->setForeground( QBrush( QColor( 255, 0, 0 ) ) );
}

if ( info.preferred && !info.deprecated && preferredInitialRow < 0 )
{
// try to select a "preferred" entry by default
preferredInitialRow = row;
}

QString toolTipString;
if ( gridShiftTransformation( item->text() ) )
{
@@ -158,9 +165,12 @@ void QgsDatumTransformDialog::load( QPair<int, int> selectedDatumTransforms )
row++;
}

if ( mDatumTransformTableWidget->currentRow() < 0 )
mDatumTransformTableWidget->selectRow( preferredInitialRow >= 0 ? preferredInitialRow : 0 );

mDatumTransformTableWidget->resizeColumnsToContents();

setOKButtonEnabled();
tableCurrentItemChanged( nullptr, nullptr );
}

void QgsDatumTransformDialog::setOKButtonEnabled()
@@ -269,12 +279,18 @@ void QgsDatumTransformDialog::tableCurrentItemChanged( QTableWidgetItem *, QTabl
{
int row = mDatumTransformTableWidget->currentRow();
if ( row < 0 )
return;
{
mLabelSrcDescription->clear();
mLabelDstDescription->clear();
}
else
{

QTableWidgetItem *srcItem = mDatumTransformTableWidget->item( row, 0 );
mLabelSrcDescription->setText( srcItem ? srcItem->toolTip() : QString() );
QTableWidgetItem *destItem = mDatumTransformTableWidget->item( row, 1 );
mLabelDstDescription->setText( destItem ? destItem->toolTip() : QString() );
QTableWidgetItem *srcItem = mDatumTransformTableWidget->item( row, 0 );
mLabelSrcDescription->setText( srcItem ? srcItem->toolTip() : QString() );
QTableWidgetItem *destItem = mDatumTransformTableWidget->item( row, 1 );
mLabelDstDescription->setText( destItem ? destItem->toolTip() : QString() );
}

setOKButtonEnabled();
}

0 comments on commit f0f825a

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