I'm using the Qt 5 Core Compatibility APIs in my Qt 6 applications. In particular, I need the QtGraphicalEffects module in my Qt Quick Scene.
This is the full code of my main.qml file:
import QtQuick
import QtQuick.Window
import Qt5Compat.GraphicalEffects
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Item {
width: 300
height: 300
Image {
id: bug
source: "images/bug.jpg"
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
visible: false
}
Image {
id: mask
source: "images/butterfly.png"
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
visible: false
}
OpacityMask {
anchors.fill: bug
source: bug
maskSource: mask
}
}
}
This runs fine with Qt 6.2.4 (installed via the Qt Maintenance Tool). However with Qt 6.3.0, I get the following error:
QQmlApplicationEngine failed to load component qrc:/main.qml:3:1: Cannot load library C:\Qt\6.3.0\msvc2019_64\qml\Qt5Compat\GraphicalEffects\qtgraphicaleffectsplugind.dll: The specified procedure could not be found.
I verified that the file C:\Qt\6.3.0\msvc2019_64\qml\Qt5Compat\GraphicalEffects\qtgraphicaleffectsplugind.dll
actually exists and made sure that the Qt 5 Compatibility module is installed for my Qt version. I've also tried to upgrade to the Qt 6.4.0 alpha release (again making sure that the compatibility module is installed) and with that I get a slightly different error:
QQmlApplicationEngine failed to load component qrc:/main.qml:31:9: Type OpacityMask unavailable qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/OpacityMask.qml:41:1: Cannot load library C:\Qt\6.4.0\msvc2019_64\qml\Qt5Compat\GraphicalEffects\private\qtgraphicaleffectsprivateplugind.dll: The specified module could not be found.
What could be the cause of this issue? Has anything changed since Qt 6.3.0 regarding the compatibility module?
As this thread said, You need install Shader tools
module after Qt 6.4
. Install it by MaintenanceTool, then it will be ok.