Skip to content

Commit

Permalink
use aliases instead of field names in attribute table column filter list
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 12, 2015
1 parent f1fe985 commit 0461cbd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void QgsAttributeTableDialog::columnBoxInit()
mFilterButton->addAction( mActionFilterColumnsMenu );
mFilterButton->addAction( mActionAdvancedFilter );

QList<QgsField> fields = mLayer->fields().toList();
const QList<QgsField> fields = mLayer->fields().toList();

Q_FOREACH ( const QgsField& field, fields )
{
Expand All @@ -338,10 +338,11 @@ void QgsAttributeTableDialog::columnBoxInit()
if ( mLayer->editorWidgetV2( idx ) != "Hidden" )
{
QIcon icon = QgsApplication::getThemeIcon( "/mActionNewAttribute.png" );
QString text = field.name();
QString alias = mLayer->attributeDisplayName( idx );

// Generate action for the filter popup button
QAction* filterAction = new QAction( icon, text, mFilterButton );
QAction* filterAction = new QAction( icon, alias, mFilterButton );
filterAction->setData( field.name() );
mFilterActionMapper->setMapping( filterAction, filterAction );
connect( filterAction, SIGNAL( triggered() ), mFilterActionMapper, SLOT( map() ) );
mFilterColumnsMenu->addAction( filterAction );
Expand Down Expand Up @@ -453,7 +454,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
mCurrentSearchWidgetWrapper->widget()->setVisible( false );
delete mCurrentSearchWidgetWrapper;
}
QString fieldName = mFilterButton->defaultAction()->text();
QString fieldName = mFilterButton->defaultAction()->data().toString();
// get the search widget
int fldIdx = mLayer->fieldNameIndex( fieldName );
if ( fldIdx < 0 )
Expand Down

0 comments on commit 0461cbd

Please sign in to comment.