Ejemplo n.º 1
0
void QgsLayerTreeUtils::storeOriginalLayersProperties( QgsLayerTreeGroup *group,  const QDomDocument *doc )
{
  const QDomNodeList mlNodeList( doc->documentElement()
                                 .firstChildElement( QStringLiteral( "projectlayers" ) )
                                 .elementsByTagName( QStringLiteral( "maplayer" ) ) );

  std::function<void ( QgsLayerTreeNode * )> _store = [ & ]( QgsLayerTreeNode * node )
  {
    if ( QgsLayerTree::isLayer( node ) )
    {
      QgsMapLayer *l( QgsLayerTree::toLayer( node )->layer() );
      if ( l )
      {
        for ( int i = 0; i < mlNodeList.count(); i++ )
        {
          QDomNode mlNode( mlNodeList.at( i ) );
          QString id( mlNode.firstChildElement( QStringLiteral( "id" ) ).firstChild().nodeValue() );
          if ( id == l->id() )
          {
            QDomImplementation DomImplementation;
            QDomDocumentType documentType = DomImplementation.createDocumentType( QStringLiteral( "qgis" ), QStringLiteral( "http://mrcc.com/qgis.dtd" ), QStringLiteral( "SYSTEM" ) );
            QDomDocument document( documentType );
            QDomElement element = mlNode.toElement();
            document.appendChild( element );
            QString str;
            QTextStream stream( &str );
            document.save( stream, 4 /*indent*/ );
            l->setOriginalXmlProperties( str );
          }
        }
      }
    }
    else if ( QgsLayerTree::isGroup( node ) )
    {
      const QList<QgsLayerTreeNode *> constChildren( node->children( ) );
      for ( const auto &childNode : constChildren )
      {
        _store( childNode );
      }
    }
  };

  for ( QgsLayerTreeNode *node : group->children() )
  {
    _store( node );
  }
}
Ejemplo n.º 2
0
 qt_dbtableview_impl :: ~qt_dbtableview_impl() {
   _store();
   delete _model;
   delete _xml;
 }
Ejemplo n.º 3
0
void Buffer::shrink()
{
	_store()->shrink();
}
Ejemplo n.º 4
0
unsigned int Buffer::clientSize() const
{
	return _store()->clientSize();
}
Ejemplo n.º 5
0
unsigned int Buffer::size() const
{
	return _store()->size();
}