Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1423

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/dialogs/qinputdialog.cpp:64 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>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: #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>QInputDialog Class Reference</h1>

<p>The QInputDialog class provides a simple convenience dialog to get a single value from the user.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qinputdialog-h.html">qinputdialog.h</a>&gt;</tt>
<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="#getText"><b>getText</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;label, QLineEdit::EchoMode&nbsp;mode = QLineEdit::Normal, const&nbsp;QString&nbsp;&amp;&nbsp;text = QString::null, bool&nbsp;*&nbsp;ok = 0, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn>int <a href="#getInteger"><b>getInteger</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;label, int&nbsp;num = 0, int&nbsp;from = -2147483647, int&nbsp;to = 2147483647, int&nbsp;step = 1, bool&nbsp;*&nbsp;ok = 0, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn>double <a href="#getDouble"><b>getDouble</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;label, double&nbsp;num = 0, double&nbsp;from = -2147483647, double&nbsp;to = 2147483647, int&nbsp;decimals = 1, bool&nbsp;*&nbsp;ok = 0, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn>QString <a href="#getItem"><b>getItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;caption, const&nbsp;QString&nbsp;&amp;&nbsp;label, const&nbsp;QStringList&nbsp;&amp;&nbsp;list, int&nbsp;current = 0, bool&nbsp;editable = TRUE, bool&nbsp;*&nbsp;ok = 0, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QInputDialog class provides a simple convenience dialog to get a single value from the user.


<p> The QInputDialog is a simple dialog which can be used if you need to
get a single input value from the user. The input value can be a
string, a number or an item from a list. A label has to be set to tell
the user what they should input.
<p> Four static convenience functions are provided:
<a href="#getText">getText</a>(), <a href="#getInteger">getInteger</a>(), <a href="#getDouble">getDouble</a>() and <a href="#getItem">getItem</a>(). All the
functions can be used in a similar way, for example:
<pre>
  bool ok = FALSE;
  <a href="qstring.html">QString</a> text = QInputDialog::<a href="#getText">getText</a>(
                    <a href="qobject.html#tr">tr</a>( "Application name" ),
                    <a href="qobject.html#tr">tr</a>( "Please enter your name" ),
                    QLineEdit::Normal, <a href="qstring.html#QString-null">QString::null</a>, &amp;ok, this );
  if ( ok &amp;&amp; !text.<a href="qstring.html#isEmpty">isEmpty</a>() )
      ;// user entered something and pressed OK
  else
      ;// user entered nothing or pressed Cancel
  </pre>
 
<p> <center><img src="inputdialogs.png" alt="Input Dialogs"></center> 
<p> <p>See also <a href="dialogs.html">Dialog Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn>double <a name="getDouble"></a>QInputDialog::getDouble ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label, double&nbsp;num = 0, double&nbsp;from = -2147483647, double&nbsp;to = 2147483647, int&nbsp;decimals = 1, bool&nbsp;*&nbsp;ok = 0, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )<tt> [static]</tt>
</h3>
Static convenience function to get a floating point number 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
what they should input), <em>num</em> is the default floating point number
that the line edit will be set to.
<em>from</em> and <em>to</em> are the minimum and maximum values the user may
choose, and <em>decimals</em> is the maximum number of decimal places the
number may have.
<p> If <em>ok</em> is not-null it will be set to TRUE if the user pressed OK and
FALSE if the user pressed Cancel.
The dialog's parent is <em>parent</em>; the dialog is called <em>name</em>. The
dialog will be modal.
<p> This method returns the floating point number which has been entered
by the user.
<p> Use this static method like this:
<p> <pre>
  bool ok = FALSE;
  double res = QInputDialog::<a href="#getDouble">getDouble</a>(
                <a href="qobject.html#tr">tr</a>( "Application name" ),
                <a href="qobject.html#tr">tr</a>( "Please enter a decimal number" ),
                33.7, 0, 1000, 2, &amp;ok, this );
  if ( ok )
      ;// user entered something and pressed OK
  else
      ;// user pressed Cancel
  </pre>
 

<h3 class=fn>int <a name="getInteger"></a>QInputDialog::getInteger ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label, int&nbsp;num = 0, int&nbsp;from = -2147483647, int&nbsp;to = 2147483647, int&nbsp;step = 1, bool&nbsp;*&nbsp;ok = 0, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )<tt> [static]</tt>
</h3>
Static convenience function to get an integer 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
what they should input), <em>num</em> is the default number which the
spinbox will be set to.
<em>from</em> and <em>to</em> are the minimum and maximum values the user may
choose, and <em>step</em> is the amount by which the values change as the
user presses the arrow buttons to increment or decrement the value.
<p> If <em>ok</em> is not-null it will be set to TRUE if the user pressed OK and
FALSE if the user pressed Cancel.
The dialog's parent is <em>parent</em>; the dialog is called <em>name</em>. The
dialog will be modal.
<p> This method returns the number which has been entered by the user.
<p> Use this static method like this:
<p> <pre>
  bool ok = FALSE;
  int res = QInputDialog::<a href="#getInteger">getInteger</a>(
                <a href="qobject.html#tr">tr</a>( "Application name" ),
                <a href="qobject.html#tr">tr</a>( "Please enter a number" ), 22, 0, 1000, 2, &amp;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="getItem"></a>QInputDialog::getItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label, const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp;&nbsp;list, int&nbsp;current = 0, bool&nbsp;editable = TRUE, bool&nbsp;*&nbsp;ok = 0, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )<tt> [static]</tt>
</h3>
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 what they should input). <em>list</em> is the
string list which is inserted into the combobox, and <em>current</em> is the number
of the item which should be the current item. If <em>editable</em> is TRUE
the user can enter their own text; if <em>editable</em> is FALSE the user
may only select one of the existing items.
<p> If <em>ok</em> is not-null it will be set to TRUE if the user pressed OK and
FALSE if the user pressed Cancel.
The dialog's parent is <em>parent</em>; the dialog is called <em>name</em>. The
dialog will be modal.
<p> This method returns the text of the current item, or if <em>editable</em>
is TRUE, the current text of the combobox.
<p> Use this static method like this:
<p> <pre>
  <a href="qstringlist.html">QStringList</a> lst;
  lst &lt;&lt; "First" &lt;&lt; "Second" &lt;&lt; "Third" &lt;&lt; "Fourth" &lt;&lt; "Fifth";
  bool ok = FALSE;
  <a href="qstring.html">QString</a> res = QInputDialog::<a href="#getItem">getItem</a>(
                    <a href="qobject.html#tr">tr</a>( "Application name" ),
                    <a href="qobject.html#tr">tr</a>( "Please select an item" ), lst, 1, TRUE, &amp;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="getText"></a>QInputDialog::getText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label, <a href="qlineedit.html#EchoMode-enum">QLineEdit::EchoMode</a>&nbsp;mode = QLineEdit::Normal, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text = QString::null, bool&nbsp;*&nbsp;ok = 0, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )<tt> [static]</tt>
</h3>
Static convenience function to get a string 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
what they should input), <em>text</em> the default text which is placed in
the line edit. The <em>mode</em> is the echo mode the
line edit will use.
If <em>ok</em> is not-null it will be set to TRUE if the user pressed OK and
FALSE if the user pressed Cancel.
The dialog's parent is <em>parent</em>; the dialog is called <em>name</em>. The
dialog will be modal.
<p> This method returns the text which has been entered in the line edit.
<p> Use this static method like this:
<p> <pre>
  bool ok = FALSE;
  <a href="qstring.html">QString</a> text = QInputDialog::<a href="#getText">getText</a>(
                    <a href="qobject.html#tr">tr</a>( "Application name" ),
                    <a href="qobject.html#tr">tr</a>( "Please enter your name" ),
                    QLineEdit::Normal, <a href="qstring.html#QString-null">QString::null</a>, &amp;ok, this );
  if ( ok &amp;&amp; !text.<a href="qstring.html#isEmpty">isEmpty</a>() )
      ;// user entered something and pressed OK
  else
      ;// user entered nothing or pressed Cancel
  </pre>
 

<p>Example: <a href="ftpclient-example.html#x1010">network/ftpclient/ftpmainwindow.cpp</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 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 &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>