22 #include <QMessageBox> 27 , mNameOnly( nameOnly )
28 , mPropertyDefinition( def )
33 mType->addItem( tr(
"String" ) );
34 mType->addItem( tr(
"Real" ) );
35 mType->addItem( tr(
"Integer" ) );
40 mType->setCurrentIndex( mType->findText( tr(
"String" ) ) );
43 mType->setCurrentIndex( mType->findText( tr(
"Real" ) ) );
46 mType->setCurrentIndex( mType->findText( tr(
"Integer" ) ) );
51 mType->setEnabled(
false );
53 mType->setEnabled(
true );
63 if ( mType->currentText().compare( tr(
"String" ) ) == 0 )
67 else if ( mType->currentText().compare( tr(
"Real" ) ) == 0 )
84 const QString title = tr(
"New Auxiliary Field" );
85 const QString msg = tr(
"Invalid name. Auxiliary field '%1' already exists." ).arg( fieldName );
86 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
88 else if ( def.
comment().isEmpty() )
90 const QString title = tr(
"New Auxiliary Field" );
91 const QString msg = tr(
"Name is a mandatory parameter." );
92 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
QgsPropertyDefinition mPropertyDefinition
QgsNewAuxiliaryFieldDialog(const QgsPropertyDefinition &definition, QgsVectorLayer *layer, bool nameOnly=true, QWidget *parent=nullptr)
Constructor.
DataType dataType() const
Returns the allowable field/value data type for the property.
static QgsGui * instance()
Returns a pointer to the singleton instance.
void setName(const QString &name)
Sets the name of the property.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
Property requires a boolean value.
Property requires a numeric value.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.
void setDataType(DataType type)
Sets the data type.
Definition for a 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.
QgsPropertyDefinition propertyDefinition() const
Returns the underlying property definition.
void setComment(const QString &comment)
Sets comment of the property.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
QString comment() const
Returns the 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.