Qt Toolkit - QGroupBox Class

# QGroupBox Class Reference

The QGroupBox widget provides a group box frame with a title. More...

`#include <qgroupbox.h>`

Inherits QFrame.

Inherited by QButtonGroup.

List of all member functions.

## Public Members

- QGroupBox ( QWidget * parent=0, const char * name=0 )
- QGroupBox ( const char * title, QWidget * parent=0, const char * name=0 )
- const char* title () const
- void setTitle ( const char * )
- int alignment () const
- void setAlignment ( int )

## Protected Members

- virtual void paintEvent ( QPaintEvent * )

## Detailed Description

The QGroupBox widget provides a group box frame with a title.

The intended use of a group box is to show that a number of widgets (i.e. child widgets) are logically related. QPrintDialog is a good example; each of its three panes is one group box.

By default, the group's setFont() and setPalette() functions do not change the appearance of the widgets it contaisn, but you can use setFontPropagation() and setPalettePropagation() to change that.

Qt also provides a more specialized group box, QButtonGroup, that is very useful for organizing buttons in a group.

Examples: xform/xform.cpp

## Member Function Documentation

### QGroupBox::QGroupBox ( QWidget * parent=0, const char * name=0 )

Constructs a group box widget with no title.

The parent and name arguments are passed to the QWidget constructor.

### QGroupBox::QGroupBox ( const char * title, QWidget * parent=0, const char * name=0 )

Constructs a group box with a title.

The parent and name arguments are passed to the QWidget constructor.

### int QGroupBox::alignment () const

Returns the alignment of the group box title.

The default alignment is `AlignHCenter.`

See also: setAlignment().

### void QGroupBox::paintEvent ( QPaintEvent * event ) `[virtual protected]`

Handles paint events for the group box.

Reimplemented from QWidget.

### void QGroupBox::setAlignment ( int alignment )

Sets the alignment of the group box title.

The title is always placed on the upper frame line, however, the horizontal alignment can be specified by the alignment parameter.

The alignment is the bitwise OR of the following flags:

- `AlignLeft` aligns the title text to the left.
- `AlignRight` aligns the title text to the right.
- `AlignHCenter` aligns the title text centered.

See also: alignment().

### void QGroupBox::setTitle ( const char * title )

Sets the group box title text to title.

Examples: xform/xform.cpp widgets/widgets.cpp

### const char* QGroupBox::title () const

Returns the group box title text.

Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):

This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.

It was generated from the following files:

- qgroupbox.h: 1998/08/21
- qgroupbox.cpp: 1998/07/03