QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
#include <qgseditformconfig.h>
Classes | |
struct | GroupData |
struct | TabData |
Public Types | |
enum | EditorLayout { GeneratedLayout = 0, TabLayout = 1, UiFileLayout = 2 } |
The different types to layout the attribute editor. More... | |
enum | FeatureFormSuppress { SuppressDefault = 0, SuppressOn = 1, SuppressOff = 2 } |
Types of feature form suppression after feature creation. More... | |
enum | PythonInitCodeSource { CodeSourceNone = 0, CodeSourceFile = 1, CodeSourceDialog = 2, CodeSourceEnvironment = 3 } |
The python init code source options. More... | |
Public Member Functions | |
void | addTab (QgsAttributeEditorElement *data) |
This is only useful in combination with EditorLayout::TabLayout. More... | |
QgsAttributeEditorElement * | attributeEditorElementFromDomElement (QDomElement &elem, QObject *parent) |
Deserialize drag and drop designer elements. More... | |
void | clearTabs () |
Clears all the tabs for the attribute editor form with EditorLayout::TabLayout. More... | |
QString | expression (int idx) const |
Returns the constraint expression of a specific field. More... | |
QString | expressionDescription (int idx) const |
Returns the constraint expression description of a specific filed. More... | |
QString | initCode () const |
Get python code for edit form initialization. More... | |
PythonInitCodeSource | initCodeSource () const |
Return python code source for edit form initialization (if it shall be loaded from a file, read from the provided dialog editor or inherited from the environment) More... | |
QString | initFilePath () const |
Get python external file path for edit form initialization. More... | |
QString | initFunction () const |
Get python function for edit form initialization. More... | |
bool | labelOnTop (int idx) const |
If this returns true, the widget at the given index will receive its label on the previous line while if it returns false, the widget will receive its label on the left hand side. More... | |
EditorLayout | layout () const |
Get the active layout style for the attribute editor for this layer. More... | |
bool | notNull (int fieldidx) const |
Returns if the field at fieldidx should be treated as NOT NULL value. More... | |
bool | readOnly (int idx) const |
This returns true if the field is manually set to read only or if the field does not support editing like joins or virtual fields. More... | |
void | readXml (const QDomNode &node) |
Read XML information Deserialize on project load. More... | |
bool | removeWidgetConfig (int fieldIdx) |
Remove the configuration for the editor widget used to represent the field at the given index. More... | |
bool | removeWidgetConfig (const QString &widgetName) |
Remove the configuration for the editor widget used to represent the field with the given name. More... | |
void | setExpression (int idx, const QString &str) |
Set the constraint expression for a specific field. More... | |
void | setExpressionDescription (int idx, const QString &descr) |
Set the constraint expression description for a specific field. More... | |
void | setInitCode (const QString &code) |
Set python code for edit form initialization. More... | |
void | setInitCodeSource (const PythonInitCodeSource initCodeSource) |
Set if python code shall be used for edit form initialization and its origin. More... | |
void | setInitFilePath (const QString &filePath) |
Set python external file path for edit form initialization. More... | |
void | setInitFunction (const QString &function) |
Set python function for edit form initialization. More... | |
void | setLabelOnTop (int idx, bool onTop) |
If this is set to true, the widget at the given index will receive its label on the previous line while if it is set to false, the widget will receive its label on the left hand side. More... | |
void | setLayout (EditorLayout editorLayout) |
Set the active layout style for the attribute editor for this layer. More... | |
void | setNotNull (int idx, bool notnull=true) |
Set if the field at fieldidx should be treated as NOT NULL value. More... | |
void | setReadOnly (int idx, bool readOnly=true) |
If set to false, the widget at the given index will be read-only. More... | |
void | setSuppress (FeatureFormSuppress s) |
Set type of feature form pop-up suppression after feature creation (overrides app setting) More... | |
void | setUiForm (const QString &ui) |
Set path to the .ui form. More... | |
void | setWidgetConfig (int attrIdx, const QgsEditorWidgetConfig &config) |
Set the editor widget config for a field. More... | |
void | setWidgetConfig (const QString &widgetName, const QgsEditorWidgetConfig &config) |
Set the editor widget config for a widget. More... | |
void | setWidgetType (int fieldIdx, const QString &widgetType) |
Set the editor widget type for a field. More... | |
FeatureFormSuppress | suppress () const |
Type of feature form pop-up suppression after feature creation (overrides app setting) More... | |
QList< QgsAttributeEditorElement *> | tabs () const |
Returns a list of tabs for EditorLayout::TabLayout. More... | |
QString | uiForm () const |
Get path to the .ui form. More... | |
QgsEditorWidgetConfig | widgetConfig (int fieldIdx) const |
Get the configuration for the editor widget used to represent the field at the given index. More... | |
QgsEditorWidgetConfig | widgetConfig (const QString &widgetName) const |
Get the configuration for the editor widget used to represent the field with the given name. More... | |
QString | widgetType (int fieldIdx) const |
Get the id for the editor widget used to represent the field at the given index. More... | |
QString | widgetType (const QString &fieldName) const |
Get the id for the editor widget used to represent the field at the given index. More... | |
void | writeXml (QDomNode &node) const |
Write XML information Serialize on project save. More... | |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Protected Member Functions | |
QgsEditFormConfig (QObject *parent=nullptr) | |
Create a new edit form config. More... | |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Friends | |
class | QgsVectorLayer |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Definition at line 355 of file qgseditformconfig.h.
The different types to layout the attribute editor.
Definition at line 362 of file qgseditformconfig.h.
Types of feature form suppression after feature creation.
Enumerator | |
---|---|
SuppressDefault | Use the application-wide setting. |
SuppressOn | Suppress feature form. |
SuppressOff | Do not suppress feature form. |
Definition at line 396 of file qgseditformconfig.h.
The python init code source options.
Definition at line 406 of file qgseditformconfig.h.
|
explicitprotected |
Create a new edit form config.
Normally invoked by QgsVectorLayer
Definition at line 18 of file qgseditformconfig.cpp.
|
inline |
This is only useful in combination with EditorLayout::TabLayout.
Adds a new element to the layout.
Definition at line 419 of file qgseditformconfig.h.
QgsAttributeEditorElement * QgsEditFormConfig::attributeEditorElementFromDomElement | ( | QDomElement & | elem, |
QObject * | parent | ||
) |
Deserialize drag and drop designer elements.
Definition at line 413 of file qgseditformconfig.cpp.
|
inline |
Clears all the tabs for the attribute editor form with EditorLayout::TabLayout.
Definition at line 429 of file qgseditformconfig.h.
QString QgsEditFormConfig::expression | ( | int | idx | ) | const |
Returns the constraint expression of a specific field.
idx | The index of the field |
Definition at line 122 of file qgseditformconfig.cpp.
QString QgsEditFormConfig::expressionDescription | ( | int | idx | ) | const |
Returns the constraint expression description of a specific filed.
idx | The index of the field |
Definition at line 138 of file qgseditformconfig.cpp.
|
inline |
Get python code for edit form initialization.
Definition at line 658 of file qgseditformconfig.h.
|
inline |
Return python code source for edit form initialization (if it shall be loaded from a file, read from the provided dialog editor or inherited from the environment)
Definition at line 683 of file qgseditformconfig.h.
|
inline |
Get python external file path for edit form initialization.
Definition at line 670 of file qgseditformconfig.h.
|
inline |
Get python function for edit form initialization.
Will be looked up in a python file relative to the project folder if it includes a module name or if it's a pure function name it will searched in the python code set with setInitCode.
Definition at line 645 of file qgseditformconfig.h.
bool QgsEditFormConfig::labelOnTop | ( | int | idx | ) | const |
If this returns true, the widget at the given index will receive its label on the previous line while if it returns false, the widget will receive its label on the left hand side.
Labeling on top leaves more horizontal space for the widget itself.
Definition at line 114 of file qgseditformconfig.cpp.
|
inline |
Get the active layout style for the attribute editor for this layer.
Definition at line 432 of file qgseditformconfig.h.
bool QgsEditFormConfig::notNull | ( | int | fieldidx | ) | const |
Returns if the field at fieldidx should be treated as NOT NULL value.
Definition at line 154 of file qgseditformconfig.cpp.
bool QgsEditFormConfig::readOnly | ( | int | idx | ) | const |
This returns true if the field is manually set to read only or if the field does not support editing like joins or virtual fields.
Definition at line 101 of file qgseditformconfig.cpp.
void QgsEditFormConfig::readXml | ( | const QDomNode & | node | ) |
Read XML information Deserialize on project load.
TODO: MAKE THIS MORE GENERIC, SO INDIVIDUALL WIDGETS CAN NOT ONLY SAVE STRINGS SEE QgsEditorWidgetFactory::writeConfig
Definition at line 180 of file qgseditformconfig.cpp.
bool QgsEditFormConfig::removeWidgetConfig | ( | int | fieldIdx | ) |
Remove the configuration for the editor widget used to represent the field at the given index.
fieldIdx | The index of the field |
Definition at line 80 of file qgseditformconfig.cpp.
bool QgsEditFormConfig::removeWidgetConfig | ( | const QString & | widgetName | ) |
Remove the configuration for the editor widget used to represent the field with the given name.
widgetName | The name of the widget. This can be a field name or the name of an additional widget. |
Definition at line 75 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setExpression | ( | int | idx, |
const QString & | str | ||
) |
Set the constraint expression for a specific field.
idx | the field index |
str | the constraint expression |
Definition at line 132 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setExpressionDescription | ( | int | idx, |
const QString & | descr | ||
) |
Set the constraint expression description for a specific field.
idx | The index of the field |
descr | The description of the expression |
Definition at line 148 of file qgseditformconfig.cpp.
|
inline |
Set python code for edit form initialization.
Make sure that you also set the appropriate function name in setInitFunction
Definition at line 665 of file qgseditformconfig.h.
|
inline |
Set if python code shall be used for edit form initialization and its origin.
Definition at line 686 of file qgseditformconfig.h.
|
inline |
Set python external file path for edit form initialization.
Make sure that you also set the appropriate function name in setInitFunction
Definition at line 677 of file qgseditformconfig.h.
|
inline |
Set python function for edit form initialization.
Will be looked up in a python file relative to the project folder if it includes a module name or if it's a pure function name it will searched in the python code set with setInitCode.
Definition at line 653 of file qgseditformconfig.h.
void QgsEditFormConfig::setLabelOnTop | ( | int | idx, |
bool | onTop | ||
) |
If this is set to true, the widget at the given index will receive its label on the previous line while if it is set to false, the widget will receive its label on the left hand side.
Labeling on top leaves more horizontal space for the widget itself.
Definition at line 168 of file qgseditformconfig.cpp.
|
inline |
Set the active layout style for the attribute editor for this layer.
Definition at line 435 of file qgseditformconfig.h.
void QgsEditFormConfig::setNotNull | ( | int | idx, |
bool | notnull = true |
||
) |
Set if the field at fieldidx should be treated as NOT NULL value.
Definition at line 174 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setReadOnly | ( | int | idx, |
bool | readOnly = true |
||
) |
If set to false, the widget at the given index will be read-only.
Definition at line 162 of file qgseditformconfig.cpp.
|
inline |
Set type of feature form pop-up suppression after feature creation (overrides app setting)
Definition at line 691 of file qgseditformconfig.h.
void QgsEditFormConfig::setUiForm | ( | const QString & | ui | ) |
Set path to the .ui form.
When a string is provided, the layout style will be set to EditorLayout::UiFileLayout, if an empty or a null string is provided, the layout style will be set to EditorLayout::GeneratedLayout.
Definition at line 88 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setWidgetConfig | ( | int | attrIdx, |
const QgsEditorWidgetConfig & | config | ||
) |
Set the editor widget config for a field.
Python: Will accept a map.
Example:
attrIdx | Index of the field |
config | The config to set for this field |
Definition at line 64 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setWidgetConfig | ( | const QString & | widgetName, |
const QgsEditorWidgetConfig & | config | ||
) |
Set the editor widget config for a widget.
Example:
widgetName | The name of the widget or field to configure |
config | The config to set for this field |
Definition at line 70 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setWidgetType | ( | int | fieldIdx, |
const QString & | widgetType | ||
) |
Set the editor widget type for a field.
QGIS ships the following widget types, additional types may be available depending on plugins.
fieldIdx | Index of the field |
widgetType | Type id of the editor widget to use |
Definition at line 58 of file qgseditformconfig.cpp.
|
inline |
Type of feature form pop-up suppression after feature creation (overrides app setting)
Definition at line 689 of file qgseditformconfig.h.
|
inline |
Returns a list of tabs for EditorLayout::TabLayout.
Definition at line 424 of file qgseditformconfig.h.
|
inline |
Get path to the .ui form.
Only meaningful with EditorLayout::UiFileLayout.
Definition at line 438 of file qgseditformconfig.h.
QgsEditorWidgetConfig QgsEditFormConfig::widgetConfig | ( | int | fieldIdx | ) | const |
Get the configuration for the editor widget used to represent the field at the given index.
fieldIdx | The index of the field |
Definition at line 40 of file qgseditformconfig.cpp.
QgsEditorWidgetConfig QgsEditFormConfig::widgetConfig | ( | const QString & | widgetName | ) | const |
Get the configuration for the editor widget used to represent the field with the given name.
widgetName | The name of the widget. This can be a field name or the name of an additional widget. |
Definition at line 48 of file qgseditformconfig.cpp.
QString QgsEditFormConfig::widgetType | ( | int | fieldIdx | ) | const |
Get the id for the editor widget used to represent the field at the given index.
fieldIdx | The index of the field |
Definition at line 27 of file qgseditformconfig.cpp.
Get the id for the editor widget used to represent the field at the given index.
fieldName | The name of the field |
Definition at line 35 of file qgseditformconfig.cpp.
void QgsEditFormConfig::writeXml | ( | QDomNode & | node | ) | const |
Write XML information Serialize on project save.
TODO: MAKE THIS MORE GENERIC, SO INDIVIDUALL WIDGETS CAN NOT ONLY SAVE STRINGS SEE QgsEditorWidgetFactory::writeConfig
Definition at line 309 of file qgseditformconfig.cpp.
|
friend |
Definition at line 768 of file qgseditformconfig.h.