Subgroup: Attribute

Class: QgsAttributeForm

class qgis.gui.QgsAttributeForm(vl: QgsVectorLayer, feature: QgsFeature = QgsFeature(), context: QgsAttributeEditorContext = QgsAttributeEditorContext(), parent: QWidget = None)

Bases: PyQt5.QtWidgets.QWidget

Methods

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
addInterface Takes ownership
adjustSize
aggregateFilter The aggregate filter is only useful if the form is in AggregateFilter mode.
autoFillBackground
backgroundRole
baseSize
blockSignals
changeAttribute Call this to change the content of a given attribute.
changeEvent
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clearFocus
clearMask
close
closeEvent
colorCount
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
create
createWindowContainer
cursor
customEvent
deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectButtonBox
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
editable Returns if the form is currently in editable mode.
effectiveWinId
ensurePolished
enterEvent
event
eventFilter Intercepts keypress on custom form (escape should not close it)
feature
find
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPolicy
focusPreviousChild
focusProxy
focusWidget
font
fontInfo
fontMetrics
foregroundRole
frameGeometry
frameSize
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse grabMouse(self, Union[QCursor, Qt.CursorShape])
grabShortcut
graphicsEffect
graphicsProxyWidget
hasFocus
hasHeightForWidth
hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideButtonBox
hideEvent
inherits
initPainter
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
installEventFilter
isActiveWindow
isAncestorOf
isEnabled
isEnabledTo
isFullScreen
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layer Returns the layer for which this form is shown
layout
layoutDirection
leaveEvent
locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mask
maximumHeight
maximumSize
maximumWidth
metaObject
metric
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mode Returns the current mode of the form.
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
pos
previousInFocusChain
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
raise_
receivers
rect
refreshFeature reload current feature
releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
render render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren))
repaint repaint(self, int, int, int, int)
resetSearch Resets the search/filter form values.
resetValues Sets all values to the values of the current feature
resize resize(self, int, int)
resizeEvent
restoreGeometry
save Save all the values from the editors to the layer.
saveGeometry
scroll scroll(self, int, int, QRect)
sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAttribute
setAutoFillBackground
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCursor
setDisabled
setEditCommandMessage Sets the edit command message (Undo) that will be used when the dialog is accepted
setEnabled
setFeature Update all editors to correspond to a different feature.
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setHidden
setInputMethodHints
setLayout
setLayoutDirection
setLocale
setMask setMask(self, QRegion)
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumWidth
setMessageBar Sets the message bar to display feedback from the form in.
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumWidth
setMode Sets the current mode of the form.
setMouseTracking
setMultiEditFeatureIds Sets all feature IDs which are to be edited if the form is in multiedit mode
setObjectName
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setProperty
setShortcutAutoRepeat
setShortcutEnabled
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setToolTip
setToolTipDuration
setUpdatesEnabled
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
sharedPainter
show
showButtonBox
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
stackUnder
startTimer
statusTip
style
styleSheet
tabletEvent
testAttribute
thread
timerEvent
toolTip
toolTipDuration
tr
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update update(self, QRect)
updateGeometry
updateMicroFocus
updatesEnabled
visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
x
y

Attributes

AddFeatureMode
AggregateSearchMode
DrawChildren
DrawWindowBackground
FilterAnd
FilterOr
IgnoreMask
MultiEditMode
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
ReplaceFilter
SearchMode
SingleEditMode
attributeChanged Notifies about changes of attributes
closed Emitted when the user selects the close option from the form’s button bar.
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
destroyed destroyed(self, QObject = None) [signal]
featureSaved Is emitted, when a feature is changed or added [signal]
filterExpressionSet Is emitted when a filter expression is set using the form.
flashFeatures Emitted when the user chooses to flash a filtered set of features.
modeChanged Emitted when the form changes mode.
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
zoomToFeatures Emitted when the user chooses to zoom to a filtered set of features.
AddFeatureMode = 1
AggregateSearchMode = 4
FilterAnd = 1
FilterOr = 2
class FilterType

Bases: int

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

Parameters:
  • attribute – The name of the attribute that changed.
  • value – The new value of the attribute. [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)
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

Is emitted, when a feature is changed or added [signal]

filterExpressionSet

Is 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)
hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
layer(self) → QgsVectorLayer

Returns the layer for which this form is shown

Returns:Layer
leaveEvent()
metric()
mode(self) → QgsAttributeForm.Mode

Returns the current mode of the form.

New in version 2.16.

See also

setMode()

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: QgsAttributeForm.Mode)

Sets the current mode of the form.

Parameters:mode – form mode

New in version 2.16.

See also

mode()

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.

sharedPainter()
showButtonBox(self)
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()
zoomToFeatures

Emitted when the user chooses to zoom to a filtered set of features.

New in version 3.0: [signal]