|
|||||||||
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 QCheckBox
es or QRadioButton
s but can be any widgets). The following example shows how we can set up a QGroupBox
with a layout:
The following code example is written in c++.
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. |
QButtonGroup
, and Group 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.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Field Summary | |
---|---|
QSignalEmitter.Signal1 |
clicked
This signal is emitted when the check box is activated (i.e. |
QSignalEmitter.Signal1 |
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()
Constructs a group box widget with the given parent but with no title. |
|
QGroupBox(QWidget parent)
Constructs a group box widget with the given parent but with no title. |
|
QGroupBox(java.lang.String title)
Constructs a group box with the given title and parent. |
|
QGroupBox(java.lang.String title,
QWidget parent)
Constructs a group box with the given title and parent. |
Method Summary | |
---|---|
Qt.Alignment |
alignment()
This property holds the alignment of the group box title. |
static QGroupBox |
fromNativePointer(QNativePointer nativePointer)
|
protected void |
initStyleOption(QStyleOptionGroupBox option)
Initialize option with the values from this QGroupBox. |
boolean |
isCheckable()
This property holds whether the group box has a checkbox in its title. |
boolean |
isChecked()
This property holds whether the group box is checked. |
boolean |
isFlat()
This property holds whether the group box is painted flat or has a frame. |
void |
setAlignment(int alignment)
This property holds the alignment of the group box title. |
void |
setCheckable(boolean checkable)
This property holds whether the group box has a checkbox in its title. |
void |
setChecked(boolean checked)
This property holds whether the group box is checked. |
void |
setFlat(boolean flat)
This property holds whether the group box is painted flat or has a frame. |
void |
setTitle(java.lang.String title)
This property holds the group box title text. |
java.lang.String |
title()
This property holds the group box title text. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1 clicked
setChecked()
. If the check box is checked checked is true; it is false if the check box is unchecked.
checkable
, toggled()
, and checked
.
public final QSignalEmitter.Signal1 toggled
checkable
.
Constructor Detail |
---|
public QGroupBox()
public QGroupBox(QWidget parent)
public QGroupBox(java.lang.String title)
public QGroupBox(java.lang.String title, QWidget parent)
Method Detail |
---|
public final Qt.Alignment alignment()
Qt::AlignLeft
aligns the title text with the left-hand side of the group box.Qt::AlignRight
aligns the title text with the right-hand side of the group box.Qt::AlignHCenter
aligns the title text with the horizontal center of the group box.Qt::AlignLeft
.
public final boolean isCheckable()
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()
By default, checkable group boxes are also checked.
checkable
.
public final boolean isFlat()
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.
title
.
public final void setAlignment(int alignment)
Qt::AlignLeft
aligns the title text with the left-hand side of the group box.Qt::AlignRight
aligns the title text with the right-hand side of the group box.Qt::AlignHCenter
aligns the title text with the horizontal center of the group box.Qt::AlignLeft
.
public final void setCheckable(boolean checkable)
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)
By default, checkable group boxes are also checked.
checkable
.
public final void setFlat(boolean flat)
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.
title
.
public final void setTitle(java.lang.String title)
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.
alignment
.
public final java.lang.String title()
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.
alignment
.
public static QGroupBox fromNativePointer(QNativePointer nativePointer)
protected final void initStyleOption(QStyleOptionGroupBox option)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |