Results 1 to 3 of 3

Thread: How to Assign a Variable into LineEdit

  1. #1
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to Assign a Variable into LineEdit

    Hello,

    I want to assign a variable from lineedit but cant. For example:

    Qt Code:
    1. ofstream file("file.txt");
    2.  
    3. file << ui->LineEdit->text(); //this is not work.
    4. << ui->LineEdit; // this is write a thing like "00FD7" into the file. I hope its memory address?
    To copy to clipboard, switch view to plain text mode 

    thanks for helps
    Last edited by mcht_z; 18th February 2011 at 18:59.

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to Assign a Variable into LineEdit

    You could use QTextStream :
    Qt Code:
    1. QFile data("output.txt");
    2. QTextStream out(&data);
    3. out << ui->LineEdit->text();;
    To copy to clipboard, switch view to plain text mode 

    Otherwise, you could use ui->LineEdit->text().toAscii() I think.

    Best regards,
    Marc

  3. #3
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to Assign a Variable into LineEdit

    Thank you very much. I was waiting this answer

Similar Threads

  1. Cannot assign to pixmap during painting
    By fanatos in forum Qt Programming
    Replies: 9
    Last Post: 22nd February 2016, 17:56
  2. How to assign IP address to eth0 in QT
    By csw00700 in forum Qt Programming
    Replies: 4
    Last Post: 7th February 2011, 13:31
  3. How to correctly re-assign a pointer?
    By homerun4711 in forum Newbie
    Replies: 26
    Last Post: 4th January 2011, 16:39
  4. boost::assign
    By Sivert in forum General Programming
    Replies: 0
    Last Post: 2nd May 2007, 00:23
  5. I can't assign TableView signals...
    By tomek in forum Newbie
    Replies: 5
    Last Post: 9th January 2006, 21:04

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
  •  
Qt is a trademark of The Qt Company.