Class: QgsAttributeForm¶
-
class
qgis.gui.
QgsAttributeForm
(vl: QgsVectorLayer, feature: QgsFeature = QgsFeature(), context: QgsAttributeEditorContext = QgsAttributeEditorContext(), parent: QWidget = None)¶ Bases:
PyQt5.QtWidgets.QWidget
Enums
Methods
Takes ownership
The aggregate filter is only useful if the form is in AggregateFilter mode.
Call this to change the content of a given attribute.
Disconnects the button box (OK/Cancel) from the accept/resetValues slots If this method is called, you have to create these connections from outside
Returns if the form is currently in editable mode.
Intercepts keypress on custom form (escape should not close it)
Hides the button box (OK/Cancel) and enables auto-commit
Returns the layer for which this form is shown
Returns the current mode of the form.
reload current feature
Resets the search/filter form values.
Sets all values to the values of the current feature
Save all the values from the editors to the layer.
Sets the edit command message (Undo) that will be used when the dialog is accepted
Update all editors to correspond to a different feature.
Sets the message bar to display feedback from the form in.
Sets the current mode of the form.
Sets all feature IDs which are to be edited if the form is in multiedit mode
Shows the button box (OK/Cancel) and disables auto-commit
Signals
Notifies about changes of attributes, this signal is not emitted when the value is set back to the original one.
Emitted when the user selects the close option from the form’s button bar.
Emitted when a feature is changed or added [signal]
Emitted when a filter expression is set using the form.
Emitted when the user chooses to flash a filtered set of features.
Emitted when the form changes mode.
Notifies about changes of attributes
Emitted when the user chooses to zoom to a filtered set of features.
Attributes
-
AddFeatureMode
= 1¶
-
AggregateSearchMode
= 4¶
-
FilterAnd
= 1¶
-
FilterOr
= 2¶
-
class
FilterType
¶ Bases:
int
-
IdentifyMode
= 5¶
-
class
Mode
¶ Bases:
int
-
MultiEditMode
= 2¶
-
ReplaceFilter
= 0¶
-
SearchMode
= 3¶
-
SingleEditMode
= 0¶
-
actionEvent
()¶
-
addInterface
(self, iface: QgsAttributeFormInterface)¶ Takes ownership
- Parameters
iface –
-
aggregateFilter
(self) → str¶ The aggregate filter is only useful if the form is in AggregateFilter mode. In this case it will return a combined expression according to the chosen filters on all attribute widgets.
New in version 3.0.
-
attributeChanged
¶ Notifies about changes of attributes, this signal is not emitted when the value is set back to the original one.
- Parameters
attribute – The name of the attribute that changed.
value – The new value of the attribute.
Deprecated since version since: 3.0 [signal]
-
changeAttribute
(self, field: str, value: Any, hintText: str = '')¶ Call this to change the content of a given attribute. Will update the editor(s) related to this field.
- Parameters
field – The field to change
value – The new value
hintText – A hint text for non existent joined features
-
changeEvent
()¶
-
childEvent
()¶
-
closeEvent
()¶
-
closed
¶ Emitted when the user selects the close option from the form’s button bar.
New in version 2.16: [signal]
-
connectNotify
()¶
-
contextMenuEvent
()¶
-
create
()¶
-
customEvent
()¶
-
destroy
()¶
-
disconnectButtonBox
(self)¶ Disconnects the button box (OK/Cancel) from the accept/resetValues slots If this method is called, you have to create these connections from outside
-
disconnectNotify
()¶
-
dragEnterEvent
()¶
-
dragLeaveEvent
()¶
-
dragMoveEvent
()¶
-
dropEvent
()¶
-
editable
(self) → bool¶ Returns if the form is currently in editable mode.
- Returns
Editable mode of this form
-
enterEvent
()¶
-
event
()¶
-
eventFilter
(self, object: QObject, event: QEvent) → bool¶ Intercepts keypress on custom form (escape should not close it)
- Parameters
object – The object for which the event has been sent
event – The event which is being filtered
- Returns
True
if the event has been handled (key was ESC)
-
feature
(self) → QgsFeature¶
-
featureSaved
¶ Emitted when a feature is changed or added [signal]
-
filterExpressionSet
¶ Emitted when a filter expression is set using the form.
- Parameters
expression – filter expression
type – filter type
New in version 2.16: [signal]
-
flashFeatures
¶ Emitted when the user chooses to flash a filtered set of features.
New in version 3.0: [signal]
-
focusInEvent
()¶
-
focusNextChild
()¶
-
focusNextPrevChild
()¶
-
focusOutEvent
()¶
-
focusPreviousChild
()¶
-
hideButtonBox
(self)¶ Hides the button box (OK/Cancel) and enables auto-commit
Note
set Embed in QgsAttributeEditorContext in constructor instead
-
hideEvent
()¶
-
initPainter
()¶
-
inputMethodEvent
()¶
-
isSignalConnected
()¶
-
keyPressEvent
()¶
-
keyReleaseEvent
()¶
-
layer
(self) → QgsVectorLayer¶ Returns the layer for which this form is shown
- Returns
Layer
-
leaveEvent
()¶
-
metric
()¶
-
mode
(self) → QgsAttributeEditorContext.Mode¶ Returns the current mode of the form.
See also
New in version 2.16.
-
modeChanged
¶ Emitted when the form changes mode.
- Parameters
mode – new mode [signal]
-
mouseDoubleClickEvent
()¶
-
mouseMoveEvent
()¶
-
mousePressEvent
()¶
-
mouseReleaseEvent
()¶
-
moveEvent
()¶
-
nativeEvent
()¶
-
paintEvent
()¶
-
receivers
()¶
-
refreshFeature
(self)¶ reload current feature
-
resetSearch
(self)¶ Resets the search/filter form values.
New in version 2.16.
-
resetValues
(self)¶ Sets all values to the values of the current feature
-
resizeEvent
()¶
-
save
(self) → bool¶ Save all the values from the editors to the layer.
- Returns
True
if successful
-
sender
()¶
-
senderSignalIndex
()¶
-
setEditCommandMessage
(self, message: str)¶ Sets the edit command message (Undo) that will be used when the dialog is accepted
- Parameters
message – The message
-
setFeature
(self, feature: QgsFeature)¶ Update all editors to correspond to a different feature.
- Parameters
feature – The feature which will be represented by the form
-
setMessageBar
(self, messageBar: QgsMessageBar)¶ Sets the message bar to display feedback from the form in. This is used in the search/filter mode to display the count of selected features.
- Parameters
messageBar – target message bar
New in version 2.16.
-
setMode
(self, mode: QgsAttributeEditorContext.Mode)¶ Sets the current mode of the form.
- Parameters
mode – form mode
See also
New in version 2.16.
-
setMultiEditFeatureIds
(self, fids: object)¶ Sets all feature IDs which are to be edited if the form is in multiedit mode
- Parameters
fids – feature ID list
New in version 2.16.
-
showButtonBox
(self)¶ Shows the button box (OK/Cancel) and disables auto-commit
Note
set Embed in QgsAttributeEditorContext in constructor instead
-
showEvent
()¶
-
tabletEvent
()¶
-
timerEvent
()¶
-
updateMicroFocus
()¶
-
wheelEvent
()¶
-
widgetValueChanged
¶ Notifies about changes of attributes
- Parameters
attribute – The name of the attribute that changed.
value – The new value of the attribute.
attributeChanged – If
True
, it corresponds to an actual change of the feature attribute
New in version 3.0.1: [signal]
-
zoomToFeatures
¶ Emitted when the user chooses to zoom to a filtered set of features.
New in version 3.0: [signal]
-