Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. 4144357970 is a "valid" QUrl?

4144357970 is a "valid" QUrl?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 768 Views 2 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.
  • P Offline
    P Offline
    Pippin
    wrote on last edited by
    #1

    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())
    		QDesktopServices::openUrl(foo);
    	else
    		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?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I think by valid it means it do not contains any invalid letters
      https://url.spec.whatwg.org/#urls
      Not if it points to something real.

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

      1 Reply Last reply
      2
      • P Offline
        P Offline
        Pippin
        wrote on last edited by
        #3

        That would make sense, thanks @mrjj.

        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