尝试进行 Qt 测试,增加了 AI 人机调试工具 _console,以及 TransPyV 进行修正

This commit is contained in:
2026-07-21 14:41:22 +08:00
parent a277ded8d4
commit 135aa05485
311 changed files with 7084 additions and 2131 deletions

View 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