class KContainerLayout

KContainerLayout is a class that will manage layout of it's child widgets. More...

Definition#include <kcontainer.h>
InheritsQFrame (qt)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members


Detailed Description

KContainerLayout is a class that will manage layout of it's child widgets. Here is an example of using this class:

KContainerLayout (QWidget * parent=0, const char * name=0, int orientation = KContainerLayout::Horizontal, bool homogeneos = FALSE, int spacing = 5, WFlags f=0, bool allowLines=TRUE)

Constructs a KContainerLayout as child of parent

Parameters:
parentThe parent widget of the KContainerLayout
nameThe name of the widget
orientationThe orientation of the container, either KContainerLayout::Horizontal or KContainer::Vertical
homogeneousIf the container should split available size by all KContainerLayoutItem in equal parts
spacingThe space to add between each widget and between the first/last and the borders
fFlags @see QFrame#QFrame
allowLinesFlags @see QFrame#QFrame

~KContainerLayout ()
[virtual]

The destructor

int getNumberOfWidgets ()
[const]

Returns the number of widgets inside this container

int packStart (QWidget *w, bool e=FALSE, bool f=FALSE,int p=1)

Pack one widget to the start of the container after the previously packed on start widgets

Parameters:
wThe widget to be packed
eIf the widget should use the whole size allocated to it
fIf the widget should be sized to fill the whole space allocated to it (only makes sense with Expand=TRUE)
pPadding that should be used as the borders in each side of the widget

int packEnd (QWidget *w, bool e=FALSE, bool f=FALSE,int p=1)

Pack one widget to the end of the container after the previously packed on end widgets

Parameters:
wThe widget to be packed
eIf the widget should use the whole size allocated to it
fIf the widget should be sized to fill the whole space allocated to it (only makes sense with Expand=TRUE)
pPadding that should be used as the borders in each side of the widget

void setOrientation (int i)

Sets the orientation of the container, one of KContainerLayout::Horizontal or KContainer::Vertical

void setHomogeneos (bool b)

Sets the container to use the same size to each widget he contains (TRUE) or not (FALSE) When homogeneous is true all widgets will be packed as if they had the Expand set to TRUE @see KContainerLayout#packStart @see KContainer#packEnd

void setStartOffset (int i)

Sets the starting offset for this container @see _startOffset

void setEndOffset (int i)

Sets the ending offset for this container @see _endOffset

const int orientation ()
[const]

Returns the current orientation of the container @see KContainerLayout#setOrientation

const bool homogeneos ()
[const]

Returns the current homogeneous state of the container @see KContainerLayout#setHomogeneous

const int spacing ()
[const]

Returns the current spacing of the container @see KContainerLayout#setSpacing

const int startOffset ()
[const]

Returns the starting offset for this container @see _startOffset

const int endOffset ()
[const]

Returns the ending offset for this container @see _endOffset

void sizeToFit ()

Resizes the container to be as small as necessary to display all widgets

void recalcLayout ()
[protected]

Calculates the size necessary to display all widgets

QSize widgetSize (KContainerLayoutItem *item)
[protected]

Returns the size necessary for the widget represented by this KContainerLayoutItem

void repositionWidgets ()
[protected]

Reposition all widgets on the container.

int numberOfWidgetsWithExpand ()
[protected]

Returns the number of widgets that share the extra space on the container.

void calculateSizeHint ()
[protected]

Calculate our size hint based on the sizeHint() of all out widgets, on our properties - expand and homogeneous, and on the KContainerLayoutItem properties.

See also: KContainerLayoutItem, @see, packStart, @see, packEnd

QSize sizeOfLargerWidget ()
[protected]

Return the size necessary by the largest widget on the container.

QSize idealSizeOfWidget (KContainerLayoutItem *item)
[protected]

Returns the ideal size for the widget represented by this KContainerLayoutItem.

const bool horizontal ()
[protected const]

Return TRUE if this is an horizontal container.

void resizeEvent (QResizeEvent *ev)
[protected virtual]

Resizes the widget and repositions all widgets.

bool eventFilter (QObject *, QEvent *ev)
[protected virtual]

Used to filter resize events from our parent if it isn't a KContainerLayout.

QSize sizeHint ()
[protected const virtual]

Returns our size hint. The size necessary to display this container.

int _orientation
[protected]

Keeps the orientation of the container one of KContainerLayout::Horizontal or KContainer::Vertical

bool _homogeneos
[protected]

Should we split our size in equal parts by all the widgets?

int _spacing
[protected]

Space to be used between widgets and between the first/last widget and the container borders.

int _startOffset
[protected]

Space between the starting border and the first widget

int _endOffset
[protected]

Space between the last widget and ending border

QList<KContainerLayoutItem> _startWidgets
[protected]

The list of all widgets packed on the start

QList<KContainerLayoutItem> _endWidgets
[protected]

The list of all widgets packed at the end

int _sizeForEach
[protected]

width or height we have for each widget

QSize _sizeHint
[protected]

our sizeHint that we will return on our implementation of sizeHint()