Results 1 to 4 of 4

Thread: Resolving external executables path in platform independent way

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Location
    Oulu, Finland
    Posts
    23
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: Resolving external executables path in platform independent way

    Hi again,

    now I have tested some different methods of launching external applications and files. I have used QProcess and QDesktopServices for launching. They seem to do their job as expected in Windows but with Linux QDesktopServices doesn't want to launch external applications directly. Although it opens files, for example pdf files, as expected in default PDF reader program.

    Now is there a way to get QDesktopServices to launch application executables also in Linux. Or should i just use QProcess to launch executables, as it works fine.

    Here's code that does it's job as expected:
    Qt Code:
    1. QString program = "/path/to/executable";
    2. QStringList arguments;
    3.  
    4. QProcess *process = new QProcess(this);
    5. process->start(program, arguments);
    To copy to clipboard, switch view to plain text mode 

    The following code does the job in Windows but does nothing in Linux:
    Qt Code:
    1. QDesktopService::openUrl(QUrl("path/to/executable"));
    To copy to clipboard, switch view to plain text mode 

    So is there a way to get QDesktopServices working or should I just use QProcess to start those executables and stick with QDesktopServices with other kind of files and resources? I would really like to use just QDesktopServices to do the job because it's so simple way to launch different type of files with their default programs...

    Edit: I looked the application output and it says "No application is registered as handling this file", so it seems that Linux is expecting some other application to launch these, even if the file is executable itself. Which seems quite strange... I have to take closer look at that then
    Last edited by Tepi; 18th January 2010 at 12:55.

Similar Threads

  1. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 18:50
  2. Replies: 16
    Last Post: 23rd May 2008, 11:12
  3. Crash handler on Win32
    By niko in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 20:41

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
  •  
Qt is a trademark of The Qt Company.