Qt Toolkit - QGManager Class

# QGManager Class Reference

The QGManager class provides one-dimensional geometry management. More...

`#include <qgmanager.h>`

Inherits QObject.

List of all member functions.

## Public Members

- QGManager ( QWidget * parent, const char * name=0 )
- ~QGManager ()
- void setBorder ( int b )
- enum { unlimited = QCOORD_MAX }
- QChain* newSerChain ( Direction )
- QChain* newParChain ( Direction )
- bool add ( QChain * destination, QChain * source, int stretch = 0 )
- bool addWidget ( QChain *, QWidget *, int stretch = 0 )
- bool addSpacing ( QChain *, int minSize, int stretch = 0, int maxSize = unlimited )
- bool addBranch ( QChain * destination, QChain * branch, int fromIndex, int toIndex )
- void setStretch ( QChain *, int )
- bool activate ()
- void freeze ( int w = 0, int h = 0 )
- void unFreeze ()
- QChain* xChain ()
- QChain* yChain ()
- void setMenuBar ( QWidget * w )
- QWidget* mainWidget ()
- void remove ( QWidget * w )
- void setName ( QChain *, const char * )

## Protected Members

- virtual bool eventFilter ( QObject *, QEvent * )

## Detailed Description

The QGManager class provides one-dimensional geometry management.

This class is intended for those who write geometry managers and graphical designers. It is not for the faint of heart. The QHBoxLayout, QVBoxLayout and QGridLayout classes are available for normal application programming.

Each dimension (horizontal and vertical) is handled independently. Widgets are organized in chains, which can be parallel or serial.

In a serial chain, elements are added one after another. Available space is divided among the elements according to stretch and max-/minsize.

In parallel chains, elements are added on top of each other. All elements are given the full length of the chain, and are placed at the same position.

See also: QHBoxLayout, QVBoxLayout and QGridLayout.

## Member Function Documentation

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

Creates a new QGManager which manages parent's children.

### QGManager::~QGManager ()

Destroys the QGManager, deleting all add()ed chains.

### bool QGManager::activate ()

Starts geometry management.

### bool QGManager::add ( QChain * destination, QChain * source, int stretch = 0 )

Adds the chain source to the chain destination.

### bool QGManager::addBranch ( QChain * destination, QChain * branch, int fromIndex, int toIndex )

Adds branch to destination as a branch going from fromIndex to toIndex. A branch is a chain that is anchored at two locations in a serial chain. The branch does not influence the main chain; if the branch's minimum size is greater than the minimum distance between the anchors, things will look ugly.

The branch goes from the beginning of the item at fromIndex to the end of the item at toIndex. Note: remember to count spacing when calculating indices.

### bool QGManager::addSpacing ( QChain * d, int minSize, int stretch = 0, int maxSize = unlimited )

Adds the spacing w to the chain d. If d is a serial chain, this means screen space between widgets. If d is parallel, this influences the maximum and minimum size.

### bool QGManager::addWidget ( QChain * d, QWidget * w, int stretch = 0 )

Adds the widget w to the chain d.

### bool QGManager::eventFilter ( QObject * o, QEvent * e ) `[virtual protected]`

Grabs all resize events for my parent, and does child widget resizing.

Reimplemented from QObject.

### void QGManager::freeze ( int w = 0, int h = 0 )

Fixes the size of the main widget and distributes the available space to the child widgets. The size is adjusted to a valid value. Thus freeze(0,0) (the default) will fix the widget to its minimum size.

### QWidget * QGManager::mainWidget ()

Returns the main widget of the manager.

### QChain * QGManager::newParChain ( Direction d )

Creates a new QChain which is parallel.

### QChain * QGManager::newSerChain ( Direction d )

Creates a new QChain which is serial.

### void QGManager::remove ( QWidget * w )

Removes the widget w from geometry management. Will not remove spacing around the widget. This function is called automatically if the widget is deleted.

### void QGManager::setBorder ( int b )

Sets the border around the edge of the widget. b is the number of pixels between the edge of the widget and the area controlled by the manager.

### void QGManager::setMenuBar ( QWidget * w )

Makes the geometry manager take account of the menu bar w. All child widgets are placed below the bottom edge of the menu bar.

### void QGManager::setName ( QChain * chain, const char * name )

Sets the name of chain to name. The name is used for debugging purposes.

### void QGManager::setStretch ( QChain * c, int s )

Sets the stretch factor on c to s. This stretch factor is overridden by add(), so there's no point in calling this function before you add() the chain.

See also: add().

### void QGManager::unFreeze ()

Undoes the effect of a previous freeze(). The main widget will now again be resizable.

### QChain * QGManager::xChain ()

Returns the main horizontal chain of the manager. All horizontal chains should be inserted into this chain or one of its descendants, otherwise they will be ignored.

### QChain * QGManager::yChain ()

Returns the main vertical chain of the manager. All vertical chains should be inserted into this chain or one of its descendants, otherwise they will be ignored.

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:

- qgmanager.h: 1998/08/21
- qgmanager.cpp: 1998/10/29