Resolve error in Qt Creator

The issue is going to be fixed with build targets for the upcoming Sailfish OS release (4.4.0).

Meanwhile, it can be made less annoying by removing the corrupted QML type info from the affected build targets.

This can be achieved persistently with a build hook:

Create a directory for your build hooks. In this example we will use a subdirectory of Sailfish SDK installation directory. You can use any path you like but ensure it belongs to your SDK workspace (your user home directory by default).

mkdir ~/SailfishOS/hooks

Create a script named post-pull-build-requires (exactly!) under the directory, with the following content:

#!/bin/bash

drop_broken_qmltypes() {
    rpm -q --changelog sailfishsilica-qt5 |grep -F -q "JB#55309" && return
    rm /usr/lib*/qt5/qml/Sailfish/Silica/plugins.qmltypes &>/dev/null || return 0
    touch /var/lib/rpm/* || :
}

sfdk tools exec "$SFDK_TARGET" bash -c "$(declare -f drop_broken_qmltypes); drop_broken_qmltypes"

Ensure it is executable

chmod +x ~/SailfishOS/hooks/post-pull-build-requires

And take it into use globally

sfdk config --global --push hooks-dir ~/SailfishOS/hooks

Run qmake on your project within the IDE (Build > Run qmake) and the annoying red highlight all around should change for a single red-highlighted line, the import Sailfish.Silica 1.0 line.

Learn more about build hooks in sfdk --help-all.

3 Likes