21 #include <QMessageBox> 26 , mNameOnly( nameOnly )
27 , mPropertyDefinition( def )
31 mType->addItem( tr(
"String" ) );
32 mType->addItem( tr(
"Real" ) );
33 mType->addItem( tr(
"Integer" ) );
38 mType->setCurrentIndex( mType->findText( tr(
"String" ) ) );
41 mType->setCurrentIndex( mType->findText( tr(
"Real" ) ) );
44 mType->setCurrentIndex( mType->findText( tr(
"Integer" ) ) );
49 mType->setEnabled(
false );
51 mType->setEnabled(
true );
61 if ( mType->currentText().compare( tr(
"String" ) ) == 0 )
65 else if ( mType->currentText().compare( tr(
"Real" ) ) == 0 )
82 const QString title = tr(
"New Auxiliary Field" );
83 const QString msg = tr(
"Invalid name. Auxiliary field '%1' already exists." ).arg( fieldName );
84 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
86 else if ( def.
comment().isEmpty() )
88 const QString title = tr(
"New Auxiliary Field" );
89 const QString msg = tr(
"Name is a mandatory parameter." );
90 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
int lookupField(const QString &fieldName) const
Look up field's index from the field name.
QgsPropertyDefinition mPropertyDefinition
QgsNewAuxiliaryFieldDialog(const QgsPropertyDefinition &definition, QgsVectorLayer *layer, bool nameOnly=true, QWidget *parent=nullptr)
Constructor.
void setName(const QString &name)
Sets the name of the property.
DataType dataType() const
Returns the allowable field/value data type for the property.
QgsFields fields() const override
Returns the list of fields of this layer.
Property requires a boolean value.
Property requires a numeric value.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
void setDataType(DataType type)
Sets the data type.
Definition for a property.
QString comment() const
Returns the comment of the property.
Property requires a string value.
void setOrigin(const QString &origin)
Sets the origin of the property.
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
void setComment(const QString &comment)
Sets comment of the property.
bool addAuxiliaryField(const QgsPropertyDefinition &definition)
Adds an auxiliary field for the given property.
Represents a vector layer which manages a vector based data sets.
QgsPropertyDefinition propertyDefinition() const
Returns the underlying property definition.