HomeHome

ClassesAnnotated - TreeFunctionsHomeStructure

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

Properties

TypeNameREADWRITEOptions
QStringtitletitlesetTitle 
AlignmentalignmentalignmentsetAlignment 
OrientationorientationorientationsetOrientation DESIGNABLE false
intcolumnscolumnssetColumns DESIGNABLE false

Detailed Description

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' child widgets, and the child widgets are arranged in an array inside the frame.

The simplest way to use it is to create a group box with the desired number of columns and orientation, and then just create widgets with the group box as parent.

However, it is also possible to change the orientation() and number of columns() after construction, or to ignore all the automatic layout support and manage all that yourself.

QGroupBox also lets you set the title() (normally set in the constructor) and if you so please, even the title's alignment().

See also QButtonGroup.


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.

This constructor does not do automatic layout.

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.

This constructor does not do automatic layout.

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 titled 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 for internal reasons; the API is not affected.

Reimplemented from QObject.

int QGroupBox::columns () const

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

bool QGroupBox::event ( QEvent * e ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QObject.

void QGroupBox::focusInEvent ( QFocusEvent * ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

void QGroupBox::fontChange ( const QFont & oldFont ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

Orientation QGroupBox::orientation () const

Returns the current orientation of the groupbox.

See also setOrientation().

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

Reimplemented for internal reasons; the API is not affected.

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 one 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 to c. Usually it is no good idea to use the method since it is slow (it does a complete layout). 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 (it does a complete layout). 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" );

QSize QGroupBox::sizeHint () const [virtual]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

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.trolltech.com):


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


Copyright © 2000 TrolltechTrademarks
Qt version 2.2.1