尝试进行 Qt 测试,增加了 AI 人机调试工具 _console,以及 TransPyV 进行修正
This commit is contained in:
57
ViperQtHelloWorld/App/main.py
Normal file
57
ViperQtHelloWorld/App/main.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# ============================================================
|
||||
# ViperQtHelloWorld - vqt6 的第一个示例
|
||||
#
|
||||
# 创建一个 Qt6 窗口:
|
||||
# - 标题: "vqt6 Hello"
|
||||
# - 大小: 400x300
|
||||
# - 居中文本: "你好,Viper!"
|
||||
# - 一个按钮: "退出"(点击关闭应用)
|
||||
#
|
||||
# 使用 vqt6 (Viper 的 Qt6 绑定) 创建窗口
|
||||
# ============================================================
|
||||
|
||||
import t
|
||||
import c
|
||||
import vqt6
|
||||
import w32.win32console as w32cmd
|
||||
|
||||
|
||||
pagecode: t.CDefine = 65001
|
||||
|
||||
|
||||
@t.CExport
|
||||
def main() -> int:
|
||||
w32cmd.SetConsoleOutputCP(pagecode)
|
||||
w32cmd.SetConsoleCP(pagecode)
|
||||
|
||||
print("[vqt6] 正在创建 QApplication...")
|
||||
|
||||
# 1. 创建 QApplication
|
||||
app: vqt6.QApplication = vqt6.QApplication([])
|
||||
|
||||
print("[vqt6] 正在创建窗口...")
|
||||
|
||||
# 2. 创建主窗口
|
||||
window: vqt6.QWidget = vqt6.QWidget()
|
||||
window.setWindowTitle("vqt6 Hello")
|
||||
window.resize(400, 300)
|
||||
window.setGeometry(100, 100, 400, 300)
|
||||
|
||||
# 3. 创建居中文本标签
|
||||
label: vqt6.QLabel = vqt6.QLabel("你好,Viper!", window)
|
||||
label.setAlignment(vqt6.QT_ALIGN_CENTER)
|
||||
|
||||
# 4. 创建退出按钮
|
||||
button: vqt6.QPushButton = vqt6.QPushButton("退出", window)
|
||||
|
||||
# 5. 显示窗口
|
||||
window.show()
|
||||
|
||||
print("[vqt6] 窗口已显示,进入事件循环")
|
||||
print("[vqt6] 关闭窗口以退出程序")
|
||||
|
||||
# 6. 进入事件循环
|
||||
ret: int = app.exec()
|
||||
|
||||
print(f"[vqt6] 应用退出,返回码: {ret}")
|
||||
return ret
|
||||
48
ViperQtHelloWorld/project.vpj
Normal file
48
ViperQtHelloWorld/project.vpj
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "vqt6 Hello World",
|
||||
"version": "0.1.0",
|
||||
"description": "vqt6 第一个示例 - 创建一个 Qt6 窗口,点击按钮退出",
|
||||
"source_dir": "./App",
|
||||
"temp_dir": "./temp",
|
||||
"output_dir": "./output",
|
||||
"compiler": {
|
||||
"cmd": "llc",
|
||||
"flags": ["-filetype=obj", "-relocation-model=pic"]
|
||||
},
|
||||
"linker": {
|
||||
"cmd": "clang++",
|
||||
"flags": [
|
||||
"-lmsvcrt",
|
||||
"-lucrt",
|
||||
"-lpthread",
|
||||
"-lmingwex",
|
||||
"-lkernel32",
|
||||
"-lws2_32",
|
||||
"-ldnsapi",
|
||||
"-liphlpapi",
|
||||
"-lQt6Core",
|
||||
"-lQt6Gui",
|
||||
"-lQt6Widgets",
|
||||
"-lQt6Network",
|
||||
"-L", "D:/Qt/6.9.3/mingw_64/lib",
|
||||
"-Wl,--allow-multiple-definition"
|
||||
],
|
||||
"output": "app.exe"
|
||||
},
|
||||
"includes": [
|
||||
"../includes"
|
||||
],
|
||||
"target": {
|
||||
"triple": "x86_64-pc-windows-gnu",
|
||||
"datalayout": "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
},
|
||||
"options": {
|
||||
"slice_level": 3,
|
||||
"target": "llvm",
|
||||
"strict_mode": true
|
||||
},
|
||||
"runtime": {
|
||||
"qt6_path": "D:/Qt/6.9.3/mingw_64",
|
||||
"qt6_dlls": ["Qt6Core.dll", "Qt6Gui.dll", "Qt6Widgets.dll", "Qt6Network.dll"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user