QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsfieldvalidator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfieldvalidator.h - description
3  -------------------
4  begin : March 2011
5  copyright : (C) 2011 by SunilRajKiran-kCube
6  email : [email protected]
7 
8  adapted version of QValidator for QgsField
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #ifndef QGSFIELDVALIDATOR_H
21 #define QGSFIELDVALIDATOR_H
22 
23 #include <QValidator>
24 #include <QVariant>
25 #include <QSettings>
26 #include "qgsfield.h"
27 
28 
29 class GUI_EXPORT QgsFieldValidator : public QValidator
30 {
31  Q_OBJECT
32 
33  public:
34  QgsFieldValidator( QObject *parent, const QgsField &field, QString dateFormat );
36 
37  virtual State validate( QString &, int & ) const;
38  virtual void fixup( QString & ) const;
39 
40  QString dateFormat() const { return mDateFormat; }
41 
42  private:
43  // Disables copy constructing
44  Q_DISABLE_COPY( QgsFieldValidator )
45 
46  QValidator *mValidator;
47  QgsField mField;
48  QString mNullValue;
49  QString mDateFormat;
50 };
51 
52 #endif // QGSFIELDVALIDATOR_H