PDA

View Full Version : Problem>QT and Mini2440: Get text from Line edit



mrquicuong
25th November 2011, 03:34
Hi there,
My project uses QtDesigner to create a GUI for Kit Mini2440. It has a Line edit box to receive texts from user and send them via UART. All project was built without error and downloaded to the Mini2440 successfully.
But, when I press SEND button to send texts in this box "Line edit", I got the message "[name of project] was terminated due to application error (11)".
This is my code to change get text and send them:
I use library "terminos.h" for UART


QString text="";
text=text_setspeed->text(); //text_setspeed is the name of the Line edit
write(fd,text.latin1(),text.length());
// But if I code like this, it has no error:
QString text="abc";
write(fd,text.latin1(),text.length());


I guess I has problem when change type of variable from Qstring >> char * by "text.latin1()". Because the function write() is defined as: write(fd, data, n_bytes);
with char *data and int n_bytes.
Ps: I attached my project.7128
Thank you in advance.

mrquicuong
26th November 2011, 13:26
Anyone help me, please.
I think my code written on Ubuntu not suitable for Kit FriendlyArm although I build successfully.
Maybe this code "Qstring a=text_setspeed->text()" created the error "motor was terminated due to application error (11)"."
Thank you everyone.