Class: QgsSearchWidgetToolButton

A tool button widget which is displayed next to search widgets in forms, and allows for controlling how the widget behaves and how the filtering/searching operates.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsSearchWidgetToolButton

Base classes

QToolButton

QAbstractButton

QWidget

QObject

QPaintDevice

Methods

activeFlags

Returns the active filter flags shown in the widget.

availableFlags

Returns the available filter flags shown in the widget.

isActive

Returns True if the widget is set to be included in the search.

setActive

Sets the search widget as active by selecting the first available search type.

setActiveFlags

Sets the current active filter flags for the widget.

setAvailableFlags

Sets the available filter flags to show in the widget.

setDefaultFlags

Sets the default filter flags to show in the widget.

setInactive

Sets the search widget as inactive, ie do not search the corresponding field.

toggleFlag

Toggles an individual active filter flag for the widget.

Signals

activeFlagsChanged

Emitted when the active flags selected in the widget is changed

class qgis.gui.QgsSearchWidgetToolButton[source]

Bases: QToolButton

__init__(parent: QWidget | None = None)

Constructor for QgsSearchWidgetToolButton.

Parameters:

parent (Optional[QWidget] = None) – parent object

activeFlags(self) QgsSearchWidgetWrapper.FilterFlags[source]

Returns the active filter flags shown in the widget.

See also

setActiveFlags()

See also

toggleFlag()

See also

availableFlags()

Return type:

QgsSearchWidgetWrapper.FilterFlags

signal activeFlagsChanged(flags: QgsSearchWidgetWrapper.FilterFlags)[source]

Emitted when the active flags selected in the widget is changed

Parameters:

flags (QgsSearchWidgetWrapper.FilterFlags) – active flags

availableFlags(self) QgsSearchWidgetWrapper.FilterFlags[source]

Returns the available filter flags shown in the widget.

See also

activeFlags()

Return type:

QgsSearchWidgetWrapper.FilterFlags

isActive(self) bool[source]

Returns True if the widget is set to be included in the search.

See also

setInactive()

See also

setActive()

Return type:

bool

setActive(self)[source]

Sets the search widget as active by selecting the first available search type.

See also

isActive()

See also

setInactive()

setActiveFlags(self, flags: QgsSearchWidgetWrapper.FilterFlags | QgsSearchWidgetWrapper.FilterFlag)[source]

Sets the current active filter flags for the widget. Any flags which are not present in the available filter flags (see availableFlags()) will not be set.

Parameters:

flags (Union[QgsSearchWidgetWrapper.FilterFlags, QgsSearchWidgetWrapper.FilterFlag]) – active flags to show in widget

See also

toggleFlag()

See also

activeFlags()

setAvailableFlags(self, flags: QgsSearchWidgetWrapper.FilterFlags | QgsSearchWidgetWrapper.FilterFlag)[source]

Sets the available filter flags to show in the widget. Any active flags (see activeFlags()) which are not present in the new available filter flags will be cleared;

Parameters:

flags (Union[QgsSearchWidgetWrapper.FilterFlags, QgsSearchWidgetWrapper.FilterFlag]) – available flags to show in widget

See also

availableFlags()

See also

setActiveFlags()

setDefaultFlags(self, flags: QgsSearchWidgetWrapper.FilterFlags | QgsSearchWidgetWrapper.FilterFlag)[source]

Sets the default filter flags to show in the widget.

Parameters:

flags (Union[QgsSearchWidgetWrapper.FilterFlags, QgsSearchWidgetWrapper.FilterFlag]) – default flags to show in widget

See also

setActiveFlags()

setInactive(self)[source]

Sets the search widget as inactive, ie do not search the corresponding field.

See also

isActive()

See also

setActive()

toggleFlag(self, flag: QgsSearchWidgetWrapper.FilterFlag)[source]

Toggles an individual active filter flag for the widget. Any flags which are not present in the available filter flags (see availableFlags()) will be ignore. Other flags may be cleared if they conflict with the newly toggled flag.

Parameters:

flag (QgsSearchWidgetWrapper.FilterFlag) – flag to toggle

See also

setActiveFlags()

See also

activeFlags()