A how-to guide with code samples on configuring and building your own custom QGroundControl application. We’ll be changing the UI based on a passcode that we supply to unlock different levels of access.

Environment Set-Up

If you already have the required software installed, double-check that you have the correct versions. Then you may continue to the section titled ‘Configuring the Project.’

Required Software

  • Microsoft Visual Studio 2019
  • Qt/Qt Creator

Installing Visual Studio 2019

  1. Follow this link to download the last version of Visual Studio 2019:
    1. https://my.visualstudio.com/Downloads?q=visual%20studio%202019&wt.mc_id=o~msft~vscom~older-downloads
  2. Once downloaded, run the installer and check the box labeled, “Desktop development with C++”
  3. Finish installing by checking the Install box

Installing Qt Creator

  1. Follow this link, scroll down to the section titled “Looking for Qt binaries?”
    1. https://www.qt.io/download-open-source
  2. Click the button labeled “Download the Qt Online Installer”
  3. A page will show up with a green button labeled “Download”. Click it and the QT Online Installer will download
  4. After downloading, launch the installer
  5. Log in / Create an account for Qt
  6. Check the box claiming you are an individual
  7. Hit next until you reach installation folder
  8. Check the box labeled “Custom Installation” and hit next
  9. Select the dropdown for Qt and check the box labeled “5.15.2”
  10. Finish installation by hitting next until it is complete

Configuring the Project

  1. Clone the QGroundControl repository found here:
    1. https://github.com/mavlink/qgroundcontrol
  2. Open Qt Creator
  3. Select “File” and then “Open File or Project…”
  4. Navigate to the repository
  5. Select the file “qgroundcontrol.pro”
  6. Select “Configure Project”
  7. In the terminal window navigate to the [QGroundControl Repository]/custom
  8. Update sub dependencies with this command:
    1. git submodule update –recursive
  9. Restart Qt Creator
  10. The project will now be able to build without any modifications

Building & Deployment

  1. In Qt Creator, select the hammer button in the bottom right corner to build the project
  2. Select the green run button to run the project. The default configuration will be on desktop
    1. It will create a folder outside of the project folder (default is [user]/Documents) containing the flight logs, missions, and other miscellaneous items
    2. It will also create a build folder next to the project folder containing an executable as well as staging files


Any files that are mentioned from “the Github Repository” can be found here: https://github.com/riis/qgccomponenthiding

Adding the Access Type cc/h files

  1. Create 4 new files under custom/src:
    1. AccessType.cpp
    2. AccessTypeConfig.cpp
    3. AccessType.h
    4. AccessTypeConfig.h[1] [2] 
  2. For AccessType.cpp, copy “AccessType.cpp”from the Github Repository
  3. For AccessTypeConfig.cpp, copy “AccessTypeConfig.cpp”from the Github Repository
  4. For AccessType.h, copy “AccessType.h”from the Github Repository
  5. For AccessTypeConfig.h, copy “AccessTypeConfig.h”from the Github Repository

Adding the Custom Plugins

The custom plugins allow the user to have access types depending on the drone firmware. In this case, the firmware that will have a custom plugin is PX4-based

  1. Create 6 new files under custom/src (All these files – CustomCorePlugin are modified versions of their original counterparts found under src/FirmwarePlugin/PX4):
    1. CustomFirmwarePluginFactory.h
    2. CustomPX4FirmwarePlugin.h
    3. CustomCorePlugin.h
    4. CustomFirmwarePluginFactory.cc
    5. CustomPX4FirmwarePlugin.cc
    6. CustomCorePlugin.cc
  2. In CustomFirmwarePluginFactory.h, copy “CustomFirmwarePluginFactory.h”from the Github Repository
  3. In CustomCorePlugin.h, copy “CustomCorePlugin.h”from the Github Repository
  4. In CustomFirmwarePluginFactory.cc, copy “CustomFirmwarePluginFactory.cc”from the Github Repository
  5. In CustomPX4FirmwarePlugin.h, copy “CustomPX4FirmwarePlugin.h”from the Github Repository
  6. In CustomCorePlugin.cc, copy “CustomCorePlugin.cc”from the Github Repository
  7. In CustomPX4FirmwarePlugin.cc, copy “CustomPX4FirmwarePlugin.cc”from the Github Repository

Passcode Manager

This is how the logic is handled for setting and changing the user’s access types

  1. Create 2 new files under custom/src/PasscodeMenu:
    1. PascodeManager.h
    2. PasscodeManager.cc
  2. In PasscodeManager.h, copy “PascodeManager.h”from the Github Repository
  3. In PasscodeManager.cc, copy “PasscodeManager.cc”from the Github Repository

Configuring the custom.pri file

This is the project initialization file

  1. Open the custom.pri file
  2. Under SOURCES, add the following:

$$PWD/src/AccessType.cpp \
$$PWD/src/AccessTypeConfig.cpp \
$$PWD/src/CustomFirmwarePluginFactory.cc \
$$PWD/src/CustomPX4FirmwarePlugin.cc \
$$PWD/src/CustomCorePlugin.cc \

3. Under HEADERS, add the following:

$$PWD/src/AccessType.h \
$$PWD/src/AccessTypeConfig.h \
$$PWD/src/CustomFirmwarePluginFactory.h \
$$PWD/src/CustomPX4FirmwarePlugin.h \
$$PWD/src/CustomCorePlugin.h \

Overriding the Custom Motor Component QML

This will override the original Motor Component

  1. Under custom/res/Custom, create the file CustomMotorComponent.qml and copy “CustomMotorComponent.qml”from the Github Repository
  2. In custom/qgroundcontrol.exclusion, add this line:
<file alias=”MotorComponent.qml”>../src/AutoPilotPlugins/Common/MotorComponent.qml</file>
  1. In custom/custom.qrc, under the section with the prefix “qml”, add this line:
  1. In the terminal window navigate to the [QGroundControl Repository]/custom and run this command:
python updateqrc.py

Passcode Menu QML

  1. Under custom/res, create the file, PasswordSettings.qml, and copy “14”from the Github Repository
  2. In custom/custom.qrc, under the section with the prefix “qml”, add this line:
<file alias=”PasswordSettings.qml”>res/PasswordSettings.qml</file>