this slot works, but your programm terminated immediately. create QProcess in a heap.
wysota, you was first![]()
this slot works, but your programm terminated immediately. create QProcess in a heap.
wysota, you was first![]()
Last edited by spirit; 14th November 2008 at 08:08. Reason: updated contents
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Well, actually my program does not end. I did not paste the whole constructor code.
After connect.... line I have this:
while (true)
{
Sleep(1000)
}
So I stay in constructor and my program keeps running. It stays in constructor because I don't want it to open GUI. It's ugly I know but it works and runs hidden. With Sleep I prevent 100% CPU utilization.
create console app and run process.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
I don't want to open any window, not even console. I want it to run as services do (completely hidden), but don't know how to program real service.
Now it seems like signal-slots communication does not work until execution leaves constructor??
if you need a service you can use QtService from Qt Solutions.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Tiansen (14th November 2008)
I never programmed a service and I want to be sure that I cannot achieve my goal any other way before diving into this.
I still do not understand why it does not work as it is now.
If I comment out while loop so that it opens GUI then object indeed emits signal. So it seems that with that loop I blocked processing of signals. Any other idea to create a "hidden" launcher without programming a service?
Hmmm, now I figured out something. I can leave constructor as in first post (without while loop), but just comment out following line in main.cpp:
//w.show();
and it works as intended (launches program, shows dialog box when program exits and stays completely hidden). Does this have any side effect?
what do you want to achive? do you use any GUI in your app or you need only start another process, so you don't need GUI?
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Okay, I wil try to explain:
1. I DON'T want ANY window (NO GUI, no console either)
2. I just want to first run 2 other processes and then restart them if one of them dies/exits.
This is all I want. And it seems I can achieve that if i comment out w.show().
P.S.: I only had that QMessageBox because I tested behaviour. Application must stay completely silent normally.
there is some "magic" to hidding your app (i.e. that it don't appear in task bar), but for this "magic" you need to use platform dependent code.
so, I suggest to use QtService or take a look at QSystemTrayIcon
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Tiansen (14th November 2008)
I think I "invented" such magic too![]()
Bookmarks