QGIS API Documentation  2.14.0-Essen
qgsvaluerelationsearchwidgetwrapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvaluerelationwidgetwrapper.h
3  --------------------------------------
4  Date : 19.6.2015
5  Copyright : (C) 2015 Karolina Alexiou
6  Email : carolinegr at gmail dot com
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 
16 #ifndef QGSVALUERELATIONSEARCHWIDGETWRAPPER_H
17 #define QGSVALUERELATIONSEARCHWIDGETWRAPPER_H
18 
19 #include "qgssearchwidgetwrapper.h"
21 
22 #include <QComboBox>
23 #include <QListWidget>
24 #include <QLineEdit>
25 
27 
36 {
37  Q_OBJECT
38 
39  public:
42 
43  public:
44  explicit QgsValueRelationSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr );
45  bool applyDirectly() override;
46  QString expression() override;
47  bool valid() const override;
48  QVariant value() const;
49 
50  protected:
51  QWidget* createWidget( QWidget* parent ) override;
52  void initWidget( QWidget* editor ) override;
53 
54  public slots:
55  void valueChanged();
56 
57  protected slots:
58  void setExpression( QString exp ) override;
59 
60  private:
61  QComboBox* mComboBox;
62  QListWidget* mListWidget;
63  QLineEdit* mLineEdit;
64 
65  ValueRelationCache mCache;
66  QgsVectorLayer* mLayer;
67 
69 };
70 
71 #endif // QGSVALUERELATIONSEARCHWIDGETWRAPPER_H
Manages an editor widget Widget and wrapper share the same parent.
virtual void setExpression(QString value)=0
virtual QString expression()=0
Will be used to access the widget&#39;s value.
Wraps a value relation search widget.
virtual bool valid() const =0
Return true if the widget has been properly initialized.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
virtual bool applyDirectly()=0
If this is true, then this search widget should take effect directly when its expression changes...
Represents a vector layer which manages a vector based data sets.