QgsDefaultSearchWidgetWrapper class

Wraps a search widget.

Default form is just a QgsLineFilterEdit

Base classes

class QgsSearchWidgetWrapper
Shows a search widget on a filter form.

Derived classes

class QgsTextEditSearchWidgetWrapper
Wraps a text edit widget for searching.

Constructors, destructors, conversion operators

QgsDefaultSearchWidgetWrapper(QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr) explicit
Constructor for QgsDefaultSearchWidgetWrapper.

Public functions

auto applyDirectly() -> bool override
If this is true, then this search widget should take effect directly when its expression changes.
auto defaultFlags() const -> QgsSearchWidgetWrapper::FilterFlags override
Returns the filter flags which should be set by default for the search widget.
auto expression() const -> QString override
Will be used to access the widget's value.
auto supportedFlags() const -> QgsSearchWidgetWrapper::FilterFlags override
Returns filter flags supported by the search widget.

Protected functions

auto caseSensitiveCheckBox() -> QCheckBox*
Returns a pointer to the case sensitivity checkbox in the widget.
auto createWidget(QWidget* parent) -> QWidget* override
This method should create a new widget with the provided parent.
void initWidget(QWidget* editor) override
This method should initialize the editor widget with runtime data.
auto lineEdit() -> QgsFilterLineEdit*
Returns a pointer to the line edit part of the widget.
auto valid() const -> bool override
Returns true if the widget has been properly initialized.

Function documentation

QgsSearchWidgetWrapper::FilterFlags QgsDefaultSearchWidgetWrapper::defaultFlags() const override

Returns the filter flags which should be set by default for the search widget.

QString QgsDefaultSearchWidgetWrapper::expression() const override

Will be used to access the widget's value.

Returns The current value the widget represents

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.

QgsSearchWidgetWrapper::FilterFlags QgsDefaultSearchWidgetWrapper::supportedFlags() const override

Returns filter flags supported by the search widget.

QCheckBox* QgsDefaultSearchWidgetWrapper::caseSensitiveCheckBox() protected

Returns a pointer to the case sensitivity checkbox in the widget.

QWidget* QgsDefaultSearchWidgetWrapper::createWidget(QWidget* parent) override protected

This method should create a new widget with the provided parent.

Parameters
parent You should set this parent on the created widget.
Returns A new widget

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().

void QgsDefaultSearchWidgetWrapper::initWidget(QWidget* editor) override protected

This method should initialize the editor widget with runtime data.

Parameters
editor The widget which will represent this attribute editor in a form.

Fill your comboboxes here.

QgsFilterLineEdit* QgsDefaultSearchWidgetWrapper::lineEdit() protected

Returns a pointer to the line edit part of the widget.

bool QgsDefaultSearchWidgetWrapper::valid() const override protected

Returns true if the widget has been properly initialized.

Returns Validity status of this widget.

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.