Skip to content
Permalink
Browse files

Show vector layer wkb types in tooltip in layer tree and layer combo …

…boxes

This is very useful information to have readily visible (esp.
to see if a layer is multi* type, has z/m, when choosing it
as a source for a processing algorithm)

Remove redundant geometry type display from default layer name
  • Loading branch information
nyalldawson committed Nov 14, 2017
1 parent 6e31fcc commit 15e15356b37a87534cea20d4e25ff924aab02cdc
Showing with 14 additions and 7 deletions.
  1. +2 −4 src/app/qgisapp.cpp
  2. +6 −1 src/core/layertree/qgslayertreemodel.cpp
  3. +6 −2 src/core/qgsmaplayermodel.cpp
@@ -4203,7 +4203,7 @@ bool QgisApp::addVectorLayers( const QStringList &layerQStringList, const QStrin

if ( elements.size() >= 4 && layer->name() != elements.at( 1 ) )
{
layer->setName( QStringLiteral( "%1 %2 %3" ).arg( layer->name(), elements.at( 1 ), elements.at( 3 ) ) );
layer->setName( QStringLiteral( "%1 %2" ).arg( layer->name(), elements.at( 1 ) ) );
}

myList << layer;
@@ -4636,8 +4636,6 @@ void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )

QgsDebugMsg( "Creating new vector layer using " + composedURI );
QString name = fileName + " " + def.layerName;
if ( !layerGeometryType.isEmpty() )
name += " " + layerGeometryType;
QgsVectorLayer::LayerOptions options;
options.loadDefaultStyle = false;
QgsVectorLayer *layer = new QgsVectorLayer( composedURI, name, QStringLiteral( "ogr" ), options );
@@ -9999,7 +9997,7 @@ QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const Q

if ( elements.size() >= 4 && layer->name() != elements.at( 1 ) )
{
layer->setName( QStringLiteral( "%1 %2 %3" ).arg( layer->name(), elements.at( 1 ), elements.at( 3 ) ) );
layer->setName( QStringLiteral( "%1 %2" ).arg( layer->name(), elements.at( 1 ) ) );
}
}

@@ -297,7 +297,12 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
title = layer->name();
title = "<b>" + title + "</b>";
if ( layer->crs().isValid() )
title = tr( "%1 (%2)" ).arg( title, layer->crs().authid() );
{
if ( QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer ) )
title = tr( "%1 (%2 - %3)" ).arg( title, QgsWkbTypes::displayString( vl->wkbType() ), layer->crs().authid() );
else
title = tr( "%1 (%2) " ).arg( title, layer->crs().authid() );
}

parts << title;

@@ -288,8 +288,12 @@ QVariant QgsMapLayerModel::data( const QModelIndex &index, int role ) const
title = layer->name();
title = "<b>" + title + "</b>";
if ( layer->crs().isValid() )
title = tr( "%1 (%2)" ).arg( title, layer->crs().authid() );

{
if ( QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer ) )
title = tr( "%1 (%2 - %3)" ).arg( title, QgsWkbTypes::displayString( vl->wkbType() ), layer->crs().authid() );
else
title = tr( "%1 (%2) " ).arg( title, layer->crs().authid() );
}
parts << title;

if ( !layer->abstract().isEmpty() )

0 comments on commit 15e1535

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