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.

QgsDualView(parent: QWidget = None) Constructor

Parameters:

parent

The parent widget

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.

filterFeatures

Sets the expression and Updates the filtered features in the filter model.

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

parentFormValueChanged

Called in embedded forms when an attribute value in the parent form has changed.

receivers

resizeEvent

saveEditChanges

rtype:

bool

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

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

filterChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

filterExpressionSet

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

formModeChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

showContextMenuExternally

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

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(self, QActionEvent)
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(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
copyCellContent(self)

Copy the content of the selected cell in the clipboard.

New in version 1.16.

create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
displayExpressionChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
drawFrame(self, QPainter)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
featureCount(self) int

Returns the number of features on the layer.

Return type:

int

Returns:

Number of features

filterChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

filterExpressionSet

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

filterFeatures(self, filterExpression: QgsExpression, context: QgsExpressionContext)

Sets the expression and Updates the filtered features in the filter model. It is called when the filter expression changed.

New in version 3.10.3.

Parameters:
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(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
formModeChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

hideEvent(self, event: QHideEvent)
Parameters:

event (QHideEvent) –

init(self, layer: QgsVectorLayer, mapCanvas: QgsMapCanvas, request: QgsFeatureRequest = QgsFeatureRequest(), context: QgsAttributeEditorContext = QgsAttributeEditorContext(), loadFeatures: bool = True, showFirstFeature: 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()

  • showFirstFeature (bool = True) – whether to initially show the first feature form upon initializing the dual view

initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
masterModel(self) QgsAttributeTableModel

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

Return type:

QgsAttributeTableModel

Returns:

The master model

metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
openConditionalStyles(self)
paintEvent(self, QPaintEvent)
parentFormValueChanged(self, attribute: str, value: Any)

Called in embedded forms when an attribute value in the parent form has changed.

Notify the form widgets that something has changed in case they have filter expression that depend on the parent form scope.

New in version 3.14.

Parameters:
  • attribute (str) –

  • value (Any) –

receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
saveEditChanges(self) bool
saveEditChanges(None) None
Return type:

bool

Returns:

True if the saving was OK. False is possible due to connected validation logic.

sender(self) QObject
senderSignalIndex(self) int
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

Deprecated since version since: filterFeatures is handled in the attribute filter model itself

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(self) QPainter
showContextMenuExternally

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

showEvent(self, QShowEvent)
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(self, QTabletEvent)
timerEvent(self, QTimerEvent)
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(self)
view(self) QgsDualView.ViewMode

Returns the current view mode.

See also

setView()

New in version 2.16.

Return type:

QgsDualView.ViewMode

wheelEvent(self, QWheelEvent)