Qt Forum

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

    Unsolved error: ‘class QUrl’ has no member named ‘setEncodedUrl’; did you mean ‘toEncoded’?

    General and Desktop
    2
    4
    406
    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.
    • B
      BeefTaco last edited by

      I have made a custom server using Qt, i installed in in vps with Debian GNU/Linux 9.1 (stretch), then installed qt:

      apt-get install qtcreator

      After that i have done:
      qmake -qt=qt5
      make

      the qt version output is:

      Using Qt version 5.7.1 in /usr/lib/x86_64-linux-gnu

      But then, when i try to compile my code i get errors on this methods of QUrl class

      
      httpd.cpp:210:20: error: ‘class QUrl’ has no member named ‘setEncodedUrl’; did you mean ‘toEncoded’?
               urlRequest.setEncodedUrl(
                          ^~~~~~~~~~~~~
      scpp:221:32: error: ‘class QUrl’ has no member named ‘setEncodedHost’; did you mean ‘toEncoded’?
                           urlRequest.setEncodedHost(strLine);
                                      ^~~~~~~~~~~~~~
      s.cpp:223:32: error: ‘class QUrl’ has no member named ‘setEncodedHost’; did you mean ‘toEncoded’?
                           urlRequest.setEncodedHost(strLine.left(intSepPos));
                                      ^~~~~~~~~~~~~~
      s.cpp:236:20: error: ‘class QUrl’ has no member named ‘setEncodedUrl’; did you mean ‘toEncoded’?
               urlRequest.setEncodedUrl(elements.at(1));
      

      Does qt 5.7.1 doesn't have those methods?

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

        Hi
        They are flagged obsolete
        http://doc.qt.io/qt-5/qurl-obsolete.html
        As far as i know, setUrl can be used as it handles encoded also.

        1 Reply Last reply Reply Quote 2
        • B
          BeefTaco last edited by

          Re: error: ‘class QUrl’ has no member named ‘setEncodedUrl’; did you mean ‘toEncoded’?

          What about encodedHost?

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @BeefTaco last edited by

            http://doc.qt.io/qt-5/qurl-obsolete.html#encodedHost
            "This function is equivalent to calling QUrl::toAce() on the return value of host()."

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