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.
tqt3/doc/html/ntqmainwindow.html

957 lines
62 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/qmainwindow.cpp:506 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQMainWindow 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>TQMainWindow Class Reference</h1>
<p>The TQMainWindow class provides a main application window,
with a menu bar, dock windows (e.g. for toolbars), and a status
bar.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qmainwindow-h.html">ntqmainwindow.h</a>&gt;</tt>
<p>Inherits <a href="ntqwidget.html">TQWidget</a>.
<p><a href="qmainwindow-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQMainWindow"><b>TQMainWindow</b></a> ( TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = WType_TopLevel )</li>
<li class=fn><a href="#~TQMainWindow"><b>~TQMainWindow</b></a> ()</li>
<li class=fn>TQMenuBar * <a href="#menuBar"><b>menuBar</b></a> () const</li>
<li class=fn>TQStatusBar * <a href="#statusBar"><b>statusBar</b></a> () const</li>
<li class=fn>TQToolTipGroup * <a href="#toolTipGroup"><b>toolTipGroup</b></a> () const</li>
<li class=fn>virtual void <a href="#setCentralWidget"><b>setCentralWidget</b></a> ( TQWidget&nbsp;*&nbsp;w )</li>
<li class=fn>TQWidget * <a href="#centralWidget"><b>centralWidget</b></a> () const</li>
<li class=fn>virtual void <a href="#setDockEnabled"><b>setDockEnabled</b></a> ( Dock&nbsp;dock, bool&nbsp;enable )</li>
<li class=fn>bool <a href="#isDockEnabled"><b>isDockEnabled</b></a> ( Dock&nbsp;dock ) const</li>
<li class=fn>bool <a href="#isDockEnabled-2"><b>isDockEnabled</b></a> ( TQDockArea&nbsp;*&nbsp;area ) const</li>
<li class=fn>virtual void <a href="#setDockEnabled-2"><b>setDockEnabled</b></a> ( TQDockWindow&nbsp;*&nbsp;dw, Dock&nbsp;dock, bool&nbsp;enable )</li>
<li class=fn>bool <a href="#isDockEnabled-3"><b>isDockEnabled</b></a> ( TQDockWindow&nbsp;*&nbsp;tb, Dock&nbsp;dock ) const</li>
<li class=fn>bool <a href="#isDockEnabled-4"><b>isDockEnabled</b></a> ( TQDockWindow&nbsp;*&nbsp;dw, TQDockArea&nbsp;*&nbsp;area ) const</li>
<li class=fn>virtual void <a href="#addDockWindow"><b>addDockWindow</b></a> ( TQDockWindow&nbsp;*&nbsp;dockWindow, Dock&nbsp;edge = DockTop, bool&nbsp;newLine = FALSE )</li>
<li class=fn>virtual void <a href="#addDockWindow-2"><b>addDockWindow</b></a> ( TQDockWindow&nbsp;*&nbsp;dockWindow, const&nbsp;TQString&nbsp;&amp;&nbsp;label, Dock&nbsp;edge = DockTop, bool&nbsp;newLine = FALSE )</li>
<li class=fn>virtual void <a href="#moveDockWindow"><b>moveDockWindow</b></a> ( TQDockWindow&nbsp;*&nbsp;dockWindow, Dock&nbsp;edge = DockTop )</li>
<li class=fn>virtual void <a href="#moveDockWindow-2"><b>moveDockWindow</b></a> ( TQDockWindow&nbsp;*&nbsp;dockWindow, Dock&nbsp;edge, bool&nbsp;nl, int&nbsp;index, int&nbsp;extraOffset = -1 )</li>
<li class=fn>virtual void <a href="#removeDockWindow"><b>removeDockWindow</b></a> ( TQDockWindow&nbsp;*&nbsp;dockWindow )</li>
<li class=fn>bool rightJustification () const &nbsp;<em>(obsolete)</em></li>
<li class=fn>bool <a href="#usesBigPixmaps"><b>usesBigPixmaps</b></a> () const</li>
<li class=fn>bool <a href="#usesTextLabel"><b>usesTextLabel</b></a> () const</li>
<li class=fn>bool <a href="#dockWindowsMovable"><b>dockWindowsMovable</b></a> () const</li>
<li class=fn>bool <a href="#opaqueMoving"><b>opaqueMoving</b></a> () const</li>
<li class=fn>bool <a href="#getLocation"><b>getLocation</b></a> ( TQDockWindow&nbsp;*&nbsp;dw, Dock&nbsp;&amp;&nbsp;dock, int&nbsp;&amp;&nbsp;index, bool&nbsp;&amp;&nbsp;nl, int&nbsp;&amp;&nbsp;extraOffset ) const</li>
<li class=fn>TQPtrList&lt;TQDockWindow&gt; <a href="#dockWindows"><b>dockWindows</b></a> ( Dock&nbsp;dock ) const</li>
<li class=fn>TQPtrList&lt;TQDockWindow&gt; <a href="#dockWindows-2"><b>dockWindows</b></a> () const</li>
<li class=fn>void <a href="#lineUpDockWindows"><b>lineUpDockWindows</b></a> ( bool&nbsp;keepNewLines = FALSE )</li>
<li class=fn>bool <a href="#isDockMenuEnabled"><b>isDockMenuEnabled</b></a> () const</li>
<li class=fn>bool <a href="#hasDockWindow"><b>hasDockWindow</b></a> ( TQDockWindow&nbsp;*&nbsp;dw )</li>
<li class=fn>void addToolBar ( TQDockWindow *, Dock = DockTop, bool&nbsp;newLine = FALSE ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void addToolBar ( TQDockWindow *, const&nbsp;TQString&nbsp;&amp;&nbsp;label, Dock = DockTop, bool&nbsp;newLine = FALSE ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void moveToolBar ( TQDockWindow *, Dock = DockTop ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void moveToolBar ( TQDockWindow *, Dock, bool&nbsp;nl, int&nbsp;index, int&nbsp;extraOffset = -1 ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void removeToolBar ( TQDockWindow * ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>bool toolBarsMovable () const &nbsp;<em>(obsolete)</em></li>
<li class=fn>TQPtrList&lt;TQToolBar&gt; <a href="#toolBars"><b>toolBars</b></a> ( Dock&nbsp;dock ) const</li>
<li class=fn>void lineUpToolBars ( bool&nbsp;keepNewLines = FALSE ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>TQDockArea * <a href="#leftDock"><b>leftDock</b></a> () const</li>
<li class=fn>TQDockArea * <a href="#rightDock"><b>rightDock</b></a> () const</li>
<li class=fn>TQDockArea * <a href="#topDock"><b>topDock</b></a> () const</li>
<li class=fn>TQDockArea * <a href="#bottomDock"><b>bottomDock</b></a> () const</li>
<li class=fn>virtual bool <a href="#isCustomizable"><b>isCustomizable</b></a> () const</li>
<li class=fn>bool <a href="#appropriate"><b>appropriate</b></a> ( TQDockWindow&nbsp;*&nbsp;dw ) const</li>
<li class=fn>enum <a href="#DockWindows-enum"><b>DockWindows</b></a> { OnlyToolBars, NoToolBars, AllDockWindows }</li>
<li class=fn>TQPopupMenu * <a href="#createDockWindowMenu"><b>createDockWindowMenu</b></a> ( DockWindows&nbsp;dockWindows = AllDockWindows ) const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void setRightJustification ( bool ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>virtual void <a href="#setUsesBigPixmaps"><b>setUsesBigPixmaps</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#setUsesTextLabel"><b>setUsesTextLabel</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#setDockWindowsMovable"><b>setDockWindowsMovable</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#setOpaqueMoving"><b>setOpaqueMoving</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#setDockMenuEnabled"><b>setDockMenuEnabled</b></a> ( bool&nbsp;b )</li>
<li class=fn>virtual void <a href="#whatsThis"><b>whatsThis</b></a> ()</li>
<li class=fn>virtual void <a href="#setAppropriate"><b>setAppropriate</b></a> ( TQDockWindow&nbsp;*&nbsp;dw, bool&nbsp;a )</li>
<li class=fn>virtual void <a href="#customize"><b>customize</b></a> ()</li>
<li class=fn>void setToolBarsMovable ( bool ) &nbsp;<em>(obsolete)</em></li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#pixmapSizeChanged"><b>pixmapSizeChanged</b></a> ( bool )</li>
<li class=fn>void <a href="#usesTextLabelChanged"><b>usesTextLabelChanged</b></a> ( bool )</li>
<li class=fn>void <a href="#dockWindowPositionChanged"><b>dockWindowPositionChanged</b></a> ( TQDockWindow&nbsp;*&nbsp;dockWindow )</li>
<li class=fn>void toolBarPositionChanged ( TQToolBar * ) &nbsp;<em>(obsolete)</em></li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#dockWindowsMovable-prop"><b>dockWindowsMovable</b></a>&nbsp;- whether the dock windows are movable</li>
<li class=fn>bool <a href="#opaqueMoving-prop"><b>opaqueMoving</b></a>&nbsp;- whether dock windows are moved opaquely</li>
<li class=fn>bool rightJustification&nbsp;- whether the main window right-justifies its dock windows &nbsp;<em>(obsolete)</em></li>
<li class=fn>bool <a href="#usesBigPixmaps-prop"><b>usesBigPixmaps</b></a>&nbsp;- whether big pixmaps are enabled</li>
<li class=fn>bool <a href="#usesTextLabel-prop"><b>usesTextLabel</b></a>&nbsp;- whether text labels for toolbar buttons are enabled</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#childEvent"><b>childEvent</b></a> ( TQChildEvent&nbsp;*&nbsp;e )</li>
</ul>
<h2>Protected Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setUpLayout"><b>setUpLayout</b></a> ()</li>
<li class=fn>virtual bool <a href="#showDockMenu"><b>showDockMenu</b></a> ( const&nbsp;TQPoint&nbsp;&amp;&nbsp;globalPos )</li>
<li class=fn>void <a href="#menuAboutToShow"><b>menuAboutToShow</b></a> ()</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>TQTextStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( TQTextStream&nbsp;&amp;&nbsp;ts, const&nbsp;TQMainWindow&nbsp;&amp;&nbsp;mainWindow )</li>
<li class=fn>TQTextStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( TQTextStream&nbsp;&amp;&nbsp;ts, TQMainWindow&nbsp;&amp;&nbsp;mainWindow )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQMainWindow class provides a main application window,
with a menu bar, dock windows (e.g. for toolbars), and a status
bar.
<p>
<p> Main windows are most often used to provide menus, toolbars and a
status bar around a large central widget, such as a text edit,
drawing canvas or <a href="ntqworkspace.html">TQWorkspace</a> (for MDI applications). TQMainWindow
is usually subclassed since this makes it easier to encapsulate
the central widget, menus and toolbars as well as the window's
state. Subclassing makes it possible to create the slots that are
called when the user clicks menu items or toolbar buttons. You can
also create main windows using <a href="designer-manual.html">TQt
Designer</a>. We'll briefly review adding menu items and
toolbar buttons then describe the facilities of TQMainWindow
itself.
<p> <pre>
TQMainWindow *mw = new TQMainWindow;
<a href="ntqtextedit.html">TQTextEdit</a> *edit = new <a href="ntqtextedit.html">TQTextEdit</a>( mw, "editor" );
edit-&gt;<a href="ntqwidget.html#setFocus">setFocus</a>();
mw-&gt;<a href="ntqwidget.html#setCaption">setCaption</a>( "Main Window" );
mw-&gt;<a href="#setCentralWidget">setCentralWidget</a>( edit );
mw-&gt;<a href="ntqwidget.html#show">show</a>();
</pre>
<p> TQMainWindows may be created in their own right as shown above.
The central widget is set with <a href="#setCentralWidget">setCentralWidget</a>(). Popup menus can
be added to the default menu bar, widgets can be added to the
status bar, toolbars and dock windows can be added to any of the
dock areas.
<p>
<pre> ApplicationWindow *mw = new ApplicationWindow();
mw-&gt;<a href="ntqwidget.html#setCaption">setCaption</a>( "TQt Example - Application" );
<a name="x2115"></a> mw-&gt;<a href="ntqwidget.html#show">show</a>();
</pre>
<p> In the extract above ApplicationWindow is a subclass of
TQMainWindow that we must write for ourselves; this is the usual
approach to using TQMainWindow. (The source for the extracts in
this description are taken from <a href="simple-application-example.html">application/main.cpp</a>, <a href="simple-application-example.html">application/application.cpp</a>, <a href="qaction-application-example.html">action/main.cpp</a>, and <a href="qaction-application-example.html">action/application.cpp</a> )
<p> When subclassing we add the menu items and toolbars in the
subclass's constructor. If we've created a TQMainWindow instance
directly we can add menu items and toolbars just as easily by
passing the TQMainWindow instance as the parent instead of the <em>this</em> pointer.
<p>
<pre> <a href="ntqpopupmenu.html">TQPopupMenu</a> * help = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this );
<a href="#menuBar">menuBar</a>()-&gt;insertItem( "&amp;Help", help );
help-&gt;<a href="ntqmenudata.html#insertItem">insertItem</a>( "&amp;About", this, TQ_SLOT(about()), Key_F1 );
</pre>
<p> Here we've added a new menu with one menu item. The menu has been
inserted into the menu bar that TQMainWindow provides by default
and which is accessible through the <a href="#menuBar">menuBar</a>() function. The slot
will be called when the menu item is clicked.
<p>
<pre> <a href="ntqtoolbar.html">TQToolBar</a> * fileTools = new <a href="ntqtoolbar.html">TQToolBar</a>( this, "file operations" );
fileTools-&gt;<a href="ntqtoolbar.html#setLabel">setLabel</a>( "File Operations" );
</pre><pre> TQToolButton * fileOpen
= new <a href="ntqtoolbutton.html">TQToolButton</a>( openIcon, "Open File", <a href="ntqstring.html#TQString-null">TQString::null</a>,
this, TQ_SLOT(choose()), fileTools, "open file" );
</pre>
<p> This extract shows the creation of a toolbar with one toolbar
button. TQMainWindow supplies four dock areas for toolbars. When a
toolbar is created as a child of a TQMainWindow (or derived class)
instance it will be placed in a dock area (the <a href="ntqt.html#Dock-enum">Top</a> dock area by
default). The slot will be called when the toolbar button is
clicked. Any dock window can be added to a dock area either using
<a href="#addDockWindow">addDockWindow</a>(), or by creating a dock window with the TQMainWindow
as the parent.
<p>
<pre> e = new <a href="ntqtextedit.html">TQTextEdit</a>( this, "editor" );
e-&gt;<a href="ntqwidget.html#setFocus">setFocus</a>();
<a href="#setCentralWidget">setCentralWidget</a>( e );
<a href="#statusBar">statusBar</a>()-&gt;message( "Ready", 2000 );
</pre>
<p> Having created the menus and toolbar we create an instance of the
large central widget, give it the focus and set it as the main
window's central widget. In the example we've also set the status
bar, accessed via the <a href="#statusBar">statusBar</a>() function, to an initial message
which will be displayed for two seconds. Note that you can add
additional widgets to the status bar, for example labels, to show
further status information. See the <a href="ntqstatusbar.html">TQStatusBar</a> documentation for
details, particularly the addWidget() function.
<p> Often we want to synchronize a toolbar button with a menu item.
For example, if the user clicks a 'bold' toolbar button we want
the 'bold' menu item to be checked. This synchronization can be
achieved automatically by creating actions and adding the actions
to the toolbar and menu.
<p>
<pre> <a href="ntqaction.html">TQAction</a> * fileOpenAction;
</pre><pre> fileOpenAction = new <a href="ntqaction.html">TQAction</a>( TQPixmap( fileopen ), "&amp;Open...",
CTRL+Key_O, this, "open" );
<a href="ntqobject.html#connect">connect</a>( fileOpenAction, TQ_SIGNAL( <a href="ntqaction.html#activated">activated</a>() ) , this, TQ_SLOT( choose() ) );
</pre>
<p> Here we create an action with an icon which will be used in any
menu and toolbar that the action is added to. We've also given the
action a menu name, '&amp;Open', and a keyboard shortcut. The
connection that we have made will be used when the user clicks
either the menu item <em>or</em> the toolbar button.
<p>
<pre> <a href="ntqpopupmenu.html">TQPopupMenu</a> * file = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this );
<a href="#menuBar">menuBar</a>()-&gt;insertItem( "&amp;File", file );
</pre><pre> fileOpenAction-&gt;<a href="ntqaction.html#addTo">addTo</a>( file );
</pre>
<p> The extract above shows the creation of a popup menu. We add the
menu to the TQMainWindow's menu bar and add our action.
<p>
<pre> <a href="ntqtoolbar.html">TQToolBar</a> * fileTools = new <a href="ntqtoolbar.html">TQToolBar</a>( this, "file operations" );
fileTools-&gt;<a href="ntqtoolbar.html#setLabel">setLabel</a>( "File Operations" );
fileOpenAction-&gt;<a href="ntqaction.html#addTo">addTo</a>( fileTools );
</pre>
<p> Here we create a new toolbar as a child of the TQMainWindow and add
our action to the toolbar.
<p> We'll now explore the functionality offered by TQMainWindow.
<p> The main window will take care of the dock areas, and the geometry
of the central widget, but all other aspects of the central widget
are left to you. TQMainWindow automatically detects the creation of
a menu bar or status bar if you specify the TQMainWindow as parent,
or you can use the provided <a href="#menuBar">menuBar</a>() and <a href="#statusBar">statusBar</a>() functions.
The functions menuBar() and statusBar() create a suitable widget
if one doesn't exist, and update the window's layout to make
space.
<p> TQMainWindow provides a <a href="qtooltipgroup.html">TQToolTipGroup</a> connected to the status bar.
The function <a href="#toolTipGroup">toolTipGroup</a>() provides access to the default
TQToolTipGroup. It isn't possible to set a different tool tip
group.
<p> New dock windows and toolbars can be added to a TQMainWindow using
<a href="#addDockWindow">addDockWindow</a>(). Dock windows can be moved using <a href="#moveDockWindow">moveDockWindow</a>()
and removed with <a href="#removeDockWindow">removeDockWindow</a>(). TQMainWindow allows default
dock window (toolbar) docking in all its dock areas (<a href="ntqt.html#Dock-enum">Top</a>, <a href="ntqt.html#Dock-enum">Left</a>, <a href="ntqt.html#Dock-enum">Right</a>, <a href="ntqt.html#Dock-enum">Bottom</a>). You can use <a href="#setDockEnabled">setDockEnabled</a>() to
enable and disable docking areas for dock windows. When adding or
moving dock windows you can specify their 'edge' (dock area). The
currently available edges are: <a href="ntqt.html#Dock-enum">Top</a>, <a href="ntqt.html#Dock-enum">Left</a>, <a href="ntqt.html#Dock-enum">Right</a>, <a href="ntqt.html#Dock-enum">Bottom</a>, <a href="ntqt.html#Dock-enum">Minimized</a> (effectively a 'hidden' dock area) and <a href="ntqt.html#Dock-enum">TornOff</a> (floating). See <a href="ntqt.html#Dock-enum">TQt::Dock</a> for an explanation of these
areas. Note that the *ToolBar functions are included for backward
compatibility; all new code should use the *DockWindow functions.
TQToolbar is a subclass of <a href="ntqdockwindow.html">TQDockWindow</a> so all functions that work
with dock windows work on toolbars in the same way.
<p> <a name="dwm"></a>
If the user clicks the close button, then the dock window is
hidden. A dock window can be hidden or unhidden by the user by
right clicking a dock area and clicking the name of the relevant
dock window on the pop up dock window menu. This menu lists the
names of every dock window; visible dock windows have a tick
beside their names. The dock window menu is created automatically
as required by <a href="#createDockWindowMenu">createDockWindowMenu</a>(). Since it may not always be
appropriate for a dock window to appear on this menu the
<a href="#setAppropriate">setAppropriate</a>() function is used to inform the main window
whether or not the dock window menu should include a particular
dock window. Double clicking a dock window handle (usually on the
left-hand side of the dock window) undocks (floats) the dock
window. Double clicking a floating dock window's titlebar will
dock the floating dock window. (See also
<a href="#DockWindows-enum">TQMainWindow::DockWindows</a>.)
<p> Some functions change the appearance of a TQMainWindow globally:
<ul>
<li> <a href="ntqdockwindow.html#setHorizontalStretchable">TQDockWindow::setHorizontalStretchable</a>() and
<a href="ntqdockwindow.html#setVerticalStretchable">TQDockWindow::setVerticalStretchable</a>() are used to make specific dock
windows or toolbars stretchable.
<li> <a href="#setUsesBigPixmaps">setUsesBigPixmaps</a>() is used to set whether tool buttons should
draw small or large pixmaps (see <a href="ntqiconset.html">TQIconSet</a> for more information).
<li> <a href="#setUsesTextLabel">setUsesTextLabel</a>() is used to set whether tool buttons
should display a textual label in addition to pixmaps
(see <a href="ntqtoolbutton.html">TQToolButton</a> for more information).
</ul>
<p> The user can drag dock windows into any enabled docking area. Dock
windows can also be dragged <em>within</em> a docking area, for example
to rearrange the order of some toolbars. Dock windows can also be
dragged outside any docking area (undocked or 'floated'). Being
able to drag dock windows can be enabled (the default) and
disabled using <a href="#setDockWindowsMovable">setDockWindowsMovable</a>().
<p> The <a href="ntqt.html#Dock-enum">Minimized</a> edge is a hidden dock area. If this dock area is
enabled the user can hide (minimize) a dock window or show (restore)
a minimized dock window by clicking the dock window handle. If the
user hovers the mouse cursor over one of the handles, the caption of
the dock window is displayed in a tool tip (see
<a href="ntqwidget.html#caption">TQDockWindow::caption</a>() or <a href="ntqtoolbar.html#label">TQToolBar::label</a>()), so if you enable the
<a href="ntqt.html#Dock-enum">Minimized</a> dock area, it is best to specify a meaningful caption
or label for each dock window. To minimize a dock window
programmatically use <a href="#moveDockWindow">moveDockWindow</a>() with an edge of <a href="ntqt.html#Dock-enum">Minimized</a>.
<p> Dock windows are moved transparently by default, i.e. during the
drag an outline rectangle is drawn on the screen representing the
position of the dock window as it moves. If you want the dock
window to be shown normally whilst it is moved use
<a href="#setOpaqueMoving">setOpaqueMoving</a>().
<p> The location of a dock window, i.e. its dock area and position
within the dock area, can be determined by calling <a href="#getLocation">getLocation</a>().
Movable dock windows can be lined up to minimize wasted space with
<a href="#lineUpDockWindows">lineUpDockWindows</a>(). Pointers to the dock areas are available from
<a href="#topDock">topDock</a>(), <a href="#leftDock">leftDock</a>(), <a href="#rightDock">rightDock</a>() and <a href="#bottomDock">bottomDock</a>(). A customize
menu item is added to the pop up dock window menu if
<a href="#isCustomizable">isCustomizable</a>() returns TRUE; it returns FALSE by default.
Reimplement isCustomizable() and <a href="#customize">customize</a>() if you want to offer
this extra menu item, for example, to allow the user to change
settings relating to the main window and its toolbars and dock
windows.
<p> The main window's menu bar is fixed (at the top) by default. If
you want a movable menu bar, create a <a href="ntqmenubar.html">TQMenuBar</a> as a stretchable
widget inside its own movable dock window and restrict this dock
window to only live within the <a href="ntqt.html#Dock-enum">Top</a> or <a href="ntqt.html#Dock-enum">Bottom</a> dock:
<p> <pre>
<a href="ntqtoolbar.html">TQToolBar</a> *tb = new <a href="ntqtoolbar.html">TQToolBar</a>( this );
<a href="#addDockWindow">addDockWindow</a>( tb, tr( "Menubar" ), Top, FALSE );
<a href="ntqmenubar.html">TQMenuBar</a> *mb = new <a href="ntqmenubar.html">TQMenuBar</a>( tb );
mb-&gt;<a href="ntqframe.html#setFrameStyle">setFrameStyle</a>( TQFrame::NoFrame );
tb-&gt;<a href="ntqtoolbar.html#setStretchableWidget">setStretchableWidget</a>( mb );
<a href="#setDockEnabled">setDockEnabled</a>( tb, Left, FALSE );
<a href="#setDockEnabled">setDockEnabled</a>( tb, Right, FALSE );
</pre>
<p> An application with multiple dock windows can choose to save the
current dock window layout in order to restore it later, e.g. in
the next session. You can do this by using the streaming operators
for TQMainWindow.
<p> To save the layout and positions of all the dock windows do this:
<p> <pre>
<a href="ntqfile.html">TQFile</a> file( filename );
if ( file.<a href="ntqfile.html#open">open</a>( <a href="ntqfile.html#open">IO_WriteOnly</a> ) ) {
<a href="ntqtextstream.html">TQTextStream</a> stream( &amp;file );
stream &lt;&lt; *mainWindow;
file.<a href="ntqfile.html#close">close</a>();
}
</pre>
<p> To restore the dock window positions and sizes (normally when the
application is next started), do following:
<p> <pre>
<a href="ntqfile.html">TQFile</a> file( filename );
if ( file.<a href="ntqfile.html#open">open</a>( <a href="ntqfile.html#open">IO_ReadOnly</a> ) ) {
<a href="ntqtextstream.html">TQTextStream</a> stream( &amp;file );
stream &gt;&gt; *mainWindow;
file.<a href="ntqfile.html#close">close</a>();
}
</pre>
<p> The <a href="ntqsettings.html">TQSettings</a> class can be used in conjunction with the streaming
operators to store the application's settings.
<p> TQMainWindow's management of dock windows and toolbars is done
transparently behind-the-scenes by <a href="ntqdockarea.html">TQDockArea</a>.
<p> For multi-document interfaces (MDI), use a <a href="ntqworkspace.html">TQWorkspace</a> as the
central widget.
<p> Adding dock windows, e.g. toolbars, to TQMainWindow's dock areas is
straightforward. If the supplied dock areas are not sufficient for
your application we suggest that you create a <a href="ntqwidget.html">TQWidget</a> subclass and
add your own dock areas (see <a href="ntqdockarea.html">TQDockArea</a>) to the subclass since
TQMainWindow provides functionality specific to the standard dock
areas it provides.
<p> <img src=qmainwindow-m.png> <img src=qmainwindow-w.png>
<p> <p>See also <a href="ntqtoolbar.html">TQToolBar</a>, <a href="ntqdockwindow.html">TQDockWindow</a>, <a href="ntqstatusbar.html">TQStatusBar</a>, <a href="ntqaction.html">TQAction</a>, <a href="ntqmenubar.html">TQMenuBar</a>, <a href="ntqpopupmenu.html">TQPopupMenu</a>, <a href="qtooltipgroup.html">TQToolTipGroup</a>, <a href="ntqdialog.html">TQDialog</a>, and <a href="application.html">Main Window and Related Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="DockWindows-enum"></a>TQMainWindow::DockWindows</h3>
<p> Right-clicking a dock area will pop-up the dock window menu
(<a href="#createDockWindowMenu">createDockWindowMenu</a>() is called automatically). When called in
code you can specify what items should appear on the menu with
this enum.
<ul>
<li><tt>TQMainWindow::OnlyToolBars</tt> - The menu will list all the toolbars, but not
any other dock windows.
<li><tt>TQMainWindow::NoToolBars</tt> - The menu will list dock windows but not
toolbars.
<li><tt>TQMainWindow::AllDockWindows</tt> - The menu will list all toolbars and other
dock windows. (This is the default.)
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQMainWindow"></a>TQMainWindow::TQMainWindow ( <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = WType_TopLevel )
</h3>
Constructs an empty main window. The <em>parent</em>, <em>name</em> and widget
flags <em>f</em>, are passed on to the <a href="ntqwidget.html">TQWidget</a> constructor.
<p> By default, the widget flags are set to <a href="ntqt.html#WidgetFlags-enum">WType_TopLevel</a> rather
than 0 as they are with TQWidget. If you don't want your
TQMainWindow to be a top level widget then you will need to set <em>f</em> to 0.
<h3 class=fn><a name="~TQMainWindow"></a>TQMainWindow::~TQMainWindow ()
</h3>
Destroys the object and frees any allocated resources.
<h3 class=fn>void <a name="addDockWindow"></a>TQMainWindow::addDockWindow ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dockWindow, <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;edge = DockTop, bool&nbsp;newLine = FALSE )<tt> [virtual]</tt>
</h3>
Adds <em>dockWindow</em> to the <em>edge</em> dock area.
<p> If <em>newLine</em> is FALSE (the default) then the <em>dockWindow</em> is
added at the end of the <em>edge</em>. For vertical edges the end is at
the bottom, for horizontal edges (including <a href="ntqt.html#Dock-enum">Minimized</a>) the end
is at the right. If <em>newLine</em> is TRUE a new line of dock windows
is started with <em>dockWindow</em> as the first (left-most and
top-most) dock window.
<p> If <em>dockWindow</em> is managed by another main window, it is first
removed from that window.
<h3 class=fn>void <a name="addDockWindow-2"></a>TQMainWindow::addDockWindow ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dockWindow, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;label, <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;edge = DockTop, bool&nbsp;newLine = FALSE )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Adds <em>dockWindow</em> to the dock area with label <em>label</em>.
<p> If <em>newLine</em> is FALSE (the default) the <em>dockWindow</em> is added at
the end of the <em>edge</em>. For vertical edges the end is at the
bottom, for horizontal edges (including <a href="ntqt.html#Dock-enum">Minimized</a>) the end is
at the right. If <em>newLine</em> is TRUE a new line of dock windows is
started with <em>dockWindow</em> as the first (left-most and top-most)
dock window.
<p> If <em>dockWindow</em> is managed by another main window, it is first
removed from that window.
<h3 class=fn>void <a name="addToolBar"></a>TQMainWindow::addToolBar ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*, <a href="ntqt.html#Dock-enum">Dock</a> = DockTop, bool&nbsp;newLine = FALSE )
</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>
<h3 class=fn>void <a name="addToolBar-2"></a>TQMainWindow::addToolBar ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;label, <a href="ntqt.html#Dock-enum">Dock</a> = DockTop, bool&nbsp;newLine = FALSE )
</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> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn>bool <a name="appropriate"></a>TQMainWindow::appropriate ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dw ) const
</h3>
Returns TRUE if it is appropriate to include a menu item for the
<em>dw</em> dock window in the dock window menu; otherwise returns
FALSE.
<p> The user is able to change the state (show or hide) a dock window
that has a menu item by clicking the item.
<p> Call <a href="#setAppropriate">setAppropriate</a>() to indicate whether or not a particular dock
window should appear on the popup menu.
<p> <p>See also <a href="#setAppropriate">setAppropriate</a>().
<h3 class=fn><a href="ntqdockarea.html">TQDockArea</a>&nbsp;* <a name="bottomDock"></a>TQMainWindow::bottomDock () const
</h3>
Returns a pointer the <a href="ntqt.html#Dock-enum">Bottom</a> dock area
<p> <p>See also <a href="#topDock">topDock</a>(), <a href="#leftDock">leftDock</a>(), and <a href="#rightDock">rightDock</a>().
<h3 class=fn><a href="ntqwidget.html">TQWidget</a>&nbsp;* <a name="centralWidget"></a>TQMainWindow::centralWidget () const
</h3>
Returns a pointer to the main window's central widget.
<p> The central widget is surrounded by the left, top, right and
bottom dock areas. The menu bar is above the top dock area.
<p> <p>See also <a href="#setCentralWidget">setCentralWidget</a>().
<p>Example: <a href="qfd-example.html#x2013">qfd/qfd.cpp</a>.
<h3 class=fn>void <a name="childEvent"></a>TQMainWindow::childEvent ( <a href="qchildevent.html">TQChildEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
</h3>
Monitors events, recieved in <em>e</em>, to ensure the layout is updated.
<p>Reimplemented from <a href="ntqobject.html#childEvent">TQObject</a>.
<h3 class=fn><a href="ntqpopupmenu.html">TQPopupMenu</a>&nbsp;* <a name="createDockWindowMenu"></a>TQMainWindow::createDockWindowMenu ( <a href="ntqmainwindow.html#DockWindows-enum">DockWindows</a>&nbsp;dockWindows = AllDockWindows ) const
</h3>
Creates the dock window menu which contains all toolbars (if <em>dockWindows</em> is <a href="#DockWindows-enum">OnlyToolBars</a> ), all dock windows (if <em>dockWindows</em> is <a href="#DockWindows-enum">NoToolBars</a>) or all toolbars and dock windows (if
<em>dockWindows</em> is <a href="#DockWindows-enum">AllDockWindows</a> - the default).
<p> This function is called internally when necessary, e.g. when the
user right clicks a dock area (providing <a href="#isDockMenuEnabled">isDockMenuEnabled</a>()
returns TRUE).
<p> The menu items representing the toolbars and dock windows are
checkable. The visible dock windows are checked and the hidden
dock windows are unchecked. The user can click a menu item to
change its state (show or hide the dock window).
<p> The list and the state are always kept up-to-date.
<p> Toolbars and dock windows which are not appropriate in the current
context (see <a href="#setAppropriate">setAppropriate</a>()) are not listed in the menu.
<p> The menu also has a menu item for lining up the dock windows.
<p> If <a href="#isCustomizable">isCustomizable</a>() returns TRUE, a Customize menu item is added
to the menu, which if clicked will call <a href="#customize">customize</a>(). The
isCustomizable() function we provide returns FALSE and customize()
does nothing, so they must be reimplemented in a subclass to be
useful.
<h3 class=fn>void <a name="customize"></a>TQMainWindow::customize ()<tt> [virtual slot]</tt>
</h3>
This function is called when the user clicks the Customize menu
item on the dock window menu.
<p> The customize menu item will only appear if <a href="#isCustomizable">isCustomizable</a>()
returns TRUE (it returns FALSE by default).
<p> The function is intended, for example, to provide the user with a
means of telling the application that they wish to customize the
main window, dock windows or dock areas.
<p> The default implementation does nothing and the Customize menu
item is not shown on the right-click menu by default. If you want
the item to appear then reimplement isCustomizable() to return
TRUE, and reimplement this function to do whatever you want.
<p> <p>See also <a href="#isCustomizable">isCustomizable</a>().
<h3 class=fn>void <a name="dockWindowPositionChanged"></a>TQMainWindow::dockWindowPositionChanged ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dockWindow )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the <em>dockWindow</em> has changed its
position. A change in position occurs when a dock window is moved
within its dock area or moved to another dock area (including the
<a href="ntqt.html#Dock-enum">Minimized</a> and <tt>TearOff</tt> dock areas).
<p> <p>See also <a href="#getLocation">getLocation</a>().
<h3 class=fn><a href="ntqptrlist.html">TQPtrList</a>&lt;TQDockWindow&gt; <a name="dockWindows"></a>TQMainWindow::dockWindows ( <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;dock ) const
</h3>
Returns a list of all the dock windows which are in the <em>dock</em>
dock area, regardless of their state.
<p> For example, the <a href="ntqt.html#Dock-enum">DockTornOff</a> dock area may contain closed dock
windows but these are returned along with the visible dock
windows.
<h3 class=fn><a href="ntqptrlist.html">TQPtrList</a>&lt;TQDockWindow&gt; <a name="dockWindows-2"></a>TQMainWindow::dockWindows () const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the list of dock windows which belong to this main window,
regardless of which dock area they are in or what their state is,
(e.g. irrespective of whether they are visible or not).
<h3 class=fn>bool <a name="dockWindowsMovable"></a>TQMainWindow::dockWindowsMovable () const
</h3><p>Returns TRUE if the dock windows are movable; otherwise returns FALSE.
See the <a href="ntqmainwindow.html#dockWindowsMovable-prop">"dockWindowsMovable"</a> property for details.
<h3 class=fn>bool <a name="getLocation"></a>TQMainWindow::getLocation ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dw, <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;&amp;&nbsp;dock, int&nbsp;&amp;&nbsp;index, bool&nbsp;&amp;&nbsp;nl, int&nbsp;&amp;&nbsp;extraOffset ) const
</h3>
Finds the location of the dock window <em>dw</em>.
<p> If the <em>dw</em> dock window is found in the main window the function
returns TRUE and populates the <em>dock</em> variable with the dw's dock
area and the <em>index</em> with the dw's position within the dock area.
It also sets <em>nl</em> to TRUE if the <em>dw</em> begins a new line
(otherwise FALSE), and <em>extraOffset</em> with the dock window's offset.
<p> If the <em>dw</em> dock window is not found then the function returns
FALSE and the state of <em>dock</em>, <em>index</em>, <em>nl</em> and <em>extraOffset</em>
is undefined.
<p> If you want to save and restore dock window positions then use
<a href="#operator-gt-gt">operator&gt;&gt;</a>() and <a href="#operator-lt-lt">operator&lt;&lt;</a>().
<p> <p>See also <a href="#operator-gt-gt">operator&gt;&gt;</a>() and <a href="#operator-lt-lt">operator&lt;&lt;</a>().
<h3 class=fn>bool <a name="hasDockWindow"></a>TQMainWindow::hasDockWindow ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dw )
</h3>
Returns TRUE if <em>dw</em> is a dock window known to the main window;
otherwise returns FALSE.
<h3 class=fn>bool <a name="isCustomizable"></a>TQMainWindow::isCustomizable () const<tt> [virtual]</tt>
</h3>
Returns TRUE if the dock area dock window menu includes the
Customize menu item (which calls <a href="#customize">customize</a>() when clicked).
Returns FALSE by default, i.e. the popup menu will not contain a
Customize menu item. You will need to reimplement this function
and set it to return TRUE if you wish the user to be able to see
the dock window menu.
<p> <p>See also <a href="#customize">customize</a>().
<h3 class=fn>bool <a name="isDockEnabled"></a>TQMainWindow::isDockEnabled ( <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;dock ) const
</h3>
Returns TRUE if the <em>dock</em> dock area is enabled, i.e. it can
accept user dragged dock windows; otherwise returns FALSE.
<p> <p>See also <a href="#setDockEnabled">setDockEnabled</a>().
<h3 class=fn>bool <a name="isDockEnabled-2"></a>TQMainWindow::isDockEnabled ( <a href="ntqdockarea.html">TQDockArea</a>&nbsp;*&nbsp;area ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if dock area <em>area</em> is enabled, i.e. it can accept
user dragged dock windows; otherwise returns FALSE.
<p> <p>See also <a href="#setDockEnabled">setDockEnabled</a>().
<h3 class=fn>bool <a name="isDockEnabled-3"></a>TQMainWindow::isDockEnabled ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;tb, <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;dock ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if dock area <em>dock</em> is enabled for the dock window
<em>tb</em>; otherwise returns FALSE.
<p> <p>See also <a href="#setDockEnabled">setDockEnabled</a>().
<h3 class=fn>bool <a name="isDockEnabled-4"></a>TQMainWindow::isDockEnabled ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dw, <a href="ntqdockarea.html">TQDockArea</a>&nbsp;*&nbsp;area ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if dock area <em>area</em> is enabled for the dock window
<em>dw</em>; otherwise returns FALSE.
<p> <p>See also <a href="#setDockEnabled">setDockEnabled</a>().
<h3 class=fn>bool <a name="isDockMenuEnabled"></a>TQMainWindow::isDockMenuEnabled () const
</h3>
Returns TRUE, if the dock window menu is enabled; otherwise
returns FALSE.
<p> The menu lists the (<a href="#appropriate">appropriate</a>()) dock windows (which may be
shown or hidden), and has a "Line Up Dock Windows" menu item. It
will also have a "Customize" menu item if <a href="#isCustomizable">isCustomizable</a>() returns
TRUE.
<p> <p>See also <a href="#setDockEnabled">setDockEnabled</a>(), <a href="#lineUpDockWindows">lineUpDockWindows</a>(), <a href="#appropriate">appropriate</a>(), and <a href="#setAppropriate">setAppropriate</a>().
<h3 class=fn><a href="ntqdockarea.html">TQDockArea</a>&nbsp;* <a name="leftDock"></a>TQMainWindow::leftDock () const
</h3>
Returns the <a href="ntqt.html#Dock-enum">Left</a> dock area
<p> <p>See also <a href="#rightDock">rightDock</a>(), <a href="#topDock">topDock</a>(), and <a href="#bottomDock">bottomDock</a>().
<h3 class=fn>void <a name="lineUpDockWindows"></a>TQMainWindow::lineUpDockWindows ( bool&nbsp;keepNewLines = FALSE )
</h3>
This function will line up dock windows within the visible dock
areas (<a href="ntqt.html#Dock-enum">Top</a>, <a href="ntqt.html#Dock-enum">Left</a>, <a href="ntqt.html#Dock-enum">Right</a> and <a href="ntqt.html#Dock-enum">Bottom</a>) as compactly as
possible.
<p> If <em>keepNewLines</em> is TRUE, all dock windows stay on their
original lines. If <em>keepNewLines</em> is FALSE then newlines may be
removed to achieve the most compact layout possible.
<p> The method only works if <a href="#dockWindowsMovable">dockWindowsMovable</a>() returns TRUE.
<h3 class=fn>void <a name="lineUpToolBars"></a>TQMainWindow::lineUpToolBars ( bool&nbsp;keepNewLines = FALSE )
</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>
<h3 class=fn>void <a name="menuAboutToShow"></a>TQMainWindow::menuAboutToShow ()<tt> [protected slot]</tt>
</h3>
This slot is called from the aboutToShow() signal of the default
dock menu of the mainwindow. The default implementation
initializes the menu with all dock windows and toolbars in this
slot.
<h3 class=fn><a href="ntqmenubar.html">TQMenuBar</a>&nbsp;* <a name="menuBar"></a>TQMainWindow::menuBar () const
</h3>
Returns the menu bar for this window.
<p> If there isn't one, then <a href="#menuBar">menuBar</a>() creates an empty menu bar.
<p> <p>See also <a href="#statusBar">statusBar</a>().
<h3 class=fn>void <a name="moveDockWindow"></a>TQMainWindow::moveDockWindow ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dockWindow, <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;edge = DockTop )<tt> [virtual]</tt>
</h3>
Moves <em>dockWindow</em> to the end of the <em>edge</em>.
<p> For vertical edges the end is at the bottom, for horizontal edges
(including <a href="ntqt.html#Dock-enum">Minimized</a>) the end is at the right.
<p> If <em>dockWindow</em> is managed by another main window, it is first
removed from that window.
<h3 class=fn>void <a name="moveDockWindow-2"></a>TQMainWindow::moveDockWindow ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dockWindow, <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;edge, bool&nbsp;nl, int&nbsp;index, int&nbsp;extraOffset = -1 )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Moves <em>dockWindow</em> to position <em>index</em> within the <em>edge</em> dock
area.
<p> Any dock windows with positions <em>index</em> or higher have their
position number incremented and any of these on the same line are
moved right (down for vertical dock areas) to make room.
<p> If <em>nl</em> is TRUE, a new dock window line is created below the line
in which the moved dock window appears and the moved dock window,
with any others with higher positions on the same line, is moved
to this new line.
<p> The <em>extraOffset</em> is the space to put between the left side of
the dock area (top side for vertical dock areas) and the dock
window. (This is mostly used for restoring dock windows to the
positions the user has dragged them to.)
<p> If <em>dockWindow</em> is managed by another main window, it is first
removed from that window.
<h3 class=fn>void <a name="moveToolBar"></a>TQMainWindow::moveToolBar ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*, <a href="ntqt.html#Dock-enum">Dock</a> = DockTop )
</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>
<h3 class=fn>void <a name="moveToolBar-2"></a>TQMainWindow::moveToolBar ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*, <a href="ntqt.html#Dock-enum">Dock</a>, bool&nbsp;nl, int&nbsp;index, int&nbsp;extraOffset = -1 )
</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> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn>bool <a name="opaqueMoving"></a>TQMainWindow::opaqueMoving () const
</h3><p>Returns TRUE if dock windows are moved opaquely; otherwise returns FALSE.
See the <a href="ntqmainwindow.html#opaqueMoving-prop">"opaqueMoving"</a> property for details.
<h3 class=fn>void <a name="pixmapSizeChanged"></a>TQMainWindow::pixmapSizeChanged ( bool )<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever the <a href="#setUsesBigPixmaps">setUsesBigPixmaps</a>() is called
with a value different to the current setting. All widgets that
should respond to such changes, e.g. toolbar buttons, must connect
to this signal.
<h3 class=fn>void <a name="removeDockWindow"></a>TQMainWindow::removeDockWindow ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dockWindow )<tt> [virtual]</tt>
</h3>
Removes <em>dockWindow</em> from the main window's docking area,
provided <em>dockWindow</em> is non-null and managed by this main
window.
<h3 class=fn>void <a name="removeToolBar"></a>TQMainWindow::removeToolBar ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;* )
</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>
<h3 class=fn><a href="ntqdockarea.html">TQDockArea</a>&nbsp;* <a name="rightDock"></a>TQMainWindow::rightDock () const
</h3>
Returns the <a href="ntqt.html#Dock-enum">Right</a> dock area
<p> <p>See also <a href="#leftDock">leftDock</a>(), <a href="#topDock">topDock</a>(), and <a href="#bottomDock">bottomDock</a>().
<h3 class=fn>bool <a name="rightJustification"></a>TQMainWindow::rightJustification () const
</h3><p>Returns TRUE if the main window right-justifies its dock windows; otherwise returns FALSE.
See the <a href="ntqmainwindow.html#rightJustification-prop">"rightJustification"</a> property for details.
<h3 class=fn>void <a name="setAppropriate"></a>TQMainWindow::setAppropriate ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dw, bool&nbsp;a )<tt> [virtual slot]</tt>
</h3>
Use this function to control whether or not the <em>dw</em> dock
window's caption should appear as a menu item on the dock window
menu that lists the dock windows.
<p> If <em>a</em> is TRUE then the <em>dw</em> will appear as a menu item on the
dock window menu. The user is able to change the state (show or
hide) a dock window that has a menu item by clicking the item;
depending on the state of your application, this may or may not be
appropriate. If <em>a</em> is FALSE the <em>dw</em> will not appear on the
popup menu.
<p> <p>See also <a href="#showDockMenu">showDockMenu</a>(), <a href="#isCustomizable">isCustomizable</a>(), and <a href="#customize">customize</a>().
<h3 class=fn>void <a name="setCentralWidget"></a>TQMainWindow::setCentralWidget ( <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;w )<tt> [virtual]</tt>
</h3>
Sets the central widget for this main window to <em>w</em>.
<p> The central widget is surrounded by the left, top, right and
bottom dock areas. The menu bar is above the top dock area.
<p> <p>See also <a href="#centralWidget">centralWidget</a>().
<h3 class=fn>void <a name="setDockEnabled"></a>TQMainWindow::setDockEnabled ( <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;dock, bool&nbsp;enable )<tt> [virtual]</tt>
</h3>
If <em>enable</em> is TRUE then users can dock windows in the <em>dock</em>
area. If <em>enable</em> is FALSE users cannot dock windows in the <em>dock</em> dock area.
<p> Users can dock (drag) dock windows into any enabled dock area.
<h3 class=fn>void <a name="setDockEnabled-2"></a>TQMainWindow::setDockEnabled ( <a href="ntqdockwindow.html">TQDockWindow</a>&nbsp;*&nbsp;dw, <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;dock, bool&nbsp;enable )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> If <em>enable</em> is TRUE then users can dock the <em>dw</em> dock window in
the <em>dock</em> area. If <em>enable</em> is FALSE users cannot dock the <em>dw</em> dock window in the <em>dock</em> area.
<p> In general users can dock (drag) dock windows into any enabled
dock area. Using this function particular dock areas can be
enabled (or disabled) as docking points for particular dock
windows.
<h3 class=fn>void <a name="setDockMenuEnabled"></a>TQMainWindow::setDockMenuEnabled ( bool&nbsp;b )<tt> [virtual slot]</tt>
</h3>
If <em>b</em> is TRUE, then right clicking on a dock window or dock area
will pop up the dock window menu. If <em>b</em> is FALSE, right clicking
a dock window or dock area will not pop up the menu.
<p> The menu lists the (<a href="#appropriate">appropriate</a>()) dock windows (which may be
shown or hidden), and has a "Line Up Dock Windows" item. It will
also have a "Customize" menu item if <a href="#isCustomizable">isCustomizable</a>() returns
TRUE.
<p> <p>See also <a href="#lineUpDockWindows">lineUpDockWindows</a>() and <a href="#isDockMenuEnabled">isDockMenuEnabled</a>().
<h3 class=fn>void <a name="setDockWindowsMovable"></a>TQMainWindow::setDockWindowsMovable ( bool )<tt> [virtual slot]</tt>
</h3><p>Sets whether the dock windows are movable.
See the <a href="ntqmainwindow.html#dockWindowsMovable-prop">"dockWindowsMovable"</a> property for details.
<h3 class=fn>void <a name="setOpaqueMoving"></a>TQMainWindow::setOpaqueMoving ( bool )<tt> [virtual slot]</tt>
</h3><p>Sets whether dock windows are moved opaquely.
See the <a href="ntqmainwindow.html#opaqueMoving-prop">"opaqueMoving"</a> property for details.
<h3 class=fn>void <a name="setRightJustification"></a>TQMainWindow::setRightJustification ( bool )<tt> [virtual slot]</tt>
</h3><p>Sets whether the main window right-justifies its dock windows.
See the <a href="ntqmainwindow.html#rightJustification-prop">"rightJustification"</a> property for details.
<h3 class=fn>void <a name="setToolBarsMovable"></a>TQMainWindow::setToolBarsMovable ( bool )<tt> [slot]</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>
<h3 class=fn>void <a name="setUpLayout"></a>TQMainWindow::setUpLayout ()<tt> [virtual protected slot]</tt>
</h3>
Sets up the geometry management of the window. It is called
automatically when needed, so you shouldn't need to call it.
<h3 class=fn>void <a name="setUsesBigPixmaps"></a>TQMainWindow::setUsesBigPixmaps ( bool )<tt> [virtual slot]</tt>
</h3><p>Sets whether big pixmaps are enabled.
See the <a href="ntqmainwindow.html#usesBigPixmaps-prop">"usesBigPixmaps"</a> property for details.
<h3 class=fn>void <a name="setUsesTextLabel"></a>TQMainWindow::setUsesTextLabel ( bool )<tt> [virtual slot]</tt>
</h3><p>Sets whether text labels for toolbar buttons are enabled.
See the <a href="ntqmainwindow.html#usesTextLabel-prop">"usesTextLabel"</a> property for details.
<h3 class=fn>bool <a name="showDockMenu"></a>TQMainWindow::showDockMenu ( const&nbsp;<a href="ntqpoint.html">TQPoint</a>&nbsp;&amp;&nbsp;globalPos )<tt> [virtual protected slot]</tt>
</h3>
Shows the dock menu at the position <em>globalPos</em>. The menu lists
the dock windows so that they can be shown (or hidden), lined up,
and possibly customized. Returns TRUE if the menu is shown;
otherwise returns FALSE.
<p> If you want a custom menu, reimplement this function. You can
create the menu from scratch or call <a href="#createDockWindowMenu">createDockWindowMenu</a>() and
modify the result.
<h3 class=fn><a href="ntqstatusbar.html">TQStatusBar</a>&nbsp;* <a name="statusBar"></a>TQMainWindow::statusBar () const
</h3>
Returns this main window's status bar. If there isn't one,
<a href="#statusBar">statusBar</a>() creates an empty status bar, and if necessary a tool
tip group too.
<p> <p>See also <a href="#menuBar">menuBar</a>() and <a href="#toolTipGroup">toolTipGroup</a>().
<p>Example: <a href="qfd-example.html#x2015">qfd/qfd.cpp</a>.
<h3 class=fn>void <a name="toolBarPositionChanged"></a>TQMainWindow::toolBarPositionChanged ( <a href="ntqtoolbar.html">TQToolBar</a>&nbsp;* )<tt> [signal]</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>
<h3 class=fn><a href="ntqptrlist.html">TQPtrList</a>&lt;TQToolBar&gt; <a name="toolBars"></a>TQMainWindow::toolBars ( <a href="ntqt.html#Dock-enum">Dock</a>&nbsp;dock ) const
</h3>
Returns a list of all the toolbars which are in the <em>dock</em> dock
area, regardless of their state.
<p> For example, the <a href="ntqt.html#Dock-enum">TornOff</a> dock area may contain closed toolbars
but these are returned along with the visible toolbars.
<p> <p>See also <a href="#dockWindows">dockWindows</a>().
<h3 class=fn>bool <a name="toolBarsMovable"></a>TQMainWindow::toolBarsMovable () const
</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>
<h3 class=fn><a href="qtooltipgroup.html">TQToolTipGroup</a>&nbsp;* <a name="toolTipGroup"></a>TQMainWindow::toolTipGroup () const
</h3>
Returns this main window's tool tip group. If there isn't one,
<a href="#toolTipGroup">toolTipGroup</a>() creates an empty tool tip group.
<p> <p>See also <a href="#menuBar">menuBar</a>() and <a href="#statusBar">statusBar</a>().
<h3 class=fn><a href="ntqdockarea.html">TQDockArea</a>&nbsp;* <a name="topDock"></a>TQMainWindow::topDock () const
</h3>
Returns the <a href="ntqt.html#Dock-enum">Top</a> dock area
<p> <p>See also <a href="#bottomDock">bottomDock</a>(), <a href="#leftDock">leftDock</a>(), and <a href="#rightDock">rightDock</a>().
<h3 class=fn>bool <a name="usesBigPixmaps"></a>TQMainWindow::usesBigPixmaps () const
</h3><p>Returns TRUE if big pixmaps are enabled; otherwise returns FALSE.
See the <a href="ntqmainwindow.html#usesBigPixmaps-prop">"usesBigPixmaps"</a> property for details.
<h3 class=fn>bool <a name="usesTextLabel"></a>TQMainWindow::usesTextLabel () const
</h3><p>Returns TRUE if text labels for toolbar buttons are enabled; otherwise returns FALSE.
See the <a href="ntqmainwindow.html#usesTextLabel-prop">"usesTextLabel"</a> property for details.
<h3 class=fn>void <a name="usesTextLabelChanged"></a>TQMainWindow::usesTextLabelChanged ( bool )<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever the <a href="#setUsesTextLabel">setUsesTextLabel</a>() is called
with a value different to the current setting. All widgets that
should respond to such changes, e.g. toolbar buttons, must connect
to this signal.
<h3 class=fn>void <a name="whatsThis"></a>TQMainWindow::whatsThis ()<tt> [virtual slot]</tt>
</h3>
Enters 'What's This?' mode and returns immediately.
<p> This is the same as <a href="ntqwhatsthis.html#enterWhatsThisMode">TQWhatsThis::enterWhatsThisMode</a>(), but
implemented as a main window object's slot. This way it can easily
be used for popup menus, for example:
<p> <pre>
<a href="ntqpopupmenu.html">TQPopupMenu</a> * help = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this );
help-&gt;<a href="ntqmenudata.html#insertItem">insertItem</a>( "What's &amp;This", this , TQ_SLOT(<a href="#whatsThis">whatsThis</a>()), SHIFT+Key_F1);
</pre>
<p> <p>See also <a href="ntqwhatsthis.html#enterWhatsThisMode">TQWhatsThis::enterWhatsThisMode</a>().
<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="dockWindowsMovable-prop"></a>dockWindowsMovable</h3>
<p>This property holds whether the dock windows are movable.
<p>If TRUE (the default), the user will be able to move movable dock
windows from one TQMainWindow dock area to another, including the
<tt>TearOff</tt> area (i.e. where the dock window floats freely as a
window in its own right), and the <a href="ntqt.html#Dock-enum">Minimized</a> area (where only
the dock window's handle is shown below the menu bar). Moveable
dock windows can also be moved within TQMainWindow dock areas, i.e.
to rearrange them within a dock area.
<p> If FALSE the user will not be able to move any dock windows.
<p> By default dock windows are moved transparently (i.e. only an
outline rectangle is shown during the drag), but this setting can
be changed with <a href="#setOpaqueMoving">setOpaqueMoving</a>().
<p> <p>See also <a href="#setDockEnabled">setDockEnabled</a>() and <a href="#opaqueMoving-prop">opaqueMoving</a>.
<p>Set this property's value with <a href="#setDockWindowsMovable">setDockWindowsMovable</a>() and get this property's value with <a href="#dockWindowsMovable">dockWindowsMovable</a>().
<h3 class=fn>bool <a name="opaqueMoving-prop"></a>opaqueMoving</h3>
<p>This property holds whether dock windows are moved opaquely.
<p>If TRUE the dock windows of the main window are shown opaquely
(i.e. it shows the toolbar as it looks when docked) whilst it is
being moved. If FALSE (the default) they are shown transparently,
(i.e. as an outline rectangle).
<p> <b>Warning:</b> Opaque moving of toolbars and dockwindows is known to
have several problems. We recommend avoiding the use of this
feature for the time being. We intend fixing the problems in a
future release.
<p>Set this property's value with <a href="#setOpaqueMoving">setOpaqueMoving</a>() and get this property's value with <a href="#opaqueMoving">opaqueMoving</a>().
<h3 class=fn>bool <a name="rightJustification-prop"></a>rightJustification</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> <p>This property holds whether the main window right-justifies its dock windows.
<p>If disabled (the default), stretchable dock windows are expanded,
and non-stretchable dock windows are given the minimum space they
need. Since most dock windows are not stretchable, this usually
results in an unjustified right edge (or unjustified bottom edge
for a vertical dock area). If enabled, the main window will
right-justify its dock windows.
<p> <p>See also <a href="ntqdockwindow.html#setVerticalStretchable">TQDockWindow::setVerticalStretchable</a>() and <a href="ntqdockwindow.html#setHorizontalStretchable">TQDockWindow::setHorizontalStretchable</a>().
<p>Set this property's value with <a href="#setRightJustification">setRightJustification</a>() and get this property's value with <a href="#rightJustification">rightJustification</a>().
<h3 class=fn>bool <a name="usesBigPixmaps-prop"></a>usesBigPixmaps</h3>
<p>This property holds whether big pixmaps are enabled.
<p>If FALSE (the default), the tool buttons will use small pixmaps;
otherwise big pixmaps will be used.
<p> Tool buttons and other widgets that wish to respond to this
setting are responsible for reading the correct state on startup,
and for connecting to the main window's widget's
<a href="#pixmapSizeChanged">pixmapSizeChanged</a>() signal.
<p>Set this property's value with <a href="#setUsesBigPixmaps">setUsesBigPixmaps</a>() and get this property's value with <a href="#usesBigPixmaps">usesBigPixmaps</a>().
<h3 class=fn>bool <a name="usesTextLabel-prop"></a>usesTextLabel</h3>
<p>This property holds whether text labels for toolbar buttons are enabled.
<p>If disabled (the default), the tool buttons will not use text
labels. If enabled, text labels will be used.
<p> Tool buttons and other widgets that wish to respond to this
setting are responsible for reading the correct state on startup,
and for connecting to the main window's widget's
<a href="#usesTextLabelChanged">usesTextLabelChanged</a>() signal.
<p> <p>See also <a href="ntqtoolbutton.html#usesTextLabel-prop">TQToolButton::usesTextLabel</a>.
<p>Set this property's value with <a href="#setUsesTextLabel">setUsesTextLabel</a>() and get this property's value with <a href="#usesTextLabel">usesTextLabel</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="ntqtextstream.html">TQTextStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="ntqtextstream.html">TQTextStream</a>&nbsp;&amp;&nbsp;ts, const&nbsp;<a href="ntqmainwindow.html">TQMainWindow</a>&nbsp;&amp;&nbsp;mainWindow )
</h3>
<p> Writes the layout (sizes and positions) of the dock windows in the
dock areas of the TQMainWindow <em>mainWindow</em>, including <a href="ntqt.html#Dock-enum">Minimized</a> and <a href="ntqt.html#Dock-enum">TornOff</a> dock windows, to the text stream <em>ts</em>.
<p> This can be used, for example, in conjunction with <a href="ntqsettings.html">TQSettings</a> to
save the user's layout when the \mainWindow receives a closeEvent.
<p> <p>See also <a href="#operator-gt-gt">operator&gt;&gt;</a>() and <a href="ntqwidget.html#closeEvent">closeEvent</a>().
<h3 class=fn><a href="ntqtextstream.html">TQTextStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="ntqtextstream.html">TQTextStream</a>&nbsp;&amp;&nbsp;ts, <a href="ntqmainwindow.html">TQMainWindow</a>&nbsp;&amp;&nbsp;mainWindow )
</h3>
<p> Reads the layout (sizes and positions) of the dock windows in the
dock areas of the TQMainWindow <em>mainWindow</em> from the text stream,
<em>ts</em>, including <a href="ntqt.html#Dock-enum">Minimized</a> and <a href="ntqt.html#Dock-enum">TornOff</a> dock windows.
Restores the dock windows and dock areas to these sizes and
positions. The layout information must be in the format produced
by <a href="#operator-lt-lt">operator&lt;&lt;</a>().
<p> This can be used, for example, in conjunction with <a href="ntqsettings.html">TQSettings</a> to
restore the user's layout.
<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">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>