CopperSpice API  1.9.1
QDateTimeEdit Class Reference

Provides a widget for editing dates and times. More...

Inheritance diagram for QDateTimeEdit:
QAbstractSpinBox QWidget QObject QPaintDevice QDateEdit QTimeEdit

Public Typedefs

using Sections = QFlags< Section >
 
- Public Typedefs inherited from QAbstractSpinBox
using StepEnabled = QFlags< StepEnabledFlag >
 
- Public Typedefs inherited from QWidget
using RenderFlags = QFlags< RenderFlag >
 

Public Types

enum  Section
 
- Public Types inherited from QAbstractSpinBox
enum  ButtonSymbols
 
enum  CorrectionMode
 
enum  StepEnabledFlag
 
- Public Types inherited from QWidget
enum  RenderFlag
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 

Public Signals

void dateChanged (const QDate &date)
 
void dateTimeChanged (const QDateTime &datetime)
 
void timeChanged (const QTime &time)
 
- Public Signals inherited from QAbstractSpinBox
void editingFinished ()
 
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void windowTitleChanged (const QString &title)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void setDate (const QDate &date)
 
void setDateTime (const QDateTime &datetime)
 
void setTime (const QTime &time)
 
- Public Slots inherited from QAbstractSpinBox
virtual void clear ()
 
void selectAll ()
 
void stepDown ()
 
void stepUp ()
 
- Public Slots inherited from QWidget
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void repaint ()
 
void setDisabled (bool disable)
 
void setEnabled (bool enable)
 
void setFocus ()
 
void setHidden (bool hidden)
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool modified)
 
void setWindowTitle (const QString &title)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QDateTimeEdit (const QDate &date, QWidget *parent=nullptr)
 
 QDateTimeEdit (const QDateTime &datetime, QWidget *parent=nullptr)
 
 QDateTimeEdit (const QTime &time, QWidget *parent=nullptr)
 
 QDateTimeEdit (QWidget *parent=nullptr)
 
bool calendarPopup () const
 
QCalendarWidgetcalendarWidget () const
 
void clear () override
 
void clearMaximumDate ()
 
void clearMaximumDateTime ()
 
void clearMaximumTime ()
 
void clearMinimumDate ()
 
void clearMinimumDateTime ()
 
void clearMinimumTime ()
 
Section currentSection () const
 
int currentSectionIndex () const
 
QDate date () const
 
QDateTime dateTime () const
 
Sections displayedSections () const
 
QString displayFormat () const
 
bool event (QEvent *event) override
 
QDate maximumDate () const
 
QDateTime maximumDateTime () const
 
QTime maximumTime () const
 
QDate minimumDate () const
 
QDateTime minimumDateTime () const
 
QTime minimumTime () const
 
Section sectionAt (int index) const
 
int sectionCount () const
 
QString sectionText (Section section) const
 
void setCalendarPopup (bool enable)
 
void setCalendarWidget (QCalendarWidget *calendarWidget)
 
void setCurrentSection (Section section)
 
void setCurrentSectionIndex (int index)
 
void setDateRange (const QDate &min, const QDate &max)
 
void setDateTimeRange (const QDateTime &min, const QDateTime &max)
 
void setDisplayFormat (const QString &format)
 
void setMaximumDate (const QDate &max)
 
void setMaximumDateTime (const QDateTime &dt)
 
void setMaximumTime (const QTime &max)
 
void setMinimumDate (const QDate &min)
 
void setMinimumDateTime (const QDateTime &dt)
 
void setMinimumTime (const QTime &min)
 
void setSelectedSection (Section section)
 
void setTimeRange (const QTime &min, const QTime &max)
 
void setTimeZone (QTimeZone tz)
 
QSize sizeHint () const override
 
void stepBy (int steps) override
 
QTime time () const
 
QTimeZone timeZone () const
 
- Public Methods inherited from QAbstractSpinBox
 QAbstractSpinBox (QWidget *parent=nullptr)
 
 ~QAbstractSpinBox ()
 
Qt::Alignment alignment () const
 
ButtonSymbols buttonSymbols () const
 
CorrectionMode correctionMode () const
 
bool event (QEvent *event) override
 
bool hasAcceptableInput () const
 
bool hasFrame () const
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 
void interpretText ()
 
bool isAccelerated () const
 
bool isGroupSeparatorShown () const
 
bool isReadOnly () const
 
bool keyboardTracking () const
 
QSize minimumSizeHint () const override
 
void setAccelerated (bool on)
 
void setAlignment (Qt::Alignment flag)
 
void setButtonSymbols (ButtonSymbols symbols)
 
void setCorrectionMode (CorrectionMode cm)
 
void setFrame (bool enable)
 
void setGroupSeparatorShown (bool shown)
 
void setKeyboardTracking (bool enable)
 
void setReadOnly (bool enable)
 
void setSpecialValueText (const QString &txt)
 
void setWrapping (bool wrapping)
 
QString specialValueText () const
 
QString text () const
 
bool wrapping () const
 
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QWidget ()
 
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 
void activateWindow ()
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void adjustSize ()
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 
QBackingStorebackingStore () const
 
QSize baseSize () const
 
QWidget * childAt (const QPoint &position) const
 
QWidget * childAt (int x, int y) const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 
void clearMask ()
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
QCursor cursor () const
 
WId effectiveWinId () const
 
void ensurePolished () const
 
Qt::FocusPolicy focusPolicy () const
 
QWidget * focusProxy () const
 
QWidget * focusWidget () const
 
const QFontfont () const
 
QFontInfo fontInfo () const
 
QFontMetrics fontMetrics () const
 
QPalette::ColorRole foregroundRole () const
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
 
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
 
void grabKeyboard ()
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
QGraphicsEffectgraphicsEffect () const
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 
bool hasEditFocus () const
 
bool hasFocus () const
 
virtual bool hasHeightForWidth () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int width) const
 
Qt::InputMethodHints inputMethodHints () const
 
void insertAction (QAction *before, QAction *action)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *parent) const
 
bool isEnabledToTLW () const
 
bool isFullScreen () const
 
bool isHidden () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *parent) const
 
bool isWindow () const
 
bool isWindowModified () const
 
QLayoutlayout () const
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapFromParent (const QPoint &pos) const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QPoint mapToParent (const QPoint &pos) const
 
QRegion mask () const
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (const QPoint &point)
 
void move (int x, int y)
 
QWidget * nativeParentWidget () const
 
QWidget * nextInFocusChain () const
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
QPaintEnginepaintEngine () const override
 
const QPalettepalette () const
 
QWidget * parentWidget () const
 
QPoint pos () const
 
QWidget * previousInFocusChain () const
 
QRect rect () const
 
void releaseKeyboard ()
 
void releaseMouse ()
 
void releaseShortcut (int id)
 
void removeAction (QAction *action)
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &region)
 
void repaint (int x, int y, int w, int h)
 
void resize (const QSize &size)
 
void resize (int w, int h)
 
bool restoreGeometry (const QByteArray &geometry)
 
QByteArray saveGeometry () const
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &rect)
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
 
void setAutoFillBackground (bool enable)
 
void setBackgroundRole (QPalette::ColorRole role)
 
void setBaseSize (const QSize &size)
 
void setBaseSize (int basew, int baseh)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &cursor)
 
void setEditFocus (bool enable)
 
void setFixedHeight (int h)
 
void setFixedSize (const QSize &size)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFocus (Qt::FocusReason reason)
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *widget)
 
void setFont (const QFont &font)
 
void setForegroundRole (QPalette::ColorRole role)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int x, int y, int w, int h)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *layout)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &size)
 
void setMaximumSize (int maxw, int maxh)
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &size)
 
void setMinimumSize (int minw, int minh)
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &palette)
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags flags)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setSizeIncrement (const QSize &size)
 
void setSizeIncrement (int w, int h)
 
void setSizePolicy (QSizePolicy policy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
void setStatusTip (const QString &data)
 
void setStyle (QStyle *style)
 
void setToolTip (const QString &data)
 
void setToolTipDuration (int msec)
 
void setUpdatesEnabled (bool enable)
 
void setWhatsThis (const QString &str)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags flags)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &role)
 
void setWindowState (Qt::WindowStates windowState)
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *widget)
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 
QString toolTip () const
 
int toolTipDuration () const
 
QWidget * topLevelWidget () const
 
bool underMouse () const
 
void ungrabGesture (Qt::GestureType gestureType)
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (const QRect &rect)
 
void update (const QRegion &region)
 
void update (int x, int y, int w, int h)
 
void updateGeometry ()
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 
QString whatsThis () const
 
int width () const
 
QWidget * window () const
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 
QWindowwindowHandle () const
 
QIcon windowIcon () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 
Qt::WindowStates windowState () const
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 
WId winId () const
 
int x () const
 
int y () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Protected Methods

virtual QDateTime dateTimeFromText (const QString &text) const
 
void fixup (QString &input) const override
 
void focusInEvent (QFocusEvent *event) override
 
bool focusNextPrevChild (bool next) override
 
void initStyleOption (QStyleOptionSpinBox *option) const
 
void keyPressEvent (QKeyEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
StepEnabled stepEnabled () const override
 
virtual QString textFromDateTime (const QDateTime &datetime) const
 
QValidator::State validate (QString &input, int &pos) const override
 
void wheelEvent (QWheelEvent *event) override
 
- Protected Methods inherited from QAbstractSpinBox
void changeEvent (QEvent *event) override
 
void closeEvent (QCloseEvent *event) override
 
void contextMenuEvent (QContextMenuEvent *event) override
 
void focusOutEvent (QFocusEvent *event) override
 
void hideEvent (QHideEvent *event) override
 
void initStyleOption (QStyleOptionSpinBox *option) const
 
void keyReleaseEvent (QKeyEvent *event) override
 
QLineEditlineEdit () const
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void setLineEdit (QLineEdit *lineEdit)
 
void showEvent (QShowEvent *event) override
 
void timerEvent (QTimerEvent *event) override
 
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
 
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual void dragEnterEvent (QDragEnterEvent *event)
 
virtual void dragLeaveEvent (QDragLeaveEvent *event)
 
virtual void dragMoveEvent (QDragMoveEvent *event)
 
virtual void dropEvent (QDropEvent *event)
 
virtual void enterEvent (QEvent *event)
 
bool event (QEvent *event) override
 
bool focusNextChild ()
 
bool focusPreviousChild ()
 
void initPainter (QPainter *painter) const override
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
int metric (PaintDeviceMetric metric) const override
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void tabletEvent (QTabletEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 

Properties

 calendarPopup
 
 currentSection
 
 currentSectionIndex
 
 date
 
 dateTime
 
 displayedSections
 
 displayFormat
 
 maximumDate
 
 maximumDateTime
 
 maximumTime
 
 minimumDate
 
 minimumDateTime
 
 minimumTime
 
 sectionCount
 
 time
 
 timeZone
 
- Properties inherited from QAbstractSpinBox
 accelerated
 
 acceptableInput
 
 alignment
 
 buttonSymbols
 
 correctionMode
 
 frame
 
 keyboardTracking
 
 readOnly
 
 specialValueText
 
 text
 
 wrapping
 
- Properties inherited from QWidget
 acceptDrops
 
 accessibleDescription
 
 accessibleName
 
 autoFillBackground
 
 baseSize
 
 childrenRect
 
 childrenRegion
 
 contextMenuPolicy
 
 cursor
 
 enabled
 
 focus
 
 focusPolicy
 
 font
 
 frameGeometry
 
 frameSize
 
 fullScreen
 
 geometry
 
 height
 
 inputMethodHints
 
 isActiveWindow
 
 layoutDirection
 
 locale
 
 maximized
 
 maximumHeight
 
 maximumSize
 
 maximumWidth
 
 minimized
 
 minimumHeight
 
 minimumSize
 
 minimumSizeHint
 
 minimumWidth
 
 modal
 
 mouseTracking
 
 normalGeometry
 
 palette
 
 pos
 
 rect
 
 size
 
 sizeHint
 
 sizeIncrement
 
 sizePolicy
 
 statusTip
 
 styleSheet
 
 toolTip
 
 updatesEnabled
 
 visible
 
 whatsThis
 
 width
 
 windowFilePath
 
 windowFlags
 
 windowIcon
 
 windowIconText
 
 windowModality
 
 windowModified
 
 windowOpacity
 
 windowTitle
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QWidget * find (WId id)
 
static QWidget * keyboardGrabber ()
 
static QWidget * mouseGrabber ()
 
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 

Detailed Description

The QDateTimeEdit class provides a widget for editing dates and times. The user can edit dates by using the keyboard or the arrow keys to increase and decrease date and time values. The arrow keys also be can be used to move from section to section within the QDateTimeEdit box. Dates and times appear in accordance with the format set.

In the following example we are creating a new QDateTimeEdit object initialized with today's date. Then the maximum and minimum valid date range is set to plus or minus 365 days. Calling setDisplayFormat() allows changing the date display format.

dateEdit->setMinimumDate(QDate::currentDate().addDays(-365));
dateEdit->setMaximumDate(QDate::currentDate().addDays(365));
dateEdit->setDisplayFormat("yyyy.MM.dd");

Using a Pop-up Calendar Widget

QDateTimeEdit can be configured to allow a QCalendarWidget to be used to select dates. This is enabled by setting the calendarPopup property. Additionally, you can supply a custom calendar widget for use as the calendar pop-up by calling the setCalendarWidget() function. The existing calendar widget can be retrieved with calendarWidget().

Screenshot of a Windows XP style date time editing widget A date time editing widget shown in the Windows XP widget style.
Screenshot of a Mac OS X style date time editing widget A date time editing widget shown in the Mac OS X widget style.
Screenshot of a Fusion style date time editing widget A date time editing widget shown in the Fusion widget style.
See also
QDateEdit, QTimeEdit, QDate, QTime

Member Typedef Documentation

Typedef for QFlags<Section>. Refer to QDateTimeEdit::Section for documentation.

Member Enumeration Documentation

ConstantValue
QDateTimeEdit::NoSection0x0000
QDateTimeEdit::AmPmSection0x0001
QDateTimeEdit::MSecSection0x0002
QDateTimeEdit::SecondSection0x0004
QDateTimeEdit::MinuteSection0x0008
QDateTimeEdit::HourSection0x0010
QDateTimeEdit::DaySection0x0100
QDateTimeEdit::MonthSection0x0200
QDateTimeEdit::YearSection0x0400

Constructor & Destructor Documentation

QDateTimeEdit::QDateTimeEdit ( QWidget parent = nullptr)
explicit

Constructs an empty date time editor with a parent.

QDateTimeEdit::QDateTimeEdit ( const QDateTime datetime,
QWidget parent = nullptr 
)
explicit

Constructs an empty date time editor with a parent. The value is set to datetime.

QDateTimeEdit::QDateTimeEdit ( const QDate date,
QWidget parent = nullptr 
)
explicit

Constructs an empty date time editor with a parent. The value is set to date.

QDateTimeEdit::QDateTimeEdit ( const QTime time,
QWidget parent = nullptr 
)
explicit

Constructs an empty date time editor with a parent. The value is set to time.

Method Documentation

bool QDateTimeEdit::calendarPopup ( ) const

Returns the value of the property.

QCalendarWidget * QDateTimeEdit::calendarWidget ( ) const

Returns the calendar widget for the editor if calendarPopup is set to true and (sections() & DateSections_Mask) != 0. This method creates and returns a calendar widget if none has been set.

See also
setCalendarWidget()
void QDateTimeEdit::clear ( )
override

Reimplemented from QAbstractSpinBox::clear()

void QDateTimeEdit::clearMaximumDate ( )

Returns the value of the property.

void QDateTimeEdit::clearMaximumDateTime ( )

Returns the value of the property.

void QDateTimeEdit::clearMaximumTime ( )

Returns the value of the property.

void QDateTimeEdit::clearMinimumDate ( )

Returns the value of the property.

void QDateTimeEdit::clearMinimumDateTime ( )

Returns the value of the property.

void QDateTimeEdit::clearMinimumTime ( )

Returns the value of the property..

Section QDateTimeEdit::currentSection ( ) const

Returns the value of the property.

int QDateTimeEdit::currentSectionIndex ( ) const

Returns the value of the property.

QDate QDateTimeEdit::date ( ) const

Returns the value of the property.

void QDateTimeEdit::dateChanged ( const QDate date)
signal

This signal is emitted whenever the date is changed. The new date is passed in date.

QDateTime QDateTimeEdit::dateTime ( ) const

Returns the value of the property.

void QDateTimeEdit::dateTimeChanged ( const QDateTime datetime)
signal

This signal is emitted whenever the date or time is changed. The new date and time is passed in datetime.

QDateTime QDateTimeEdit::dateTimeFromText ( const QString text) const
protectedvirtual

Returns an appropriate datetime for the given text.

This virtual function is used by the datetime edit whenever it needs to interpret text entered by the user as a value.

See also
textFromDateTime(), validate()
Sections QDateTimeEdit::displayedSections ( ) const

Returns the value of the property.

QString QDateTimeEdit::displayFormat ( ) const

Returns the value of the property.

bool QDateTimeEdit::event ( QEvent event)
override

Reimplemented from QAbstractSpinBox::event()

void QDateTimeEdit::fixup ( QString input) const
overrideprotectedvirtual

Reimplemented from QAbstractSpinBox::fixup()

void QDateTimeEdit::focusInEvent ( QFocusEvent event)
overrideprotectedvirtual
bool QDateTimeEdit::focusNextPrevChild ( bool  next)
overrideprotectedvirtual

Reimplemented from QWidget::focusNextPrevChild()

void QDateTimeEdit::initStyleOption ( QStyleOptionSpinBox option) const
protected

Initialize option with the values from this QDateTimeEdit. This method is useful for subclasses when they need a QStyleOptionSpinBox, but do not want to fill in all the information themselves.

See also
QStyleOption::initFrom()
void QDateTimeEdit::keyPressEvent ( QKeyEvent event)
overrideprotectedvirtual
QDate QDateTimeEdit::maximumDate ( ) const

Returns the value of the property.

QDateTime QDateTimeEdit::maximumDateTime ( ) const

Returns the value of the property.

QTime QDateTimeEdit::maximumTime ( ) const

Returns the value of the property.

QDate QDateTimeEdit::minimumDate ( ) const

Returns the value of the property..

QDateTime QDateTimeEdit::minimumDateTime ( ) const

Returns the value of the property.

QTime QDateTimeEdit::minimumTime ( ) const

Returns the value of the property.

void QDateTimeEdit::mousePressEvent ( QMouseEvent event)
overrideprotectedvirtual
void QDateTimeEdit::paintEvent ( QPaintEvent event)
overrideprotectedvirtual

Reimplemented from QAbstractSpinBox::paintEvent()

Section QDateTimeEdit::sectionAt ( int  index) const

Returns the Section at index.

If the format is 'yyyy/MM/dd', sectionAt(0) returns YearSection, sectionAt(1) returns MonthSection, and sectionAt(2) returns YearSection,

int QDateTimeEdit::sectionCount ( ) const

Returns the value of the property.

QString QDateTimeEdit::sectionText ( Section  section) const

Returns the text from the given section.

See also
currentSection()
void QDateTimeEdit::setCalendarPopup ( bool  enable)

Sets the value of the property to enable.

void QDateTimeEdit::setCalendarWidget ( QCalendarWidget calendarWidget)

Sets the given calendarWidget as the widget to be used for the calendar pop-up. The editor does not automatically take ownership of the calendar widget. The calendarPopup property must be set to true before setting the calendar widget.

See also
calendarWidget(), calendarPopup
void QDateTimeEdit::setCurrentSection ( Section  section)

Sets the value of the property to section.

void QDateTimeEdit::setCurrentSectionIndex ( int  index)

Sets the value of the property to index.

void QDateTimeEdit::setDate ( const QDate date)
slot

Sets the value of the property to date.

void QDateTimeEdit::setDateRange ( const QDate min,
const QDate max 
)

This method sets the minimum and maximum date range. If either min or max are not valid, this method does nothing.

See also
setMinimumDate(), maximumDate(), setMaximumDate(), clearMinimumDate(), setMinimumTime(), maximumTime(), setMaximumTime(), clearMinimumTime(), QDate::isValid()
void QDateTimeEdit::setDateTime ( const QDateTime datetime)
slot

Sets the value of the property to datetime.

void QDateTimeEdit::setDateTimeRange ( const QDateTime min,
const QDateTime max 
)

This method sets the minimum and maximum date time range. If either min or max are not valid, this method does nothing.

See also
setMinimumDate(), maximumDate(), setMaximumDate(), clearMinimumDate(), setMinimumTime(), maximumTime(), setMaximumTime(), clearMinimumTime(), QDateTime::isValid()
void QDateTimeEdit::setDisplayFormat ( const QString format)

Sets the value of the property to format.

void QDateTimeEdit::setMaximumDate ( const QDate max)

Sets the value of the property to max.

void QDateTimeEdit::setMaximumDateTime ( const QDateTime dt)

Sets the value of the property to dt.

void QDateTimeEdit::setMaximumTime ( const QTime max)

Sets the value of the property to max.

void QDateTimeEdit::setMinimumDate ( const QDate min)

Sets the value of the property to min.

void QDateTimeEdit::setMinimumDateTime ( const QDateTime dt)

Sets the value of the property to dt.

void QDateTimeEdit::setMinimumTime ( const QTime min)

Sets the value of the property to min.

void QDateTimeEdit::setSelectedSection ( Section  section)

Selects section. If section does not exist in the currently displayed sections this function does nothing. If section is NoSection this function will unselect all text in the editor. Otherwise this function will move the cursor and the current section to the selected section.

See also
currentSection()
void QDateTimeEdit::setTime ( const QTime time)
slot

Sets the value of the property to time.

void QDateTimeEdit::setTimeRange ( const QTime min,
const QTime max 
)

This method sets the minimum and maximum time. If either min or max are not valid, this method does nothing.

See also
setMinimumDate(), maximumDate(), setMaximumDate(), clearMinimumDate(), setMinimumTime(), maximumTime(), setMaximumTime(), clearMinimumTime(), QTime::isValid()
void QDateTimeEdit::setTimeZone ( QTimeZone  tz)

Sets the value of the property to tz.

QSize QDateTimeEdit::sizeHint ( ) const
overridevirtual

Returns the value of the property.

Reimplemented from QAbstractSpinBox::sizeHint()

void QDateTimeEdit::stepBy ( int  steps)
overridevirtual

Reimplemented from QAbstractSpinBox::stepBy()

StepEnabled QDateTimeEdit::stepEnabled ( ) const
overrideprotectedvirtual

Reimplemented from QAbstractSpinBox::stepEnabled()

QString QDateTimeEdit::textFromDateTime ( const QDateTime datetime) const
protectedvirtual

This method is used by the date time edit whenever it needs to display datetime. If you reimplement this method you may also need to reimplement validate().

See also
dateTimeFromText(), validate()
QTime QDateTimeEdit::time ( ) const

Returns the time of the date time edit.

void QDateTimeEdit::timeChanged ( const QTime time)
signal

This signal is emitted whenever the time is changed. The new time is passed in time.

QTimeZone QDateTimeEdit::timeZone ( ) const

Returns the value of the property.

QValidator::State QDateTimeEdit::validate ( QString input,
int &  pos 
) const
overrideprotectedvirtual

Reimplemented from QAbstractSpinBox::validate()

void QDateTimeEdit::wheelEvent ( QWheelEvent event)
overrideprotectedvirtual

Reimplemented from QAbstractSpinBox::wheelEvent()

Property Documentation

QDateTimeEdit::calendarPopup

This property holds the current calendar pop-up showing mode.

The calendar pop-up will be shown upon clicking the arrow button. This property is valid only if there is a valid date display format.

See also
setDisplayFormat()
PropertiesClass Methods
read calendarPopup
write setCalendarPopup
QDateTimeEdit::currentSection

This property holds the current section of the spinbox setCurrentSection().

PropertiesClass Methods
read currentSection
write setCurrentSection
QDateTimeEdit::currentSectionIndex

This property holds the current section index of the spinbox.

If the format is 'yyyy/MM/dd' and the cursorPosition is 5, this method returns a value of 1 since you are in the second section. If the cursorPosition is 3 the return value is 0.

See also
currentSection(), setCurrentSection()
PropertiesClass Methods
read currentSectionIndex
write setCurrentSectionIndex
QDateTimeEdit::date

This property holds the QDate currently displayed in the QDateTimeEdit widget.

By default this property contains a date of January 1, 2000.

See also
dateTime, time
PropertiesClass Methods
read date
write setDate
notify dateChanged
QDateTimeEdit::dateTime

This property holds a QDateTime.

By default this property contains a date of January 1, 2000 and a time of 00:00:00 and 0 milliseconds.

See also
date, time
PropertiesClass Methods
read dateTime
write setDateTime
notify dateTimeChanged
user true
QDateTimeEdit::displayedSections

This property holds the currently displayed fields of the date time edit. Returns a bit set of the displayed sections for this format.

See also
displayFormat(), setDisplayFormat()
PropertiesClass Methods
read displayedSections
QDateTimeEdit::displayFormat

This property holds the format used to display the time/date of for a QDateTimeEdit widget. This format is described in QDateTime::toString() and QDateTime::fromString().

The following are a few example format strings using a date of August 17 2008. If you specify an invalid format nothing will be set. If you specify a two digit year it will be interpreted to be in the century in which the QDateTimeEdit was initialized.

FormatResult
dd.MM.yyyy17.08.2008
MMM d yyAug 17 08
MMMM d yyAugust 17 08
See also
QDateTime::toString(), displayedSections
PropertiesClass Methods
read displayFormat
write setDisplayFormat
QDateTimeEdit::maximumDate

This property holds the maximum date of the date time edit. When setting this property the minimumDate is adjusted if necessary to ensure that the range remains valid. If the date is not a valid QDate object, this method does nothing.

By default this property contains a date that refers to December 31, 7999.

See also
minimumDate, minimumTime, maximumTime, setDateRange()
PropertiesClass Methods
read maximumDate
write setMaximumDate
reset clearMaximumDate
QDateTimeEdit::maximumDateTime

This property holds the maximum datetime of the date time edit.

When setting this property the minimumDateTime() is adjusted if necessary to ensure that the range remains valid. If the datetime is not a valid QDateTime object, this function does nothing.

The default maximumDateTime can be restored with clearMaximumDateTime().

By default this property contains a date that refers to 31 December, 7999 and a time of 23:59:59 and 999 milliseconds.

See also
minimumDateTime(), minimumTime(), maximumTime(), minimumDate(), maximumDate(), setDateTimeRange(), setDateRange(), setTimeRange(), clearMinimumDateTime(), clearMinimumDate(), clearMaximumDate(), clearMinimumTime(), clearMaximumTime()
PropertiesClass Methods
read maximumDateTime
write setMaximumDateTime
reset clearMaximumDateTime
QDateTimeEdit::maximumTime

This property holds the maximum time of the date time edit.

When setting this property, the minimumTime is adjusted if necessary to ensure that the range remains valid. If the time is not a valid QTime object, this function does nothing.

By default this property contains a time of 23:59:59 and 999 milliseconds.

See also
minimumTime, minimumDate, maximumDate, setTimeRange()
PropertiesClass Methods
read maximumTime
write setMaximumTime
reset clearMaximumTime
QDateTimeEdit::minimumDate

This property holds the minimum date of the date time edit.

When setting this property the maximumDate is adjusted if necessary, to ensure that the range remains valid. If the date is not a valid QDate object, this function does nothing.

By default this property contains a date that refers to September 14, 1752. The minimum date must be at least the first day in year 100, otherwise setMinimumDate() has no effect.

See also
minimumTime(), maximumTime(), setDateRange()
PropertiesClass Methods
read minimumDate
write setMinimumDate
reset clearMinimumDate
QDateTimeEdit::minimumDateTime

This property holds the minimum datetime of the date time edit.

When setting this property the maximumDateTime() is adjusted if necessary to ensure that the range remains valid. If the datetime is not a valid QDateTime object, this function does nothing.

The default minimumDateTime can be restored with clearMinimumDateTime()

By default this property contains a date that refers to September 14, 1752 and a time of 00:00:00 and 0 milliseconds.

See also
maximumDateTime(), minimumTime(), maximumTime(), minimumDate(), maximumDate(), setDateTimeRange(), setDateRange(), setTimeRange(), clearMaximumDateTime(), clearMinimumDate(), clearMaximumDate(), clearMinimumTime(), clearMaximumTime()
PropertiesClass Methods
read minimumDateTime
write setMinimumDateTime
reset clearMinimumDateTime
QDateTimeEdit::minimumTime

This property holds the minimum time of the date time edit.

When setting this property the maximumTime is adjusted if necessary, to ensure that the range remains valid. If the time is not a valid QTime object, this function does nothing.

By default this property contains a time of 00:00:00 and 0 milliseconds.

See also
maximumTime, minimumDate, maximumDate, setTimeRange()
PropertiesClass Methods
read minimumTime
write setMinimumTime
reset clearMinimumTime
QDateTimeEdit::sectionCount

This property holds the number of sections displayed. If the format is 'yyyy/yy/yyyy', sectionCount returns 3.

PropertiesClass Methods
read sectionCount
QDateTimeEdit::time

This property holds the QTime that is set in the widget. By default this property contains a time of 00:00:00 and 0 milliseconds.

See also
date, dateTime
PropertiesClass Methods
read time
write setTime
notify timeChanged
QDateTimeEdit::timeZone

This property holds the current timezone used by the date time edit.

PropertiesClass Methods
read timeZone
write setTimeZone