Skip to content
Permalink
Browse files

Allow columns to be resized in datum transformation table

Fixes #39169
  • Loading branch information
nyalldawson committed Oct 8, 2020
1 parent ec2cc48 commit 1cd5a3358b235f67b6b4d95331ce561e9f8cb715
Showing with 13 additions and 2 deletions.
  1. +12 −2 src/app/qgsdatumtransformtablewidget.cpp
  2. +1 −0 src/app/qgsdatumtransformtablewidget.h
@@ -18,7 +18,7 @@
#include "qgscoordinatetransform.h"
#include "qgsdatumtransformdialog.h"
#include "qgisapp.h"

#include "qgssettings.h"

QgsDatumTransformTableModel::QgsDatumTransformTableModel( QObject *parent )
: QAbstractTableModel( parent )
@@ -231,11 +231,15 @@ QgsDatumTransformTableWidget::QgsDatumTransformTableWidget( QWidget *parent )

mTableView->setModel( mModel );
mTableView->resizeColumnToContents( 0 );
mTableView->horizontalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
mTableView->horizontalHeader()->setSectionResizeMode( QHeaderView::Interactive );
mTableView->horizontalHeader()->show();
mTableView->setSelectionMode( QAbstractItemView::SingleSelection );
mTableView->setSelectionBehavior( QAbstractItemView::SelectRows );
mTableView->setAlternatingRowColors( true );

QgsSettings settings;
mTableView->horizontalHeader()->restoreState( settings.value( QStringLiteral( "Windows/DatumTransformTable/headerState" ) ).toByteArray() );

connect( mAddButton, &QToolButton::clicked, this, &QgsDatumTransformTableWidget::addDatumTransform );
connect( mRemoveButton, &QToolButton::clicked, this, &QgsDatumTransformTableWidget::removeDatumTransform );
connect( mEditButton, &QToolButton::clicked, this, [ = ]
@@ -256,6 +260,12 @@ QgsDatumTransformTableWidget::QgsDatumTransformTableWidget( QWidget *parent )
mEditButton->setEnabled( false );
}

QgsDatumTransformTableWidget::~QgsDatumTransformTableWidget()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/DatumTransformTable/headerState" ), mTableView->horizontalHeader()->saveState() );
}

void QgsDatumTransformTableWidget::addDatumTransform()
{
QgsDatumTransformDialog dlg( QgsCoordinateReferenceSystem(), QgsCoordinateReferenceSystem(), true, false, false, QPair< int, int >(), nullptr, Qt::WindowFlags(), QString(), QgisApp::instance()->mapCanvas() );
@@ -81,6 +81,7 @@ class APP_EXPORT QgsDatumTransformTableWidget : public QWidget, private Ui::QgsD

public:
explicit QgsDatumTransformTableWidget( QWidget *parent = nullptr );
~QgsDatumTransformTableWidget() override;

void setTransformContext( const QgsCoordinateTransformContext &context )
{

0 comments on commit 1cd5a33

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