Skip to content

Commit b4be39f

Browse files
DelazJnirvn
authored andcommittedJan 15, 2018
Avoid 'geometry' field name being translated when creating new SpatiaLite layer (#6059)
1 parent ded9b09 commit b4be39f

File tree

2 files changed

+43
-24
lines changed

2 files changed

+43
-24
lines changed
 

‎src/app/qgsnewspatialitelayerdialog.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "qgsspatialiteutils.h"
3232
#include "qgslogger.h"
3333
#include "qgssettings.h"
34+
#include "qgsgui.h"
3435

3536
#include <QPushButton>
3637
#include <QLineEdit>
@@ -44,6 +45,8 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
4445
: QDialog( parent, fl )
4546
{
4647
setupUi( this );
48+
QgsGui::instance()->enableAutoGeometryRestore( this );
49+
4750
connect( mAddAttributeButton, &QToolButton::clicked, this, &QgsNewSpatialiteLayerDialog::mAddAttributeButton_clicked );
4851
connect( mRemoveAttributeButton, &QToolButton::clicked, this, &QgsNewSpatialiteLayerDialog::mRemoveAttributeButton_clicked );
4952
connect( mGeometryTypeBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsNewSpatialiteLayerDialog::mGeometryTypeBox_currentIndexChanged );
@@ -53,9 +56,6 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
5356
connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsNewSpatialiteLayerDialog::buttonBox_accepted );
5457
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsNewSpatialiteLayerDialog::buttonBox_rejected );
5558

56-
QgsSettings settings;
57-
restoreGeometry( settings.value( QStringLiteral( "Windows/NewSpatiaLiteLayer/geometry" ) ).toByteArray() );
58-
5959
mGeometryTypeBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconTableLayer.svg" ) ), tr( "No geometry" ), QStringLiteral( "" ) );
6060
mGeometryTypeBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPointLayer.svg" ) ), tr( "Point" ), QStringLiteral( "POINT" ) );
6161
mGeometryTypeBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconLineLayer.svg" ) ), tr( "Line" ), QStringLiteral( "LINESTRING" ) );
@@ -68,6 +68,7 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
6868
mGeometryWithZCheckBox->setEnabled( false );
6969
mGeometryWithMCheckBox->setEnabled( false );
7070
leGeometryColumn->setEnabled( false );
71+
leGeometryColumn->setText( "geometry" );
7172

7273
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewAttribute.svg" ) ) );
7374
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) );
@@ -76,6 +77,7 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
7677
mTypeBox->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconFieldFloat.svg" ) ), tr( "Decimal number" ), "real" );
7778

7879
// Populate the database list from the stored connections
80+
QgsSettings settings;
7981
settings.beginGroup( QStringLiteral( "SpatiaLite/connections" ) );
8082
QStringList keys = settings.childGroups();
8183
QStringList::Iterator it = keys.begin();
@@ -112,8 +114,7 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
112114

113115
QgsNewSpatialiteLayerDialog::~QgsNewSpatialiteLayerDialog()
114116
{
115-
QgsSettings settings;
116-
settings.setValue( QStringLiteral( "Windows/NewSpatiaLiteLayer/geometry" ), saveGeometry() );
117+
117118
}
118119

119120
void QgsNewSpatialiteLayerDialog::mGeometryTypeBox_currentIndexChanged( int index )
@@ -502,4 +503,3 @@ void QgsNewSpatialiteLayerDialog::showHelp()
502503
{
503504
QgsHelp::openHelp( QStringLiteral( "managing_data_source/create_layers.html#creating-a-new-spatialite-layer" ) );
504505
}
505-

‎src/ui/qgsnewspatialitelayerdialogbase.ui

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>490</width>
9+
<width>470</width>
1010
<height>627</height>
1111
</rect>
1212
</property>
@@ -51,8 +51,8 @@
5151
<rect>
5252
<x>0</x>
5353
<y>0</y>
54-
<width>419</width>
55-
<height>598</height>
54+
<width>450</width>
55+
<height>560</height>
5656
</rect>
5757
</property>
5858
<layout class="QGridLayout" name="gridLayout_5">
@@ -124,7 +124,7 @@
124124
<cstring>mGeometryTypeBox</cstring>
125125
</property>
126126
</widget>
127-
</item>
127+
</item>
128128
<item row="2" column="1" colspan="2">
129129
<widget class="QComboBox" name="mGeometryTypeBox">
130130
<property name="enabled">
@@ -157,8 +157,21 @@
157157
</property>
158158
</widget>
159159
</item>
160-
</layout>
161-
</item>
160+
<item>
161+
<spacer name="horizontalSpacer_3">
162+
<property name="orientation">
163+
<enum>Qt::Horizontal</enum>
164+
</property>
165+
<property name="sizeHint" stdset="0">
166+
<size>
167+
<width>0</width>
168+
<height>20</height>
169+
</size>
170+
</property>
171+
</spacer>
172+
</item>
173+
</layout>
174+
</item>
162175
<item row="4" column="1" colspan="2">
163176
<layout class="QHBoxLayout" name="horizontalLayout_3">
164177
<item>
@@ -193,12 +206,12 @@
193206
</item>
194207
</layout>
195208
</item>
196-
<item row="5" colspan="3">
209+
<item row="5" column="0" colspan="3">
197210
<widget class="QGroupBox" name="groupBox1">
198211
<property name="title">
199212
<string>New field</string>
200213
</property>
201-
<layout class="QGridLayout" name="gridLayout">
214+
<layout class="QGridLayout" name="gridLayout_7">
202215
<item row="0" column="0">
203216
<widget class="QLabel" name="textLabel1">
204217
<property name="sizePolicy">
@@ -283,7 +296,7 @@
283296
</layout>
284297
</widget>
285298
</item>
286-
<item row="6" colspan="3">
299+
<item row="6" column="0" colspan="3">
287300
<widget class="QGroupBox" name="groupBox_2">
288301
<property name="title">
289302
<string>Fields list</string>
@@ -357,9 +370,9 @@
357370
</layout>
358371
</widget>
359372
</item>
360-
<item row="7" colspan="3">
361-
<widget class="QgsCollapsibleGroupBox" name="groupBox">
362-
<property name="title">
373+
<item row="7" column="0" colspan="3">
374+
<widget class="QgsCollapsibleGroupBox" name="groupBox" native="true">
375+
<property name="title" stdset="0">
363376
<string>Advanced options</string>
364377
</property>
365378
<property name="collapsed" stdset="0">
@@ -385,10 +398,7 @@
385398
</sizepolicy>
386399
</property>
387400
<property name="toolTip">
388-
<string>Name for the new layer</string>
389-
</property>
390-
<property name="text">
391-
<string>geometry</string>
401+
<string>Name of the geometry column</string>
392402
</property>
393403
</widget>
394404
</item>
@@ -432,21 +442,30 @@
432442
<header>qgsscrollarea.h</header>
433443
<container>1</container>
434444
</customwidget>
445+
<customwidget>
446+
<class>QgsCollapsibleGroupBox</class>
447+
<extends>QWidget</extends>
448+
<header>qgscollapsiblegroupbox.h</header>
449+
<container>1</container>
450+
</customwidget>
435451
</customwidgets>
436452
<tabstops>
437453
<tabstop>scrollArea</tabstop>
438454
<tabstop>mDatabaseComboBox</tabstop>
439455
<tabstop>toolButtonNewDatabase</tabstop>
440456
<tabstop>leLayerName</tabstop>
441-
<tabstop>leGeometryColumn</tabstop>
457+
<tabstop>mGeometryTypeBox</tabstop>
458+
<tabstop>mGeometryWithZCheckBox</tabstop>
459+
<tabstop>mGeometryWithMCheckBox</tabstop>
442460
<tabstop>leSRID</tabstop>
443461
<tabstop>pbnFindSRID</tabstop>
444-
<tabstop>checkBoxPrimaryKey</tabstop>
445462
<tabstop>mNameEdit</tabstop>
446463
<tabstop>mTypeBox</tabstop>
447464
<tabstop>mAddAttributeButton</tabstop>
448465
<tabstop>mAttributeView</tabstop>
449466
<tabstop>mRemoveAttributeButton</tabstop>
467+
<tabstop>leGeometryColumn</tabstop>
468+
<tabstop>checkBoxPrimaryKey</tabstop>
450469
</tabstops>
451470
<resources>
452471
<include location="../../images/images.qrc"/>

0 commit comments

Comments
 (0)
Please sign in to comment.