Merge pull request #31855 from Gustry/datetime

update docstring about QgsDateTimeEdit with NULL values
This commit is contained in:
rldhont 2019-09-18 18:42:57 +02:00 committed by GitHub
commit 3ff8ca5736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 4 deletions

View File

@ -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
@ -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();

View File

@ -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;}
/**
@ -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;