3.3 KiB
Development
This documentation provides instructions for setting up the development environment and using Qt Creator with Logos Storage UI.
Architecture
The project is divided into two CMake entry points:
-
StorageUIPlugin: It uses the root
CMakeLists.txtand the sources undersrc/. This is the main UI. It is a plugin because it can be reused in the Logos main app or in a standalone application. -
qml: It uses
src/qml/CMakeLists.txt. It is a dev application used to run the QML preview easily. Note that it relies on theStorageUIPluginbuild folder, so YOU MUST buildStorageUIPluginbefore using the QML preview.
Qt Creator (for development)
Qt Creator provides a great development experience for Qt. To ensure proper integration, it is recommended to either configure the project using submodules or clone the dependencies independently into the same parent directory. Nix may work with Qt Creator, but only after an initial build has been run.
Installation
Install from the repository (recommended)
If your package manager provides qtcreator, this is the easiest way to start. You will need to install some dependencies with it.
Note that you should install and run it from a Toolbox, otherwise you may face glx errors:
sudo dnf install cmake ninja clangd qtcreator gcc
Install from the installer
An alternative is to use the Qt installer.
Ensure that you already have the build tools installed (see the previous section), or let the installer install them for you (default behavior).
Configuration
You need to import the CMake projects for the plugin (CMakeLists.txt at the repo root) and for src/qml into Qt Creator.
To import the project into Qt Creator, click on File -> Open File or Project and select the CMakeLists.txt file. A configuration popup will appear. Make sure you have a Debug build configuration pointing to the build directory and then click on Configure project.
Enable CMake debug logging, add --log-level=DEBUG in Projects -> Imported Kits -> Build -> Additional CMake options.
Ensure that clangd is enabled for your project. Go to Projects on the left, then click on Manage Kits at the top. Select the C++ tab and open the last tab, Clangd. Check Use clangd and, if needed, configure it to use the clangd installed on your system.
Then go to Projects -> qml -> Build -> Build Environment. Click Add to create a new variable, set the name to QML_IMPORT_TYPE, and set the value to the absolute path of your QML build directory (for example, /path/to/your/project/src/qml/build/qml).
That's it. The configuration defined in CMakeLists.txt should allow the project to build correctly.
If you encounter any configuration issues, close Qt Creator, remove the CMakeLists.txt.user file, and restart Qt Creator to reconfigure the project.
Tips
Here are some tips that may help during development:
- If you use the
Ctrl+Bshortcut to build, make sure the correct project is selected. Right-click on it and chooseSet as Active Project. - If you encounter build errors, a possible fix is to nuke the build folder and rebuild from scratch.
- Do not call storage module functions from within a callback.