Class: QgsDualView

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

Bases: PyQt5.QtWidgets.QStackedWidget

Constructor

Parameters

parent (QWidget = None) – 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

param event

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

Emitted whenever the display expression is successfully changed

filterChanged

Emitted whenever the filter changes [signal]

filterExpressionSet

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

NoAction

PanToFeature

ZoomToFeature

AttributeEditor = 1
AttributeTable = 0
class FeatureListBrowsingAction

Bases: int

baseClass

alias of QgsDualView

NoAction = 0
PanToFeature = 1
class ViewMode

Bases: int

baseClass

alias of QgsDualView

ZoomToFeature = 2
actionEvent()
attributeTableConfig(self) → QgsAttributeTableConfig

The config used for the attribute table.

Return type

QgsAttributeTableConfig

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

Emitted whenever the display expression is successfully changed

Parameters

expression (str) – The expression that was applied [signal]

dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
drawFrame()
dropEvent()
enterEvent()
event()
featureCount(self) → int

Returns the number of features on the layer.

Return type

int

Returns

Number of features

filterChanged

Emitted whenever the filter changes [signal]

filterExpressionSet

Emitted when a filter expression is set using the view.

Parameters

New in version 2.16: [signal]

filterMode(self) → QgsAttributeTableFilterModel.FilterMode

Gets the filter mode

Return type

QgsAttributeTableFilterModel.FilterMode

Returns

the filter mode

filteredFeatureCount(self) → int

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

Return type

int

Returns

Number of features

filteredFeatures(self) → object

Gets a list of currently visible feature ids.

Return type

object

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

Emitted when the form changes mode.

Parameters

mode (QgsAttributeEditorContext.Mode) – new mode [signal]

hideEvent(self, event: QHideEvent)
Parameters

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 (QgsVectorLayer) – The layer which should be used to fetch features

  • mapCanvas (QgsMapCanvas) – The mapCanvas (used for the FilterMode QgsAttributeTableFilterModel.ShowVisible)

  • request (QgsFeatureRequest = QgsFeatureRequest()) – Use a modified request to limit the shown features

  • context (QgsAttributeEditorContext = QgsAttributeEditorContext()) – The context in which this view is shown

  • loadFeatures (bool = True) – 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)

Return type

QgsAttributeTableModel

Returns

The master model

metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
openConditionalStyles(self)
paintEvent()
receivers()
resizeEvent()
saveEditChanges(self) → bool

saveEditChanges

Return type

bool

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.

Parameters

config (QgsAttributeTableConfig) –

setCurrentEditSelection(self, fids: object)

Set the current edit selection in the AttributeEditor mode.

Parameters

fids (object) – A list of edited features (Currently only one at a time is supported)

setFeatureSelectionManager(self, featureSelectionManager: QgsIFeatureSelectionManager)

Set the feature selection model

Parameters

featureSelectionManager (QgsIFeatureSelectionManager) – the feature selection model

setFilterMode(self, filterMode: QgsAttributeTableFilterModel.FilterMode)

Set the filter mode

Parameters

filterMode (QgsAttributeTableFilterModel.FilterMode) –

setFilteredFeatures(self, filteredFeatures: object)

Set a list of currently visible features

Parameters

filteredFeatures (object) – A list of feature ids

setMultiEditEnabled(self, enabled: bool)

Sets whether multi edit mode is enabled.

New in version 2.16.

Parameters

enabled (bool) –

setRequest(self, request: QgsFeatureRequest)

Set the request

Parameters

request (QgsFeatureRequest) – The request

setSelectedOnTop(self, selectedOnTop: bool)

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

Parameters

selectedOnTop (bool) – 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.

Parameters
  • sortExpression (str) –

  • sortOrder (Qt.SortOrder = Qt.AscendingOrder) –

setView(self, view: QgsDualView.ViewMode)

Change the current view mode.

Parameters

view (QgsDualView.ViewMode) – 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 (QgsActionMenu) – context menu

  • fid (int) – feature id of the selected feature [signal]

showEvent()
sortExpression(self) → str

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

Return type

str

tableView(self) → QgsAttributeTableView

Returns the table view

Return type

QgsAttributeTableView

Returns

The table view

tabletEvent()
timerEvent()
toggleSearchMode(self, enabled: bool)

Toggles whether search mode should be enabled in the form.

Parameters

enabled (bool) – 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.

Return type

QgsDualView.ViewMode

wheelEvent()