Skip to content

Commit

Permalink
fix cppcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and nyalldawson committed Nov 19, 2022
1 parent d3ca501 commit 6973dc1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -176,11 +176,11 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
{
QgsLayerTreeLayer *nodeLayer = QgsLayerTree::toLayer( node );
QString name = nodeLayer->name();
if ( nodeLayer->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toInt() && role == Qt::DisplayRole )
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( nodeLayer->layer() );
if ( vlayer && nodeLayer->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toInt() && role == Qt::DisplayRole )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( nodeLayer->layer() );
const bool estimatedCount = QgsDataSourceUri( vlayer->dataProvider()->dataSourceUri() ).useEstimatedMetadata();
const qlonglong count = vlayer ? vlayer->featureCount() : -1;
const qlonglong count = vlayer->featureCount();

// if you modify this line, please update QgsSymbolLegendNode::updateLabel
name += QStringLiteral( " [%1%2]" ).arg(
Expand Down

0 comments on commit 6973dc1

Please sign in to comment.