Skip to content

Commit 0b3f86d

Browse files
authored
[ui] improve new geopackage layer dialog (#5682)
- move a number of options under a collapsible group - rework wording for Z dimension and M values - disable z and m checkboxes when geometry type is non spatial
1 parent e05cca2 commit 0b3f86d

File tree

2 files changed

+147
-131
lines changed

2 files changed

+147
-131
lines changed

src/gui/qgsnewgeopackagelayerdialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W
8383
mGeometryTypeBox->addItem( tr( "Multi curve" ), wkbMultiCurve );
8484
mGeometryTypeBox->addItem( tr( "Multi surface" ), wkbMultiSurface );
8585

86+
mGeometryWithZCheckBox->setEnabled( false );
87+
mGeometryWithMCheckBox->setEnabled( false );
8688
mGeometryColumnEdit->setEnabled( false );
8789
mCheckBoxCreateSpatialIndex->setEnabled( false );
8890
mCrsSelector->setEnabled( false );
@@ -141,6 +143,8 @@ void QgsNewGeoPackageLayerDialog::mGeometryTypeBox_currentIndexChanged( int )
141143
OGRwkbGeometryType geomType = static_cast<OGRwkbGeometryType>
142144
( mGeometryTypeBox->currentData( Qt::UserRole ).toInt() );
143145
bool isSpatial = geomType != wkbNone;
146+
mGeometryWithZCheckBox->setEnabled( isSpatial );
147+
mGeometryWithMCheckBox->setEnabled( isSpatial );
144148
mGeometryColumnEdit->setEnabled( isSpatial );
145149
mCheckBoxCreateSpatialIndex->setEnabled( isSpatial );
146150
mCrsSelector->setEnabled( isSpatial );

src/ui/qgsnewgeopackagelayerdialogbase.ui

Lines changed: 143 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,10 @@
6666
</rect>
6767
</property>
6868
<layout class="QGridLayout" name="gridLayout_5">
69-
<item row="8" column="0">
70-
<widget class="QCheckBox" name="mCheckBoxCreateSpatialIndex">
71-
<property name="toolTip">
72-
<string>Add an integer id field as the primary key for the new layer</string>
73-
</property>
74-
<property name="text">
75-
<string>Create a spatial index</string>
76-
</property>
77-
</widget>
78-
</item>
7969
<item row="0" column="0">
8070
<layout class="QHBoxLayout" name="horizontalLayout_6"/>
8171
</item>
82-
<item row="9" column="0">
72+
<item row="3" column="0">
8373
<widget class="QGroupBox" name="groupBox_3">
8474
<property name="title">
8575
<string>New field</string>
@@ -156,35 +146,6 @@
156146
</item>
157147
<item row="1" column="0">
158148
<layout class="QGridLayout" name="gridLayout_2">
159-
<item row="4" column="2">
160-
<widget class="QLineEdit" name="mLayerIdentifierEdit">
161-
<property name="sizePolicy">
162-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
163-
<horstretch>0</horstretch>
164-
<verstretch>0</verstretch>
165-
</sizepolicy>
166-
</property>
167-
<property name="toolTip">
168-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Human-readable identifier (e.g. short name) for the layer content&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
169-
</property>
170-
</widget>
171-
</item>
172-
<item row="8" column="2">
173-
<widget class="QLineEdit" name="mGeometryColumnEdit">
174-
<property name="sizePolicy">
175-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
176-
<horstretch>0</horstretch>
177-
<verstretch>0</verstretch>
178-
</sizepolicy>
179-
</property>
180-
<property name="toolTip">
181-
<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>
182-
</property>
183-
<property name="text">
184-
<string>geometry</string>
185-
</property>
186-
</widget>
187-
</item>
188149
<item row="1" column="2">
189150
<layout class="QHBoxLayout" name="horizontalLayout">
190151
<item>
@@ -212,17 +173,7 @@
212173
</item>
213174
</layout>
214175
</item>
215-
<item row="5" column="0">
216-
<widget class="QLabel" name="mLayerDescriptionLabel">
217-
<property name="text">
218-
<string>Layer description</string>
219-
</property>
220-
<property name="buddy">
221-
<cstring>mLayerIdentifierEdit</cstring>
222-
</property>
223-
</widget>
224-
</item>
225-
<item row="7" column="0">
176+
<item row="3" column="0">
226177
<widget class="QLabel" name="mGeometryTypeLabel">
227178
<property name="enabled">
228179
<bool>true</bool>
@@ -232,17 +183,7 @@
232183
</property>
233184
</widget>
234185
</item>
235-
<item row="8" column="0">
236-
<widget class="QLabel" name="mGeometryColumnLabel">
237-
<property name="text">
238-
<string>Geometry column</string>
239-
</property>
240-
<property name="buddy">
241-
<cstring>mGeometryColumnEdit</cstring>
242-
</property>
243-
</widget>
244-
</item>
245-
<item row="3" column="2">
186+
<item row="2" column="2">
246187
<widget class="QLineEdit" name="mTableNameEdit">
247188
<property name="sizePolicy">
248189
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -255,19 +196,6 @@
255196
</property>
256197
</widget>
257198
</item>
258-
<item row="5" column="2">
259-
<widget class="QLineEdit" name="mLayerDescriptionEdit">
260-
<property name="sizePolicy">
261-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
262-
<horstretch>0</horstretch>
263-
<verstretch>0</verstretch>
264-
</sizepolicy>
265-
</property>
266-
<property name="toolTip">
267-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Human-readable description for the layer content&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
268-
</property>
269-
</widget>
270-
</item>
271199
<item row="1" column="0">
272200
<widget class="QLabel" name="mDatabaseLabel">
273201
<property name="enabled">
@@ -278,7 +206,7 @@
278206
</property>
279207
</widget>
280208
</item>
281-
<item row="3" column="0">
209+
<item row="2" column="0">
282210
<widget class="QLabel" name="mTableNameLabel">
283211
<property name="text">
284212
<string>Table name</string>
@@ -288,17 +216,7 @@
288216
</property>
289217
</widget>
290218
</item>
291-
<item row="4" column="0">
292-
<widget class="QLabel" name="mLayerIdentifierLabel">
293-
<property name="text">
294-
<string>Layer identifier</string>
295-
</property>
296-
<property name="buddy">
297-
<cstring>mLayerIdentifierEdit</cstring>
298-
</property>
299-
</widget>
300-
</item>
301-
<item row="7" column="2">
219+
<item row="3" column="2">
302220
<widget class="QComboBox" name="mGeometryTypeBox">
303221
<property name="enabled">
304222
<bool>true</bool>
@@ -314,35 +232,27 @@
314232
</property>
315233
</widget>
316234
</item>
317-
<item row="6" column="0">
318-
<widget class="QLabel" name="mFeatureIdLabel">
319-
<property name="text">
320-
<string>Feature id column</string>
321-
</property>
322-
<property name="buddy">
323-
<cstring>mGeometryColumnEdit</cstring>
324-
</property>
325-
</widget>
326-
</item>
327-
<item row="6" column="2">
328-
<widget class="QLineEdit" name="mFeatureIdColumnEdit">
329-
<property name="sizePolicy">
330-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
331-
<horstretch>0</horstretch>
332-
<verstretch>0</verstretch>
333-
</sizepolicy>
334-
</property>
335-
<property name="toolTip">
336-
<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>
337-
</property>
338-
<property name="text">
339-
<string>fid</string>
340-
</property>
341-
</widget>
235+
<item row="4" column="2">
236+
<layout class="QHBoxLayout" name="horizontalZMLayout">
237+
<item>
238+
<widget class="QCheckBox" name="mGeometryWithZCheckBox">
239+
<property name="text">
240+
<string>Include Z dimension</string>
241+
</property>
242+
</widget>
243+
</item>
244+
<item>
245+
<widget class="QCheckBox" name="mGeometryWithMCheckBox">
246+
<property name="text">
247+
<string>Include M values</string>
248+
</property>
249+
</widget>
250+
</item>
251+
</layout>
342252
</item>
343253
</layout>
344254
</item>
345-
<item row="10" column="0">
255+
<item row="4" column="0">
346256
<widget class="QGroupBox" name="groupBox_2">
347257
<property name="title">
348258
<string>Fields list</string>
@@ -421,30 +331,132 @@
421331
</layout>
422332
</widget>
423333
</item>
424-
<item row="6" column="0">
334+
<item row="2" column="0">
425335
<widget class="QgsProjectionSelectionWidget" name="mCrsSelector">
426336
<property name="focusPolicy">
427337
<enum>Qt::StrongFocus</enum>
428338
</property>
429339
</widget>
430340
</item>
431-
<item row="3" column="0">
432-
<layout class="QHBoxLayout" name="horizontalZMLayout">
433-
<item>
434-
<widget class="QCheckBox" name="mGeometryWithZCheckBox">
435-
<property name="text">
436-
<string>Geometries with Z coordinate</string>
437-
</property>
438-
</widget>
439-
</item>
440-
<item>
441-
<widget class="QCheckBox" name="mGeometryWithMCheckBox">
442-
<property name="text">
443-
<string>Geometries with M coordinate</string>
444-
</property>
445-
</widget>
446-
</item>
447-
</layout>
341+
<item row="5" column="0">
342+
<widget class="QgsCollapsibleGroupBox" name="groupBox">
343+
<property name="title">
344+
<string>Advanced options</string>
345+
</property>
346+
<property name="collapsed" stdset="0">
347+
<bool>true</bool>
348+
</property>
349+
<layout class="QGridLayout" name="gridLayout_5">
350+
<item row="1" column="0">
351+
<widget class="QLabel" name="mLayerIdentifierLabel">
352+
<property name="text">
353+
<string>Layer identifier</string>
354+
</property>
355+
<property name="buddy">
356+
<cstring>mLayerIdentifierEdit</cstring>
357+
</property>
358+
</widget>
359+
</item>
360+
<item row="1" column="2">
361+
<widget class="QLineEdit" name="mLayerIdentifierEdit">
362+
<property name="sizePolicy">
363+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
364+
<horstretch>0</horstretch>
365+
<verstretch>0</verstretch>
366+
</sizepolicy>
367+
</property>
368+
<property name="toolTip">
369+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Human-readable identifier (e.g. short name) for the layer content&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
370+
</property>
371+
</widget>
372+
</item>
373+
<item row="2" column="0">
374+
<widget class="QLabel" name="mLayerDescriptionLabel">
375+
<property name="text">
376+
<string>Layer description</string>
377+
</property>
378+
<property name="buddy">
379+
<cstring>mLayerIdentifierEdit</cstring>
380+
</property>
381+
</widget>
382+
</item>
383+
<item row="2" column="2">
384+
<widget class="QLineEdit" name="mLayerDescriptionEdit">
385+
<property name="sizePolicy">
386+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
387+
<horstretch>0</horstretch>
388+
<verstretch>0</verstretch>
389+
</sizepolicy>
390+
</property>
391+
<property name="toolTip">
392+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Human-readable description for the layer content&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
393+
</property>
394+
</widget>
395+
</item>
396+
<item row="3" column="0">
397+
<widget class="QLabel" name="mFeatureIdLabel">
398+
<property name="text">
399+
<string>Feature id column</string>
400+
</property>
401+
<property name="buddy">
402+
<cstring>mGeometryColumnEdit</cstring>
403+
</property>
404+
</widget>
405+
</item>
406+
<item row="3" column="2">
407+
<widget class="QLineEdit" name="mFeatureIdColumnEdit">
408+
<property name="sizePolicy">
409+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
410+
<horstretch>0</horstretch>
411+
<verstretch>0</verstretch>
412+
</sizepolicy>
413+
</property>
414+
<property name="toolTip">
415+
<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>
416+
</property>
417+
<property name="text">
418+
<string>fid</string>
419+
</property>
420+
</widget>
421+
</item>
422+
<item row="4" column="0">
423+
<widget class="QLabel" name="mGeometryColumnLabel">
424+
<property name="text">
425+
<string>Geometry column</string>
426+
</property>
427+
<property name="buddy">
428+
<cstring>mGeometryColumnEdit</cstring>
429+
</property>
430+
</widget>
431+
</item>
432+
<item row="4" column="2">
433+
<widget class="QLineEdit" name="mGeometryColumnEdit">
434+
<property name="sizePolicy">
435+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
436+
<horstretch>0</horstretch>
437+
<verstretch>0</verstretch>
438+
</sizepolicy>
439+
</property>
440+
<property name="toolTip">
441+
<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>
442+
</property>
443+
<property name="text">
444+
<string>geometry</string>
445+
</property>
446+
</widget>
447+
</item>
448+
<item row="5" column="2">
449+
<widget class="QCheckBox" name="mCheckBoxCreateSpatialIndex">
450+
<property name="toolTip">
451+
<string>Add an integer id field as the primary key for the new layer</string>
452+
</property>
453+
<property name="text">
454+
<string>Create a spatial index</string>
455+
</property>
456+
</widget>
457+
</item>
458+
</layout>
459+
</widget>
448460
</item>
449461
</layout>
450462
</widget>

0 commit comments

Comments
 (0)