Class that steers the DataDrivenUI
DdManager manages all masks in the current project
api method to add an action to the layer with a self defined name
api method initLayer: initialize this layer with a data-driven input mask Returns a Boolean stating the success of the initialization Paramters: - layer [QgsVectorLayer] - skip [array [string]]: field names to not show - labels [dict] with entries: “fieldname”: “label” - fieldOrder [array[string]]: containing the field names in the order they should be shown - fieldGroups [dict] with entries: fieldName: [tabTitle, tabTooltip] for each group a tab is created and the fields from fieldName onwards (refers to fieldOrder) are grouped in this tab; tabTooltip is optional - minMax [dict] with entries: “fieldname”: [min, max] (use for numerical fields only! - searchFields [array[string]] with fields to be shown in the search form, if empty all fields are shown - showParents [Boolean] show tabs for 1-to-1 relations (parents) - createAction [Boolean]: add an action to the layer’s list of actions - db [QtSql.QSqlDatabase] - inputMask [Boolean]: create a data-edit mask - searchMask [Boolean]: create a data-search mask - inputUi [ddui.DdDialogWidget]: apply this inputUi - searchUi [ddui.DdDialogWidget]: apply this as search ui -helpText [string] help text for this mask, may be html formatted
check if user has right to access this table
make a DdTable object from the passed in layer, returns None, if layer is not suitable
api method showFeatureForm: show the data-driven input mask for a layer and a feature returns 1 if user clicked OK, 0 if CANCEL
Each DdAttribute corresponds to an input widget in the mask or each input widget is based on exactly one DdAttribute.
abstract super class for all DdAttributes
a DdAttribute for field in a QGIS layer that represents a foreign key
a DdAttribute for a field in a QGIS layer
a DdAttribute for a n2m relation, subtype can be list, tree or table relationTable and relatedTable are DdTable objects
a DdAttribute that draws a pushButton in the mask. the button must be implemented as subclass of ddui.DdPushButton
Classes that make up or steer the DataDrivenUI
Bases: object
Creates the DataDrivenUi
When subclassing this class, you want to rewrite createUi and use DdManager’s setUi method to apply your custom ui to the layer
creates default uis for this table (DdTable instance) showChildren [Boolean]: show tabs for 1-to-1 relations (children) see ddmanager.initLayer for other parameters
querys this table’s foreign keys and returns a dict attnum: [str: Type of the lookup field, str: sql to query lookup values, str: Name of the value field in the lookup table, str: Comment on lookup table]
find those tables (n2mtable) where our pk is a fk
Bases: ddui.DdLineEdit
input widget (QCheckBox) for a boolean field
Bases: ddui.DdLineEdit
input widget (QComboBox) for a foreign key
Bases: ddui.DdLineEdit
input widget (QDateEdit) for a date field
Bases: ddui.DdWidget
This is the mask ui
Bases: ddui.DdWidget
DdForms are the content of DdDialog, each DdDialog needs at least one DdForm (tab). The class arranges its input widgets either in a QToolBox or in the DdDialogWidget’s current tab
Bases: ddui.DdWidget
abstract super class for any input widget, corresponds to a DdAttribute
Bases: ddui.DdInputWidget
abstract class for all Input Widgets that can be represented in one line, creates a QLineEdit as default InputWidget, adds it together with a QCheckBox (to store null values) and a label to a QFormLayout.
slot: disables the input widget if the null checkbox is checked and vice versa
returns a str representing the value in this field for this feature; if the value is null, None is returned, if it is a new feature the default value is returned if available.
return the field index for this DdInputWidget’s attribute’s name in this layer
check/uncheck the null checkbox depending on the value and the attribute’s notNull property
create search sql-string
Bases: ddui.DdLineEdit
input widget (QLineEdit) for a char or varchar
Bases: ddui.DdLineEdit
input widget (QLineEdit) for a DoubleValue
Bases: ddui.DdLineEdit
input widget (QLineEdit) for an IntegerValue
Bases: ddui.DdN2mWidget
input widget (clickable QListWidget) for simple n2m relations
Bases: ddui.DdN2mWidget
a input widget for n-to-m relations with more than one field in the relation table The input widget consists of a QTableWidget and an add (+) and a remove (-) button
Bases: ddui.DdN2mWidget
input widget (clickable QTreeWidget) for n2m relations with more than one additional field in the related table TreeWidget is initialized directly from the DB
Bases: ddui.DdInputWidget
abstract class for any n-to-m relation
create a new QgsFeature for the relation table with this fid
Bases: ddui.DdInputWidget
abstract class, needs subclassing
Bases: ddui.DdLineEdit
input widget (QTextEdit) for a text field
Bases: object
abstract base class of all ui-widgets
initialize this widget for feature in layer must be implemented in child classes
creates search string must be implemented in child classes