29 , mNameOnly( nameOnly )
30 , mPropertyDefinition( def )
39 mType->setCurrentIndex( mType->findData( def.
dataType() ) );
42 mType->setEnabled(
false );
44 mType->setEnabled(
true );
64 const QString title = tr(
"New Auxiliary Field" );
65 const QString msg = tr(
"Invalid name. Auxiliary field '%1' already exists." ).arg( fieldName );
66 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
68 else if ( def.
comment().isEmpty() )
70 const QString title = tr(
"New Auxiliary Field" );
71 const QString msg = tr(
"Name is a mandatory parameter." );
72 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
bool addAuxiliaryField(const QgsPropertyDefinition &definition)
Adds an auxiliary field for the given property.
static QIcon iconForFieldType(QMetaType::Type type, QMetaType::Type subType=QMetaType::Type::UnknownType, const QString &typeString=QString())
Returns an icon corresponding to a field type.
Q_INVOKABLE int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
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...
QgsPropertyDefinition mPropertyDefinition
QgsPropertyDefinition propertyDefinition() const
Returns the underlying property definition.
QgsNewAuxiliaryFieldDialog(const QgsPropertyDefinition &definition, QgsVectorLayer *layer, bool nameOnly=true, QWidget *parent=nullptr)
Constructor.
Definition for a property.
QString comment() const
Returns the comment of the property.
DataType dataType() const
Returns the allowable field/value data type for the property.
void setOrigin(const QString &origin)
Sets the origin of the property.
void setDataType(DataType type)
Sets the data type.
void setName(const QString &name)
Sets the name of the property.
void setComment(const QString &comment)
Sets comment of the property.
DataType
Valid data types required by property.
@ DataTypeString
Property requires a string value.
@ DataTypeBoolean
Property requires a boolean value.
@ DataTypeNumeric
Property requires a numeric value.
static QString typeToDisplayString(QMetaType::Type type, QMetaType::Type subType=QMetaType::Type::UnknownType)
Returns a user-friendly translated string representing a QVariant type.
Represents a vector layer which manages a vector based data sets.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.