简体   繁体   中英

how to write and read a text to and from a LineEdit using QT Creator?

I am working with QT Creator. I have a form that contains a push button and an Line Edit. I would like to print a string that i give programatically in this LineEdit.Secondly I would also like to the from the LineBox a string that I fill in and print it using QMessageBox.

How to do it? Need some help. I don't know how to access the displayText() to write and read from a LineEdit.

I would like to specify that I put the push button and the lineedit on the Form using drag and drop.

I am working in c++ under Ubuntu Appreciate.

You use QLineEdit::setText() to change the text and QLineEdit::text() to read.

Your questions are very basic and show a clear lack of studying the documentation and experimenting thing yourself. Qt is one of the better documented frameworks out there and with lots of examples. Please take your time to go through them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM