QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
#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 | |
QgsEditFormConfig (const QgsEditFormConfig &o) | |
Copy constructor. More... | |
QgsEditFormConfig () | |
Create a new edit form config. More... | |
~QgsEditFormConfig () | |
void | addTab (QgsAttributeEditorElement *data) |
Adds a new element to the invisible root container in the layout. More... | |
QgsAttributeEditorElement * | attributeEditorElementFromDomElement (QDomElement &elem, QgsAttributeEditorElement *parent, const QString &layerId=QString(), const QgsReadWriteContext &context=QgsReadWriteContext()) |
Deserialize drag and drop designer elements. More... | |
void | clearTabs () |
Clears all the tabs for the attribute editor form with EditorLayout::TabLayout. More... | |
QString | initCode () const |
Gets Python code for edit form initialization. More... | |
PythonInitCodeSource | initCodeSource () const |
Returns 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 |
Gets Python external file path for edit form initialization. More... | |
QString | initFunction () const |
Gets Python function for edit form initialization. More... | |
QgsAttributeEditorContainer * | invisibleRootContainer () |
Gets the invisible root container for the drag and drop designer form (EditorLayout::TabLayout). 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 |
Gets the active layout style for the attribute editor for this layer. More... | |
QgsEditFormConfig & | operator= (const QgsEditFormConfig &o) |
bool | operator== (const QgsEditFormConfig &o) |
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, QgsReadWriteContext &context) |
Read XML information Deserialize on project load. More... | |
bool | removeWidgetConfig (const QString &widgetName) |
Remove the configuration for the editor widget with the given name. More... | |
void | setInitCode (const QString &code) |
Set Python code for edit form initialization. More... | |
void | setInitCodeSource (PythonInitCodeSource initCodeSource) |
Sets 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) |
Sets the active layout style for the attribute editor for this layer. 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) |
Sets 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... | |
bool | setWidgetConfig (const QString &widgetName, const QVariantMap &config) |
Set the editor widget config for a widget which is not for a simple 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 obtained from the invisible root container. More... | |
QString | uiForm () const |
Returns the path or URL to the .ui form. More... | |
QVariantMap | widgetConfig (const QString &widgetName) const |
Gets the configuration for the editor widget with the given name. More... | |
void | writeXml (QDomNode &node, const QgsReadWriteContext &context) const |
Write XML information Serialize on project save. More... | |
Friends | |
class | QgsVectorLayer |
Definition at line 37 of file qgseditformconfig.h.
The different types to layout the attribute editor.
Definition at line 42 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 78 of file qgseditformconfig.h.
The Python init code source options.
Definition at line 88 of file qgseditformconfig.h.
QgsEditFormConfig::QgsEditFormConfig | ( | const QgsEditFormConfig & | o | ) |
QgsEditFormConfig::~QgsEditFormConfig | ( | ) |
Definition at line 100 of file qgseditformconfig.cpp.
|
explicit |
Create a new edit form config.
Normally invoked by QgsVectorLayer
Definition at line 32 of file qgseditformconfig.cpp.
void QgsEditFormConfig::addTab | ( | QgsAttributeEditorElement * | data | ) |
Adds a new element to the invisible root container in the layout.
This is only useful in combination with EditorLayout::TabLayout.
Definition at line 114 of file qgseditformconfig.cpp.
QgsAttributeEditorElement * QgsEditFormConfig::attributeEditorElementFromDomElement | ( | QDomElement & | elem, |
QgsAttributeEditorElement * | parent, | ||
const QString & | layerId = QString() , |
||
const QgsReadWriteContext & | context = QgsReadWriteContext() |
||
) |
Deserialize drag and drop designer elements.
Definition at line 521 of file qgseditformconfig.cpp.
void QgsEditFormConfig::clearTabs | ( | ) |
Clears all the tabs for the attribute editor form with EditorLayout::TabLayout.
Definition at line 125 of file qgseditformconfig.cpp.
QString QgsEditFormConfig::initCode | ( | ) | const |
Gets Python code for edit form initialization.
Definition at line 224 of file qgseditformconfig.cpp.
QgsEditFormConfig::PythonInitCodeSource QgsEditFormConfig::initCodeSource | ( | ) | const |
Returns 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 246 of file qgseditformconfig.cpp.
QString QgsEditFormConfig::initFilePath | ( | ) | const |
Gets Python external file path for edit form initialization.
Definition at line 235 of file qgseditformconfig.cpp.
QString QgsEditFormConfig::initFunction | ( | ) | const |
Gets 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 213 of file qgseditformconfig.cpp.
QgsAttributeEditorContainer * QgsEditFormConfig::invisibleRootContainer | ( | ) |
Gets the invisible root container for the drag and drop designer form (EditorLayout::TabLayout).
Definition at line 131 of file qgseditformconfig.cpp.
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 187 of file qgseditformconfig.cpp.
QgsEditFormConfig::EditorLayout QgsEditFormConfig::layout | ( | ) | const |
Gets the active layout style for the attribute editor for this layer.
Definition at line 136 of file qgseditformconfig.cpp.
QgsEditFormConfig & QgsEditFormConfig::operator= | ( | const QgsEditFormConfig & | o | ) |
Definition at line 103 of file qgseditformconfig.cpp.
bool QgsEditFormConfig::operator== | ( | const QgsEditFormConfig & | o | ) |
Definition at line 109 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 174 of file qgseditformconfig.cpp.
void QgsEditFormConfig::readXml | ( | const QDomNode & | node, |
QgsReadWriteContext & | context | ||
) |
Read XML information Deserialize on project load.
Definition at line 268 of file qgseditformconfig.cpp.
bool QgsEditFormConfig::removeWidgetConfig | ( | const QString & | widgetName | ) |
Remove the configuration for the editor widget with the given name.
widgetName | The name of the widget. |
Definition at line 89 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setInitCode | ( | const QString & | code | ) |
Set Python code for edit form initialization.
Make sure that you also set the appropriate function name in setInitFunction().
Definition at line 229 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setInitCodeSource | ( | const QgsEditFormConfig::PythonInitCodeSource | initCodeSource | ) |
Sets if Python code shall be used for edit form initialization and its origin.
Definition at line 251 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setInitFilePath | ( | const QString & | filePath | ) |
Set Python external file path for edit form initialization.
Make sure that you also set the appropriate function name in setInitFunction().
Definition at line 240 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setInitFunction | ( | const QString & | function | ) |
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 218 of file qgseditformconfig.cpp.
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 204 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setLayout | ( | QgsEditFormConfig::EditorLayout | editorLayout | ) |
Sets the active layout style for the attribute editor for this layer.
Definition at line 141 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 195 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setSuppress | ( | QgsEditFormConfig::FeatureFormSuppress | s | ) |
Sets type of feature form pop-up suppression after feature creation (overrides app setting)
Definition at line 262 of file qgseditformconfig.cpp.
void QgsEditFormConfig::setUiForm | ( | const QString & | ui | ) |
Set path to the .ui form.
When a string is provided in ui, 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. If ui is a URL, a local copy of the file will be made and will be used to create the forms context is provided to save error messages
Definition at line 155 of file qgseditformconfig.cpp.
bool QgsEditFormConfig::setWidgetConfig | ( | const QString & | widgetName, |
const QVariantMap & | config | ||
) |
Set the editor widget config for a widget which is not for a simple field.
Example:
widgetName | The name of the widget to configure |
config | The config to set for this widget |
Definition at line 76 of file qgseditformconfig.cpp.
QgsEditFormConfig::FeatureFormSuppress QgsEditFormConfig::suppress | ( | ) | const |
Type of feature form pop-up suppression after feature creation (overrides app setting)
Definition at line 257 of file qgseditformconfig.cpp.
QList< QgsAttributeEditorElement * > QgsEditFormConfig::tabs | ( | ) | const |
Returns a list of tabs for EditorLayout::TabLayout obtained from the invisible root container.
Definition at line 120 of file qgseditformconfig.cpp.
QString QgsEditFormConfig::uiForm | ( | ) | const |
Returns the path or URL to the .ui form.
Only meaningful with EditorLayout::UiFileLayout
Definition at line 150 of file qgseditformconfig.cpp.
QVariantMap QgsEditFormConfig::widgetConfig | ( | const QString & | widgetName | ) | const |
Gets the configuration for the editor widget with the given name.
widgetName | The name of the widget. |
Definition at line 37 of file qgseditformconfig.cpp.
void QgsEditFormConfig::writeXml | ( | QDomNode & | node, |
const QgsReadWriteContext & | context | ||
) | const |
Write XML information Serialize on project save.
Definition at line 411 of file qgseditformconfig.cpp.
|
friend |
Definition at line 314 of file qgseditformconfig.h.