Skip to content

Commit

Permalink
[UX] Show feature id in attribute table tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 17, 2016
1 parent 4411267 commit 15e9e0a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -517,10 +517,10 @@ QVariant QgsAttributeTableModel::headerData( int section, Qt::Orientation orient
}
else if ( section >= 0 && section < mFieldCount )
{
QString attributeName = layer()->attributeAlias( mAttributes[section] );
QString attributeName = layer()->attributeAlias( mAttributes.at( section ) );
if ( attributeName.isEmpty() )
{
QgsField field = layer()->fields().at( mAttributes[section] );
QgsField field = layer()->fields().at( mAttributes.at( section ) );
attributeName = field.name();
}
return QVariant( attributeName );
Expand All @@ -530,6 +530,19 @@ QVariant QgsAttributeTableModel::headerData( int section, Qt::Orientation orient
return tr( "extra column" );
}
}
else if ( role == Qt::ToolTipRole )
{
if ( orientation == Qt::Vertical )
{
// TODO show DisplayExpression
return tr( "Feature ID: %1" ).arg( rowToId( section ) );
}
else
{
QgsField field = layer()->fields().at( mAttributes.at( section ) );
return field.name();
}
}
else
{
return QVariant();
Expand Down

0 comments on commit 15e9e0a

Please sign in to comment.