Class: QgsDualView

class qgis.gui.QgsDualView(parent: QWidget = None)

Bases: PyQt5.QtWidgets.QStackedWidget

Constructor

Parameters:parent – The parent widget

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

actionEvent
attributeTableConfig The config used for the attribute table.
cancelProgress Cancel the progress dialog (if any)
changeEvent
childEvent
closeEvent
connectNotify
contextMenuEvent
copyCellContent Copy the content of the selected cell in the clipboard.
create
customEvent
destroy
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
drawFrame
dropEvent
enterEvent
event
featureCount Returns the number of features on the layer.
filterMode Gets the filter mode
filteredFeatureCount Returns the number of features which are currently visible, according to the filter restrictions
filteredFeatures Gets a list of currently visible feature ids.
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPreviousChild
hideEvent
init Has to be called to initialize the dual view.
initPainter
initStyleOption
inputMethodEvent
isSignalConnected
keyPressEvent
keyReleaseEvent
leaveEvent
masterModel Returns the model which has the information about all features (not only filtered)
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveEvent
nativeEvent
openConditionalStyles
paintEvent
receivers
resizeEvent
saveEditChanges saveEditChanges
sender
senderSignalIndex
setAttributeTableConfig Set the attribute table config which should be used to control the appearance of the attribute table.
setCurrentEditSelection Set the current edit selection in the AttributeEditor mode.
setFeatureSelectionManager Set the feature selection model
setFilterMode Set the filter mode
setFilteredFeatures Set a list of currently visible features
setMultiEditEnabled Sets whether multi edit mode is enabled.
setRequest Set the request
setSelectedOnTop Toggle the selectedOnTop flag.
setSortExpression Set the expression used for sorting the table and feature list.
setView Change the current view mode.
sharedPainter
showEvent
sortExpression Gets the expression used for sorting the table and feature list.
tableView Returns the table view
tabletEvent
timerEvent
toggleSearchMode Toggles whether search mode should be enabled in the form.
updateMicroFocus
view Returns the current view mode.
wheelEvent

Signals

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.
showContextMenuExternally Emitted when selecting context menu on the feature list to create the context menu individually

Attributes

AttributeEditor
AttributeTable
AttributeEditor = 1
AttributeTable = 0
class ViewMode

Bases: int

baseClass

alias of QgsDualView

actionEvent()
attributeTableConfig(self) → QgsAttributeTableConfig

The config used for the attribute table.

Returns:The config used for the attribute table.
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

Gets 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

Gets 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)
  • request – Use a modified request to limit the shown features
  • context – The context in which this view is shown
  • 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

Gets 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()