Class: QgsDateEdit

class qgis.gui.QgsDateEdit

Bases: QgsDateTimeEdit

The QgsDateEdit class is a QDateEdit widget with the capability of setting/reading null dates.

Warning

You should use the signal valueChanged of this subclass rather than QDateTimeEdit.dateChanged. (If you consequently connect parent’s dateChanged signal and call date() afterwards there is no guarantee that NULL values will be correctly handled).

See also

QgsDateTimeEdit

See also

QgsTimeEdit

New in version 3.14.

QgsDateEdit(parent: QWidget = None) Constructor for QgsDateEdit. The current 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.

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

dateTimeFromText

destroy

disconnectNotify

displayNull

write the null value representation to the line edit without changing the value

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

emitValueChanged

param value

enterEvent

fixup

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

initStyleOption

inputMethodEvent

isNull

Returns True if the widget is currently set to a null value

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

lineEdit

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setDate

Sets the date for the widget and handles null dates.

setLineEdit

sharedPainter

showEvent

stepEnabled

tabletEvent

textFromDateTime

timerEvent

updateMicroFocus

validate

wheelEvent

Signals

dateValueChanged

Signal emitted whenever the date changes.

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
dateTimeFromText(self, str)QDateTime
dateValueChanged

Signal emitted whenever the date changes. [signal]

Parameters

date (Union[QDate) –

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
displayNull(self, updateCalendar: bool = False)

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

dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
emitValueChanged(self, value: Any)
Parameters

value (Any) –

enterEvent(self, QEvent)
fixup(self, str)str
focusInEvent(self, event: QFocusEvent)
focusNextChild(self)bool
focusNextPrevChild(self, bool)bool
focusOutEvent(self, event: QFocusEvent)
focusPreviousChild(self)bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionSpinBox)
inputMethodEvent(self, QInputMethodEvent)
isNull(self)bool

Returns True if the widget is currently set to a null value

isSignalConnected(self, QMetaMethod)bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
lineEdit(self)QLineEdit
metric(self, QPaintDevice.PaintDeviceMetric)int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, event: QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr)Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL)int
resizeEvent(self, QResizeEvent)
sender(self)QObject
senderSignalIndex(self)int
setDate(self, date: Union[QDate, datetime.date])

Sets the date for the widget and handles null dates.

Note

Since QDateTimeEdit.setDate() is not virtual, setDate must be called for QgsDateEdit.

Parameters

date (Union[QDate) –

setLineEdit(self, QLineEdit)
sharedPainter(self)QPainter
showEvent(self, event: QShowEvent)
stepEnabled(self)QAbstractSpinBox.StepEnabled
tabletEvent(self, QTabletEvent)
textFromDateTime(self, Union[QDateTime, datetime.datetime])str
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
validate(self, str, int)Tuple[QValidator.State, str, int]
wheelEvent(self, event: QWheelEvent)