Skip to content

Commit 11c1f3a

Browse files
authored
[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

+8-28
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()

0 commit comments

Comments
 (0)