Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    SOLVED: Comparing line edit to a specific phrase

    QML and Qt Quick
    2
    3
    547
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      crystal_ice last edited by

      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 :/

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

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

        Doesn't make sense.

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • C
          crystal_ice last edited by

          Yes it works! Thank you!!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post