Unsolved QlineEdit
-
How to get access of QlineEdit?
something like this:
ui_filename->textEdit->plainText();
What is the right syntax?
Actually i want take input from the user and write it into the file using qlineEdit?
If you sent sample code of given above problem using data serialization it will be much helpful -
@shree_qt For
QLineEdit
the correct method is text(). If you want to put just the text into a file then use QTextStream and if you want to serialize objects then look for QDataStream -
Save is pretty straightforward if you just want to save text
#include <QFile> #include <QTextStream> int save() { QString filename = "c:/thepath/Data.txt"; QFile file(filename); if (file.open(QIODevice::ReadWrite)) { QTextStream stream(&file); stream << "something" << endl; } else qDebug() << "save failed"; }
-
I want to write into file as given input by user in qLineEdit. Something like assigning a user value to variable and writing it into file. What can i do for it?
-