Results 1 to 6 of 6

Thread: System File Association

  1. #1
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default System File Association

    Is there a programmatic way to associate a file extension with the application? Then the user could double-click the file name to start the app with that file. I understand that it can be done in the install program, but I would like to do it within the code. Thanks.

  2. #2
    Join Date
    Jul 2010
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: System File Association

    What you're asking for is OS-specific, and not really a Qt question. The OS has to know to start one app or another. If you're packaging your program for Linux, you usually want to include the file association in a post-install script of your package.

    Have a look at Wikipedia http://en.wikipedia.org/wiki/File_association to start .

  3. #3
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: System File Association

    Thanks. Yes, I know that the associations are OS specific, but much of Qt is designed to make OS specific code disappear. I was hoping that this deployment detail had been considered in code, so that the relevant files/registrations could be handled directly. I suppose not.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: System File Association

    Typically, the job of associating applications with extensions is done by the OS-specific installer of your application, not your application itself.

  5. #5
    Join Date
    Nov 2010
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: System File Association

    Quote Originally Posted by suslik View Post
    What you're asking for is OS-specific, and not really a Qt question. The OS has to know to start one app or another. If you're packaging your program for Linux, you usually want to include the file association in a post-install script of your package.

    Have a look at Wikipedia http://en.wikipedia.org/wiki/File_association to start .
    I thought that the sole purpose of Qt is to handle "OS-specific" issues.
    Currently a developer has to go through a lot of pain implementing it himself. It is relativaly straightforward on Windows but Linux is a mess. For example Gnome 2.2 is very different from Gnome 2.8 implementation.
    And no, it is not the installer only issue. It might be if the application handles a single file extension.
    Many applications that handle multiple file associations allow the user to change the settings.

  6. #6
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: System File Association

    Exactly, but this detail is not as interesting as others, and so is unlikely to get support. We probably need to volunteer.

Similar Threads

  1. Replies: 0
    Last Post: 12th April 2010, 07:05
  2. How to get system associated icon for any file
    By rittchat in forum Qt Programming
    Replies: 0
    Last Post: 15th December 2009, 04:16
  3. Replies: 3
    Last Post: 29th October 2009, 17:52
  4. copy and run a .exe file in another system
    By sabeesh in forum Installation and Deployment
    Replies: 3
    Last Post: 22nd August 2007, 10:05
  5. association between 2 classes
    By castorvert in forum General Programming
    Replies: 4
    Last Post: 5th April 2006, 07:52

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.