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 503 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on 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

    JonBJ 1 Reply Last reply
    0
    • PerdrixP Perdrix

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #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 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