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. Convert QUrl to QString
Forum Updated to NodeBB v4.3 + New Features

Convert QUrl to QString

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 13.4k 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
    Cannabis2011
    wrote on last edited by
    #1

    I´m working on a web browser, and want a QUrl variable converted to a QString variable. How can this be done, and sorry for my bad english.

    Cannabis2011!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      d2uriel
      wrote on last edited by
      #2

      Try the "toString()":http://developer.qt.nokia.com/doc/qt-4.8/qurl.html#toString method of your QUrl object.

      "Do not judge, and you will never be mistaken." - Jean-Jacques Rousseau

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Cannabis2011
        wrote on last edited by
        #3

        Thanks for the reply. After a few experiments it worked out succesfully.

        @
        QString MainWindow::convert(QUrl input)
        {
        QString Input; Input = input.toEncoded();

        return(Input);
        

        }@

        I´m new to programming, so i still missing some understanding of it.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          You could shorten that to
          @
          QString MainWindow::convert(QUrl input)
          {
          return input.toEncoded();
          }
          @

          ...or just use toEncoded() instead of creating a convert() method.

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          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