From 5c5deec4a0e8a3fd85d3742f45ae9b3a78ee5eb0 Mon Sep 17 00:00:00 2001
From: Denis Rouzaud <denis.rouzaud@gmail.com>
Date: Mon, 1 Sep 2014 11:51:56 +0200
Subject: [PATCH] SIP file for new date time edit

---
 python/gui/gui.sip                      |  1 +
 python/gui/qgsdatetimeedit.sip          | 38 +++++++++++++++++++++++++
 src/gui/editorwidgets/qgsdatetimeedit.h |  2 +-
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 python/gui/qgsdatetimeedit.sip

diff --git a/python/gui/gui.sip b/python/gui/gui.sip
index 888a57ee88b..72f65666ef2 100644
--- a/python/gui/gui.sip
+++ b/python/gui/gui.sip
@@ -39,6 +39,7 @@
 %Include qgscolorschemelist.sip
 %Include qgscomposerview.sip
 %Include qgscredentialdialog.sip
+%Include qgsdatetimeedit.sip
 %Include qgsdetaileditemdata.sip
 %Include qgsdetaileditemdelegate.sip
 %Include qgsdialog.sip
diff --git a/python/gui/qgsdatetimeedit.sip b/python/gui/qgsdatetimeedit.sip
new file mode 100644
index 00000000000..90449b9f4e6
--- /dev/null
+++ b/python/gui/qgsdatetimeedit.sip
@@ -0,0 +1,38 @@
+
+class QgsDateTimeEdit : QDateTimeEdit
+{
+
+%TypeHeaderCode
+#include "qgsdatetimeedit.h"
+%End
+
+
+  public:
+    explicit QgsDateTimeEdit( QWidget *parent /TransferThis/ = 0 );
+
+    //! determines if the widget allows setting null date/time.
+    void setAllowNull( bool allowNull );
+    bool allowNull() const;
+
+    /**
+     * @brief setDateTime set the date time in the widget and handles null date times.
+     * @note since QDateTimeEdit::setDateTime() is not virtual, setDateTime must be called for QgsDateTimeEdit.
+     */
+    void setDateTime( const QDateTime &dateTime );
+
+    /**
+     * @brief dateTime returns the date time which can eventually be a null date/time
+     * @note since QDateTimeEdit::dateTime() is not virtual, dateTime must be called for QgsDateTimeEdit.
+     */
+    QDateTime dateTime() const;
+
+    //! Set the current date as NULL
+    //! @note if the widget is not configured to accept NULL dates, this will have no effect
+    virtual void clear();
+
+
+  protected:
+    virtual void resizeEvent( QResizeEvent* event );
+
+    void mousePressEvent( QMouseEvent*event );
+};
diff --git a/src/gui/editorwidgets/qgsdatetimeedit.h b/src/gui/editorwidgets/qgsdatetimeedit.h
index 853ffd85f5b..ee39da3a5d1 100644
--- a/src/gui/editorwidgets/qgsdatetimeedit.h
+++ b/src/gui/editorwidgets/qgsdatetimeedit.h
@@ -34,7 +34,7 @@ class GUI_EXPORT QgsDateTimeEdit : public QDateTimeEdit
 
     //! determines if the widget allows setting null date/time.
     void setAllowNull( bool allowNull );
-    bool allowNull() {return mAllowNull;}
+    bool allowNull() const {return mAllowNull;}
 
     /**
      * @brief setDateTime set the date time in the widget and handles null date times.