Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QDateTimeEdit

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QWidget
                      com.trolltech.qt.gui.QAbstractSpinBox
                          com.trolltech.qt.gui.QDateTimeEdit

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

Direct Known Subclasses:
  QDateEdit, QTimeEdit

    public class QDateTimeEdit

extends QAbstractSpinBox

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

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

Here we've created a new `QDateTimeEdit` object initialized with today's date, and restricted the valid date range to today plus or minus 365 days. We've set the order to month, day, year.

The minimum value for `QDateTimeEdit` is 14 September 1752, and 2 January 4713BC for `QDate`. You can change this by calling `setMinimumDate()`, `setMaximumDate()`, `setMinimumTime()`, and `setMaximumTime()`.

## 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()`.

| A date time editing widget shown in the Windows XP widget style.
| A date time editing widget shown in the Macintosh widget style.
| A date time editing widget shown in the Plastique widget style.

See also:
  `QDateEdit`, `QTimeEdit`, `QDate`, and `QTime`.

Nested Class Summary
`static class` | `QDateTimeEdit.Section`
`static class` | `QDateTimeEdit.Sections` This is a flags class for com.trolltech.qt.gui.QDateTimeEdit.Section

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QAbstractSpinBox
`QAbstractSpinBox.ButtonSymbols, QAbstractSpinBox.CorrectionMode, QAbstractSpinBox.StepEnabled, QAbstractSpinBox.StepEnabledFlag`

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
`QWidget.RenderFlag, QWidget.RenderFlags`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Field Summary
`QSignalEmitter.Signal1` | `dateChanged` This signal is emitted whenever the date is changed.
`QSignalEmitter.Signal1` | `dateTimeChanged` This signal is emitted whenever the date or time is changed.
`QSignalEmitter.Signal1` | `timeChanged` This signal is emitted whenever the time is changed.

Fields inherited from class com.trolltech.qt.gui.QAbstractSpinBox
`editingFinished`

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Constructor Summary
`QDateTimeEdit()` Constructs an empty date time editor with a `parent`.
`QDateTimeEdit(QDate d)` Constructs an empty date time editor with a `parent`.
`QDateTimeEdit(QDate d, QWidget parent)`
`QDateTimeEdit(QDateTime dt)` Constructs an empty date time editor with a `parent`.
`QDateTimeEdit(QDateTime dt, QWidget parent)` Constructs an empty date time editor with a `parent`.
`QDateTimeEdit(QTime t)` Constructs an empty date time editor with a `parent`.
`QDateTimeEdit(QTime t, QWidget parent)` Constructs an empty date time editor with a `parent`.
`QDateTimeEdit(QWidget parent)` Constructs an empty date time editor with a `parent`.

Method Summary
`boolean` | `calendarPopup()` This property holds the current calender pop-up showing mode.
`QCalendarWidget` | `calendarWidget()` Returns the calendar widget for the editor if `calendarPopup` is set to true and (`sections()` & `DateSections_Mask` ) != 0.
`void` | `clearMaximumDate()` This property holds the maximum date of the date time edit.
`void` | `clearMaximumDateTime()` This property holds the maximum datetime of the date time edit.
`void` | `clearMaximumTime()` This property holds the maximum time of the date time edit.
`void` | `clearMinimumDate()` This property holds the minimum date of the date time edit.
`void` | `clearMinimumDateTime()` This property holds the minimum datetime of the date time edit.
`void` | `clearMinimumTime()` This property holds the minimum time of the date time edit.
`QDateTimeEdit.Section` | `currentSection()` This property holds the current section of the spinbox `setCurrentSection()`.
`int` | `currentSectionIndex()` This property holds the current section index of the spinbox.
`QDate` | `date()` This property holds the `QDate` that is set in the `QDateTimeEdit`.
`QDateTime` | `dateTime()` This property holds the `QDateTime` that is set in the `QDateTimeEdit`.
`protected QDateTime` | `dateTimeFromText(java.lang.String text)` Returns an appropriate datetime for the given `text`.
`QDateTimeEdit.Sections` | `displayedSections()` This property holds the currently displayed fields of the date time edit.
`java.lang.String` | `displayFormat()` This property holds the format used to display the time/date of the date time edit.
`static QDateTimeEdit` | `fromNativePointer(QNativePointer nativePointer)` This method returns the QDateTimeEdit instance pointed to by `nativePointer`.
`protected void` | `initDateTimeEditStyleOption(QStyleOptionSpinBox option)` Initializes the style option of this QDateTimeEdit.
`QDate` | `maximumDate()` This property holds the maximum date of the date time edit.
`QDateTime` | `maximumDateTime()` This property holds the maximum datetime of the date time edit.
`QTime` | `maximumTime()` This property holds the maximum time of the date time edit.
`QDate` | `minimumDate()` This property holds the minimum date of the date time edit.
`QDateTime` | `minimumDateTime()` This property holds the minimum datetime of the date time edit.
`QTime` | `minimumTime()` This property holds the minimum time of the date time edit.
`QDateTimeEdit.Section` | `sectionAt(int index)` Returns the Section at `index`.
`int` | `sectionCount()` This property holds the number of sections displayed.
`java.lang.String` | `sectionText(QDateTimeEdit.Section section)` Returns the text from the given `section`.
`void` | `setCalendarPopup(boolean enable)` This property holds the current calender pop-up showing mode.
`void` | `setCalendarWidget(QCalendarWidget calendarWidget)` Sets the calendar widget to be used for the calendar pop-up.
`void` | `setCurrentSection(QDateTimeEdit.Section section)` This property holds the current section of the spinbox `setCurrentSection()`.
`void` | `setCurrentSectionIndex(int index)` This property holds the current section index of the spinbox.
`void` | `setDate(QDate date)` This property holds the `QDate` that is set in the `QDateTimeEdit`.
`void` | `setDateRange(QDate min, QDate max)` Convenience function to set minimum and maximum date with one function call.
`void` | `setDateTime(QDateTime dateTime)` This property holds the `QDateTime` that is set in the `QDateTimeEdit`.
`void` | `setDateTimeRange(QDateTime min, QDateTime max)` Convenience function to set minimum and maximum date time with one function call.
`void` | `setDisplayFormat(java.lang.String format)` This property holds the format used to display the time/date of the date time edit.
`void` | `setMaximumDate(QDate max)` This property holds the maximum date of the date time edit.
`void` | `setMaximumDateTime(QDateTime dt)` This property holds the maximum datetime of the date time edit.
`void` | `setMaximumTime(QTime max)` This property holds the maximum time of the date time edit.
`void` | `setMinimumDate(QDate min)` This property holds the minimum date of the date time edit.
`void` | `setMinimumDateTime(QDateTime dt)` This property holds the minimum datetime of the date time edit.
`void` | `setMinimumTime(QTime min)` This property holds the minimum time of the date time edit.
`void` | `setSelectedSection(QDateTimeEdit.Section section)` Selects `section`.
`void` | `setTime(QTime time)` This property holds the `QTime` that is set in the `QDateTimeEdit`.
`void` | `setTimeRange(QTime min, QTime max)` Convenience function to set minimum and maximum time with one function call.
`void` | `setTimeSpec(Qt.TimeSpec spec)` This property holds the current timespec used by the date time edit.
`protected java.lang.String` | `textFromDateTime(QDateTime dt)` This virtual function is used by the date time edit whenever it needs to display `dateTime`.
`QTime` | `time()` This property holds the `QTime` that is set in the `QDateTimeEdit`.
`Qt.TimeSpec` | `timeSpec()` This property holds the current timespec used by the date time edit.

Methods inherited from class com.trolltech.qt.gui.QAbstractSpinBox
`alignment, buttonSymbols, clear, correctionMode, fixup, hasAcceptableInput, hasFrame, initStyleOption, interpretText, isAccelerated, isReadOnly, keyboardTracking, lineEdit, selectAll, setAccelerated, setAlignment, setAlignment, setButtonSymbols, setCorrectionMode, setFrame, setKeyboardTracking, setLineEdit, setReadOnly, setSpecialValueText, setWrapping, specialValueText, stepBy, stepDown, stepEnabled, stepUp, text, validate, wrapping`

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### dateChanged

    public final QSignalEmitter.Signal1 dateChanged

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

### dateTimeChanged

    public final QSignalEmitter.Signal1 dateTimeChanged

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

### timeChanged

    public final QSignalEmitter.Signal1 timeChanged

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

Constructor Detail

### QDateTimeEdit

    public QDateTimeEdit()

  Constructs an empty date time editor with a `parent`.

### QDateTimeEdit

    public QDateTimeEdit(QWidget parent)

  Constructs an empty date time editor with a `parent`.

### QDateTimeEdit

    public QDateTimeEdit(QDate d)

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

### QDateTimeEdit

    public QDateTimeEdit(QDate d,
                         QWidget parent)

### QDateTimeEdit

    public QDateTimeEdit(QDateTime dt)

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

### QDateTimeEdit

    public QDateTimeEdit(QDateTime dt,
                         QWidget parent)

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

### QDateTimeEdit

    public QDateTimeEdit(QTime t)

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

### QDateTimeEdit

    public QDateTimeEdit(QTime t,
                         QWidget parent)

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

Method Detail

### calendarPopup

    public final boolean calendarPopup()

  This property holds the current calender 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()`.

### calendarWidget

    public final QCalendarWidget calendarWidget()

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

See also:
  `setCalendarWidget()`.

### clearMaximumDate

    public final void clearMaximumDate()

  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 function does nothing.

See also:
  `minimumDate`, `minimumTime`, `maximumTime`, and `setDateRange()`.

### clearMaximumDateTime

    public final void clearMaximumDateTime()

  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()`.

See also:
  `minimumDateTime()`, `minimumTime()`, `maximumTime()`, `minimumDate()`, `maximumDate()`, `setDateTimeRange()`, `setDateRange()`, `setTimeRange()`, `clearMinimumDateTime()`, `clearMinimumDate()`, `clearMaximumDate()`, `clearMinimumTime()`, and `clearMaximumTime()`.

### clearMaximumTime

    public final void clearMaximumTime()

  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.

See also:
  `minimumTime`, `minimumDate`, `maximumDate`, and `setTimeRange()`.

### clearMinimumDate

    public final void clearMinimumDate()

  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.

See also:
  `minimumTime()`, `maximumTime()`, and `setDateRange()`.

### clearMinimumDateTime

    public final void clearMinimumDateTime()

  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()`

See also:
  `maximumDateTime()`, `minimumTime()`, `maximumTime()`, `minimumDate()`, `maximumDate()`, `setDateTimeRange()`, `setDateRange()`, `setTimeRange()`, `clearMaximumDateTime()`, `clearMinimumDate()`, `clearMaximumDate()`, `clearMinimumTime()`, and `clearMaximumTime()`.

### clearMinimumTime

    public final void clearMinimumTime()

  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.

See also:
  `maximumTime`, `minimumDate`, `maximumDate`, and `setTimeRange()`.

### currentSection

    public final QDateTimeEdit.Section currentSection()

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

### currentSectionIndex

    public final int currentSectionIndex()

  This property holds the current section index of the spinbox. If the format is 'yyyy/MM/dd', the `displayText` is '2001/05/21' and the `cursorPosition` is 5 `currentSectionIndex` returns 1. If the `cursorPosition` is 3 `currentSectionIndex` is 0 etc.

  `setCurrentSection()`

See also:
  `currentSection()`.

### date

    public final QDate date()

  This property holds the `QDate` that is set in the `QDateTimeEdit`.

See also:
  `time`, and `dateTime`.

### dateTime

    public final QDateTime dateTime()

  This property holds the `QDateTime` that is set in the `QDateTimeEdit`.

See also:
  `date`, and `time`.

### displayFormat

    public final java.lang.String displayFormat()

  This property holds the format used to display the time/date of the date time edit. This format is the same as the one used described in `QDateTime::toString()` and `QDateTime::fromString()`

  Example format strings(assuming that the date is 2nd of July 1969):

  Format | Result
  --- | ---
  dd.MM.yyyy | 02.07.1969
  MMM d yy | Jul 2 69
  MMMM d yy | July 2 69

  Note that if you specify a two digit year, it will be interpreted to be in the century in which the date time edit was initialized. The default century is the 21 (2000-2099).

  If you specify an invalid format the format will not be set.

See also:
  `QDateTime::toString()`, and `displayedSections()`.

### displayedSections

    public final QDateTimeEdit.Sections displayedSections()

  This property holds the currently displayed fields of the date time edit. Returns a bit set of the displayed sections for this format. `setDisplayFormat()`, `displayFormat()`

### maximumDate

    public final QDate 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 function does nothing.

See also:
  `minimumDate`, `minimumTime`, `maximumTime`, and `setDateRange()`.

### maximumDateTime

    public final QDateTime 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()`.

See also:
  `minimumDateTime()`, `minimumTime()`, `maximumTime()`, `minimumDate()`, `maximumDate()`, `setDateTimeRange()`, `setDateRange()`, `setTimeRange()`, `clearMinimumDateTime()`, `clearMinimumDate()`, `clearMaximumDate()`, `clearMinimumTime()`, and `clearMaximumTime()`.

### maximumTime

    public final QTime 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.

See also:
  `minimumTime`, `minimumDate`, `maximumDate`, and `setTimeRange()`.

### minimumDate

    public final QDate 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.

See also:
  `minimumTime()`, `maximumTime()`, and `setDateRange()`.

### minimumDateTime

    public final QDateTime 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()`

See also:
  `maximumDateTime()`, `minimumTime()`, `maximumTime()`, `minimumDate()`, `maximumDate()`, `setDateTimeRange()`, `setDateRange()`, `setTimeRange()`, `clearMaximumDateTime()`, `clearMinimumDate()`, `clearMaximumDate()`, `clearMinimumTime()`, and `clearMaximumTime()`.

### minimumTime

    public final QTime 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.

See also:
  `maximumTime`, `minimumDate`, `maximumDate`, and `setTimeRange()`.

### sectionAt

    public final QDateTimeEdit.Section sectionAt(int index)

  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` ,

### sectionCount

    public final int sectionCount()

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

### sectionText

    public final java.lang.String sectionText(QDateTimeEdit.Section section)

  Returns the text from the given `section`.

See also:
  `currentSection()`.

### setCalendarPopup

    public final void setCalendarPopup(boolean enable)

  This property holds the current calender 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()`.

### setCalendarWidget

    public final void setCalendarWidget(QCalendarWidget calendarWidget)

  Sets the calendar widget to be used for the calendar pop-up. The editor does not automatically take ownership of the calendar widget.

See also:
  `calendarWidget()`, and `calendarPopup`.

### setCurrentSection

    public final void setCurrentSection(QDateTimeEdit.Section section)

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

### setCurrentSectionIndex

    public final void setCurrentSectionIndex(int index)

  This property holds the current section index of the spinbox. If the format is 'yyyy/MM/dd', the `displayText` is '2001/05/21' and the `cursorPosition` is 5 `currentSectionIndex` returns 1. If the `cursorPosition` is 3 `currentSectionIndex` is 0 etc.

  `setCurrentSection()`

See also:
  `currentSection()`.

### setDate

    public final void setDate(QDate date)

  This property holds the `QDate` that is set in the `QDateTimeEdit`.

See also:
  `time`, and `dateTime`.

### setDateRange

    public final void setDateRange(QDate min,
                                   QDate max)

  Convenience function to set minimum and maximum date with one function call.

        setDateRange(min, max);

  is analogous to:

        setMinimumDate(min);
        setMaximumDate(max);

  If either `min` or `max` are not valid, this function does nothing.

See also:
  `setMinimumDate()`, `maximumDate()`, `setMaximumDate()`, `clearMinimumDate()`, `setMinimumTime()`, `maximumTime()`, `setMaximumTime()`, `clearMinimumTime()`, and `QDate::isValid()`.

### setDateTime

    public final void setDateTime(QDateTime dateTime)

  This property holds the `QDateTime` that is set in the `QDateTimeEdit`.

See also:
  `date`, and `time`.

### setDateTimeRange

    public final void setDateTimeRange(QDateTime min,
                                       QDateTime max)

  Convenience function to set minimum and maximum date time with one function call.

        setDateTimeRange(min, max);

  is analogous to:

        setMinimumDateTime(min);
        setMaximumDateTime(max);

  If either `min` or `max` are not valid, this function does nothing.

See also:
  `setMinimumDate()`, `maximumDate()`, `setMaximumDate()`, `clearMinimumDate()`, `setMinimumTime()`, `maximumTime()`, `setMaximumTime()`, `clearMinimumTime()`, and `QDateTime::isValid()`.

### setDisplayFormat

    public final void setDisplayFormat(java.lang.String format)

  This property holds the format used to display the time/date of the date time edit. This format is the same as the one used described in `QDateTime::toString()` and `QDateTime::fromString()`

  Example format strings(assuming that the date is 2nd of July 1969):

  Format | Result
  --- | ---
  dd.MM.yyyy | 02.07.1969
  MMM d yy | Jul 2 69
  MMMM d yy | July 2 69

  Note that if you specify a two digit year, it will be interpreted to be in the century in which the date time edit was initialized. The default century is the 21 (2000-2099).

  If you specify an invalid format the format will not be set.

See also:
  `QDateTime::toString()`, and `displayedSections()`.

### setMaximumDate

    public final void setMaximumDate(QDate max)

  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 function does nothing.

See also:
  `minimumDate`, `minimumTime`, `maximumTime`, and `setDateRange()`.

### setMaximumDateTime

    public final void setMaximumDateTime(QDateTime dt)

  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()`.

See also:
  `minimumDateTime()`, `minimumTime()`, `maximumTime()`, `minimumDate()`, `maximumDate()`, `setDateTimeRange()`, `setDateRange()`, `setTimeRange()`, `clearMinimumDateTime()`, `clearMinimumDate()`, `clearMaximumDate()`, `clearMinimumTime()`, and `clearMaximumTime()`.

### setMaximumTime

    public final void setMaximumTime(QTime max)

  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.

See also:
  `minimumTime`, `minimumDate`, `maximumDate`, and `setTimeRange()`.

### setMinimumDate

    public final void setMinimumDate(QDate min)

  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.

See also:
  `minimumTime()`, `maximumTime()`, and `setDateRange()`.

### setMinimumDateTime

    public final void setMinimumDateTime(QDateTime dt)

  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()`

See also:
  `maximumDateTime()`, `minimumTime()`, `maximumTime()`, `minimumDate()`, `maximumDate()`, `setDateTimeRange()`, `setDateRange()`, `setTimeRange()`, `clearMaximumDateTime()`, `clearMinimumDate()`, `clearMaximumDate()`, `clearMinimumTime()`, and `clearMaximumTime()`.

### setMinimumTime

    public final void setMinimumTime(QTime min)

  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.

See also:
  `maximumTime`, `minimumDate`, `maximumDate`, and `setTimeRange()`.

### setSelectedSection

    public final void setSelectedSection(QDateTimeEdit.Section section)

  Selects `section`. If `section` doesn't 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()`.

### setTime

    public final void setTime(QTime time)

  This property holds the `QTime` that is set in the `QDateTimeEdit`.

See also:
  `date`, and `dateTime`.

### setTimeRange

    public final void setTimeRange(QTime min,
                                   QTime max)

  Convenience function to set minimum and maximum time with one function call.

        setTimeRange(min, max);

  is analogous to:

        setMinimumTime(min);
        setMaximumTime(max);

  If either `min` or `max` are not valid, this function does nothing.

See also:
  `setMinimumDate()`, `maximumDate()`, `setMaximumDate()`, `clearMinimumDate()`, `setMinimumTime()`, `maximumTime()`, `setMaximumTime()`, `clearMinimumTime()`, and `QTime::isValid()`.

### setTimeSpec

    public final void setTimeSpec(Qt.TimeSpec spec)

  This property holds the current timespec used by the date time edit. All dates/passed to the date time edit will be converted to this timespec.

### time

    public final QTime time()

  This property holds the `QTime` that is set in the `QDateTimeEdit`.

See also:
  `date`, and `dateTime`.

### timeSpec

    public final Qt.TimeSpec timeSpec()

  This property holds the current timespec used by the date time edit. All dates/passed to the date time edit will be converted to this timespec.

### dateTimeFromText

    protected QDateTime dateTimeFromText(java.lang.String text)

  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()`, and `validate()`.

### textFromDateTime

    protected java.lang.String textFromDateTime(QDateTime dt)

  This virtual function is used by the date time edit whenever it needs to display `dateTime`.

  If you reimplement this, you may also need to reimplement `valueFromText()` and `validate()`.

See also:
  `dateTimeFromText()`, and `validate()`.

### fromNativePointer

    public static QDateTimeEdit fromNativePointer(QNativePointer nativePointer)

  This method returns the QDateTimeEdit instance pointed to by `nativePointer`.

### initDateTimeEditStyleOption

    protected final void initDateTimeEditStyleOption(QStyleOptionSpinBox option)

  Initializes the style option of this QDateTimeEdit.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD