TQSplitter(3qt)

NAME
TQSplitter - Implements a splitter widget

SYNOPSIS
#include <tqsplitter.h>

Inherits TQFrame.

  Public Members
enum ResizeMode { Stretch, KeepSize, FollowSizeHint, Auto }
QSplitter ( TQWidget * parent = 0, const char * name = 0 )
QSplitter ( Orientation o, TQWidget * parent = 0, const char * name = 0 )
~TQSplitter ()
virtual void setOrientation ( Orientation )
Orientation orientation () const
void setChildrenCollapsible ( bool )
bool childrenCollapsible () const
void setCollapsible ( TQWidget * w, bool collapse )
virtual void setResizeMode ( TQWidget * w, ResizeMode mode )
virtual void setOpaqueResize ( bool = true )
bool opaqueResize () const
void moveToFirst ( TQWidget * w )
void moveToLast ( TQWidget * w )
void refresh ()
TQValueList<int> sizes () const
void setSizes ( TQValueList<int> list )
int handleWidth () const
void setHandleWidth ( int )

  Properties
bool childrenCollapsible - whether child widgets can be resized down to size 0 by the user
int handleWidth - the width of the splitter handle
bool opaqueResize - whether resizing is opaque
Orientation orientation - the orientation of the splitter

  Protected Members
virtual void childEvent ( TQChildEvent * c )
int idAfter ( TQWidget * w ) const
void moveSplitter ( QCOORD p, int id )
virtual void drawSplitter ( TQPainter * p, QCOORD x, QCOORD y, QCOORD w, QCOORD h ) (obsolete)
int adjustPos ( int pos, int id )
virtual void setRubberband ( int p )
void getRange ( int id, int * min, int * max )

RELATED FUNCTION DOCUMENTATION
TQTextStream & operator<< ( TQTextStream & ts, const TQSplitter & splitter )
TQTextStream & operator>> ( TQTextStream & ts, TQSplitter & splitter )

DESCRIPTION
The TQSplitter class implements a splitter widget.

A splitter lets the user control the size of child widgets by dragging the boundary between the children. Any number of widgets may be controlled by a single splitter.

To show a TQListBox, a TQListView and a TQTextEdit side by side:

        TQSplitter *split = new TQSplitter( parent );
        TQListBox *lb = new TQListBox( split );
        TQListView *lv = new TQListView( split );
        TQTextEdit *ed = new TQTextEdit( split );

TQSplitter lays out its children horizontally (side by side); you can use setOrientation(TQSplitter::Vertical) to lay out the children vertically.

By default, all widgets can be as large or as small as the user wishes, between the minimumSizeHint() (or minimumSize()) and maximumSize() of the widgets. Use setResizeMode() to specify that a widget should keep its size when the splitter is resized, or set the stretch component of the sizePolicy.

Although TQSplitter normally resizes the children only at the end of a resize operation, if you call setOpaqueResize(true) the widgets are resized as often as possible.

The initial distribution of size between the widgets is determined by the initial size of each widget. You can also use setSizes() to set the sizes of all the widgets. The function sizes() returns the sizes set by the user.

If you hide() a child its space will be distributed among the other children. It will be reinstated when you show() it again. It is also possible to reorder the widgets within the splitter using moveToFirst() and moveToLast().

[Image Omitted]

[Image Omitted]

See also TQTabBar and Organizers.

  Member Type Documentation

TQSplitter::ResizeMode
This enum type describes how TQSplitter will resize each of its child widgets.

QSplitter::Auto - The widget will be resized according to the stretch factors set in its sizePolicy().

QSplitter::Stretch - The widget will be resized when the splitter itself is resized.

QSplitter::KeepSize - TQSplitter will try to keep the widget's size unchanged.

QSplitter::FollowSizeHint - TQSplitter will resize the widget when the widget's size hint changes.

MEMBER FUNCTION DOCUMENTATION

TQSplitter::TQSplitter ( TQWidget * parent = 0, const char * name = 0 )
Constructs a horizontal splitter with the parent and name arguments being passed on to the TQFrame constructor.

TQSplitter::TQSplitter ( Orientation o, TQWidget * parent = 0, const char * name = 0 )
Constructs a splitter with orientation o with the parent and name arguments being passed on to the TQFrame constructor.

TQSplitter::~TQSplitter ()
Destroys the splitter and any children.

int TQSplitter::adjustPos ( int pos, int id ) [protected]
Returns the closest legal position to pos of the widget with ID id.

See also idAfter().

void TQSplitter::childEvent ( TQChildEvent * c ) [virtual protected]
Tells the splitter that the child widget described by c has been inserted or removed.

Reimplemented from TQObject.

bool TQSplitter::childrenCollapsible () const
Returns true if child widgets can be resized down to size 0 by the user; otherwise returns false. See the "childrenCollapsible" property for details.

void TQSplitter::drawSplitter ( TQPainter * p, QCOORD x, QCOORD y, QCOORD w, QCOORD h ) [virtual protected]
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

Draws the splitter handle in the rectangle described by x, y, w, h using painter p.

See also TQStyle::drawPrimitive().

void TQSplitter::getRange ( int id, int * min, int * max ) [protected]
Returns the valid range of the splitter with ID id in *min and *max if min and max are not 0.

See also idAfter().

int TQSplitter::handleWidth () const
Returns the width of the splitter handle. See the "handleWidth" property for details.

int TQSplitter::idAfter ( TQWidget * w ) const [protected]
Returns the ID of the widget to the right of or below the widget w, or 0 if there is no such widget (i.e. it is either not in this TQSplitter or w is at the end).

void TQSplitter::moveSplitter ( QCOORD p, int id ) [protected]
Moves the left/top edge of the splitter handle with ID id as close as possible to position p, which is the distance from the left (or top) edge of the widget.

For Arabic, Hebrew and other right-to-left languages the layout is reversed. p is then the distance from the right (or top) edge of the widget.

See also idAfter().

void TQSplitter::moveToFirst ( TQWidget * w )
Moves widget w to the leftmost/top position.

Example: splitter/splitter.cpp.

void TQSplitter::moveToLast ( TQWidget * w )
Moves widget w to the rightmost/bottom position.

bool TQSplitter::opaqueResize () const
Returns true if resizing is opaque; otherwise returns false. See the "opaqueResize" property for details.

Orientation TQSplitter::orientation () const
Returns the orientation of the splitter. See the "orientation" property for details.

void TQSplitter::refresh ()
Updates the splitter's state. You should not need to call this function.

void TQSplitter::setChildrenCollapsible ( bool )
Sets whether child widgets can be resized down to size 0 by the user. See the "childrenCollapsible" property for details.

void TQSplitter::setCollapsible ( TQWidget * w, bool collapse )
Sets whether the child widget w is collapsible to collapse.

By default, children are collapsible, meaning that the user can resize them down to size 0, even if they have a non-zero minimumSize() or minimumSizeHint(). This behavior can be changed on a per-widget basis by calling this function, or globally for all the widgets in the splitter by setting the childrenCollapsible property.

See also childrenCollapsible.

void TQSplitter::setHandleWidth ( int )
Sets the width of the splitter handle. See the "handleWidth" property for details.

void TQSplitter::setOpaqueResize ( bool = true ) [virtual]
Sets whether resizing is opaque. See the "opaqueResize" property for details.

void TQSplitter::setOrientation ( Orientation ) [virtual]
Sets the orientation of the splitter. See the "orientation" property for details.

void TQSplitter::setResizeMode ( TQWidget * w, ResizeMode mode ) [virtual]
Sets resize mode of widget w to mode. (The default is Auto.)

Examples:

void TQSplitter::setRubberband ( int p ) [virtual protected]
Displays a rubber band at position p. If p is negative, the rubber band is removed.

void TQSplitter::setSizes ( TQValueList<int> list )
Sets the size parameters to the values given in the list. If the splitter is horizontal, the values set the widths of each widget going from left to right. If the splitter is vertical, the values set the heights of each widget going from top to bottom. Extra values in the list are ignored.

If list contains too few values, the result is undefined but the program will still be well-behaved.

Note that the values in list should be the height/width that the widgets should be resized to.

See also sizes().

TQValueList<int> TQSplitter::sizes () const
Returns a list of the size parameters of all the widgets in this splitter.

If the splitter's orientation is horizontal, the list is a list of widget widths; if the orientation is vertical, the list is a list of widget heights.

Giving the values to another splitter's setSizes() function will produce a splitter with the same layout as this one.

Note that if you want to iterate over the list, you should iterate over a copy, e.g.

    TQValueList<int> list = mySplitter.sizes();
    TQValueList<int>::Iterator it = list.begin();
    while( it != list.end() ) {
        myProcessing( *it );
        ++it;
    }

See also setSizes().

  Property Documentation

bool childrenCollapsible
This property holds whether child widgets can be resized down to size 0 by the user.

By default, children are collapsible. It is possible to enable and disable the collapsing of individual children; see setCollapsible().

Set this property's value with setChildrenCollapsible() and get this property's value with childrenCollapsible().

int handleWidth
This property holds the width of the splitter handle.

Set this property's value with setHandleWidth() and get this property's value with handleWidth().

bool opaqueResize
This property holds whether resizing is opaque.

Opaque resizing is off by default.

Set this property's value with setOpaqueResize() and get this property's value with opaqueResize().

Orientation orientation
This property holds the orientation of the splitter.

By default the orientation is horizontal (the widgets are side by side). The possible orientations are Horizontal and Vertical.

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

RELATED FUNCTION DOCUMENTATION

TQTextStream & operator<< ( TQTextStream & ts, const TQSplitter & splitter )
Writes the sizes and the hidden state of the widgets in the splitter splitter to the text stream ts.

See also operator>>(), sizes(), and TQWidget::hidden.

TQTextStream & operator>> ( TQTextStream & ts, TQSplitter & splitter )
Reads the sizes and the hidden state of the widgets in the splitter splitter from the text stream ts. The sizes must have been previously written by the operator<<() function.

See also operator<<(), setSizes(), and TQWidget::hide().

SEE ALSO
http://doc.trolltech.com/tqsplitter.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (tqsplitter.3qt) and the Qt version (3.3.8).