|
|
||||||||||
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 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.
![]() | 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()
Clears the lineedit of all text but prefix and suffix. |
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 is the main event handler; it handles event arg__1. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead. Key press and release events are treated differently from other events. event checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event calls keyPressEvent. Mouse and tablet event handling is also slightly special: only when the widget is enabled, event will call the specialized handlers such as mousePressEvent; otherwise it will discard the event. This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops. |
java.lang.String |
fixup(java.lang.String input)
This virtual function is called by the QAbstractSpinBox if the input is not validated to QValidator::Acceptable when Return is pressed or interpretText is called. |
protected void |
focusInEvent(QFocusEvent event)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. The event is passed in the arg__1 parameter A widget normally must setFocusPolicy to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus on any widget, even those that do not normally accept focus.) The default implementation updates the widget (except for windows that do not specify a focusPolicy). |
protected boolean |
focusNextPrevChild(boolean next)
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't. |
static QDateTimeEdit |
fromNativePointer(QNativePointer nativePointer)
This function returns the QDateTimeEdit instance pointed to by nativePointer |
protected void |
keyPressEvent(QKeyEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive key press events for the widget. A widget must call setFocusPolicy to accept focus initially and have focus in order to receive a key press event. If you reimplement this handler, it is very important that you ignore() the event if you do not understand it, so that the widget's parent can interpret it. The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored. |
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 event handler, for event arg__1, can be reimplemented in a subclass to receive mouse press events for the widget. If you create new widgets in the mousePressEvent the mouseReleaseEvent may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more. The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing. |
protected void |
paintEvent(QPaintEvent event)
This event handler can be reimplemented in a subclass to receive paint events which are passed in the arg__1 parameter. A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint or update, or because the widget was obscured and has now been uncovered, or for many other reasons. Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example. Qt also tries to speed up painting by merging multiple paint events into one. When update is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). repaint does not permit this optimization, so we suggest using update whenever possible. When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background. The background can be set using setBackgroundRole and setPalette. From Qt 4.0, QWidget automatically double-buffers its painting, so there's no need to write double-buffering code in paintEvent to avoid flicker. Note: Under X11 it is possible to toggle the global double buffering by calling qt_x11_set_global_double_buffer(). Example usage: ... extern void qt_x11_set_global_double_buffer(bool); qt_x11_set_global_double_buffer(false); ... Note: In general, one should refrain from calling update or repaint inside of paintEvent. For example, calling update or repaint on children inside a paintEvent results in undefined behavior; the child may or may not get a paint event. |
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()
Returns the recommended size for the widget. If the value of this property is an invalid size, no size is recommended. The default implementation of sizeHint returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise. |
void |
stepBy(int steps)
Virtual function that is called whenever the user triggers a step. |
protected QAbstractSpinBox.StepEnabled |
stepEnabled()
Virtual function that determines whether stepping up and down is legal at any given time. |
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 event handler, for event arg__1, can be reimplemented in a subclass to receive wheel events for the widget. If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it. The default implementation ignores the event. |
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(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(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()
Equivalent to QDateTimeEdit(0).
public QDateTimeEdit(QWidget parent)
Constructs an empty date time editor with a parent.
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.
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()
Clears the lineedit of all text but prefix and suffix.
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 is the main event handler; it handles event arg__1. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
Key press and release events are treated differently from other events. event checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event calls keyPressEvent.
Mouse and tablet event handling is also slightly special: only when the widget is enabled, event will call the specialized handlers such as mousePressEvent; otherwise it will discard the event.
This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops.
event
in class QAbstractSpinBox
public java.lang.String fixup(java.lang.String input)
This virtual function is called by the QAbstractSpinBox if the input is not validated to QValidator::Acceptable when Return is pressed or interpretText is called. It will try to change the text so it is valid. Reimplemented in the various subclasses.
fixup
in class QAbstractSpinBox
protected void focusInEvent(QFocusEvent event)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. The event is passed in the arg__1 parameter
A widget normally must setFocusPolicy to something other than Qt::NoFocus in order to receive focus events. (Note that the application programmer can call setFocus on any widget, even those that do not normally accept focus.)
The default implementation updates the widget (except for windows that do not specify a focusPolicy).
focusInEvent
in class QAbstractSpinBox
protected boolean focusNextPrevChild(boolean next)
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't.
If next is true, this function searches forward, if next is false, it searches backward.
Sometimes, you will want to reimplement this function. For example, a web browser might reimplement it to move its "current active link" forward or backward, and call focusNextPrevChild only when it reaches the last or first link on the "page".
Child widgets call focusNextPrevChild on their parent widgets, but only the window that contains the child widgets decides where to redirect focus. By reimplementing this function for an object, you thus gain control of focus traversal for all child widgets.
focusNextPrevChild
in class QWidget
protected void keyPressEvent(QKeyEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive key press events for the widget.
A widget must call setFocusPolicy to accept focus initially and have focus in order to receive a key press event.
If you reimplement this handler, it is very important that you ignore() the event if you do not understand it, so that the widget's parent can interpret it.
The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored.
keyPressEvent
in class QAbstractSpinBox
protected void mousePressEvent(QMouseEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive mouse press events for the widget.
If you create new widgets in the mousePressEvent the mouseReleaseEvent may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.
The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.
mousePressEvent
in class QAbstractSpinBox
Example
protected void paintEvent(QPaintEvent event)
This event handler can be reimplemented in a subclass to receive paint events which are passed in the arg__1 parameter.
A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint or update, or because the widget was obscured and has now been uncovered, or for many other reasons.
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). repaint does not permit this optimization, so we suggest using update whenever possible.
When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background.
The background can be set using setBackgroundRole and setPalette.
From Qt 4.0, QWidget automatically double-buffers its painting, so there's no need to write double-buffering code in paintEvent to avoid flicker.
Note: Under X11 it is possible to toggle the global double buffering by calling qt_x11_set_global_double_buffer(). Example usage:
... extern void qt_x11_set_global_double_buffer(bool); qt_x11_set_global_double_buffer(false); ...
Note: In general, one should refrain from calling update or repaint inside of paintEvent. For example, calling update or repaint on children inside a paintEvent results in undefined behavior; the child may or may not get a paint event.
paintEvent
in class QAbstractSpinBox
public QSize sizeHint()
Returns the recommended size for the widget.
If the value of this property is an invalid size, no size is recommended.
The default implementation of sizeHint returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise.
sizeHint
in class QAbstractSpinBox
public void stepBy(int steps)
Virtual function that is called whenever the user triggers a step. The steps parameter indicates how many steps were taken, e.g. Pressing Qt::Key_Down will trigger a call to stepBy(-1), whereas pressing Qt::Key_Prior will trigger a call to stepBy(10).
If you subclass QAbstractSpinBox you must reimplement this function. Note that this function is called even if the resulting value will be outside the bounds of minimum and maximum. It's this function's job to handle these situations.
stepBy
in class QAbstractSpinBox
protected QAbstractSpinBox.StepEnabled stepEnabled()
Virtual function that determines whether stepping up and down is legal at any given time.
The up arrow will be painted as disabled unless (stepEnabled & StepUpEnabled) != 0.
The default implementation will return (StepUpEnabled| StepDownEnabled) if wrapping is turned on. Else it will return StepDownEnabled if value is > minimum() or'ed with StepUpEnabled if value < maximum().
If you subclass QAbstractSpinBox you will need to reimplement this function.
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 event handler, for event arg__1, can be reimplemented in a subclass to receive wheel events for the widget.
If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.
The default implementation ignores the event.
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 |