Qt learning path (18): QInputDialog In the Qt standard dialog box

Source: Internet
Author: User

This is the last part of the Qt standard dialog box. As shown in its name, QInputDialog is used to receive user input. QInputDialog provides some simple static functions to quickly create a dialog box, just as QColorDialog provides the getColor function. First let's take a look at the getText function: 650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> bool isOK;
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> QString text = QInputDialog: getText (NULL," Input Dialog ",
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/>" Please input your comment ",
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> QLineEdit: Normal,
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/>" your comment ",
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> & isOK );
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> if (isOK ){
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> QMessageBox: information (NULL," Information ",
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/>" Your comment is: <B> "+ text +" </B> ",
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> QMessageBox: Yes | QMessageBox: No,
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> QMessageBox: Yes );
650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php?refimg= "+ This. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/>} The code is relatively simple. You can use the getText function to pop up a dialog box for user input: 650) this. width = 650;" onclick = 'window. open (" http://blog.51cto.com/viewpic.php?refimg= "+ This. src) 'border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1S4131215-12.png "/> Let's take a look at the signature of this function: 650) this. width = 650;" onclick = 'window. open (" http://blog.51cto.com/viewpic.php?refimg= "+ This. src) 'align =" top "src =" http://www.bkjia.com/uploads/allimg/131228/1S4133K0-0.gif "/> Static QString QInputDialog: getText (QWidget * parent, const QString & title, const QString & label, QLineEdit: EchoMode mode = QLineEdit: Normal, const QString & text = QString (), bool * OK = 0, Qt: WindowFlags flags = 0) the first parameter parent, that is, the pointer to the familiar parent component; the second parameter title is the title of the dialog box. The third parameter label is the prompt Statement on the input box. The fourth parameter mode is used to specify the input mode of QLineEdit. The value range is QLineEdit :: echoMode. The default value is Normal, that is, Normal display. You can also declare it as password. This means that the input of the password is displayed, For details, refer to the API. The fifth parameter text is the default string of QLineEdit, and the sixth parameter OK is optional. If it is not NLL, when you press the OK button in the dialog box, this bool variable is set to true. You can determine whether the user presses OK or Cancel to determine whether the text is meaningful. The seventh parameter flags is used to specify the style of the dialog box. Although there are many parameters, the meaning of each parameter is obvious. You only need to refer to the API. The Return Value of the function is QString, that is, the content entered by the user in QLineEdit. As to whether the content is meaningful, it depends on whether the OK parameter is true. QInputDialog not only provides functions for obtaining strings, but also getInteger, getDouble, and getItem functions.

This article is from the "bean space" blog, please be sure to keep this source http://devbean.blog.51cto.com/448512/219338

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.