All changes will be made within the custom folder
When changing the logo, we will need to edit 3 files:
- custom.qrc
- CustomPlugin.h Found in
/src - CustomPlugin.cc Found in
/src
Follow the previous steps setup to set up the CustomPlugin.h and CustomPlugin.cc. If you have not edited each of these files from the example, you can skip to Change The Logo.
- CustomPlugin.h
- Add to the CustomPlugin class
brandImageIndoorandbrandImageOutdoor:class CustomPlugin : public QGCCorePlugin { public: CustomPlugin(QGCApplication* app, QGCToolbox *toolbox); ~CustomPlugin(); void paletteOverride (QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo) final; QString brandImageIndoor (void) const final; QString brandImageOutdoor (void) const final; };
- Add to the CustomPlugin class
- CustomPlugin.cc
- Add both functions
brandImageIndoorandbrandImageOutdoor:QString CustomPlugin::brandImageIndoor(void) const { } QString CustomPlugin::brandImageOutdoor(void) const { }
- Add both functions
- custom.qrc
- Add the following line under
<qresource prefix="custom/img">:<file alias="CustomAppIcon.png">res/Images/CustomAppIcon.png</file>
- Add the following line under
- custom.qrc
- Within
<qresource prefix="custom/img">, you may find a line like below. Changeres/Images/CustomAppIcon.pngto point to the new location of your file. In most cases, it is usually easier to leave the alias name as this will be the name QT will use within your project. If you are leaving the alias name, you can proceed to add the function inCustomPlugin.ccin the next step; if not, continue following along.<file alias="CustomAppIcon.png">res/Images/CustomAppIcon.png</file>
- Within
- CustomPlugin.cc
- In the
brandImageIndoorandbrandImageOutdoorfunctions, add a return command with the string of the logo. The string will be the location of the logo from the project resource directory. Find this by viewingcustom.qrcand locating CustomAppIcon or its new alias. The prefix comes from the<qresource>tag and the name is its alias. Each function will be the same, but by changing the string, you can choose which logo to use for each mode.- An example from code above would be:
QString CustomPlugin::brandImageIndoor(void) const { return QStringLiteral("/custom/img/CustomAppIcon.png"); }/custom/imgcomes from its prefix from the<qresource>tagCustomAppIcon.pngcomes from its alias name
- An example from code above would be:
- In the
- custom_deploy.pri
- Append this to the end of the file to change the name of the logo. Here, make sure to use the name of the file and not the alias:
QMAKE_POST_LINK += && $$QMAKE_COPY $$PWD/res/Images/CustomAppIcon.png $$DESTDIR
- Append this to the end of the file to change the name of the logo. Here, make sure to use the name of the file and not the alias: