mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Add an origin (PAL or Diagram) to QgsProperty
This commit is contained in:
parent
37783f7444
commit
fa4777ead2
@ -67,20 +67,27 @@ class QgsPropertyDefinition
|
||||
DataTypeBoolean,
|
||||
};
|
||||
|
||||
enum Origin
|
||||
{
|
||||
Diagram,
|
||||
Pal
|
||||
};
|
||||
|
||||
QgsPropertyDefinition();
|
||||
%Docstring
|
||||
Constructs an empty property.
|
||||
%End
|
||||
|
||||
QgsPropertyDefinition( const QString &name, const QString &description, StandardPropertyTemplate type );
|
||||
QgsPropertyDefinition( const QString &name, const QString &description, StandardPropertyTemplate type, Origin origin = QgsPropertyDefinition::Pal );
|
||||
%Docstring
|
||||
Constructor for QgsPropertyDefinition, using a standard property template.
|
||||
\param name is used internally and should be a unique, alphanumeric string.
|
||||
\param description can be any localised string describing what the property is used for.
|
||||
\param type one of the predefined standard property template
|
||||
\param origin The origin of the property
|
||||
%End
|
||||
|
||||
QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText );
|
||||
QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, Origin origin = QgsPropertyDefinition::Pal );
|
||||
%Docstring
|
||||
Constructor for custom QgsPropertyDefinitions.
|
||||
\param name is used internally and should be a unique, alphanumeric string.
|
||||
@ -88,6 +95,7 @@ class QgsPropertyDefinition
|
||||
\param description can be any localised string describing what the property is used for.
|
||||
\param helpText parameter should specify a descriptive string for users outlining the types
|
||||
of value acceptable by the property (eg 'dashed' or 'solid' for a line style property).
|
||||
\param origin The origin of the property
|
||||
%End
|
||||
|
||||
QString name() const;
|
||||
@ -96,6 +104,12 @@ class QgsPropertyDefinition
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
Origin origin() const;
|
||||
%Docstring
|
||||
Returns the origin of the property
|
||||
:rtype: Origin
|
||||
%End
|
||||
|
||||
QString description() const;
|
||||
%Docstring
|
||||
Descriptive name of the property.
|
||||
|
@ -34,20 +34,22 @@ void QgsDiagramLayerSettings::initPropertyDefinitions()
|
||||
if ( !sPropertyDefinitions.isEmpty() )
|
||||
return;
|
||||
|
||||
QgsPropertyDefinition::Origin origin = QgsPropertyDefinition::Diagram;
|
||||
|
||||
sPropertyDefinitions = QgsPropertiesDefinition
|
||||
{
|
||||
{ QgsDiagramLayerSettings::BackgroundColor, QgsPropertyDefinition( "backgroundColor", QObject::tr( "Background color" ), QgsPropertyDefinition::ColorWithAlpha ) },
|
||||
{ QgsDiagramLayerSettings::StrokeColor, QgsPropertyDefinition( "strokeColor", QObject::tr( "Stroke color" ), QgsPropertyDefinition::ColorWithAlpha ) },
|
||||
{ QgsDiagramLayerSettings::StrokeWidth, QgsPropertyDefinition( "strokeWidth", QObject::tr( "Stroke width" ), QgsPropertyDefinition::StrokeWidth ) },
|
||||
{ QgsDiagramLayerSettings::PositionX, QgsPropertyDefinition( "positionX", QObject::tr( "Position (X)" ), QgsPropertyDefinition::Double ) },
|
||||
{ QgsDiagramLayerSettings::PositionY, QgsPropertyDefinition( "positionY", QObject::tr( "Position (Y)" ), QgsPropertyDefinition::Double ) },
|
||||
{ QgsDiagramLayerSettings::Distance, QgsPropertyDefinition( "distance", QObject::tr( "Placement distance" ), QgsPropertyDefinition::DoublePositive ) },
|
||||
{ QgsDiagramLayerSettings::Priority, QgsPropertyDefinition( "priority", QObject::tr( "Placement priority" ), QgsPropertyDefinition::DoublePositive ) },
|
||||
{ QgsDiagramLayerSettings::ZIndex, QgsPropertyDefinition( "zIndex", QObject::tr( "Placement z-index" ), QgsPropertyDefinition::Double ) },
|
||||
{ QgsDiagramLayerSettings::IsObstacle, QgsPropertyDefinition( "isObstacle", QObject::tr( "Diagram is an obstacle" ), QgsPropertyDefinition::Boolean ) },
|
||||
{ QgsDiagramLayerSettings::Show, QgsPropertyDefinition( "show", QObject::tr( "Show diagram" ), QgsPropertyDefinition::Boolean ) },
|
||||
{ QgsDiagramLayerSettings::AlwaysShow, QgsPropertyDefinition( "alwaysShow", QObject::tr( "Always show diagram" ), QgsPropertyDefinition::Boolean ) },
|
||||
{ QgsDiagramLayerSettings::StartAngle, QgsPropertyDefinition( "startAngle", QObject::tr( "Pie chart start angle" ), QgsPropertyDefinition::Rotation ) },
|
||||
{ QgsDiagramLayerSettings::BackgroundColor, QgsPropertyDefinition( "backgroundColor", QObject::tr( "Background color" ), QgsPropertyDefinition::ColorWithAlpha, origin ) },
|
||||
{ QgsDiagramLayerSettings::StrokeColor, QgsPropertyDefinition( "strokeColor", QObject::tr( "Stroke color" ), QgsPropertyDefinition::ColorWithAlpha, origin ) },
|
||||
{ QgsDiagramLayerSettings::StrokeWidth, QgsPropertyDefinition( "strokeWidth", QObject::tr( "Stroke width" ), QgsPropertyDefinition::StrokeWidth, origin ) },
|
||||
{ QgsDiagramLayerSettings::PositionX, QgsPropertyDefinition( "positionX", QObject::tr( "Position (X)" ), QgsPropertyDefinition::Double, origin ) },
|
||||
{ QgsDiagramLayerSettings::PositionY, QgsPropertyDefinition( "positionY", QObject::tr( "Position (Y)" ), QgsPropertyDefinition::Double, origin ) },
|
||||
{ QgsDiagramLayerSettings::Distance, QgsPropertyDefinition( "distance", QObject::tr( "Placement distance" ), QgsPropertyDefinition::DoublePositive, origin ) },
|
||||
{ QgsDiagramLayerSettings::Priority, QgsPropertyDefinition( "priority", QObject::tr( "Placement priority" ), QgsPropertyDefinition::DoublePositive, origin ) },
|
||||
{ QgsDiagramLayerSettings::ZIndex, QgsPropertyDefinition( "zIndex", QObject::tr( "Placement z-index" ), QgsPropertyDefinition::Double, origin ) },
|
||||
{ QgsDiagramLayerSettings::IsObstacle, QgsPropertyDefinition( "isObstacle", QObject::tr( "Diagram is an obstacle" ), QgsPropertyDefinition::Boolean, origin ) },
|
||||
{ QgsDiagramLayerSettings::Show, QgsPropertyDefinition( "show", QObject::tr( "Show diagram" ), QgsPropertyDefinition::Boolean, origin ) },
|
||||
{ QgsDiagramLayerSettings::AlwaysShow, QgsPropertyDefinition( "alwaysShow", QObject::tr( "Always show diagram" ), QgsPropertyDefinition::Boolean, origin ) },
|
||||
{ QgsDiagramLayerSettings::StartAngle, QgsPropertyDefinition( "startAngle", QObject::tr( "Pie chart start angle" ), QgsPropertyDefinition::Rotation, origin ) },
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,11 @@
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, const QString &description, QgsPropertyDefinition::StandardPropertyTemplate type )
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, const QString &description, QgsPropertyDefinition::StandardPropertyTemplate type, Origin origin )
|
||||
: mName( name )
|
||||
, mDescription( description )
|
||||
, mStandardType( type )
|
||||
, mOrigin( origin )
|
||||
{
|
||||
switch ( mStandardType )
|
||||
{
|
||||
@ -169,11 +170,12 @@ QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, const QString
|
||||
}
|
||||
}
|
||||
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText )
|
||||
QgsPropertyDefinition::QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, Origin origin )
|
||||
: mName( name )
|
||||
, mDescription( description )
|
||||
, mTypes( dataType )
|
||||
, mHelpText( helpText )
|
||||
, mOrigin( origin )
|
||||
{}
|
||||
|
||||
bool QgsPropertyDefinition::supportsAssistant() const
|
||||
|
@ -105,6 +105,12 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
DataTypeBoolean,
|
||||
};
|
||||
|
||||
enum Origin
|
||||
{
|
||||
Diagram,
|
||||
Pal
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs an empty property.
|
||||
*/
|
||||
@ -115,8 +121,9 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
* \param name is used internally and should be a unique, alphanumeric string.
|
||||
* \param description can be any localised string describing what the property is used for.
|
||||
* \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 );
|
||||
QgsPropertyDefinition( const QString &name, const QString &description, StandardPropertyTemplate type, Origin origin = QgsPropertyDefinition::Pal );
|
||||
|
||||
/**
|
||||
* Constructor for custom QgsPropertyDefinitions.
|
||||
@ -125,14 +132,20 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
* \param description can be any localised string describing what the property is used for.
|
||||
* \param helpText parameter should specify a descriptive string for users outlining the types
|
||||
* 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 );
|
||||
QgsPropertyDefinition( const QString &name, DataType dataType, const QString &description, const QString &helpText, Origin origin = QgsPropertyDefinition::Pal );
|
||||
|
||||
/**
|
||||
* Returns the name of the property. This is used internally and should be a unique, alphanumeric string.
|
||||
*/
|
||||
QString name() const { return mName; }
|
||||
|
||||
/**
|
||||
* Returns the origin of the property
|
||||
*/
|
||||
Origin origin() const { return mOrigin; }
|
||||
|
||||
/**
|
||||
* Descriptive name of the property.
|
||||
*/
|
||||
@ -167,6 +180,7 @@ class CORE_EXPORT QgsPropertyDefinition
|
||||
DataType mTypes = DataTypeString;
|
||||
QString mHelpText;
|
||||
StandardPropertyTemplate mStandardType = Custom;
|
||||
Origin mOrigin;
|
||||
|
||||
static QString trString();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user