<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qinputdialog.cpp --> <title>Qt 4.8: QInputDialog Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qtgui.html">QtGui</a></li> <li>QInputDialog</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#properties">Properties</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#signals">Signals</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QInputDialog Class Reference</h1> <!-- $$$QInputDialog-brief --> <p>The QInputDialog class provides a simple convenience dialog to get a single value from the user. <a href="#details">More...</a></p> <!-- @@@QInputDialog --> <pre class="cpp"> <span class="preprocessor">#include <QInputDialog></span></pre><p><b>Inherits: </b><a href="qdialog.html">QDialog</a>.</p> <ul> <li><a href="qinputdialog-members.html">List of all members, including inherited members</a></li> <li><a href="qinputdialog-obsolete.html">Obsolete members</a></li> <li><a href="qinputdialog-qt3.html">Qt 3 support members</a></li> </ul> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#InputDialogOption-enum">InputDialogOption</a></b> { NoButtons, UseListViewForComboBoxItems }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#InputDialogOption-enum">InputDialogOptions</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#InputMode-enum">InputMode</a></b> { TextInput, IntInput, DoubleInput }</td></tr> </table> <a name="properties"></a> <h2>Properties</h2> <table class="propsummary"> <tr><td class="topAlign"><ul> <li class="fn"><b><a href="qinputdialog.html#cancelButtonText-prop">cancelButtonText</a></b> : QString</li> <li class="fn"><b><a href="qinputdialog.html#comboBoxEditable-prop">comboBoxEditable</a></b> : bool</li> <li class="fn"><b><a href="qinputdialog.html#comboBoxItems-prop">comboBoxItems</a></b> : QStringList</li> <li class="fn"><b><a href="qinputdialog.html#doubleDecimals-prop">doubleDecimals</a></b> : int</li> <li class="fn"><b><a href="qinputdialog.html#doubleMaximum-prop">doubleMaximum</a></b> : double</li> <li class="fn"><b><a href="qinputdialog.html#doubleMinimum-prop">doubleMinimum</a></b> : double</li> <li class="fn"><b><a href="qinputdialog.html#doubleValue-prop">doubleValue</a></b> : int</li> <li class="fn"><b><a href="qinputdialog.html#inputMode-prop">inputMode</a></b> : InputMode</li> <li class="fn"><b><a href="qinputdialog.html#intMaximum-prop">intMaximum</a></b> : int</li> </ul></td><td class="topAlign"><ul> <li class="fn"><b><a href="qinputdialog.html#intMinimum-prop">intMinimum</a></b> : int</li> <li class="fn"><b><a href="qinputdialog.html#intStep-prop">intStep</a></b> : int</li> <li class="fn"><b><a href="qinputdialog.html#intValue-prop">intValue</a></b> : int</li> <li class="fn"><b><a href="qinputdialog.html#labelText-prop">labelText</a></b> : QString</li> <li class="fn"><b><a href="qinputdialog.html#okButtonText-prop">okButtonText</a></b> : QString</li> <li class="fn"><b><a href="qinputdialog.html#options-prop">options</a></b> : InputDialogOptions</li> <li class="fn"><b><a href="qinputdialog.html#textEchoMode-prop">textEchoMode</a></b> : QLineEdit::EchoMode</li> <li class="fn"><b><a href="qinputdialog.html#textValue-prop">textValue</a></b> : QString</li> </ul> </td></tr> </table> <ul> <li class="fn">2 properties inherited from <a href="qdialog.html#properties">QDialog</a></li> <li class="fn">58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li> <li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li> </ul> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#QInputDialog">QInputDialog</a></b> ( QWidget * <i>parent</i> = 0, Qt::WindowFlags <i>flags</i> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#dtor.QInputDialog">~QInputDialog</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#cancelButtonText-prop">cancelButtonText</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#comboBoxItems-prop">comboBoxItems</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleDecimals-prop">doubleDecimals</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleMaximum-prop">doubleMaximum</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleMinimum-prop">doubleMinimum</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleValue-prop">doubleValue</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> InputMode </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#inputMode-prop">inputMode</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intMaximum-prop">intMaximum</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intMinimum-prop">intMinimum</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intStep-prop">intStep</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intValue-prop">intValue</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#comboBoxEditable-prop">isComboBoxEditable</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#labelText-prop">labelText</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#okButtonText-prop">okButtonText</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#open">open</a></b> ( QObject * <i>receiver</i>, const char * <i>member</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> InputDialogOptions </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#options-prop">options</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#cancelButtonText-prop">setCancelButtonText</a></b> ( const QString & <i>text</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#comboBoxEditable-prop">setComboBoxEditable</a></b> ( bool <i>editable</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#comboBoxItems-prop">setComboBoxItems</a></b> ( const QStringList & <i>items</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleDecimals-prop">setDoubleDecimals</a></b> ( int <i>decimals</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleMaximum-prop">setDoubleMaximum</a></b> ( double <i>max</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleMinimum-prop">setDoubleMinimum</a></b> ( double <i>min</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#setDoubleRange">setDoubleRange</a></b> ( double <i>min</i>, double <i>max</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleValue-prop">setDoubleValue</a></b> ( double <i>value</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#inputMode-prop">setInputMode</a></b> ( InputMode <i>mode</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intMaximum-prop">setIntMaximum</a></b> ( int <i>max</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intMinimum-prop">setIntMinimum</a></b> ( int <i>min</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#setIntRange">setIntRange</a></b> ( int <i>min</i>, int <i>max</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intStep-prop">setIntStep</a></b> ( int <i>step</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intValue-prop">setIntValue</a></b> ( int <i>value</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#labelText-prop">setLabelText</a></b> ( const QString & <i>text</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#okButtonText-prop">setOkButtonText</a></b> ( const QString & <i>text</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#setOption">setOption</a></b> ( InputDialogOption <i>option</i>, bool <i>on</i> = true )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#options-prop">setOptions</a></b> ( InputDialogOptions <i>options</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#textEchoMode-prop">setTextEchoMode</a></b> ( QLineEdit::EchoMode <i>mode</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#textValue-prop">setTextValue</a></b> ( const QString & <i>text</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#testOption">testOption</a></b> ( InputDialogOption <i>option</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QLineEdit::EchoMode </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#textEchoMode-prop">textEchoMode</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#textValue-prop">textValue</a></b> () const</td></tr> </table> <a name="reimplemented-public-functions"></a> <h2>Reimplemented Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#done">done</a></b> ( int <i>result</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#minimumSizeHint">minimumSizeHint</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#setVisible">setVisible</a></b> ( bool <i>visible</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#sizeHint">sizeHint</a></b> () const</td></tr> </table> <ul> <li class="fn">8 public functions inherited from <a href="qdialog.html#public-functions">QDialog</a></li> <li class="fn">221 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li> <li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> <li class="fn">13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li> </ul> <a name="signals"></a> <h2>Signals</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleValueChanged">doubleValueChanged</a></b> ( double <i>value</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#doubleValueSelected">doubleValueSelected</a></b> ( double <i>value</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intValueChanged">intValueChanged</a></b> ( int <i>value</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#intValueSelected">intValueSelected</a></b> ( int <i>value</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#textValueChanged">textValueChanged</a></b> ( const QString & <i>text</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#textValueSelected">textValueSelected</a></b> ( const QString & <i>text</i> )</td></tr> </table> <ul> <li class="fn">3 signals inherited from <a href="qdialog.html#signals">QDialog</a></li> <li class="fn">1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li> <li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li> </ul> <a name="static-public-members"></a> <h2>Static Public Members</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#getDouble">getDouble</a></b> ( QWidget * <i>parent</i>, const QString & <i>title</i>, const QString & <i>label</i>, double <i>value</i> = 0, double <i>min</i> = -2147483647, double <i>max</i> = 2147483647, int <i>decimals</i> = 1, bool * <i>ok</i> = 0, Qt::WindowFlags <i>flags</i> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#getInt">getInt</a></b> ( QWidget * <i>parent</i>, const QString & <i>title</i>, const QString & <i>label</i>, int <i>value</i> = 0, int <i>min</i> = -2147483647, int <i>max</i> = 2147483647, int <i>step</i> = 1, bool * <i>ok</i> = 0, Qt::WindowFlags <i>flags</i> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#getItem">getItem</a></b> ( QWidget * <i>parent</i>, const QString & <i>title</i>, const QString & <i>label</i>, const QStringList & <i>items</i>, int <i>current</i> = 0, bool <i>editable</i> = true, bool * <i>ok</i> = 0, Qt::WindowFlags <i>flags</i> = 0, Qt::InputMethodHints <i>inputMethodHints</i> = Qt::ImhNone )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qinputdialog.html#getText">getText</a></b> ( QWidget * <i>parent</i>, const QString & <i>title</i>, const QString & <i>label</i>, QLineEdit::EchoMode <i>mode</i> = QLineEdit::Normal, const QString & <i>text</i> = QString(), bool * <i>ok</i> = 0, Qt::WindowFlags <i>flags</i> = 0, Qt::InputMethodHints <i>inputMethodHints</i> = Qt::ImhNone )</td></tr> </table> <ul> <li class="fn">4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li> <li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">5 public slots inherited from <a href="qdialog.html#public-slots">QDialog</a></li> <li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li> <li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li> <li class="fn">7 protected functions inherited from <a href="qdialog.html#protected-functions">QDialog</a></li> <li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li> <li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> <li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li> <li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li> </ul> <a name="details"></a> <!-- $$$QInputDialog-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QInputDialog class provides a simple convenience dialog to get a single value from the user.</p> <p>The input value can be a string, a number or an item from a list. A label must be set to tell the user what they should enter.</p> <p>Four static convenience functions are provided: <a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getInt">getInt</a>(), <a href="qinputdialog.html#getDouble">getDouble</a>(), and <a href="qinputdialog.html#getItem">getItem</a>(). All the functions can be used in a similar way, for example:</p> <pre class="cpp"> <span class="type">bool</span> ok; <span class="type"><a href="qstring.html">QString</a></span> text <span class="operator">=</span> <span class="type">QInputDialog</span><span class="operator">::</span>getText(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog::getText()"</span>)<span class="operator">,</span> tr(<span class="string">"User name:"</span>)<span class="operator">,</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">::</span>Normal<span class="operator">,</span> <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">::</span>home()<span class="operator">.</span>dirName()<span class="operator">,</span> <span class="operator">&</span>ok); <span class="keyword">if</span> (ok <span class="operator">&</span><span class="operator">&</span> <span class="operator">!</span>text<span class="operator">.</span>isEmpty()) textLabel<span class="operator">-</span><span class="operator">></span>setText(text);</pre> <p>The <tt>ok</tt> variable is set to true if the user clicks <b>OK</b>; otherwise it is set to false.</p> <p class="centerAlign"><img src="images/inputdialogs.png" alt="Input Dialogs" /></p><p>The <a href="dialogs-standarddialogs.html">Standard Dialogs</a> example shows how to use QInputDialog as well as other built-in Qt dialogs.</p> </div> <p><b>See also </b><a href="qmessagebox.html">QMessageBox</a> and <a href="dialogs-standarddialogs.html">Standard Dialogs Example</a>.</p> <!-- @@@QInputDialog --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$InputDialogOption$$$NoButtons$$$UseListViewForComboBoxItems --> <h3 class="flags"><a name="InputDialogOption-enum"></a>enum QInputDialog::<span class="name">InputDialogOption</span><br/>flags QInputDialog::<span class="name">InputDialogOptions</span></h3> <p>This enum specifies various options that affect the look and feel of an input dialog.</p> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>QInputDialog::NoButtons</tt></td><td class="topAlign"><tt>0x00000001</tt></td><td class="topAlign">Don't display <b>OK</b> and <b>Cancel</b> buttons. (Useful for "live dialogs".)</td></tr> <tr><td class="topAlign"><tt>QInputDialog::UseListViewForComboBoxItems</tt></td><td class="topAlign"><tt>0x00000002</tt></td><td class="topAlign">Use a <a href="qlistview.html">QListView</a> rather than a non-editable <a href="qcombobox.html">QComboBox</a> for displaying the items set with <a href="qinputdialog.html#comboBoxItems-prop">setComboBoxItems</a>().</td></tr> </table> <p>This enum was introduced or modified in Qt 4.5.</p> <p>The InputDialogOptions type is a typedef for <a href="qflags.html">QFlags</a><InputDialogOption>. It stores an OR combination of InputDialogOption values.</p> <p><b>See also </b><a href="qinputdialog.html#options-prop">options</a>, <a href="qinputdialog.html#setOption">setOption</a>(), and <a href="qinputdialog.html#testOption">testOption</a>().</p> <!-- @@@InputDialogOption --> <!-- $$$InputMode$$$TextInput$$$IntInput$$$DoubleInput --> <h3 class="fn"><a name="InputMode-enum"></a>enum QInputDialog::<span class="name">InputMode</span></h3> <p>This enum describes the different modes of input that can be selected for the dialog.</p> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>QInputDialog::TextInput</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">Used to input text strings.</td></tr> <tr><td class="topAlign"><tt>QInputDialog::IntInput</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">Used to input integers.</td></tr> <tr><td class="topAlign"><tt>QInputDialog::DoubleInput</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">Used to input floating point numbers with double precision accuracy.</td></tr> </table> <p>This enum was introduced or modified in Qt 4.5.</p> <p><b>See also </b><a href="qinputdialog.html#inputMode-prop">inputMode</a>.</p> <!-- @@@InputMode --> </div> <div class="prop"> <h2>Property Documentation</h2> <!-- $$$cancelButtonText-prop$$$cancelButtonText$$$setCancelButtonTextconstQString& --> <h3 class="fn"><a name="cancelButtonText-prop"></a><span class="name">cancelButtonText</span> : <span class="type"><a href="qstring.html">QString</a></span></h3> <p>This property holds the text for the button used to cancel the dialog.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>cancelButtonText</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCancelButtonText</b></span> ( const QString & <i>text</i> )</td></tr> </table> <!-- @@@cancelButtonText --> <!-- $$$comboBoxEditable-prop$$$isComboBoxEditable$$$setComboBoxEditablebool --> <h3 class="fn"><a name="comboBoxEditable-prop"></a><span class="name">comboBoxEditable</span> : <span class="type">bool</span></h3> <p>This property holds whether or not the combo box is used in the input dialog is editable.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isComboBoxEditable</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setComboBoxEditable</b></span> ( bool <i>editable</i> )</td></tr> </table> <!-- @@@comboBoxEditable --> <!-- $$$comboBoxItems-prop$$$comboBoxItems$$$setComboBoxItemsconstQStringList& --> <h3 class="fn"><a name="comboBoxItems-prop"></a><span class="name">comboBoxItems</span> : <span class="type"><a href="qstringlist.html">QStringList</a></span></h3> <p>This property holds the items used in the combobox for the input dialog.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> QStringList </td><td class="memItemRight bottomAlign"><span class="name"><b>comboBoxItems</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setComboBoxItems</b></span> ( const QStringList & <i>items</i> )</td></tr> </table> <!-- @@@comboBoxItems --> <!-- $$$doubleDecimals-prop$$$doubleDecimals$$$setDoubleDecimalsint --> <h3 class="fn"><a name="doubleDecimals-prop"></a><span class="name">doubleDecimals</span> : <span class="type">int</span></h3> <p>This property holds sets the percision of the double spinbox in decimals.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>doubleDecimals</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDoubleDecimals</b></span> ( int <i>decimals</i> )</td></tr> </table> <p><b>See also </b><a href="qdoublespinbox.html#decimals-prop">QDoubleSpinBox::setDecimals</a>().</p> <!-- @@@doubleDecimals --> <!-- $$$doubleMaximum-prop$$$doubleMaximum$$$setDoubleMaximumdouble --> <h3 class="fn"><a name="doubleMaximum-prop"></a><span class="name">doubleMaximum</span> : <span class="type">double</span></h3> <p>This property holds the maximum double precision floating point value accepted as input.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">DoubleInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> double </td><td class="memItemRight bottomAlign"><span class="name"><b>doubleMaximum</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDoubleMaximum</b></span> ( double <i>max</i> )</td></tr> </table> <!-- @@@doubleMaximum --> <!-- $$$doubleMinimum-prop$$$doubleMinimum$$$setDoubleMinimumdouble --> <h3 class="fn"><a name="doubleMinimum-prop"></a><span class="name">doubleMinimum</span> : <span class="type">double</span></h3> <p>This property holds the minimum double precision floating point value accepted as input.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">DoubleInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> double </td><td class="memItemRight bottomAlign"><span class="name"><b>doubleMinimum</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDoubleMinimum</b></span> ( double <i>min</i> )</td></tr> </table> <!-- @@@doubleMinimum --> <!-- $$$doubleValue-prop$$$doubleValue$$$setDoubleValuedouble$$$doubleValueChangeddouble --> <h3 class="fn"><a name="doubleValue-prop"></a><span class="name">doubleValue</span> : <span class="type">int</span></h3> <p>This property holds the current double precision floating point value accepted as input.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">DoubleInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> double </td><td class="memItemRight bottomAlign"><span class="name"><b>doubleValue</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDoubleValue</b></span> ( double <i>value</i> )</td></tr> </table> <p><b>Notifier signal:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qinputdialog.html#doubleValueChanged">doubleValueChanged</a></b></span> ( double <i>value</i> )</td></tr> </table> <!-- @@@doubleValue --> <!-- $$$inputMode-prop$$$inputMode$$$setInputModeInputMode --> <h3 class="fn"><a name="inputMode-prop"></a><span class="name">inputMode</span> : <span class="type"><a href="qinputdialog.html#InputMode-enum">InputMode</a></span></h3> <p>This property holds the mode used for input.</p> <p>This property help determines which widget is used for entering input into the dialog.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> InputMode </td><td class="memItemRight bottomAlign"><span class="name"><b>inputMode</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setInputMode</b></span> ( InputMode <i>mode</i> )</td></tr> </table> <!-- @@@inputMode --> <!-- $$$intMaximum-prop$$$intMaximum$$$setIntMaximumint --> <h3 class="fn"><a name="intMaximum-prop"></a><span class="name">intMaximum</span> : <span class="type">int</span></h3> <p>This property holds the maximum integer value accepted as input.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>intMaximum</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIntMaximum</b></span> ( int <i>max</i> )</td></tr> </table> <!-- @@@intMaximum --> <!-- $$$intMinimum-prop$$$intMinimum$$$setIntMinimumint --> <h3 class="fn"><a name="intMinimum-prop"></a><span class="name">intMinimum</span> : <span class="type">int</span></h3> <p>This property holds the minimum integer value accepted as input.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>intMinimum</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIntMinimum</b></span> ( int <i>min</i> )</td></tr> </table> <!-- @@@intMinimum --> <!-- $$$intStep-prop$$$intStep$$$setIntStepint --> <h3 class="fn"><a name="intStep-prop"></a><span class="name">intStep</span> : <span class="type">int</span></h3> <p>This property holds the step by which the integer value is increased and decreased.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>intStep</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIntStep</b></span> ( int <i>step</i> )</td></tr> </table> <!-- @@@intStep --> <!-- $$$intValue-prop$$$intValue$$$setIntValueint$$$intValueChangedint --> <h3 class="fn"><a name="intValue-prop"></a><span class="name">intValue</span> : <span class="type">int</span></h3> <p>This property holds the current integer value accepted as input.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>intValue</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIntValue</b></span> ( int <i>value</i> )</td></tr> </table> <p><b>Notifier signal:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qinputdialog.html#intValueChanged">intValueChanged</a></b></span> ( int <i>value</i> )</td></tr> </table> <!-- @@@intValue --> <!-- $$$labelText-prop$$$labelText$$$setLabelTextconstQString& --> <h3 class="fn"><a name="labelText-prop"></a><span class="name">labelText</span> : <span class="type"><a href="qstring.html">QString</a></span></h3> <p>This property holds the text to for the label to describe what needs to be input.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>labelText</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setLabelText</b></span> ( const QString & <i>text</i> )</td></tr> </table> <!-- @@@labelText --> <!-- $$$okButtonText-prop$$$okButtonText$$$setOkButtonTextconstQString& --> <h3 class="fn"><a name="okButtonText-prop"></a><span class="name">okButtonText</span> : <span class="type"><a href="qstring.html">QString</a></span></h3> <p>This property holds the text for the button used to accept the entry in the dialog.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>okButtonText</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setOkButtonText</b></span> ( const QString & <i>text</i> )</td></tr> </table> <!-- @@@okButtonText --> <!-- $$$options-prop$$$options$$$setOptionsInputDialogOptions --> <h3 class="fn"><a name="options-prop"></a><span class="name">options</span> : <span class="type"><a href="qinputdialog.html#InputDialogOption-enum">InputDialogOptions</a></span></h3> <p>This property holds the various options that affect the look and feel of the dialog.</p> <p>By default, all options are disabled.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> InputDialogOptions </td><td class="memItemRight bottomAlign"><span class="name"><b>options</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setOptions</b></span> ( InputDialogOptions <i>options</i> )</td></tr> </table> <p><b>See also </b><a href="qinputdialog.html#setOption">setOption</a>() and <a href="qinputdialog.html#testOption">testOption</a>().</p> <!-- @@@options --> <!-- $$$textEchoMode-prop$$$textEchoMode$$$setTextEchoModeQLineEdit::EchoMode --> <h3 class="fn"><a name="textEchoMode-prop"></a><span class="name">textEchoMode</span> : <span class="type"><a href="qlineedit.html#EchoMode-enum">QLineEdit::EchoMode</a></span></h3> <p>This property holds the echo mode for the text value.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">TextInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> QLineEdit::EchoMode </td><td class="memItemRight bottomAlign"><span class="name"><b>textEchoMode</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTextEchoMode</b></span> ( QLineEdit::EchoMode <i>mode</i> )</td></tr> </table> <!-- @@@textEchoMode --> <!-- $$$textValue-prop$$$textValue$$$setTextValueconstQString&$$$textValueChangedconstQString& --> <h3 class="fn"><a name="textValue-prop"></a><span class="name">textValue</span> : <span class="type"><a href="qstring.html">QString</a></span></h3> <p>This property holds the text value for the input dialog.</p> <p>This property is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">TextInput</a> mode.</p> <p>This property was introduced in Qt 4.5.</p> <p><b>Access functions:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>textValue</b></span> () const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTextValue</b></span> ( const QString & <i>text</i> )</td></tr> </table> <p><b>Notifier signal:</b></p> <table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qinputdialog.html#textValueChanged">textValueChanged</a></b></span> ( const QString & <i>text</i> )</td></tr> </table> <!-- @@@textValue --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QInputDialog[overload1]$$$QInputDialogQWidget*Qt::WindowFlags --> <h3 class="fn"><a name="QInputDialog"></a>QInputDialog::<span class="name">QInputDialog</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>flags</i> = 0 )</h3> <p>Constructs a new input dialog with the given <i>parent</i> and window <i>flags</i>.</p> <p>This function was introduced in Qt 4.5.</p> <!-- @@@QInputDialog --> <!-- $$$~QInputDialog[overload1]$$$~QInputDialog --> <h3 class="fn"><a name="dtor.QInputDialog"></a>QInputDialog::<span class="name">~QInputDialog</span> ()</h3> <p>Destroys the input dialog.</p> <p>This function was introduced in Qt 4.5.</p> <!-- @@@~QInputDialog --> <!-- $$$done[overload1]$$$doneint --> <h3 class="fn"><a name="done"></a><span class="type">void</span> QInputDialog::<span class="name">done</span> ( <span class="type">int</span> <i>result</i> )<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="qdialog.html#done">QDialog::done</a>().</p> <p>Closes the dialog and sets its result code to <i>result</i>. If this dialog is shown with <a href="qdialog.html#exec">exec</a>(), done() causes the local event loop to finish, and <a href="qdialog.html#exec">exec</a>() to return <i>result</i>.</p> <p><b>See also </b><a href="qdialog.html#done">QDialog::done</a>().</p> <!-- @@@done --> <!-- $$$doubleValueChanged[overload1]$$$doubleValueChangeddouble --> <h3 class="fn"><a name="doubleValueChanged"></a><span class="type">void</span> QInputDialog::<span class="name">doubleValueChanged</span> ( <span class="type">double</span> <i>value</i> )<tt> [signal]</tt></h3> <p>This signal is emitted whenever the double value changes in the dialog. The current value is specified by <i>value</i>.</p> <p>This signal is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">DoubleInput</a> mode.</p> <!-- @@@doubleValueChanged --> <!-- $$$doubleValueSelected[overload1]$$$doubleValueSelecteddouble --> <h3 class="fn"><a name="doubleValueSelected"></a><span class="type">void</span> QInputDialog::<span class="name">doubleValueSelected</span> ( <span class="type">double</span> <i>value</i> )<tt> [signal]</tt></h3> <p>This signal is emitted whenever the user selects a double value by accepting the dialog; for example, by clicking the <b>OK</b> button. The selected value is specified by <i>value</i>.</p> <p>This signal is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">DoubleInput</a> mode.</p> <!-- @@@doubleValueSelected --> <!-- $$$getDouble[overload1]$$$getDoubleQWidget*constQString&constQString&doubledoubledoubleintbool*Qt::WindowFlags --> <h3 class="fn"><a name="getDouble"></a><span class="type">double</span> QInputDialog::<span class="name">getDouble</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>title</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>label</i>, <span class="type">double</span> <i>value</i> = 0, <span class="type">double</span> <i>min</i> = -2147483647, <span class="type">double</span> <i>max</i> = 2147483647, <span class="type">int</span> <i>decimals</i> = 1, <span class="type">bool</span> * <i>ok</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>flags</i> = 0 )<tt> [static]</tt></h3> <p>Static convenience function to get a floating point number from the user.</p> <p><i>title</i> is the text which is displayed in the title bar of the dialog. <i>label</i> is the text which is shown to the user (it should say what should be entered). <i>value</i> is the default floating point number that the line edit will be set to. <i>min</i> and <i>max</i> are the minimum and maximum values the user may choose. <i>decimals</i> is the maximum number of decimal places the number may have.</p> <p>If <i>ok</i> is nonnull, *<i>ok</i> will be set to true if the user pressed <b>OK</b> and to false if the user pressed <b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog will be modal and uses the widget <i>flags</i>.</p> <p>This function returns the floating point number which has been entered by the user.</p> <p>Use this static function like this:</p> <pre class="cpp"> <span class="type">bool</span> ok; <span class="type">double</span> d <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">::</span>getDouble(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog::getDouble()"</span>)<span class="operator">,</span> tr(<span class="string">"Amount:"</span>)<span class="operator">,</span> <span class="number">37.56</span><span class="operator">,</span> <span class="operator">-</span><span class="number">10000</span><span class="operator">,</span> <span class="number">10000</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="operator">&</span>ok); <span class="keyword">if</span> (ok) doubleLabel<span class="operator">-</span><span class="operator">></span>setText(<span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"$%1"</span>)<span class="operator">.</span>arg(d));</pre> <p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p> <p><b>See also </b><a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getInt">getInt</a>(), and <a href="qinputdialog.html#getItem">getItem</a>().</p> <!-- @@@getDouble --> <!-- $$$getInt[overload1]$$$getIntQWidget*constQString&constQString&intintintintbool*Qt::WindowFlags --> <h3 class="fn"><a name="getInt"></a><span class="type">int</span> QInputDialog::<span class="name">getInt</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>title</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>label</i>, <span class="type">int</span> <i>value</i> = 0, <span class="type">int</span> <i>min</i> = -2147483647, <span class="type">int</span> <i>max</i> = 2147483647, <span class="type">int</span> <i>step</i> = 1, <span class="type">bool</span> * <i>ok</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>flags</i> = 0 )<tt> [static]</tt></h3> <p>Static convenience function to get an integer input from the user.</p> <p><i>title</i> is the text which is displayed in the title bar of the dialog. <i>label</i> is the text which is shown to the user (it should say what should be entered). <i>value</i> is the default integer which the spinbox will be set to. <i>min</i> and <i>max</i> are the minimum and maximum values the user may choose. <i>step</i> is the amount by which the values change as the user presses the arrow buttons to increment or decrement the value.</p> <p>If <i>ok</i> is nonnull *<i>ok</i> will be set to true if the user pressed <b>OK</b> and to false if the user pressed <b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog will be modal and uses the widget <i>flags</i>.</p> <p>On success, this function returns the integer which has been entered by the user; on failure, it returns the initial <i>value</i>.</p> <p>Use this static function like this:</p> <pre class="cpp"> <span class="type">bool</span> ok; <span class="type">int</span> i <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">::</span>getInt(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog::getInteger()"</span>)<span class="operator">,</span> tr(<span class="string">"Percentage:"</span>)<span class="operator">,</span> <span class="number">25</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="operator">&</span>ok); <span class="keyword">if</span> (ok) integerLabel<span class="operator">-</span><span class="operator">></span>setText(tr(<span class="string">"%1%"</span>)<span class="operator">.</span>arg(i));</pre> <p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p> <p>This function was introduced in Qt 4.5.</p> <p><b>See also </b><a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getDouble">getDouble</a>(), and <a href="qinputdialog.html#getItem">getItem</a>().</p> <!-- @@@getInt --> <!-- $$$getItem[overload1]$$$getItemQWidget*constQString&constQString&constQStringList&intboolbool*Qt::WindowFlagsQt::InputMethodHints --> <h3 class="fn"><a name="getItem"></a><span class="type"><a href="qstring.html">QString</a></span> QInputDialog::<span class="name">getItem</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>title</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>label</i>, const <span class="type"><a href="qstringlist.html">QStringList</a></span> & <i>items</i>, <span class="type">int</span> <i>current</i> = 0, <span class="type">bool</span> <i>editable</i> = true, <span class="type">bool</span> * <i>ok</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>flags</i> = 0, <span class="type"><a href="qt.html#InputMethodHint-enum">Qt::InputMethodHints</a></span> <i>inputMethodHints</i> = Qt::ImhNone )<tt> [static]</tt></h3> <p>Static convenience function to let the user select an item from a string list.</p> <p><i>title</i> is the text which is displayed in the title bar of the dialog. <i>label</i> is the text which is shown to the user (it should say what should be entered). <i>items</i> is the string list which is inserted into the combobox. <i>current</i> is the number of the item which should be the current item. <i>inputMethodHints</i> is the input method hints that will be used if the combobox is editable and an input method is active.</p> <p>If <i>editable</i> is true the user can enter their own text; otherwise the user may only select one of the existing items.</p> <p>If <i>ok</i> is nonnull <i>*a</i> ok will be set to true if the user pressed <b>OK</b> and to false if the user pressed <b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog will be modal and uses the widget <i>flags</i>.</p> <p>This function returns the text of the current item, or if <i>editable</i> is true, the current text of the combobox.</p> <p>Use this static function like this:</p> <pre class="cpp"> <span class="type"><a href="qstringlist.html">QStringList</a></span> items; items <span class="operator"><</span><span class="operator"><</span> tr(<span class="string">"Spring"</span>) <span class="operator"><</span><span class="operator"><</span> tr(<span class="string">"Summer"</span>) <span class="operator"><</span><span class="operator"><</span> tr(<span class="string">"Fall"</span>) <span class="operator"><</span><span class="operator"><</span> tr(<span class="string">"Winter"</span>); <span class="type">bool</span> ok; <span class="type"><a href="qstring.html">QString</a></span> item <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">::</span>getItem(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog::getItem()"</span>)<span class="operator">,</span> tr(<span class="string">"Season:"</span>)<span class="operator">,</span> items<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="keyword">false</span><span class="operator">,</span> <span class="operator">&</span>ok); <span class="keyword">if</span> (ok <span class="operator">&</span><span class="operator">&</span> <span class="operator">!</span>item<span class="operator">.</span>isEmpty()) itemLabel<span class="operator">-</span><span class="operator">></span>setText(item);</pre> <p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p> <p><b>See also </b><a href="qinputdialog.html#getText">getText</a>(), <a href="qinputdialog.html#getInt">getInt</a>(), and <a href="qinputdialog.html#getDouble">getDouble</a>().</p> <!-- @@@getItem --> <!-- $$$getText[overload1]$$$getTextQWidget*constQString&constQString&QLineEdit::EchoModeconstQString&bool*Qt::WindowFlagsQt::InputMethodHints --> <h3 class="fn"><a name="getText"></a><span class="type"><a href="qstring.html">QString</a></span> QInputDialog::<span class="name">getText</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>title</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>label</i>, <span class="type"><a href="qlineedit.html#EchoMode-enum">QLineEdit::EchoMode</a></span> <i>mode</i> = QLineEdit::Normal, const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i> = QString(), <span class="type">bool</span> * <i>ok</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>flags</i> = 0, <span class="type"><a href="qt.html#InputMethodHint-enum">Qt::InputMethodHints</a></span> <i>inputMethodHints</i> = Qt::ImhNone )<tt> [static]</tt></h3> <p>Static convenience function to get a string from the user.</p> <p><i>title</i> is the text which is displayed in the title bar of the dialog. <i>label</i> is the text which is shown to the user (it should say what should be entered). <i>text</i> is the default text which is placed in the line edit. <i>mode</i> is the echo mode the line edit will use. <i>inputMethodHints</i> is the input method hints that will be used in the edit widget if an input method is active.</p> <p>If <i>ok</i> is nonnull <i>*a</i> ok will be set to true if the user pressed <b>OK</b> and to false if the user pressed <b>Cancel</b>. The dialog's parent is <i>parent</i>. The dialog will be modal and uses the specified widget <i>flags</i>.</p> <p>If the dialog is accepted, this function returns the text in the dialog's line edit. If the dialog is rejected, a null <a href="qstring.html">QString</a> is returned.</p> <p>Use this static function like this:</p> <pre class="cpp"> <span class="type">bool</span> ok; <span class="type"><a href="qstring.html">QString</a></span> text <span class="operator">=</span> <span class="type"><a href="qinputdialog.html">QInputDialog</a></span><span class="operator">::</span>getText(<span class="keyword">this</span><span class="operator">,</span> tr(<span class="string">"QInputDialog::getText()"</span>)<span class="operator">,</span> tr(<span class="string">"User name:"</span>)<span class="operator">,</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">::</span>Normal<span class="operator">,</span> <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">::</span>home()<span class="operator">.</span>dirName()<span class="operator">,</span> <span class="operator">&</span>ok); <span class="keyword">if</span> (ok <span class="operator">&</span><span class="operator">&</span> <span class="operator">!</span>text<span class="operator">.</span>isEmpty()) textLabel<span class="operator">-</span><span class="operator">></span>setText(text);</pre> <p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qinputdialog.html">QInputDialog</a> constructors.</p> <p><b>See also </b><a href="qinputdialog.html#getInt">getInt</a>(), <a href="qinputdialog.html#getDouble">getDouble</a>(), and <a href="qinputdialog.html#getItem">getItem</a>().</p> <!-- @@@getText --> <!-- $$$intValueChanged[overload1]$$$intValueChangedint --> <h3 class="fn"><a name="intValueChanged"></a><span class="type">void</span> QInputDialog::<span class="name">intValueChanged</span> ( <span class="type">int</span> <i>value</i> )<tt> [signal]</tt></h3> <p>This signal is emitted whenever the integer value changes in the dialog. The current value is specified by <i>value</i>.</p> <p>This signal is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p> <!-- @@@intValueChanged --> <!-- $$$intValueSelected[overload1]$$$intValueSelectedint --> <h3 class="fn"><a name="intValueSelected"></a><span class="type">void</span> QInputDialog::<span class="name">intValueSelected</span> ( <span class="type">int</span> <i>value</i> )<tt> [signal]</tt></h3> <p>This signal is emitted whenever the user selects a integer value by accepting the dialog; for example, by clicking the <b>OK</b> button. The selected value is specified by <i>value</i>.</p> <p>This signal is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">IntInput</a> mode.</p> <!-- @@@intValueSelected --> <!-- $$$minimumSizeHint[overload1]$$$minimumSizeHint --> <h3 class="fn"><a name="minimumSizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QInputDialog::<span class="name">minimumSizeHint</span> () const<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget::minimumSizeHint</a>().</p> <!-- @@@minimumSizeHint --> <!-- $$$open[overload1]$$$openQObject*constchar* --> <h3 class="fn"><a name="open"></a><span class="type">void</span> QInputDialog::<span class="name">open</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, const <span class="type">char</span> * <i>member</i> )</h3> <p>This is an overloaded function.</p> <p>This function connects one of its signals to the slot specified by <i>receiver</i> and <i>member</i>. The specific signal depends on the arguments that are specified in <i>member</i>. These are:</p> <ul> <li><a href="qinputdialog.html#textValueSelected">textValueSelected</a>() if <i>member</i> has a <a href="qstring.html">QString</a> for its first argument.</li> <li><a href="qinputdialog.html#intValueSelected">intValueSelected</a>() if <i>member</i> has an int for its first argument.</li> <li><a href="qinputdialog.html#doubleValueSelected">doubleValueSelected</a>() if <i>member</i> has a double for its first argument.</li> <li><a href="qdialog.html#accepted">accepted</a>() if <i>member</i> has NO arguments.</li> </ul> <p>The signal will be disconnected from the slot when the dialog is closed.</p> <p>This function was introduced in Qt 4.5.</p> <!-- @@@open --> <!-- $$$setDoubleRange[overload1]$$$setDoubleRangedoubledouble --> <h3 class="fn"><a name="setDoubleRange"></a><span class="type">void</span> QInputDialog::<span class="name">setDoubleRange</span> ( <span class="type">double</span> <i>min</i>, <span class="type">double</span> <i>max</i> )</h3> <p>Sets the range of double precision floating point values accepted by the dialog when used in <a href="qinputdialog.html#InputMode-enum">DoubleInput</a> mode, with minimum and maximum values specified by <i>min</i> and <i>max</i> respectively.</p> <!-- @@@setDoubleRange --> <!-- $$$setIntRange[overload1]$$$setIntRangeintint --> <h3 class="fn"><a name="setIntRange"></a><span class="type">void</span> QInputDialog::<span class="name">setIntRange</span> ( <span class="type">int</span> <i>min</i>, <span class="type">int</span> <i>max</i> )</h3> <p>Sets the range of integer values accepted by the dialog when used in <a href="qinputdialog.html#InputMode-enum">IntInput</a> mode, with minimum and maximum values specified by <i>min</i> and <i>max</i> respectively.</p> <!-- @@@setIntRange --> <!-- $$$setOption[overload1]$$$setOptionInputDialogOptionbool --> <h3 class="fn"><a name="setOption"></a><span class="type">void</span> QInputDialog::<span class="name">setOption</span> ( <span class="type"><a href="qinputdialog.html#InputDialogOption-enum">InputDialogOption</a></span> <i>option</i>, <span class="type">bool</span> <i>on</i> = true )</h3> <p>Sets the given <i>option</i> to be enabled if <i>on</i> is true; otherwise, clears the given <i>option</i>.</p> <p><b>See also </b><a href="qinputdialog.html#options-prop">options</a> and <a href="qinputdialog.html#testOption">testOption</a>().</p> <!-- @@@setOption --> <!-- $$$setVisible[overload1]$$$setVisiblebool --> <h3 class="fn"><a name="setVisible"></a><span class="type">void</span> QInputDialog::<span class="name">setVisible</span> ( <span class="type">bool</span> <i>visible</i> )<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget::setVisible</a>().</p> <!-- @@@setVisible --> <!-- $$$sizeHint[overload1]$$$sizeHint --> <h3 class="fn"><a name="sizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QInputDialog::<span class="name">sizeHint</span> () const<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>().</p> <!-- @@@sizeHint --> <!-- $$$testOption[overload1]$$$testOptionInputDialogOption --> <h3 class="fn"><a name="testOption"></a><span class="type">bool</span> QInputDialog::<span class="name">testOption</span> ( <span class="type"><a href="qinputdialog.html#InputDialogOption-enum">InputDialogOption</a></span> <i>option</i> ) const</h3> <p>Returns true if the given <i>option</i> is enabled; otherwise, returns false.</p> <p><b>See also </b><a href="qinputdialog.html#options-prop">options</a> and <a href="qinputdialog.html#setOption">setOption</a>().</p> <!-- @@@testOption --> <!-- $$$textValueChanged[overload1]$$$textValueChangedconstQString& --> <h3 class="fn"><a name="textValueChanged"></a><span class="type">void</span> QInputDialog::<span class="name">textValueChanged</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i> )<tt> [signal]</tt></h3> <p>This signal is emitted whenever the text string changes in the dialog. The current string is specified by <i>text</i>.</p> <p>This signal is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">TextInput</a> mode.</p> <!-- @@@textValueChanged --> <!-- $$$textValueSelected[overload1]$$$textValueSelectedconstQString& --> <h3 class="fn"><a name="textValueSelected"></a><span class="type">void</span> QInputDialog::<span class="name">textValueSelected</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i> )<tt> [signal]</tt></h3> <p>This signal is emitted whenever the user selects a text string by accepting the dialog; for example, by clicking the <b>OK</b> button. The selected string is specified by <i>text</i>.</p> <p>This signal is only relevant when the input dialog is used in <a href="qinputdialog.html#InputMode-enum">TextInput</a> mode.</p> <!-- @@@textValueSelected --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>