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
The config used for the attribute table.
Cancel the progress dialog (if any)
Copy the content of the selected cell in the clipboard.
Returns the number of features on the layer.
Sets the expression and Updates the filtered features in the filter model.
Gets the filter mode
Returns the number of features which are currently visible, according to the filter restrictions
Gets a list of currently visible feature ids.
- param event
Has to be called to initialize the dual view.
Returns the model which has the information about all features (not only filtered)
Called in embedded forms when an
attribute
value
in the parent form has changed.saveEditChanges
Set the attribute table config which should be used to control the appearance of the attribute table.
Set the current edit selection in the AttributeEditor mode.
Set the feature selection model
Set the filter mode
Set a list of currently visible features
Sets whether multi edit mode is enabled.
Set the request
Toggle the selectedOnTop flag.
Set the expression used for sorting the table and feature list.
Change the current view mode.
Gets the expression used for sorting the table and feature list.
Returns the table view
Toggles whether search mode should be enabled in the form.
Returns the current view mode.
Signals
Emitted whenever the display expression is successfully changed
Emitted whenever the filter changes [signal]
Emitted when a filter expression is set using the view.
Emitted when the form changes mode.
Emitted when selecting context menu on the feature list to create the context menu individually
Attributes
-
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
- 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: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
-
customEvent
(self, QEvent)¶
-
destroy
(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
displayExpressionChanged
¶ Emitted whenever the display expression is successfully changed
- Parameters
expression (str) – The expression that was applied [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
¶ Emitted whenever the filter changes [signal]
-
filterExpressionSet
¶ Emitted when a filter expression is set using the view.
- Parameters
expression (str) – filter expression
type (QgsAttributeForm.FilterType) – filter type
New in version 2.16: [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
filterExpression (QgsExpression) –
context (QgsExpressionContext) –
-
filterMode
(self) → QgsAttributeTableFilterModel.FilterMode¶ Gets the filter mode
- Return type
- 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
¶ 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 featurescontext (
QgsAttributeEditorContext
= QgsAttributeEditorContext()) – The context in which this view is shownloadFeatures (bool = True) – whether to initially load all features into the view. If set to
False
, limited features can later be loaded usingsetFilterMode()
-
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
- 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], 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
- 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
-
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
(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
- 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
New in version 2.16.
- Return type
-
wheelEvent
(self, QWheelEvent)¶