Results 1 to 2 of 2

Thread: Problem>QT and Mini2440: Get text from Line edit

  1. #1
    Join Date
    Nov 2011
    Posts
    3
    Qt products
    Platforms
    Windows

    Default Problem>QT and Mini2440: Get text from Line edit

    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
    Qt Code:
    1. QString text="";
    2. text=text_setspeed->text(); //text_setspeed is the name of the Line edit
    3. write(fd,text.latin1(),text.length());
    4. // But if I code like this, it has no error:
    5. QString text="abc";
    6. write(fd,text.latin1(),text.length());
    To copy to clipboard, switch view to plain text mode 

    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.test5.zip
    Thank you in advance.

  2. #2
    Join Date
    Nov 2011
    Posts
    3
    Qt products
    Platforms
    Windows

    Default Re: Problem>QT and Mini2440: Get text from Line edit

    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.

Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 19:06
  2. Replies: 3
    Last Post: 26th August 2010, 08:57
  3. Checking max text lenght to fit in line edit?
    By maverick_pol in forum Qt Programming
    Replies: 2
    Last Post: 16th June 2008, 00:24
  4. Line Edit Controll problem
    By mansoorulhaq in forum Qt Programming
    Replies: 5
    Last Post: 31st October 2007, 08:33
  5. Replies: 8
    Last Post: 15th May 2007, 09:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.