|
|||||||||
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.QAbstractButton
com.trolltech.qt.gui.QCheckBox
public class QCheckBox
The QCheckBox widget provides a checkbox with a text label.
A QCheckBox is an option button that can be switched on (checked) or off (unchecked). Checkboxes are typically used to represent features in an application that can be enabled or disabled without affecting others, but different types of behavior can be implemented.
A QButtonGroup can be used to group check buttons visually.
Whenever a checkbox is checked or cleared it emits the signal stateChanged. Connect to this signal if you want to trigger an action each time the checkbox changes state. You can use isChecked to query whether or not a checkbox is checked.
In addition to the usual checked and unchecked states, QCheckBox optionally provides a third state to indicate "no change". This is useful whenever you need to give the user the option of neither checking nor unchecking a checkbox. If you need this third state, enable it with setTristate, and use checkState to query the current toggle state.
Just like QPushButton, a checkbox displays text, and optionally a small icon. The icon is set with setIcon. The text can be set in the constructor or with setText. A shortcut key can be specified by preceding the preferred character with an ampersand. For example:
QCheckBox *checkbox = new QCheckBox("C&ase sensitive", this);
In this example the shortcut is Alt+A. See the QShortcut documentation for details (to display an actual ampersand, use '&&').
Important inherited functions: text, setText, text, pixmap, setPixmap(), accel(), setAccel(), isToggleButton(), setDown, isDown, isOn(), checkState, autoRepeat, isExclusiveToggle(), group, setAutoRepeat, toggle, pressed, released, clicked, toggled, checkState, and stateChanged.
![]() | A checkbox shown in the Macintosh widget style. |
![]() | A checkbox shown in the Windows XP widget style. |
![]() | A checkbox shown in the Plastique widget style. |
Nested Class Summary |
---|
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<java.lang.Integer> |
stateChanged
This signal is emitted whenever the check box's state changes, i.e. whenever the user checks or unchecks it. |
Fields inherited from class com.trolltech.qt.gui.QAbstractButton |
---|
clicked, pressed, released, toggled |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QCheckBox()
Equivalent to QCheckBox(0). |
|
QCheckBox(QWidget parent)
Constructs a checkbox with the given parent, but with no text. |
|
QCheckBox(java.lang.String text)
Equivalent to QCheckBox(text, 0). |
|
QCheckBox(java.lang.String text,
QWidget parent)
Constructs a checkbox with the given parent and text. |
Method Summary | |
---|---|
Qt.CheckState |
checkState()
Returns the check box's check state. |
protected void |
checkStateSet()
This function is reimplemented for internal reasons. |
boolean |
event(QEvent e)
This function is reimplemented for internal reasons. |
static QCheckBox |
fromNativePointer(QNativePointer nativePointer)
This function returns the QCheckBox instance pointed to by nativePointer |
protected boolean |
hitButton(QPoint pos)
This function is reimplemented for internal reasons. |
protected void |
initStyleOption(QStyleOptionButton option)
Initialize option with the values from this QCheckBox. |
boolean |
isTristate()
Returns whether the checkbox is a tri-state checkbox. |
protected void |
mouseMoveEvent(QMouseEvent arg__1)
This function is reimplemented for internal reasons. |
protected void |
nextCheckState()
This function is reimplemented for internal reasons. |
protected void |
paintEvent(QPaintEvent arg__1)
This function is reimplemented for internal reasons. |
void |
setCheckState(Qt.CheckState state)
Sets the check box's check state to state. |
void |
setTristate()
Equivalent to setTristate(true). |
void |
setTristate(boolean y)
Sets whether the checkbox is a tri-state checkbox to y. |
QSize |
sizeHint()
This function is reimplemented for internal reasons. |
Methods inherited from class com.trolltech.qt.gui.QAbstractButton |
---|
animateClick, animateClick, autoExclusive, autoRepeat, autoRepeatDelay, autoRepeatInterval, changeEvent, click, focusInEvent, focusOutEvent, group, icon, iconSize, isCheckable, isChecked, isDown, keyPressEvent, keyReleaseEvent, mousePressEvent, mouseReleaseEvent, setAutoExclusive, setAutoRepeat, setAutoRepeatDelay, setAutoRepeatInterval, setCheckable, setChecked, setDown, setIcon, setIconSize, setShortcut, setShortcut, setShortcut, setText, shortcut, text, timerEvent, toggle |
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<java.lang.Integer> stateChanged
This signal is emitted whenever the check box's state changes, i.e. whenever the user checks or unchecks it.
arg__1 contains the check box's new ToggleState.
Constructor Detail |
---|
public QCheckBox()
Equivalent to QCheckBox(0).
public QCheckBox(QWidget parent)
Constructs a checkbox with the given parent, but with no text.
The parent argument is passed on to the QAbstractButton constructor.
public QCheckBox(java.lang.String text)
Equivalent to QCheckBox(text, 0).
public QCheckBox(java.lang.String text, QWidget parent)
Constructs a checkbox with the given parent and text.
The parent argument is passed on to the QAbstractButton constructor.
Method Detail |
---|
public final Qt.CheckState checkState()
Returns the check box's check state.
public final boolean isTristate()
Returns whether the checkbox is a tri-state checkbox.
The default is false; i.e. the checkbox has only two states.
public final void setCheckState(Qt.CheckState state)
Sets the check box's check state to state.
public final void setTristate()
Equivalent to setTristate(true).
public final void setTristate(boolean y)
Sets whether the checkbox is a tri-state checkbox to y.
The default is false; i.e. the checkbox has only two states.
protected void checkStateSet()
This function is reimplemented for internal reasons.
checkStateSet
in class QAbstractButton
public boolean event(QEvent e)
This function is reimplemented for internal reasons.
event
in class QAbstractButton
protected boolean hitButton(QPoint pos)
This function is reimplemented for internal reasons.
hitButton
in class QAbstractButton
protected void mouseMoveEvent(QMouseEvent arg__1)
This function is reimplemented for internal reasons.
mouseMoveEvent
in class QAbstractButton
Example
protected void nextCheckState()
This function is reimplemented for internal reasons.
nextCheckState
in class QAbstractButton
protected void paintEvent(QPaintEvent arg__1)
This function is reimplemented for internal reasons.
paintEvent
in class QAbstractButton
public QSize sizeHint()
This function is reimplemented for internal reasons.
sizeHint
in class QWidget
public static QCheckBox fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected final void initStyleOption(QStyleOptionButton option)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |