You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qdockarea.html

279 lines
16 KiB

<!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/qdockarea.cpp:450 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QDockArea 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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>QDockArea Class Reference</h1>
<p>The QDockArea class manages and lays out QDockWindows.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qdockarea-h.html">qdockarea.h</a>&gt;</tt>
<p>Inherits <a href="qwidget.html">QWidget</a>.
<p><a href="qdockarea-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#HandlePosition-enum"><b>HandlePosition</b></a> { Normal, Reverse }</li>
<li class=fn><a href="#QDockArea"><b>QDockArea</b></a> ( Orientation&nbsp;o, HandlePosition&nbsp;h = Normal, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#~QDockArea"><b>~QDockArea</b></a> ()</li>
<li class=fn>void <a href="#moveDockWindow-2"><b>moveDockWindow</b></a> ( QDockWindow&nbsp;*&nbsp;w, const&nbsp;QPoint&nbsp;&amp;&nbsp;p, const&nbsp;QRect&nbsp;&amp;&nbsp;r, bool&nbsp;swap )</li>
<li class=fn>void <a href="#removeDockWindow"><b>removeDockWindow</b></a> ( QDockWindow&nbsp;*&nbsp;w, bool&nbsp;makeFloating, bool&nbsp;swap, bool&nbsp;fixNewLines = TRUE )</li>
<li class=fn>void <a href="#moveDockWindow"><b>moveDockWindow</b></a> ( QDockWindow&nbsp;*&nbsp;w, int&nbsp;index = -1 )</li>
<li class=fn>bool <a href="#hasDockWindow"><b>hasDockWindow</b></a> ( QDockWindow&nbsp;*&nbsp;w, int&nbsp;*&nbsp;index = 0 )</li>
<li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li>
<li class=fn>HandlePosition <a href="#handlePosition"><b>handlePosition</b></a> () const</li>
<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
<li class=fn>int <a href="#count"><b>count</b></a> () const</li>
<li class=fn>QPtrList&lt;QDockWindow&gt; <a href="#dockWindowList"><b>dockWindowList</b></a> () const</li>
<li class=fn>bool <a href="#isDockWindowAccepted"><b>isDockWindowAccepted</b></a> ( QDockWindow&nbsp;*&nbsp;dw )</li>
<li class=fn>void <a href="#setAcceptDockWindow"><b>setAcceptDockWindow</b></a> ( QDockWindow&nbsp;*&nbsp;dw, bool&nbsp;accept )</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#lineUp"><b>lineUp</b></a> ( bool&nbsp;keepNewLines )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>int <a href="#count-prop"><b>count</b></a>&nbsp;- the number of dock windows in the dock area &nbsp;<em>(read only)</em></li>
<li class=fn>bool <a href="#empty-prop"><b>empty</b></a>&nbsp;- whether the dock area is empty &nbsp;<em>(read only)</em></li>
<li class=fn>HandlePosition <a href="#handlePosition-prop"><b>handlePosition</b></a>&nbsp;- where the dock window splitter handle is placed in the dock area &nbsp;<em>(read only)</em></li>
<li class=fn>Orientation <a href="#orientation-prop"><b>orientation</b></a>&nbsp;- the dock area's orientation &nbsp;<em>(read only)</em></li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>QTextStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QTextStream&nbsp;&amp;&nbsp;ts, const&nbsp;QDockArea&nbsp;&amp;&nbsp;dockArea )</li>
<li class=fn>QTextStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QTextStream&nbsp;&amp;&nbsp;ts, QDockArea&nbsp;&amp;&nbsp;dockArea )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QDockArea class manages and lays out QDockWindows.
<p>
<p> A QDockArea is a container which manages a list of
<a href="qdoctwindow.html">QDockWindow</a>s which it lays out within its area. In cooperation
with the <a href="qdoctwindow.html">QDockWindow</a>s it is responsible for the docking and
undocking of <a href="qdoctwindow.html">QDockWindow</a>s and moving them inside the dock
area. QDockAreas also handle the wrapping of <a href="qdoctwindow.html">QDockWindow</a>s to
fill the available space as compactly as possible. QDockAreas can
contain QToolBars since <a href="qtoolbar.html">QToolBar</a> is a <a href="qdoctwindow.html">QDockWindow</a> subclass.
<p> <a href="qmainwindow.html">QMainWindow</a> contains four QDockAreas which you can use for your
QToolBars and QDockWindows, so in most situations you do not need
to use the QDockArea class directly. Although QMainWindow contains
support for its own dock areas it isn't convenient for adding new
QDockAreas. If you need to create your own dock areas we suggest
that you create a subclass of <a href="qwidget.html">QWidget</a> and add your QDockAreas to
your subclass.
<p> <center><img src="qmainwindow-qdockareas.png" alt="QMainWindow's QDockAreas"></center>
<p> <a name="lines"></a>
<em>Lines</em>. QDockArea uses the concept of lines. A line is a
horizontal region which may contain dock windows side-by-side. A
dock area may have room for more than one line. When dock windows
are docked into a dock area they are usually added at the right
hand side of the top-most line that has room (unless manually
placed by the user). When users move dock windows they may leave
empty lines or gaps in non-empty lines. Dock windows can be lined
up to minimize wasted space using the <a href="#lineUp">lineUp</a>() function.
<p> The QDockArea class maintains a position list of all its child
dock windows. Dock windows are added to a dock area from position
0 onwards. Dock windows are laid out sequentially in position
order from left to right, and in the case of multiple lines of
dock windows, from top to bottom. If a dock window is floated it
still retains its position since this is where the window will
return if the user double clicks its caption. A dock window's
position can be determined with <a href="#hasDockWindow">hasDockWindow</a>(). The position can
be changed with <a href="#moveDockWindow">moveDockWindow</a>().
<p> To dock or undock a dock window use <a href="qdoctwindow.html#dock">QDockWindow::dock</a>() and
<a href="qdoctwindow.html#undock">QDockWindow::undock</a>() respectively. If you want to control which
dock windows can dock in a dock area use <a href="#setAcceptDockWindow">setAcceptDockWindow</a>(). To
see if a dock area contains a particular dock window use
<a href="#hasDockWindow">hasDockWindow</a>(); to see how many dock windows a dock area
contains use <a href="#count">count</a>().
<p> The streaming operators can write the positions of the dock
windows in the dock area to a <a href="qtextstream.html">QTextStream</a>. The positions can be
read back later to restore the saved positions.
<p> Save the positions to a QTextStream:
<pre>
ts &lt;&lt; *myDockArea;
</pre>
<p> Restore the positions from a QTextStream:
<pre>
ts &gt;&gt; *myDockArea;
</pre>
<p>See also <a href="application.html">Main Window and Related Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="HandlePosition-enum"></a>QDockArea::HandlePosition</h3>
<p> A dock window has two kinds of handles, the dock window handle
used for dragging the dock window, and the splitter handle used to
resize the dock window in relation to other dock windows using a
splitter. (The splitter handle is only visible for docked
windows.)
<p> This enum specifies where the dock window splitter handle is
placed in the dock area.
<ul>
<li><tt>QDockArea::Normal</tt> - The splitter handles of dock windows are placed at
the right or bottom.
<li><tt>QDockArea::Reverse</tt> - The splitter handles of dock windows are placed at
the left or top.
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QDockArea"></a>QDockArea::QDockArea ( <a href="qt.html#Orientation-enum">Orientation</a>&nbsp;o, <a href="qdockarea.html#HandlePosition-enum">HandlePosition</a>&nbsp;h = Normal, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a QDockArea with orientation <em>o</em>, HandlePosition <em>h</em>,
parent <em>parent</em> and called <em>name</em>.
<h3 class=fn><a name="~QDockArea"></a>QDockArea::~QDockArea ()
</h3>
Destroys the dock area and all the dock windows docked in the dock
area.
<p> Does not affect any floating dock windows or dock windows in other
dock areas, even if they first appeared in this dock area.
Floating dock windows are effectively top level windows and are
not child windows of the dock area. When a floating dock window is
docked (dragged into a dock area) its parent becomes the dock
area.
<h3 class=fn>int <a name="count"></a>QDockArea::count () const
</h3><p>Returns the number of dock windows in the dock area.
See the <a href="qdockarea.html#count-prop">"count"</a> property for details.
<h3 class=fn><a href="qptrlist.html">QPtrList</a>&lt;QDockWindow&gt; <a name="dockWindowList"></a>QDockArea::dockWindowList () const
</h3>
Returns a list of the dock windows in the dock area.
<h3 class=fn><a href="qdockarea.html#HandlePosition-enum">HandlePosition</a> <a name="handlePosition"></a>QDockArea::handlePosition () const
</h3><p>Returns where the dock window splitter handle is placed in the dock area.
See the <a href="qdockarea.html#handlePosition-prop">"handlePosition"</a> property for details.
<h3 class=fn>bool <a name="hasDockWindow"></a>QDockArea::hasDockWindow ( <a href="qdoctwindow.html">QDockWindow</a>&nbsp;*&nbsp;w, int&nbsp;*&nbsp;index = 0 )
</h3>
Returns TRUE if the dock area contains the dock window <em>w</em>;
otherwise returns FALSE. If <em>index</em> is not 0 it will be set as
follows: if the dock area contains the dock window <em>*index</em> is
set to <em>w</em>'s index position; otherwise <em>*index</em> is set to -1.
<h3 class=fn>bool <a name="isDockWindowAccepted"></a>QDockArea::isDockWindowAccepted ( <a href="qdoctwindow.html">QDockWindow</a>&nbsp;*&nbsp;dw )
</h3>
Returns TRUE if dock window <em>dw</em> could be docked into the dock
area; otherwise returns FALSE.
<p> <p>See also <a href="#setAcceptDockWindow">setAcceptDockWindow</a>().
<h3 class=fn>bool <a name="isEmpty"></a>QDockArea::isEmpty () const
</h3><p>Returns TRUE if the dock area is empty; otherwise returns FALSE.
See the <a href="qdockarea.html#empty-prop">"empty"</a> property for details.
<h3 class=fn>void <a name="lineUp"></a>QDockArea::lineUp ( bool&nbsp;keepNewLines )<tt> [slot]</tt>
</h3>
Lines up the dock windows in this dock area to minimize wasted
space. If <em>keepNewLines</em> is TRUE, only space within lines is
cleaned up. If <em>keepNewLines</em> is FALSE the number of lines might
be changed.
<h3 class=fn>void <a name="moveDockWindow"></a>QDockArea::moveDockWindow ( <a href="qdoctwindow.html">QDockWindow</a>&nbsp;*&nbsp;w, int&nbsp;index = -1 )
</h3>
Moves the <a href="qdoctwindow.html">QDockWindow</a> <em>w</em> within the dock area. If <em>w</em> is not
already docked in this area, <em>w</em> is docked first. If <em>index</em> is
-1 or larger than the number of docked widgets, <em>w</em> is appended
at the end, otherwise it is inserted at the position <em>index</em>.
<h3 class=fn>void <a name="moveDockWindow-2"></a>QDockArea::moveDockWindow ( <a href="qdoctwindow.html">QDockWindow</a>&nbsp;*&nbsp;w, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, bool&nbsp;swap )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Moves the dock window <em>w</em> inside the dock area where <em>p</em> is the
new position (in global screen coordinates), <em>r</em> is the suggested
rectangle of the dock window and <em>swap</em> specifies whether or not
the orientation of the docked widget needs to be changed.
<p> This function is used internally by <a href="qdoctwindow.html">QDockWindow</a>. You shouldn't
need to call it yourself.
<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation"></a>QDockArea::orientation () const
</h3><p>Returns the dock area's orientation.
See the <a href="qdockarea.html#orientation-prop">"orientation"</a> property for details.
<h3 class=fn>void <a name="removeDockWindow"></a>QDockArea::removeDockWindow ( <a href="qdoctwindow.html">QDockWindow</a>&nbsp;*&nbsp;w, bool&nbsp;makeFloating, bool&nbsp;swap, bool&nbsp;fixNewLines = TRUE )
</h3>
Removes the dock window <em>w</em> from the dock area. If <em>makeFloating</em> is TRUE, <em>w</em> gets floated, and if <em>swap</em> is TRUE,
the orientation of <em>w</em> gets swapped. If <em>fixNewLines</em> is TRUE
(the default) newlines in the area will be fixed.
<p> You should never need to call this function yourself. Use
<a href="qdoctwindow.html#dock">QDockWindow::dock</a>() and <a href="qdoctwindow.html#undock">QDockWindow::undock</a>() instead.
<h3 class=fn>void <a name="setAcceptDockWindow"></a>QDockArea::setAcceptDockWindow ( <a href="qdoctwindow.html">QDockWindow</a>&nbsp;*&nbsp;dw, bool&nbsp;accept )
</h3>
If <em>accept</em> is TRUE, dock window <em>dw</em> can be docked in the dock
area. If <em>accept</em> is FALSE, dock window <em>dw</em> cannot be docked in
the dock area.
<p> <p>See also <a href="#isDockWindowAccepted">isDockWindowAccepted</a>().
<hr><h2>Property Documentation</h2>
<h3 class=fn>int <a name="count-prop"></a>count</h3>
<p>This property holds the number of dock windows in the dock area.
<p>
<p>Get this property's value with <a href="#count">count</a>().
<h3 class=fn>bool <a name="empty-prop"></a>empty</h3>
<p>This property holds whether the dock area is empty.
<p>
<p>Get this property's value with <a href="#isEmpty">isEmpty</a>().
<h3 class=fn><a href="qdockarea.html#HandlePosition-enum">HandlePosition</a> <a name="handlePosition-prop"></a>handlePosition</h3>
<p>This property holds where the dock window splitter handle is placed in the dock area.
<p>The default position is <a href="#HandlePosition-enum">Normal</a>.
<p>Get this property's value with <a href="#handlePosition">handlePosition</a>().
<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation-prop"></a>orientation</h3>
<p>This property holds the dock area's orientation.
<p>There is no default value; the orientation is specified in the
constructor.
<p>Get this property's value with <a href="#orientation">orientation</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="qtextstream.html">QTextStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qtextstream.html">QTextStream</a>&nbsp;&amp;&nbsp;ts, const&nbsp;<a href="qdockarea.html">QDockArea</a>&nbsp;&amp;&nbsp;dockArea )
</h3>
<p> Writes the layout of the dock windows in dock area <em>dockArea</em> to
the text stream <em>ts</em>.
<p> <p>See also <a href="#operator-gt-gt">operator&gt;&gt;</a>().
<h3 class=fn><a href="qtextstream.html">QTextStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qtextstream.html">QTextStream</a>&nbsp;&amp;&nbsp;ts, <a href="qdockarea.html">QDockArea</a>&nbsp;&amp;&nbsp;dockArea )
</h3>
<p> Reads the layout description of the dock windows in dock area <em>dockArea</em> from the text stream <em>ts</em> and restores it. The layout
description must have been previously written by the <a href="#operator-lt-lt">operator&lt;&lt;</a>()
function.
<p> <p>See also <a href="#operator-lt-lt">operator&lt;&lt;</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>