[Qt-interest] return to command line but the GUI is still alive

Forest Yang yzine0511 at gmail.com
Tue Jan 26 04:19:06 CET 2010


Thanks Colin,

This is exactly what I want !


Forest.


On Sun, Jan 24, 2010 at 3:12 PM, Colin S. Miller
<no-spam-thank-you at csmiller.demon.co.uk> wrote:
> Forest Yang wrote:
>> Thanks ! I was too curious about the techniques to forget this simple one.
>>
>> Just for curious, can we implement the similar thing without "&" ? I
>> saw this effect from a TCL/TK program and also Acrobat Reader.
>>
>> One good future usage would be like Acrobat Reader, if there are files
>> opened, or one acroreader alive, when execute
>>
>> $ acroread file.pdf
>>
>> It just open a new tab in the reader and return to shell, even you did
>> not put a "&" at the end
>>
>>
> Forest,
> this is the normal way of doing this.
> The child should be able to read stdin
> after forking, but I've never tried.
>
> However, the child process is no longer considered
> a (grand)child of the shell that invoked it.
>
> HTH,
> Colin S. Miller
>
>
> int main(int argc, char** argv)
> {
>   pid_t pid;
>
>   pid=fork();
>   if (pid==0)
>   {
>     /* we're the child */
>     QApplication qapp(argc, argv);
>     MainWindow mainWindow;
>     mainWindow.show();
>
>     qapp.setMainWidget(&mainWindow);
>     qapp.exec();
>   }
> }
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>




More information about the Qt-interest-old mailing list