Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #31874 from qgis/backport-31855-to-release-3_4
[Backport release-3_4] update docstring about QgsDateTimeEdit with NULL values
  • Loading branch information
rldhont committed Sep 18, 2019
2 parents 5f5b1cb + fa95536 commit 8dbf063
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
16 changes: 15 additions & 1 deletion python/gui/auto_generated/editorwidgets/qgsdatetimeedit.sip.in
Expand Up @@ -29,13 +29,23 @@ The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/read
explicit QgsDateTimeEdit( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsDateTimeEdit
The current date and time is used by default.
The widget is allowing null by default.
%End

void setAllowNull( bool allowNull );
%Docstring
Determines if the widget allows setting null date/time.

.. seealso:: :py:func:`allowNull`
%End

bool allowNull() const;
%Docstring
If the widget allows setting null date/time.

.. seealso:: :py:func:`setAllowNull`
%End

void setDateTime( const QDateTime &dateTime );
%Docstring
Expand All @@ -52,7 +62,11 @@ 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.
You mustn't call date() or time() because they can't return a NULL value.

.. note::

since QDateTimeEdit.dateTime() is not virtual, dateTime must be called for QgsDateTimeEdit
%End

virtual void clear();
Expand Down
19 changes: 16 additions & 3 deletions src/gui/editorwidgets/qgsdatetimeedit.h
Expand Up @@ -36,11 +36,23 @@ class GUI_EXPORT QgsDateTimeEdit : public QDateTimeEdit

public:

//! Constructor for QgsDateTimeEdit
/**
* Constructor for QgsDateTimeEdit
* The current date and time is used by default.
* The widget is allowing null by default.
*/
explicit QgsDateTimeEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr );

//! Determines if the widget allows setting null date/time.
/**
* Determines if the widget allows setting null date/time.
* \see allowNull
*/
void setAllowNull( bool allowNull );

/**
* If the widget allows setting null date/time.
* \see setAllowNull
*/
bool allowNull() const {return mAllowNull;}

/**
Expand All @@ -51,7 +63,8 @@ class GUI_EXPORT QgsDateTimeEdit : public QDateTimeEdit

/**
* \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.
* \note You mustn't call date() or time() because they can't return a NULL value.
* \note since QDateTimeEdit::dateTime() is not virtual, dateTime must be called for QgsDateTimeEdit
*/
QDateTime dateTime() const;

Expand Down

0 comments on commit 8dbf063

Please sign in to comment.