Possible Duplicate:
running a qt application at startup
How can I run a qt program at startup so that the user won't see the desktop at all?
I am building my program in linux and I want to distribute it to linux users.
I want to add that code to my app, because the customers don't have any understanding about linux.
I found that QSettings
can do that, is it true? What about QService
? Can we use a simple code like this?
QSettings a;
A.setpath(IniFormat,SystemScope,/etc/xdg)
QSettings has zero relevance to this and QService is for Symbian devices. In fact, your question has nothing to do with Qt.
What you need to do is place a *.desktop shortcut or link to the application in the user's startup folder. See:
http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html.
For example, if I want to start the application /opt/myapp/myapp_executable
at login, I would create a myapp.desktop
file with the following contents:
[Desktop Entry]
Exec=/opt/myapp/myapp_executable
and put it in my ~/.config/autostart directory.
If you want it to be executed for every user at login, then you'd put it in /etc/xdg/autostart/. But again, check the XDG site because the directory can be different if an XDG environment variable is set that overrides the default.
Your question really belongs on http://superuser.com
If you are using linux, use cron
to launch your program, add something like this to crontab
:
@reboot /path/to/program
Or to launch it at user login, append /path/to/program
to ~/.bashrc
or ~/.bash_profile