在 PySide6 中使用图形效果

问题描述 投票:0回答:3

我正在使用 PySide6 并尝试使用 GraphicalEffects 模块。

根据此处的文档: https://doc.qt.io/qt-6/qtgraphicaleffects5-index.html

我正在做:

import Qt5Compat.QtGraphicalEffects

我收到的错误:

"Qt5Compat.QtGraphicalEffects" is not installed

如何安装此模块?我的 Linux 机器上安装了 PySide6.2.2.1。

qt qml pyside2 pyside6 qt6
3个回答
2
投票
从 pypi 安装时,这是一个“已知问题”。它将在 pyside 6.4 中修复。

您还可以从源代码构建

,如果您使用 Qt 在线安装程序安装它,它将自动添加。

另一种方法是从根目录复制模块并将其包含在开发环境中。

1
投票
这里有更详细的描述:

QT6.4 QML PYTHON 模块“Qt5Compat.GraphicalEffects”未安装

与 Pyside6 或 PyQt6 配合使用。

在我的

0
投票
文件中导入

Qml

 时,我遇到了困难,并且在 QtCreator 中总是显示此错误:
Qml Module not found ... Import paths :C:\Qt\6.6.1\mingw_64\qml

我有 Pyside 6.6.1,这是我所做的解决方案: “我正在使用 QtCreator,它在 QtCreator 内生成一个 Python 虚拟环境,我在这里查看了已安装的软件包:
<your_project_name>\venv\Lib\site-packages\PySide6\qml
├── Qt
├── Qt3D
├── Qt5Compat
│   └── GraphicalEffects // found it !!
...

然后我所做的就是将此 qml 文件夹复制到:
C:\Qt\6.6.1\mingw_64\qml

它将被导入到哪里,并且它起作用了
ps:我不知道这是否会产生一些问题,因为直接修改 Qt 安装位置可能会导致问题!!

© www.soinside.com 2019 - 2024. All rights reserved.