Subgroup: Date

Class: QgsDateTimeEdit

class qgis.gui.QgsDateTimeEdit

Bases: PyQt5.QtWidgets.QDateTimeEdit

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

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
adjustSize
alignment
allowNull
autoFillBackground
backgroundRole
baseSize
blockSignals
buttonSymbols
calendarPopup
calendarWidget
changeEvent
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clear Set the current date as NULL
clearFocus
clearMask
clearMaximumDate
clearMaximumDateTime
clearMaximumTime
clearMinimumDate
clearMinimumDateTime
clearMinimumTime
close
closeEvent
colorCount
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
correctionMode
create
createWindowContainer
currentSection
currentSectionIndex
cursor
customEvent
date
dateTime dateTime returns the date time which can eventually be a null date/time
dateTimeFromText
deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectNotify
displayFormat
displayedSections
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveWinId
ensurePolished
enterEvent
event
eventFilter
find
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
fixup
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPolicy
focusPreviousChild
focusProxy
focusWidget
font
fontInfo
fontMetrics
foregroundRole
frameGeometry
frameSize
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse grabMouse(self, Union[QCursor, Qt.CursorShape])
grabShortcut
graphicsEffect
graphicsProxyWidget
hasAcceptableInput
hasFocus
hasFrame
hasHeightForWidth
hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
inherits
initPainter
initStyleOption
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
installEventFilter
interpretText
isAccelerated
isActiveWindow
isAncestorOf
isEnabled
isEnabledTo
isFullScreen
isGroupSeparatorShown
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isReadOnly
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
keyPressEvent
keyReleaseEvent
keyboardGrabber
keyboardTracking
killTimer
layout
layoutDirection
leaveEvent
lineEdit
locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mask
maximumDate
maximumDateTime
maximumHeight
maximumSize
maximumTime
maximumWidth
metaObject
metric
minimumDate
minimumDateTime
minimumHeight
minimumSize
minimumSizeHint
minimumTime
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
pos
previousInFocusChain
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
raise_
receivers
rect
releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
render render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren))
repaint repaint(self, int, int, int, int)
resize resize(self, int, int)
resizeEvent
restoreGeometry
saveGeometry
scroll scroll(self, int, int, QRect)
sectionAt
sectionCount
sectionText
selectAll
sender
senderSignalIndex
setAccelerated
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAlignment
setAllowNull Determines if the widget allows setting null date/time.
setAttribute
setAutoFillBackground
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setButtonSymbols
setCalendarPopup
setCalendarWidget
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCorrectionMode
setCurrentSection
setCurrentSectionIndex
setCursor
setDate
setDateRange
setDateTime setDateTime set the date time in the widget and handles null date times.
setDateTimeRange
setDisabled
setDisplayFormat
setEmpty Resets the widget to show no value (ie, an “unknown” state).
setEnabled
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setFrame
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setGroupSeparatorShown
setHidden
setInputMethodHints
setKeyboardTracking
setLayout
setLayoutDirection
setLineEdit
setLocale
setMask setMask(self, QRegion)
setMaximumDate
setMaximumDateTime
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumTime
setMaximumWidth
setMinimumDate
setMinimumDateTime
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumTime
setMinimumWidth
setMouseTracking
setObjectName
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setProperty
setReadOnly
setSelectedSection
setShortcutAutoRepeat
setShortcutEnabled
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setSpecialValueText
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setTime
setTimeRange
setTimeSpec
setToolTip
setToolTipDuration
setUpdatesEnabled
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
setWrapping
sharedPainter
show
showEvent
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
specialValueText
stackUnder
startTimer
statusTip
stepBy
stepDown
stepEnabled
stepUp
style
styleSheet
tabletEvent
testAttribute
text
textFromDateTime
thread
time
timeSpec
timerEvent
toolTip
toolTipDuration
tr
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update update(self, QRect)
updateGeometry
updateMicroFocus
updatesEnabled
validate
visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
wrapping
x
y

Attributes

AmPmSection
CorrectToNearestValue
CorrectToPreviousValue
DateSections_Mask
DaySection
DrawChildren
DrawWindowBackground
HourSection
IgnoreMask
MSecSection
MinuteSection
MonthSection
NoButtons
NoSection
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
PlusMinus
SecondSection
StepDownEnabled
StepNone
StepUpEnabled
TimeSections_Mask
UpDownArrows
YearSection
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
dateChanged dateChanged(self, Union[QDate, datetime.date]) [signal]
dateTimeChanged dateTimeChanged(self, Union[QDateTime, datetime.datetime]) [signal]
destroyed destroyed(self, QObject = None) [signal]
editingFinished editingFinished(self) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
timeChanged timeChanged(self, Union[QTime, datetime.time]) [signal]
valueChanged signal emitted whenever the value changes.
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
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. @param date the new date/time value. [signal]

wheelEvent(self, event: QWheelEvent)