Skip to content
Permalink
Browse files

Remove setLayerName(), layerName() from QgsLayerTreeLayer

(replaced by setName(), name() overridden from the parent)
  • Loading branch information
wonder-sk committed Nov 14, 2016
1 parent 9950b08 commit 645514a23b266a3af9446dbd56adf69477e8541c
@@ -941,6 +941,12 @@ QgsLayerTreeGroup {#qgis_api_break_3_0_QgsLayerTreeGroup}
- readChildrenFromXML() has been renamed to readChildrenFromXml()


QgsLayerTreeLayer {#qgis_api_break_3_0_QgsLayerTreeLayer}
-----------------

- setLayerName(), layerName() were renamed to setName(), name()


QgsLayerTreeModel {#qgis_api_break_3_0_QgsLayerTreeMode}
-----------------

@@ -38,9 +38,6 @@ class QgsLayerTreeLayer : QgsLayerTreeNode
//! @note added in 3.0
void setName( const QString& n );

QString layerName() const;
void setLayerName( const QString& n );

Qt::CheckState isVisible() const;
void setVisible( Qt::CheckState visible );

@@ -996,7 +996,7 @@ void QgsComposerLegendWidget::on_mItemTreeView_doubleClicked( const QModelIndex
}
else if ( QgsLayerTree::isLayer( currentNode ) )
{
currentText = QgsLayerTree::toLayer( currentNode )->layerName();
currentText = QgsLayerTree::toLayer( currentNode )->name();
QVariant v = currentNode->customProperty( QStringLiteral( "legend/title-label" ) );
if ( !v.isNull() )
currentText = v.toString();
@@ -92,7 +92,7 @@ QStringList QgsProjectLayerGroupDialog::selectedLayerNames() const
{
QgsLayerTreeNode* node = model->index2node( index );
if ( QgsLayerTree::isLayer( node ) )
layerNames << QgsLayerTree::toLayer( node )->layerName();
layerNames << QgsLayerTree::toLayer( node )->name();
}
return layerNames;
}
@@ -72,21 +72,11 @@ void QgsLayerTreeLayer::attachToLayer()
}

QString QgsLayerTreeLayer::name() const
{
return layerName();
}

void QgsLayerTreeLayer::setName( const QString& n )
{
setLayerName( n );
}

QString QgsLayerTreeLayer::layerName() const
{
return mLayer ? mLayer->name() : mLayerName;
}

void QgsLayerTreeLayer::setLayerName( const QString& n )
void QgsLayerTreeLayer::setName( const QString& n )
{
if ( mLayer )
{
@@ -144,7 +134,7 @@ void QgsLayerTreeLayer::writeXml( QDomElement& parentElement )
QDomDocument doc = parentElement.ownerDocument();
QDomElement elem = doc.createElement( QStringLiteral( "layer-tree-layer" ) );
elem.setAttribute( QStringLiteral( "id" ), mLayerId );
elem.setAttribute( QStringLiteral( "name" ), layerName() );
elem.setAttribute( QStringLiteral( "name" ), name() );
elem.setAttribute( QStringLiteral( "checked" ), QgsLayerTreeUtils::checkStateToXml( mVisible ) );
elem.setAttribute( QStringLiteral( "expanded" ), mExpanded ? "1" : "0" );

@@ -155,7 +145,7 @@ void QgsLayerTreeLayer::writeXml( QDomElement& parentElement )

QString QgsLayerTreeLayer::dump() const
{
return QStringLiteral( "LAYER: %1 visible=%2 expanded=%3 id=%4\n" ).arg( layerName() ).arg( mVisible ).arg( mExpanded ).arg( layerId() );
return QStringLiteral( "LAYER: %1 visible=%2 expanded=%3 id=%4\n" ).arg( name() ).arg( mVisible ).arg( mExpanded ).arg( layerId() );
}

QgsLayerTreeLayer* QgsLayerTreeLayer::clone() const
@@ -58,9 +58,6 @@ class CORE_EXPORT QgsLayerTreeLayer : public QgsLayerTreeNode
//! @note added in 3.0
void setName( const QString& n ) override;

QString layerName() const;
void setLayerName( const QString& n );

Qt::CheckState isVisible() const { return mVisible; }
void setVisible( Qt::CheckState visible );

@@ -198,7 +198,7 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
if ( QgsLayerTree::isLayer( node ) )
{
QgsLayerTreeLayer* nodeLayer = QgsLayerTree::toLayer( node );
QString name = nodeLayer->layerName();
QString name = nodeLayer->name();
if ( nodeLayer->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toInt() && role == Qt::DisplayRole )
{
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( nodeLayer->layer() );
@@ -417,7 +417,7 @@ bool QgsLayerTreeModel::setData( const QModelIndex& index, const QVariant& value
if ( QgsLayerTree::isLayer( node ) )
{
QgsLayerTreeLayer* layer = QgsLayerTree::toLayer( node );
layer->setLayerName( value.toString() );
layer->setName( value.toString() );
emit dataChanged( index, index );
}
else if ( QgsLayerTree::isGroup( node ) )
@@ -457,7 +457,7 @@ void QgsSymbolLegendNode::updateLabel()

if ( mEmbeddedInParent )
{
QString layerName = mLayerNode->layerName();
QString layerName = mLayerNode->name();
if ( !mLayerNode->customProperty( QStringLiteral( "legend/title-label" ) ).isNull() )
layerName = mLayerNode->customProperty( QStringLiteral( "legend/title-label" ) ).toString();

@@ -113,7 +113,7 @@ static QDomElement _writeOldLegendLayer( QDomDocument& doc, QgsLayerTreeLayer* n
layerElem.setAttribute( QStringLiteral( "drawingOrder" ), drawingOrder );
layerElem.setAttribute( QStringLiteral( "open" ), nodeLayer->isExpanded() ? "true" : "false" );
layerElem.setAttribute( QStringLiteral( "checked" ), QgsLayerTreeUtils::checkStateToXml( nodeLayer->isVisible() ) );
layerElem.setAttribute( QStringLiteral( "name" ), nodeLayer->layerName() );
layerElem.setAttribute( QStringLiteral( "name" ), nodeLayer->name() );
layerElem.setAttribute( QStringLiteral( "showFeatureCount" ), nodeLayer->customProperty( QStringLiteral( "showFeatureCount" ) ).toInt() );

QDomElement fileGroupElem = doc.createElement( QStringLiteral( "filegroup" ) );

0 comments on commit 645514a

Please sign in to comment.
You can’t perform that action at this time.