|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
public class QDateTimeEdit
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 maximum and minimum values for a date value in the date editor default to the maximum and minimum values for a QDate. You can change this by calling setMinimumDate, setMaximumDate, setMinimumTime, and setMaximumTime.
![]() | 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. |
Nested Class Summary | |
---|---|
static class |
QDateTimeEdit.Section
Press link for info on QDateTimeEdit.Section |
static class |
QDateTimeEdit.Sections
This QFlag class provides flags for the int enum. |
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<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Field Summary | |
---|---|
QSignalEmitter.Signal1<QDate> |
dateChanged
This signal is emitted whenever the date is changed. |
QSignalEmitter.Signal1<QDateTime> |
dateTimeChanged
This signal is emitted whenever the date or time is changed. |
QSignalEmitter.Signal1<QTime> |
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()
Equivalent to QDateTimeEdit(0). |
|
QDateTimeEdit(QDate d)
Equivalent to QDateTimeEdit(d, 0). |
|
QDateTimeEdit(QDate d,
QWidget parent)
Constructs an empty date time editor with a parent. |
|
QDateTimeEdit(QDateTime dt)
Equivalent to QDateTimeEdit(dt, 0). |
|
QDateTimeEdit(QDateTime dt,
QWidget parent)
Constructs an empty date time editor with a parent. |
|
QDateTimeEdit(QTime t)
Equivalent to QDateTimeEdit(t, 0). |
|
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()
Returns the current calender popup showing mode.. |
void |
clear()
This function is reimplemented for internal reasons. |
void |
clearMaximumDate()
Resets the maximum date of the date time edit. |
void |
clearMaximumTime()
Resets the maximum time of the date time edit. |
void |
clearMinimumDate()
Resets the minimum date of the date time edit. |
void |
clearMinimumTime()
Resets the minimum time of the date time edit. |
QDateTimeEdit.Section |
currentSection()
Returns the current section of the spinbox setCurrentSection(). |
int |
currentSectionIndex()
Returns the current section index of the spinbox. |
QDate |
date()
Returns the QDate that is set in the QDateTimeEdit. |
QDateTime |
dateTime()
Returns 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()
Returns the currently displayed fields of the date time edit. |
java.lang.String |
displayFormat()
Returns the format used to display the time/date of the date time edit. |
boolean |
event(QEvent event)
This function is reimplemented for internal reasons. |
java.lang.String |
fixup(java.lang.String input)
This function is reimplemented for internal reasons. |
protected void |
focusInEvent(QFocusEvent event)
This function is reimplemented for internal reasons. |
protected boolean |
focusNextPrevChild(boolean next)
This function is reimplemented for internal reasons. |
static QDateTimeEdit |
fromNativePointer(QNativePointer nativePointer)
This function returns the QDateTimeEdit instance pointed to by nativePointer |
protected void |
keyPressEvent(QKeyEvent event)
This function is reimplemented for internal reasons. |
QDate |
maximumDate()
Returns the maximum date of the date time edit. |
QTime |
maximumTime()
Returns the maximum time of the date time edit. |
QDate |
minimumDate()
Returns the minimum date of the date time edit. |
QTime |
minimumTime()
Returns the minimum time of the date time edit. |
protected void |
mousePressEvent(QMouseEvent event)
This function is reimplemented for internal reasons. |
protected void |
paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons. |
QDateTimeEdit.Section |
sectionAt(int index)
Returns the Section at index. |
int |
sectionCount()
Returns the number of sections displayed. |
java.lang.String |
sectionText(QDateTimeEdit.Section section)
Returns the text from the given section. |
void |
setCalendarPopup(boolean enable)
Sets the current calender popup showing mode. |
void |
setCurrentSection(QDateTimeEdit.Section section)
Sets the current section of the spinbox setCurrentSection() to section. |
void |
setCurrentSectionIndex(int index)
Sets the current section index of the spinbox to index. |
void |
setDate(QDate date)
Sets the QDate that is set in the QDateTimeEdit to date. |
void |
setDateRange(QDate min,
QDate max)
Convenience function to set minimum and maximum date with one function call. |
void |
setDateTime(QDateTime dateTime)
Sets the QDateTime that is set in the QDateTimeEdit to dateTime. |
void |
setDisplayFormat(java.lang.String format)
Sets the format used to display the time/date of the date time edit to format. |
void |
setMaximumDate(QDate max)
Sets the maximum date of the date time edit to max. |
void |
setMaximumTime(QTime max)
Sets the maximum time of the date time edit to max. |
void |
setMinimumDate(QDate min)
Sets the minimum date of the date time edit to min. |
void |
setMinimumTime(QTime min)
Sets the minimum time of the date time edit to min. |
void |
setSelectedSection(QDateTimeEdit.Section section)
Selects section. |
void |
setTime(QTime time)
Sets the QTime that is set in the QDateTimeEdit to time. |
void |
setTimeRange(QTime min,
QTime max)
Convenience function to set minimum and maximum time with one function call. |
QSize |
sizeHint()
This function is reimplemented for internal reasons. |
void |
stepBy(int steps)
This function is reimplemented for internal reasons. |
protected QAbstractSpinBox.StepEnabled |
stepEnabled()
This function is reimplemented for internal reasons. |
protected java.lang.String |
textFromDateTime(QDateTime dt)
This virtual function is used by the date time edit whenever it needs to display dt. |
QTime |
time()
Returns the QTime that is set in the QDateTimeEdit. |
QValidator.State |
validate(QValidator.QValidationData input)
Equivalent to validate(input, ). |
protected void |
wheelEvent(QWheelEvent event)
This function is reimplemented for internal reasons. |
Methods inherited from class com.trolltech.qt.gui.QAbstractSpinBox |
---|
alignment, buttonSymbols, changeEvent, closeEvent, contextMenuEvent, correctionMode, focusOutEvent, hasAcceptableInput, hasFrame, hideEvent, initStyleOption, interpretText, isAccelerated, isReadOnly, keyboardTracking, keyReleaseEvent, lineEdit, minimumSizeHint, mouseMoveEvent, mouseReleaseEvent, resizeEvent, selectAll, setAccelerated, setAlignment, setAlignment, setButtonSymbols, setCorrectionMode, setFrame, setKeyboardTracking, setLineEdit, setReadOnly, setSpecialValueText, setWrapping, showEvent, specialValueText, stepDown, stepUp, text, timerEvent, wrapping |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1<QDate> dateChanged
This signal is emitted whenever the date is changed. The new date is passed in date.
public final QSignalEmitter.Signal1<QDateTime> dateTimeChanged
This signal is emitted whenever the date or time is changed. The new date and time is passed in date.
public final QSignalEmitter.Signal1<QTime> timeChanged
This signal is emitted whenever the time is changed. The new time is passed in date.
Constructor Detail |
---|
public QDateTimeEdit(QDateTime dt)
Equivalent to QDateTimeEdit(dt, 0).
public QDateTimeEdit(QDateTime dt, QWidget parent)
Constructs an empty date time editor with a parent. The value is set to dt.
public QDateTimeEdit(QTime t)
Equivalent to QDateTimeEdit(t, 0).
public QDateTimeEdit(QTime t, QWidget parent)
Constructs an empty date time editor with a parent. The value is set to t.
public QDateTimeEdit(QDate d)
Equivalent to QDateTimeEdit(d, 0).
public QDateTimeEdit(QDate d, QWidget parent)
Constructs an empty date time editor with a parent. The value is set to d.
public QDateTimeEdit()
Equivalent to QDateTimeEdit(0).
public QDateTimeEdit(QWidget parent)
Constructs an empty date time editor with a parent.
Method Detail |
---|
public final boolean calendarPopup()
Returns the current calender popup showing mode..
The calendar popup will be shown upon clicking the arrow button. This property is valid only if there is a valid date display format.
public final void clearMaximumDate()
Resets 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.
public final void clearMaximumTime()
Resets 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.
public final void clearMinimumDate()
Resets 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.
public final void clearMinimumTime()
Resets 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.
public final QDateTimeEdit.Section currentSection()
Returns the current section of the spinbox setCurrentSection().
public final int currentSectionIndex()
Returns 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()
public final QDate date()
Returns the QDate that is set in the QDateTimeEdit.
public final QDateTime dateTime()
Returns the QDateTime that is set in the QDateTimeEdit.
public final java.lang.String displayFormat()
Returns 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 |
If you specify an invalid format the format will not be set.
public final QDateTimeEdit.Sections displayedSections()
Returns the currently displayed fields of the date time edit.
Returns a bit set of the displayed sections for this format. setDisplayFormat(), displayFormat
public final QDate maximumDate()
Returns 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.
public final QTime maximumTime()
Returns 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.
public final QDate minimumDate()
Returns 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.
public final QTime minimumTime()
Returns 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.
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,
public final int sectionCount()
Returns the number of sections displayed. If the format is 'yyyy/yy/yyyy', sectionCount returns 3.
public final java.lang.String sectionText(QDateTimeEdit.Section section)
Returns the text from the given section.
### note about not working when not Acceptable
public final void setCalendarPopup(boolean enable)
Sets the current calender popup showing mode. to enable.
The calendar popup will be shown upon clicking the arrow button. This property is valid only if there is a valid date display format.
public final void setCurrentSection(QDateTimeEdit.Section section)
Sets the current section of the spinbox setCurrentSection() to section.
public final void setCurrentSectionIndex(int index)
Sets the current section index of the spinbox to index.
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()
public final void setDate(QDate date)
Sets the QDate that is set in the QDateTimeEdit to date.
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.
public final void setDateTime(QDateTime dateTime)
Sets the QDateTime that is set in the QDateTimeEdit to dateTime.
public final void setDisplayFormat(java.lang.String format)
Sets the format used to display the time/date of the date time edit to format.
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 |
If you specify an invalid format the format will not be set.
public final void setMaximumDate(QDate max)
Sets the maximum date of the date time edit to max.
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.
public final void setMaximumTime(QTime max)
Sets the maximum time of the date time edit to max.
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.
public final void setMinimumDate(QDate min)
Sets the minimum date of the date time edit to min.
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.
public final void setMinimumTime(QTime min)
Sets the minimum time of the date time edit to min.
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.
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.
public final void setTime(QTime time)
Sets the QTime that is set in the QDateTimeEdit to time.
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.
public final QTime time()
Returns the QTime that is set in the QDateTimeEdit.
public void clear()
This function is reimplemented for internal reasons.
clear
in class QAbstractSpinBox
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.
public boolean event(QEvent event)
This function is reimplemented for internal reasons.
event
in class QAbstractSpinBox
public java.lang.String fixup(java.lang.String input)
This function is reimplemented for internal reasons.
fixup
in class QAbstractSpinBox
protected void focusInEvent(QFocusEvent event)
This function is reimplemented for internal reasons.
focusInEvent
in class QAbstractSpinBox
protected boolean focusNextPrevChild(boolean next)
This function is reimplemented for internal reasons.
focusNextPrevChild
in class QWidget
protected void keyPressEvent(QKeyEvent event)
This function is reimplemented for internal reasons.
keyPressEvent
in class QAbstractSpinBox
protected void mousePressEvent(QMouseEvent event)
This function is reimplemented for internal reasons.
mousePressEvent
in class QAbstractSpinBox
Example
protected void paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons.
paintEvent
in class QAbstractSpinBox
public QSize sizeHint()
This function is reimplemented for internal reasons.
sizeHint
in class QAbstractSpinBox
public void stepBy(int steps)
This function is reimplemented for internal reasons.
stepBy
in class QAbstractSpinBox
protected QAbstractSpinBox.StepEnabled stepEnabled()
This function is reimplemented for internal reasons.
stepEnabled
in class QAbstractSpinBox
protected java.lang.String textFromDateTime(QDateTime dt)
This virtual function is used by the date time edit whenever it needs to display dt.
If you reimplement this, you may also need to reimplement valueFromText() and validate.
public QValidator.State validate(QValidator.QValidationData input)
Equivalent to validate(input, ).
validate
in class QAbstractSpinBox
protected void wheelEvent(QWheelEvent event)
This function is reimplemented for internal reasons.
wheelEvent
in class QAbstractSpinBox
public static QDateTimeEdit fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |