Testing and debugging Plasmoid for Plasma with Qt Creator¶
The following instructions allow to test the Plasmoid by installing it in a test directory rather than the regular home to separate testing from production.
Build as usual, ensure
NO_PLASMOIDis turned off.Add a build step to execute the custom target
init_plasmoid_testingwhich will install the Plasmoid in a test directory which is$CMAKE_BUILD_DIR/plasmoid-testingby default (configurable via cache variablePLASMOID_TESTDIR, the sub directoryplasmoid-testingis not part of the variable).Add new config for “run” in Qt Creator and set
bashas executable.Set
%{sourceDir}/../../syncthingtray/plasmoid/scripts/starttesting.sh plasmoidviewer --applet martchus.syncthingplasmoidas CLI argument.It is also possible to use
plasmawindowedorplasmashell, see sections below.It is also possible to specify
org.kde.plasma.systemtrayas applet to test how the Plasmoid looks like within the system tray plasmoid.This usage of
%{sourceDir}assumes one used the “Building this straight” instructions from the main README.md.When using a suffix (e.g. development build via CMake presets), this suffix needs to be appended to the applet name.
Keep
%{buildDir}as working directory.In the execution environment there’s nothing mandatory to be set because
starttesting.shshould already take care of setting the environment.The home directory is set in accordance with the directory used in step 2. but can be overridden by setting
TEST_HOME; make sure thatTEST_HOMEand the CMake variablePLASMOID_TESTDIRare set in accordance.If not already set,
QT_PLUGIN_PATHis set to$CMAKE_CURRENT_BINARY_DIR/plasmoid/libwhich should contain the plugin for the Plasmoid underplasma/applets/*syncthingplasmoid*.so.Set
QT_DEBUG_PLUGINSto 1 for verbose plugin detection (the verbose output might be suppressed when starting via Qt Creator so it may be worthwhile to start this from a terminal).
Ignore warning that executable is no debug build, it is sufficient when the plugin is a debug build (see next section for QML debugging).
Saving/restoring settings¶
Be aware that plasmoidviewer will revert Plasmoid-specific settings to the defaults on
startup. So it is not possible to test restoring/saving settings using it.
For this use case, plasmawindowed can be used instead.
Testing within the real Plasma shell¶
Some issues are only reproducible within the actual Plasma shell. It is possible to test
with the real Plasma shell in the same way as described above by setting plasmashell as
executable.
It is only possible to run one plasmashell at a time so you have to stop your regular
plasmashell first. While developing you can start e.g. tint2 to be not without a shell.
It works quite well within a Plasma session when both shells are placed on different screen
edges.
Enable QML debugging¶
It is not clear whether the following instructions are still valid for Plasma 6.
It seems that QML debugging can be enabled under Plasma 6 by setting the environment variable
PLASMA_ENABLE_QML_DEBUG but this has not been tested yet.
To enable QML debugging, it is required to rebuild plasmoidviewer with QML debugging
enabled.
For Arch Linux, I created the package
plasmoidviewer-debug
for that purpose. Installing this package and using plasmoidviewer-debug instead of plasmoidviewer
should make enabling QML debugging in the Run section of Qt Creator work.
To create a debug build of plasmoidviewer manually:
Get
plasma-sdk:git clone https://anongit.kde.org/plasma-sdk.gitCreate a debug build of
plasmoidviewerand ensureQT_QML_DEBUGis defined when compilingplasmoidviewer, e.g. by applying [PATCH] Enable QML debugging.Prepend the build directory containing the
plasmoidviewerbinary to the path variable in the build environment of Syncthing Tray.Enable QML debugging in the Run section.
Testing against a development build of Plasma¶
Build the whole dependency chain up to
plasma-desktopinstalling it under some custom prefix. Note thatplasma-sdkalone is not sufficient.Then follow the usual steps but make sure you build Syncthing Tray against the custom KDE builds. This is achieved the easiest by using the ``debug-kde-custom
CMake preset. This preset uses the environment variableKDE_INSTALL_DIR` which must point to the custom prefix used in step 1.Source the
prefix.shscript that should be present in the build directory of any KDE library you built in step 1, e.g.source kde/plasma-sdk/prefix.sh.When setting the environment one needs to be more careful to not override variables set in step 3. It is the easiest to just start e.g.
plasmawindowedfrom the shell:QT_PLUGIN_PATH=$BUILD_DIR/syncthingtray/`debug-kde-custom/syncthingtray/plasmoid/lib:$QT_PLUGIN_PATH HOME=$BUILD_DIR/syncthingtray/`debug-kde-custom/plasmoid-testing kdeinstall/bin/plasmawindowed martchus.syncthingplasmoid-devel
It would make sense to tweak
starttesting.shto be able to do the sourcing automatically.