Skip to content

Commit 0f0d16a

Browse files
committedJun 20, 2014
[attrtable] hide "hidden" widgets
1 parent 0305796 commit 0f0d16a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed
 

‎src/gui/attributetable/qgsattributetablemodel.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,16 @@ void QgsAttributeTableModel::loadAttributes()
247247

248248
for ( int idx = 0; idx < fields.count(); ++idx )
249249
{
250-
QgsEditorWidgetFactory* widgetFactory = QgsEditorWidgetRegistry::instance()->factory( layer()->editorWidgetV2( idx ) );
251-
if ( !widgetFactory || !layer() )
252-
continue;
253-
254-
mWidgetFactories.append( widgetFactory );
255-
mWidgetConfigs.append( layer()->editorWidgetV2Config( idx ) );
256-
mAttributeWidgetCaches.append( widgetFactory->createCache( layer(), idx, mWidgetConfigs.last() ) );
250+
const QString widgetType = layer()->editorWidgetV2( idx );
251+
QgsEditorWidgetFactory* widgetFactory = QgsEditorWidgetRegistry::instance()->factory( widgetType );
252+
if ( widgetFactory && widgetType != "Hidden" )
253+
{
254+
mWidgetFactories.append( widgetFactory );
255+
mWidgetConfigs.append( layer()->editorWidgetV2Config( idx ) );
256+
mAttributeWidgetCaches.append( widgetFactory->createCache( layer(), idx, mWidgetConfigs.last() ) );
257257

258-
attributes << idx;
258+
attributes << idx;
259+
}
259260
}
260261

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

504505
if ( role == Qt::DisplayRole )
505506
{
506-
return mWidgetFactories[ fieldId ]->representValue( layer(), fieldId, mWidgetConfigs[ fieldId ], mAttributeWidgetCaches[ fieldId ], val );
507+
return mWidgetFactories[ index.column()]->representValue( layer(), fieldId, mWidgetConfigs[ index.column()], mAttributeWidgetCaches[ index.column()], val );
507508
}
508509

509510
return val;

0 commit comments

Comments
 (0)
Please sign in to comment.