Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QGroupBox

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QWidget
                          com.trolltech.qt.gui.QGroupBox

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public class QGroupBox

extends QWidget

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.

See also:
  `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.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary
`QSignalEmitter.Signal1` | `clicked` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `toggled` This signal takes 1 generic argument(s).

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

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.
`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.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

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 com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

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

### clicked

    public final QSignalEmitter.Signal1 clicked

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Boolean(named: checked)>:

  This signal is emitted when the check box is activated (i. . 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.

See also:
  `checkable`, `toggled()` , and `checked`.

### toggled

    public final QSignalEmitter.Signal1 toggled

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Boolean(named: on)>:

  If the group box is checkable, this signal is emitted when the check box is toggled. `on` is true if the check box is checked; otherwise it is false.

See also:
  `checkable`.

Constructor Detail

### QGroupBox

    public QGroupBox()

  Constructs a group box widget with the given `parent` but with no title.

### QGroupBox

    public QGroupBox(QWidget parent)

  Constructs a group box widget with the given `parent` but with no title.

### QGroupBox

    public QGroupBox(java.lang.String title)

  Constructs a group box with the given `title` and `parent`.

### QGroupBox

    public QGroupBox(java.lang.String title,
                     QWidget parent)

  Constructs a group box with the given `title` and `parent`.

Method Detail

### alignment

    public final Qt.Alignment alignment()

  This property holds 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:
  - `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.
  The default alignment is `Qt::AlignLeft` .

See also:
  Qt::Alignment.

### isCheckable

    public final boolean isCheckable()

  This property holds 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.

See also:
  `checked`.

### isChecked

    public final boolean isChecked()

  This property holds 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.

See also:
  `checkable`.

### isFlat

    public final boolean isFlat()

  This property holds 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.

See also:
  `title`.

### setAlignment

    public final void setAlignment(int alignment)

  This property holds 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:
  - `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.
  The default alignment is `Qt::AlignLeft` .

See also:
  Qt::Alignment.

### setCheckable

    public final void setCheckable(boolean checkable)

  This property holds 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.

See also:
  `checked`.

### setChecked

    public final void setChecked(boolean checked)

  This property holds 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.

See also:
  `checkable`.

### setFlat

    public final void setFlat(boolean flat)

  This property holds 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.

See also:
  `title`.

### setTitle

    public final void setTitle(java.lang.String title)

  This property holds 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.

See also:
  `alignment`.

### title

    public final java.lang.String title()

  This property holds 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.

See also:
  `alignment`.

### initStyleOption

    protected final void initStyleOption(QStyleOptionGroupBox option)

  Initialize `option` with the values from this QGroupBox. This method is useful for subclasses when they need a QStyleOptionGroupBox, but don't want to fill in all the information themselves.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD