run application on startup (raspberry PI)
-
hi dear! thanks for your fast reply, i got a few questions, when you say (rc.localin /etc.) you mean to rootfs/etc?, i am trying to paste the project there but i Cant, i press right click but the paste option is no enabled. How can I add my program to start in the boot?
My method is wrong?. Thanks! -
dear! i found the option:
Project > Run settings > Deployment "Make this application the default one". when i turn on my raspberry PI i have a small QT introduction and my application starts automatically, now, how i can do to turn on my application immediately when i turn on the raspberry pi (without QT introduction)? -
Normally you deploy your program to a folder say
/home/rpi/myprog
.
The file/etc/rc.local
is a bash script that is run on startup. So just add a
line to the bottom of this file pointing to your program.
See https://www.raspberrypi.org/documentation/linux/usage/rc-local.md for more information. -
i finally find that i was wanted for a long time is here:
http://doc.qt.io/QtForDeviceCreation/qtee-customization.html#booting-to-a-custom-application -
Include this header QSettings
#include <QSettings>
Add this into your code.
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); settings.setValue("YourApplicationName", QCoreApplication::applicationFilePath().replace('/', '\\'));
And when you want to disable startup`
settings.remove("YourApplicationName");