Rename name method to nameFromProperty

This commit is contained in:
Blottiere Paul 2017-08-30 21:05:59 +01:00
parent e05e920ec4
commit ba9a84f343
7 changed files with 9 additions and 15 deletions

View File

@ -46,8 +46,7 @@ class QgsAuxiliaryField : QgsField
:rtype: QgsPropertyDefinition :rtype: QgsPropertyDefinition
%End %End
static QString nameFromProperty( const QgsPropertyDefinition &def, bool joined = false );
static QString name( const QgsPropertyDefinition &def, bool joined = false );
%Docstring %Docstring
Returns the name of the auxiliary field for a property definition. Returns the name of the auxiliary field for a property definition.

View File

@ -1075,7 +1075,7 @@ void QgsDiagramProperties::createAuxiliaryField()
// update property with join field name from auxiliary storage // update property with join field name from auxiliary storage
QgsProperty property = button->toProperty(); QgsProperty property = button->toProperty();
property.setField( QgsAuxiliaryField::name( def, true ) ); property.setField( QgsAuxiliaryField::nameFromProperty( def, true ) );
property.setActive( true ); property.setActive( true );
button->updateFieldLists(); button->updateFieldLists();
button->setToProperty( property ); button->setToProperty( property );

View File

@ -645,7 +645,7 @@ void QgsLabelingGui::createAuxiliaryField()
// update property with join field name from auxiliary storage // update property with join field name from auxiliary storage
QgsProperty property = button->toProperty(); QgsProperty property = button->toProperty();
property.setField( QgsAuxiliaryField::name( def, true ) ); property.setField( QgsAuxiliaryField::nameFromProperty( def, true ) );
property.setActive( true ); property.setActive( true );
button->updateFieldLists(); button->updateFieldLists();
button->setToProperty( property ); button->setToProperty( property );

View File

@ -1645,7 +1645,7 @@ void QgsVectorLayerProperties::onAuxiliaryLayerDeleteField()
def.setOrigin( item->text( 0 ) ); def.setOrigin( item->text( 0 ) );
def.setName( item->text( 1 ) ); 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 ); const int index = mLayer->auxiliaryLayer()->fields().indexOf( fieldName );
if ( index < 0 ) if ( index < 0 )

View File

@ -107,7 +107,7 @@ void QgsAuxiliaryField::init( const QgsPropertyDefinition &def )
} }
setType( type ); setType( type );
setName( name( def ) ); setName( nameFromProperty( def ) );
setTypeName( typeName ); setTypeName( typeName );
setLength( len ); setLength( len );
setPrecision( precision ); setPrecision( precision );
@ -122,7 +122,7 @@ bool QgsAuxiliaryLayer::clear()
return rc; 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() ); QString fieldName = QString( "%2_%3" ).arg( def.origin(), def.name().toLower() );
@ -194,7 +194,7 @@ QgsVectorLayerJoinInfo QgsAuxiliaryLayer::joinInfo() const
bool QgsAuxiliaryLayer::exists( const QgsPropertyDefinition &definition ) 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 ) bool QgsAuxiliaryLayer::addAuxiliaryField( const QgsPropertyDefinition &definition )

View File

@ -60,18 +60,13 @@ class CORE_EXPORT QgsAuxiliaryField : public QgsField
*/ */
QgsPropertyDefinition propertyDefinition() const; 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 the name of the auxiliary field for a property definition.
* *
* \returns def The property definition * \returns def The property definition
* \returns joined The join prefix is tok into account if true * \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: private:
QgsAuxiliaryField( const QgsField &f ); // only for auxiliary layer QgsAuxiliaryField( const QgsField &f ); // only for auxiliary layer

View File

@ -342,7 +342,7 @@ void QgsPropertyOverrideButton::aboutToShowMenu()
mActionCreateAuxiliaryField->setChecked( false ); mActionCreateAuxiliaryField->setChecked( false );
if ( alayer && alayer->exists( mDefinition ) ) if ( alayer && alayer->exists( mDefinition ) )
{ {
if ( mProperty.field() == QgsAuxiliaryField::name( mDefinition, true ) ) if ( mProperty.field() == QgsAuxiliaryField::nameFromProperty( mDefinition, true ) )
{ {
mActionCreateAuxiliaryField->setEnabled( false ); mActionCreateAuxiliaryField->setEnabled( false );
mActionCreateAuxiliaryField->setChecked( true ); mActionCreateAuxiliaryField->setChecked( true );