⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qinputdialog.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
字号:
'\" t.TH QInputDialog 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQInputDialog \- Simple convenience dialog to get a single value from the user.SH SYNOPSIS\fC#include <qinputdialog.h>\fR.PPInherits QDialog..PP.SS "Static Public Members".TPQString \fBgetText\fR ( const QString & caption, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString::null, bool * ok = 0, QWidget * parent = 0, const char * name = 0 ).TPint \fBgetInteger\fR ( const QString & caption, const QString & label, int num = 0, int from = -2147483647, int to = 2147483647, int step = 1, bool * ok = 0, QWidget * parent = 0, const char * name = 0 ).TPdouble \fBgetDouble\fR ( const QString & caption, const QString & label, double num = 0, double from = -2147483647, double to = 2147483647, int decimals = 1, bool * ok = 0, QWidget * parent = 0, const char * name = 0 ).TPQString \fBgetItem\fR ( const QString & caption, const QString & label, const QStringList & list, int current = 0, bool editable = TRUE, bool * ok = 0, QWidget * parent = 0, const char * name = 0 ).SH DESCRIPTIONThe QInputDialog class provides a simple convenience dialog to get a single value from the user..PPThe 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..PPFour static convenience functions are provided: getText(), getInteger(), getDouble() and getItem(). All the functions can be used in a similar way, for example:.PP.nf.br    bool ok;.br    QString text = QInputDialog::getText(.br            "MyApp 3000", "Enter your name:", QLineEdit::Normal,.br            QString::null, &ok, this );.br    if ( ok && !text.isEmpty() ) {.br        // user entered something and pressed OK.br    } else {.br        // user entered nothing or pressed Cancel.br    }.br.fi.PP<center>.ce 1.B "[Image Omitted]".PP</center>.PPSee also Dialog Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "double QInputDialog::getDouble ( const QString & caption, const QString & label, double num = 0, double from = -2147483647, double to = 2147483647, int decimals = 1, bool * ok = 0, QWidget * parent = 0, const char * name = 0 )\fC [static]\fR"Static convenience function to get a floating point number from the user. \fIcaption\fR is the text which is displayed in the title bar of the dialog. \fIlabel\fR is the text which is shown to the user (it should say what should be entered). \fInum\fR is the default floating point number that the line edit will be set to. \fIfrom\fR and \fIto\fR are the minimum and maximum values the user may choose, and \fIdecimals\fR is the maximum number of decimal places the number may have..PPIf \fIok\fR is not-null \fI*\fR\fIok\fR will be set to TRUE if the user pressed OK and to FALSE if the user pressed Cancel. The dialog's parent is \fIparent\fR; the dialog is called \fIname\fR. The dialog will be modal..PPThis function returns the floating point number which has been entered by the user..PPUse this static function like this:.PP.nf.br    bool ok;.br    double res = QInputDialog::getDouble(.br            "MyApp 3000", "Enter a decimal number:", 33.7, 0,.br            1000, 2, &ok, this );.br    if ( ok ) {.br        // user entered something and pressed OK.br    } else {.br        // user pressed Cancel.br    }.br.fi.SH "int QInputDialog::getInteger ( const QString & caption, const QString & label, int num = 0, int from = -2147483647, int to = 2147483647, int step = 1, bool * ok = 0, QWidget * parent = 0, const char * name = 0 )\fC [static]\fR"Static convenience function to get an integer input from the user. \fIcaption\fR is the text which is displayed in the title bar of the dialog. \fIlabel\fR is the text which is shown to the user (it should say what should be entered). \fInum\fR is the default integer which the spinbox will be set to. \fIfrom\fR and \fIto\fR are the minimum and maximum values the user may choose, and \fIstep\fR is the amount by which the values change as the user presses the arrow buttons to increment or decrement the value..PPIf \fIok\fR is not-null *\fIok\fR will be set to TRUE if the user pressed OK and to FALSE if the user pressed Cancel. The dialog's parent is \fIparent\fR; the dialog is called \fIname\fR. The dialog will be modal..PPThis function returns the integer which has been entered by the user..PPUse this static function like this:.PP.nf.br    bool ok;.br    int res = QInputDialog::getInteger(.br            "MyApp 3000", "Enter a number:", 22, 0, 1000, 2,.br            &ok, this );.br    if ( ok ) {.br        // user entered something and pressed OK.br    } else {.br        // user pressed Cancel.br    }.br.fi.SH "QString QInputDialog::getItem ( const QString & caption, const QString & label, const QStringList & list, int current = 0, bool editable = TRUE, bool * ok = 0, QWidget * parent = 0, const char * name = 0 )\fC [static]\fR"Static convenience function to let the user select an item from a string list. \fIcaption\fR is the text which is displayed in the title bar of the dialog. \fIlabel\fR is the text which is shown to the user (it should say what should be entered). \fIlist\fR is the string list which is inserted into the combobox, and \fIcurrent\fR is the number of the item which should be the current item. If \fIeditable\fR is TRUE the user can enter their own text; if \fIeditable\fR is FALSE the user may only select one of the existing items..PPIf \fIok\fR is not-null \fI*\fR\fIok\fR will be set to TRUE if the user pressed OK and to FALSE if the user pressed Cancel. The dialog's parent is \fIparent\fR; the dialog is called \fIname\fR. The dialog will be modal..PPThis function returns the text of the current item, or if \fIeditable\fR is TRUE, the current text of the combobox..PPUse this static function like this:.PP.nf.br    QStringList lst;.br    lst << "First" << "Second" << "Third" << "Fourth" << "Fifth";.br    bool ok;.br    QString res = QInputDialog::getItem(.br            "MyApp 3000", "Select an item:", lst, 1, TRUE, &ok,.br            this );.br    if ( ok ) {.br        // user selected an item and pressed OK.br    } else {.br        // user pressed Cancel.br    }.br.fi.SH "QString QInputDialog::getText ( const QString & caption, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString::null, bool * ok = 0, QWidget * parent = 0, const char * name = 0 )\fC [static]\fR"Static convenience function to get a string from the user. \fIcaption\fR is the text which is displayed in the title bar of the dialog. \fIlabel\fR is the text which is shown to the user (it should say what should be entered). \fItext\fR is the default text which is placed in the line edit. The \fImode\fR is the echo mode the line edit will use. If \fIok\fR is not-null \fI*\fR\fIok\fR will be set to TRUE if the user pressed OK and to FALSE if the user pressed Cancel. The dialog's parent is \fIparent\fR; the dialog is called \fIname\fR. The dialog will be modal..PPThis function returns the text which has been entered in the line edit. It will not return an empty string..PPUse this static function like this:.PP.nf.br    bool ok;.br    QString text = QInputDialog::getText(.br            "MyApp 3000", "Enter your name:", QLineEdit::Normal,.br            QString::null, &ok, this );.br    if ( ok && !text.isEmpty() ) {.br        // user entered something and pressed OK.br    } else {.br        // user entered nothing or pressed Cancel.br    }.br.fi.SH "SEE ALSO".BR http://doc.trolltech.com/qinputdialog.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qinputdialog.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -