QSplitter(3qt)

NAME
QSplitter - Implements a splitter widget

#include <qsplitter.h>

Inherits QFrame.

  Public Members
enum ResizeMode { Stretch, KeepSize, FollowSizeHint }
QSplitter ( QWidget * parent=0, const char * name=0 )
QSplitter ( Orientation, QWidget * parent=0, const char * name=0 )
~QSplitter ()
virtual void setOrientation ( Orientation )
Orientation orientation () const
virtual void setResizeMode ( QWidget * w, ResizeMode )
virtual void setOpaqueResize ( bool = TRUE )
bool opaqueResize () const
void moveToFirst ( QWidget * )
void moveToLast ( QWidget * )
void refresh ()
QValueList<int> sizes () const
void setSizes ( QValueList<int> )

  Protected Members
virtual void childEvent ( QChildEvent * )
int idAfter ( QWidget * ) const
void moveSplitter ( QCOORD pos, int id )
virtual void drawSplitter ( QPainter *, QCOORD x, QCOORD y, QCOORD w, QCOORD h )
int adjustPos ( int, int )
virtual void setRubberband ( int )
void getRange ( int id, int *, int * )

  Properties
Type | Name | READ | WRITE | Options
Orientation | orientation | orientation | setOrientation

DESCRIPTION
The QSplitter 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.

To show a QListBox, a QListView and a QMultiLineEdit side by side:

    QSplitter *split = new QSplitter( parent );
    QListBox *lb = new QListBox( split );
    QListView *lv = new QListView( split );
    QMultiLineEdit *ed = new QMultiLineEdit( split );

In QSplitter the boundary can be either horizontal or vertical. The default is horizontal (the children are side by side) and you can use setOrientation( QSplitter::Vertical ) to set it to vertical.

By default, all widgets can be as large or as small as the user wishes, down to minimumSizeHint(). You can naturally use setMinimumSize() and/or setMaximumSize() on the children. Use setResizeMode() to specify that a widget should keep its size when the splitter is resized.

QSplitter normally resizes the children only at the end of a resize operation, but 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. When you show() it again, it will be reinstated.

[Image Omitted]

[Image Omitted]

See also QTabBar.

Examples: mainlyQt/editor.cpp splitter/splitter.cpp

  Member Type Documentation

QSplitter::ResizeMode
This enum type describes how QSplitter will resize each of its child widgets. The currently defined values are:

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

KeepSize - QSplitter will try to keep this widget's size unchanged.

FollowSizeHint - QSplitter will resize the widget when its size hint changes.

MEMBER FUNCTION DOCUMENTATION

QSplitter::QSplitter ( Orientation o, QWidget * parent=0, const char * name=0 )
Constructs splitter with orientation o.

QSplitter::QSplitter ( QWidget * parent=0, const char * name=0 )
Constructs a horizontal splitter.

QSplitter::~QSplitter ()
Destructs the splitter.

int QSplitter::adjustPos ( int p, int id ) [protected]
Returns the legal position closest to p of the splitter with id id.

See also idAfter().

void QSplitter::childEvent ( QChildEvent * c ) [virtual protected]
Tells the splitter that a child widget has been inserted/removed.

Reimplemented from QObject.

void QSplitter::drawSplitter ( QPainter * p, QCOORD x, QCOORD y, QCOORD w, QCOORD h ) [virtual protected]
Draws the splitter handle in the rectangle described by x, y, w, h using painter p.

See also QStyle::drawSplitter.

bool QSplitter::event ( QEvent * e ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QObject.

void QSplitter::getRange ( int id, int * min, int * max ) [protected]
Returns the valid range of the splitter with id id in min and max.

See also idAfter().

int QSplitter::idAfter ( QWidget * w ) const [protected]
Returns the id of the splitter to the right of or below the widget w, or 0 if there is no such splitter. (ie. it is either not in this QSplitter, or it is at the end).

QSize QSplitter::minimumSizeHint () const [virtual]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

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

See also idAfter().

void QSplitter::moveToFirst ( QWidget * w )
Moves w to the leftmost/top position.

Examples: splitter/splitter.cpp

void QSplitter::moveToLast ( QWidget * w )
Moves w to the rightmost/bottom position.

bool QSplitter::opaqueResize () const
Returns TRUE if opaque resize is on, FALSE otherwise.

See also setOpaqueResize().

Orientation QSplitter::orientation () const
Returns the orientation (Horizontal or Vertical) of the splitter.

See also setOrientation().

void QSplitter::refresh ()
Updates the splitter state. You should not need to call this function during normal use of the splitter.

void QSplitter::resizeEvent ( QResizeEvent * ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

void QSplitter::setOpaqueResize ( bool on = TRUE ) [virtual]
Sets opaque resize to on. Opaque resize is initially turned off.

See also opaqueResize().

Examples: mainlyQt/editor.cpp splitter/splitter.cpp

void QSplitter::setOrientation ( Orientation o ) [virtual]
Sets the orientation to o. By default the orientation is horizontal (the widgets are side by side).

See also orientation().

void QSplitter::setResizeMode ( QWidget * w, ResizeMode mode )
Sets resize mode of w to mode.

See also ResizeMode.

Examples: splitter/splitter.cpp

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

void QSplitter::setSizes ( QValueList<int> list )
Sets the size parameters to the values given in list. If the splitter is horizontal, the values set the sizes from left to right. If it is vertical, the sizes are applied from top to bottom. Extra values in list are ignored.

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

See also sizes().

QSize QSplitter::sizeHint () const [virtual]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

QSizePolicy QSplitter::sizePolicy () const [virtual]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

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

Giving the values to setSizes() will give a splitter with the same layout as this one.

See also setSizes().

void QSplitter::styleChange ( QStyle & old ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

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

COPYRIGHT
Copyright 1992-2001 Trolltech AS, 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 make our job much simpler. Thank you.

In case of content or formattting problems with this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qsplitter.3) and the Qt version (2.3.2).