Class: QgsDateTimeEdit

class qgis.gui.QgsDateTimeEdit(parent: QWidget = None)

Bases: PyQt5.QtWidgets.QDateTimeEdit

Constructor for QgsDateTimeEdit

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 warranty to have a proper NULL value handling.

Methods

actionEvent
allowNull
changeEvent
childEvent
clear Set the current date as NULL
closeEvent
connectNotify
contextMenuEvent
create
customEvent
dateTime dateTime returns the date time which can eventually be a null date/time
dateTimeFromText
destroy
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
enterEvent
fixup
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPreviousChild
hideEvent
initPainter
initStyleOption
inputMethodEvent
isSignalConnected
keyPressEvent
keyReleaseEvent
leaveEvent
lineEdit
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveEvent
nativeEvent
paintEvent
receivers
resizeEvent
sender
senderSignalIndex
setAllowNull Determines if the widget allows setting null date/time.
setDateTime setDateTime set the date time in the widget and handles null date times.
setEmpty Resets the widget to show no value (ie, an “unknown” state).
setLineEdit
sharedPainter
showEvent
stepEnabled
tabletEvent
textFromDateTime
timerEvent
updateMicroFocus
validate
wheelEvent

Signals

valueChanged signal emitted whenever the value changes.

Attributes

actionEvent()
allowNull(self) → bool
changeEvent()
childEvent()
clear(self)

Set the current date as NULL

Note

if the widget is not configured to accept NULL dates, this will have no effect

closeEvent()
connectNotify()
contextMenuEvent()
create()
customEvent()
dateTime(self) → QDateTime

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.

dateTimeFromText()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
fixup()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent(self, event: QFocusEvent)
focusPreviousChild()
hideEvent()
initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
lineEdit()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent(self, event: QMouseEvent)
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
receivers()
resizeEvent()
sender()
senderSignalIndex()
setAllowNull(self, allowNull: bool)

Determines if the widget allows setting null date/time.

setDateTime(self, dateTime: Union[QDateTime, datetime.datetime])

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.

setEmpty(self)

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

New in version 2.16.

setLineEdit()
sharedPainter()
showEvent(self, event: QShowEvent)
stepEnabled()
tabletEvent()
textFromDateTime()
timerEvent()
updateMicroFocus()
validate()
valueChanged

signal emitted whenever the value changes.

Parameters:date – the new date/time value. [signal]
wheelEvent(self, event: QWheelEvent)