1

I am on Arch Linux and I am trying to use PySide6 and QT6 in my project since I will need to be able to use singleton qml objects and PySide2 doesn't seem to support the registration of singleton qml objects. My project uses ColorOverlays and DropShadows, so I will need GraphicalEffects support. However, according to the doc pages, these aren't supported by Qt6 and require a compatibility module, Qt5Compat.GraphicalEffects to be supported.

I am trying to import Qt5Compat.GraphicalEffects into my QML code via the import statement below:

import Qt5Compat.GraphicalEffects

However, when I add this to my project's QML in QT Creator, I am getting the error: "QML module not found."

Here are some things I have tried in order to remedy this issue:

  • Installed QT using the installer from the website.
  • Installed Qt6/5 via pacman.
  • Installed the qt6-5compat package from the AUR.
  • Installed qt6/5-base from the AUR.
  • Googling the issue.

How can I fix this issue with importing Qt5Compat.GraphicalEffects?

EDIT:

I am using Python and PySide6 for my backend code, but I am writing the front-end in QML, which is where I am having my issue.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Chris Ray
  • 133
  • 1
  • 2
  • 8

2 Answers2

2

Here could be the solution for the problem.

From the main directory "QT" you need to take the Qt5Compad module. This must be added to the development environment.

It works with Pyside6 and PyQT6.

Here is a better description: QT6.4 QML PYTHON module "Qt5Compat.GraphicalEffects" is not installed

Rafa
  • 31
  • 3
1

You have to keep in mind that PySide2 is a binding of Qt5 and PySide6 is that of Qt6.

If you want to use ColorOverlay or DropShadow with then you should follow the Qt5 documentation that says you should use import QtGraphicalEffects 1.15.

If instead you want to use it in it has moved those components to the Qt5Compat module so you should use: import Qt5Compat.GraphicalEffects.

So the way to import will depend on whether you are using PySide2 (Qt5) or PySide6 (Qt6).

Note: QtCreator does not have many capabilities so many times it will throw false positives since it is not able to understand PySide. Unfortunately they have not given it "much affection" so it is not optimized to work with python obtaining that type of warnings. So just obviate the warning.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • I am aware of that. I am intentionally using Pyside6 and QT6 because the qmlRegisterSingletonType() method doesn't exist in PySide2 and I need it so that I can use singleton qml objects. – Chris Ray Sep 21 '21 at 20:50
  • @ChrisRay 1. *qmlRegisterSingletonType* is irrelevant, 2. If you are using PySide6 then you should have no problems. If you see a QtCreator warning then ignore it since it is only an error in the IDE that does not have the ability to understand how PySide works – eyllanesc Sep 21 '21 at 20:53
  • 3
    `pyside6` throws [`module "Qt5Compat.GraphicalEffects" is not installed`](https://stackoverflow.com/questions/70749269/using-graphicaleffects-in-pyside6), any idea? – Giorgos Xou May 01 '22 at 19:12
  • If I use "import Qt5Compat.GraphicalEffects" with PySide 6.4.0 this throws "exited with code -1" and no further information are given. – sebwr Oct 26 '22 at 14:25
  • did you fix it? I'm running into the same issue. seems like quite some users on the internet are having this issue, but nobody posted a fix yet. did you find one? If so, please share here. Thanks. :) – christianparpart Feb 26 '23 at 20:20