Results 1 to 6 of 6

Thread: Reading text from a PlainTextEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    1

    Default Reading text from a PlainTextEdit

    Hello,

    This I'm sure is an immensely stupid question, however it's so simple that I can't find the answer to it by searching anywhere. I want to take the information from a PlainTextEdit, put it into a variable and use it elsewhere (for example to populate another box later on). I have the following, where LatEdit and EastingText are both PlainTextEdit's, but get the error 'LatEdit was not declared in this scope'. If I change it to 'num1 = "TEST";' then it will work, so I'm assuming it's me reading in the text incorrectly from the LatEdit control.
    Qt Code:
    1. void MainWindow::on_pushButton_clicked()
    2. {
    3. QString num1;
    4. num1 = LatEdit->Plain;
    5. ui->EastingText->setPlainText(num1);
    6. }
    To copy to clipboard, switch view to plain text mode 

    Can anyone help me?

    Thanks

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    10
    Thanked 37 Times in 36 Posts

    Default Re: Reading text from a PlainTextEdit

    are you forgetting to put 'ui->' in front of LatEdit?

  3. #3
    Join Date
    Oct 2010
    Location
    Belarus
    Posts
    71
    Qt products
    Qt4
    Platforms
    Windows Maemo/MeeGo
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: Reading text from a PlainTextEdit

    QPlainTextEdit::toPlainText () ?

    Qt Code:
    1. num1 = ui->LatEdit->toPlainText ();
    To copy to clipboard, switch view to plain text mode 
    Try read Qt documentation before ask stupid question.

  4. The following user says thank you to unit for this useful post:

    Bertie (8th March 2011)

Similar Threads

  1. Block the plainTextEdit
    By NewLegend in forum Newbie
    Replies: 6
    Last Post: 16th September 2010, 14:56
  2. How to set the Text Cursor in a PlainTextEdit box?
    By Mia S. in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2010, 16:30
  3. Replies: 2
    Last Post: 13th February 2010, 18:33
  4. Access violation when reading big text files
    By robertson1 in forum General Programming
    Replies: 0
    Last Post: 18th September 2008, 06:59
  5. problem with reading text files
    By Axsis in forum Newbie
    Replies: 1
    Last Post: 25th April 2008, 12:29

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.