Skip to content

Commit 6f55e50

Browse files
committedNov 14, 2017
Remove QgsMapLayer::originalName()
Now QgsMapLayer::name() is guaranteed to return the same string
1 parent 1e4f691 commit 6f55e50

File tree

8 files changed

+9
-34
lines changed

8 files changed

+9
-34
lines changed
 

‎doc/api_break.dox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,7 @@ screenUpdateRequested() were removed. These members have had no effect for a num
16671667
now sets the maximum (i.e. largest scale, or most zoomed in) at which the layer will appear, and setMinimumScale now sets the minimum (i.e. smallest scale,
16681668
or most zoomed out) at which the layer will appear. The same is true for the maximumScale and minimumScale getters.
16691669
- capitalizeLayerName() was removed. Use formatLayerName() instead.
1670+
- originalName() was removed. Use name() instead.
16701671

16711672

16721673
QgsMapLayerActionRegistry {#qgis_api_break_3_0_QgsMapLayerActionRegistry}

‎python/core/qgsmaplayer.sip

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ Returns the layer's unique ID, which is used to access this layer from QgsProjec
9797
QString name() const;
9898
%Docstring
9999
Returns the display name of the layer.
100-
:return: the layer name
101100
.. seealso:: setName()
102101
:rtype: str
103102
%End
@@ -109,12 +108,6 @@ Returns the layer's unique ID, which is used to access this layer from QgsProjec
109108
%End
110109

111110

112-
QString originalName() const;
113-
%Docstring
114-
Returns the original name of the layer.
115-
:rtype: str
116-
%End
117-
118111
void setShortName( const QString &shortName );
119112
%Docstring
120113
Sets the short name of the layer
@@ -1184,7 +1177,6 @@ Set error message
11841177

11851178

11861179

1187-
11881180
bool hasDependencyCycle( const QSet<QgsMapLayerDependency> &layers ) const;
11891181
%Docstring
11901182
Checks whether a new set of dependencies will introduce a cycle

‎src/app/qgsrasterlayerproperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ void QgsRasterLayerProperties::sync()
724724
*/
725725

726726
//these properties (layer name and label) are provided by the qgsmaplayer superclass
727-
mLayerOrigNameLineEd->setText( mRasterLayer->originalName() );
727+
mLayerOrigNameLineEd->setText( mRasterLayer->name() );
728728
leDisplayName->setText( mRasterLayer->name() );
729729

730730
//get the thumbnail for the layer

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ void QgsVectorLayerProperties::insertFieldOrExpression()
432432
void QgsVectorLayerProperties::syncToLayer()
433433
{
434434
// populate the general information
435-
mLayerOrigNameLineEdit->setText( mLayer->originalName() );
435+
mLayerOrigNameLineEdit->setText( mLayer->name() );
436436
txtDisplayName->setText( mLayer->name() );
437437
pbnQueryBuilder->setWhatsThis( tr( "This button opens the query "
438438
"builder and allows you to create a subset of features to display on "

‎src/core/qgsmaplayer.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type,
5555
const QString &lyrname,
5656
const QString &source )
5757
: mDataSource( source )
58-
, mLayerOrigName( lyrname ) // store the original name
5958
, mLayerType( type )
6059
, mStyleManager( new QgsMapLayerStyleManager( this ) )
6160
{
@@ -137,10 +136,9 @@ QString QgsMapLayer::id() const
137136

138137
void QgsMapLayer::setName( const QString &name )
139138
{
140-
if ( name == mLayerOrigName && name == mLayerName )
139+
if ( name == mLayerName )
141140
return;
142141

143-
mLayerOrigName = name;
144142
mLayerName = name;
145143

146144
emit nameChanged();
@@ -162,11 +160,6 @@ const QgsDataProvider *QgsMapLayer::dataProvider() const
162160
return nullptr;
163161
}
164162

165-
QString QgsMapLayer::originalName() const
166-
{
167-
return mLayerOrigName;
168-
}
169-
170163
QString QgsMapLayer::publicSource() const
171164
{
172165
// Redo this every time we're asked for it, as we don't know if
@@ -720,7 +713,7 @@ bool QgsMapLayer::writeLayerXml( QDomElement &layerElement, QDomDocument &docume
720713

721714
// layer name
722715
QDomElement layerName = document.createElement( QStringLiteral( "layername" ) );
723-
QDomText layerNameText = document.createTextNode( originalName() );
716+
QDomText layerNameText = document.createTextNode( name() );
724717
layerName.appendChild( layerNameText );
725718
layerElement.appendChild( layerName );
726719

‎src/core/qgsmaplayer.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ class CORE_EXPORT QgsMapLayer : public QObject
138138

139139
/**
140140
* Returns the display name of the layer.
141-
* \returns the layer name
142141
* \see setName()
143142
*/
144143
QString name() const;
@@ -154,11 +153,6 @@ class CORE_EXPORT QgsMapLayer : public QObject
154153
*/
155154
virtual const QgsDataProvider *dataProvider() const SIP_SKIP;
156155

157-
/**
158-
* Returns the original name of the layer.
159-
*/
160-
QString originalName() const;
161-
162156
/**
163157
* Sets the short name of the layer
164158
* used by QGIS Server to identify the layer.
@@ -1125,11 +1119,6 @@ class CORE_EXPORT QgsMapLayer : public QObject
11251119
//! Name of the layer - used for display
11261120
QString mLayerName;
11271121

1128-
/**
1129-
* Original name of the layer
1130-
*/
1131-
QString mLayerOrigName;
1132-
11331122
QString mShortName;
11341123
QString mTitle;
11351124

‎src/core/qgsvectorlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ QgsVectorLayer::~QgsVectorLayer()
194194

195195
QgsVectorLayer *QgsVectorLayer::clone() const
196196
{
197-
QgsVectorLayer *layer = new QgsVectorLayer( source(), originalName(), mProviderKey );
197+
QgsVectorLayer *layer = new QgsVectorLayer( source(), name(), mProviderKey );
198198
QgsMapLayer::clone( layer );
199199

200200
QList<QgsVectorLayerJoinInfo> joins = vectorJoins();
@@ -3997,7 +3997,7 @@ QString QgsVectorLayer::htmlMetadata() const
39973997
myMetadata += QLatin1String( "<table class=\"list-view\">\n" );
39983998

39993999
// original name
4000-
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Original" ) + QStringLiteral( "</td><td>" ) + originalName() + QStringLiteral( "</td></tr>\n" );
4000+
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Original" ) + QStringLiteral( "</td><td>" ) + name() + QStringLiteral( "</td></tr>\n" );
40014001

40024002
// name
40034003
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Name" ) + QStringLiteral( "</td><td>" ) + name() + QStringLiteral( "</td></tr>\n" );

‎src/core/raster/qgsrasterlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ QgsRasterLayer::~QgsRasterLayer()
146146

147147
QgsRasterLayer *QgsRasterLayer::clone() const
148148
{
149-
QgsRasterLayer *layer = new QgsRasterLayer( source(), originalName(), mProviderKey );
149+
QgsRasterLayer *layer = new QgsRasterLayer( source(), name(), mProviderKey );
150150
QgsMapLayer::clone( layer );
151151

152152
// do not clone data provider which is the first element in pipe
@@ -317,7 +317,7 @@ QString QgsRasterLayer::htmlMetadata() const
317317
myMetadata += QLatin1String( "<table class=\"list-view\">\n" );
318318

319319
// original name
320-
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Original" ) + QStringLiteral( "</td><td>" ) + originalName() + QStringLiteral( "</td></tr>\n" );
320+
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Original" ) + QStringLiteral( "</td><td>" ) + name() + QStringLiteral( "</td></tr>\n" );
321321

322322
// name
323323
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Name" ) + QStringLiteral( "</td><td>" ) + name() + QStringLiteral( "</td></tr>\n" );

0 commit comments

Comments
 (0)
Please sign in to comment.