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)
QtWS25 Last Chance

run application on startup (raspberry PI)

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 5 Posters 11.0k Views
  • 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.
  • M Offline
    M Offline
    Modonga
    wrote on 27 Apr 2015, 03:34 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
    • S Offline
      S Offline
      sneubert
      wrote on 27 Apr 2015, 07:05 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
      • M Offline
        M Offline
        Modonga
        wrote on 27 Apr 2015, 17:06 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
        • M Offline
          M Offline
          Modonga
          wrote on 27 Apr 2015, 17:57 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
          • S Offline
            S Offline
            sneubert
            wrote on 28 Apr 2015, 07:04 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
            • M Offline
              M Offline
              Modonga
              wrote on 28 Apr 2015, 20:34 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
              • M Offline
                M Offline
                Modonga
                wrote on 28 Apr 2015, 20:37 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
                • M Offline
                  M Offline
                  Mesrop
                  wrote on 22 Jul 2016, 10:35 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");
                  
                  M 1 Reply Last reply 22 Jul 2016, 11:54
                  1
                  • M Mesrop
                    22 Jul 2016, 10:35

                    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");
                    
                    M Offline
                    M Offline
                    micland
                    wrote on 22 Jul 2016, 11:54 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 30 Mar 2025, 20:25 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