Subgroup: other
Class: QgsWidgetWrapper¶
-
class
qgis.gui.
QgsWidgetWrapper
¶ Bases:
PyQt5.QtCore.QObject
Manages an editor widget Widget and wrapper share the same parent
A wrapper controls one attribute editor widget and is able to create a default widget or use a pre-existent widget. It is able to set the widget to the value implied by a field of a vector layer, or return the value it currently holds. Every time it is changed it has to emit a valueChanged signal. If it fails to do so, there is no guarantee that the changed status of the widget will be saved.
Methods
blockSignals
childEvent
children
config
Use this inside your overridden classes to access the configuration. connectNotify
context
Returns information about the context in which this widget is shown createWidget
This method should create a new widget with the provided parent. customEvent
dataDefinedProperties
Returns a reference to the editor widget’s property collection, used for data defined overrides. deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
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] fromWidget
Will return a wrapper for a given widget inherits
initWidget
This method should initialize the editor widget with runtime data. installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
layer
Access the QgsVectorLayer
, you are working onmetaObject
moveToThread
objectName
parent
property
propertyDefinitions
Returns the editor widget property definitions. pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
removeEventFilter
sender
senderSignalIndex
setConfig
Will set the config of this wrapper to the specified config. setContext
Set the context in which this widget is shown setDataDefinedProperties
Sets the editor widget’s property collection, used for data defined overrides. setEnabled
Is used to enable or disable the edit functionality of the managed widget. setFeature
Is called, when the value of the widget needs to be changed. setObjectName
setParent
setProperty
signalsBlocked
startTimer
thread
timerEvent
tr
valid
Return true if the widget has been properly initialized. widget
Access the widget managed by this wrapper Attributes
DocumentViewerContent
RootPath
destroyed
destroyed(self, QObject = None) [signal] objectNameChanged
objectNameChanged(self, str) [signal] staticMetaObject
-
DocumentViewerContent
= 1¶
-
class
Property
¶ Bases:
int
-
RootPath
= 0¶
-
childEvent
()¶
-
config
(self, key: str, defaultVal: Any = None) → Any¶ Use this inside your overridden classes to access the configuration.
Parameters: - key – The configuration option you want to load
- defaultVal – Default value
Returns: the value assigned to this configuration option
config(self) -> Dict[str, Any] Returns the whole config
Returns: The configuration
-
connectNotify
()¶
-
context
(self) → QgsAttributeEditorContext¶ Returns information about the context in which this widget is shown
Returns: context information
-
createWidget
(self, parent: QWidget) → QWidget¶ This method should create a new widget with the provided parent. This will only be called if the form did not already provide a widget, so it is not guaranteed to be called! You should not do initialization stuff, which also has to be done for custom editor widgets inside this method. Things like filling comboboxes and assigning other data which will also be used to make widgets on forms created in the QtDesigner usable should be assigned in initWidget().
Parameters: parent – You should set this parent on the created widget. Returns: A new widget
-
customEvent
()¶
-
dataDefinedProperties
(self) → QgsPropertyCollection¶ Returns a reference to the editor widget’s property collection, used for data defined overrides.
New in version 3.0.
See also
-
disconnectNotify
()¶
-
fromWidget
(widget: QWidget) → QgsWidgetWrapper¶ Will return a wrapper for a given widget
Parameters: widget – The widget which was created by a wrapper Returns: The wrapper for the widget or NULL
-
initWidget
(self, editor: QWidget)¶ This method should initialize the editor widget with runtime data. Fill your comboboxes here.
Parameters: editor – The widget which will represent this attribute editor in a form.
-
isSignalConnected
()¶
-
layer
(self) → QgsVectorLayer¶ Access the
QgsVectorLayer
, you are working onReturns: The layer See also
field()
-
propertyDefinitions
() → object¶ Returns the editor widget property definitions.
New in version 3.0.
-
receivers
()¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setConfig
(self, config: Dict[str, Any])¶ Will set the config of this wrapper to the specified config.
Parameters: config – The config for this wrapper
-
setContext
(self, context: QgsAttributeEditorContext)¶ Set the context in which this widget is shown
Parameters: context – context information
-
setDataDefinedProperties
(self, collection: QgsPropertyCollection)¶ Sets the editor widget’s property collection, used for data defined overrides.
Parameters: collection – property collection. Existing properties will be replaced. New in version 3.0.
See also
-
setEnabled
(self, enabled: bool)¶ Is used to enable or disable the edit functionality of the managed widget. By default this will not change the enabled state of the widget
Parameters: enabled – Enable or Disable?
-
setFeature
(self, feature: QgsFeature)¶ Is called, when the value of the widget needs to be changed. Update the widget representation to reflect the new value.
Parameters: feature – The new feature
-
timerEvent
()¶
-
valid
(self) → bool¶ Return true if the widget has been properly initialized. This acts as hint for the calling party if this wrapper can be used after initializing it. If it cannot be used this is a hint to the caller that he may try to find another suitable widget type instead.
Returns: Validity status of this widget. New in version 2.12.
-
widget
(self) → QWidget¶ Access the widget managed by this wrapper
Returns: The widget
-