Results 1 to 3 of 3

Thread: Start application in QT

  1. #1
    Join Date
    Feb 2012
    Posts
    33
    Qt products
    Qt4

    Default Start application in QT

    Hello,
    I want to start an application in the same folder of my application in Debian, for example the calculator (gcalctool). In Windows I have no problem.
    Where is may error?

    QProcess *process = new QProcess(0);
    QString folder = "";
    process->start("gcalctool", QStringList() << folder);

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Start application in QT

    You are using a path relative to your current working directory which might be different to what you are assuming. Better use an absolute path. You can use QCoreApplication::applicationDirPath() to get an absolute path to the directory containing your application binary.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2012
    Posts
    33
    Qt products
    Qt4

    Default Re: Start application in QT

    I modified my code, and I write the absolute path:

    QProcess *process = new QProcess(0);
    process->start("/home/eltec/Programmi QT/Shell/calcolatrice");

    "calcolatrice" is a "gcalctool" copy in the application folder ("/home/eltec/Programmi QT/Shell").

    If I start "gcalctool", I have no problem, because this application is in the "/usr/bin" folder and Debian knows the system path.
    But if I want to start an application with another path, the application do not start.
    I repeat that "calcolatrice" is a "gcalctool" copy and it starts without problem if I double click on it.


    Added after 8 minutes:


    process->start("./gcalctool");

    Debian start binary files only in the system path. With "./" I said Debian to start application in the current path.

    Resolved, thanks.
    Last edited by eltecprogetti; 12th April 2012 at 09:46.

Similar Threads

  1. Windows CE + Application does start
    By uygar in forum Installation and Deployment
    Replies: 0
    Last Post: 21st October 2011, 18:10
  2. QProcess start hangs application
    By hakermania in forum Newbie
    Replies: 3
    Last Post: 10th September 2011, 08:43
  3. Start application when OS starts
    By sophister in forum Qt Programming
    Replies: 16
    Last Post: 13th April 2011, 06:38
  4. How to start external application from QT?
    By TomASS in forum Newbie
    Replies: 10
    Last Post: 7th November 2009, 17:57
  5. PyQT application start
    By mejustme in forum Newbie
    Replies: 2
    Last Post: 6th June 2008, 18:15

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.