The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times.
More...
#include <qgsdatetimeedit.h>
|
void | displayNull (bool updateCalendar=false) |
| write the null value representation to the line edit without changing the value More...
|
|
virtual void | emitValueChanged (const QVariant &value) |
| Emits the widget's correct value changed signal. More...
|
|
void | focusInEvent (QFocusEvent *event) override |
|
void | focusOutEvent (QFocusEvent *event) override |
|
bool | isNull () const |
| Returns true if the widget is currently set to a null value. More...
|
|
void | mousePressEvent (QMouseEvent *event) override |
|
void | showEvent (QShowEvent *event) override |
|
void | wheelEvent (QWheelEvent *event) override |
|
The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times.
- Warning
- You should use the signal valueChanged of this subclass rather than QDateTimeEdit::dateTimeChanged. (If you consequently connect parent's dateTimeChanged signal and call dateTime() afterwards there is no guarantee that NULL values will be correctly handled).
- See also
- QgsDateEdit
-
QgsTimeEdit
Definition at line 36 of file qgsdatetimeedit.h.
◆ QgsDateTimeEdit()
QgsDateTimeEdit::QgsDateTimeEdit |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
Constructor for QgsDateTimeEdit.
The current date and time is used by default. The widget is allowing null by default. If allow null is disabled, you should check allowNull before getting values from the widget.
Definition at line 31 of file qgsdatetimeedit.cpp.
◆ allowNull()
bool QgsDateTimeEdit::allowNull |
( |
| ) |
const |
|
inline |
◆ clear()
void QgsDateTimeEdit::clear |
( |
| ) |
|
|
override |
Set the current date as NULL.
- Note
- If the widget is not configured to accept NULL dates, this will have no effect.
Definition at line 68 of file qgsdatetimeedit.cpp.
◆ date()
QDate QgsDateTimeEdit::date |
( |
| ) |
const |
◆ dateTime()
QDateTime QgsDateTimeEdit::dateTime |
( |
| ) |
const |
Returns the date time which can be a null date/time.
- Note
- Before QGIS 3.10, you mustn't call date() or time() because they can't return a NULL value.
-
Since QDateTimeEdit::dateTime() is not virtual, dateTime must be called for QgsDateTimeEdit.
Definition at line 324 of file qgsdatetimeedit.cpp.
◆ displayNull()
void QgsDateTimeEdit::displayNull |
( |
bool |
updateCalendar = false | ) |
|
|
protected |
write the null value representation to the line edit without changing the value
- Parameters
-
updateCalendar | Flag if calendar is open and minimum date needs to be set |
Definition at line 244 of file qgsdatetimeedit.cpp.
◆ emitValueChanged()
void QgsDateTimeEdit::emitValueChanged |
( |
const QVariant & |
value | ) |
|
|
protectedvirtual |
◆ focusInEvent()
void QgsDateTimeEdit::focusInEvent |
( |
QFocusEvent * |
event | ) |
|
|
overrideprotected |
◆ focusOutEvent()
void QgsDateTimeEdit::focusOutEvent |
( |
QFocusEvent * |
event | ) |
|
|
overrideprotected |
◆ isNull()
bool QgsDateTimeEdit::isNull |
( |
| ) |
const |
|
protected |
Returns true
if the widget is currently set to a null value.
Definition at line 263 of file qgsdatetimeedit.cpp.
◆ mousePressEvent()
void QgsDateTimeEdit::mousePressEvent |
( |
QMouseEvent * |
event | ) |
|
|
overrideprotected |
◆ nullRepresentation()
QString QgsDateTimeEdit::nullRepresentation |
( |
| ) |
const |
◆ setAllowNull()
void QgsDateTimeEdit::setAllowNull |
( |
bool |
allowNull | ) |
|
◆ setDateTime()
void QgsDateTimeEdit::setDateTime |
( |
const QDateTime & |
dateTime | ) |
|
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.
Definition at line 303 of file qgsdatetimeedit.cpp.
◆ setEmpty()
void QgsDateTimeEdit::setEmpty |
( |
| ) |
|
Resets the widget to show no value (ie, an "unknown" state).
- Since
- QGIS 2.16
Definition at line 91 of file qgsdatetimeedit.cpp.
◆ setNullRepresentation()
void QgsDateTimeEdit::setNullRepresentation |
( |
const QString & |
null | ) |
|
◆ showEvent()
void QgsDateTimeEdit::showEvent |
( |
QShowEvent * |
event | ) |
|
|
overrideprotected |
◆ time()
QTime QgsDateTimeEdit::time |
( |
| ) |
const |
◆ valueChanged
void QgsDateTimeEdit::valueChanged |
( |
const QDateTime & |
date | ) |
|
|
signal |
Signal emitted whenever the value changes.
- Parameters
-
date | The new date/time value. |
◆ wheelEvent()
void QgsDateTimeEdit::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
overrideprotected |
◆ TestQgsDateTimeEdit
friend class TestQgsDateTimeEdit |
|
friend |
◆ mBlockChangedSignal
int QgsDateTimeEdit::mBlockChangedSignal = 0 |
|
protected |
◆ mIsEmpty
bool QgsDateTimeEdit::mIsEmpty = false |
|
protected |
◆ allowNull
bool QgsDateTimeEdit::allowNull |
|
readwrite |
The documentation for this class was generated from the following files: