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. How to register application to handle custom uri:// scheme?
Forum Updated to NodeBB v4.3 + New Features

How to register application to handle custom uri:// scheme?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 5 Posters 1.8k Views 3 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.
  • V Offline
    V Offline
    Vadi2
    wrote on last edited by
    #1

    I'd like my Qt application to be opened whenever myapplication:// is invoked on Windows, macOS, and Linux - does anyone have any experience with setting this up?

    I've looked around in Qt documentation but this doesn't seem to be covered, and the details on the web are scarce or outdated for 2019. Thanks!

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      This is OS-specific and Qt can't do anything for it. For Windows see e.g. https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914(v=vs.85)?redirectedfrom=MSDN

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • G Offline
        G Offline
        glenm
        wrote last edited by
        #3

        For the benefit of others ... In order to do this I'm pursuing the use of an IFW "Execute" operation to run a PowerShell script that modifies the registry.
        https://forum.qt.io/topic/107524/qt-installer-framework-execute-command

        I think that @christian might be overstating the "can't" part of his message, given how many OS-specific facilities have recently been generalized so nicely in Qt.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote last edited by
          #4

          ... and six years later the answer is essentially the same.

          The action of launching your application when the URI scheme (or document type) is "executed" is entirely outside the application. This is an operating system specific configuration that, as you have noticed, can be achieved at install time by your installer of choice. That's generally the cleanest way to get it done.

          For this specific example on Windows, you could put OS-specific, first-time-run code in your application (using QSettings as a wrapper on the Windows registry) but it would require executing at least once with elevated privileges. You might do this in your installer...

          This is not a run time facility of your application that the Qt library can generalise.

          1 Reply Last reply
          1
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote last edited by
            #5

            https://doc.qt.io/qt-6/qdesktopservices.html#setUrlHandler does it for macOS/iOS/Android, but not for Windows/Linux I believe

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            1

            • Login

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