Navigation Menu

Skip to content

Commit

Permalink
Avoid translated name for fields when creating a new gpkg layer (#6058)
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ authored and nirvn committed Jan 14, 2018
1 parent 31d8dea commit c4aa4d0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 33 deletions.
11 changes: 6 additions & 5 deletions src/gui/qgsnewgeopackagelayerdialog.cpp
Expand Up @@ -30,6 +30,7 @@
#include "qgssettings.h"
#include "qgshelp.h"
#include "qgsogrutils.h"
#include "qgsgui.h"

#include <QPushButton>
#include <QLineEdit>
Expand All @@ -47,6 +48,8 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W
: QDialog( parent, fl )
{
setupUi( this );
QgsGui::instance()->enableAutoGeometryRestore( this );

connect( mAddAttributeButton, &QToolButton::clicked, this, &QgsNewGeoPackageLayerDialog::mAddAttributeButton_clicked );
connect( mRemoveAttributeButton, &QToolButton::clicked, this, &QgsNewGeoPackageLayerDialog::mRemoveAttributeButton_clicked );
connect( mFieldTypeBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsNewGeoPackageLayerDialog::mFieldTypeBox_currentIndexChanged );
Expand All @@ -58,9 +61,6 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsNewGeoPackageLayerDialog::buttonBox_rejected );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsNewGeoPackageLayerDialog::showHelp );

QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/NewGeoPackageLayer/geometry" ) ).toByteArray() );

mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewAttribute.svg" ) ) );
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) );

Expand All @@ -84,6 +84,8 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W
mGeometryWithZCheckBox->setEnabled( false );
mGeometryWithMCheckBox->setEnabled( false );
mGeometryColumnEdit->setEnabled( false );
mGeometryColumnEdit->setText( "geometry" );
mFeatureIdColumnEdit->setText( "fid" );
mCheckBoxCreateSpatialIndex->setEnabled( false );
mCrsSelector->setEnabled( false );

Expand All @@ -106,6 +108,7 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W

mCheckBoxCreateSpatialIndex->setChecked( true );

QgsSettings settings;
mDatabase->setStorageMode( QgsFileWidget::SaveFile );
mDatabase->setFilter( tr( "GeoPackage" ) + " (*.gpkg)" );
mDatabase->setDialogTitle( tr( "Select Existing or Create a New GeoPackage Database File..." ) );
Expand All @@ -127,8 +130,6 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W

QgsNewGeoPackageLayerDialog::~QgsNewGeoPackageLayerDialog()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/NewGeoPackageLayer/geometry" ), saveGeometry() );
}

void QgsNewGeoPackageLayerDialog::setCrs( const QgsCoordinateReferenceSystem &crs )
Expand Down
67 changes: 39 additions & 28 deletions src/ui/qgsnewgeopackagelayerdialogbase.ui
Expand Up @@ -66,10 +66,7 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_51">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6"/>
</item>
<item row="4" column="0">
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>New field</string>
Expand All @@ -83,6 +80,12 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="mFieldLengthLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Maximum length</string>
</property>
Expand Down Expand Up @@ -144,9 +147,9 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QgsFileWidget" name="mDatabase">
Expand All @@ -163,7 +166,7 @@
</item>
</layout>
</item>
<item row="3" column="0">
<item row="2" column="0">
<widget class="QLabel" name="mGeometryTypeLabel">
<property name="enabled">
<bool>true</bool>
Expand All @@ -173,7 +176,7 @@
</property>
</widget>
</item>
<item row="2" column="2">
<item row="1" column="1">
<widget class="QLineEdit" name="mTableNameEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
Expand All @@ -186,7 +189,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="0">
<widget class="QLabel" name="mDatabaseLabel">
<property name="enabled">
<bool>true</bool>
Expand All @@ -196,7 +199,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="mTableNameLabel">
<property name="text">
<string>Table name</string>
Expand All @@ -206,7 +209,7 @@
</property>
</widget>
</item>
<item row="3" column="2">
<item row="2" column="1">
<widget class="QComboBox" name="mGeometryTypeBox">
<property name="enabled">
<bool>true</bool>
Expand All @@ -222,7 +225,7 @@
</property>
</widget>
</item>
<item row="4" column="2">
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalZMLayout">
<item>
<widget class="QCheckBox" name="mGeometryWithZCheckBox">
Expand All @@ -238,9 +241,22 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="5" column="2">
<item row="4" column="1">
<widget class="QgsProjectionSelectionWidget" name="mCrsSelector" native="true">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
Expand All @@ -249,7 +265,7 @@
</item>
</layout>
</item>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Fields list</string>
Expand Down Expand Up @@ -328,7 +344,7 @@
</layout>
</widget>
</item>
<item row="6" column="0">
<item row="5" column="0">
<widget class="QgsCollapsibleGroupBox" name="groupBox" native="true">
<property name="title" stdset="0">
<string>Advanced options</string>
Expand Down Expand Up @@ -363,7 +379,7 @@
<item row="2" column="0">
<widget class="QLabel" name="mLayerDescriptionLabel">
<property name="text">
<string>Layer description</string>
<string>Layer description</string>
</property>
<property name="buddy">
<cstring>mLayerIdentifierEdit</cstring>
Expand Down Expand Up @@ -404,9 +420,6 @@
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Name of the feature id column&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>fid</string>
</property>
</widget>
</item>
<item row="4" column="0">
Expand All @@ -430,9 +443,6 @@
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Name of the geometry column&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>geometry</string>
</property>
</widget>
</item>
<item row="5" column="2">
Expand Down Expand Up @@ -477,21 +487,22 @@
</customwidgets>
<tabstops>
<tabstop>scrollArea</tabstop>
<tabstop>mDatabase</tabstop>
<tabstop>mTableNameEdit</tabstop>
<tabstop>mLayerIdentifierEdit</tabstop>
<tabstop>mLayerDescriptionEdit</tabstop>
<tabstop>mFeatureIdColumnEdit</tabstop>
<tabstop>mGeometryTypeBox</tabstop>
<tabstop>mGeometryColumnEdit</tabstop>
<tabstop>mGeometryWithZCheckBox</tabstop>
<tabstop>mGeometryWithMCheckBox</tabstop>
<tabstop>mCrsSelector</tabstop>
<tabstop>mCheckBoxCreateSpatialIndex</tabstop>
<tabstop>mFieldNameEdit</tabstop>
<tabstop>mFieldTypeBox</tabstop>
<tabstop>mFieldLengthEdit</tabstop>
<tabstop>mAddAttributeButton</tabstop>
<tabstop>mAttributeView</tabstop>
<tabstop>mRemoveAttributeButton</tabstop>
<tabstop>mLayerIdentifierEdit</tabstop>
<tabstop>mLayerDescriptionEdit</tabstop>
<tabstop>mFeatureIdColumnEdit</tabstop>
<tabstop>mGeometryColumnEdit</tabstop>
<tabstop>mCheckBoxCreateSpatialIndex</tabstop>
</tabstops>
<resources>
<include location="../../images/images.qrc"/>
Expand Down

0 comments on commit c4aa4d0

Please sign in to comment.