1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QDialog Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QDialog Class Reference</h1><br clear="all">
<p>
The QDialog class is the base class of dialog windows.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qdialog-h.html">qdialog.h</a>></code>
<p>
Inherits <a href="qwidget.html">QWidget</a>.
<p>Inherited by <a href="qcolordialog.html">QColorDialog</a>, <a href="qfiledialog.html">QFileDialog</a>, <a href="qfontdialog.html">QFontDialog</a>, <a href="qinputdialog.html">QInputDialog</a>, <a href="qmessagebox.html">QMessageBox</a>, <a href="qprintdialog.html">QPrintDialog</a>, <a href="qtabdialog.html">QTabDialog</a> and <a href="qwizard.html">QWizard</a>.
<p><a href="qdialog-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#3bf3ac"><b>QDialog</b></a>(QWidget*parent=0, constchar*name=0, boolmodal=FALSE, WFlagsf=0)</div>
<li><div class="fn"><a href="#0d706a"><b>~QDialog</b></a>()</div>
<li><div class="fn">enum<b>DialogCode</b>{Rejected, Accepted}</div>
<li><div class="fn">int<a href="#0beb1a"><b>exec</b></a>()</div>
<li><div class="fn">int<a href="#827937"><b>result</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#bfe29c"><b>show</b></a>()</div>
<li><div class="fn">void<b>setOrientation</b>(Orientationorientation)</div>
<li><div class="fn">Orientation<a href="#ba9c31"><b>orientation</b></a>()const</div>
<li><div class="fn">void<a href="#e68e4c"><b>setExtension</b></a>(QWidget*extension)</div>
<li><div class="fn">QWidget*<a href="#b361c0"><b>extension</b></a>()const</div>
<li><div class="fn">void<a href="#0a585b"><b>setSizeGripEnabled</b></a>(bool)</div>
<li><div class="fn">bool<a href="#6eaf00"><b>isSizeGripEnabled</b></a>()const</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">void<a href="#efd31d"><b>setResult</b></a>(intr)</div>
</ul>
<h2>Protected Slots</h2>
<ul>
<li><div class="fn">virtualvoid<a href="#a2afe3"><b>done</b></a>(int)</div>
<li><div class="fn">virtualvoid<a href="#82d406"><b>accept</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#604679"><b>reject</b></a>()</div>
<li><div class="fn">void<a href="#a1f41d"><b>showExtension</b></a>(bool)</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>bool<td>sizeGripEnabled<td>isSizeGripEnabled<td>setSizeGripEnabled<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QDialog class is the base class of dialog windows.
<p>
A dialog window is a top-level window used for short-term tasks and
brief communications with the user. QDialog offers mechanisms such
as modality, default buttons, extensibility and a result value.
<p>Modality means that the dialog blocks input to other windows: The
user <em>has</em> to finish interacting with the dialog and close it
before resuming work with the other window(s). The only way to set
modality is by using the constructor, and the default is
modelessness. For modal dialog, it's generally better to call
<a href="#0beb1a">exec</a>() than show; exec() returns when the dialog has been closed and
has a useful return value (see below).
<p>The default button is the button that's pressed when the user
presses Enter or Return, to accept the things done using this dialog
and close it. QDialog uses <a href="qpushbutton.html#0a887a">QPushButton::autoDefault</a>(),
<a href="qpushbutton.html#ee0b8c">QPushButton::isDefault</a>() and <a href="qpushbutton.html#d415f9">QPushButton::setDefault</a>() to make Enter
or Return map to the right button at any time.
<p>Extensibility is the ability to show more or less of the
dialog. Typically, the dialog starts out small, has a "More" button,
and when the user clicks "More", the dialog becomes bigger, and
shows some less-used options. QDialog supports this using
<a href="#e68e4c">setExtension</a>(), <a href="#ae22ae">setOrientation</a>() and <a href="#a1f41d">showExtension</a>().
<p>Since dialogs typically tend to have result value (pressing
Enter/Return maps to one value and pressing Escape to the other),
QDialog supports that. A dialog can finish by calling the slots
<a href="#82d406">accept</a>() or <a href="#604679">reject</a>(), and exec() returns that result.
<p>Note that QDialog uses the parent widget a bit differently from
other classes in Qt. A dialog is always a top-level widget, but if
it has a parent, its default location is on top of the parent, it
shares taskbar entry with its parent, and there are some minor
details.
<p>QDialog also can provide a <a href="qsizegrip.html">QSizeGrip</a> in its lower-right corner. If
you want that, call <a href="#0a585b">setSizeGripEnabled</a>( TRUE ).
<p>See also <a href="qtabdialog.html">QTabDialog</a>, <a href="qwidget.html">QWidget</a>, <a href="qsemimodal.html">QSemiModal</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Dialogs, Standard.</a>
<p>Examples:
<a href="i18n-main-cpp.html#QDialog">i18n/main.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="3bf3ac"></a>QDialog::QDialog(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0, boolmodal=FALSE, WFlagsf=0)</h3>
<p>Constructs a dialog named <em>name,</em> which has a parent widget <em>parent.</em>
<p>The dialog is modal (blocks input to other windows) if <em>modal</em> is
TRUE, and modeless if <em>modal</em> is FALSE (this is the default).
<p>The widget flags <em>f</em> are sent to the <a href="qwidget.html">QWidget</a> constructor, as usual.
<p>If you e.g. don't want a What's this button in the titlebar of the dialog,
pass WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu
here.
<p>We recommend always passing a parent.
<p>See also <a href="qwidget.html#9dd055">QWidget::setWFlags</a> and <a href="qt.html#WidgetFlags">Qt::WidgetFlags</a>.
<h3 class="fn"><a name="0d706a"></a>QDialog::~QDialog()</h3>
<p>Destructs the QDialog, deleting all its children.
<h3 class="fn">void<a name="82d406"></a>QDialog::accept() <code>[virtualprotected slot]</code></h3>
<p>Hides the dialog and sets the result code to <code>Accepted.</code>
<h3 class="fn">void<a name="21ef0e"></a>QDialog::closeEvent(<a href="qcloseevent.html">QCloseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#c04094">QWidget.</a>
<h3 class="fn">void<a name="a2afe3"></a>QDialog::done(intr) <code>[virtualprotected slot]</code></h3>
<p>Hides the (modal) dialog and sets its result code to <em>r.</em> This
uses the local event loop to finish and <a href="#0beb1a">exec</a>() to return <em>r.</em>
<p>If the dialog has the <code>WDestructiveClose</code> flag set, done() also
deletes the dialog. If the dialog is the applications's main widget,
the application quits.
<p>See also <a href="#82d406">accept</a>(), <a href="#604679">reject</a>(), <a href="qapplication.html#85380c">QApplication::mainWidget</a>() and <a href="qapplication.html#1af5b8">QApplication::quit</a>().
<p>Reimplemented in <a href="qfiledialog.html#81ccad">QFileDialog</a>.
<h3 class="fn">int<a name="0beb1a"></a>QDialog::exec()</h3>
<p>Starts the (modal) dialog, waits, and returns the result code when
it is done.
<p>If the dialog is modeless, the behaviour of this function is
undefined.
<p>See also <a href="#bfe29c">show</a>() and <a href="#827937">result</a>().
<p>Examples:
<a href="wizard-main-cpp.html#exec">wizard/main.cpp</a>
<a href="i18n-main-cpp.html#exec">i18n/main.cpp</a>
<h3 class="fn"><a href="qwidget.html">QWidget</a>*<a name="b361c0"></a>QDialog::extension()const</h3>
<p>Returns the dialog's extension or 0 if no extension has been
defined.
<p>See also <a href="#e68e4c">setExtension</a>().
<h3 class="fn">void<a name="74d5c5"></a>QDialog::hide() <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#410481">QWidget.</a>
<h3 class="fn">bool<a name="6eaf00"></a>QDialog::isSizeGripEnabled()const</h3>
<p>Returns TRUE if the QDialog has a <a href="qsizegrip.html">QSizeGrip</a> in the bottom right of
the dialog, and FALSE if it does not.
<p>See also <a href="#0a585b">setSizeGripEnabled</a>().
<h3 class="fn">void<a name="8acb39"></a>QDialog::keyPressEvent(<a href="qkeyevent.html">QKeyEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#0a4482">QWidget.</a>
<h3 class="fn"><a href="qsize.html">QSize</a><a name="e53930"></a>QDialog::minimumSizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#553e08">QWidget.</a>
<h3 class="fn">void<a name="89fdd4"></a>QDialog::move(const<a href="qpoint.html">QPoint</a>&p)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="9c89b3"></a>QDialog::move(intx, inty) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#39930b">QWidget.</a>
<h3 class="fn">Qt::Orientation<a name="ba9c31"></a>QDialog::orientation()const</h3>
<p>Returns the extension direction of the dialog.
<p>See also <a href="#ae22ae">setOrientation</a>().
<h3 class="fn">void<a name="604679"></a>QDialog::reject() <code>[virtualprotected slot]</code></h3>
<p>Hides the dialog and sets the result code to <code>Rejected.</code>
<h3 class="fn">void<a name="9d0e95"></a>QDialog::resize(const<a href="qsize.html">QSize</a>&s)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Examples:
<a href="tabdialog-main-cpp.html#resize">tabdialog/main.cpp</a>
<h3 class="fn">void<a name="d7e510"></a>QDialog::resize(intw, inth) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#8fcbbe">QWidget.</a>
<h3 class="fn">void<a name="fc5201"></a>QDialog::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7d375f">QWidget.</a>
<h3 class="fn">int<a name="827937"></a>QDialog::result()const</h3>
<p>Returns the result code of the dialog.
<h3 class="fn">void<a name="e68e4c"></a>QDialog::setExtension(<a href="qwidget.html">QWidget</a>*extension)</h3>
<p>Sets <em>extension</em> to be the dialog's extension, or deletes the
extensions if <em>extension</em> is 0.
<p>The dialogs takes over ownership of the extension. Any previously
set extension is deleted.
<p>This function can only be called while the dialog is hidden.
<p>See also <a href="#a1f41d">showExtension</a>(), <a href="#ae22ae">setOrientation</a>() and <a href="#b361c0">extension</a>().
<h3 class="fn">void<a name="bba7b0"></a>QDialog::setGeometry(const<a href="qrect.html">QRect</a>&r) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#5e9ab1">QWidget.</a>
<h3 class="fn">void<a name="e54a1a"></a>QDialog::setGeometry(intx, inty, intw, inth) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#9ede68">QWidget.</a>
<h3 class="fn">void<a name="efd31d"></a>QDialog::setResult(int) <code>[protected]</code></h3>
<p>Sets the result code of the dialog.
<h3 class="fn">void<a name="0a585b"></a>QDialog::setSizeGripEnabled(boolenabled)</h3>
<p>Enables or disables the <a href="qsizegrip.html">QSizeGrip</a> in the bottom right of the dialog.
By default, the size grip is disabled.
<p>See also <a href="#6eaf00">isSizeGripEnabled</a>().
<h3 class="fn">void<a name="bfe29c"></a>QDialog::show() <code>[virtual]</code></h3>
<p>Shows the dialog box on the screen, as <a href="qwidget.html#200ee5">QWidget::show</a>(), and
selects a suitable position and size if none has been specified yet.<p><b>Warning:</b> In Qt 2.x, calling show() on a modal dialog enters a local event
loop, and work like <a href="#0beb1a">exec</a>(), but not returning the result code exec()
returns. Trolltech has always warned against doing this.
<p>In Qt 3.0 and later, calling show() on a modal dialog will return
immediately, <em>not</em> enter a local event loop. The dialog will of
course be modal.
<p>See also <a href="#0beb1a">exec</a>().
<p>Examples:
<a href="movies-main-cpp.html#show">movies/main.cpp</a>
<p>Reimplemented from <a href="qwidget.html#200ee5">QWidget.</a>
<h3 class="fn">void<a name="a1f41d"></a>QDialog::showExtension(boolshowIt) <code>[protectedslot]</code></h3>
<p>Extends the dialog to show its extension if <em>showIt</em> is TRUE
and hides it else.
<p>This slot is usually connected to the <a href="qbutton.html#4069b1">QButton::toggled()</a> signal
of a <a href="qpushbutton.html">QPushButton</a>.
<p>If the dialog is not visible, nothing happens.
<p>See also <a href="#bfe29c">show</a>(), <a href="#e68e4c">setExtension</a>() and <a href="#ae22ae">setOrientation</a>().
<h3 class="fn"><a href="qsize.html">QSize</a><a name="864e60"></a>QDialog::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|