SOLVED: Comparing line edit to a specific phrase



  • Hi, how can you compare the entered text in line edit to a specific text you mentioned in the program? For my case, i tried this:
    @
    void MainWindow::on_button3_clicked()
    {
    QString LIN;
    LIN = "Local Interconnected Network";
    QString = scanned;
    scanned = ui->textbox3->editingFinished();
    if (ui->textbox3->text()==LIN)
    {
    ui->textbox3->clear();
    ui->textbox3->insert(LIN);
    ui->textbox3->setDisabled(true);
    ui->checkbox3->setChecked(true);
    ui->button3->setDisabled(true);
    }
    else
    {
    ui->textbox3->clear();
    ui->textbox3->insert(LIN);
    ui->textbox3->setDisabled(true);
    ui->checkbox3->setChecked(false);
    ui->button3->setDisabled(true);
    }
    }
    @

    But it doesn't work :/


  • Lifetime Qt Champion

    Hi,

    @scanned = ui->textbox3->editingFinished(); << signal@

    Doesn't make sense.

    @QString scanned = ui->textbox3->text(); << text getter@



  • Yes it works! Thank you!!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.