Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQGroupBox Class Reference

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

#include <ntqgroupbox.h>

Inherits TQFrame.

Inherited by TQButtonGroup, TQHGroupBox, and TQVGroupBox.

List of all member functions.

Public Members

Public Slots

Signals

Properties


Detailed Description

The TQGroupBox 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, and the child widgets are usually laid out horizontally (or vertically) inside the frame.

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

It is also possible to change the orientation() and number of columns() after construction, or to ignore all the automatic layout support and manage the layout yourself. You can add 'empty' spaces to the group box with addSpace().

TQGroupBox also lets you set the title() (normally set in the constructor) and the title's alignment().

You can change the spacing used by the group box with setInsideMargin() and setInsideSpacing(). To minimize space consumption, you can remove the right, left and bottom edges of the frame with setFlat().

See also TQButtonGroup, Widget Appearance and Style, Layout Management, and Organizers.


Member Function Documentation

TQGroupBox::TQGroupBox ( TQWidget * parent = 0, const char * name = 0 )

Constructs a group box widget with no title.

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

This constructor does not do automatic layout.

TQGroupBox::TQGroupBox ( const TQString & title, TQWidget * parent = 0, const char * name = 0 )

Constructs a group box with the title title.

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

This constructor does not do automatic layout.

TQGroupBox::TQGroupBox ( int strips, Orientation orientation, TQWidget * 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 TQWidget constructor.

TQGroupBox::TQGroupBox ( int strips, Orientation orientation, const TQString & title, TQWidget * 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 TQWidget constructor.

TQGroupBox::~TQGroupBox ()

Destroys the group box.

void TQGroupBox::addSpace ( int size )

Adds an empty cell at the next free position. If size is greater than 0, the empty cell takes size to be its fixed width (if orientation() is Horizontal) or height (if orientation() is Vertical).

Use this method to separate the widgets in the group box or to skip the next free cell. For performance reasons, call this method after calling setColumnLayout() or by changing the TQGroupBox::columns or TQGroupBox::orientation properties. It is generally a good idea to call these methods first (if needed at all), and insert the widgets and spaces afterwards.

int TQGroupBox::alignment () const

Returns the alignment of the group box title. See the "alignment" property for details.

int TQGroupBox::columns () const

Returns the number of columns or rows (depending on TQGroupBox::orientation) in the group box. See the "columns" property for details.

int TQGroupBox::insideMargin () const

Returns the width of the empty space between the items in the group and the frame of the group.

Only applies if the group box has a defined orientation.

The default is usually 11, by may vary depending on the platform and style.

See also setInsideMargin() and orientation.

int TQGroupBox::insideSpacing () const

Returns the width of the empty space between each of the items in the group.

Only applies if the group box has a defined orientation.

The default is usually 5, by may vary depending on the platform and style.

See also setInsideSpacing() and orientation.

bool TQGroupBox::isCheckable () const

Returns TRUE if the group box has a checkbox in its title; otherwise returns FALSE. See the "checkable" property for details.

bool TQGroupBox::isChecked () const

Returns TRUE if the group box's checkbox is checked; otherwise returns FALSE. See the "checked" property for details.

bool TQGroupBox::isFlat () const

Returns TRUE if the group box is painted flat or has a frame; otherwise returns FALSE. See the "flat" property for details.

Orientation TQGroupBox::orientation () const

Returns the group box's orientation. See the "orientation" property for details.

void TQGroupBox::setAlignment ( int ) [virtual]

Sets the alignment of the group box title. See the "alignment" property for details.

void TQGroupBox::setCheckable ( bool b )

Sets whether the group box has a checkbox in its title to b. See the "checkable" property for details.

void TQGroupBox::setChecked ( bool b ) [slot]

Sets whether the group box's checkbox is checked to b. See the "checked" property for details.

void TQGroupBox::setColumnLayout ( int strips, 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. It is not good TQt programming style to call this function after children have been inserted. Sets the number of columns or rows to be strips, depending on direction.

See also orientation and columns.

Example: chart/optionsform.cpp.

void TQGroupBox::setColumns ( int )

Sets the number of columns or rows (depending on TQGroupBox::orientation) in the group box. See the "columns" property for details.

void TQGroupBox::setFlat ( bool b )

Sets whether the group box is painted flat or has a frame to b. See the "flat" property for details.

void TQGroupBox::setInsideMargin ( int m )

Sets the the width of the inside margin to m pixels.

See also insideMargin().

void TQGroupBox::setInsideSpacing ( int s )

Sets the width of the empty space between each of the items in the group to s pixels.

See also insideSpacing().

void TQGroupBox::setOrientation ( Orientation )

Sets the group box's orientation. See the "orientation" property for details.

void TQGroupBox::setTitle ( const TQString & ) [virtual]

Sets the group box title text. See the "title" property for details.

TQString TQGroupBox::title () const

Returns the group box title text. See the "title" property for details.

void TQGroupBox::toggled ( bool on ) [signal]

If the group box has a check box (see isCheckable()) this signal is emitted when the check box is toggled. on is TRUE if the check box is checked; otherwise it is FALSE.


Property Documentation

Alignment alignment

This property holds the alignment of the group box title.

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

The alignment is one of the following flags:

The default alignment is AlignAuto.

See also TQt::AlignmentFlags.

Set this property's value with setAlignment() and get this property's value with alignment().

bool checkable

This property holds whether the group box has a checkbox in its title.

If this property is TRUE, the group box has a checkbox. If the checkbox is checked (which is the default), the group box's children are enabled.

setCheckable() controls whether or not the group box has a checkbox, and isCheckable() controls whether the checkbox is checked or not.

Set this property's value with setCheckable() and get this property's value with isCheckable().

bool checked

This property holds whether the group box's checkbox is checked.

If the group box has a check box (see isCheckable()), and the check box is checked (see isChecked()), the group box's children are enabled. If the checkbox is unchecked the children are disabled.

Set this property's value with setChecked() and get this property's value with isChecked().

int columns

This property holds the number of columns or rows (depending on TQGroupBox::orientation) in the group box.

Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is best to set the number of columns directly in the constructor.

Set this property's value with setColumns() and get this property's value with columns().

bool flat

This property holds whether the group box is painted flat or has a frame.

By default a group box has a surrounding frame, with the title being placed on the upper frame line. In flat mode the right, left and bottom frame lines are omitted, and only the thin line at the top is drawn.

See also title.

Set this property's value with setFlat() and get this property's value with isFlat().

Orientation orientation

This property holds the group box's orientation.

A horizontal group box arranges it's children in columns, while a vertical group box arranges them in rows.

Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is better to set the orientation directly in the constructor.

Set this property's value with setOrientation() and get this property's value with orientation().

TQString title

This property holds the group box title text.

The group box title text will have a focus-change keyboard accelerator if the title contains &, followed by a letter.

        g->setTitle( "&User information" );
    
This produces "User information"; Alt+U moves the keyboard focus to the group box.

There is no default title text.

Set this property's value with setTitle() and get this property's value with title().


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8