Subgroup: other

Class: QgsDualView

class qgis.gui.QgsDualView

Bases: PyQt5.QtWidgets.QStackedWidget

This widget is used to show the attributes of a set of features of a QgsVectorLayer. The attributes can be edited. It supports two different layouts: the table layout, in which the attributes for the features are shown in a table and the editor layout, where the features are shown as a selectable list and the attributes for the currently selected feature are shown in a form.

Methods

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
addWidget
adjustSize
autoFillBackground
backgroundRole
baseSize
blockSignals
cancelProgress Cancel the progress dialog (if any)
changeEvent
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clearFocus
clearMask
close
closeEvent
colorCount
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
copyCellContent Copy the content of the selected cell in the clipboard.
count
create
createWindowContainer
currentIndex
currentWidget
cursor
customEvent
deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
drawFrame
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveWinId
ensurePolished
enterEvent
event
eventFilter
featureCount Returns the number of features on the layer.
filterMode Get the filter mode
filteredFeatureCount Returns the number of features which are currently visible, according to the
filteredFeatures Get a list of currently visible feature ids.
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
frameRect
frameShadow
frameShape
frameSize
frameStyle
frameWidth
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse grabMouse(self, Union[QCursor, Qt.CursorShape])
grabShortcut
graphicsEffect
graphicsProxyWidget
hasFocus
hasHeightForWidth
hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
indexOf
inherits
init Has to be called to initialize the dual view.
initPainter
initStyleOption
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
insertWidget
installEventFilter
isActiveWindow
isAncestorOf
isEnabled
isEnabledTo
isFullScreen
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layout
layoutDirection
leaveEvent
lineWidth
locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mask
masterModel Returns the model which has the information about all features (not only filtered)
maximumHeight
maximumSize
maximumWidth
metaObject
metric
midLineWidth
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
openConditionalStyles
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
releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
removeWidget
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)
resize resize(self, int, int)
resizeEvent
restoreGeometry
saveEditChanges saveEditChanges
saveGeometry
scroll scroll(self, int, int, QRect)
sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAttribute
setAttributeTableConfig Set the attribute table config which should be used to control the appearance of the attribute table.
setAutoFillBackground
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCurrentEditSelection Set the current edit selection in the AttributeEditor mode.
setCurrentIndex
setCurrentWidget
setCursor
setDisabled
setEnabled
setFeatureSelectionManager Set the feature selection model
setFilterMode Set the filter mode
setFilteredFeatures Set a list of currently visible features
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setFrameRect
setFrameShadow
setFrameShape
setFrameStyle
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setHidden
setInputMethodHints
setLayout
setLayoutDirection
setLineWidth
setLocale
setMask setMask(self, QRegion)
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumWidth
setMidLineWidth
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumWidth
setMouseTracking
setMultiEditEnabled Sets whether multi edit mode is enabled.
setObjectName
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setProperty
setRequest Set the request
setSelectedOnTop Toggle the selectedOnTop flag.
setShortcutAutoRepeat
setShortcutEnabled
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setSortExpression Set the expression used for sorting the table and feature list.
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setToolTip
setToolTipDuration
setUpdatesEnabled
setView Change the current view mode.
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
sharedPainter
show
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
sortExpression Get the expression used for sorting the table and feature list.
stackUnder
startTimer
statusTip
style
styleSheet
tableView Returns the table view
tabletEvent
testAttribute
thread
timerEvent
toggleSearchMode Toggles whether search mode should be enabled in the form.
toolTip
toolTipDuration
tr
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update update(self, QRect)
updateGeometry
updateMicroFocus
updatesEnabled
view Returns the current view mode.
visibleRegion
whatsThis
wheelEvent
widget
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
x
y

Attributes

AttributeEditor
AttributeTable
Box
DrawChildren
DrawWindowBackground
HLine
IgnoreMask
NoFrame
Panel
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
Plain
Raised
Shadow_Mask
Shape_Mask
StyledPanel
Sunken
VLine
WinPanel
currentChanged currentChanged(self, int) [signal]
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
destroyed destroyed(self, QObject = None) [signal]
displayExpressionChanged Is emitted, whenever the display expression is successfully changed
filterChanged Is emitted, whenever the filter changes [signal]
filterExpressionSet Is emitted when a filter expression is set using the view.
formModeChanged Emitted when the form changes mode.
objectNameChanged objectNameChanged(self, str) [signal]
showContextMenuExternally Emitted when selecting context menu on the feature list to create the context menu individually
staticMetaObject
widgetRemoved widgetRemoved(self, int) [signal]
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
AttributeEditor = 1
AttributeTable = 0
class ViewMode

Bases: int

actionEvent()
cancelProgress(self)

Cancel the progress dialog (if any)

New in version 3.0.

changeEvent()
childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
copyCellContent(self)

Copy the content of the selected cell in the clipboard.

New in version 1.16.

create()
customEvent()
destroy()
disconnectNotify()
displayExpressionChanged

Is emitted, whenever the display expression is successfully changed

Parameters:expression – The expression that was applied [signal]
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
drawFrame()
dropEvent()
enterEvent()
event()
featureCount(self) → int

Returns the number of features on the layer.

Returns:Number of features
filterChanged

Is emitted, whenever the filter changes [signal]

filterExpressionSet

Is emitted when a filter expression is set using the view.

Parameters:
  • expression – filter expression
  • type – filter type

New in version 2.16: [signal]

filterMode(self) → QgsAttributeTableFilterModel.FilterMode

Get the filter mode

Returns:the filter mode
filteredFeatureCount(self) → int

Returns the number of features which are currently visible, according to the filter restrictions

Returns:Number of features
filteredFeatures(self) → object

Get a list of currently visible feature ids.

focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
formModeChanged

Emitted when the form changes mode.

Parameters:mode – new mode [signal]
hideEvent(self, event: QHideEvent)
init(self, layer: QgsVectorLayer, mapCanvas: QgsMapCanvas, request: QgsFeatureRequest = QgsFeatureRequest(), context: QgsAttributeEditorContext = QgsAttributeEditorContext(), loadFeatures: bool = True)

Has to be called to initialize the dual view.

Parameters:
  • layer – The layer which should be used to fetch features
  • mapCanvas – The mapCanvas (used for the FilterMode

QgsAttributeTableFilterModel.ShowVisible) :param request: Use a modified request to limit the shown features :param context: The context in which this view is shown :param loadFeatures: whether to initially load all features into the view. If set to false, limited features can later be loaded using setFilterMode()

initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
masterModel(self) → QgsAttributeTableModel

Returns the model which has the information about all features (not only filtered)

Returns:The master model
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
openConditionalStyles(self)
paintEvent()
receivers()
resizeEvent()
saveEditChanges(self) → bool

saveEditChanges

Returns:true if the saving was OK. false is possible due to connected

validation logic.

sender()
senderSignalIndex()
setAttributeTableConfig(self, config: QgsAttributeTableConfig)

Set the attribute table config which should be used to control the appearance of the attribute table.

setCurrentEditSelection(self, fids: object)

Set the current edit selection in the AttributeEditor mode.

Parameters:fids – A list of edited features (Currently only one at a time is supported)
setFeatureSelectionManager(self, featureSelectionManager: QgsIFeatureSelectionManager)

Set the feature selection model

Parameters:featureSelectionManager – the feature selection model
setFilterMode(self, filterMode: QgsAttributeTableFilterModel.FilterMode)

Set the filter mode

Parameters:filterMode
setFilteredFeatures(self, filteredFeatures: object)

Set a list of currently visible features

Parameters:filteredFeatures – A list of feature ids
setMultiEditEnabled(self, enabled: bool)

Sets whether multi edit mode is enabled.

New in version 2.16.

setRequest(self, request: QgsFeatureRequest)

Set the request

Parameters:request – The request
setSelectedOnTop(self, selectedOnTop: bool)

Toggle the selectedOnTop flag. If enabled, selected features will be moved to top.

Parameters:selectedOnTop – True: Show selected features on top.

False: Use defined sorting column.

setSortExpression(self, sortExpression: str, sortOrder: Qt.SortOrder = Qt.AscendingOrder)

Set the expression used for sorting the table and feature list.

setView(self, view: QgsDualView.ViewMode)

Change the current view mode.

Parameters:view – The view mode to set

See also

view()

sharedPainter()
showContextMenuExternally

Emitted when selecting context menu on the feature list to create the context menu individually

Parameters:
  • menu – context menu
  • fid – feature id of the selected feature [signal]
showEvent()
sortExpression(self) → str

Get the expression used for sorting the table and feature list.

tableView(self) → QgsAttributeTableView

Returns the table view

Returns:The table view
tabletEvent()
timerEvent()
toggleSearchMode(self, enabled: bool)

Toggles whether search mode should be enabled in the form.

Parameters:enabled – set to true to switch on search mode

New in version 2.16.

updateMicroFocus()
view(self) → QgsDualView.ViewMode

Returns the current view mode.

See also

setView()

New in version 2.16.

wheelEvent()