Reading 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. 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.

    void MainWindow::on_pushButton_clicked()
    QString num1;
    num1 = LatEdit->Plain;

    Can anyone help me?


    [EDIT: code formatting, please wrap in @-tags, Volker]

  • Read "this":, then try

    QString num1 = ui->LatEdit->toPlainText();

  • You can find some information "here":

Log in to reply