Important: Please read the Qt Code of Conduct -

4144357970 is a "valid" QUrl?

  • Hello,

    this is a continuation of this thread that is now solved.

    The following line is run at the start of my program:

    QObject::connect(someQTextBrowser, SIGNAL(anchorClicked(const QUrl&)), this, SLOT(openUrl(const QUrl&)));

    Some time later, the following line is run:

    someQTextBrowser->append("<a href=" + QString::number(someQuint32) + ">" + someQString + "</a>");

    which creates and appends an url. When I click the url, the following slot is called:

    void MyInterface::openUrl(const QUrl& foo) const
    	if (foo.isValid())
    		std::cout << foo.url().toStdString() << std::endl;

    Problem, no matter what quint32 I put in my urls, they are always considered "valid," which makes no sense to me. How did this happen?

  • Lifetime Qt Champion

    I think by valid it means it do not contains any invalid letters
    Not if it points to something real.

    So 4144357970 is just fine as it could be used as url.
    since all digits are allowed.

  • That would make sense, thanks @mrjj.

Log in to reply