QGIS API Documentation  3.6.0-Noosa (5873452)
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 : [email protected]
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 #include "qgis_sip.h"
21 
22 #include <QString>
23 #include <QObject>
24 
25 
48 class CORE_EXPORT QgsDefaultValue
49 {
50  Q_GADGET SIP_SKIP
51 
52  Q_PROPERTY( QString expression READ expression WRITE setExpression )
53  Q_PROPERTY( bool applyOnUpdate READ applyOnUpdate WRITE setApplyOnUpdate )
54 
55  public:
56 
61  explicit QgsDefaultValue( const QString &expression = QString(), bool applyOnUpdate = false );
62  bool operator==( const QgsDefaultValue &other ) const;
63 
68  QString expression() const;
69 
74  void setExpression( const QString &expression );
75 
80  bool applyOnUpdate() const;
81 
86  void setApplyOnUpdate( bool applyOnUpdate );
87 
92  bool isValid() const;
93 
98  operator bool() const SIP_PYTHON_SPECIAL_BOOL( isValid );
99 
100  private:
101  QString mExpression;
102  bool mApplyOnUpdate = false;
103 };
104 
106 
107 #endif // QGSDEFAULTVALUE_H
The QgsDefaultValue class provides a container for managing client side default values for fields...
Q_DECLARE_METATYPE(QModelIndex)
#define SIP_SKIP
Definition: qgis_sip.h:119
#define SIP_PYTHON_SPECIAL_BOOL(method_or_code)
Definition: qgis_sip.h:232