Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SOLVED: Comparing line edit to a specific phrase
Forum Updated to NodeBB v4.3 + New Features

SOLVED: Comparing line edit to a specific phrase

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 732 Views 1 Watching
  • 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 Offline
    C Offline
    crystal_ice
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • C Offline
        C Offline
        crystal_ice
        wrote on last edited by
        #3

        Yes it works! Thank you!!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved