我有一个 PySide2 应用程序,它使用 QML 来显示用户界面。该应用程序通过命令行运行。我还可以启动它并在 QtCreator 中调试它。但是,当我尝试运行 QmlProfiler 时,我看到以下错误:
:-1: error: /home/username/code/project/venv/bin/python: Error while finding module specification for 'ljsdebugger=file:/tmp/QtCreator-kVUFuF/qtcreator-freesocket.XgLEKq,block,services:CanvasFrameRate,EngineControl,DebugMessages,DebugTranslation' (ModuleNotFoundError: No module named 'ljsdebugger=file:/tmp/QtCreator-kVUFuF/qtcreator-freesocket')
我检查了项目的套件设置,它使用所有默认值。我在网上找不到任何与此错误消息相关的文章/讨论。如何解决这个问题?
解决这个问题涉及两个步骤:
- 启用应用程序调试
在实例化 QApplication 之前添加以下行:
from PySide2.QtQml import QQmlDebuggingEnabler
debug = QQmlDebuggingEnabler()
- 将其连接到 QML Profiler
run the application with the command line parameter: -qmljsdebugger=port:10002,block
with the port of your choice. Then go to Analyze>QML Profiler (Attach to Waiting Application) and choose the port you started the program with:
这成功地将程序连接到 QML Profiler。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)