Company Confidential
Table of Contents
1.1. Felgo Hot Reload GUI Application
3.2. Initial Project Configuration
3.2.1. Add Hot Reload to your project
3.2.2. Load Hot Reload instead of your main QML file
3.2.3 Update C++ initialization code
3.3. Hot Reload Configuration File
3.3.1 Auto-detecting configuration
3.3.3. Advanced configuration topics
Paths to defined QML modules and plugins
Paths to other directories containing QML files or other resources
Information about loading module and plugin binaries
Configuring multi-platform projects
Configuring projects with resource aliases
4.1. Start and connect Felgo Hot Reload
4.2. Auto-Start Felgo Hot Reload
4.4. Use the same configuration for multiple applications
7. Felgo Hot Reload Limitations
7.1. The developed application window is not set on top on Linux systems
7.3. Removing layer.effects with Qt 6.4.1 makes the parent item invisible
7.5. Can’t get rid of the error screen when fixing an error
7.6. Issues when typing Connection ID on some Android device models when using Qt 6.7
7.7. Updating font assets in Qt < 6.4.0
7.8. Using components with identical names from different modules generates unexpected results
7.9. Changes to QML files do not trigger UI updates on Linux development machine
7.10. Updating a Qt Quick Controls template does not generate application updates
7.11. GUI application option states get lost when reconnecting
7.12. Monitoring a qrc resource that has files from different drives on windows
7.13. Adding a new file to an already existing module
Felgo Hot Reload empowers you to make instant QML and JS code changes and resource updates without recompilation or redeployment; it applies these changes without losing the state of your running application. If you are currently working on a sub-screen, you will not have to navigate to it again after every change, and you will stay exactly where you are in your application.
Felgo Hot Reload consists of two components:
The Felgo Hot Reload GUI application (FelgoHotReload.exe on Windows or FelgoHotReload on other platforms) listens for project file changes and sends those changes to the running application. It is located in the root folder of the installation directory.
The Felgo Hot Reload library. It gets linked into your application binary during the development workflow (not linked to the release version). You can integrate the library via qmake, CMake, or MSBuild build system helpers. You can find the library in the client subfolder of the installation directory.
You can install Felgo Hot Reload using the specific installer for your development platform:
After downloading and starting the installer, you are asked to select:
After the installation, you can start configuring your project to use Felgo Hot Reload.
Before starting work, you need to provide a license key that you have received from Felgo as a part of an order.
Open the Felgo Hot Reload GUI application. First, it will ask you to enter the license key. Enter the received license key and press “Continue”.
If the given license key is valid, it will ask you to select a project directory. This step is necessary only once.
You can trial Felgo Hot Reload without placing an order. First, select “Demo mode” when you are asked to provide the license key. After selecting this option, the application will ask you to select a project directory. After choosing the directory, you will see a message that the license key is not set, and the application will be in demo mode. This mode allows you to use Felgo Hot Reload with a reduced set of features:
To set the license key, open the settings window from the banner or via the “Settings” button in the bottom left corner.
Locate the text field “License Key” at the very top of the screen.
Paste the received license key, and press “Save”.
When you successfully add a license, the License Banner will disappear. You will see information about your current license in the Felgo Hot Reload settings.
Note: If you have any questions about obtaining or using a license key, please contact support@felgo.com.
Adding Felgo Hot Reload to your project involves two steps: First, add the FelgoHotReload library to your project on linker level, and second, instantiate Felgo Hot Reload in your project source code.
This section gives step-by-step instructions on integrating Felgo Hot Reload into a project. You can check the FelgoHotReloadDemo project to see all the changes required for Felgo Hot Reload integration.
Note: On first start, an integration wizard is shown in the GUI application. It provides instructions and code snippets to add Felgo Hot Reload to your project. You can read more details about the recommendations in the sections below.
Here, we cover the most common build systems: CMake, qmake (Qt 5.15), and MSBuild (Windows Visual Studio).
Apply the following changes to configure your CMake-based project with Felgo Hot Reload:
# Felgo Hot Reload for host builds # Felgo Hot Reload for cross-compiling # list(APPEND CMAKE_FIND_ROOT_PATH "../client/${QT_VERSION}/gcc_64") find_package(FelgoHotReload CONFIG REQUIRED) # Link Felgo Hot Reload felgohotreload_configure_executable(${CURRENT_PROJECT_NAME}) |
Notes:
Note: qmake support is only maintained for Qt 5.15.
Apply the following changes to configure your qmake-based project with Felgo Hot Reload:
# Add Felgo Hot Reload include("$${FELGO_HOT_RELOAD_PATH}/client/$${QT_VERSION}/$${COMPILER}/qmake/FelgoHotReload.pri") |
You can add property sheets to your Qt projects in Visual Studio.
Note: Follow those steps for the Release build with the file FelgoHotReload_Release.props if you want to use Hot Reload with your release build.
Note: You can also add a new configuration named Debug HotReload (or similar) to switch between a Debug version with and without Hot Reload enabled from the configuration menu.
Typically, you only include Felgo Hot Reload in the application's debug build. This approach allows for a debug build with Felgo Hot Reload for development and testing while maintaining a separate release build for distribution.
It's advisable to have a method to quickly toggle Felgo Hot Reload on and off. When you incorporate Felgo Hot Reload into a project, it automatically defines the USE_FELGO_HOT_RELOAD symbol. This symbol can be utilized in your C++ code to write Felgo Hot Reload-specific instructions.
The following steps are required to load the Felgo Hot Reload instead of the main QML file in your application logic:
Note: The Demo Project illustrates how to implement this using the conditional USE_FELGO_HOT_RELOAD symbol.
Making the changes above will delay loading the QML file until you’ve connected your application to the Felgo Hot Reload GUI application. Because of this, any calls to QQmlApplicationEngine::rootObjects() will return an empty list. If you need to do some initialization steps that rely on these objects, we recommend using a handler for the QQmlApplicationEngine::objectCreated() signal. Move your initialization code into the handler to ensure the object you require is created.
For example, the following code:
qmlEngine.load(mainQmlFile); initializeApplication(qmlEngine.rootObjects().first()); |
is updated to:
//qmlEngine.load(mainQmlFile); QObject::connect(&qmlEngine, &QQmlApplicationEngine::objectCreated, [&](QObject *object, const QUrl &url) { // You should check that the object is the one you are expecting initializeApplication(object); }); static FelgoHotReload felgoHotReload(&qmlEngine); |
Felgo Hot Reload needs information about your project structure. It will watch specified files for changes and apply them to the running application. The information is stored inside a configuration file named hot_reload_config.json.
Felgo Hot Reload searches for this file inside your project's root directory. If the configuration file does not exist, it will be created and filled with minimal information that the Felgo Hot Reload GUI application automatically detects.
Integrating the Felgo Hot Reload Client libraries generates an additional configuration file during the CMake process. All detected information is saved in the felgo_hot_reload_cmake_targets_info.json file. This file is located next to your project’s root CMakeLists.txt file.
This temporary file allows Felgo Hot Reload to detect changes made to your project and add them to the Hot Reload configuration (e.g., building the application for a different Qt version).
Requirements:
The following information is parsed and collected from CMake:
If you are using a Qt version before 6.3 or the automatic configuration needs adjustments, manual configuration might be required.
This can be done inside the Felgo Hot Reload GUI application configuration editor.
To access this, click on the configuration button in the bottom right part of the Felgo Hot Reload GUI app:
In the configuration page, you can see information about the project, qml modules, and resources. In the example image below, you can see the configuration used by the Demo Project.
The following sections provide details about the file contents:
This is the directory the GUI application was opened with. This cannot be changed in the configuration editor.
To its right, there is the “Clear config” button. It allows you to clear the current configuration and run the auto-detection algorithm again.
The current project file. You can modify this if the detected project file is different from the root project file.
This is the first QML file loaded by your application. It is the parameter of the QQmlEngine::load, QQmlEngine::loadFromModule, or QQuickView constructor call.
The auto-detect feature scans the qml files and looks for one that could be the main qml file. In some cases where projects use QQuickView the main qml file might be incorrectly detected if the file is not named Main.qml
Project specifics can affect how this file is detected. Make sure the correct file was detected for your project.
Acts as a filter to display the configurations used by the QML modules and resources (see below).
Felgo Hot Reload always prioritizes a specific configuration over a general one. For example, if a module is configured for “All” Qt versions and compilers, and another for 6.8.3 and msvc2022_64, it will always prioritize the specific configuration when a client using the same Qt version and compiler connects. Otherwise, it will default to the generic configuration.
Felgo Hot Reload can reload files that have a correct configuration added to Qt modules or resources.
For the modules, the following information is necessary:
To add a new module, press the “+” icon in the upper-right corner of the section.
This will prompt two selection dialogs where you have to select the following:
This will add a new module with the currently selected Qt version and compiler. If “All” is selected in any of these, the new module will be a general one. If you want a specific Qt version or compiler, select it before pressing the “+” button.
You can remove a module by pressing the “X” button next to the module title. This marks the module for removal. You can make this change permanent when saving the configuration, or revert it by pressing the same button again.
Felgo Hot Reload can reload files outside Qt modules and plugins. In this case, you have to specify the path to the source directory or to a qrc resource.
You add a qrc file to the resources with the following steps:
To add a normal directory to Hot Reload:
Felgo Hot Reload creates a local copy of the configured module and plugin libraries. Copying can be unnecessarily time-consuming when running the application locally on your development machine. You can override the behavior with the “Use local plugins” checkbox at the end of the configuration page:
You can choose whether the hot_reload_config.json file is updated automatically.
Automatic configuration detection is enabled for all the projects by default.
Projects previously configured with a version older than 1.6.0 that already contain a hot_reload_config.json will not receive automatic configuration updates and must be manually toggled.
You can turn off automatic configuration detection by passing the --disableAutoConfig command line argument to the Hot Reload GUI Application at start-up. This way, the toggle from the configuration page will be ignored entirely.
You can force automatic configuration detection even with an older hot_reload_config.json. Pass the --forceAutoConfig command line argument to the Hot Reload GUI Application at start-up. This way the toggle from the configuration page will be ignored entirely.
As an example, a project defining three modules with URIs DemoStaticPlugin , Demo.SharedPlugin and demo.qml.module will have a configuration JSON similar to this:
{ "main_qml_file": "qml/main.qml", "qml_module_paths":[ "qml", { "path": "qml_static_plugin", "target_path": "DemoStaticPlugin" }, { "path": "qml_shared_plugin", "target_path": "Demo/SharedPlugin" }, { "path": "qml_module", "target_path": "demo/qml/module/qml_module" } ], "qml_plugin_paths":[ { "path": "build/MSVC2019_64bit-Debug/DemoStaticPlugin", "target_path": "DemoStaticPlugin" }, { "path": "build/MSVC2019_64bit-Debug/Demo/SharedPlugin", "target_path": "Demo/SharedPlugin" }, { "path": "build/MSVC2019_64bit-Debug/demo/qml/module", "target_path": "demo/qml/module" } ], "use_local_plugins": true } |
Note: You can build the Demo Project repository to obtain a sample JSON configuration file. You may copy it and adapt it to your project.
The following sections provide details about the file contents.
This is the first QML file loaded by your application. It is the parameter of the QQmlEngine::load, QQmlEngine::loadFromModule, or QQuickView constructor call. The path must be relative to the configuration JSON and added to the main_qml_file JSON key.
It will look something like:
"main_qml_file": "qml/main.qml" |
Felgo Hot Reload can reload files added to Qt modules or plugins if you specify:
To add the path to the module or plugin sources:
To add the path to module or plugin libraries and qmldir file:
A full Felgo Hot Reload configuration for a module looks similar to the following:
"qml_module_paths":[ { "path": "qml_shared_plugin", "target_path": "Demo/SharedPlugin" } ], "qml_plugin_paths":[ { "path": "build/MSVC2019_64bit-Debug/Demo/SharedPlugin", "target_path": "Demo/SharedPlugin" } ] |
Felgo Hot Reload can reload files not added to any Qt module or plugin. In this case, you have to specify only the path to the source directory:
Felgo Hot Reload creates a local copy of the configured module and plugin libraries. Copying can be unnecessarily time-consuming when running the application locally on your development machine. You can override the behavior with the use_local_plugins key inside the configuration file:
Plugin library paths depend on the platform, compiler, and Qt version used. Felgo Hot Reload lets you specify which configuration to use for a given path. The objects inside the qml_plugin_paths array support several optional keys:
The configuration for a module used on Linux and Windows development can look like this:
"qml_module_paths":[ { "path": "qml_shared_plugin", "target_path": "Demo/SharedPlugin" } ], "qml_plugin_paths":[ { "path": "build/gcc_64bit-Debug/Demo/SharedPlugin", "target_path":" Demo/SharedPlugin", "compiler": "gcc_64", "qt_version": "6.5.3" }, { "path": "build/MSVC2019_64bit-Debug/Demo/SharedPlugin", "target_path": "Demo/SharedPlugin", "compiler": "msvc2019_64", "qt_version": "6.4.1" },
] |
Felgo Hot Reload supports reloading files using a resource alias. Add an entry inside the qml_module_paths array for the resources:
For example, if you add resources using the following CMake command:
qt_add_resources(${PROJECT_NAME} "qml_files" PREFIX "qml/application_logic" # ${QML_FILES} is a list containing the QML files from the "qml" directory FILES ${QML_FILES} ) |
The configuration looks as follows:
"qml_module_paths": [ { "path": "qml", "target_path": "qml/application_logic" } ] |
Note: When the Felgo Hot Reload GUI application starts for the first time on Windows, it may request firewall permission. Make sure to allow access.
You can automatically start up a connection or start the application from cached files with the following methods:
The value set for either the environment variable or the command line argument can be the following:
If the application is not started automatically with the given parameters, the default starting screen will appear, with an error message describing why the auto start was unsuccessful.
You can start your application without access to the Felgo Hot Reload GUI application. This option is available only if the project has been loaded at least once without QML errors. To do this, select the “Load from Cache” option.
This will start your application with the latest error-free configuration and without Felgo Hot Reload functionality.
If you define more than one application in your project, you can still use a single configuration file:
You can restart your project application anytime. The Hot Reload GUI application does not need to be restarted and can remain open in the background.
Exception: If you change the JSON configuration, you need to restart the Felgo Hot Reload GUI application.
Make changes in your code and save the file. The changes are applied in the running application. If errors in your code occur or Hot Reload cannot be applied, you see an error overlay with a description.
There are several actions and configuration options available for the Felgo Hot Reload GUI application.
You can also access the demo project via GitHub: https://github.com/FelgoSDK/FelgoHotReloadDemo
The project demonstrates how to add Felgo Hot Reload to an existing project. To run the project, follow the instructions in the README file.
You can access the complete changelog here
Description
On Linux systems, the developed application window is not always set on top compared to Windows and macOS systems. This causes the application window to end up behind other windows, in particular use cases.
Workaround
Use the “Always on top” feature of Linux:
Description
A CMake error stating that the XKB::XKB target has not been found
Workaround
Install libxkbcommon-dev package: sudo apt-get install libxkbcommon-dev
Description
Because of a bug in Qt (https://bugreports.qt.io/browse/QTBUG-109506) for Qt 6.4.1, removing the layer.effect from a QML item makes that item invisible.
Workaround
A workaround to prevent an invisible item is to set the layer.enabled to false as well. This bug was fixed with Qt 6.4.3.
Description
Because of how we handle the main_qml_file outside the project directory, relative paths for QML imports may become invalid.
Workaround
Update the import QML relative paths:
Description
In some cases. If you fix an QML issue that triggered the Felgo Hot Reload error screen in a different way than reverting the change that caused it, the error is still reported and error screen shown. For example, consider the following component definition:
If you remove the componentColor property, Felgo Hot Reload will show the error screen. You can fix the issue in 2 ways:
If you choose the second option, the error screen will not disappear.
Workaround
Description
More characters than typed are added when typing the Connection ID on some Android device models. It’s caused by this known Qt issue: https://doc.qt.io/qt-6/android-platform-notes.html#predictive-text in combination with QTBUG-125410
Workaround
Description
No change is observed after removing or updating a font file (eg. .ttf) loaded by a QML FontLoader when using Qt versions before 6.4.0. This is a limitation imposed by the Qt API.
Workaround
Restart your application.
Description
In some cases only one of the identical-named components will be used throughout the application.
Workaround
Restart your application.
Description
In some cases you may notice that changing some QML files does not trigger UI updates on your application. This is most common in large projects. A possible cause is that the system runs out of inotify watchers.
Workaround
Increase the number of inotify watchers on the system. You can do this by executing the following in a terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Description
This is a limitation caused by how the Qt Styles are implemented.
Workaround
You can edit one of the instantiated objects. Once it looks like you expect, copy the code inside the template and restart the application.
Description
GUI application options lose their state when reconnecting your application. This is happening only if you had version 1.4.5 or earlier installed, then updated to version 1.4.6 or higher.
Workaround
Remove client from the client list, and reconnect again. Once the client was recreated, the issue no longer occurs.
Description
Having a configuration for a single qrc resource where files from different drives are used isnot supported by Felgo Hot Reload.
Workaround
Create separate entries in the configuration for monitoring each drive separately.
Description
Since Qt 6.8 introduced the QTP0001 it is not possible to add a new file to hot reload and correctly use it. This is because the qmldir needs to be correctly recreated and that happens at build time.
Workaround
After creating the new file, and adding it to the cmake. Rerun cmake, and do a Full Reload for the application.
If you have any questions, please check the Felgo Hot Reload FAQ page.
If you haven’t found an answer to your question or want to reach us, please do it via the Felgo support inbox:
support@felgo.com
© FELGO GmbH