Skip to content
Permalink
Browse files
Migrate "Hidden" widgets to "Hidden" attribute table columns
  • Loading branch information
m-kuhn committed May 11, 2016
1 parent 5a2ab50 commit ab7a07a64e56b2dbe01d6a32039a4b1d1b8f67bc
@@ -146,12 +146,33 @@ void QgsAttributeTableConfig::readXml( const QDomNode& node )

mColumns.append( column );
}
}

if ( configNode.toElement().attribute( "actionWidgetStyle" ) == "buttonList" )
mActionWidgetStyle = ButtonList;
if ( configNode.toElement().attribute( "actionWidgetStyle" ) == "buttonList" )
mActionWidgetStyle = ButtonList;
else
mActionWidgetStyle = DropDown;
}
else
mActionWidgetStyle = DropDown;
{
// Before QGIS 2.16 the attribute table would hide "Hidden" widgets.
// They are migrated to hidden columns here.
QDomNodeList editTypeNodes = node.namedItem( "edittypes" ).childNodes();

for ( int i = 0; i < editTypeNodes.size(); i++ )
{
QDomElement editTypeElement = editTypeNodes.at( i ).toElement();

if ( editTypeElement.attribute( "widgetv2type" ) == "Hidden" )
{
ColumnConfig column;

column.mName = editTypeElement.attribute( "name" );
column.mHidden = true;
column.mType = Field;
mColumns.append( column );
}
}
}
}

void QgsAttributeTableConfig::writeXml( QDomNode& node ) const
@@ -1862,6 +1862,8 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage

mEditFormConfig->readXml( node );

mAttributeTableConfig.readXml( node );

mConditionalStyles->readXml( node );

return true;
@@ -2064,6 +2066,7 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&

// add attribute actions
mActions->writeXML( node, doc );
mAttributeTableConfig.writeXml( node );
mEditFormConfig->writeXml( node );
mConditionalStyles->writeXml( node, doc );

@@ -314,7 +314,7 @@ void QgsAttributeTableModel::loadAttributes()
{
const QString widgetType = layer()->editFormConfig()->widgetType( idx );
QgsEditorWidgetFactory* widgetFactory = QgsEditorWidgetRegistry::instance()->factory( widgetType );
if ( widgetFactory && widgetType != "Hidden" )
if ( widgetFactory )
{
mWidgetFactories.append( widgetFactory );
mWidgetConfigs.append( layer()->editFormConfig()->widgetConfig( idx ) );

0 comments on commit ab7a07a

Please sign in to comment.