23 #include <QMessageBox> 28 , mNameOnly( nameOnly )
29 , mPropertyDefinition( def )
38 mType->setCurrentIndex( mType->findData( def.
dataType() ) );
41 mType->setEnabled(
false );
43 mType->setEnabled(
true );
53 def.
setDataType( static_cast< QgsPropertyDefinition::DataType >( mType->currentData().toInt() ) );
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 );
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
QgsPropertyDefinition mPropertyDefinition
QgsNewAuxiliaryFieldDialog(const QgsPropertyDefinition &definition, QgsVectorLayer *layer, bool nameOnly=true, QWidget *parent=nullptr)
Constructor.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
static QgsGui * instance()
Returns a pointer to the singleton instance.
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 FINAL
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.
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...
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.