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. Setting a filetype association with the application the Qt way?
Forum Updated to NodeBB v4.3 + New Features

Setting a filetype association with the application the Qt way?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 497 Views 2 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.
  • P Offline
    P Offline
    Perdrix
    wrote on 9 Oct 2022, 14:41 last edited by
    #1

    Windows code currently makes entries in the Windows Registry HKEY_CLASSES_ROOT to associate a particular file extension with my application. Is there a Qt way to achieve this in a platform independent manner?

    Thanks
    David

    J 1 Reply Last reply 9 Oct 2022, 15:45
    0
    • P Perdrix
      9 Oct 2022, 14:41

      Windows code currently makes entries in the Windows Registry HKEY_CLASSES_ROOT to associate a particular file extension with my application. Is there a Qt way to achieve this in a platform independent manner?

      Thanks
      David

      J Online
      J Online
      JonB
      wrote on 9 Oct 2022, 15:45 last edited by JonB 10 Sept 2022, 15:48
      #2

      @Perdrix
      I don't think Qt has this, because it's so OS specific, and for Linux at least I'm not sure what it means. For Windows the wiki offers code at https://wiki.qt.io/Assigning_a_file_type_to_an_Application_on_Windows. Actually a lot of that code looks rather old to me.

      Windows code currently makes entries in the Windows Registry HKEY_CLASSES_ROOT

      Yes, but doesn't this require elevated permission? Usually this is done from an installer running with privileges?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SimonSchroeder
        wrote on 17 Oct 2022, 07:57 last edited by
        #3

        I have to agree with @JonB. Qt does not provide anything as this is specific to the operating system. Also, he is right that it should be done by the installer (on most platforms).

        On Windows you have to set entries in the registry. You seem to have that figured out already.

        For Linux we are using xdg-mime install ... to register file extensions and xdg-mime default MyApp.desktop ... to associate the file extensions with MyApp. In most Linux file explorers this should work as expected. Also, you can use xdg-open [filename] to use this information on the command line.

        macOS usually does not use an installer. Hence, this information needs to be entered into a .plist file which resides in the application folder. This will automagically register the file extensions with the software when placed in the Applications folder.

        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