|
|
||||||||||
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
public class QAbstractSpinBox
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
The class is designed as a common super class for widgets like QSpinBox, QDoubleSpinBox and QDateTimeEdit
Here are the main properties of the class:
QAbstractSpinBox provides a virtual stepBy function that is called whenever the user triggers a step. This function takes an integer value to signify how many steps were taken. E.g. Pressing Qt::Key_Down will trigger a call to stepBy(-1).
QAbstractSpinBox also provide a virtual function stepEnabled to determine whether stepping up/down is allowed at any point. This function returns a bitset of StepEnabled.
Nested Class Summary | |
---|---|
static class |
QAbstractSpinBox.ButtonSymbols
This enum type describes the symbols that can be displayed on the buttons in a spin box. |
static class |
QAbstractSpinBox.CorrectionMode
This enum type describes the mode the spinbox will use to correct an Intermediate value if editing finishes. |
static class |
QAbstractSpinBox.StepEnabled
This QFlag class provides flags for the int enum. |
static class |
QAbstractSpinBox.StepEnabledFlag
Press link for info on 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.Signal0 |
editingFinished
This signal is emitted editing is finished. |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QAbstractSpinBox()
Equivalent to QAbstractSpinBox(0). |
|
QAbstractSpinBox(QWidget parent)
Constructs an abstract spinbox with the given parent with default wrapping, and alignment properties. |
Method Summary | |
---|---|
Qt.Alignment |
alignment()
Returns the alignment of the spin box. |
QAbstractSpinBox.ButtonSymbols |
buttonSymbols()
Returns the current button symbol mode. |
protected void |
changeEvent(QEvent event)
This event handler can be reimplemented to handle state changes. |
void |
clear()
Clears the lineedit of all text but prefix and suffix. |
protected void |
closeEvent(QCloseEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive widget close events. |
protected void |
contextMenuEvent(QContextMenuEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive widget context menu events. |
QAbstractSpinBox.CorrectionMode |
correctionMode()
Returns the mode to correct an Intermediate value if editing finishes. |
boolean |
event(QEvent event)
This is the main event handler; it handles event arg__1. |
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. |
protected void |
focusOutEvent(QFocusEvent event)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. |
static QAbstractSpinBox |
fromNativePointer(QNativePointer nativePointer)
This function returns the QAbstractSpinBox instance pointed to by nativePointer |
boolean |
hasAcceptableInput()
Returns whether the input satisfies the current validation. |
boolean |
hasFrame()
Returns whether the spin box draws itself with a frame. |
protected void |
hideEvent(QHideEvent event)
This event handler can be reimplemented in a subclass to receive widget hide events. |
protected void |
initStyleOption(QStyleOptionSpinBox option)
Initialize option with the values from this QSpinBox. |
void |
interpretText()
This function interprets the text of the spin box. |
boolean |
isAccelerated()
Returns whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons.. |
boolean |
isReadOnly()
Returns whether the spin box is read only.. |
boolean |
keyboardTracking()
Returns whether keyboard tracking is enabled for the spinbox.. |
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. |
protected void |
keyReleaseEvent(QKeyEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive key release events for the widget. |
protected QLineEdit |
lineEdit()
This function returns a pointer to the line edit of the spin box. |
QSize |
minimumSizeHint()
Returns the recommended minimum size for the widget. |
protected void |
mouseMoveEvent(QMouseEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive mouse move events for the widget. |
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. |
protected void |
mouseReleaseEvent(QMouseEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive mouse release events for the widget. |
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. |
protected void |
resizeEvent(QResizeEvent event)
This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the arg__1 parameter. |
void |
selectAll()
Selects all the text in the spinbox except the prefix and suffix. |
void |
setAccelerated(boolean on)
Sets whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons. |
void |
setAlignment(Qt.Alignment flag)
Sets the alignment of the spin box to flag. |
void |
setAlignment(Qt.AlignmentFlag... flag)
Sets the alignment of the spin box to flag. |
void |
setButtonSymbols(QAbstractSpinBox.ButtonSymbols bs)
Sets the current button symbol mode to bs. |
void |
setCorrectionMode(QAbstractSpinBox.CorrectionMode cm)
Sets the mode to correct an Intermediate value if editing finishes to cm. |
void |
setFrame(boolean arg__1)
Sets whether the spin box draws itself with a frame to arg__1. |
void |
setKeyboardTracking(boolean kt)
Sets whether keyboard tracking is enabled for the spinbox. |
protected void |
setLineEdit(QLineEdit edit)
Sets the line edit of the spinbox to be edit instead of the current line edit widget. |
void |
setReadOnly(boolean r)
Sets whether the spin box is read only. |
void |
setSpecialValueText(java.lang.String txt)
Sets the special-value text to txt. |
void |
setWrapping(boolean w)
Sets whether the spin box is circular. |
protected void |
showEvent(QShowEvent event)
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the arg__1 parameter. |
QSize |
sizeHint()
Returns the recommended size for the widget. |
java.lang.String |
specialValueText()
Returns the special-value text. |
void |
stepBy(int steps)
Virtual function that is called whenever the user triggers a step. |
void |
stepDown()
Steps down by one linestep Calling this slot is analogous to calling stepBy(-1); |
protected QAbstractSpinBox.StepEnabled |
stepEnabled()
Virtual function that determines whether stepping up and down is legal at any given time. |
void |
stepUp()
Steps up by one linestep Calling this slot is analogous to calling stepBy(1); |
java.lang.String |
text()
Returns the spin box's text, including any prefix and suffix. |
protected void |
timerEvent(QTimerEvent event)
This event handler can be reimplemented in a subclass to receive timer events for the object. |
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. |
boolean |
wrapping()
Returns whether the spin box is circular.. |
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.Signal0 editingFinished
This signal is emitted editing is finished. This happens when the spinbox loses focus and when enter is pressed.
Constructor Detail |
---|
public QAbstractSpinBox()
Equivalent to QAbstractSpinBox(0).
public QAbstractSpinBox(QWidget parent)
Constructs an abstract spinbox with the given parent with default wrapping, and alignment properties.
Method Detail |
---|
public final Qt.Alignment alignment()
Returns the alignment of the spin box.
Possible Values are Qt::AlignLeft, Qt::AlignRight, and Qt::AlignHCenter.
By default, the alignment is Qt::AlignLeft
Attempting to set the alignment to an illegal flag combination does nothing.
Qt::Alignment
public final QAbstractSpinBox.ButtonSymbols buttonSymbols()
Returns the current button symbol mode.
The possible values can be either UpDownArrows or PlusMinus. The default is UpDownArrows.
Note that some styles might render PlusMinus and UpDownArrows identically.
public final QAbstractSpinBox.CorrectionMode correctionMode()
Returns the mode to correct an Intermediate value if editing finishes.
The default mode is QAbstractSpinBox::CorrectToPreviousValue.
public final boolean hasAcceptableInput()
Returns whether the input satisfies the current validation.
public final boolean hasFrame()
Returns whether the spin box draws itself with a frame.
If enabled (the default) the spin box draws itself inside a frame, otherwise the spin box draws itself without any frame.
public final void interpretText()
This function interprets the text of the spin box. If the value has changed since last interpretation it will emit signals.
public final boolean isAccelerated()
Returns whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons..
If enabled the spin box will increase/decrease the value faster the longer you hold the button down.
public final boolean isReadOnly()
Returns whether the spin box is read only..
In read-only mode, the user can still copy the text to the clipboard, or drag and drop the text; but cannot edit it.
The QLineEdit in the QAbstractSpinBox does not show a cursor in read-only mode.
public final boolean keyboardTracking()
Returns whether keyboard tracking is enabled for the spinbox..
If keyboard tracking is enabled (the default), the spinbox emits the valueChanged() signal while the new value is being entered from the keyboard.
E.g. when the user enters the value 600 by typing 6, 0, and 0, the spinbox emits 3 signals with the values 6, 60, and 600 respectively.
If keyboard tracking is disabled, the spinbox doesn't emit the valueChanged() signal while typing. It emits the signal later, when the return key is pressed, when keyboard focus is lost, or when other spinbox functionality is used, e.g. pressing an arrow key.
protected final QLineEdit lineEdit()
This function returns a pointer to the line edit of the spin box.
public final void selectAll()
Selects all the text in the spinbox except the prefix and suffix.
public final void setAccelerated(boolean on)
Sets whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons. to on.
If enabled the spin box will increase/decrease the value faster the longer you hold the button down.
public final void setAlignment(Qt.AlignmentFlag... flag)
Sets the alignment of the spin box to flag.
Possible Values are Qt::AlignLeft, Qt::AlignRight, and Qt::AlignHCenter.
By default, the alignment is Qt::AlignLeft
Attempting to set the alignment to an illegal flag combination does nothing.
Qt::Alignment
public final void setAlignment(Qt.Alignment flag)
Sets the alignment of the spin box to flag.
Possible Values are Qt::AlignLeft, Qt::AlignRight, and Qt::AlignHCenter.
By default, the alignment is Qt::AlignLeft
Attempting to set the alignment to an illegal flag combination does nothing.
Qt::Alignment
public final void setButtonSymbols(QAbstractSpinBox.ButtonSymbols bs)
Sets the current button symbol mode to bs.
The possible values can be either UpDownArrows or PlusMinus. The default is UpDownArrows.
Note that some styles might render PlusMinus and UpDownArrows identically.
public final void setCorrectionMode(QAbstractSpinBox.CorrectionMode cm)
Sets the mode to correct an Intermediate value if editing finishes to cm.
The default mode is QAbstractSpinBox::CorrectToPreviousValue.
public final void setFrame(boolean arg__1)
Sets whether the spin box draws itself with a frame to arg__1.
If enabled (the default) the spin box draws itself inside a frame, otherwise the spin box draws itself without any frame.
public final void setKeyboardTracking(boolean kt)
Sets whether keyboard tracking is enabled for the spinbox. to kt.
If keyboard tracking is enabled (the default), the spinbox emits the valueChanged() signal while the new value is being entered from the keyboard.
E.g. when the user enters the value 600 by typing 6, 0, and 0, the spinbox emits 3 signals with the values 6, 60, and 600 respectively.
If keyboard tracking is disabled, the spinbox doesn't emit the valueChanged() signal while typing. It emits the signal later, when the return key is pressed, when keyboard focus is lost, or when other spinbox functionality is used, e.g. pressing an arrow key.
protected final void setLineEdit(QLineEdit edit)
Sets the line edit of the spinbox to be edit instead of the current line edit widget. edit can not be 0.
QAbstractSpinBox takes ownership of the new lineEdit
If QLineEdit::validator() for the edit returns 0, the internal validator of the spinbox will be set on the line edit.
public final void setReadOnly(boolean r)
Sets whether the spin box is read only. to r.
In read-only mode, the user can still copy the text to the clipboard, or drag and drop the text; but cannot edit it.
The QLineEdit in the QAbstractSpinBox does not show a cursor in read-only mode.
public final void setSpecialValueText(java.lang.String txt)
Sets the special-value text to txt.
If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minimum(). Typical use is to indicate that this choice has a special (default) meaning.
For example, if your spin box allows the user to choose a scale factor (or zoom level) for displaying an image, and your application is able to automatically choose one that will enable the image to fit completely within the display window, you can set up the spin box like this:
QSpinBox *zoomSpinBox = new QSpinBox; zoomSpinBox->setRange(0, 1000); zoomSpinBox->setSingleStep(10); zoomSpinBox->setSuffix("%"); zoomSpinBox->setSpecialValueText(tr("Automatic")); zoomSpinBox->setValue(100);
The user will then be able to choose a scale from 1% to 1000% or select "Auto" to leave it up to the application to choose. Your code must then interpret the spin box value of 0 as a request from the user to scale the image to fit inside the window.
All values are displayed with the prefix and suffix (if set), except for the special value, which only shows the special value text. This special text is passed in the QSpinBox::valueChanged() signal that passes a QString.
To turn off the special-value text display, call this function with an empty string. The default is no special-value text, i.e. the numeric value is shown as usual.
If no special-value text is set, specialValueText returns an empty string.
public final void setWrapping(boolean w)
Sets whether the spin box is circular. to w.
If wrapping is true stepping up from maximum() value will take you to the minimum() value and vica versa. Wrapping only make sense if you have minimum() and maximum() values set.
QSpinBox *spinBox = new QSpinBox(this);
spinBox->setRange(0, 100);
spinBox->setWrapping(true);
spinBox->setValue(100);
spinBox->stepBy(1);
// value is 0
public final java.lang.String specialValueText()
Returns the special-value text.
If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minimum(). Typical use is to indicate that this choice has a special (default) meaning.
For example, if your spin box allows the user to choose a scale factor (or zoom level) for displaying an image, and your application is able to automatically choose one that will enable the image to fit completely within the display window, you can set up the spin box like this:
QSpinBox *zoomSpinBox = new QSpinBox; zoomSpinBox->setRange(0, 1000); zoomSpinBox->setSingleStep(10); zoomSpinBox->setSuffix("%"); zoomSpinBox->setSpecialValueText(tr("Automatic")); zoomSpinBox->setValue(100);
The user will then be able to choose a scale from 1% to 1000% or select "Auto" to leave it up to the application to choose. Your code must then interpret the spin box value of 0 as a request from the user to scale the image to fit inside the window.
All values are displayed with the prefix and suffix (if set), except for the special value, which only shows the special value text. This special text is passed in the QSpinBox::valueChanged() signal that passes a QString.
To turn off the special-value text display, call this function with an empty string. The default is no special-value text, i.e. the numeric value is shown as usual.
If no special-value text is set, specialValueText returns an empty string.
public final void stepDown()
Steps down by one linestep Calling this slot is analogous to calling stepBy(-1);
public final void stepUp()
Steps up by one linestep Calling this slot is analogous to calling stepBy(1);
public final java.lang.String text()
Returns the spin box's text, including any prefix and suffix.
There is no default text.
public final boolean wrapping()
Returns whether the spin box is circular..
If wrapping is true stepping up from maximum() value will take you to the minimum() value and vica versa. Wrapping only make sense if you have minimum() and maximum() values set.
QSpinBox *spinBox = new QSpinBox(this);
spinBox->setRange(0, 100);
spinBox->setWrapping(true);
spinBox->setValue(100);
spinBox->stepBy(1);
// value is 0
protected void changeEvent(QEvent event)
This event handler can be reimplemented to handle state changes.
The state being changed in this event can be retrieved through event arg__1.
Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, QEvent::StyleChange, QEvent::PaletteChange, QEvent::WindowTitleChange, QEvent::IconTextChange, QEvent::ModifiedChange, QEvent::MouseTrackingChange, QEvent::ParentChange, QEvent::WindowStateChange, QEvent::LanguageChange, QEvent::LocaleChange, QEvent::LayoutDirectionChange.
changeEvent
in class QWidget
public void clear()
Clears the lineedit of all text but prefix and suffix.
protected void closeEvent(QCloseEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive widget close events.
closeEvent
in class QWidget
protected void contextMenuEvent(QContextMenuEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive widget context menu events.
The handler is called when the widget's contextMenuPolicy is Qt::DefaultContextMenu.
The default implementation ignores the context event. See the QContextMenuEvent documentation for more details.
contextMenuEvent
in class QWidget
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 QWidget
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.
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 QWidget
protected void focusOutEvent(QFocusEvent event)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. The events 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).
focusOutEvent
in class QWidget
protected void hideEvent(QHideEvent event)
This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the arg__1 parameter.
Hide events are sent to widgets immediately after they have been hidden.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible.
hideEvent
in class QWidget
visible
,
event,
QHideEventprotected 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 QWidget
protected void keyReleaseEvent(QKeyEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive key release events for the widget.
A widget must accept focus initially and have focus in order to receive a key release event.
If you reimplement this handler, it is very important that you ignore() the release if you do not understand it, so that the widget's parent can interpret it.
The default implementation ignores the event.
keyReleaseEvent
in class QWidget
public QSize minimumSizeHint()
Returns the recommended minimum size for the widget.
If the value of this property is an invalid size, no minimum size is recommended.
The default implementation of minimumSizeHint returns an invalid size if there is no layout for this widget, and returns the layout's minimum size otherwise. Most built-in widgets reimplement minimumSizeHint.
QLayout will never resize a widget to a size smaller than the minimum size hint unless minimumSize is set or the size policy is set to QSizePolicy::Ignore. If minimumSize is set, the minimum size hint will be ignored.
minimumSizeHint
in class QWidget
protected void mouseMoveEvent(QMouseEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive mouse move events for the widget.
If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.
mouseMoveEvent
in class QWidget
Example
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 QWidget
Example
protected void mouseReleaseEvent(QMouseEvent event)
This event handler, for event arg__1, can be reimplemented in a subclass to receive mouse release events for the widget.
mouseReleaseEvent
in class QWidget
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 QWidget
protected void resizeEvent(QResizeEvent event)
This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the arg__1 parameter. When resizeEvent is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
resizeEvent
in class QWidget
Example
protected void showEvent(QShowEvent event)
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the arg__1 parameter.
Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of windows are delivered afterwards.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible.
showEvent
in class QWidget
visible
,
event,
QShowEventpublic 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 QWidget
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.
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.
protected void timerEvent(QTimerEvent event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the arg__1 parameter.
timerEvent
in class QObject
public 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.
wheelEvent
in class QWidget
public static QAbstractSpinBox fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected void initStyleOption(QStyleOptionSpinBox option)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |