Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. run application on startup (raspberry PI)
Forum Updated to NodeBB v4.3 + New Features

run application on startup (raspberry PI)

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 5 Posters 11.1k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ModongaM Offline
    ModongaM Offline
    Modonga
    wrote on last edited by
    #1

    I am study and trying with QT for device (I am very noob), the question is simple, it is possible to run my own application on raspberry startup? Thanks for your help I hope that i can help you too!

    1 Reply Last reply
    0
    • sneubertS Offline
      sneubertS Offline
      sneubert
      wrote on last edited by sneubert
      #2

      Hi Modonga,

      the easiest way would be to add your program to rc.localin /etc.

      1 Reply Last reply
      0
      • ModongaM Offline
        ModongaM Offline
        Modonga
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • ModongaM Offline
          ModongaM Offline
          Modonga
          wrote on last edited by
          #4

          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)?

          1 Reply Last reply
          0
          • sneubertS Offline
            sneubertS Offline
            sneubert
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • ModongaM Offline
              ModongaM Offline
              Modonga
              wrote on last edited by
              #6

              no dear, i got in the raspberry the boot2QT i does not have that directory... ONLY way is "Make this application the default one" in Run settings. Regards!

              1 Reply Last reply
              0
              • ModongaM Offline
                ModongaM Offline
                Modonga
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                • MesropM Offline
                  MesropM Offline
                  Mesrop
                  wrote on last edited by
                  #8

                  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");
                  
                  miclandM 1 Reply Last reply
                  1
                  • MesropM Mesrop

                    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");
                    
                    miclandM Offline
                    miclandM Offline
                    micland
                    wrote on last edited by
                    #9

                    @Mesrop said:

                    Include this header QSettings [...]

                    This is a windows specific answer - but Qt4Devices / Boot2Qt is linux based...
                    So your answer might be corrent for windows platforms but does not match to this question :-)

                    1 Reply Last reply
                    1
                    • M Offline
                      M Offline
                      Mathieu L.
                      wrote on last edited by
                      #10

                      The documentation to launch a custom app on startup is now here

                      https://doc.qt.io/Boot2Qt/b2qt-customization.html#booting-to-a-custom-application

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved