Skip to content
Permalink
Browse files

Avoid translated name for fields when creating a new gpkg layer (#6058)

  • Loading branch information
DelazJ authored and nirvn committed Jan 14, 2018
1 parent 31d8dea commit c4aa4d076b4cea03592f6b1a94f0eb25b975cbf2
Showing with 45 additions and 33 deletions.
  1. +6 −5 src/gui/qgsnewgeopackagelayerdialog.cpp
  2. +39 −28 src/ui/qgsnewgeopackagelayerdialogbase.ui
@@ -30,6 +30,7 @@
#include "qgssettings.h"
#include "qgshelp.h"
#include "qgsogrutils.h"
#include "qgsgui.h"

#include <QPushButton>
#include <QLineEdit>
@@ -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 );
@@ -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" ) ) );

@@ -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 );

@@ -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..." ) );
@@ -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 )
@@ -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>
@@ -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>
@@ -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">
@@ -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>
@@ -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">
@@ -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>
@@ -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>
@@ -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>
@@ -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">
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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">
@@ -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">
@@ -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"/>

0 comments on commit c4aa4d0

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