QGIS API Documentation  3.0.2-Girona (307d082)
qgsdefaultvalue.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdefaultvalue.h
3 
4  ---------------------
5  begin : 19.9.2017
6  copyright : (C) 2017 by Matthias Kuhn
7  email : matthias@opengis.ch
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSDEFAULTVALUE_H
17 #define QGSDEFAULTVALUE_H
18 
19 #include "qgis_core.h"
20 
21 #include <QString>
22 #include <QObject>
23 
24 
47 class CORE_EXPORT QgsDefaultValue
48 {
49  Q_GADGET
50 
51  Q_PROPERTY( QString expression READ expression WRITE setExpression )
52  Q_PROPERTY( bool applyOnUpdate READ applyOnUpdate WRITE setApplyOnUpdate )
53 
54  public:
55 
60  explicit QgsDefaultValue( const QString &expression = QString(), bool applyOnUpdate = false );
61  bool operator==( const QgsDefaultValue &other ) const;
62 
67  QString expression() const;
68 
73  void setExpression( const QString &expression );
74 
79  bool applyOnUpdate() const;
80 
85  void setApplyOnUpdate( bool applyOnUpdate );
86 
91  bool isValid() const;
92 
97  operator bool() const;
98 
99  private:
100  QString mExpression;
101  bool mApplyOnUpdate = false;
102 };
103 
104 #endif // QGSDEFAULTVALUE_H
The QgsDefaultValue class provides a container for managing client side default values for fields...