Skip to content

Commit

Permalink
[attrtable] hide "hidden" widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 20, 2014
1 parent 0305796 commit 0f0d16a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,16 @@ void QgsAttributeTableModel::loadAttributes()

for ( int idx = 0; idx < fields.count(); ++idx )
{
QgsEditorWidgetFactory* widgetFactory = QgsEditorWidgetRegistry::instance()->factory( layer()->editorWidgetV2( idx ) );
if ( !widgetFactory || !layer() )
continue;

mWidgetFactories.append( widgetFactory );
mWidgetConfigs.append( layer()->editorWidgetV2Config( idx ) );
mAttributeWidgetCaches.append( widgetFactory->createCache( layer(), idx, mWidgetConfigs.last() ) );
const QString widgetType = layer()->editorWidgetV2( idx );
QgsEditorWidgetFactory* widgetFactory = QgsEditorWidgetRegistry::instance()->factory( widgetType );
if ( widgetFactory && widgetType != "Hidden" )
{
mWidgetFactories.append( widgetFactory );
mWidgetConfigs.append( layer()->editorWidgetV2Config( idx ) );
mAttributeWidgetCaches.append( widgetFactory->createCache( layer(), idx, mWidgetConfigs.last() ) );

attributes << idx;
attributes << idx;
}
}

if ( mFieldCount < attributes.size() )
Expand Down Expand Up @@ -503,7 +504,7 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons

if ( role == Qt::DisplayRole )
{
return mWidgetFactories[ fieldId ]->representValue( layer(), fieldId, mWidgetConfigs[ fieldId ], mAttributeWidgetCaches[ fieldId ], val );
return mWidgetFactories[ index.column()]->representValue( layer(), fieldId, mWidgetConfigs[ index.column()], mAttributeWidgetCaches[ index.column()], val );
}

return val;
Expand Down

0 comments on commit 0f0d16a

Please sign in to comment.