Skip to content

Commit 11c1f3a

Browse files
authoredDec 8, 2017
[need-docs] reorganize the new spatialite layer dialog (#5824)
1 parent 15e7d57 commit 11c1f3a

File tree

2 files changed

+142
-192
lines changed

2 files changed

+142
-192
lines changed
 

‎src/app/qgsnewspatialitelayerdialog.cpp

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ QgsNewSpatialiteLayerDialog::QgsNewSpatialiteLayerDialog( QWidget *parent, Qt::W
5555
QgsSettings settings;
5656
restoreGeometry( settings.value( QStringLiteral( "Windows/NewSpatiaLiteLayer/geometry" ) ).toByteArray() );
5757

58+
mGeometryTypeBox->addItem( tr( "Point" ), QStringLiteral( "POINT" ) );
59+
mGeometryTypeBox->addItem( tr( "Line" ), QStringLiteral( "LINE" ) );
60+
mGeometryTypeBox->addItem( tr( "Polygon" ), QStringLiteral( "POLYGON" ) );
61+
mGeometryTypeBox->addItem( tr( "MultiPoint" ), QStringLiteral( "MULTIPOINT" ) );
62+
mGeometryTypeBox->addItem( tr( "MultiLine" ), QStringLiteral( "MULTILINE" ) );
63+
mGeometryTypeBox->addItem( tr( "MultiPolygon" ), QStringLiteral( "MULTIPOLYGON" ) );
64+
5865
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewAttribute.svg" ) ) );
5966
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) );
6067
mTypeBox->addItem( tr( "Text data" ), "text" );
6168
mTypeBox->addItem( tr( "Whole number" ), "integer" );
6269
mTypeBox->addItem( tr( "Decimal number" ), "real" );
6370

64-
mPointRadioButton->setChecked( true );
6571
// Populate the database list from the stored connections
6672
settings.beginGroup( QStringLiteral( "SpatiaLite/connections" ) );
6773
QStringList keys = settings.childGroups();
@@ -137,33 +143,7 @@ void QgsNewSpatialiteLayerDialog::toolButtonNewDatabase_clicked()
137143

138144
QString QgsNewSpatialiteLayerDialog::selectedType() const
139145
{
140-
if ( mPointRadioButton->isChecked() )
141-
{
142-
return QStringLiteral( "POINT" );
143-
}
144-
else if ( mLineRadioButton->isChecked() )
145-
{
146-
return QStringLiteral( "LINESTRING" );
147-
}
148-
else if ( mPolygonRadioButton->isChecked() )
149-
{
150-
return QStringLiteral( "POLYGON" );
151-
}
152-
else if ( mMultipointRadioButton->isChecked() )
153-
{
154-
return QStringLiteral( "MULTIPOINT" );
155-
}
156-
else if ( mMultilineRadioButton->isChecked() )
157-
{
158-
return QStringLiteral( "MULTILINESTRING" );
159-
}
160-
else if ( mMultipolygonRadioButton->isChecked() )
161-
{
162-
return QStringLiteral( "MULTIPOLYGON" );
163-
}
164-
165-
Q_ASSERT( !"no type selected" );
166-
return QLatin1String( "" );
146+
return mGeometryTypeBox->currentData( Qt::UserRole ).toString();
167147
}
168148

169149
void QgsNewSpatialiteLayerDialog::checkOk()

‎src/ui/qgsnewspatialitelayerdialogbase.ui

Lines changed: 134 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -55,162 +55,93 @@
5555
<height>598</height>
5656
</rect>
5757
</property>
58-
<layout class="QVBoxLayout" name="verticalLayout">
59-
<item>
60-
<widget class="QGroupBox" name="buttonGroup1">
58+
<layout class="QGridLayout" name="gridLayout_5">
59+
<item row="0" column="0">
60+
<widget class="QLabel" name="mFileFormatLabel">
61+
<property name="enabled">
62+
<bool>true</bool>
63+
</property>
64+
<property name="text">
65+
<string>Database</string>
66+
</property>
67+
<property name="buddy">
68+
<cstring>mDatabaseComboBox</cstring>
69+
</property>
70+
</widget>
71+
</item>
72+
<item row="0" column="1">
73+
<widget class="QComboBox" name="mDatabaseComboBox">
74+
<property name="enabled">
75+
<bool>true</bool>
76+
</property>
6177
<property name="sizePolicy">
62-
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
78+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
6379
<horstretch>0</horstretch>
6480
<verstretch>0</verstretch>
6581
</sizepolicy>
6682
</property>
67-
<property name="title">
68-
<string>Type</string>
83+
</widget>
84+
</item>
85+
<item row="0" column="2">
86+
<widget class="QToolButton" name="toolButtonNewDatabase">
87+
<property name="toolTip">
88+
<string>Create a new SpatiaLite database</string>
89+
</property>
90+
<property name="text">
91+
<string>…</string>
6992
</property>
70-
<layout class="QGridLayout" name="gridLayout_2">
71-
<item row="0" column="0">
72-
<widget class="QRadioButton" name="mPointRadioButton">
73-
<property name="text">
74-
<string>Point</string>
75-
</property>
76-
</widget>
77-
</item>
78-
<item row="0" column="1">
79-
<widget class="QRadioButton" name="mLineRadioButton">
80-
<property name="text">
81-
<string>Line</string>
82-
</property>
83-
</widget>
84-
</item>
85-
<item row="0" column="2">
86-
<widget class="QRadioButton" name="mPolygonRadioButton">
87-
<property name="text">
88-
<string>Polygon</string>
89-
</property>
90-
</widget>
91-
</item>
92-
<item row="1" column="0">
93-
<widget class="QRadioButton" name="mMultipointRadioButton">
94-
<property name="text">
95-
<string>MultiPoint</string>
96-
</property>
97-
</widget>
98-
</item>
99-
<item row="1" column="1">
100-
<widget class="QRadioButton" name="mMultilineRadioButton">
101-
<property name="text">
102-
<string>Multiline</string>
103-
</property>
104-
</widget>
105-
</item>
106-
<item row="1" column="2">
107-
<widget class="QRadioButton" name="mMultipolygonRadioButton">
108-
<property name="text">
109-
<string>Multipolygon</string>
110-
</property>
111-
</widget>
112-
</item>
113-
</layout>
11493
</widget>
11594
</item>
116-
<item>
117-
<layout class="QHBoxLayout" name="horizontalLayout">
118-
<item>
119-
<widget class="QLabel" name="mFileFormatLabel">
120-
<property name="enabled">
121-
<bool>true</bool>
122-
</property>
123-
<property name="text">
124-
<string>Database</string>
125-
</property>
126-
<property name="buddy">
127-
<cstring>mDatabaseComboBox</cstring>
128-
</property>
129-
</widget>
130-
</item>
131-
<item>
132-
<widget class="QComboBox" name="mDatabaseComboBox">
133-
<property name="enabled">
134-
<bool>true</bool>
135-
</property>
136-
<property name="sizePolicy">
137-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
138-
<horstretch>0</horstretch>
139-
<verstretch>0</verstretch>
140-
</sizepolicy>
141-
</property>
142-
</widget>
143-
</item>
144-
<item>
145-
<widget class="QToolButton" name="toolButtonNewDatabase">
146-
<property name="toolTip">
147-
<string>Create a new SpatiaLite database</string>
148-
</property>
149-
<property name="text">
150-
<string>…</string>
151-
</property>
152-
</widget>
153-
</item>
154-
</layout>
95+
<item row="1" column="0">
96+
<widget class="QLabel" name="label">
97+
<property name="text">
98+
<string>Layer name</string>
99+
</property>
100+
<property name="buddy">
101+
<cstring>leLayerName</cstring>
102+
</property>
103+
</widget>
155104
</item>
156-
<item>
157-
<layout class="QHBoxLayout" name="horizontalLayout_2">
158-
<item>
159-
<widget class="QLabel" name="label">
160-
<property name="text">
161-
<string>Layer name</string>
162-
</property>
163-
<property name="buddy">
164-
<cstring>leLayerName</cstring>
165-
</property>
166-
</widget>
167-
</item>
168-
<item>
169-
<widget class="QLineEdit" name="leLayerName">
170-
<property name="sizePolicy">
171-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
172-
<horstretch>0</horstretch>
173-
<verstretch>0</verstretch>
174-
</sizepolicy>
175-
</property>
176-
<property name="toolTip">
177-
<string>Name for the new layer</string>
178-
</property>
179-
</widget>
180-
</item>
181-
</layout>
105+
<item row="1" column="1" colspan="2">
106+
<widget class="QLineEdit" name="leLayerName">
107+
<property name="sizePolicy">
108+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
109+
<horstretch>0</horstretch>
110+
<verstretch>0</verstretch>
111+
</sizepolicy>
112+
</property>
113+
<property name="toolTip">
114+
<string>Name for the new layer</string>
115+
</property>
116+
</widget>
182117
</item>
183-
<item>
184-
<layout class="QHBoxLayout" name="horizontalLayout_4">
185-
<item>
186-
<widget class="QLabel" name="label_2">
187-
<property name="text">
188-
<string>Geometry column</string>
189-
</property>
190-
<property name="buddy">
191-
<cstring>leGeometryColumn</cstring>
192-
</property>
193-
</widget>
194-
</item>
195-
<item>
196-
<widget class="QLineEdit" name="leGeometryColumn">
197-
<property name="sizePolicy">
198-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
199-
<horstretch>0</horstretch>
200-
<verstretch>0</verstretch>
201-
</sizepolicy>
202-
</property>
203-
<property name="toolTip">
204-
<string>Name for the new layer</string>
205-
</property>
206-
<property name="text">
207-
<string>geometry</string>
208-
</property>
209-
</widget>
210-
</item>
211-
</layout>
118+
<item row="2" column="0">
119+
<widget class="QLabel" name="label">
120+
<property name="text">
121+
<string>Geometry type</string>
122+
</property>
123+
<property name="buddy">
124+
<cstring>mGeometryTypeBox</cstring>
125+
</property>
126+
</widget>
127+
</item>
128+
<item row="2" column="1" colspan="2">
129+
<widget class="QComboBox" name="mGeometryTypeBox">
130+
<property name="enabled">
131+
<bool>true</bool>
132+
</property>
133+
<property name="sizePolicy">
134+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
135+
<horstretch>0</horstretch>
136+
<verstretch>0</verstretch>
137+
</sizepolicy>
138+
</property>
139+
<property name="toolTip">
140+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Geometry type&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
141+
</property>
142+
</widget>
212143
</item>
213-
<item>
144+
<item row="3" column="1" colspan="2">
214145
<layout class="QHBoxLayout" name="horizontalLayout_3">
215146
<item>
216147
<widget class="QLineEdit" name="leSRID">
@@ -236,27 +167,15 @@
236167
<property name="whatsThis">
237168
<string>Specify the coordinate reference system of the layer's geometry.</string>
238169
</property>
239-
<property name="text">
240-
<string>Specify CRS</string>
170+
<property name="icon">
171+
<iconset resource="../../images/images.qrc">
172+
<normaloff>:/images/themes/default/mActionSetProjection.svg</normaloff>:/images/themes/default/mActionSetProjection.svg</iconset>
241173
</property>
242174
</widget>
243175
</item>
244176
</layout>
245177
</item>
246-
<item>
247-
<widget class="QCheckBox" name="checkBoxPrimaryKey">
248-
<property name="toolTip">
249-
<string>Add an integer id field as the primary key for the new layer</string>
250-
</property>
251-
<property name="text">
252-
<string>Create an autoincrementing primary key</string>
253-
</property>
254-
<property name="checked">
255-
<bool>true</bool>
256-
</property>
257-
</widget>
258-
</item>
259-
<item>
178+
<item row="4" colspan="3">
260179
<widget class="QGroupBox" name="groupBox">
261180
<property name="title">
262181
<string>New field</string>
@@ -265,7 +184,7 @@
265184
<item row="0" column="0">
266185
<widget class="QLabel" name="textLabel1">
267186
<property name="sizePolicy">
268-
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
187+
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
269188
<horstretch>0</horstretch>
270189
<verstretch>0</verstretch>
271190
</sizepolicy>
@@ -294,7 +213,7 @@
294213
<item row="1" column="0">
295214
<widget class="QLabel" name="textLabel2">
296215
<property name="sizePolicy">
297-
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
216+
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
298217
<horstretch>0</horstretch>
299218
<verstretch>0</verstretch>
300219
</sizepolicy>
@@ -346,7 +265,7 @@
346265
</layout>
347266
</widget>
348267
</item>
349-
<item>
268+
<item row="5" colspan="3">
350269
<widget class="QGroupBox" name="groupBox_2">
351270
<property name="title">
352271
<string>Fields list</string>
@@ -420,6 +339,57 @@
420339
</layout>
421340
</widget>
422341
</item>
342+
<item row="6" colspan="3">
343+
<widget class="QgsCollapsibleGroupBox" name="groupBox">
344+
<property name="title">
345+
<string>Advanced options</string>
346+
</property>
347+
<property name="collapsed" stdset="0">
348+
<bool>true</bool>
349+
</property>
350+
<layout class="QGridLayout" name="gridLayout_6">
351+
<item row="0" column="0">
352+
<widget class="QLabel" name="label_2">
353+
<property name="text">
354+
<string>Geometry column</string>
355+
</property>
356+
<property name="buddy">
357+
<cstring>leGeometryColumn</cstring>
358+
</property>
359+
</widget>
360+
</item>
361+
<item row="0" column="1">
362+
<widget class="QLineEdit" name="leGeometryColumn">
363+
<property name="sizePolicy">
364+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
365+
<horstretch>0</horstretch>
366+
<verstretch>0</verstretch>
367+
</sizepolicy>
368+
</property>
369+
<property name="toolTip">
370+
<string>Name for the new layer</string>
371+
</property>
372+
<property name="text">
373+
<string>geometry</string>
374+
</property>
375+
</widget>
376+
</item>
377+
<item row="1" column="0" colspan="2">
378+
<widget class="QCheckBox" name="checkBoxPrimaryKey">
379+
<property name="toolTip">
380+
<string>Add an integer id field as the primary key for the new layer</string>
381+
</property>
382+
<property name="text">
383+
<string>Create an autoincrementing primary key</string>
384+
</property>
385+
<property name="checked">
386+
<bool>true</bool>
387+
</property>
388+
</widget>
389+
</item>
390+
</layout>
391+
</widget>
392+
</item>
423393
</layout>
424394
</widget>
425395
</widget>

0 commit comments

Comments
 (0)
Please sign in to comment.