Skip to content
Permalink
Browse files

Add icon to geometry combobox items

  • Loading branch information
DelazJ authored and nyalldawson committed Dec 15, 2017
1 parent db07bc6 commit 32b7c533caff04795a15c7435fa1eefdc1834037
@@ -98,12 +98,13 @@ void QgsVectorLayerSaveAsDialog::setup()
mFormatComboBox->blockSignals( false );

//add geometry types to combobox
QString path = QgsApplication::defaultThemePath();
mGeometryTypeComboBox->addItem( tr( "Automatic" ), -1 );
mGeometryTypeComboBox->addItem( QgsWkbTypes::displayString( QgsWkbTypes::Point ), QgsWkbTypes::Point );
mGeometryTypeComboBox->addItem( QgsWkbTypes::displayString( QgsWkbTypes::LineString ), QgsWkbTypes::LineString );
mGeometryTypeComboBox->addItem( QgsWkbTypes::displayString( QgsWkbTypes::Polygon ), QgsWkbTypes::Polygon );
mGeometryTypeComboBox->addItem( QIcon( path + "/mIconPointLayer.svg" ), QgsWkbTypes::displayString( QgsWkbTypes::Point ), QgsWkbTypes::Point );
mGeometryTypeComboBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), QgsWkbTypes::displayString( QgsWkbTypes::LineString ), QgsWkbTypes::LineString );
mGeometryTypeComboBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), QgsWkbTypes::displayString( QgsWkbTypes::Polygon ), QgsWkbTypes::Polygon );
mGeometryTypeComboBox->addItem( QgsWkbTypes::displayString( QgsWkbTypes::GeometryCollection ), QgsWkbTypes::GeometryCollection );
mGeometryTypeComboBox->addItem( tr( "No geometry" ), QgsWkbTypes::NoGeometry );
mGeometryTypeComboBox->addItem( QIcon( path + "/mActionOpenTable.svg" ), tr( "No geometry" ), QgsWkbTypes::NoGeometry );
mGeometryTypeComboBox->setCurrentIndex( mGeometryTypeComboBox->findData( -1 ) );

mEncodingComboBox->addItems( QgsVectorDataProvider::availableEncodings() );
@@ -64,22 +64,23 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewAttribute.svg" ) ) );
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) );

mGeometryTypeBox->addItem( tr( "Non spatial" ), wkbNone );
mGeometryTypeBox->addItem( tr( "Point" ), wkbPoint );
mGeometryTypeBox->addItem( tr( "Line" ), wkbLineString );
mGeometryTypeBox->addItem( tr( "Polygon" ), wkbPolygon );
mGeometryTypeBox->addItem( tr( "MultiPoint" ), wkbMultiPoint );
mGeometryTypeBox->addItem( tr( "MultiLine" ), wkbMultiLineString );
mGeometryTypeBox->addItem( tr( "MultiPolygon" ), wkbMultiPolygon );
QString path = QgsApplication::defaultThemePath();
mGeometryTypeBox->addItem( QIcon( path + "/mActionOpenTable.svg" ), tr( "Non spatial" ), wkbNone );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPointLayer.svg" ), tr( "Point" ), wkbPoint );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "Line" ), wkbLineString );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), tr( "Polygon" ), wkbPolygon );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPointLayer.svg" ), tr( "MultiPoint" ), wkbMultiPoint );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "MultiLine" ), wkbMultiLineString );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), tr( "MultiPolygon" ), wkbMultiPolygon );

#if 0
// QGIS always create CompoundCurve and there's no real interest of having just CircularString. CompoundCurve are more useful
mGeometryTypeBox->addItem( tr( "CircularString" ), wkbCircularString );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "CircularString" ), wkbCircularString );
#endif
mGeometryTypeBox->addItem( tr( "CompoundCurve" ), wkbCompoundCurve );
mGeometryTypeBox->addItem( tr( "CurvePolygon" ), wkbCurvePolygon );
mGeometryTypeBox->addItem( tr( "MultiCurve" ), wkbMultiCurve );
mGeometryTypeBox->addItem( tr( "MultiSurface" ), wkbMultiSurface );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "CompoundCurve" ), wkbCompoundCurve );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), tr( "CurvePolygon" ), wkbCurvePolygon );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "MultiCurve" ), wkbMultiCurve );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), tr( "MultiSurface" ), wkbMultiSurface );

mGeometryWithZCheckBox->setEnabled( false );
mGeometryWithMCheckBox->setEnabled( false );
@@ -54,13 +54,14 @@ QgsNewMemoryLayerDialog::QgsNewMemoryLayerDialog( QWidget *parent, Qt::WindowFla
QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/NewMemoryLayer/geometry" ) ).toByteArray() );

mGeometryTypeBox->addItem( tr( "Non spatial" ), QgsWkbTypes::NoGeometry );
mGeometryTypeBox->addItem( tr( "Point" ), QgsWkbTypes::Point );
mGeometryTypeBox->addItem( tr( "Line" ), QgsWkbTypes::LineString );
mGeometryTypeBox->addItem( tr( "Polygon" ), QgsWkbTypes::Polygon );
mGeometryTypeBox->addItem( tr( "MultiPoint" ), QgsWkbTypes::MultiPoint );
mGeometryTypeBox->addItem( tr( "MultiLine" ), QgsWkbTypes::MultiLineString );
mGeometryTypeBox->addItem( tr( "MultiPolygon" ), QgsWkbTypes::MultiPolygon );
QString path = QgsApplication::defaultThemePath();
mGeometryTypeBox->addItem( QIcon( path + "/mActionOpenTable.svg" ), tr( "Non spatial" ), QgsWkbTypes::NoGeometry );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPointLayer.svg" ), tr( "Point" ), QgsWkbTypes::Point );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "Line" ), QgsWkbTypes::LineString );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), tr( "Polygon" ), QgsWkbTypes::Polygon );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPointLayer.svg" ), tr( "MultiPoint" ), QgsWkbTypes::MultiPoint );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "MultiLine" ), QgsWkbTypes::MultiLineString );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), tr( "MultiPolygon" ), QgsWkbTypes::MultiPolygon );

mGeometryWithZCheckBox->setEnabled( false );
mGeometryWithMCheckBox->setEnabled( false );
@@ -56,9 +56,9 @@ QgsNewVectorLayerDialog::QgsNewVectorLayerDialog( QWidget *parent, Qt::WindowFla
mWidth->setValidator( new QIntValidator( 1, 255, this ) );
mPrecision->setValidator( new QIntValidator( 0, 15, this ) );

mGeometryTypeBox->addItem( tr( "Point" ), QgsWkbTypes::Point );
mGeometryTypeBox->addItem( tr( "Line" ), QgsWkbTypes::LineString );
mGeometryTypeBox->addItem( tr( "Polygon" ), QgsWkbTypes::Polygon );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPointLayer.svg" ), tr( "Point" ), QgsWkbTypes::Point );
mGeometryTypeBox->addItem( QIcon( path + "/mIconLineLayer.svg" ), tr( "Line" ), QgsWkbTypes::LineString );
mGeometryTypeBox->addItem( QIcon( path + "/mIconPolygonLayer.svg" ), tr( "Polygon" ), QgsWkbTypes::Polygon );

mOkButton = buttonBox->button( QDialogButtonBox::Ok );
mOkButton->setEnabled( false );

0 comments on commit 32b7c53

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