void QgsComposerLayerItem::writeXML( QDomElement& elem, QDomDocument& doc ) const
{
  QDomElement layerItemElem = doc.createElement( "LayerItem" );
  layerItemElem.setAttribute( "layerId", mLayerID );
  layerItemElem.setAttribute( "text", text() );
  layerItemElem.setAttribute( "userText", userText() );
  layerItemElem.setAttribute( "showFeatureCount", showFeatureCount() );
  layerItemElem.setAttribute( "style", QgsComposerLegendStyle::styleName( mStyle ) );
  writeXMLChildren( layerItemElem, doc );
  elem.appendChild( layerItemElem );
}
QAction* QgsLayerTreeViewDefaultActions::actionShowFeatureCount( QObject* parent )
{
  QgsLayerTreeNode* node = mView->currentNode();
  if ( !node )
    return 0;

  QAction* a = new QAction( tr( "Show Feature Count" ), parent );
  connect( a, SIGNAL( triggered() ), this, SLOT( showFeatureCount() ) );
  a->setCheckable( true );
  a->setChecked( node->customProperty( "showFeatureCount", 0 ).toInt() );
  return a;
}