<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>TQDialog Class Reference</h1>
<p>The TQDialog class is the base class of dialog windows.
The TQDialog class is the base class of dialog windows.
<p>
<p> A dialog window is a top-level window mostly used for short-term
tasks and brief communications with the user. TQDialogs may be
modal or modeless. TQDialogs support <ahref="#extensibility">extensibility</a> and can provide a <ahref="#return">return
value</a>. They can have <ahref="#default">default
buttons</a>. TQDialogs can also have a <ahref="qsizegrip.html">TQSizeGrip</a> in their
lower-right corner, using <ahref="#setSizeGripEnabled">setSizeGripEnabled</a>().
<p> Note that TQDialog uses the parent widget slightly differently from
other classes in TQt. A dialog is always a top-level widget, but if
it has a parent, its default location is centered on top of the
parent's top-level widget (if it is not top-level itself). It will
also share the parent's taskbar entry.
<p><aname="modal"></a>
<h3> Modal Dialogs
</h3>
<aname="1"></a><p> A <b>modal</b> dialog is a dialog that blocks input to other
visible windows in the same application. Users must finish
interacting with the dialog and close it before they can access
any other window in the application. Dialogs that are used to
request a file name from the user or that are used to set
application preferences are usually modal.
<p> The most common way to display a modal dialog is to call its
<ahref="#exec">exec</a>() function. When the user closes the dialog, exec() will
provide a useful <ahref="#return">return value</a>. Typically we
connect a default button, e.g. "OK", to the <ahref="#accept">accept</a>() slot and a
"Cancel" button to the <ahref="#reject">reject</a>() slot, to get the dialog to close
and return the appropriate value. Alternatively you can connect to
the <ahref="#done">done</a>() slot, passing it <ahref="#DialogCode-enum">Accepted</a> or <ahref="#DialogCode-enum">Rejected</a>.
<p> An alternative is to call <ahref="#setModal">setModal</a>(TRUE), then <ahref="#show">show</a>(). Unlike
exec(), show() returns control to the caller immediately. Calling
setModal(TRUE) is especially useful for progress dialogs, where
the user must have the ability to interact with the dialog, e.g.
to cancel a long running operation. If you use show() and
setModal(TRUE) together you must call
<ahref="qapplication.html#processEvents">TQApplication::processEvents</a>() periodically during processing to
enable the user to interact with the dialog. (See <ahref="qprogressdialog.html">TQProgressDialog</a>.)
<p><aname="modeless"></a>
<h3> Modeless Dialogs
</h3>
<aname="1-1"></a><p> A <b>modeless</b> dialog is a dialog that operates
independently of other windows in the same application. Find and
replace dialogs in word-processors are often modeless to allow the
user to interact with both the application's main window and with
the dialog.
<p> Modeless dialogs are displayed using show(), which returns control
to the caller immediately.
<p><aname="default"></a>
<h3> Default button
</h3>
<aname="1-2"></a><p> A dialog's <em>default</em> button is the button that's pressed when the
user presses Enter (Return). This button is used to signify that
the user accepts the dialog's settings and wants to close the
dialog. Use <ahref="qpushbutton.html#setDefault">TQPushButton::setDefault</a>(), <ahref="qpushbutton.html#isDefault">TQPushButton::isDefault</a>()
and <ahref="qpushbutton.html#autoDefault">TQPushButton::autoDefault</a>() to set and control the dialog's
default button.
<p><aname="escapekey"></a>
<h3> Escape Key
</h3>
<aname="1-3"></a><p> If the user presses the Esc key in a dialog, <ahref="#reject">TQDialog::reject</a>()
will be called. This will cause the window to close: the <ahref="qcloseevent.html">closeEvent</a> cannot be <ahref="qcloseevent.html#ignore">ignored</a>.
<p><aname="extensibility"></a>
<h3> Extensibility
</h3>
<aname="1-4"></a><p> Extensibility is the ability to show the dialog in two ways: a
partial dialog that shows the most commonly used options, and a
full dialog that shows all the options. Typically an extensible
dialog will initially appear as a partial dialog, but with a
"More" toggle button. If the user presses the "More" button down,
the full dialog will appear. The extension widget will be resized
to its <ahref="qwidget.html#sizeHint">sizeHint</a>(). If orientation is <ahref="qt.html#Orientation-enum">Horizontal</a> the extension
widget's <ahref="qwidget.html#height">height</a>() will be expanded to the height() of the dialog.
If the orientation is <ahref="qt.html#Orientation-enum">Vertical</a> the extension widget's <ahref="qwidget.html#width">width</a>()
will be expanded to the width() of the dialog. Extensibility is
controlled with <ahref="#setExtension">setExtension</a>(), <ahref="#setOrientation">setOrientation</a>() and
<ahref="#showExtension">showExtension</a>().
<p><aname="return"></a>
<h3> Return value (modal dialogs)
</h3>
<aname="1-5"></a><p> Modal dialogs are often used in situations where a return value is
retquired, e.g. to indicate whether the user pressed "OK" or
"Cancel". A dialog can be closed by calling the <ahref="#accept">accept</a>() or the
<ahref="#reject">reject</a>() slots, and <ahref="#exec">exec</a>() will return <ahref="#DialogCode-enum">Accepted</a> or <ahref="#DialogCode-enum">Rejected</a>
as appropriate. The exec() call returns the result of the dialog.
The result is also available from <ahref="#result">result</a>() if the dialog has not
been destroyed. If the <ahref="qt.html#WidgetFlags-enum">WDestructiveClose</a> flag is set, the
dialog is deleted after exec() returns.
<p><aname="examples"></a>
<h3> Examples
</h3>
<aname="1-6"></a><p> A modal dialog.
<p>
<pre><ahref="qfiledialog.html">TQFileDialog</a> *dlg = new <ahref="qfiledialog.html">TQFileDialog</a>( workingDirectory,
</h3> Closes the dialog and sets its result code to <em>r</em>. If this dialog
is shown with <ahref="#exec">exec</a>(), <ahref="#done">done</a>() causes the local event loop to finish,
and exec() to return <em>r</em>.
<p> As with <ahref="qwidget.html#close">TQWidget::close</a>(), done() deletes the dialog if the <ahref="qt.html#WidgetFlags-enum">WDestructiveClose</a> flag is set. If the dialog is the application's
main widget, the application terminates. If the dialog is the
last window closed, the <ahref="qapplication.html#lastWindowClosed">TQApplication::lastWindowClosed</a>() signal is
<p><p>See also <ahref="#accept">accept</a>(), <ahref="#reject">reject</a>(), <ahref="qapplication.html#mainWidget">TQApplication::mainWidget</a>(), and <ahref="qapplication.html#quit">TQApplication::quit</a>().
If <em>orientation</em> is <ahref="qt.html#Orientation-enum">Horizontal</a>, the extension will be displayed
to the right of the dialog's main area. If <em>orientation</em> is <ahref="qt.html#Orientation-enum">Vertical</a>, the extension will be displayed below the dialog's main
area.
<p><p>See also <ahref="#orientation">orientation</a>() and <ahref="#setExtension">setExtension</a>().
If <em>showIt</em> is TRUE, the dialog's extension is shown; otherwise the
extension is hidden.
<p> This slot is usually connected to the <ahref="qbutton.html#toggled">TQButton::toggled</a>() signal
of a <ahref="qpushbutton.html">TQPushButton</a>.
<p> A dialog with a visible extension is not resizeable.
<p><p>See also <ahref="#show">show</a>(), <ahref="#setExtension">setExtension</a>(), and <ahref="#setOrientation">setOrientation</a>().
<hr><h2>Property Documentation</h2>
<h3class=fn>bool <aname="modal-prop"></a>modal</h3><p>This property holds whether <ahref="#show">show</a>() should pop up the dialog as modal or modeless.
<p>By default, this property is false and show() pops up the dialog as
modeless.
<p><ahref="#exec">exec</a>() ignores the value of this property and always pops up the
dialog as modal.
<p><p>See also <ahref="#show">show</a>() and <ahref="#exec">exec</a>().
<p>Set this property's value with <ahref="#setModal">setModal</a>() and get this property's value with <ahref="#isModal">isModal</a>().
<p>This property holds whether the size grip is enabled.
<p>A <ahref="qsizegrip.html">TQSizeGrip</a> is placed in the bottom right corner of the dialog when this
property is enabled. By default, the size grip is disabled.
<p>Set this property's value with <ahref="#setSizeGripEnabled">setSizeGripEnabled</a>() and get this property's value with <ahref="#isSizeGripEnabled">isSizeGripEnabled</a>().
<!-- eof -->
<hr><p>
This file is part of the <ahref="index.html">TQt toolkit</a>.