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. Open a Link in google chrome using QT
QtWS25 Last Chance

Open a Link in google chrome using QT

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.8k 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.
  • A Offline
    A Offline
    AmrCoder
    wrote on 9 May 2018, 09:33 last edited by
    #1

    Hello
    iam want to open a link in google chrome browser so I use this code

    QString link = "http://www.google.com";
    QDesktopServices::openUrl(QUrl(link));
    

    but here is the problem when i use this link to open it in chrome

    chrome://settings/
    

    any link that opens a chrome setting it not open so i should open it manually, it open on an empty tab so how can I do this or automate this process if it will not in the normal way.
    Thanks in advance.

    P 1 Reply Last reply 9 May 2018, 14:32
    0
    • A AmrCoder
      9 May 2018, 09:33

      Hello
      iam want to open a link in google chrome browser so I use this code

      QString link = "http://www.google.com";
      QDesktopServices::openUrl(QUrl(link));
      

      but here is the problem when i use this link to open it in chrome

      chrome://settings/
      

      any link that opens a chrome setting it not open so i should open it manually, it open on an empty tab so how can I do this or automate this process if it will not in the normal way.
      Thanks in advance.

      P Offline
      P Offline
      Pablo J. Rogina
      wrote on 9 May 2018, 14:32 last edited by
      #2

      @AmrCoder said in Open a Link in google chrome using QT:

      chrome://settings/

      are you sure you can open that page with Chrome (by the way, please state your OS) from command line?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • A Offline
        A Offline
        AmrCoder
        wrote on 9 May 2018, 15:33 last edited by
        #3

        iam using Windows 10
        QT 5.10.0
        no really if I try to open this link which is setting page I can't open it using the command line like this

        chrome.exe chrome://setting/
        

        but for sure it opens other websites to use this link in google chrome I must write it manually in the search bar.

        1 Reply Last reply
        -1
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 9 May 2018, 15:36 last edited by
          #4

          Hi
          That will not work on Windows as
          chrome: is NOT registered as a protocol.
          The concept is called URI Schemes
          its possible to add to registry new ones
          https://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-e-g-so

          BUt that might not be optimal but depends on your actual use case :)

          P 1 Reply Last reply 9 May 2018, 16:11
          4
          • M mrjj
            9 May 2018, 15:36

            Hi
            That will not work on Windows as
            chrome: is NOT registered as a protocol.
            The concept is called URI Schemes
            its possible to add to registry new ones
            https://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-e-g-so

            BUt that might not be optimal but depends on your actual use case :)

            P Offline
            P Offline
            Pablo J. Rogina
            wrote on 9 May 2018, 16:11 last edited by
            #5

            @mrjj great info about registering custom protocols under Windows. However I guess in this particular case (chrome:) even when @AmrCoder is able to add it, Chrome won't show the settings page, that's why I asked him to try on command line beforehand.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            M 1 Reply Last reply 9 May 2018, 16:15
            1
            • P Pablo J. Rogina
              9 May 2018, 16:11

              @mrjj great info about registering custom protocols under Windows. However I guess in this particular case (chrome:) even when @AmrCoder is able to add it, Chrome won't show the settings page, that's why I asked him to try on command line beforehand.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 9 May 2018, 16:15 last edited by
              #6

              @Pablo-J.-Rogina
              I think you are right. For safety reason.
              But i never tried with chrome settings. Only an actual custom protocol. :)

              1 Reply Last reply
              1

              6/6

              9 May 2018, 16:15

              • Login

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