<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qsplitter.cpp:220 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>TQSplitter Class</title> <style type="text/css"><!-- fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQSplitter Class Reference</h1> <p>The TQSplitter class implements a splitter widget. <a href="#details">More...</a> <p><tt>#include <<a href="qsplitter-h.html">ntqsplitter.h</a>></tt> <p>Inherits <a href="ntqframe.html">TQFrame</a>. <p><a href="qsplitter-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn>enum <a href="#ResizeMode-enum"><b>ResizeMode</b></a> { Stretch, KeepSize, FollowSizeHint, Auto }</li> <li class=fn><a href="#TQSplitter"><b>TQSplitter</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li> <li class=fn><a href="#TQSplitter-2"><b>TQSplitter</b></a> ( Orientation o, TQWidget * parent = 0, const char * name = 0 )</li> <li class=fn><a href="#~TQSplitter"><b>~TQSplitter</b></a> ()</li> <li class=fn>virtual void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation )</li> <li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li> <li class=fn>void <a href="#setChildrenCollapsible"><b>setChildrenCollapsible</b></a> ( bool )</li> <li class=fn>bool <a href="#childrenCollapsible"><b>childrenCollapsible</b></a> () const</li> <li class=fn>void <a href="#setCollapsible"><b>setCollapsible</b></a> ( TQWidget * w, bool collapse )</li> <li class=fn>virtual void <a href="#setResizeMode"><b>setResizeMode</b></a> ( TQWidget * w, ResizeMode mode )</li> <li class=fn>virtual void <a href="#setOpaqueResize"><b>setOpaqueResize</b></a> ( bool = TRUE )</li> <li class=fn>bool <a href="#opaqueResize"><b>opaqueResize</b></a> () const</li> <li class=fn>void <a href="#moveToFirst"><b>moveToFirst</b></a> ( TQWidget * w )</li> <li class=fn>void <a href="#moveToLast"><b>moveToLast</b></a> ( TQWidget * w )</li> <li class=fn>void <a href="#refresh"><b>refresh</b></a> ()</li> <li class=fn>TQValueList<int> <a href="#sizes"><b>sizes</b></a> () const</li> <li class=fn>void <a href="#setSizes"><b>setSizes</b></a> ( TQValueList<int> list )</li> <li class=fn>int <a href="#handleWidth"><b>handleWidth</b></a> () const</li> <li class=fn>void <a href="#setHandleWidth"><b>setHandleWidth</b></a> ( int )</li> </ul> <h2>Properties</h2> <ul> <li class=fn>bool <a href="#childrenCollapsible-prop"><b>childrenCollapsible</b></a> - whether child widgets can be resized down to size 0 by the user</li> <li class=fn>int <a href="#handleWidth-prop"><b>handleWidth</b></a> - the width of the splitter handle</li> <li class=fn>bool <a href="#opaqueResize-prop"><b>opaqueResize</b></a> - whether resizing is opaque</li> <li class=fn>Orientation <a href="#orientation-prop"><b>orientation</b></a> - the orientation of the splitter</li> </ul> <h2>Protected Members</h2> <ul> <li class=fn>virtual void <a href="#childEvent"><b>childEvent</b></a> ( TQChildEvent * c )</li> <li class=fn>int <a href="#idAfter"><b>idAfter</b></a> ( TQWidget * w ) const</li> <li class=fn>void <a href="#moveSplitter"><b>moveSplitter</b></a> ( TQCOORD p, int id )</li> <li class=fn>virtual void drawSplitter ( TQPainter * p, TQCOORD x, TQCOORD y, TQCOORD w, TQCOORD h ) <em>(obsolete)</em></li> <li class=fn>int <a href="#adjustPos"><b>adjustPos</b></a> ( int pos, int id )</li> <li class=fn>virtual void <a href="#setRubberband"><b>setRubberband</b></a> ( int p )</li> <li class=fn>void <a href="#getRange"><b>getRange</b></a> ( int id, int * min, int * max )</li> </ul> <h2>Related Functions</h2> <ul> <li class=fn>TQTextStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQTextStream & ts, const TQSplitter & splitter )</li> <li class=fn>TQTextStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQTextStream & ts, TQSplitter & splitter )</li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The TQSplitter class implements a splitter widget. <p> <p> 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. <p> To show a <a href="ntqlistbox.html">TQListBox</a>, a <a href="ntqlistview.html">TQListView</a> and a <a href="ntqtextedit.html">TQTextEdit</a> side by side: <pre> TQSplitter *split = new TQSplitter( parent ); <a href="ntqlistbox.html">TQListBox</a> *lb = new <a href="ntqlistbox.html">TQListBox</a>( split ); <a href="ntqlistview.html">TQListView</a> *lv = new <a href="ntqlistview.html">TQListView</a>( split ); <a href="ntqtextedit.html">TQTextEdit</a> *ed = new <a href="ntqtextedit.html">TQTextEdit</a>( split ); </pre> <p> TQSplitter lays out its children horizontally (side by side); you can use <a href="#setOrientation">setOrientation</a>(TQSplitter::Vertical) to lay out the children vertically. <p> By default, all widgets can be as large or as small as the user wishes, between the <a href="ntqwidget.html#minimumSizeHint">minimumSizeHint</a>() (or <a href="ntqwidget.html#minimumSize">minimumSize</a>()) and <a href="ntqwidget.html#maximumSize">maximumSize</a>() of the widgets. Use <a href="#setResizeMode">setResizeMode</a>() to specify that a widget should keep its size when the splitter is resized, or set the stretch component of the <a href="ntqwidget.html#sizePolicy-prop">sizePolicy</a>. <p> Although TQSplitter normally resizes the children only at the end of a resize operation, if you call <a href="#setOpaqueResize">setOpaqueResize</a>(TRUE) the widgets are resized as often as possible. <p> The initial distribution of size between the widgets is determined by the initial size of each widget. You can also use <a href="#setSizes">setSizes</a>() to set the sizes of all the widgets. The function <a href="#sizes">sizes</a>() returns the sizes set by the user. <p> If you <a href="ntqwidget.html#hide">hide</a>() a child its space will be distributed among the other children. It will be reinstated when you <a href="ntqwidget.html#show">show</a>() it again. It is also possible to reorder the widgets within the splitter using <a href="#moveToFirst">moveToFirst</a>() and <a href="#moveToLast">moveToLast</a>(). <p> <img src=qsplitter-m.png> <img src=qsplitter-w.png> <p> <p>See also <a href="ntqtabbar.html">TQTabBar</a> and <a href="organizers.html">Organizers</a>. <hr><h2>Member Type Documentation</h2> <h3 class=fn><a name="ResizeMode-enum"></a>TQSplitter::ResizeMode</h3> <p> This enum type describes how TQSplitter will resize each of its child widgets. <ul> <li><tt>TQSplitter::Auto</tt> - The widget will be resized according to the stretch factors set in its <a href="ntqwidget.html#sizePolicy">sizePolicy</a>(). <li><tt>TQSplitter::Stretch</tt> - The widget will be resized when the splitter itself is resized. <li><tt>TQSplitter::KeepSize</tt> - TQSplitter will try to keep the widget's size unchanged. <li><tt>TQSplitter::FollowSizeHint</tt> - TQSplitter will resize the widget when the widget's size hint changes. </ul> <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="TQSplitter"></a>TQSplitter::TQSplitter ( <a href="ntqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 ) </h3> Constructs a horizontal splitter with the <em>parent</em> and <em>name</em> arguments being passed on to the <a href="ntqframe.html">TQFrame</a> constructor. <h3 class=fn><a name="TQSplitter-2"></a>TQSplitter::TQSplitter ( <a href="ntqt.html#Orientation-enum">Orientation</a> o, <a href="ntqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 ) </h3> Constructs a splitter with orientation <em>o</em> with the <em>parent</em> and <em>name</em> arguments being passed on to the <a href="ntqframe.html">TQFrame</a> constructor. <h3 class=fn><a name="~TQSplitter"></a>TQSplitter::~TQSplitter () </h3> Destroys the splitter and any children. <h3 class=fn>int <a name="adjustPos"></a>TQSplitter::adjustPos ( int pos, int id )<tt> [protected]</tt> </h3> Returns the closest legal position to <em>pos</em> of the widget with ID <em>id</em>. <p> <p>See also <a href="#idAfter">idAfter</a>(). <h3 class=fn>void <a name="childEvent"></a>TQSplitter::childEvent ( <a href="qchildevent.html">TQChildEvent</a> * c )<tt> [virtual protected]</tt> </h3> Tells the splitter that the child widget described by <em>c</em> has been inserted or removed. <p>Reimplemented from <a href="ntqobject.html#childEvent">TQObject</a>. <h3 class=fn>bool <a name="childrenCollapsible"></a>TQSplitter::childrenCollapsible () const </h3><p>Returns TRUE if child widgets can be resized down to size 0 by the user; otherwise returns FALSE. See the <a href="ntqsplitter.html#childrenCollapsible-prop">"childrenCollapsible"</a> property for details. <h3 class=fn>void <a name="drawSplitter"></a>TQSplitter::drawSplitter ( <a href="ntqpainter.html">TQPainter</a> * p, TQCOORD x, TQCOORD y, TQCOORD w, TQCOORD h )<tt> [virtual protected]</tt> </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Draws the splitter handle in the rectangle described by <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em> using painter <em>p</em>. <p>See also <a href="ntqstyle.html#drawPrimitive">TQStyle::drawPrimitive</a>(). <h3 class=fn>void <a name="getRange"></a>TQSplitter::getRange ( int id, int * min, int * max )<tt> [protected]</tt> </h3> Returns the valid range of the splitter with ID <em>id</em> in <em>*min</em> and <em>*max</em> if <em>min</em> and <em>max</em> are not 0. <p> <p>See also <a href="#idAfter">idAfter</a>(). <h3 class=fn>int <a name="handleWidth"></a>TQSplitter::handleWidth () const </h3><p>Returns the width of the splitter handle. See the <a href="ntqsplitter.html#handleWidth-prop">"handleWidth"</a> property for details. <h3 class=fn>int <a name="idAfter"></a>TQSplitter::idAfter ( <a href="ntqwidget.html">TQWidget</a> * w ) const<tt> [protected]</tt> </h3> Returns the ID of the widget to the right of or below the widget <em>w</em>, or 0 if there is no such widget (i.e. it is either not in this TQSplitter or <em>w</em> is at the end). <h3 class=fn>void <a name="moveSplitter"></a>TQSplitter::moveSplitter ( TQCOORD p, int id )<tt> [protected]</tt> </h3> Moves the left/top edge of the splitter handle with ID <em>id</em> as close as possible to position <em>p</em>, which is the distance from the left (or top) edge of the widget. <p> For Arabic, Hebrew and other right-to-left languages the layout is reversed. <em>p</em> is then the distance from the right (or top) edge of the widget. <p> <p>See also <a href="#idAfter">idAfter</a>(). <h3 class=fn>void <a name="moveToFirst"></a>TQSplitter::moveToFirst ( <a href="ntqwidget.html">TQWidget</a> * w ) </h3> Moves widget <em>w</em> to the leftmost/top position. <p>Example: <a href="splitter-example.html#x1299">splitter/splitter.cpp</a>. <h3 class=fn>void <a name="moveToLast"></a>TQSplitter::moveToLast ( <a href="ntqwidget.html">TQWidget</a> * w ) </h3> Moves widget <em>w</em> to the rightmost/bottom position. <h3 class=fn>bool <a name="opaqueResize"></a>TQSplitter::opaqueResize () const </h3><p>Returns TRUE if resizing is opaque; otherwise returns FALSE. See the <a href="ntqsplitter.html#opaqueResize-prop">"opaqueResize"</a> property for details. <h3 class=fn><a href="ntqt.html#Orientation-enum">Orientation</a> <a name="orientation"></a>TQSplitter::orientation () const </h3><p>Returns the orientation of the splitter. See the <a href="ntqsplitter.html#orientation-prop">"orientation"</a> property for details. <h3 class=fn>void <a name="refresh"></a>TQSplitter::refresh () </h3> <p> Updates the splitter's state. You should not need to call this function. <h3 class=fn>void <a name="setChildrenCollapsible"></a>TQSplitter::setChildrenCollapsible ( bool ) </h3><p>Sets whether child widgets can be resized down to size 0 by the user. See the <a href="ntqsplitter.html#childrenCollapsible-prop">"childrenCollapsible"</a> property for details. <h3 class=fn>void <a name="setCollapsible"></a>TQSplitter::setCollapsible ( <a href="ntqwidget.html">TQWidget</a> * w, bool collapse ) </h3> Sets whether the child widget <em>w</em> is collapsible to <em>collapse</em>. <p> By default, children are collapsible, meaning that the user can resize them down to size 0, even if they have a non-zero <a href="ntqwidget.html#minimumSize">minimumSize</a>() or <a href="ntqwidget.html#minimumSizeHint">minimumSizeHint</a>(). 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 <a href="#childrenCollapsible-prop">childrenCollapsible</a> property. <p> <p>See also <a href="#childrenCollapsible-prop">childrenCollapsible</a>. <h3 class=fn>void <a name="setHandleWidth"></a>TQSplitter::setHandleWidth ( int ) </h3><p>Sets the width of the splitter handle. See the <a href="ntqsplitter.html#handleWidth-prop">"handleWidth"</a> property for details. <h3 class=fn>void <a name="setOpaqueResize"></a>TQSplitter::setOpaqueResize ( bool = TRUE )<tt> [virtual]</tt> </h3><p>Sets whether resizing is opaque. See the <a href="ntqsplitter.html#opaqueResize-prop">"opaqueResize"</a> property for details. <h3 class=fn>void <a name="setOrientation"></a>TQSplitter::setOrientation ( <a href="ntqt.html#Orientation-enum">Orientation</a> )<tt> [virtual]</tt> </h3><p>Sets the orientation of the splitter. See the <a href="ntqsplitter.html#orientation-prop">"orientation"</a> property for details. <h3 class=fn>void <a name="setResizeMode"></a>TQSplitter::setResizeMode ( <a href="ntqwidget.html">TQWidget</a> * w, <a href="ntqsplitter.html#ResizeMode-enum">ResizeMode</a> mode )<tt> [virtual]</tt> </h3> Sets resize mode of widget <em>w</em> to <em>mode</em>. (The default is <a href="#ResizeMode-enum">Auto</a>.) <p>Examples: <a href="fileiconview-example.html#x894">fileiconview/mainwindow.cpp</a>, <a href="listviews-example.html#x161">listviews/listviews.cpp</a>, and <a href="splitter-example.html#x1301">splitter/splitter.cpp</a>. <h3 class=fn>void <a name="setRubberband"></a>TQSplitter::setRubberband ( int p )<tt> [virtual protected]</tt> </h3> Displays a rubber band at position <em>p</em>. If <em>p</em> is negative, the rubber band is removed. <h3 class=fn>void <a name="setSizes"></a>TQSplitter::setSizes ( <a href="ntqvaluelist.html">TQValueList</a><int> list ) </h3> Sets the size parameters to the values given in the <em>list</em>. 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 <em>list</em> are ignored. <p> If <em>list</em> contains too few values, the result is undefined but the program will still be well-behaved. <p> Note that the values in <em>list</em> should be the height/width that the widgets should be resized to. <p> <p>See also <a href="#sizes">sizes</a>(). <h3 class=fn><a href="ntqvaluelist.html">TQValueList</a><int> <a name="sizes"></a>TQSplitter::sizes () const </h3> Returns a list of the size parameters of all the widgets in this splitter. <p> 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. <p> Giving the values to another splitter's <a href="#setSizes">setSizes</a>() function will produce a splitter with the same layout as this one. <p> Note that if you want to iterate over the list, you should iterate over a copy, e.g. <pre> <a href="ntqvaluelist.html">TQValueList</a><int> list = mySplitter.sizes(); TQValueList<int>::Iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>(); while( it != list.<a href="ntqvaluelist.html#end">end</a>() ) { myProcessing( *it ); ++it; } </pre> <p> <p>See also <a href="#setSizes">setSizes</a>(). <hr><h2>Property Documentation</h2> <h3 class=fn>bool <a name="childrenCollapsible-prop"></a>childrenCollapsible</h3> <p>This property holds whether child widgets can be resized down to size 0 by the user. <p>By default, children are collapsible. It is possible to enable and disable the collapsing of individual children; see <a href="#setCollapsible">setCollapsible</a>(). <p>Set this property's value with <a href="#setChildrenCollapsible">setChildrenCollapsible</a>() and get this property's value with <a href="#childrenCollapsible">childrenCollapsible</a>(). <h3 class=fn>int <a name="handleWidth-prop"></a>handleWidth</h3> <p>This property holds the width of the splitter handle. <p> <p>Set this property's value with <a href="#setHandleWidth">setHandleWidth</a>() and get this property's value with <a href="#handleWidth">handleWidth</a>(). <h3 class=fn>bool <a name="opaqueResize-prop"></a>opaqueResize</h3> <p>This property holds whether resizing is opaque. <p>Opaque resizing is off by default. <p>Set this property's value with <a href="#setOpaqueResize">setOpaqueResize</a>() and get this property's value with <a href="#opaqueResize">opaqueResize</a>(). <h3 class=fn><a href="ntqt.html#Orientation-enum">Orientation</a> <a name="orientation-prop"></a>orientation</h3> <p>This property holds the orientation of the splitter. <p>By default the orientation is horizontal (the widgets are side by side). The possible orientations are <a href="ntqt.html#Orientation-enum">Horizontal</a> and <a href="ntqt.html#Orientation-enum">Vertical</a>. <p>Set this property's value with <a href="#setOrientation">setOrientation</a>() and get this property's value with <a href="#orientation">orientation</a>(). <hr><h2>Related Functions</h2> <h3 class=fn><a href="ntqtextstream.html">TQTextStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="ntqtextstream.html">TQTextStream</a> & ts, const <a href="ntqsplitter.html">TQSplitter</a> & splitter ) </h3> <p> Writes the sizes and the hidden state of the widgets in the splitter <em>splitter</em> to the text stream <em>ts</em>. <p> <p>See also <a href="#operator-gt-gt">operator>></a>(), <a href="#sizes">sizes</a>(), and <a href="ntqwidget.html#hidden-prop">TQWidget::hidden</a>. <h3 class=fn><a href="ntqtextstream.html">TQTextStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="ntqtextstream.html">TQTextStream</a> & ts, <a href="ntqsplitter.html">TQSplitter</a> & splitter ) </h3> <p> Reads the sizes and the hidden state of the widgets in the splitter <em>splitter</em> from the text stream <em>ts</em>. The sizes must have been previously written by the <a href="#operator-lt-lt">operator<<</a>() function. <p> <p>See also <a href="#operator-lt-lt">operator<<</a>(), <a href="#setSizes">setSizes</a>(), and <a href="ntqwidget.html#hide">TQWidget::hide</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">TQt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>TQt 3.3.8</div> </table></div></address></body> </html>