title: Qt check for valid URL
body: <p>I am trying to create a Qt application which checks if a URL entered by the user into a text edit is valid.</p>
  
  <p>This is what I have so far but it only ever says the URL entered is valid, even when I enter one which is not.</p>
  
  <pre><code>bool checkUrl(const QUrl &amp;url) {
      if (!url.isValid()) {
          //qDebug(QString("Invalid URL: %1").arg(url.toString()));
          return false;
      }
      return true;
  }
  
  void MainWindow::on_pushButton_clicked()
  {
      QString usertext = ui-&gt;plainTextEdit-&gt;toPlainText();
      QUrl url = QUrl::fromUserInput(usertext);
      if (checkUrl(url))
          ui-&gt;textEdit-&gt;setPlainText("Valid URL.");
      else
          ui-&gt;textEdit-&gt;setPlainText("Invalid URL.");
  }
  </code></pre>
  
  <p>Also on the qDebug line there is an error:</p>
  
  <pre><code>/home/user/HTML/mainwindow.cpp:32: error: no matching function for call to ‘qDebug(QString)’
  </code></pre>
  
  <p>Does anyone know what the problem is as it keeps returning true?</p>