开发工具
建议使用VSCode,它有QML插件,IDEA的收费。
qrc文件的编译
https://www.psvmc.cn/article/2021-11-24-qt-quick-qrc.html
resources.qrc
1 | <RCC> |
QML中使用
1 | import "js/common_methods.js" as CommonMethods |
图片
1 | Image { |
编译
1 | pyside2-rcc resources.qrc -o resources_rc.py |
项目创建
项目建议使用pipenv管理依赖
Pipfile
1 | [[source]] |
打包
安装pyinstaller
1 | pip install pyinstaller==6.11.1 |
一般打包
1 | pyinstaller main.py -y --noconsole --name="xh-marking-client" --icon="logo.ico" |
排除DLL
打包,同时会自动生成spec文件
1 | pyinstaller main.py -y --noconsole --name="xh-marking-client" --icon="logo.ico" |
修改spec文件
1 | # -*- mode: python ; coding: utf-8 -*- |
使用修改后的spec文件打包
1 | pyinstaller xh-marking-client.spec --clean -y |
设置VSCode任务
项目根目录创建.vscode
文件夹
添加文件tasks.json
先编译后执行脚本
1 | { |
运行任务直接用快捷键Ctrl+Shift+B
运行时再点击快捷键Ctrl+Shift+B
可以选择重启任务或者终止任务