mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Origin in QgsProperty is a string and pal is replaced by labeling
This commit is contained in:
parent
c22bfdc8de
commit
fcdf20df95
@ -67,18 +67,12 @@ class QgsPropertyDefinition
|
||||
DataTypeBoolean,
|
||||
};
|
||||
|
||||
enum Origin
|
||||
{
|
||||
Diagram,
|
||||
Pal
|
||||
};
|
||||
|
||||
QgsPropertyDefinition();
|
||||
%Docstring
|
||||
Constructs an empty property.
|
||||
%End
|
||||
|
||||
QgsPropertyDefinition( const QString &name, const QString &description, StandardPropertyTemplate type, Origin origin = QgsPropertyDefinition::Pal );
|
||||
QgsPropertyDefinition( const QString &name, const QString &description, StandardPropertyTemplate type, const QString &origin = QStringLiteral( "labeling" ) );
|
||||
%Docstring
|
||||
Constructor for QgsPropertyDefinition, using a standard property template.
|
||||
\param name is used internally and should be a unique, alphanumeric string.
|
||||
@ -87,7 +81,7 @@ class QgsPropertyDefinition
|
||||
\param origin The origin of the property
|
||||
%End
|
||||
|
||||
QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, Origin origin = QgsPropertyDefinition::Pal );
|
||||
QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, const QString &origin = QStringLiteral( "labeling" ) );
|
||||
%Docstring
|
||||
Constructor for custom QgsPropertyDefinitions.
|
||||
\param name is used internally and should be a unique, alphanumeric string.
|
||||
@ -109,13 +103,13 @@ class QgsPropertyDefinition
|
||||
Sets the name of the property
|
||||
%End
|
||||
|
||||
Origin origin() const;
|
||||
QString origin() const;
|
||||
%Docstring
|
||||
Returns the origin of the property
|
||||
:rtype: Origin
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
void setOrigin( Origin origin );
|
||||
void setOrigin( const QString &origin );
|
||||
%Docstring
|
||||
Sets origin of the property
|
||||
%End
|
||||
|
@ -1528,13 +1528,7 @@ void QgsVectorLayerProperties::updateAuxiliaryStoragePage( bool reset )
|
||||
const QgsPropertyDefinition prop = field.propertyDefinition();
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
|
||||
if ( prop.origin() == QgsPropertyDefinition::Pal )
|
||||
item->setText( 0, "Pal" );
|
||||
else if ( prop.origin() == QgsPropertyDefinition::Diagram )
|
||||
item->setText( 0, "Diagram" );
|
||||
else
|
||||
item->setText( 0, "Unknown" );
|
||||
|
||||
item->setText( 0, prop.origin() );
|
||||
item->setText( 1, prop.name() );
|
||||
item->setText( 2, field.typeName() );
|
||||
|
||||
@ -1648,12 +1642,7 @@ void QgsVectorLayerProperties::onAuxiliaryLayerDeleteField()
|
||||
// get auxiliary field name and index from item
|
||||
const QTreeWidgetItem *item = items[0];
|
||||
QgsPropertyDefinition def;
|
||||
|
||||
if ( item->text( 0 ).compare( "pal", Qt::CaseInsensitive ) == 0 )
|
||||
def.setOrigin( QgsPropertyDefinition::Pal );
|
||||
else
|
||||
def.setOrigin( QgsPropertyDefinition::Diagram );
|
||||
|
||||
def.setOrigin( item->text( 0 ) );
|
||||
def.setName( item->text( 1 ) );
|
||||
|
||||
const QString fieldName = QgsAuxiliaryField::name( def );
|
||||
|
@ -47,7 +47,7 @@ QgsAuxiliaryField::QgsAuxiliaryField( const QgsField &f )
|
||||
const QString propertyName = parts[1];
|
||||
QgsPropertyDefinition def;
|
||||
|
||||
if ( origin.compare( "pal", Qt::CaseInsensitive ) == 0 )
|
||||
if ( origin.compare( "labeling", Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
const QgsPropertiesDefinition props = QgsPalLayerSettings::propertyDefinitions();
|
||||
Q_FOREACH ( const QgsPropertyDefinition p, props.values() )
|
||||
@ -126,20 +126,7 @@ bool QgsAuxiliaryLayer::clear()
|
||||
|
||||
QString QgsAuxiliaryField::name( const QgsPropertyDefinition &def, bool joined )
|
||||
{
|
||||
QString origin;
|
||||
switch ( def.origin() )
|
||||
{
|
||||
case QgsPropertyDefinition::Pal:
|
||||
origin = "pal";
|
||||
break;
|
||||
case QgsPropertyDefinition::Diagram:
|
||||
origin = "diagram";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QString fieldName = QString( "%2_%3" ).arg( origin, def.name().toLower() );
|
||||
QString fieldName = QString( "%2_%3" ).arg( def.origin(), def.name().toLower() );
|
||||
|
||||
if ( joined )
|
||||
fieldName = QString( "%1%2" ).arg( AS_JOINPREFIX, fieldName );
|
||||
|
@ -34,7 +34,7 @@ void QgsDiagramLayerSettings::initPropertyDefinitions()
|
||||
if ( !sPropertyDefinitions.isEmpty() )
|
||||
return;
|
||||
|
||||
QgsPropertyDefinition::Origin origin = QgsPropertyDefinition::Diagram;
|
||||
const QString origin = QStringLiteral( "diagram" );
|
||||
|
||||
sPropertyDefinitions = QgsPropertiesDefinition
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, const QString &description, QgsPropertyDefinition::StandardPropertyTemplate type, Origin origin )
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, const QString &description, QgsPropertyDefinition::StandardPropertyTemplate type, const QString &origin )
|
||||
: mName( name )
|
||||
, mDescription( description )
|
||||
, mStandardType( type )
|
||||
@ -170,7 +170,7 @@ QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, const QString
|
||||
}
|
||||
}
|
||||
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, Origin origin )
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, const QString &origin )
|
||||
: mName( name )
|
||||
, mDescription( description )
|
||||
, mTypes( dataType )
|
||||
|
@ -105,13 +105,6 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
DataTypeBoolean,
|
||||
};
|
||||
|
||||
//! Indicates for which settings the property has been set
|
||||
enum Origin
|
||||
{
|
||||
Diagram,
|
||||
Pal
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs an empty property.
|
||||
*/
|
||||
@ -124,7 +117,7 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
* \param type one of the predefined standard property template
|
||||
* \param origin The origin of the property
|
||||
*/
|
||||
QgsPropertyDefinition( const QString &name, const QString &description, StandardPropertyTemplate type, Origin origin = QgsPropertyDefinition::Pal );
|
||||
QgsPropertyDefinition( const QString &name, const QString &description, StandardPropertyTemplate type, const QString &origin = QStringLiteral( "labeling" ) );
|
||||
|
||||
/**
|
||||
* Constructor for custom QgsPropertyDefinitions.
|
||||
@ -135,7 +128,7 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
* of value acceptable by the property (eg 'dashed' or 'solid' for a line style property).
|
||||
* \param origin The origin of the property
|
||||
*/
|
||||
QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, Origin origin = QgsPropertyDefinition::Pal );
|
||||
QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, const QString &origin = QStringLiteral( "labeling" ) );
|
||||
|
||||
/**
|
||||
* Returns the name of the property. This is used internally and should be a unique, alphanumeric string.
|
||||
@ -150,12 +143,12 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
/**
|
||||
* Returns the origin of the property
|
||||
*/
|
||||
Origin origin() const { return mOrigin; }
|
||||
QString origin() const { return mOrigin; }
|
||||
|
||||
/**
|
||||
* Sets origin of the property
|
||||
*/
|
||||
void setOrigin( Origin origin ) { mOrigin = origin; }
|
||||
void setOrigin( const QString &origin ) { mOrigin = origin; }
|
||||
|
||||
/**
|
||||
* Descriptive name of the property.
|
||||
@ -191,7 +184,7 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
DataType mTypes = DataTypeString;
|
||||
QString mHelpText;
|
||||
StandardPropertyTemplate mStandardType = Custom;
|
||||
Origin mOrigin;
|
||||
QString mOrigin;
|
||||
|
||||
static QString trString();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user