QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsattributeformrelationeditorwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsattributeformrelationeditorwidget.cpp
3  --------------------------------------
4  Date : Nov 2017
5  Copyright : (C) 2017 Matthias Kuhn
6  Email : [email protected]
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
18 #include "qgsattributeform.h"
19 
21 
23  : QgsAttributeFormWidget( wrapper, form )
24  , mWrapper( wrapper )
25 {
27 }
28 
30 {
31  if ( !context.parentContext() )
32  {
33  mSearchWidget = new QgsRelationAggregateSearchWidgetWrapper( layer(), mWrapper, form() );
34  mSearchWidget->setContext( context );
35 
36  setSearchWidgetWrapper( mSearchWidget );
37  }
38 }
39 
41 {
42  QString filterExpression;
43  if ( mSearchWidget )
44  filterExpression = mSearchWidget->expression();
45 
46  return filterExpression;
47 }
QString expression() const override
Will be used to access the widget's value.
QString currentFilterExpression() const override
Creates an expression matching the current search filter value and search properties represented in t...
Search widget for the children of a relation.
Base class for all widgets shown on a QgsAttributeForm.
This class contains context information for attribute editor widgets.
void createSearchWidgetWrappers(const QgsAttributeEditorContext &context=QgsAttributeEditorContext()) override
Creates the search widget wrappers for the widget used when the form is in search mode...
void setContext(const QgsAttributeEditorContext &context)
Set the context in which this widget is shown.
void setSearchWidgetWrapper(QgsSearchWidgetWrapper *wrapper)
Sets the search widget wrapper for the widget used when the form is in search mode.
const QgsAttributeEditorContext * parentContext() const
void setSearchWidgetToolButtonVisible(bool searchWidgetToolButtonVisible)
The visibility of the search widget tool button, that allows (de)activating this search widgte or def...
QgsVectorLayer * layer()
The layer for which this widget and its form is shown.
QgsAttributeFormRelationEditorWidget(QgsRelationWidgetWrapper *wrapper, QgsAttributeForm *form)
Constructor.
QgsAttributeForm * form() const
The form on which this widget is shown.