Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QDateTimeEdit Class Reference

#include <qdatetimeedit.h>

Inheritance diagram for QDateTimeEdit:

QAbstractSpinBox QWidget QObject QDateEdit QTimeEdit

List of all members.

Detailed Description

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

doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp 0

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

Definition at line 63 of file qdatetimeedit.h.

Public Types

enum  ButtonSymbols { UpDownArrows, PlusMinus, NoButtons }
enum  CorrectionMode { CorrectToPreviousValue, CorrectToNearestValue }
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
enum  RenderFlag { DrawWindowBackground = 0x1, DrawChildren = 0x2, IgnoreMask = 0x4 }
enum  Section {
  NoSection = 0x0000, AmPmSection = 0x0001, MSecSection = 0x0002, SecondSection = 0x0004,
  MinuteSection = 0x0008, HourSection = 0x0010, DaySection = 0x0100, MonthSection = 0x0200,
  YearSection = 0x0400, TimeSections_Mask = AmPmSection|MSecSection|SecondSection|MinuteSection|HourSection, DateSections_Mask = DaySection|MonthSection|YearSection
enum  StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01, StepDownEnabled = 0x02 }

Public Slots

bool close ()
void deleteLater ()
void hide ()
void lower ()
void raise ()
void repaint ()
void selectAll ()
void setDate (const QDate &date)
void setDateTime (const QDateTime &dateTime)
void setDisabled (bool)
void setEnabled (bool)
void setFocus ()
void setHidden (bool hidden)
QT_MOC_COMPAT void setShown (bool shown)
void setStyleSheet (const QString &styleSheet)
void setTime (const QTime &time)
virtual void setVisible (bool visible)
void setWindowModified (bool)
void setWindowTitle (const QString &)
void show ()
void showFullScreen ()
void showMaximized ()
void showMinimized ()
void showNormal ()
void stepDown ()
void stepUp ()
void update ()


void customContextMenuRequested (const QPoint &pos)
void dateChanged (const QDate &date)
void dateTimeChanged (const QDateTime &date)
void destroyed (QObject *=0)
void editingFinished ()
void timeChanged (const QTime &date)

Public Member Functions

bool acceptDrops () const
QString accessibleDescription () const
QString accessibleName () const
QList< QAction * > actions () const
void activateWindow ()
void addAction (QAction *action)
void addActions (QList< QAction * > actions)
void adjustSize ()
Qt::Alignment alignment () const
bool autoFillBackground () const
QPalette::ColorRole backgroundRole () const
QSize baseSize () const
bool blockSignals (bool b)
ButtonSymbols buttonSymbols () const
bool calendarPopup () const
QCalendarWidgetcalendarWidget () const
 Returns the calendar widget for the editor if calendarPopup is set to true and (sections() & DateSections_Mask) != 0.
QWidgetchildAt (const QPoint &p) const
QWidgetchildAt (int x, int y) const
const QObjectListchildren () const
QRect childrenRect () const
QRegion childrenRegion () const
virtual void clear ()
void clearFocus ()
void clearMask ()
void clearMaximumDate ()
void clearMaximumDateTime ()
void clearMaximumTime ()
void clearMinimumDate ()
void clearMinimumDateTime ()
void clearMinimumTime ()
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
QRect contentsRect () const
Qt::ContextMenuPolicy contextMenuPolicy () const
CorrectionMode correctionMode () const
void createWinId ()
Section currentSection () const
int currentSectionIndex () const
QCursor cursor () const
QDate date () const
QDateTime dateTime () const
int depth () const
int devType () const
bool disconnect (const QObject *receiver, const char *member=0)
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
Sections displayedSections () const
QString displayFormat () const
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
WId effectiveWinId () const
void ensurePolished () const
bool event (QEvent *event)
virtual bool eventFilter (QObject *, QEvent *)
template<typename T>
findChild (const QString &aName=QString()) const
template<typename T>
QList< T > findChildren (const QRegExp &re) const
template<typename T>
QList< T > findChildren (const QString &aName=QString()) const
Qt::FocusPolicy focusPolicy () const
QWidgetfocusProxy () const
QWidgetfocusWidget () 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
void grabKeyboard ()
void grabMouse (const QCursor &)
void grabMouse ()
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
Qt::HANDLE handle () const
bool hasAcceptableInput () const
bool hasFocus () const
bool hasFrame () const
bool hasMouseTracking () const
int height () const
virtual int heightForWidth (int) const
int heightMM () const
bool inherits (const char *classname) const
QInputContextinputContext ()
virtual QVariant inputMethodQuery (Qt::InputMethodQuery) const
void insertAction (QAction *before, QAction *action)
void insertActions (QAction *before, QList< QAction * > actions)
void installEventFilter (QObject *)
WId internalWinId () const
void interpretText ()
bool isAccelerated () const
bool isActiveWindow () const
bool isAncestorOf (const QWidget *child) const
bool isEnabled () const
bool isEnabledTo (QWidget *) const
bool isEnabledToTLW () const
bool isFullScreen () const
bool isHidden () const
bool isLeftToRight () const
bool isMaximized () const
bool isMinimized () const
bool isModal () const
bool isReadOnly () const
bool isRightToLeft () const
bool isTopLevel () const
bool isVisible () const
bool isVisibleTo (QWidget *) const
bool isWidgetType () const
bool isWindow () const
bool isWindowModified () const
bool keyboardTracking () const
void killTimer (int id)
QLayoutlayout () const
Qt::LayoutDirection layoutDirection () const
QLocale locale () const
int logicalDpiX () const
int logicalDpiY () const
QPoint mapFrom (QWidget *, const QPoint &) const
QPoint mapFromGlobal (const QPoint &) const
QPoint mapFromParent (const QPoint &) const
QPoint mapTo (QWidget *, const QPoint &) const
QPoint mapToGlobal (const QPoint &) const
QPoint mapToParent (const QPoint &) const
QRegion mask () const
QDate maximumDate () const
QDateTime maximumDateTime () const
int maximumHeight () const
QSize maximumSize () const
QTime maximumTime () const
int maximumWidth () const
QDate minimumDate () const
QDateTime minimumDateTime () const
int minimumHeight () const
QSize minimumSize () const
QSize minimumSizeHint () const
QTime minimumTime () const
int minimumWidth () const
void move (const QPoint &)
void move (int x, int y)
void moveToThread (QThread *thread)
QWidgetnativeParentWidget () const
QWidgetnextInFocusChain () const
QRect normalGeometry () const
int numColors () const
QString objectName () const
void overrideWindowFlags (Qt::WindowFlags type)
void overrideWindowState (Qt::WindowStates state)
QPaintEnginepaintEngine () const
bool paintingActive () const
const QPalettepalette () const
QObjectparent () const
QWidgetparentWidget () const
int physicalDpiX () const
int physicalDpiY () const
QPoint pos () const
QVariant property (const char *name) const
 QDateTimeEdit (const QTime &t, QWidget *parent=0)
 QDateTimeEdit (const QDate &d, QWidget *parent=0)
 QDateTimeEdit (const QDateTime &dt, QWidget *parent=0)
 QDateTimeEdit (QWidget *parent=0)
QRect rect () const
void releaseKeyboard ()
void releaseMouse ()
void releaseShortcut (int id)
void removeAction (QAction *action)
void removeEventFilter (QObject *)
void render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
void repaint (const QRegion &)
void repaint (const QRect &)
void repaint (int x, int y, int w, int h)
void resize (const QSize &)
void resize (int w, int h)
bool restoreGeometry (const QByteArray &geometry)
QByteArray saveGeometry () const
void scroll (int dx, int dy, const QRect &)
void scroll (int dx, int dy)
Section sectionAt (int index) const
int sectionCount () const
QString sectionText (Section section) const
void setAccelerated (bool on)
void setAcceptDrops (bool on)
void setAccessibleDescription (const QString &description)
void setAccessibleName (const QString &name)
void setAlignment (Qt::Alignment flag)
void setAttribute (Qt::WidgetAttribute, bool on=true)
void setAutoFillBackground (bool enabled)
void setBackgroundRole (QPalette::ColorRole)
void setBaseSize (int basew, int baseh)
void setBaseSize (const QSize &)
void setButtonSymbols (ButtonSymbols bs)
void setCalendarPopup (bool enable)
void setCalendarWidget (QCalendarWidget *calendarWidget)
void setContentsMargins (int left, int top, int right, int bottom)
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
void setCorrectionMode (CorrectionMode cm)
void setCurrentSection (Section section)
void setCurrentSectionIndex (int index)
void setCursor (const QCursor &)
void setDateRange (const QDate &min, const QDate &max)
void setDateTimeRange (const QDateTime &min, const QDateTime &max)
void setDisplayFormat (const QString &format)
void setFixedHeight (int h)
void setFixedSize (int w, int h)
void setFixedSize (const QSize &)
void setFixedWidth (int w)
void setFocus (Qt::FocusReason reason)
void setFocusPolicy (Qt::FocusPolicy policy)
void setFocusProxy (QWidget *)
void setFont (const QFont &)
void setForegroundRole (QPalette::ColorRole)
void setFrame (bool)
void setGeometry (const QRect &)
void setGeometry (int x, int y, int w, int h)
void setInputContext (QInputContext *)
void setKeyboardTracking (bool kt)
void setLayout (QLayout *)
void setLayoutDirection (Qt::LayoutDirection direction)
void setLocale (const QLocale &locale)
void setMask (const QRegion &)
void setMask (const QBitmap &)
void setMaximumDate (const QDate &max)
void setMaximumDateTime (const QDateTime &dt)
void setMaximumHeight (int maxh)
void setMaximumSize (int maxw, int maxh)
void setMaximumSize (const QSize &)
void setMaximumTime (const QTime &max)
void setMaximumWidth (int maxw)
void setMinimumDate (const QDate &min)
void setMinimumDateTime (const QDateTime &dt)
void setMinimumHeight (int minh)
void setMinimumSize (int minw, int minh)
void setMinimumSize (const QSize &)
void setMinimumTime (const QTime &min)
void setMinimumWidth (int minw)
void setMouseTracking (bool enable)
void setObjectName (const QString &name)
void setPalette (const QPalette &)
void setParent (QObject *)
void setParent (QWidget *parent, Qt::WindowFlags f)
void setParent (QWidget *parent)
bool setProperty (const char *name, const QVariant &value)
void setReadOnly (bool r)
void setSelectedSection (Section section)
void setShortcutAutoRepeat (int id, bool enable=true)
void setShortcutEnabled (int id, bool enable=true)
void setSizeIncrement (int w, int h)
void setSizeIncrement (const QSize &)
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
void setSizePolicy (QSizePolicy)
void setSpecialValueText (const QString &txt)
void setStatusTip (const QString &)
void setStyle (QStyle *)
void setTimeRange (const QTime &min, const QTime &max)
void setTimeSpec (Qt::TimeSpec spec)
void setToolTip (const QString &)
void setUpdatesEnabled (bool enable)
void setUserData (uint id, QObjectUserData *data)
void setWhatsThis (const QString &)
void setWindowFilePath (const QString &filePath)
void setWindowFlags (Qt::WindowFlags type)
void setWindowIcon (const QIcon &icon)
void setWindowIconText (const QString &)
void setWindowModality (Qt::WindowModality windowModality)
void setWindowOpacity (qreal level)
void setWindowRole (const QString &)
void setWindowState (Qt::WindowStates state)
void setWindowSurface (QWindowSurface *surface)
void setWrapping (bool w)
bool signalsBlocked () const
QSize size () const
QSize sizeHint () const
QSize sizeIncrement () const
QSizePolicy sizePolicy () const
QString specialValueText () const
void stackUnder (QWidget *)
int startTimer (int interval)
QString statusTip () const
virtual void stepBy (int steps)
QStylestyle () const
QString styleSheet () const
bool testAttribute (Qt::WidgetAttribute) const
QString text () const
QThreadthread () const
QTime time () const
Qt::TimeSpec timeSpec () const
QString toolTip () const
QWidgettopLevelWidget () const
bool underMouse () const
void unsetCursor ()
void unsetLayoutDirection ()
void unsetLocale ()
void update (const QRegion &)
void update (const QRect &)
void update (int x, int y, int w, int h)
void updateGeometry ()
bool updatesEnabled () const
QObjectUserData * userData (uint id) const
QRegion visibleRegion () const
QString whatsThis () const
int width () const
int widthMM () const
QWidgetwindow () const
QString windowFilePath () const
Qt::WindowFlags windowFlags () const
QIcon windowIcon () const
QString windowIconText () const
Qt::WindowModality windowModality () const
qreal windowOpacity () const
QString windowRole () const
Qt::WindowStates windowState () const
QWindowSurfacewindowSurface () const
QString windowTitle () const
Qt::WindowType windowType () const
WId winId () const
bool wrapping () const
int x () const
int y () const

Static Public Member Functions

static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static QWidgetfind (WId)
static QWidgetkeyboardGrabber ()
static QWidgetmouseGrabber ()
static uint registerUserData ()
static void setTabOrder (QWidget *, QWidget *)

Protected Slots

void updateMicroFocus ()

Protected Member Functions

virtual void actionEvent (QActionEvent *)
void changeEvent (QEvent *event)
virtual void childEvent (QChildEvent *)
void closeEvent (QCloseEvent *event)
virtual void connectNotify (const char *signal)
void contextMenuEvent (QContextMenuEvent *event)
void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
virtual void customEvent (QEvent *)
virtual QDateTime dateTimeFromText (const QString &text) const
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
virtual void disconnectNotify (const char *signal)
virtual void dragEnterEvent (QDragEnterEvent *)
virtual void dragLeaveEvent (QDragLeaveEvent *)
virtual void dragMoveEvent (QDragMoveEvent *)
virtual void dropEvent (QDropEvent *)
virtual void enabledChange (bool)
virtual void enterEvent (QEvent *)
virtual void fixup (QString &input) const
virtual void focusInEvent (QFocusEvent *event)
bool focusNextChild ()
virtual bool focusNextPrevChild (bool next)
void focusOutEvent (QFocusEvent *event)
bool focusPreviousChild ()
virtual void fontChange (const QFont &)
void hideEvent (QHideEvent *event)
void initStyleOption (QStyleOptionSpinBox *option) const
virtual void inputMethodEvent (QInputMethodEvent *)
virtual void keyPressEvent (QKeyEvent *event)
void keyReleaseEvent (QKeyEvent *event)
virtual void languageChange ()
virtual void leaveEvent (QEvent *)
QLineEditlineEdit () const
int metric (PaintDeviceMetric) const
virtual void mouseDoubleClickEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *event)
virtual void mousePressEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)
virtual void moveEvent (QMoveEvent *)
virtual void paintEvent (QPaintEvent *event)
virtual void paletteChange (const QPalette &)
 QDateTimeEdit (const QVariant &val, QVariant::Type parserType, QWidget *parent=0)
int receivers (const char *signal) const
void resetInputContext ()
void resizeEvent (QResizeEvent *event)
QObjectsender () const
void setLineEdit (QLineEdit *edit)
void showEvent (QShowEvent *event)
virtual StepEnabled stepEnabled () const
virtual void styleChange (QStyle &)
virtual void tabletEvent (QTabletEvent *)
virtual QString textFromDateTime (const QDateTime &dt) const
void timerEvent (QTimerEvent *event)
virtual QValidator::State validate (QString &input, int &pos) const
virtual void wheelEvent (QWheelEvent *event)
virtual void windowActivationChange (bool)

Protected Attributes

QObjectData * d_ptr
ushort painters

Static Protected Attributes

static const QMetaObject staticQtMetaObject


bool accelerated
 whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons.
bool acceptableInput
 whether the input satisfies the current validation
bool acceptDrops
 whether drop events are enabled for this widget
QString accessibleDescription
 the widget's description as seen by assistive technologies
QString accessibleName
 the widget's name as seen by assistive technologies
Qt::Alignment alignment
 the alignment of the spin box
bool autoFillBackground
 whether the widget background is filled automatically
QSize baseSize
 the base size of the widget
ButtonSymbols buttonSymbols
 the current button symbol mode
bool calendarPopup
 the current calender pop-up showing mode.
QRect childrenRect
 the bounding rectangle of the widget's children
QRegion childrenRegion
 the combined region occupied by the widget's children
Qt::ContextMenuPolicy contextMenuPolicy
 how the widget shows a context menu
CorrectionMode correctionMode
 the mode to correct an {QValidator::}{Intermediate} value if editing finishes
Section currentSection
 the current section of the spinbox setCurrentSection()
int currentSectionIndex
 the current section index of the spinbox
QCursor cursor
 the cursor shape for this widget
QDate date
 the QDate that is set in the QDateTimeEdit
QDateTime dateTime
 the QDateTime that is set in the QDateTimeEdit
Sections displayedSections
 the currently displayed fields of the date time edit
QString displayFormat
 the format used to display the time/date of the date time edit
bool enabled
 whether the widget is enabled
bool focus
 whether this widget (or its focus proxy) has the keyboard input focus
Qt::FocusPolicy focusPolicy
 the way the widget accepts keyboard focus
QFont font
 the font currently set for the widget
bool frame
 whether the spin box draws itself with a frame
QRect frameGeometry
 geometry of the widget relative to its parent including any window frame
QSize frameSize
 the size of the widget including any window frame
bool fullScreen
 whether the widget is shown in full screen mode
QRect geometry
 the geometry of the widget relative to its parent and excluding the window frame
int height
 the height of the widget excluding any window frame
bool isActiveWindow
 whether this widget's window is the active window
bool keyboardTracking
 whether keyboard tracking is enabled for the spinbox.
Qt::LayoutDirection layoutDirection
 the layout direction for this widget
QLocale locale
 the widget's locale
bool maximized
 whether this widget is maximized
QDate maximumDate
 the maximum date of the date time edit
QDateTime maximumDateTime
 the maximum datetime of the date time edit
int maximumHeight
 the widget's maximum height in pixels
QSize maximumSize
 the widget's maximum size in pixels
QTime maximumTime
 the maximum time of the date time edit
int maximumWidth
 the widget's maximum width in pixels
bool minimized
 whether this widget is minimized (iconified)
QDate minimumDate
 the minimum date of the date time edit
QDateTime minimumDateTime
 the minimum datetime of the date time edit
int minimumHeight
 the widget's minimum height in pixels
QSize minimumSize
 the widget's minimum size
QSize minimumSizeHint
 the recommended minimum size for the widget
QTime minimumTime
 the minimum time of the date time edit
int minimumWidth
 the widget's minimum width in pixels
bool modal
 whether the widget is a modal widget
bool mouseTracking
 whether mouse tracking is enabled for the widget
QRect normalGeometry
 the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget
QString objectName
 the name of this object
QPalette palette
 the widget's palette
QPoint pos
 the position of the widget within its parent widget
bool readOnly
 whether the spin box is read only.
QRect rect
 the internal geometry of the widget excluding any window frame
int sectionCount
 the number of sections displayed. If the format is 'yyyy/yy/yyyy', sectionCount returns 3
QSize size
 the size of the widget excluding any window frame
QSize sizeHint
 the recommended size for the widget
QSize sizeIncrement
 the size increment of the widget
QSizePolicy sizePolicy
 the default layout behavior of the widget
QString specialValueText
 the special-value text
QString statusTip
 the widget's status tip
QString styleSheet
 the widget's style sheet
QString text
 the spin box's text, including any prefix and suffix
QTime time
 the QTime that is set in the QDateTimeEdit
Qt::TimeSpec timeSpec
 the current timespec used by the date time edit.
QString toolTip
 the widget's tooltip
bool updatesEnabled
 whether updates are enabled
bool visible
 whether the widget is visible
QString whatsThis
 the widget's What's This help text.
int width
 the width of the widget excluding any window frame
QString windowFilePath
 the file path associated with a widget
QIcon windowIcon
 the widget's icon
QString windowIconText
 the widget's icon text
Qt::WindowModality windowModality
 which windows are blocked by the modal widget
bool windowModified
 whether the document shown in the window has unsaved changes
double windowOpacity
 The level of opacity for the window.
QString windowTitle
 the window title (caption)
bool wrapping
 whether the spin box is circular.
int x
 the x coordinate of the widget relative to its parent including any window frame
int y
 the y coordinate of the widget relative to its parent and including any window frame


class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData
class QWidget

Related Functions

(Note that these are not member functions.)

qFindChild (const QObject *obj, const QString &name=QString(), T dummy=0)
qFindChild (const QObject *obj, const QString &name)
QList< T > qFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > qFindChildren (const QObject *obj, const QString &name)
T * qobject_cast (QObject *object)
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)
const Q_GUI_EXPORT QX11Infoqt_x11Info (const QPaintDevice *pd)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index