Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, April 2007
QProcess not starting my program


Message 1 in thread

Hello-

First time using QProcess, seemed easy enuf.
Im in a QT gui, I try launching another QT gui
using QProcess but it never seems to start
and the process falls through the code:

        QProcess *proc = new QProcess(this);
        QStringList env = QProcess::systemEnvironment();
        proc->setEnvironment(env);
        proc->setWorkingDirectory(".");
        proc->setStandardOutputFile("./out");

        QStringList args;
        args << " -d directory";

        proc->start("mygui", args);
        proc->waitForStarted(5000);
printf("Proc state: %d\n",proc->state());

I get one line of output in my 'out' file
and proc state is = 2 (running), however the
GUI never comes up.  The GUI works just fine
standalone, so I assume its my use of QProcess
somehow.

Suggestions/advice?  This is QT 4.2.2 
Thanks,
Jeff

--
 [ signature omitted ] 

Message 2 in thread

Hi,

do you have this problem only under linux?

I had the problem that my Qt gui apps only
could be started inside an xterm - when I
tried to start them by another program,
they didn't show up.

Hint: You could try to open an xterm and
provide your app as parameter for xterm -
e.g.:  "xterm -e ~/mygui"

ciao,
Chris


--
 [ signature omitted ] 

Message 3 in thread

On Thursday 12 April 2007 06:33, Jeff Lacki wrote:
> Hello-
>
> First time using QProcess, seemed easy enuf.
> Im in a QT gui, I try launching another QT gui
> using QProcess but it never seems to start
> and the process falls through the code:
>
>         QProcess *proc = new QProcess(this);
>         QStringList env = QProcess::systemEnvironment();
>         proc->setEnvironment(env);
>         proc->setWorkingDirectory(".");
>         proc->setStandardOutputFile("./out");
>
>         QStringList args;
>         args << " -d directory";
>
>         proc->start("mygui", args);
>         proc->waitForStarted(5000);
> printf("Proc state: %d\n",proc->state());
>
> I get one line of output in my 'out' file
> and proc state is = 2 (running), however the
> GUI never comes up.  The GUI works just fine
> standalone, so I assume its my use of QProcess
> somehow.
>
> Suggestions/advice?  This is QT 4.2.2
> Thanks,
> Jeff

Your sample code works fine with QT 4.2.3 and proc->start("./mygui", args) or 
proc->start("mygui", args) in case mygui is in the path.

I get state = 0 if mygui cannot be found when using proc->start("mygui", args) 
without having it in the path. Does the single line in the output file 
indicate that the mygui application was actually started? My 'out' file is a 
zero length file if the application failed to start.


Regards,
Enar

--
 [ signature omitted ] 

Message 4 in thread

Enar VÃikene wrote:

>Your sample code works fine with QT 4.2.3 and proc->start("./mygui", args) or 
>proc->start("mygui", args) in case mygui is in the path.
>
>I get state = 0 if mygui cannot be found when using proc->start("mygui", args) 
>without having it in the path. Does the single line in the output file 
>indicate that the mygui application was actually started? My 'out' file is a 
>zero length file if the application failed to start.
>
>
>  
>
This is under linux (I dont have it setup under any other OS to try it 
there).
Yes Im doing :

proc->start("./mygui", args)

Im sorry, I should have said that it seems to startup
but never actually comes up.  I do get one line in my
output file during the main.cpp command line processing right
before my splash screen gets started (which does not come up).

Jeff




--
 [ signature omitted ] 

Message 5 in thread

Sorry for the waste of bandwidth.  I found my issue.  I didnt
do a setProcessChannelMode(QProcess::MergedChannels);
So I wasnt getting my stderr output in the log file telling me I had
a command line argument error.

Thanks for the help and suggestions.
Jeff

>On Thursday 12 April 2007 06:33, Jeff Lacki wrote:
>  
>
>>Hello-
>>
>>First time using QProcess, seemed easy enuf.
>>Im in a QT gui, I try launching another QT gui
>>using QProcess but it never seems to start
>>and the process falls through the code:
>>
>>        QProcess *proc = new QProcess(this);
>>        QStringList env = QProcess::systemEnvironment();
>>        proc->setEnvironment(env);
>>        proc->setWorkingDirectory(".");
>>        proc->setStandardOutputFile("./out");
>>
>>        QStringList args;
>>        args << " -d directory";
>>
>>        proc->start("mygui", args);
>>        proc->waitForStarted(5000);
>>printf("Proc state: %d\n",proc->state());
>>
>>I get one line of output in my 'out' file
>>and proc state is = 2 (running), however the
>>GUI never comes up.  The GUI works just fine
>>standalone, so I assume its my use of QProcess
>>somehow.
>>
>>Suggestions/advice?  This is QT 4.2.2
>>Thanks,
>>Jeff
>>    
>>


--
 [ signature omitted ]