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. Browse web page
Forum Update on Monday, May 27th 2025

Browse web page

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.2k Views
  • 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.
  • S Offline
    S Offline
    sosoia
    wrote on 17 Aug 2013, 15:11 last edited by
    #1

    How to browse to a Q URl ?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 17 Aug 2013, 15:58 last edited by
      #2

      Use a QWebview for displaying a webpage.
      Use QWebview's setUrl(const QUrl & url) method for setting the URL you wish to display.

      • pass QUrl as something like QUrl("http://www.google.com").

      157

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ArbolOne
        wrote on 17 Aug 2013, 16:39 last edited by
        #3

        In Qt4.8.x under the header file "QUrl" (#include <QUrl>) the class has several constructors of which, for your purpose, ' QUrl ( const QString & url ) ' or perhaps ' QUrl ( const QString & url, ParsingMode parsingMode ) ', would be most appropriate, but it depends of what you are looking for.
        Another option is to use th 'QUrl ()' constructor and then use 'setUrl ( const QString & url )' or ' setUrl ( const QString & url, ParsingMode parsingMode )'.
        Example:
        @
        #include <QUrl> //Qt UR
        #include <memory> // smart pointer
        #include <string>
        int main(){
        std::string url;

        // ..... some other code .....

        if(url.empty()){
        std::shared_ptr<QUrl > myUrl;
        }else{
        std::shared_ptr<QUrl > myUrl(url);
        }

        // ..... some other code .....
        

        // if the non parameterized constructor was used, use default URL address
        if(url.empty()){
        myUrl->setUrl("http://www.bing.com") ;
        }
        return 0;
        }

        @

        I have NOT checked the code, but it will help you understand the main concept I hope; but if not, keep asking, folks here a very help full.

        This is not the first time you've been here, at the end you've always lost. You create viruses and we the cure, and in this battle you've always lost.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sosoia
          wrote on 18 Aug 2013, 17:26 last edited by
          #4

          I thank everyone for the answers

          1 Reply Last reply
          0

          1/4

          17 Aug 2013, 15:11

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved