QgsDateTimeEdit class

The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times.

Constructors, destructors, conversion operators

QgsDateTimeEdit(QWidget* parent = nullptr) explicit
Constructor for QgsDateTimeEdit.

Public functions

void clear() override
Set the current date as NULL.
auto dateTime() const -> QDateTime
dateTime returns the date time which can eventually be a null date/time
void setAllowNull(bool allowNull)
Determines if the widget allows setting null date/time.
void setDateTime(const QDateTime& dateTime)
setDateTime set the date time in the widget and handles null date times.
void setEmpty()
Resets the widget to show no value (ie, an "unknown" state).

Signals

void valueChanged(const QDateTime& date)
signal emitted whenever the value changes.

Function documentation

void QgsDateTimeEdit::clear() override

Set the current date as NULL.

QDateTime QgsDateTimeEdit::dateTime() const

dateTime returns the date time which can eventually be a null date/time

void QgsDateTimeEdit::setDateTime(const QDateTime& dateTime)

setDateTime set the date time in the widget and handles null date times.

void QgsDateTimeEdit::setEmpty()

Resets the widget to show no value (ie, an "unknown" state).

void QgsDateTimeEdit::valueChanged(const QDateTime& date) signal

signal emitted whenever the value changes.

Parameters
date the new date/time value.