Getting problem in using textedit inside write in tcp qt ...!!!!
-
hello im doing a tcp program in qt i want to send content of textedit on client side to textedit on server side for this i used
write(ui->textedit->settext("hello"));
but this giving a error like this
E:\Qt_files\cust_send\secdialog.cpp:23: error: invalid use of void expression
sendsocket->write(ui->textEdit->setText("hello"));
but if use lineedit instead of it ,everything works fine but my intention is to use textedit so can anyone solve this problem....??thanks
-
Hello ecmanja,
You are doing 2 tasks at the same time writing string on socket as well as setting text on textEdit .
First of all set the text in textEdit after that take a QString variable that will hold the entire text of textEdit using QString toPlainText () const and then pass this variable to write() function.Hope it will work..