Qt logo

QGroupBox Class Reference


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

#include <qgroupbox.h>

Inherits QFrame.

Inherited by QButtonGroup, QHGroupBox and QVGroupBox.

List of all member functions.

Public Members

Protected Members

Properties

TypeNameREADWRITEOptions
QStringtitletitlesetTitle
AlignmentalignmentalignmentsetAlignment
OrientationorientationorientationsetOrientation
intcolumnscolumnssetColumns

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.

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


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 QString & 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.

QGroupBox::QGroupBox ( int strips, Orientation orientation, QWidget * parent=0, const char * name=0 )

Constructs a group box with no title. Child widgets will be arranged in strips rows or columns (depending on orientation).

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

QGroupBox::QGroupBox ( int strips, Orientation orientation, const QString & title, QWidget * parent=0, const char * name=0 )

Constructs a group box with a title. Child widgets will be arranged in strips rows or columns (depending on orientation).

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

void QGroupBox::addSpace ( int size )

Adds an empty cell at the next free position. If size is greater than 0 then the empty cell has a fixed height or width. If the groupbox is oriented horizontally then the empty cell has a fixed height and if oriented vertically it has a fixed width.

Use this method to separate the widgets in the groupbox or to skip the next free cell. For performance reasons call this method after calling setColumnLayout(), setColumns() or setOrientation(). It is in general a good idea to call these methods first (if needed at all) and insert the widgets and spaces afterwards.

int QGroupBox::alignment () const

Returns the alignment of the group box title.

The default alignment is AlignLeft.

See also: setAlignment() and Qt::AlignmentFlags.

void QGroupBox::childEvent ( QChildEvent * c ) [virtual protected]

Reimplemented to layout new children as they are inserted.

Reimplemented from QObject.

int QGroupBox::columns () const

Returns the numbers of columns in the groupbox as passed to the constructor, setColumns() or setColumnLayout().

Orientation QGroupBox::orientation () const

Returns the current orientation of the groupbox.

See also: setOrientation().

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

Handles paint events for the group box.

Reimplemented from QWidget.

void QGroupBox::resizeEvent ( QResizeEvent * e ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

void QGroupBox::setAlignment ( int alignment ) [virtual]

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:

See also: alignment() and Qt::AlignmentFlags.

void QGroupBox::setColumnLayout ( int columns, Orientation direction ) [virtual]

Changes the layout of the group box. This function is only useful in combination with the default constructor that does not take any layout information. This function will put all existing children in the new layout. Nevertheless is is not good programming style to call this function after children have been inserted.

See also: setOrientation() and setColumns().

void QGroupBox::setColumns ( int c )

Changes the numbers of columns.Usually it is no good idea to use the method since it is slow. Better set the numbers of columns directly in the constructor.

See also: column() and setColumnLayout().

void QGroupBox::setOrientation ( Qt::Orientation o )

Changes the orientation of the groupbox. Usually it is no good idea to use the method since it is slow. Better set the orientation directly in the constructor.

See also: orientation().

void QGroupBox::setTitle ( const QString & title ) [virtual]

Sets the group box title text to title, and add a focus-change accelerator if the title contains & followed by an appropriate letter. This produces "User information" with the U underscored and Alt-U moves the keyboard focus into the group.

    g->setTitle( "&User information" );

QString QGroupBox::title () const

Returns the group box title text.

void QGroupBox::updateMask () [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.


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


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


Copyright © 2000 Troll TechTrademarks
Qt version 2.1.0-beta1