mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
use QgsProjectionSelectionWidget rather than buttons
This commit is contained in:
parent
fec7c705ff
commit
eb71750f00
@ -23,6 +23,7 @@
|
||||
#include "qgsproject.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QPushButton>
|
||||
|
||||
QgsDatumTransformDialog::QgsDatumTransformDialog( QgsCoordinateReferenceSystem sourceCrs,
|
||||
QgsCoordinateReferenceSystem destinationCrs,
|
||||
@ -34,8 +35,8 @@ QgsDatumTransformDialog::QgsDatumTransformDialog( QgsCoordinateReferenceSystem s
|
||||
connect( mHideDeprecatedCheckBox, &QCheckBox::stateChanged, this, &QgsDatumTransformDialog::mHideDeprecatedCheckBox_stateChanged );
|
||||
connect( mDatumTransformTreeWidget, &QTreeWidget::currentItemChanged, this, &QgsDatumTransformDialog::mDatumTransformTreeWidget_currentItemChanged );
|
||||
|
||||
connect( mSourceCrsButton, &QPushButton::clicked, this, &QgsDatumTransformDialog::setSourceCrs );
|
||||
connect( mDstCrsButton, &QPushButton::clicked, this, &QgsDatumTransformDialog::setDestinationCrs );
|
||||
connect( mSourceProjectionSelectionWidget, &QgsProjectionSelectionWidget::crsChanged, this, &QgsDatumTransformDialog::setSourceCrs );
|
||||
connect( mDestinationProjectionSelectionWidget, &QgsProjectionSelectionWidget::crsChanged, this, &QgsDatumTransformDialog::setDestinationCrs );
|
||||
|
||||
//get list of datum transforms
|
||||
mSourceCrs = sourceCrs;
|
||||
@ -44,7 +45,6 @@ QgsDatumTransformDialog::QgsDatumTransformDialog( QgsCoordinateReferenceSystem s
|
||||
|
||||
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||
|
||||
updateTitle();
|
||||
setOKButtonEnabled();
|
||||
|
||||
QgsSettings settings;
|
||||
@ -141,7 +141,7 @@ void QgsDatumTransformDialog::load()
|
||||
void QgsDatumTransformDialog::setOKButtonEnabled()
|
||||
{
|
||||
QTreeWidgetItem *item = mDatumTransformTreeWidget->currentItem();
|
||||
buttonBox->button( QDialogButtonBox::Ok )->setEnabled( mSourceCrs.isValid() && mDestinationCrs.isValid() && item );
|
||||
mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( mSourceCrs.isValid() && mDestinationCrs.isValid() && item );
|
||||
}
|
||||
|
||||
QgsDatumTransformDialog::~QgsDatumTransformDialog()
|
||||
@ -258,36 +258,18 @@ void QgsDatumTransformDialog::mDatumTransformTreeWidget_currentItemChanged( QTre
|
||||
setOKButtonEnabled();
|
||||
}
|
||||
|
||||
void QgsDatumTransformDialog::setSourceCrs()
|
||||
void QgsDatumTransformDialog::setSourceCrs( QgsCoordinateReferenceSystem sourceCrs )
|
||||
{
|
||||
QgsProjectionSelectionDialog *mySelector = new QgsProjectionSelectionDialog( this );
|
||||
if ( mySelector->exec() )
|
||||
{
|
||||
mSourceCrs = mySelector->crs();
|
||||
updateTitle();
|
||||
mDatumTransforms = QgsCoordinateTransform::datumTransformations( mSourceCrs, mDestinationCrs );
|
||||
load();
|
||||
}
|
||||
delete mySelector;
|
||||
mSourceCrs = sourceCrs;
|
||||
mDatumTransforms = QgsCoordinateTransform::datumTransformations( mSourceCrs, mDestinationCrs );
|
||||
load();
|
||||
setOKButtonEnabled();
|
||||
}
|
||||
|
||||
void QgsDatumTransformDialog::setDestinationCrs()
|
||||
void QgsDatumTransformDialog::setDestinationCrs( QgsCoordinateReferenceSystem destinationCrs )
|
||||
{
|
||||
QgsProjectionSelectionDialog *mySelector = new QgsProjectionSelectionDialog( this );
|
||||
if ( mySelector->exec() )
|
||||
{
|
||||
mDestinationCrs = mySelector->crs();
|
||||
updateTitle();
|
||||
mDatumTransforms = QgsCoordinateTransform::datumTransformations( mSourceCrs, mDestinationCrs );
|
||||
load();
|
||||
}
|
||||
delete mySelector;
|
||||
mDestinationCrs = destinationCrs;
|
||||
mDatumTransforms = QgsCoordinateTransform::datumTransformations( mSourceCrs, mDestinationCrs );
|
||||
load();
|
||||
setOKButtonEnabled();
|
||||
}
|
||||
|
||||
void QgsDatumTransformDialog::updateTitle()
|
||||
{
|
||||
mSourceCrsButton->setText( QStringLiteral( "%1 - %2" ).arg( mSourceCrs.authid(), mSourceCrs.isValid() ? mSourceCrs.description() : tr( "unknown" ) ) );
|
||||
mDstCrsButton->setText( QStringLiteral( "%1 - %2" ).arg( mDestinationCrs.authid(), mDestinationCrs.isValid() ? mDestinationCrs.description() : tr( "unknown" ) ) );
|
||||
}
|
||||
|
@ -57,11 +57,10 @@ class GUI_EXPORT QgsDatumTransformDialog : public QDialog, private Ui::QgsDatumT
|
||||
private slots:
|
||||
void mHideDeprecatedCheckBox_stateChanged( int state );
|
||||
void mDatumTransformTreeWidget_currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * );
|
||||
void setSourceCrs();
|
||||
void setDestinationCrs();
|
||||
void setSourceCrs( QgsCoordinateReferenceSystem sourceCrs );
|
||||
void setDestinationCrs( QgsCoordinateReferenceSystem destinationCrs );
|
||||
|
||||
private:
|
||||
void updateTitle();
|
||||
bool gridShiftTransformation( const QString &itemText ) const;
|
||||
//! Returns false if the location of the grid shift files is known (PROJ_LIB) and the shift file is not there
|
||||
bool testGridShiftFileAvailability( QTreeWidgetItem *item, int col ) const;
|
||||
|
@ -14,14 +14,7 @@
|
||||
<string>Select Datum Transformations</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Destination CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="mLabelSrcDescription">
|
||||
<property name="text">
|
||||
<string notr="true">Description</string>
|
||||
@ -34,47 +27,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Source CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="mSourceCrsButton">
|
||||
<property name="text">
|
||||
<string>source CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="mDstCrsButton">
|
||||
<property name="text">
|
||||
<string>destination CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QTreeWidget" name="mDatumTransformTreeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>src transform</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>dst transform</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="mLabelDstDescription">
|
||||
<property name="text">
|
||||
<string notr="true">Description</string>
|
||||
@ -112,7 +65,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<widget class="QDialogButtonBox" name="mButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -121,17 +74,71 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QTreeWidget" name="mDatumTransformTreeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>src transform</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>dst transform</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Source CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsProjectionSelectionWidget" name="mSourceProjectionSelectionWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Destination CRS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsProjectionSelectionWidget" name="mDestinationProjectionSelectionWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsProjectionSelectionWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgsprojectionselectionwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>mDatumTransformTreeWidget</tabstop>
|
||||
<tabstop>mHideDeprecatedCheckBox</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>mButtonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>mButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>QgsDatumTransformDialogBase</receiver>
|
||||
<slot>accept()</slot>
|
||||
@ -147,7 +154,7 @@
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>mButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>QgsDatumTransformDialogBase</receiver>
|
||||
<slot>reject()</slot>
|
||||
|
Loading…
x
Reference in New Issue
Block a user