Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I automatically start application at booting

Tags:

qt

autostart

I'm using Qt.

I could not find the function or class to start application at booting time.

In windows, for example, add register to HKMU/Software/Microsoft/Windows/CurrentVersion/Run.

I wanna know the function/class like above example.

like image 646
Dong Geun Oh Avatar asked Dec 06 '25 10:12

Dong Geun Oh


2 Answers

You can use QSettings in order to set a value at Windows Registry.

QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
                    QSettings::NativeFormat);

and then use the setValue function.

However this will work only in Windows so it is better to use an #ifdef before calling it.

like image 66
pnezis Avatar answered Dec 08 '25 04:12

pnezis


The only thing I can think of is the QtService framework. It is available for all the major platforms (look here). It might not be exactly what you were looking for but it may help.

It is also important to mention that a Windows service has no direct access to the graphical interface. This means that if the application is graphical, you'll probably have to redesign it.

like image 42
Luca Carlon Avatar answered Dec 08 '25 06:12

Luca Carlon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!