Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename name method to nameFromProperty
  • Loading branch information
pblottiere committed Oct 9, 2017
1 parent e05e920 commit ba9a84f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 15 deletions.
3 changes: 1 addition & 2 deletions python/core/qgsauxiliarystorage.sip
Expand Up @@ -46,8 +46,7 @@ class QgsAuxiliaryField : QgsField
:rtype: QgsPropertyDefinition
%End


static QString name( const QgsPropertyDefinition &def, bool joined = false );
static QString nameFromProperty( const QgsPropertyDefinition &def, bool joined = false );
%Docstring
Returns the name of the auxiliary field for a property definition.

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdiagramproperties.cpp
Expand Up @@ -1075,7 +1075,7 @@ void QgsDiagramProperties::createAuxiliaryField()

// update property with join field name from auxiliary storage
QgsProperty property = button->toProperty();
property.setField( QgsAuxiliaryField::name( def, true ) );
property.setField( QgsAuxiliaryField::nameFromProperty( def, true ) );
property.setActive( true );
button->updateFieldLists();
button->setToProperty( property );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgslabelinggui.cpp
Expand Up @@ -645,7 +645,7 @@ void QgsLabelingGui::createAuxiliaryField()

// update property with join field name from auxiliary storage
QgsProperty property = button->toProperty();
property.setField( QgsAuxiliaryField::name( def, true ) );
property.setField( QgsAuxiliaryField::nameFromProperty( def, true ) );
property.setActive( true );
button->updateFieldLists();
button->setToProperty( property );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -1645,7 +1645,7 @@ void QgsVectorLayerProperties::onAuxiliaryLayerDeleteField()
def.setOrigin( item->text( 0 ) );
def.setName( item->text( 1 ) );

const QString fieldName = QgsAuxiliaryField::name( def );
const QString fieldName = QgsAuxiliaryField::nameFromProperty( def );

const int index = mLayer->auxiliaryLayer()->fields().indexOf( fieldName );
if ( index < 0 )
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsauxiliarystorage.cpp
Expand Up @@ -107,7 +107,7 @@ void QgsAuxiliaryField::init( const QgsPropertyDefinition &def )
}

setType( type );
setName( name( def ) );
setName( nameFromProperty( def ) );
setTypeName( typeName );
setLength( len );
setPrecision( precision );
Expand All @@ -122,7 +122,7 @@ bool QgsAuxiliaryLayer::clear()
return rc;
}

QString QgsAuxiliaryField::name( const QgsPropertyDefinition &def, bool joined )
QString QgsAuxiliaryField::nameFromProperty( const QgsPropertyDefinition &def, bool joined )
{
QString fieldName = QString( "%2_%3" ).arg( def.origin(), def.name().toLower() );

Expand Down Expand Up @@ -194,7 +194,7 @@ QgsVectorLayerJoinInfo QgsAuxiliaryLayer::joinInfo() const

bool QgsAuxiliaryLayer::exists( const QgsPropertyDefinition &definition ) const
{
return ( fields().indexOf( QgsAuxiliaryField::name( definition ) ) >= 0 );
return ( fields().indexOf( QgsAuxiliaryField::nameFromProperty( definition ) ) >= 0 );
}

bool QgsAuxiliaryLayer::addAuxiliaryField( const QgsPropertyDefinition &definition )
Expand Down
7 changes: 1 addition & 6 deletions src/core/qgsauxiliarystorage.h
Expand Up @@ -60,18 +60,13 @@ class CORE_EXPORT QgsAuxiliaryField : public QgsField
*/
QgsPropertyDefinition propertyDefinition() const;

/**
* Returns the name of the field.
*/
using QgsField::name SIP_SKIP;

/**
* Returns the name of the auxiliary field for a property definition.
*
* \returns def The property definition
* \returns joined The join prefix is tok into account if true
*/
static QString name( const QgsPropertyDefinition &def, bool joined = false );
static QString nameFromProperty( const QgsPropertyDefinition &def, bool joined = false );

private:
QgsAuxiliaryField( const QgsField &f ); // only for auxiliary layer
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgspropertyoverridebutton.cpp
Expand Up @@ -342,7 +342,7 @@ void QgsPropertyOverrideButton::aboutToShowMenu()
mActionCreateAuxiliaryField->setChecked( false );
if ( alayer && alayer->exists( mDefinition ) )
{
if ( mProperty.field() == QgsAuxiliaryField::name( mDefinition, true ) )
if ( mProperty.field() == QgsAuxiliaryField::nameFromProperty( mDefinition, true ) )
{
mActionCreateAuxiliaryField->setEnabled( false );
mActionCreateAuxiliaryField->setChecked( true );
Expand Down

0 comments on commit ba9a84f

Please sign in to comment.