I want to use QLineEdit
for input. My problem is that I don't know how I can read its contents.
Let's say I have:
QLineEdit *edit = new QLineEdit("");
After adding it to the GUI how can get the content? Thanks in advance.
The QLineEdit widget is a one-line text editor. More... A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop (see setDragEnabled ()).
The most common setting is Normal, in which the text entered by the user is displayed verbatim, but QLineEdit also supports modes that allow the entered text to be suppressed or obscured: these include NoEcho, Password and PasswordEchoOnEdit. The widget's display and the ability to copy or drag the text is affected by this setting.
Last Updated : 18 Aug, 2020 QLineEdit : It allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop. It is the basic widget in PyQt5 to receive keyboard input, input can be text, numbers or even symbol as well.
An input box or line edit is added to the window, this is called a QLineEdit. You can connect every keypress in the input box ( QLineEdit) with a method call. In that method set the labels text and adjust the labels size.
It has a text
property, so simply do:
edit->text();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With