mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
This commit adds a new mode to the attribute table dialog for searching and filtering features. When activated (using a button on the toolbar or by pressng CTRL+F), the dialog will switch to form view and all widgets are replaced with their search widget wrapper variant. Alongside each widget is a tool button with options for controlling the search/filter behaviour for that field, eg "equal to", "not equal to", "is null", "greater than", etc.., with the options presented matching themselves to the corresponding field and widget type. New buttons appear at the bottom of the form for either selecting matching features (with options for add to selection/remove from selection/select within current selection) or filtering features in the table (with options for adding features to a current filter or further restricting a current filter). Sponsored by SIGE
91 lines
3.0 KiB
Plaintext
91 lines
3.0 KiB
Plaintext
/** \ingroup gui
|
|
* \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.
|
|
* \note Added in version 2.16
|
|
*/
|
|
class QgsSearchWidgetToolButton : QToolButton
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgssearchwidgettoolbutton.h>
|
|
%End
|
|
public:
|
|
|
|
/** Constructor for QgsSearchWidgetToolButton.
|
|
* @param parent parent object
|
|
*/
|
|
explicit QgsSearchWidgetToolButton( QWidget *parent /TransferThis/ = nullptr );
|
|
|
|
/** Sets the search widget wrapper associated with this button.
|
|
* Calling this will automatically set the available flags to match those
|
|
* supported by the wrapper and reset the active flags to match the wrapper's
|
|
* default flags.
|
|
* @param wrapper search wrapper. Ownership is not transferred.
|
|
*/
|
|
void setSearchWidgetWrapper( QgsSearchWidgetWrapper* wrapper );
|
|
|
|
/** 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;
|
|
* @param flags available flags to show in widget
|
|
* @see availableFlags()
|
|
* @see setActiveFlags()
|
|
*/
|
|
void setAvailableFlags( QgsSearchWidgetWrapper::FilterFlags flags );
|
|
|
|
/** Returns the available filter flags shown in the widget.
|
|
* @see setAvailableFlags()
|
|
* @see activeFlags()
|
|
*/
|
|
QgsSearchWidgetWrapper::FilterFlags availableFlags() const;
|
|
|
|
/** 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.
|
|
* @param flags active flags to show in widget
|
|
* @see toggleFlag()
|
|
* @see activeFlags()
|
|
* @see setAvailableFlags()
|
|
*/
|
|
void setActiveFlags( QgsSearchWidgetWrapper::FilterFlags flags );
|
|
|
|
/** 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.
|
|
* @param flag flag to toggle
|
|
* @see setActiveFlags()
|
|
* @see activeFlags()
|
|
*/
|
|
void toggleFlag( QgsSearchWidgetWrapper::FilterFlag flag );
|
|
|
|
/** Returns the active filter flags shown in the widget.
|
|
* @see setActiveFlags()
|
|
* @see toggleFlag()
|
|
* @see availableFlags()
|
|
*/
|
|
QgsSearchWidgetWrapper::FilterFlags activeFlags() const;
|
|
|
|
/** Returns true if the widget is set to be included in the search.
|
|
* @see setInactive()
|
|
* @see setActive()
|
|
*/
|
|
bool isActive() const;
|
|
|
|
public slots:
|
|
|
|
/** Sets the search widget as inactive, ie do not search the corresponding field.
|
|
* @see isActive()
|
|
* @see setActive()
|
|
*/
|
|
void setInactive();
|
|
|
|
/** Sets the search widget as active by selecting the first available search type.
|
|
* @see isActive()
|
|
* @see setInactive()
|
|
*/
|
|
void setActive();
|
|
|
|
};
|