Results 1 to 3 of 3

Thread: Open chm file using Qt in Linux

  1. #1
    Join Date
    Sep 2017
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Open chm file using Qt in Linux

    I have an application developed in C++ and QT that runs both in Windows and Linux(SuseLinux11). The help file was generated as a chm file. I used QDesktopServices:penurl() to open the chm file. As per the documentation of openurl():

    If the URL is a reference to a local file (i.e., the URL scheme is "file") then it will be opened with a suitable application instead of a Web browser.

    it works properly in Windows. But in Linux it tries to open using webBrowser and it fails. chmSee is installed in my Linux system which can be used to read the chm files.

    Can anyone please help here.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,689
    Thanks
    257
    Thanked 750 Times in 740 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Open chm file using Qt in Linux

    chmSee is installed in my Linux system which can be used to read the chm files.
    In Windows, the operating system keeps a table of file extension associations between the file extension ("pdf") and the application used to open that type ("acrobat.exe"). All QDesktopServices is doing is looking up that association and firing off the application (if the association exists) with the URL as a command line argument to the program.

    I am certain there is something similar in linux. You need to set up the association between "chm" extensions and the "chmSee" app. Maybe you can do this from within the app itself or maybe there is something in a file browser app that lets you do it (like Windows Explorer's "Open with" context menu option.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Sep 2017
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Open chm file using Qt in Linux

    Quote Originally Posted by d_stranz View Post
    In Windows, the operating system keeps a table of file extension associations between the file extension ("pdf") and the application used to open that type ("acrobat.exe"). All QDesktopServices is doing is looking up that association and firing off the application (if the association exists) with the URL as a command line argument to the program.

    I am certain there is something similar in linux. You need to set up the association between "chm" extensions and the "chmSee" app. Maybe you can do this from within the app itself or maybe there is something in a file browser app that lets you do it (like Windows Explorer's "Open with" context menu option.

    I found "/usr/share/applications/defaults.list" which maps the extensions to applications in SuseLinux. It already contains the mapping for chm files. So what next?
    Last edited by Anaswara; 20th September 2017 at 07:24.

Similar Threads

  1. Replies: 2
    Last Post: 25th July 2013, 06:17
  2. Replies: 1
    Last Post: 7th May 2013, 00:34
  3. Open/Executing Files on Linux
    By MBex in forum Qt Programming
    Replies: 5
    Last Post: 3rd June 2011, 00:15
  4. Replies: 3
    Last Post: 1st November 2010, 16:33
  5. Replies: 4
    Last Post: 9th May 2010, 16:18

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.