Class: QgsSearchWidgetWrapper¶
- class qgis.gui.QgsSearchWidgetWrapper¶
Bases:
QgsWidgetWrapper
Shows a search widget on a filter form.
QgsSearchWidgetWrapper(vl:
QgsVectorLayer
, fieldIdx: int, parent: QWidget = None) Create a new widget wrapper- Parameters:
vl – The layer on which the field is
fieldIdx – The field which will be controlled
parent –
A parent widget for this widget wrapper and the created widget.
Methods
If in AggregateSearch mode, which aggregate should be used to construct the filter expression.
If this is
True
, then this search widget should take effect directly when its expression changesclears the expression to search for all features
Clears the widget's current value and resets it back to the default state
Creates a filter expression based on the current state of the search widget and the specified filter flags.
Gets a field name or expression to use as field comparison.
This method should create a new widget with the provided parent.
Returns the filter flags which should be set by default for the search widget.
Returns a list of exclusive filter flags, which cannot be combined with other flags (e.g., EqualTo/NotEqualTo)
Will be used to access the widget's value.
Returns the field index
This method should initialize the editor widget with runtime data.
Returns a list of non-exclusive filter flags, which can be combined with other flags (e.g., CaseInsensitive)
If in AggregateSearch mode, which aggregate should be used to construct the filter expression.
Toggles whether the search widget is enabled or disabled.
Set the
expression
which is currently used as filter for this widget.- param feature:
Returns filter flags supported by the search widget.
Returns a translated string representing a filter flag.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
Attributes
- Between = 128¶
- CaseInsensitive = 256¶
- Contains = 512¶
- DoesNotContain = 1024¶
- EndsWith = 32768¶
- EqualTo = 2¶
- class FilterFlag¶
Bases:
int
- class FilterFlags¶
- class FilterFlags(Union[QgsSearchWidgetWrapper.FilterFlags, QgsSearchWidgetWrapper.FilterFlag])
- class FilterFlags(QgsSearchWidgetWrapper.FilterFlags)
Bases:
sip.wrapper
- GreaterThan = 8¶
- GreaterThanOrEqualTo = 32¶
- IsNotBetween = 4096¶
- IsNotNull = 8192¶
- IsNull = 2048¶
- LessThan = 16¶
- LessThanOrEqualTo = 64¶
- NotEqualTo = 4¶
- StartsWith = 16384¶
- aggregate(self) str ¶
If in AggregateSearch mode, which aggregate should be used to construct the filter expression. Is a Null String if none.
New in version 3.0.
- Return type:
str
- applyDirectly(self) bool ¶
If this is
True
, then this search widget should take effect directly when its expression changes- Return type:
bool
- childEvent(self, QChildEvent)¶
- clearExpression(self)¶
clears the expression to search for all features
- clearWidget(self)¶
Clears the widget’s current value and resets it back to the default state
New in version 2.16.
- connectNotify(self, QMetaMethod)¶
- createExpression(self, flags: QgsSearchWidgetWrapper.FilterFlags | QgsSearchWidgetWrapper.FilterFlag) str ¶
Creates a filter expression based on the current state of the search widget and the specified filter flags.
- Parameters:
flags (Union[QgsSearchWidgetWrapper.FilterFlags) – filter flags
- Return type:
str
- Returns:
filter expression
New in version 2.16.
- createFieldIdentifier(self) str ¶
Gets a field name or expression to use as field comparison. If in SearchMode returns a quoted field identifier. If in AggregateSearchMode returns an appropriate aggregate expression.
New in version 3.0.
- Return type:
str
- 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(self, QEvent)¶
- defaultFlags(self) QgsSearchWidgetWrapper.FilterFlags ¶
Returns the filter flags which should be set by default for the search widget.
See also
New in version 2.16.
- Return type:
- disconnectNotify(self, QMetaMethod)¶
- exclusiveFilterFlags() object ¶
Returns a list of exclusive filter flags, which cannot be combined with other flags (e.g., EqualTo/NotEqualTo)
See also
New in version 2.16.
- Return type:
object
- expression(self) str ¶
Will be used to access the widget’s value. Read the value from the widget and return it properly formatted to be saved in the attribute.
If an invalid variant is returned this will be interpreted as no change. Be sure to return a NULL QVariant if it should be set to NULL.
- Return type:
str
- Returns:
The current value the widget represents
- expressionChanged¶
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
- fieldIndex(self) int ¶
Returns the field index
New in version 3.10.
- Return type:
int
- 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(self, QMetaMethod) bool ¶
- nonExclusiveFilterFlags() object ¶
Returns a list of non-exclusive filter flags, which can be combined with other flags (e.g., CaseInsensitive)
See also
New in version 2.16.
- Return type:
object
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setAggregate(self, aggregate: str)¶
If in AggregateSearch mode, which aggregate should be used to construct the filter expression. Is a Null String if none.
New in version 3.0.
- Parameters:
aggregate (str) –
- setEnabled(self, enabled: bool)¶
Toggles whether the search widget is enabled or disabled.
- Parameters:
enabled (bool) – set to
True
to enable widget
- setExpression(self, expression: str)¶
Set the
expression
which is currently used as filter for this widget.- Parameters:
expression (str) –
- setFeature(self, feature: QgsFeature)¶
- Parameters:
feature (QgsFeature) –
- supportedFlags(self) QgsSearchWidgetWrapper.FilterFlags ¶
Returns filter flags supported by the search widget.
See also
New in version 2.16.
- Return type:
- timerEvent(self, QTimerEvent)¶
- toString(flag: QgsSearchWidgetWrapper.FilterFlag) str ¶
Returns a translated string representing a filter flag.
- Parameters:
flag (QgsSearchWidgetWrapper.FilterFlag) – flag to convert to string
New in version 2.16.
- Return type:
str
- valueChanged¶
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
- valueCleared¶
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