QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsdatetimeedit.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdatetimeedit.h
3  --------------------------------------
4  Date : 08.2014
5  Copyright : (C) 2014 Denis Rouzaud
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 
16 #ifndef QGSDATETIMEEDIT_H
17 #define QGSDATETIMEEDIT_H
18 
19 #include <QDateTimeEdit>
20 
21 class QToolButton;
22 class QLineEdit;
23 
27 class GUI_EXPORT QgsDateTimeEdit : public QDateTimeEdit
28 {
29  Q_OBJECT
30  Q_PROPERTY( bool allowNull READ allowNull WRITE setAllowNull )
31 
32  public:
33  explicit QgsDateTimeEdit( QWidget *parent = 0 );
34 
36  void setAllowNull( bool allowNull );
37  bool allowNull() const {return mAllowNull;}
38 
43  void setDateTime( const QDateTime &dateTime );
44 
49  QDateTime dateTime() const;
50 
53  virtual void clear();
54 
55 
56  protected:
57  virtual void resizeEvent( QResizeEvent* event );
58 
59  void mousePressEvent( QMouseEvent*event );
60 
61 
62  private slots:
63  void changed( const QDateTime & dateTime );
64 
65 
66  private:
67  int spinButtonWidth() const;
68  int frameWidth() const;
69 
70  bool mAllowNull;
71  bool mIsNull;
72 
73  QLineEdit* mNullLabel;
74  QToolButton* mClearButton;
75 
76 };
77 
78 #endif // QGSDATETIMEEDIT_H