23 #include <QMessageBox>
28 , mNameOnly( nameOnly )
29 , mPropertyDefinition( def )
38 mType->setCurrentIndex( mType->findData( def.
dataType() ) );
41 mType->setEnabled(
false );
43 mType->setEnabled(
true );
63 const QString title = tr(
"New Auxiliary Field" );
64 const QString msg = tr(
"Invalid name. Auxiliary field '%1' already exists." ).arg( fieldName );
65 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
67 else if ( def.
comment().isEmpty() )
69 const QString title = tr(
"New Auxiliary Field" );
70 const QString msg = tr(
"Name is a mandatory parameter." );
71 QMessageBox::critical(
this, title, msg, QMessageBox::Ok );
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
bool addAuxiliaryField(const QgsPropertyDefinition &definition)
Adds an auxiliary field for the given property.
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
static QgsGui * instance()
Returns a pointer to the singleton instance.
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.
Represents a vector layer which manages a vector based data sets.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
QgsAuxiliaryLayer * auxiliaryLayer()
Returns the current auxiliary layer.