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
|
<!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 - QInputDialog 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>QInputDialog Class Reference</h1><br clear="all">
<p>
A convenience dialog to get a simple input from the user
<a href="#details">More...</a>
<p>
<code>#include <<a href="qinputdialog-h.html">qinputdialog.h</a>></code>
<p>
Inherits <a href="qdialog.html">QDialog</a>.
<p><a href="qinputdialog-members.html">List of all member functions.</a>
<h2>Static Public Members</h2>
<ul>
<li><div class="fn">QString<a href="#2c38f4"><b>getText</b></a>(constQString&caption, constQString&label, constQString&text=QString::null, bool*ok=0, QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn">QString<a href="#832521"><b>getText</b></a>(constQString&caption, constQString&label, QLineEdit::EchoModeecho, constQString&text=QString::null, bool*ok=0, QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn">int<a href="#85646d"><b>getInteger</b></a>(constQString&caption, constQString&label, intnum=0, intfrom=-2147483647, intto=2147483647, intstep=1, bool*ok=0, QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn">double<a href="#b45cb9"><b>getDouble</b></a>(constQString&caption, constQString&label, doublenum=0, doublefrom=-2147483647, doubleto=2147483647, intdecimals=1, bool*ok=0, QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn">QString<a href="#c78831"><b>getItem</b></a>(constQString&caption, constQString&label, constQStringList&list, intcurrent=0, booleditable=TRUE, bool*ok=0, QWidget*parent=0, constchar*name=0)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
A convenience dialog to get a simple input from the user
<p>
The QInputDialog is a simple dialog which can be used if you
need a simple input from the user. This can be text, a number or
an item from a list. Also a label has to be set to tell the user
what he/she should input.
<p>In this Qt version only the 4 static convenience functions
<a href="#2c38f4">getText</a>(), <a href="#85646d">getInteger</a>(), <a href="#b45cb9">getDouble</a>() and <a href="#c78831">getItem</a>() of QInputDialog
are available.
<p>Use it like this:
<p><pre> bool ok = FALSE;
<a href="qstring.html">QString</a> text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this );
if ( ok && !text.<a href="qstring.html#c62623">isEmpty</a>() )
;// user entered something and pressed ok
else
;// user entered nothing or pressed cancel
</pre>
<p>There are more static convenience methods!
<p>See also <a href="#2c38f4">getText</a>(), <a href="#85646d">getInteger</a>(), <a href="#b45cb9">getDouble</a>() and <a href="#c78831">getItem</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class="fn">double<a name="b45cb9"></a>QInputDialog::getDouble(const<a href="qstring.html">QString</a>&caption, const<a href="qstring.html">QString</a>&label, doublenum=0, doublefrom=-2147483647, doubleto=2147483647, intdecimals=1, bool*ok=0, <a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0) <code>[static]</code></h3>
<p>Static convenience function to get a decimal input from the user. <em>caption</em> is the text
which is displayed in the title bar of the dialog. <em>label</em> is the text which
is shown to the user (it should mention to the user what he/she should input), <em>num</em>
the default decimal number which will be initially set to the line edit, <em>from</em> and <em>to</em> the
range in which the entered number has to be, <em>decimals</em> the number of decimal which
the number may have, <em>ok</em> a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, <em>parent</em> the parent widget of the dialog and <em>name</em>
the name of it. The dialogs pops up modally!
<p>This method returns the number which has been entered by the user.
<p>You will use this static method like this:
<p><pre> bool ok = FALSE;
double res = QInputDialog::getDouble( tr( "Please enter a decimal number" ), 33.7, 0, 1000, 2, &ok, this );
if ( ok )
;// user entered something and pressed ok
else
;// user pressed cancel
</pre>
<h3 class="fn">int<a name="85646d"></a>QInputDialog::getInteger(const<a href="qstring.html">QString</a>&caption, const<a href="qstring.html">QString</a>&label, intnum=0, intfrom=-2147483647, intto=2147483647, intstep=1, bool*ok=0, <a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0) <code>[static]</code></h3>
<p>Static convenience function to get an integral input from the user. <em>caption</em> is the text
which is displayed in the title bar of the dialog. <em>label</em> is the text which
is shown to the user (it should mention to the user what he/she should input), <em>num</em>
the default number which will be initially set to the spinbox, <em>from</em> and <em>to</em> the
range in which the entered number has to be, <em>step</em> the step in which the number can
be increased/decreased by the spinbox, <em>ok</em> a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, <em>parent</em> the parent widget of the dialog and <em>name</em>
the name of it. The dialogs pops up modally!
<p>This method returns the number which has been entered by the user.
<p>You will use this static method like this:
<p><pre> bool ok = FALSE;
int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this );
if ( ok )
;// user entered something and pressed ok
else
;// user pressed cancel
</pre>
<h3 class="fn"><a href="qstring.html">QString</a><a name="c78831"></a>QInputDialog::getItem(const<a href="qstring.html">QString</a>&caption, const<a href="qstring.html">QString</a>&label, const<a href="qstringlist.html">QStringList</a>&list, intcurrent=0, booleditable=TRUE, bool*ok=0, <a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0) <code>[static]</code></h3>
<p>Static convenience function to let the user select an item from a string list. <em>caption</em> is the text
which is displayed in the title bar of the dialog. <em>label</em> is the text which
is shown to the user (it should mention to the user what he/she should input), <em>list</em> the
string list which is inserted into the combobox, <em>current</em> the number of the item which should
be initially the current item, <em>editable</em> specifies if the combobox should be editable (if it is TRUE)
or read-only (if <em>editable</em> is FALSE), <em>ok</em> a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, <em>parent</em> the parent widget of the dialog and <em>name</em>
the name of it. The dialogs pops up modally!
<p>This method returns the text of the current item, or if <em>editable</em> was TRUE, the current
text of the combobox.
<p>You will use this static method like this:
<p><pre> <a href="qstringlist.html">QStringList</a> lst;
lst << "First" << "Second" << "Third" << "Fourth" << "Fifth";
bool ok = FALSE;
<a href="qstring.html">QString</a> res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this );
if ( ok )
;// user selected an item and pressed ok
else
;// user pressed cancel
</pre>
<h3 class="fn"><a href="qstring.html">QString</a><a name="832521"></a>QInputDialog::getText(const<a href="qstring.html">QString</a>&caption, const<a href="qstring.html">QString</a>&label, <a href="qlineedit.html#EchoMode">QLineEdit::EchoMode</a>mode, const<a href="qstring.html">QString</a>&text=QString::null, bool*ok=0, <a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0) <code>[static]</code></h3>
<p>Like above, but accepts an a <em>mode</em> which the line edit will use to display text.
<p>See also <a href="#2c38f4">getText</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="2c38f4"></a>QInputDialog::getText(const<a href="qstring.html">QString</a>&caption, const<a href="qstring.html">QString</a>&label, const<a href="qstring.html">QString</a>&text=QString::null, bool*ok=0, <a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0) <code>[static]</code></h3>
<p>Static convenience function to get a textual input from the user. <em>caption</em> is the text
which is displayed in the title bar of the dialog. <em>label</em> is the text which
is shown to the user (it should mention to the user what he/she should input), <em>text</em>
the default text which will be initially set to the line edit, <em>ok</em> a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, <em>parent</em> the parent widget of the dialog and <em>name</em>
the name of it. The dialogs pops up modally!
<p>This method returns the text which has been entered in the line edit.
<p>You will use this static method like this:
<p><pre> bool ok = FALSE;
<a href="qstring.html">QString</a> text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this );
if ( ok && !text.<a href="qstring.html#c62623">isEmpty</a>() )
;// user entered something and pressed ok
else
;// user entered nothing or pressed cancel
</pre>
<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>
|