|
|
||||||||||
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.QGroupBox
public class QGroupBox
The QGroupBox widget provides a group box frame with a title.
A group box provides a frame, a title and a keyboard shortcut, and displays various other widgets inside itself. The title is on top, the keyboard shortcut moves keyboard focus to one of the group box's child widgets.
QGroupBox also lets you set the title (normally set in the constructor) and the title's alignment. Group boxes can be checkable; child widgets in checkable group boxes are enabled or disabled depending on whether or not the group box is checked.
You can minimize the space consumption of a group box by enabling the flat property. In most styles, enabling this property results in the removal of the left, right and bottom edges of the frame.
QGroupBox doesn't automatically lay out the child widgets (which are often QCheckBoxes or QRadioButtons but can be any widgets). The following example shows how we can set up a QGroupBox with a layout:
QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons")); QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1")); QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2")); QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3")); radio1->setChecked(true); QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget(radio1); vbox->addWidget(radio2); vbox->addWidget(radio3); vbox->addStretch(1); groupBox->setLayout(vbox);
![]() | ![]() | ![]() |
A Windows XP style group box. | A Macintosh style group box. | A Plastique style group box. |
Box Example
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.AbstractSignal, 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.Boolean> |
clicked
This signal is emitted when the check box is activated (i.e. pressed down then released while the mouse cursor is inside the button), or when the shortcut key is typed, Notably, this signal is not emitted if you call setChecked. |
QSignalEmitter.Signal1<java.lang.Boolean> |
toggled
If the group box is checkable, this signal is emitted when the check box is toggled. |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QGroupBox()
Equivalent to QGroupBox(0). |
|
QGroupBox(QWidget parent)
Constructs a group box widget with the given parent but with no title. |
|
QGroupBox(java.lang.String title)
Equivalent to QGroupBox(title, 0). |
|
QGroupBox(java.lang.String title,
QWidget parent)
Constructs a group box with the given title and parent. |
Method Summary | |
---|---|
Qt.Alignment |
alignment()
Returns the alignment of the group box title.. |
protected void |
changeEvent(QEvent event)
This function is reimplemented for internal reasons. |
protected void |
childEvent(QChildEvent event)
This function is reimplemented for internal reasons. |
boolean |
event(QEvent event)
This function is reimplemented for internal reasons. |
protected void |
focusInEvent(QFocusEvent event)
This function is reimplemented for internal reasons. |
static QGroupBox |
fromNativePointer(QNativePointer nativePointer)
This function returns the QGroupBox instance pointed to by nativePointer |
protected void |
initStyleOption(QStyleOptionGroupBox option)
Initialize option with the values from this QGroupBox. |
boolean |
isCheckable()
Returns whether the group box has a checkbox in its title. |
boolean |
isChecked()
Returns whether the group box is checked. |
boolean |
isFlat()
Returns whether the group box is painted flat or has a frame. |
QSize |
minimumSizeHint()
This function is reimplemented for internal reasons. |
protected void |
mouseMoveEvent(QMouseEvent event)
This function is reimplemented for internal reasons. |
protected void |
mousePressEvent(QMouseEvent event)
This function is reimplemented for internal reasons. |
protected void |
mouseReleaseEvent(QMouseEvent event)
This function is reimplemented for internal reasons. |
protected void |
paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons. |
protected void |
resizeEvent(QResizeEvent event)
This function is reimplemented for internal reasons. |
void |
setAlignment(int alignment)
Sets the alignment of the group box title. to alignment. |
void |
setCheckable(boolean checkable)
Sets whether the group box has a checkbox in its title to checkable. |
void |
setChecked(boolean checked)
Sets whether the group box is checked to checked. |
void |
setFlat(boolean flat)
Sets whether the group box is painted flat or has a frame to flat. |
void |
setTitle(java.lang.String title)
Sets the group box title text to title. |
java.lang.String |
title()
Returns the group box title text. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, 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, timerEvent |
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.Boolean> clicked
This signal is emitted when the check box is activated (i.e. pressed down then released while the mouse cursor is inside the button), or when the shortcut key is typed, Notably, this signal is not emitted if you call setChecked.
If the check box is checked checked is true; it is false if the check box is unchecked.
public final QSignalEmitter.Signal1<java.lang.Boolean> toggled
If the group box is checkable, this signal is emitted when the check box is toggled. arg__1 is true if the check box is checked; otherwise it is false.
Constructor Detail |
---|
public QGroupBox()
Equivalent to QGroupBox(0).
public QGroupBox(QWidget parent)
Constructs a group box widget with the given parent but with no title.
public QGroupBox(java.lang.String title)
Equivalent to QGroupBox(title, 0).
public QGroupBox(java.lang.String title, QWidget parent)
Constructs a group box with the given title and parent.
Method Detail |
---|
public final Qt.Alignment alignment()
Returns the alignment of the group box title..
Most styles place the title at the top of the frame. The horizontal alignment of the title can be specified using single values from the following list:
The default alignment is Qt::AlignLeft.
Qt::Alignment
public final boolean isCheckable()
Returns whether the group box has a checkbox in its title.
If this property is true, the group box displays its title using a checkbox in place of an ordinary label. If the checkbox is checked, the group box's children are enabled; otherwise they are disabled and inaccessible.
By default, group boxes are not checkable.
If this property is enabled for a group box, it will also be initially checked to ensure that its contents are enabled.
checked
public final boolean isChecked()
Returns whether the group box is checked.
If the group box is checkable, it is displayed with a check box. If the check box is checked, the group box's children are enabled; otherwise the children are disabled and are inaccessible to the user.
By default, checkable group boxes are also checked.
checkable
public final boolean isFlat()
Returns whether the group box is painted flat or has a frame.
A group box usually consists of a surrounding frame with a title at the top. If this property is enabled, only the top part of the frame is drawn in most styles; otherwise the whole frame is drawn.
By default, this property is disabled; i.e. group boxes are not flat unless explicitly specified.
Note: In some styles, flat and non-flat group boxes have similar representations and may not be as distinguishable as they are in other styles.
public final void setAlignment(int alignment)
Sets the alignment of the group box title. to alignment.
Most styles place the title at the top of the frame. The horizontal alignment of the title can be specified using single values from the following list:
The default alignment is Qt::AlignLeft.
Qt::Alignment
public final void setCheckable(boolean checkable)
Sets whether the group box has a checkbox in its title to checkable.
If this property is true, the group box displays its title using a checkbox in place of an ordinary label. If the checkbox is checked, the group box's children are enabled; otherwise they are disabled and inaccessible.
By default, group boxes are not checkable.
If this property is enabled for a group box, it will also be initially checked to ensure that its contents are enabled.
checked
public final void setChecked(boolean checked)
Sets whether the group box is checked to checked.
If the group box is checkable, it is displayed with a check box. If the check box is checked, the group box's children are enabled; otherwise the children are disabled and are inaccessible to the user.
By default, checkable group boxes are also checked.
checkable
public final void setFlat(boolean flat)
Sets whether the group box is painted flat or has a frame to flat.
A group box usually consists of a surrounding frame with a title at the top. If this property is enabled, only the top part of the frame is drawn in most styles; otherwise the whole frame is drawn.
By default, this property is disabled; i.e. group boxes are not flat unless explicitly specified.
Note: In some styles, flat and non-flat group boxes have similar representations and may not be as distinguishable as they are in other styles.
public final void setTitle(java.lang.String title)
Sets the group box title text to title.
The group box title text will have a keyboard shortcut if the title contains an ampersand ('&') followed by a letter.
g->setTitle("&User information");
In the example above, Alt+U moves the keyboard focus to the group box. See the QShortcut documentation for details (to display an actual ampersand, use '&&').
There is no default title text.
public final java.lang.String title()
Returns the group box title text.
The group box title text will have a keyboard shortcut if the title contains an ampersand ('&') followed by a letter.
g->setTitle("&User information");
In the example above, Alt+U moves the keyboard focus to the group box. See the QShortcut documentation for details (to display an actual ampersand, use '&&').
There is no default title text.
protected void changeEvent(QEvent event)
This function is reimplemented for internal reasons.
changeEvent
in class QWidget
protected void childEvent(QChildEvent event)
This function is reimplemented for internal reasons.
childEvent
in class QObject
public boolean event(QEvent event)
This function is reimplemented for internal reasons.
event
in class QWidget
protected void focusInEvent(QFocusEvent event)
This function is reimplemented for internal reasons.
focusInEvent
in class QWidget
public QSize minimumSizeHint()
This function is reimplemented for internal reasons.
minimumSizeHint
in class QWidget
protected void mouseMoveEvent(QMouseEvent event)
This function is reimplemented for internal reasons.
mouseMoveEvent
in class QWidget
Example
protected void mousePressEvent(QMouseEvent event)
This function is reimplemented for internal reasons.
mousePressEvent
in class QWidget
Example
protected void mouseReleaseEvent(QMouseEvent event)
This function is reimplemented for internal reasons.
mouseReleaseEvent
in class QWidget
Example
protected void paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons.
paintEvent
in class QWidget
protected void resizeEvent(QResizeEvent event)
This function is reimplemented for internal reasons.
resizeEvent
in class QWidget
Example
public static QGroupBox fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected final void initStyleOption(QStyleOptionGroupBox option)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |