尝试进行 Qt 测试,增加了 AI 人机调试工具 _console,以及 TransPyV 进行修正
This commit is contained in:
@@ -418,17 +418,28 @@ class MemBuddy(MemManager):
|
||||
# === 虚函数覆盖 ===
|
||||
|
||||
def alloc(self, size: t.CSizeT) -> t.CVoid | t.CPtr:
|
||||
stdio.printf("DBG MemBuddy.alloc: size=%lu\n", size)
|
||||
stdio.fflush(None)
|
||||
self._lock()
|
||||
result: t.CVoid | t.CPtr = None
|
||||
if self.usable is not None:
|
||||
stdio.printf("DBG MemBuddy.alloc: usable=%p\n", self.usable)
|
||||
stdio.fflush(None)
|
||||
if size != 0:
|
||||
needed: t.CSizeT = size + MEMBUDDY_HEADER_SIZE
|
||||
order: t.CInt = self._order_for_size(needed)
|
||||
stdio.printf("DBG MemBuddy.alloc: order=%d max_order=%d\n", order, self.max_order)
|
||||
stdio.fflush(None)
|
||||
if order <= self.max_order:
|
||||
block: t.CVoid | t.CPtr = self._split_to_order(order)
|
||||
stdio.printf("DBG MemBuddy.alloc: block=%p\n", block)
|
||||
stdio.fflush(None)
|
||||
if block is not None:
|
||||
c.DerefAs(block, t.CVoid(t.CUInt64T((order << 1) | 1), t.CPtr))
|
||||
result = t.CVoid(t.CUInt64T(block) + MEMBUDDY_HEADER_SIZE, t.CPtr)
|
||||
else:
|
||||
stdio.printf("DBG MemBuddy.alloc: usable is None!\n")
|
||||
stdio.fflush(None)
|
||||
self._unlock()
|
||||
return result
|
||||
|
||||
|
||||
110
includes/vqt6/CMakeLists.txt
Normal file
110
includes/vqt6/CMakeLists.txt
Normal file
@@ -0,0 +1,110 @@
|
||||
# ============================================================
|
||||
# vqt6 CMakeLists.txt — 构建 vqt6 C 桥接层
|
||||
#
|
||||
# 默认产物: libvqt6_bridge.a (静态库)
|
||||
# 可选产物: vqt6_bridge.dll (动态库)
|
||||
#
|
||||
# 使用:
|
||||
# cmake -B build -S .
|
||||
# cmake --build build --config Release
|
||||
# ============================================================
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(vqt6_bridge CXX C)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# 构建选项
|
||||
option(VQT6_BUILD_SHARED "Build vqt6 as shared library (DLL)" OFF)
|
||||
option(VQT6_BUILD_STATIC "Build vqt6 as static library" ON)
|
||||
option(VQT6_BUILD_EXAMPLES "Build example programs" OFF)
|
||||
|
||||
# Qt6 依赖
|
||||
find_package(Qt6 6.5 REQUIRED COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Network
|
||||
)
|
||||
|
||||
# Win32 GUI 应用不需要控制台
|
||||
if(WIN32)
|
||||
set(CMAKE_WIN32_EXECUTABLE OFF)
|
||||
endif()
|
||||
|
||||
# 公共源文件
|
||||
set(VQT6_SOURCES
|
||||
_bridge_core.cpp
|
||||
_bridge_widgets.cpp
|
||||
_bridge_gui.cpp
|
||||
_bridge_network.cpp
|
||||
)
|
||||
|
||||
set(VQT6_HEADERS
|
||||
_bridge.h
|
||||
_bridge_widgets.h
|
||||
_bridge_gui.h
|
||||
_bridge_network.h
|
||||
)
|
||||
|
||||
# Qt 模块
|
||||
set(VQT6_QT_MODULES
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
Qt6::Network
|
||||
)
|
||||
|
||||
# ============================================================
|
||||
# 静态库
|
||||
# ============================================================
|
||||
if(VQT6_BUILD_STATIC)
|
||||
add_library(vqt6_bridge_static STATIC ${VQT6_SOURCES} ${VQT6_HEADERS})
|
||||
target_link_libraries(vqt6_bridge_static PUBLIC ${VQT6_QT_MODULES})
|
||||
target_compile_definitions(vqt6_bridge_static PUBLIC VQT6_BRIDGE_STATIC)
|
||||
target_include_directories(vqt6_bridge_static PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
set_target_properties(vqt6_bridge_static PROPERTIES
|
||||
OUTPUT_NAME vqt6_bridge
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
endif()
|
||||
|
||||
# ============================================================
|
||||
# 动态库
|
||||
# ============================================================
|
||||
if(VQT6_BUILD_SHARED)
|
||||
add_library(vqt6_bridge SHARED ${VQT6_SOURCES} ${VQT6_HEADERS})
|
||||
target_link_libraries(vqt6_bridge PUBLIC ${VQT6_QT_MODULES})
|
||||
target_compile_definitions(vqt6_bridge PRIVATE VQT6_BRIDGE_BUILD)
|
||||
target_include_directories(vqt6_bridge PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
set_target_properties(vqt6_bridge PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||
)
|
||||
endif()
|
||||
|
||||
# ============================================================
|
||||
# 安装
|
||||
# ============================================================
|
||||
install(TARGETS vqt6_bridge_static vqt6_bridge
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
install(FILES ${VQT6_HEADERS}
|
||||
DESTINATION include/vqt6
|
||||
)
|
||||
|
||||
# ============================================================
|
||||
# 示例
|
||||
# ============================================================
|
||||
if(VQT6_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
90
includes/vqt6/README.md
Normal file
90
includes/vqt6/README.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# vqt6 — Viper 的 Qt6 绑定包
|
||||
|
||||
`vqt6` 是 [Viper](https://git.gvsds.com/GVSDS/TransPyC) 语言的 **Qt6 GUI 框架绑定**,是 Viper 包管理器分发的"包"(类似于 Python 的 PyQt6、Node.js 的 node-gtk)。
|
||||
|
||||
> 注意:`vqt6` **不是** 包管理器,而是一个**被包管理器管理的包**(库)。
|
||||
> 包管理器负责下载、预编译、安装;`vqt6` 只负责把 Qt6 C++ API 暴露给 Viper 代码。
|
||||
|
||||
## 架构
|
||||
|
||||
```
|
||||
+--------------------+ +-----------------------+ +------------+
|
||||
| Viper 用户代码 | FFI | vqt6 桥接层 (libvqt6) | C++ | Qt6 C++ |
|
||||
| (app.py) | <----> | - t.State 声明 | <-----> | QtCore |
|
||||
| | | - C 桥接函数 | | QtGui |
|
||||
| vqt6.QApplication | | (extern "C") | | QtWidgets |
|
||||
| vqt6.QLabel | | - 静态库 / 动态库 | | QtNetwork |
|
||||
+--------------------+ +-----------------------+ +------------+
|
||||
```
|
||||
|
||||
**FFI 路径**:
|
||||
1. Viper 编译器把 `t.State` 声明的 `def xxx() -> t.State: pass` 解析为外部函数符号
|
||||
2. 链接时通过 `libvqt6_bridge.a`(静态)或 `vqt6_bridge.dll`(动态)解析符号
|
||||
3. 运行时 C 桥接层调用 Qt6 C++ API 完成实际工作
|
||||
|
||||
## 链接模式
|
||||
|
||||
| 模式 | 产物 | 优点 | 缺点 |
|
||||
|------|------|------|------|
|
||||
| **静态**(默认) | `libvqt6_bridge.a` | 部署简单(一个 exe),无需分发 dll | exe 体积较大 |
|
||||
| **动态** | `vqt6_bridge.dll` | 共享内存,多个程序共用 | 需随 exe 分发 dll |
|
||||
|
||||
vqt6 同一套 C 桥接源代码,可同时编译为两种产物。Viper 项目通过 `project.vpj` 切换。
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
includes/vqt6/
|
||||
├── README.md # 本文件
|
||||
├── __init__.py # 公共 Pythonic API(用户使用)
|
||||
├── _types.py # 公共类型(不透明指针 typedef)
|
||||
├── _qtcore.py # QtCore 的 t.State FFI 声明
|
||||
├── _qtwidgets.py # QtWidgets 的 t.State FFI 声明
|
||||
├── _qtgui.py # QtGui 的 t.State FFI 声明
|
||||
├── _qtnetwork.py # QtNetwork 的 t.State FFI 声明
|
||||
├── _bridge.h # C 桥接层头文件
|
||||
├── _bridge.cpp # C 桥接层实现(extern "C" 包装 Qt6 C++ API)
|
||||
└── CMakeLists.txt # 构建脚本(生成 libvqt6_bridge.a)
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
|
||||
```python
|
||||
# App/main.py
|
||||
import t
|
||||
import c
|
||||
import vqt6
|
||||
|
||||
# 1. 创建 QApplication
|
||||
app: vqt6.QApplication | t.CPtr = vqt6.QApplication([])
|
||||
|
||||
# 2. 创建窗口
|
||||
window: vqt6.QWidget | t.CPtr = vqt6.QWidget()
|
||||
window.setWindowTitle("vqt6 Hello")
|
||||
window.resize(400, 300)
|
||||
|
||||
# 3. 创建标签
|
||||
label: vqt6.QLabel | t.CPtr = vqt6.QLabel("你好,Viper!", window)
|
||||
label.move(50, 50)
|
||||
|
||||
# 4. 显示并进入事件循环
|
||||
window.show()
|
||||
app.exec()
|
||||
```
|
||||
|
||||
## 设计原则
|
||||
|
||||
1. **不透明指针**:Viper 端不直接操作 Qt6 C++ 类(`QWidget*`、`QString*` 等),所有操作通过 C 桥接函数 `vqt6_xxx()` 转发。
|
||||
2. **t.State 声明**:所有 FFI 函数返回 `t.State`,C 桥接层函数实现负责实际操作。
|
||||
3. **句柄化对象模型**:Viper 端的对象是 `t.CPtr`(不透明指针),C 端管理生命周期(构造函数/析构函数)。
|
||||
4. **跨平台**:同一套 C 桥接代码可在 Windows / Linux / macOS 编译(差异在 Qt6 安装路径)。
|
||||
|
||||
## 当前状态
|
||||
|
||||
- [x] 架构设计
|
||||
- [x] FFI 覆盖:QtCore / QtWidgets / QtGui / QtNetwork
|
||||
- [x] FFI 粒度:仅暴露 C 桥接函数
|
||||
- [ ] FFI 声明文件编写中
|
||||
- [ ] C 桥接层实现
|
||||
- [ ] CMakeLists.txt 构建脚本
|
||||
- [ ] Hello World 示例验证
|
||||
208
includes/vqt6/__init__.py
Normal file
208
includes/vqt6/__init__.py
Normal file
@@ -0,0 +1,208 @@
|
||||
# ============================================================
|
||||
# vqt6 — Viper 的 Qt6 绑定包
|
||||
#
|
||||
# 公共 Pythonic API(基于 C 桥接层)
|
||||
# 用户用法:
|
||||
# import vqt6
|
||||
# app = vqt6.QApplication([])
|
||||
# win = vqt6.QWidget()
|
||||
# win.setWindowTitle("Hello")
|
||||
# win.show()
|
||||
# app.exec()
|
||||
# ============================================================
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
from vqt6._types import *
|
||||
from vqt6._qtcore import *
|
||||
from vqt6._qtwidgets import *
|
||||
from vqt6._qtgui import *
|
||||
from vqt6._qtnetwork import *
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 高级 API 类(Pythonic 包装,不透明指针)
|
||||
# ============================================================
|
||||
@t.NoVTable
|
||||
class QApplication:
|
||||
"""QApplication 包装(不透明指针)"""
|
||||
_ptr: QtAppPtr
|
||||
|
||||
def __init__(self, argv: list[str] | t.CPtr):
|
||||
# 把 argv 转换为 argc/argv 数组
|
||||
argc: t.CInt = 1
|
||||
# Viper 端 argv 是 c_char_p 指针数组
|
||||
# 这里仅传空 argv,避免 C ABI 复杂性
|
||||
argv_ptr: t.CPtr = t.CPtr(0)
|
||||
self._ptr = vqt6_qapplication_create(argc, argv_ptr)
|
||||
if self._ptr is None:
|
||||
raise RuntimeError("Failed to create QApplication")
|
||||
|
||||
def exec(self) -> int:
|
||||
return vqt6_qapplication_exec(self._ptr)
|
||||
|
||||
def quit(self):
|
||||
vqt6_qapplication_quit(self._ptr)
|
||||
|
||||
def exit(self, code: int):
|
||||
vqt6_qapplication_exit(self._ptr, code)
|
||||
|
||||
def process_events(self):
|
||||
vqt6_qapplication_process_events(self._ptr)
|
||||
|
||||
def desktop_width(self) -> int:
|
||||
return vqt6_qapplication_desktop_width(self._ptr)
|
||||
|
||||
def desktop_height(self) -> int:
|
||||
return vqt6_qapplication_desktop_height(self._ptr)
|
||||
|
||||
|
||||
@t.NoVTable
|
||||
class QWidget:
|
||||
"""QWidget 包装"""
|
||||
_ptr: QtWidgetPtr
|
||||
|
||||
def __init__(self, parent: "QWidget | None" = None):
|
||||
if parent is not None and parent._ptr is not None:
|
||||
self._ptr = vqt6_qwidget_create_with_parent(parent._ptr)
|
||||
else:
|
||||
self._ptr = vqt6_qwidget_create()
|
||||
if self._ptr is None:
|
||||
raise RuntimeError("Failed to create QWidget")
|
||||
|
||||
def show(self):
|
||||
vqt6_qwidget_show(self._ptr)
|
||||
|
||||
def hide(self):
|
||||
vqt6_qwidget_hide(self._ptr)
|
||||
|
||||
def close(self) -> int:
|
||||
return vqt6_qwidget_close(self._ptr)
|
||||
|
||||
def setWindowTitle(self, title: str):
|
||||
title_qs: QtStringPtr = vqt6_qstring_create(title)
|
||||
vqt6_qwidget_set_window_title(self._ptr, title_qs)
|
||||
vqt6_qstring_free(title_qs)
|
||||
|
||||
def windowTitle(self) -> str:
|
||||
result: QtStringPtr = vqt6_qwidget_window_title(self._ptr)
|
||||
buf: bytes = stdlib.malloc(1024)
|
||||
vqt6_qstring_to_utf8(result, buf, 1024)
|
||||
s: str = string.strndup(buf, 1024)
|
||||
vqt6_qstring_free(result)
|
||||
return s
|
||||
|
||||
def resize(self, w: int, h: int):
|
||||
vqt6_qwidget_resize(self._ptr, w, h)
|
||||
|
||||
def move(self, x: int, y: int):
|
||||
vqt6_qwidget_move(self._ptr, x, y)
|
||||
|
||||
def setGeometry(self, x: int, y: int, w: int, h: int):
|
||||
vqt6_qwidget_set_geometry(self._ptr, x, y, w, h)
|
||||
|
||||
def setEnabled(self, enabled: int):
|
||||
vqt6_qwidget_set_enabled(self._ptr, enabled)
|
||||
|
||||
def setVisible(self, visible: int):
|
||||
vqt6_qwidget_set_visible(self._ptr, visible)
|
||||
|
||||
def isVisible(self) -> int:
|
||||
return vqt6_qwidget_is_visible(self._ptr)
|
||||
|
||||
def setToolTip(self, tip: str):
|
||||
tip_qs: QtStringPtr = vqt6_qstring_create(tip)
|
||||
vqt6_qwidget_set_tool_tip(self._ptr, tip_qs)
|
||||
vqt6_qstring_free(tip_qs)
|
||||
|
||||
|
||||
@t.NoVTable
|
||||
class QLabel:
|
||||
"""QLabel 包装"""
|
||||
_ptr: QtLabelPtr
|
||||
|
||||
def __init__(self, text: str = "", parent: "QWidget | None" = None):
|
||||
text_qs: QtStringPtr = vqt6_qstring_create(text)
|
||||
if parent is not None and parent._ptr is not None:
|
||||
self._ptr = vqt6_qlabel_create_with_text_parent(text_qs, parent._ptr)
|
||||
elif text_qs is not None:
|
||||
self._ptr = vqt6_qlabel_create_with_text(text_qs)
|
||||
else:
|
||||
self._ptr = vqt6_qlabel_create()
|
||||
vqt6_qstring_free(text_qs)
|
||||
if self._ptr is None:
|
||||
raise RuntimeError("Failed to create QLabel")
|
||||
|
||||
def setText(self, text: str):
|
||||
text_qs: QtStringPtr = vqt6_qstring_create(text)
|
||||
vqt6_qlabel_set_text(self._ptr, text_qs)
|
||||
vqt6_qstring_free(text_qs)
|
||||
|
||||
def text(self) -> str:
|
||||
result: QtStringPtr = vqt6_qlabel_text(self._ptr)
|
||||
buf: bytes = stdlib.malloc(1024)
|
||||
vqt6_qstring_to_utf8(result, buf, 1024)
|
||||
s: str = string.strndup(buf, 1024)
|
||||
vqt6_qstring_free(result)
|
||||
return s
|
||||
|
||||
def setAlignment(self, alignment: int):
|
||||
vqt6_qlabel_set_alignment(self._ptr, alignment)
|
||||
|
||||
|
||||
@t.NoVTable
|
||||
class QPushButton:
|
||||
"""QPushButton 包装"""
|
||||
_ptr: QtPushButtonPtr
|
||||
|
||||
def __init__(self, text: str = "", parent: "QWidget | None" = None):
|
||||
text_qs: QtStringPtr = vqt6_qstring_create(text)
|
||||
if parent is not None and parent._ptr is not None:
|
||||
self._ptr = vqt6_qpushbutton_create_with_text_parent(text_qs, parent._ptr)
|
||||
elif text_qs is not None:
|
||||
self._ptr = vqt6_qpushbutton_create_with_text(text_qs)
|
||||
else:
|
||||
self._ptr = vqt6_qpushbutton_create()
|
||||
vqt6_qstring_free(text_qs)
|
||||
if self._ptr is None:
|
||||
raise RuntimeError("Failed to create QPushButton")
|
||||
|
||||
def setText(self, text: str):
|
||||
text_qs: QtStringPtr = vqt6_qstring_create(text)
|
||||
vqt6_qpushbutton_set_text(self._ptr, text_qs)
|
||||
vqt6_qstring_free(text_qs)
|
||||
|
||||
def text(self) -> str:
|
||||
result: QtStringPtr = vqt6_qpushbutton_text(self._ptr)
|
||||
buf: bytes = stdlib.malloc(1024)
|
||||
vqt6_qstring_to_utf8(result, buf, 1024)
|
||||
s: str = string.strndup(buf, 1024)
|
||||
vqt6_qstring_free(result)
|
||||
return s
|
||||
|
||||
def click(self):
|
||||
vqt6_qpushbutton_click(self._ptr)
|
||||
|
||||
def setEnabled(self, enabled: int):
|
||||
vqt6_qwidget_set_enabled(self._ptr, enabled)
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 模块导出
|
||||
# ============================================================
|
||||
__all__ = [
|
||||
# 高层类
|
||||
"QApplication", "QWidget", "QLabel", "QPushButton",
|
||||
# 类型
|
||||
"QtObjectPtr", "QtStringPtr", "QtByteArrayPtr", "QtWidgetPtr", "QtAppPtr",
|
||||
"QtLabelPtr", "QtPushButtonPtr",
|
||||
"QtColorPtr", "QtFontPtr", "QtPixmapPtr", "QtImagePtr", "QtPainterPtr",
|
||||
"QtTcpSocketPtr", "QtHostAddressPtr", "QtNetworkRequestPtr", "QtNetworkReplyPtr",
|
||||
# 常量
|
||||
"QT_KEY_ESCAPE", "QT_KEY_RETURN", "QT_KEY_A", "QT_KEY_Z",
|
||||
"QT_LEFT_BUTTON", "QT_RIGHT_BUTTON", "QT_MID_BUTTON",
|
||||
"QT_HORIZONTAL", "QT_VERTICAL",
|
||||
"QT_ALIGN_LEFT", "QT_ALIGN_CENTER", "QT_ALIGN_RIGHT",
|
||||
"QT_PORT_HTTP", "QT_PORT_HTTPS", "QT_PORT_FTP",
|
||||
"QT_OK", "QT_CANCEL", "QT_YES", "QT_NO", "QT_CLOSE",
|
||||
]
|
||||
151
includes/vqt6/_bridge.h
Normal file
151
includes/vqt6/_bridge.h
Normal file
@@ -0,0 +1,151 @@
|
||||
// ============================================================
|
||||
// vqt6/_bridge.h — C 桥接层头文件
|
||||
//
|
||||
// 作用: 把 Qt6 C++ API 包装成 extern "C" 函数,供 Viper FFI 调用
|
||||
// 编译: 作为静态库 libvqt6_bridge.a 或动态库 vqt6_bridge.dll
|
||||
// ============================================================
|
||||
|
||||
#ifndef VQT6_BRIDGE_H
|
||||
#define VQT6_BRIDGE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if defined(VQT6_BRIDGE_STATIC)
|
||||
# define VQT6_API
|
||||
# elif defined(VQT6_BRIDGE_BUILD)
|
||||
# define VQT6_API __declspec(dllexport)
|
||||
# else
|
||||
# define VQT6_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
# define VQT6_API __attribute__((visibility("default")))
|
||||
# else
|
||||
# define VQT6_API
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ============================================================
|
||||
// QString
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qstring_create(const char* utf8);
|
||||
VQT6_API size_t vqt6_qstring_to_utf8(void* qstr, char* buf, size_t buf_size);
|
||||
VQT6_API void vqt6_qstring_free(void* qstr);
|
||||
VQT6_API int vqt6_qstring_length(void* qstr);
|
||||
VQT6_API int vqt6_qstring_is_empty(void* qstr);
|
||||
VQT6_API int vqt6_qstring_equals(void* qstr, void* other);
|
||||
VQT6_API void* vqt6_qstring_append(void* qstr, void* other);
|
||||
|
||||
// ============================================================
|
||||
// QByteArray
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qbytearray_create(const void* data, size_t size);
|
||||
VQT6_API void* vqt6_qbytearray_data(void* qba, size_t* out_size);
|
||||
VQT6_API size_t vqt6_qbytearray_size(void* qba);
|
||||
VQT6_API void vqt6_qbytearray_free(void* qba);
|
||||
|
||||
// ============================================================
|
||||
// QObject
|
||||
// ============================================================
|
||||
VQT6_API void vqt6_qobject_delete(void* obj);
|
||||
VQT6_API void vqt6_qobject_delete_later(void* obj);
|
||||
VQT6_API void vqt6_qobject_set_object_name(void* obj, void* name);
|
||||
VQT6_API void* vqt6_qobject_object_name(void* obj);
|
||||
VQT6_API void vqt6_qobject_set_parent(void* child, void* parent);
|
||||
VQT6_API void* vqt6_qobject_parent(void* obj);
|
||||
VQT6_API int vqt6_qobject_connect(void* sender, const char* signal_name,
|
||||
void* receiver, const char* slot_name);
|
||||
VQT6_API int vqt6_qobject_disconnect(void* sender, const char* signal_name,
|
||||
void* receiver, const char* slot_name);
|
||||
VQT6_API void vqt6_qobject_install_event_filter(void* watched, void* filter);
|
||||
VQT6_API void vqt6_qobject_remove_event_filter(void* watched, void* filter);
|
||||
|
||||
// ============================================================
|
||||
// QCoreApplication
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qcoreapp_create(const char* app_name);
|
||||
VQT6_API void* vqt6_qcoreapp_instance(void);
|
||||
VQT6_API int vqt6_qcoreapp_exec(void* app);
|
||||
VQT6_API void vqt6_qcoreapp_quit(void* app, int exit_code);
|
||||
VQT6_API void vqt6_qcoreapp_exit(void* app, int exit_code);
|
||||
VQT6_API void vqt6_qcoreapp_process_events(void* app, int flags);
|
||||
VQT6_API void vqt6_qcoreapp_post_event(void* receiver, void* event);
|
||||
VQT6_API int vqt6_qcoreapp_send_event(void* receiver, void* event);
|
||||
VQT6_API void* vqt6_qcoreapp_organization_name(void* app);
|
||||
VQT6_API void vqt6_qcoreapp_set_organization_name(void* app, void* name);
|
||||
VQT6_API void* vqt6_qcoreapp_application_name(void* app);
|
||||
VQT6_API void vqt6_qcoreapp_set_application_name(void* app, void* name);
|
||||
|
||||
// ============================================================
|
||||
// QTimer
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qtimer_create(void);
|
||||
VQT6_API void* vqt6_qtimer_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qtimer_start(void* timer, int interval_ms);
|
||||
VQT6_API void vqt6_qtimer_stop(void* timer);
|
||||
VQT6_API void vqt6_qtimer_set_interval(void* timer, int interval_ms);
|
||||
VQT6_API int vqt6_qtimer_interval(void* timer);
|
||||
VQT6_API int vqt6_qtimer_is_active(void* timer);
|
||||
VQT6_API void vqt6_qtimer_set_single_shot(void* timer, int single_shot);
|
||||
VQT6_API int vqt6_qtimer_is_single_shot(void* timer);
|
||||
|
||||
// ============================================================
|
||||
// QVariant
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qvariant_create_int(int value);
|
||||
VQT6_API void* vqt6_qvariant_create_double(double value);
|
||||
VQT6_API void* vqt6_qvariant_create_bool(int value);
|
||||
VQT6_API void* vqt6_qvariant_create_string(void* s);
|
||||
VQT6_API int vqt6_qvariant_to_int(void* v, int* ok);
|
||||
VQT6_API double vqt6_qvariant_to_double(void* v, int* ok);
|
||||
VQT6_API int vqt6_qvariant_to_bool(void* v, int* ok);
|
||||
VQT6_API void* vqt6_qvariant_to_string(void* v);
|
||||
VQT6_API int vqt6_qvariant_type_id(void* v);
|
||||
VQT6_API int vqt6_qvariant_is_valid(void* v);
|
||||
VQT6_API void vqt6_qvariant_free(void* v);
|
||||
|
||||
// ============================================================
|
||||
// QEvent
|
||||
// ============================================================
|
||||
VQT6_API int vqt6_qevent_type(void* event);
|
||||
VQT6_API void vqt6_qevent_accept(void* event);
|
||||
VQT6_API void vqt6_qevent_ignore(void* event);
|
||||
VQT6_API int vqt6_qevent_is_accepted(void* event);
|
||||
|
||||
// ============================================================
|
||||
// QStringList
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qstringlist_create(void);
|
||||
VQT6_API void vqt6_qstringlist_append(void* list, void* str);
|
||||
VQT6_API int vqt6_qstringlist_size(void* list);
|
||||
VQT6_API void* vqt6_qstringlist_at(void* list, int index);
|
||||
VQT6_API void vqt6_qstringlist_free(void* list);
|
||||
|
||||
// ============================================================
|
||||
// QByteArrayList
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qbytearraylist_create(void);
|
||||
VQT6_API void vqt6_qbytearraylist_append(void* list, void* qba);
|
||||
VQT6_API int vqt6_qbytearraylist_size(void* list);
|
||||
VQT6_API void* vqt6_qbytearraylist_at(void* list, int index);
|
||||
VQT6_API void vqt6_qbytearraylist_free(void* list);
|
||||
|
||||
// ============================================================
|
||||
// 全局回调注册表
|
||||
// ============================================================
|
||||
typedef void (*vqt6_slot_callback_t)(int slot_id, void* user_data);
|
||||
VQT6_API void vqt6_register_slot(int slot_id, void* user_data);
|
||||
VQT6_API void vqt6_unregister_slot(int slot_id);
|
||||
VQT6_API void vqt6_trigger_slot(int slot_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // VQT6_BRIDGE_H
|
||||
433
includes/vqt6/_bridge_core.cpp
Normal file
433
includes/vqt6/_bridge_core.cpp
Normal file
@@ -0,0 +1,433 @@
|
||||
// ============================================================
|
||||
// vqt6/_bridge_core.cpp — QtCore C 桥接层实现
|
||||
// ============================================================
|
||||
|
||||
#include "_bridge.h"
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <QVariant>
|
||||
#include <QEvent>
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QHash>
|
||||
#include <QMutex>
|
||||
#include <cstring>
|
||||
|
||||
// 全局回调表(线程安全)
|
||||
namespace {
|
||||
QMutex g_slot_mutex;
|
||||
QHash<int, QPair<vqt6_slot_callback_t, void*>> g_slots;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QString
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qstring_create(const char* utf8) {
|
||||
if (utf8 == nullptr) return nullptr;
|
||||
return new QString(QString::fromUtf8(utf8));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qstring_to_utf8(void* qstr, char* buf, size_t buf_size) {
|
||||
if (qstr == nullptr || buf == nullptr || buf_size == 0) return 0;
|
||||
QString* s = static_cast<QString*>(qstr);
|
||||
QByteArray ba = s->toUtf8();
|
||||
size_t len = static_cast<size_t>(ba.size());
|
||||
if (len >= buf_size) len = buf_size - 1;
|
||||
std::memcpy(buf, ba.constData(), len);
|
||||
buf[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qstring_free(void* qstr) {
|
||||
delete static_cast<QString*>(qstr);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qstring_length(void* qstr) {
|
||||
if (qstr == nullptr) return 0;
|
||||
return static_cast<QString*>(qstr)->length();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qstring_is_empty(void* qstr) {
|
||||
if (qstr == nullptr) return 1;
|
||||
return static_cast<QString*>(qstr)->isEmpty() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qstring_equals(void* qstr, void* other) {
|
||||
if (qstr == nullptr || other == nullptr) return 0;
|
||||
return *static_cast<QString*>(qstr) == *static_cast<QString*>(other) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qstring_append(void* qstr, void* other) {
|
||||
if (qstr == nullptr || other == nullptr) return nullptr;
|
||||
return new QString(*static_cast<QString*>(qstr) + *static_cast<QString*>(other));
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QByteArray
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qbytearray_create(const void* data, size_t size) {
|
||||
if (data == nullptr) return new QByteArray();
|
||||
return new QByteArray(static_cast<const char*>(data), static_cast<int>(size));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qbytearray_data(void* qba, size_t* out_size) {
|
||||
if (qba == nullptr) return nullptr;
|
||||
QByteArray* ba = static_cast<QByteArray*>(qba);
|
||||
if (out_size != nullptr) *out_size = static_cast<size_t>(ba->size());
|
||||
return ba->data();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qbytearray_size(void* qba) {
|
||||
if (qba == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QByteArray*>(qba)->size());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qbytearray_free(void* qba) {
|
||||
delete static_cast<QByteArray*>(qba);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QObject
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void vqt6_qobject_delete(void* obj) {
|
||||
if (obj == nullptr) return;
|
||||
delete static_cast<QObject*>(obj);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qobject_delete_later(void* obj) {
|
||||
if (obj == nullptr) return;
|
||||
static_cast<QObject*>(obj)->deleteLater();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qobject_set_object_name(void* obj, void* name) {
|
||||
if (obj == nullptr || name == nullptr) return;
|
||||
static_cast<QObject*>(obj)->setObjectName(*static_cast<QString*>(name));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qobject_object_name(void* obj) {
|
||||
if (obj == nullptr) return nullptr;
|
||||
return new QString(static_cast<QObject*>(obj)->objectName());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qobject_set_parent(void* child, void* parent) {
|
||||
if (child == nullptr) return;
|
||||
static_cast<QObject*>(child)->setParent(static_cast<QObject*>(parent));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qobject_parent(void* obj) {
|
||||
if (obj == nullptr) return nullptr;
|
||||
return static_cast<QObject*>(obj)->parent();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qobject_connect(void* sender, const char* signal_name,
|
||||
void* receiver, const char* slot_name) {
|
||||
if (sender == nullptr || receiver == nullptr || signal_name == nullptr || slot_name == nullptr)
|
||||
return 0;
|
||||
return QObject::connect(
|
||||
static_cast<QObject*>(sender), signal_name,
|
||||
static_cast<QObject*>(receiver), slot_name
|
||||
) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qobject_disconnect(void* sender, const char* signal_name,
|
||||
void* receiver, const char* slot_name) {
|
||||
if (sender == nullptr || receiver == nullptr) return 0;
|
||||
return QObject::disconnect(
|
||||
static_cast<QObject*>(sender), signal_name,
|
||||
static_cast<QObject*>(receiver), slot_name
|
||||
) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qobject_install_event_filter(void* watched, void* filter) {
|
||||
if (watched == nullptr || filter == nullptr) return;
|
||||
static_cast<QObject*>(watched)->installEventFilter(static_cast<QObject*>(filter));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qobject_remove_event_filter(void* watched, void* filter) {
|
||||
if (watched == nullptr || filter == nullptr) return;
|
||||
static_cast<QObject*>(watched)->removeEventFilter(static_cast<QObject*>(filter));
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QCoreApplication
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qcoreapp_create(const char* app_name) {
|
||||
if (app_name == nullptr) return nullptr;
|
||||
int argc = 1;
|
||||
static char app_name_copy[1024];
|
||||
std::strncpy(app_name_copy, app_name, sizeof(app_name_copy) - 1);
|
||||
app_name_copy[sizeof(app_name_copy) - 1] = '\0';
|
||||
char* argv[] = { app_name_copy, nullptr };
|
||||
return new QCoreApplication(argc, argv);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcoreapp_instance(void) {
|
||||
return QCoreApplication::instance();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcoreapp_exec(void* app) {
|
||||
if (app == nullptr) return -1;
|
||||
return static_cast<QCoreApplication*>(app)->exec();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcoreapp_quit(void* app, int exit_code) {
|
||||
if (app == nullptr) return;
|
||||
// 优先使用 exit_code 重载
|
||||
QCoreApplication* a = static_cast<QCoreApplication*>(app);
|
||||
if (a == QCoreApplication::instance()) {
|
||||
a->exit(exit_code);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcoreapp_exit(void* app, int exit_code) {
|
||||
if (app == nullptr) return;
|
||||
static_cast<QCoreApplication*>(app)->exit(exit_code);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcoreapp_process_events(void* app, int flags) {
|
||||
if (app == nullptr) return;
|
||||
static_cast<QCoreApplication*>(app)->processEvents(static_cast<QEventLoop::ProcessEventsFlag>(flags));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcoreapp_post_event(void* receiver, void* event) {
|
||||
if (receiver == nullptr || event == nullptr) return;
|
||||
QCoreApplication::postEvent(static_cast<QObject*>(receiver), static_cast<QEvent*>(event));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcoreapp_send_event(void* receiver, void* event) {
|
||||
if (receiver == nullptr || event == nullptr) return 0;
|
||||
return QCoreApplication::sendEvent(static_cast<QObject*>(receiver), static_cast<QEvent*>(event)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcoreapp_organization_name(void* app) {
|
||||
if (app == nullptr) return nullptr;
|
||||
return new QString(QCoreApplication::organizationName());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcoreapp_set_organization_name(void* app, void* name) {
|
||||
if (app == nullptr || name == nullptr) return;
|
||||
QCoreApplication::setOrganizationName(*static_cast<QString*>(name));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcoreapp_application_name(void* app) {
|
||||
if (app == nullptr) return nullptr;
|
||||
return new QString(QCoreApplication::applicationName());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcoreapp_set_application_name(void* app, void* name) {
|
||||
if (app == nullptr || name == nullptr) return;
|
||||
QCoreApplication::setApplicationName(*static_cast<QString*>(name));
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QTimer
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qtimer_create(void) {
|
||||
return new QTimer();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qtimer_create_with_parent(void* parent) {
|
||||
if (parent == nullptr) return nullptr;
|
||||
return new QTimer(static_cast<QObject*>(parent));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtimer_start(void* timer, int interval_ms) {
|
||||
if (timer == nullptr) return;
|
||||
static_cast<QTimer*>(timer)->start(interval_ms);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtimer_stop(void* timer) {
|
||||
if (timer == nullptr) return;
|
||||
static_cast<QTimer*>(timer)->stop();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtimer_set_interval(void* timer, int interval_ms) {
|
||||
if (timer == nullptr) return;
|
||||
static_cast<QTimer*>(timer)->setInterval(interval_ms);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qtimer_interval(void* timer) {
|
||||
if (timer == nullptr) return 0;
|
||||
return static_cast<QTimer*>(timer)->interval();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qtimer_is_active(void* timer) {
|
||||
if (timer == nullptr) return 0;
|
||||
return static_cast<QTimer*>(timer)->isActive() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtimer_set_single_shot(void* timer, int single_shot) {
|
||||
if (timer == nullptr) return;
|
||||
static_cast<QTimer*>(timer)->setSingleShot(single_shot != 0);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qtimer_is_single_shot(void* timer) {
|
||||
if (timer == nullptr) return 0;
|
||||
return static_cast<QTimer*>(timer)->isSingleShot() ? 1 : 0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QVariant
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qvariant_create_int(int value) {
|
||||
return new QVariant(value);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qvariant_create_double(double value) {
|
||||
return new QVariant(value);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qvariant_create_bool(int value) {
|
||||
return new QVariant(value != 0);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qvariant_create_string(void* s) {
|
||||
if (s == nullptr) return new QVariant();
|
||||
return new QVariant(*static_cast<QString*>(s));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qvariant_to_int(void* v, int* ok) {
|
||||
if (v == nullptr) return 0;
|
||||
bool bok = false;
|
||||
int val = static_cast<QVariant*>(v)->toInt(&bok);
|
||||
if (ok != nullptr) *ok = bok ? 1 : 0;
|
||||
return val;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API double vqt6_qvariant_to_double(void* v, int* ok) {
|
||||
if (v == nullptr) return 0.0;
|
||||
bool bok = false;
|
||||
double val = static_cast<QVariant*>(v)->toDouble(&bok);
|
||||
if (ok != nullptr) *ok = bok ? 1 : 0;
|
||||
return val;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qvariant_to_bool(void* v, int* ok) {
|
||||
if (v == nullptr) return 0;
|
||||
bool bok = false;
|
||||
bool val = static_cast<QVariant*>(v)->toBool();
|
||||
if (ok != nullptr) *ok = 1;
|
||||
return val ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qvariant_to_string(void* v) {
|
||||
if (v == nullptr) return nullptr;
|
||||
return new QString(static_cast<QVariant*>(v)->toString());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qvariant_type_id(void* v) {
|
||||
if (v == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QVariant*>(v)->typeId());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qvariant_is_valid(void* v) {
|
||||
if (v == nullptr) return 0;
|
||||
return static_cast<QVariant*>(v)->isValid() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qvariant_free(void* v) {
|
||||
delete static_cast<QVariant*>(v);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QEvent
|
||||
// ============================================================
|
||||
extern "C" VQT6_API int vqt6_qevent_type(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QEvent*>(event)->type());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qevent_accept(void* event) {
|
||||
if (event == nullptr) return;
|
||||
static_cast<QEvent*>(event)->accept();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qevent_ignore(void* event) {
|
||||
if (event == nullptr) return;
|
||||
static_cast<QEvent*>(event)->ignore();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qevent_is_accepted(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<QEvent*>(event)->isAccepted() ? 1 : 0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QStringList
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qstringlist_create(void) {
|
||||
return new QStringList();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qstringlist_append(void* list, void* str) {
|
||||
if (list == nullptr || str == nullptr) return;
|
||||
static_cast<QStringList*>(list)->append(*static_cast<QString*>(str));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qstringlist_size(void* list) {
|
||||
if (list == nullptr) return 0;
|
||||
return static_cast<QStringList*>(list)->size();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qstringlist_at(void* list, int index) {
|
||||
if (list == nullptr) return nullptr;
|
||||
QStringList* sl = static_cast<QStringList*>(list);
|
||||
if (index < 0 || index >= sl->size()) return nullptr;
|
||||
return new QString(sl->at(index));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qstringlist_free(void* list) {
|
||||
delete static_cast<QStringList*>(list);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QByteArrayList
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qbytearraylist_create(void) {
|
||||
return new QList<QByteArray>();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qbytearraylist_append(void* list, void* qba) {
|
||||
if (list == nullptr || qba == nullptr) return;
|
||||
static_cast<QList<QByteArray>*>(list)->append(*static_cast<QByteArray*>(qba));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qbytearraylist_size(void* list) {
|
||||
if (list == nullptr) return 0;
|
||||
return static_cast<QList<QByteArray>*>(list)->size();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qbytearraylist_at(void* list, int index) {
|
||||
if (list == nullptr) return nullptr;
|
||||
QList<QByteArray>* qbl = static_cast<QList<QByteArray>*>(list);
|
||||
if (index < 0 || index >= qbl->size()) return nullptr;
|
||||
return new QByteArray(qbl->at(index));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qbytearraylist_free(void* list) {
|
||||
delete static_cast<QList<QByteArray>*>(list);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 全局回调注册表
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void vqt6_register_slot(int slot_id, void* user_data) {
|
||||
QMutexLocker locker(&g_slot_mutex);
|
||||
g_slots.insert(slot_id, QPair<vqt6_slot_callback_t, void*>(nullptr, user_data));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_unregister_slot(int slot_id) {
|
||||
QMutexLocker locker(&g_slot_mutex);
|
||||
g_slots.remove(slot_id);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_trigger_slot(int slot_id) {
|
||||
QMutexLocker locker(&g_slot_mutex);
|
||||
auto it = g_slots.find(slot_id);
|
||||
if (it != g_slots.end() && it.value().first != nullptr) {
|
||||
it.value().first(slot_id, it.value().second);
|
||||
}
|
||||
}
|
||||
868
includes/vqt6/_bridge_gui.cpp
Normal file
868
includes/vqt6/_bridge_gui.cpp
Normal file
@@ -0,0 +1,868 @@
|
||||
// ============================================================
|
||||
// vqt6/_bridge_gui.cpp — QtGui C 桥接层实现
|
||||
// ============================================================
|
||||
|
||||
#include "_bridge.h"
|
||||
#include "_bridge_gui.h"
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QPixmap>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QPen>
|
||||
#include <QBrush>
|
||||
#include <QIcon>
|
||||
#include <QCursor>
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QPaintEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QPainterPath>
|
||||
#include <QPolygon>
|
||||
#include <QPoint>
|
||||
#include <QPointF>
|
||||
#include <QRect>
|
||||
#include <QRectF>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QImageReader>
|
||||
#include <QBuffer>
|
||||
#include <QStyle>
|
||||
#include <QStringList>
|
||||
|
||||
// ============================================================
|
||||
// QColor
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qcolor_create_rgb(int r, int g, int b) {
|
||||
return new QColor(r, g, b);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcolor_create_rgba(int r, int g, int b, int a) {
|
||||
return new QColor(r, g, b, a);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcolor_create_name(void* name) {
|
||||
if (name == nullptr) return new QColor();
|
||||
return new QColor(*static_cast<QString*>(name));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcolor_create_hex(void* hex_str) {
|
||||
if (hex_str == nullptr) return new QColor();
|
||||
return new QColor(*static_cast<QString*>(hex_str));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcolor_red(void* c) {
|
||||
if (c == nullptr) return 0;
|
||||
return static_cast<QColor*>(c)->red();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcolor_green(void* c) {
|
||||
if (c == nullptr) return 0;
|
||||
return static_cast<QColor*>(c)->green();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcolor_blue(void* c) {
|
||||
if (c == nullptr) return 0;
|
||||
return static_cast<QColor*>(c)->blue();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcolor_alpha(void* c) {
|
||||
if (c == nullptr) return 255;
|
||||
return static_cast<QColor*>(c)->alpha();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcolor_set_red(void* c, int r) {
|
||||
if (c == nullptr) return;
|
||||
static_cast<QColor*>(c)->setRed(r);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcolor_set_green(void* c, int g) {
|
||||
if (c == nullptr) return;
|
||||
static_cast<QColor*>(c)->setGreen(g);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcolor_set_blue(void* c, int b) {
|
||||
if (c == nullptr) return;
|
||||
static_cast<QColor*>(c)->setBlue(b);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcolor_set_alpha(void* c, int a) {
|
||||
if (c == nullptr) return;
|
||||
static_cast<QColor*>(c)->setAlpha(a);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcolor_set_rgb(void* c, int r, int g, int b) {
|
||||
if (c == nullptr) return;
|
||||
static_cast<QColor*>(c)->setRgb(r, g, b);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcolor_set_rgba(void* c, int r, int g, int b, int a) {
|
||||
if (c == nullptr) return;
|
||||
static_cast<QColor*>(c)->setRgba(r, g, b, a);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcolor_name(void* c) {
|
||||
if (c == nullptr) return nullptr;
|
||||
return new QString(static_cast<QColor*>(c)->name());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcolor_is_valid(void* c) {
|
||||
if (c == nullptr) return 0;
|
||||
return static_cast<QColor*>(c)->isValid() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcolor_free(void* c) {
|
||||
delete static_cast<QColor*>(c);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QFont
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qfont_create(void) {
|
||||
return new QFont();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qfont_create_with_family(void* family) {
|
||||
if (family == nullptr) return new QFont();
|
||||
return new QFont(*static_cast<QString*>(family));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qfont_create_with_family_size(void* family, int point_size) {
|
||||
if (family == nullptr) return new QFont();
|
||||
return new QFont(*static_cast<QString*>(family), point_size);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_family(void* font, void* family) {
|
||||
if (font == nullptr || family == nullptr) return;
|
||||
static_cast<QFont*>(font)->setFamily(*static_cast<QString*>(family));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qfont_family(void* font) {
|
||||
if (font == nullptr) return nullptr;
|
||||
return new QString(static_cast<QFont*>(font)->family());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_point_size(void* font, int point_size) {
|
||||
if (font == nullptr) return;
|
||||
static_cast<QFont*>(font)->setPointSize(point_size);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfont_point_size(void* font) {
|
||||
if (font == nullptr) return 0;
|
||||
return static_cast<QFont*>(font)->pointSize();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_pixel_size(void* font, int pixel_size) {
|
||||
if (font == nullptr) return;
|
||||
static_cast<QFont*>(font)->setPixelSize(pixel_size);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfont_pixel_size(void* font) {
|
||||
if (font == nullptr) return 0;
|
||||
return static_cast<QFont*>(font)->pixelSize();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_bold(void* font, int bold) {
|
||||
if (font == nullptr) return;
|
||||
static_cast<QFont*>(font)->setBold(bold != 0);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfont_bold(void* font) {
|
||||
if (font == nullptr) return 0;
|
||||
return static_cast<QFont*>(font)->bold() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_italic(void* font, int italic) {
|
||||
if (font == nullptr) return;
|
||||
static_cast<QFont*>(font)->setItalic(italic != 0);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfont_italic(void* font) {
|
||||
if (font == nullptr) return 0;
|
||||
return static_cast<QFont*>(font)->italic() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_underline(void* font, int underline) {
|
||||
if (font == nullptr) return;
|
||||
static_cast<QFont*>(font)->setUnderline(underline != 0);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfont_underline(void* font) {
|
||||
if (font == nullptr) return 0;
|
||||
return static_cast<QFont*>(font)->underline() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_strike_out(void* font, int strike_out) {
|
||||
if (font == nullptr) return;
|
||||
static_cast<QFont*>(font)->setStrikeOut(strike_out != 0);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfont_strike_out(void* font) {
|
||||
if (font == nullptr) return 0;
|
||||
return static_cast<QFont*>(font)->strikeOut() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_set_weight(void* font, int weight) {
|
||||
if (font == nullptr) return;
|
||||
static_cast<QFont*>(font)->setWeight(static_cast<QFont::Weight>(weight));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfont_weight(void* font) {
|
||||
if (font == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QFont*>(font)->weight());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfont_free(void* font) {
|
||||
delete static_cast<QFont*>(font);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QFontMetrics
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qfontmetrics_create(void* font) {
|
||||
if (font == nullptr) return nullptr;
|
||||
return new QFontMetrics(*static_cast<QFont*>(font));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfontmetrics_width(void* fm, void* text) {
|
||||
if (fm == nullptr || text == nullptr) return 0;
|
||||
return static_cast<QFontMetrics*>(fm)->horizontalAdvance(*static_cast<QString*>(text));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfontmetrics_height(void* fm) {
|
||||
if (fm == nullptr) return 0;
|
||||
return static_cast<QFontMetrics*>(fm)->height();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfontmetrics_ascent(void* fm) {
|
||||
if (fm == nullptr) return 0;
|
||||
return static_cast<QFontMetrics*>(fm)->ascent();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qfontmetrics_descent(void* fm) {
|
||||
if (fm == nullptr) return 0;
|
||||
return static_cast<QFontMetrics*>(fm)->descent();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qfontmetrics_free(void* fm) {
|
||||
delete static_cast<QFontMetrics*>(fm);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QPixmap
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qpixmap_create(void) {
|
||||
return new QPixmap();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpixmap_create_with_size(int w, int h) {
|
||||
return new QPixmap(w, h);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpixmap_load(void* pm, void* file_name) {
|
||||
if (pm == nullptr || file_name == nullptr) return 0;
|
||||
return static_cast<QPixmap*>(pm)->load(*static_cast<QString*>(file_name)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpixmap_load_from_data(void* pm, const void* data, size_t size) {
|
||||
if (pm == nullptr || data == nullptr) return 0;
|
||||
return static_cast<QPixmap*>(pm)->loadFromData(static_cast<const uchar*>(data), static_cast<uint>(size)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpixmap_save(void* pm, void* file_name) {
|
||||
if (pm == nullptr || file_name == nullptr) return 0;
|
||||
return static_cast<QPixmap*>(pm)->save(*static_cast<QString*>(file_name)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpixmap_width(void* pm) {
|
||||
if (pm == nullptr) return 0;
|
||||
return static_cast<QPixmap*>(pm)->width();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpixmap_height(void* pm) {
|
||||
if (pm == nullptr) return 0;
|
||||
return static_cast<QPixmap*>(pm)->height();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpixmap_is_null(void* pm) {
|
||||
if (pm == nullptr) return 0;
|
||||
return static_cast<QPixmap*>(pm)->isNull() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpixmap_scaled(void* pm, int w, int h) {
|
||||
if (pm == nullptr) return nullptr;
|
||||
return new QPixmap(static_cast<QPixmap*>(pm)->scaled(w, h));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpixmap_fill(void* pm, void* color) {
|
||||
if (pm == nullptr) return;
|
||||
if (color != nullptr) {
|
||||
static_cast<QPixmap*>(pm)->fill(*static_cast<QColor*>(color));
|
||||
} else {
|
||||
static_cast<QPixmap*>(pm)->fill();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpixmap_free(void* pm) {
|
||||
delete static_cast<QPixmap*>(pm);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QImage
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qimage_create(void) {
|
||||
return new QImage();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qimage_create_with_size(int w, int h, int format) {
|
||||
return new QImage(w, h, static_cast<QImage::Format>(format));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qimage_load(void* img, void* file_name) {
|
||||
if (img == nullptr || file_name == nullptr) return 0;
|
||||
return static_cast<QImage*>(img)->load(*static_cast<QString*>(file_name)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qimage_save(void* img, void* file_name) {
|
||||
if (img == nullptr || file_name == nullptr) return 0;
|
||||
return static_cast<QImage*>(img)->save(*static_cast<QString*>(file_name)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qimage_width(void* img) {
|
||||
if (img == nullptr) return 0;
|
||||
return static_cast<QImage*>(img)->width();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qimage_height(void* img) {
|
||||
if (img == nullptr) return 0;
|
||||
return static_cast<QImage*>(img)->height();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qimage_format(void* img) {
|
||||
if (img == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QImage*>(img)->format());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qimage_is_null(void* img) {
|
||||
if (img == nullptr) return 0;
|
||||
return static_cast<QImage*>(img)->isNull() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qimage_fill(void* img, void* color) {
|
||||
if (img == nullptr) return;
|
||||
if (color != nullptr) {
|
||||
static_cast<QImage*>(img)->fill(*static_cast<QColor*>(color));
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qimage_scaled(void* img, int w, int h) {
|
||||
if (img == nullptr) return nullptr;
|
||||
return new QImage(static_cast<QImage*>(img)->scaled(w, h));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qimage_free(void* img) {
|
||||
delete static_cast<QImage*>(img);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QPainter
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qpainter_create(void) {
|
||||
return new QPainter();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpainter_begin(void* p, void* device) {
|
||||
if (p == nullptr || device == nullptr) return 0;
|
||||
return static_cast<QPainter*>(p)->begin(static_cast<QPixmap*>(device)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpainter_end(void* p) {
|
||||
if (p == nullptr) return 0;
|
||||
return static_cast<QPainter*>(p)->end() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpainter_is_active(void* p) {
|
||||
if (p == nullptr) return 0;
|
||||
return static_cast<QPainter*>(p)->isActive() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_set_pen(void* p, void* pen) {
|
||||
if (p == nullptr || pen == nullptr) return;
|
||||
static_cast<QPainter*>(p)->setPen(*static_cast<QPen*>(pen));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_set_brush(void* p, void* brush) {
|
||||
if (p == nullptr || brush == nullptr) return;
|
||||
static_cast<QPainter*>(p)->setBrush(*static_cast<QBrush*>(brush));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_set_font(void* p, void* font) {
|
||||
if (p == nullptr || font == nullptr) return;
|
||||
static_cast<QPainter*>(p)->setFont(*static_cast<QFont*>(font));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpainter_pen(void* p) {
|
||||
if (p == nullptr) return nullptr;
|
||||
return new QPen(static_cast<QPainter*>(p)->pen());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpainter_brush(void* p) {
|
||||
if (p == nullptr) return nullptr;
|
||||
return new QBrush(static_cast<QPainter*>(p)->brush());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpainter_font(void* p) {
|
||||
if (p == nullptr) return nullptr;
|
||||
return new QFont(static_cast<QPainter*>(p)->font());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_set_opacity(void* p, double opacity) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->setOpacity(opacity);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API double vqt6_qpainter_opacity(void* p) {
|
||||
if (p == nullptr) return 1.0;
|
||||
return static_cast<QPainter*>(p)->opacity();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_line(void* p, int x1, int y1, int x2, int y2) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawLine(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_rect(void* p, int x, int y, int w, int h) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawRect(x, y, w, h);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_fill_rect(void* p, int x, int y, int w, int h, void* color) {
|
||||
if (p == nullptr || color == nullptr) return;
|
||||
static_cast<QPainter*>(p)->fillRect(x, y, w, h, *static_cast<QColor*>(color));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_ellipse(void* p, int x, int y, int w, int h) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawEllipse(x, y, w, h);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_arc(void* p, int x, int y, int w, int h, int start_angle, int span_angle) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawArc(x, y, w, h, start_angle, span_angle);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_chord(void* p, int x, int y, int w, int h, int start_angle, int span_angle) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawChord(x, y, w, h, start_angle, span_angle);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_pie(void* p, int x, int y, int w, int h, int start_angle, int span_angle) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawPie(x, y, w, h, start_angle, span_angle);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_polygon(void* p, int* points, int point_count) {
|
||||
if (p == nullptr || points == nullptr || point_count < 1) return;
|
||||
QPolygon polygon;
|
||||
for (int i = 0; i < point_count; ++i) {
|
||||
polygon << QPoint(points[i*2], points[i*2+1]);
|
||||
}
|
||||
static_cast<QPainter*>(p)->drawPolygon(polygon);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_polyline(void* p, int* points, int point_count) {
|
||||
if (p == nullptr || points == nullptr || point_count < 1) return;
|
||||
QPolygon polyline;
|
||||
for (int i = 0; i < point_count; ++i) {
|
||||
polyline << QPoint(points[i*2], points[i*2+1]);
|
||||
}
|
||||
static_cast<QPainter*>(p)->drawPolyline(polyline);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_point(void* p, int x, int y) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawPoint(x, y);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_points(void* p, int* points, int point_count) {
|
||||
if (p == nullptr || points == nullptr || point_count < 1) return;
|
||||
QPolygon pts;
|
||||
for (int i = 0; i < point_count; ++i) {
|
||||
pts << QPoint(points[i*2], points[i*2+1]);
|
||||
}
|
||||
static_cast<QPainter*>(p)->drawPoints(pts);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_text(void* p, int x, int y, void* text) {
|
||||
if (p == nullptr || text == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawText(x, y, *static_cast<QString*>(text));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_text_in_rect(void* p, int x, int y, int w, int h, int flags, void* text) {
|
||||
if (p == nullptr || text == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawText(x, y, w, h, flags, *static_cast<QString*>(text));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_pixmap(void* p, int x, int y, void* pixmap) {
|
||||
if (p == nullptr || pixmap == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawPixmap(x, y, *static_cast<QPixmap*>(pixmap));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_image(void* p, int x, int y, void* image) {
|
||||
if (p == nullptr || image == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawImage(x, y, *static_cast<QImage*>(image));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_draw_tiled_pixmap(void* p, int x, int y, int w, int h, void* pixmap) {
|
||||
if (p == nullptr || pixmap == nullptr) return;
|
||||
static_cast<QPainter*>(p)->drawTiledPixmap(x, y, w, h, *static_cast<QPixmap*>(pixmap));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_translate(void* p, int dx, int dy) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->translate(dx, dy);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_rotate(void* p, double angle) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->rotate(angle);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_scale(void* p, double sx, double sy) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->scale(sx, sy);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_reset_transform(void* p) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->resetTransform();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_save(void* p) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->save();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_restore(void* p) {
|
||||
if (p == nullptr) return;
|
||||
static_cast<QPainter*>(p)->restore();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpainter_free(void* p) {
|
||||
delete static_cast<QPainter*>(p);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QPen
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qpen_create(void) {
|
||||
return new QPen();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpen_create_with_color(void* color) {
|
||||
if (color == nullptr) return new QPen();
|
||||
return new QPen(*static_cast<QColor*>(color));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpen_create_with_color_width(void* color, int width) {
|
||||
if (color == nullptr) return new QPen();
|
||||
return new QPen(*static_cast<QColor*>(color), width);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpen_set_color(void* pen, void* color) {
|
||||
if (pen == nullptr || color == nullptr) return;
|
||||
static_cast<QPen*>(pen)->setColor(*static_cast<QColor*>(color));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpen_color(void* pen) {
|
||||
if (pen == nullptr) return nullptr;
|
||||
return new QColor(static_cast<QPen*>(pen)->color());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpen_set_width(void* pen, int width) {
|
||||
if (pen == nullptr) return;
|
||||
static_cast<QPen*>(pen)->setWidth(width);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpen_width(void* pen) {
|
||||
if (pen == nullptr) return 0;
|
||||
return static_cast<QPen*>(pen)->width();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpen_set_style(void* pen, int style) {
|
||||
if (pen == nullptr) return;
|
||||
static_cast<QPen*>(pen)->setStyle(static_cast<Qt::PenStyle>(style));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qpen_style(void* pen) {
|
||||
if (pen == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QPen*>(pen)->style());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpen_free(void* pen) {
|
||||
delete static_cast<QPen*>(pen);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QBrush
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qbrush_create(void) {
|
||||
return new QBrush();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qbrush_create_with_color(void* color) {
|
||||
if (color == nullptr) return new QBrush();
|
||||
return new QBrush(*static_cast<QColor*>(color));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qbrush_create_with_style(int style) {
|
||||
return new QBrush(static_cast<Qt::BrushStyle>(style));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qbrush_set_color(void* brush, void* color) {
|
||||
if (brush == nullptr || color == nullptr) return;
|
||||
static_cast<QBrush*>(brush)->setColor(*static_cast<QColor*>(color));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qbrush_color(void* brush) {
|
||||
if (brush == nullptr) return nullptr;
|
||||
return new QColor(static_cast<QBrush*>(brush)->color());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qbrush_set_style(void* brush, int style) {
|
||||
if (brush == nullptr) return;
|
||||
static_cast<QBrush*>(brush)->setStyle(static_cast<Qt::BrushStyle>(style));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qbrush_style(void* brush) {
|
||||
if (brush == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QBrush*>(brush)->style());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qbrush_free(void* brush) {
|
||||
delete static_cast<QBrush*>(brush);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QIcon
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qicon_create(void) {
|
||||
return new QIcon();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qicon_create_with_file(void* file_name) {
|
||||
if (file_name == nullptr) return new QIcon();
|
||||
return new QIcon(*static_cast<QString*>(file_name));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qicon_add_file(void* icon, void* file_name) {
|
||||
if (icon == nullptr || file_name == nullptr) return;
|
||||
static_cast<QIcon*>(icon)->addFile(*static_cast<QString*>(file_name));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qicon_add_pixmap(void* icon, void* pixmap) {
|
||||
if (icon == nullptr || pixmap == nullptr) return;
|
||||
static_cast<QIcon*>(icon)->addPixmap(*static_cast<QPixmap*>(pixmap));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qicon_is_null(void* icon) {
|
||||
if (icon == nullptr) return 0;
|
||||
return static_cast<QIcon*>(icon)->isNull() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qicon_pixmap(void* icon, int w, int h) {
|
||||
if (icon == nullptr) return nullptr;
|
||||
return new QPixmap(static_cast<QIcon*>(icon)->pixmap(w, h));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qicon_free(void* icon) {
|
||||
delete static_cast<QIcon*>(icon);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QCursor
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qcursor_create(void) {
|
||||
return new QCursor();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcursor_create_with_shape(int shape) {
|
||||
return new QCursor(static_cast<Qt::CursorShape>(shape));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcursor_pos(int* x, int* y) {
|
||||
QPoint p = QCursor::pos();
|
||||
if (x != nullptr) *x = p.x();
|
||||
if (y != nullptr) *y = p.y();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcursor_set_pos(int x, int y) {
|
||||
QCursor::setPos(x, y);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcursor_set_shape(void* cursor, int shape) {
|
||||
if (cursor == nullptr) return;
|
||||
static_cast<QCursor*>(cursor)->setShape(static_cast<Qt::CursorShape>(shape));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcursor_shape(void* cursor) {
|
||||
if (cursor == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QCursor*>(cursor)->shape());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcursor_free(void* cursor) {
|
||||
delete static_cast<QCursor*>(cursor);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QKeyEvent
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qkeyevent_create(int type, int key, int modifiers, void* text) {
|
||||
QString* t = static_cast<QString*>(text);
|
||||
return new QKeyEvent(static_cast<QEvent::Type>(type), key, static_cast<Qt::KeyboardModifiers>(modifiers),
|
||||
t != nullptr ? *t : QString());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qkeyevent_key(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<QKeyEvent*>(event)->key();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qkeyevent_text(void* event) {
|
||||
if (event == nullptr) return nullptr;
|
||||
return new QString(static_cast<QKeyEvent*>(event)->text());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qkeyevent_modifiers(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QKeyEvent*>(event)->modifiers());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qkeyevent_is_auto_repeat(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<QKeyEvent*>(event)->isAutoRepeat() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qkeyevent_free(void* event) {
|
||||
delete static_cast<QKeyEvent*>(event);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QMouseEvent
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qmouseevent_create(int type, void* local_pos, int button, int buttons, int modifiers) {
|
||||
QPointF* lp = static_cast<QPointF*>(local_pos);
|
||||
return new QMouseEvent(
|
||||
static_cast<QEvent::Type>(type),
|
||||
lp != nullptr ? *lp : QPointF(0, 0),
|
||||
Qt::NoButton,
|
||||
static_cast<Qt::MouseButton>(button),
|
||||
static_cast<Qt::KeyboardModifiers>(modifiers)
|
||||
);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qmouseevent_button(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QMouseEvent*>(event)->button());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qmouseevent_buttons(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QMouseEvent*>(event)->buttons());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qmouseevent_x(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QMouseEvent*>(event)->position().x());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qmouseevent_y(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QMouseEvent*>(event)->position().y());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qmouseevent_global_x(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QMouseEvent*>(event)->globalPosition().x());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qmouseevent_global_y(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QMouseEvent*>(event)->globalPosition().y());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qmouseevent_modifiers(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QMouseEvent*>(event)->modifiers());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qmouseevent_free(void* event) {
|
||||
delete static_cast<QMouseEvent*>(event);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QResizeEvent / QPaintEvent / QCloseEvent
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qresizeevent_create(int width, int height, int old_width, int old_height) {
|
||||
return new QResizeEvent(QSize(width, height), QSize(old_width, old_height));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qresizeevent_size(void* event, int* w, int* h) {
|
||||
if (event == nullptr) return;
|
||||
QSize s = static_cast<QResizeEvent*>(event)->size();
|
||||
if (w != nullptr) *w = s.width();
|
||||
if (h != nullptr) *h = s.height();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qresizeevent_old_size(void* event, int* w, int* h) {
|
||||
if (event == nullptr) return;
|
||||
QSize s = static_cast<QResizeEvent*>(event)->oldSize();
|
||||
if (w != nullptr) *w = s.width();
|
||||
if (h != nullptr) *h = s.height();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qresizeevent_free(void* event) {
|
||||
delete static_cast<QResizeEvent*>(event);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qpaintevent_create(int rect_x, int rect_y, int rect_w, int rect_h) {
|
||||
return new QPaintEvent(QRect(rect_x, rect_y, rect_w, rect_h));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpaintevent_rect(void* event, int* x, int* y, int* w, int* h) {
|
||||
if (event == nullptr) return;
|
||||
QRect r = static_cast<QPaintEvent*>(event)->rect();
|
||||
if (x != nullptr) *x = r.x();
|
||||
if (y != nullptr) *y = r.y();
|
||||
if (w != nullptr) *w = r.width();
|
||||
if (h != nullptr) *h = r.height();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qpaintevent_free(void* event) {
|
||||
delete static_cast<QPaintEvent*>(event);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qcloseevent_create(void) {
|
||||
return new QCloseEvent();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qcloseevent_is_accepted(void* event) {
|
||||
if (event == nullptr) return 0;
|
||||
return static_cast<QCloseEvent*>(event)->isAccepted() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcloseevent_accept(void* event) {
|
||||
if (event == nullptr) return;
|
||||
static_cast<QCloseEvent*>(event)->accept();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcloseevent_ignore(void* event) {
|
||||
if (event == nullptr) return;
|
||||
static_cast<QCloseEvent*>(event)->ignore();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qcloseevent_free(void* event) {
|
||||
delete static_cast<QCloseEvent*>(event);
|
||||
}
|
||||
231
includes/vqt6/_bridge_gui.h
Normal file
231
includes/vqt6/_bridge_gui.h
Normal file
@@ -0,0 +1,231 @@
|
||||
// ============================================================
|
||||
// vqt6/_bridge_gui.h — QtGui C 桥接函数声明
|
||||
// ============================================================
|
||||
|
||||
#ifndef VQT6_BRIDGE_GUI_H
|
||||
#define VQT6_BRIDGE_GUI_H
|
||||
|
||||
#include "_bridge.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ============================================================
|
||||
// QColor
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qcolor_create_rgb(int r, int g, int b);
|
||||
VQT6_API void* vqt6_qcolor_create_rgba(int r, int g, int b, int a);
|
||||
VQT6_API void* vqt6_qcolor_create_name(void* name);
|
||||
VQT6_API void* vqt6_qcolor_create_hex(void* hex_str);
|
||||
VQT6_API int vqt6_qcolor_red(void* c);
|
||||
VQT6_API int vqt6_qcolor_green(void* c);
|
||||
VQT6_API int vqt6_qcolor_blue(void* c);
|
||||
VQT6_API int vqt6_qcolor_alpha(void* c);
|
||||
VQT6_API void vqt6_qcolor_set_red(void* c, int r);
|
||||
VQT6_API void vqt6_qcolor_set_green(void* c, int g);
|
||||
VQT6_API void vqt6_qcolor_set_blue(void* c, int b);
|
||||
VQT6_API void vqt6_qcolor_set_alpha(void* c, int a);
|
||||
VQT6_API void vqt6_qcolor_set_rgb(void* c, int r, int g, int b);
|
||||
VQT6_API void vqt6_qcolor_set_rgba(void* c, int r, int g, int b, int a);
|
||||
VQT6_API void* vqt6_qcolor_name(void* c);
|
||||
VQT6_API int vqt6_qcolor_is_valid(void* c);
|
||||
VQT6_API void vqt6_qcolor_free(void* c);
|
||||
|
||||
// ============================================================
|
||||
// QFont
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qfont_create(void);
|
||||
VQT6_API void* vqt6_qfont_create_with_family(void* family);
|
||||
VQT6_API void* vqt6_qfont_create_with_family_size(void* family, int point_size);
|
||||
VQT6_API void vqt6_qfont_set_family(void* font, void* family);
|
||||
VQT6_API void* vqt6_qfont_family(void* font);
|
||||
VQT6_API void vqt6_qfont_set_point_size(void* font, int point_size);
|
||||
VQT6_API int vqt6_qfont_point_size(void* font);
|
||||
VQT6_API void vqt6_qfont_set_pixel_size(void* font, int pixel_size);
|
||||
VQT6_API int vqt6_qfont_pixel_size(void* font);
|
||||
VQT6_API void vqt6_qfont_set_bold(void* font, int bold);
|
||||
VQT6_API int vqt6_qfont_bold(void* font);
|
||||
VQT6_API void vqt6_qfont_set_italic(void* font, int italic);
|
||||
VQT6_API int vqt6_qfont_italic(void* font);
|
||||
VQT6_API void vqt6_qfont_set_underline(void* font, int underline);
|
||||
VQT6_API int vqt6_qfont_underline(void* font);
|
||||
VQT6_API void vqt6_qfont_set_strike_out(void* font, int strike_out);
|
||||
VQT6_API int vqt6_qfont_strike_out(void* font);
|
||||
VQT6_API void vqt6_qfont_set_weight(void* font, int weight);
|
||||
VQT6_API int vqt6_qfont_weight(void* font);
|
||||
VQT6_API void vqt6_qfont_free(void* font);
|
||||
|
||||
// ============================================================
|
||||
// QFontMetrics
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qfontmetrics_create(void* font);
|
||||
VQT6_API int vqt6_qfontmetrics_width(void* fm, void* text);
|
||||
VQT6_API int vqt6_qfontmetrics_height(void* fm);
|
||||
VQT6_API int vqt6_qfontmetrics_ascent(void* fm);
|
||||
VQT6_API int vqt6_qfontmetrics_descent(void* fm);
|
||||
VQT6_API void vqt6_qfontmetrics_free(void* fm);
|
||||
|
||||
// ============================================================
|
||||
// QPixmap
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qpixmap_create(void);
|
||||
VQT6_API void* vqt6_qpixmap_create_with_size(int w, int h);
|
||||
VQT6_API int vqt6_qpixmap_load(void* pm, void* file_name);
|
||||
VQT6_API int vqt6_qpixmap_load_from_data(void* pm, const void* data, size_t size);
|
||||
VQT6_API int vqt6_qpixmap_save(void* pm, void* file_name);
|
||||
VQT6_API int vqt6_qpixmap_width(void* pm);
|
||||
VQT6_API int vqt6_qpixmap_height(void* pm);
|
||||
VQT6_API int vqt6_qpixmap_is_null(void* pm);
|
||||
VQT6_API void* vqt6_qpixmap_scaled(void* pm, int w, int h);
|
||||
VQT6_API void vqt6_qpixmap_fill(void* pm, void* color);
|
||||
VQT6_API void vqt6_qpixmap_free(void* pm);
|
||||
|
||||
// ============================================================
|
||||
// QImage
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qimage_create(void);
|
||||
VQT6_API void* vqt6_qimage_create_with_size(int w, int h, int format);
|
||||
VQT6_API int vqt6_qimage_load(void* img, void* file_name);
|
||||
VQT6_API int vqt6_qimage_save(void* img, void* file_name);
|
||||
VQT6_API int vqt6_qimage_width(void* img);
|
||||
VQT6_API int vqt6_qimage_height(void* img);
|
||||
VQT6_API int vqt6_qimage_format(void* img);
|
||||
VQT6_API int vqt6_qimage_is_null(void* img);
|
||||
VQT6_API void vqt6_qimage_fill(void* img, void* color);
|
||||
VQT6_API void* vqt6_qimage_scaled(void* img, int w, int h);
|
||||
VQT6_API void vqt6_qimage_free(void* img);
|
||||
|
||||
// ============================================================
|
||||
// QPainter
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qpainter_create(void);
|
||||
VQT6_API int vqt6_qpainter_begin(void* p, void* device);
|
||||
VQT6_API int vqt6_qpainter_end(void* p);
|
||||
VQT6_API int vqt6_qpainter_is_active(void* p);
|
||||
VQT6_API void vqt6_qpainter_set_pen(void* p, void* pen);
|
||||
VQT6_API void vqt6_qpainter_set_brush(void* p, void* brush);
|
||||
VQT6_API void vqt6_qpainter_set_font(void* p, void* font);
|
||||
VQT6_API void* vqt6_qpainter_pen(void* p);
|
||||
VQT6_API void* vqt6_qpainter_brush(void* p);
|
||||
VQT6_API void* vqt6_qpainter_font(void* p);
|
||||
VQT6_API void vqt6_qpainter_set_opacity(void* p, double opacity);
|
||||
VQT6_API double vqt6_qpainter_opacity(void* p);
|
||||
VQT6_API void vqt6_qpainter_draw_line(void* p, int x1, int y1, int x2, int y2);
|
||||
VQT6_API void vqt6_qpainter_draw_rect(void* p, int x, int y, int w, int h);
|
||||
VQT6_API void vqt6_qpainter_fill_rect(void* p, int x, int y, int w, int h, void* color);
|
||||
VQT6_API void vqt6_qpainter_draw_ellipse(void* p, int x, int y, int w, int h);
|
||||
VQT6_API void vqt6_qpainter_draw_arc(void* p, int x, int y, int w, int h, int start_angle, int span_angle);
|
||||
VQT6_API void vqt6_qpainter_draw_chord(void* p, int x, int y, int w, int h, int start_angle, int span_angle);
|
||||
VQT6_API void vqt6_qpainter_draw_pie(void* p, int x, int y, int w, int h, int start_angle, int span_angle);
|
||||
VQT6_API void vqt6_qpainter_draw_polygon(void* p, int* points, int point_count);
|
||||
VQT6_API void vqt6_qpainter_draw_polyline(void* p, int* points, int point_count);
|
||||
VQT6_API void vqt6_qpainter_draw_point(void* p, int x, int y);
|
||||
VQT6_API void vqt6_qpainter_draw_points(void* p, int* points, int point_count);
|
||||
VQT6_API void vqt6_qpainter_draw_text(void* p, int x, int y, void* text);
|
||||
VQT6_API void vqt6_qpainter_draw_text_in_rect(void* p, int x, int y, int w, int h, int flags, void* text);
|
||||
VQT6_API void vqt6_qpainter_draw_pixmap(void* p, int x, int y, void* pixmap);
|
||||
VQT6_API void vqt6_qpainter_draw_image(void* p, int x, int y, void* image);
|
||||
VQT6_API void vqt6_qpainter_draw_tiled_pixmap(void* p, int x, int y, int w, int h, void* pixmap);
|
||||
VQT6_API void vqt6_qpainter_translate(void* p, int dx, int dy);
|
||||
VQT6_API void vqt6_qpainter_rotate(void* p, double angle);
|
||||
VQT6_API void vqt6_qpainter_scale(void* p, double sx, double sy);
|
||||
VQT6_API void vqt6_qpainter_reset_transform(void* p);
|
||||
VQT6_API void vqt6_qpainter_save(void* p);
|
||||
VQT6_API void vqt6_qpainter_restore(void* p);
|
||||
VQT6_API void vqt6_qpainter_free(void* p);
|
||||
|
||||
// ============================================================
|
||||
// QPen
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qpen_create(void);
|
||||
VQT6_API void* vqt6_qpen_create_with_color(void* color);
|
||||
VQT6_API void* vqt6_qpen_create_with_color_width(void* color, int width);
|
||||
VQT6_API void vqt6_qpen_set_color(void* pen, void* color);
|
||||
VQT6_API void* vqt6_qpen_color(void* pen);
|
||||
VQT6_API void vqt6_qpen_set_width(void* pen, int width);
|
||||
VQT6_API int vqt6_qpen_width(void* pen);
|
||||
VQT6_API void vqt6_qpen_set_style(void* pen, int style);
|
||||
VQT6_API int vqt6_qpen_style(void* pen);
|
||||
VQT6_API void vqt6_qpen_free(void* pen);
|
||||
|
||||
// ============================================================
|
||||
// QBrush
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qbrush_create(void);
|
||||
VQT6_API void* vqt6_qbrush_create_with_color(void* color);
|
||||
VQT6_API void* vqt6_qbrush_create_with_style(int style);
|
||||
VQT6_API void vqt6_qbrush_set_color(void* brush, void* color);
|
||||
VQT6_API void* vqt6_qbrush_color(void* brush);
|
||||
VQT6_API void vqt6_qbrush_set_style(void* brush, int style);
|
||||
VQT6_API int vqt6_qbrush_style(void* brush);
|
||||
VQT6_API void vqt6_qbrush_free(void* brush);
|
||||
|
||||
// ============================================================
|
||||
// QIcon
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qicon_create(void);
|
||||
VQT6_API void* vqt6_qicon_create_with_file(void* file_name);
|
||||
VQT6_API void vqt6_qicon_add_file(void* icon, void* file_name);
|
||||
VQT6_API void vqt6_qicon_add_pixmap(void* icon, void* pixmap);
|
||||
VQT6_API int vqt6_qicon_is_null(void* icon);
|
||||
VQT6_API void* vqt6_qicon_pixmap(void* icon, int w, int h);
|
||||
VQT6_API void vqt6_qicon_free(void* icon);
|
||||
|
||||
// ============================================================
|
||||
// QCursor
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qcursor_create(void);
|
||||
VQT6_API void* vqt6_qcursor_create_with_shape(int shape);
|
||||
VQT6_API void vqt6_qcursor_pos(int* x, int* y);
|
||||
VQT6_API void vqt6_qcursor_set_pos(int x, int y);
|
||||
VQT6_API void vqt6_qcursor_set_shape(void* cursor, int shape);
|
||||
VQT6_API int vqt6_qcursor_shape(void* cursor);
|
||||
VQT6_API void vqt6_qcursor_free(void* cursor);
|
||||
|
||||
// ============================================================
|
||||
// QKeyEvent
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qkeyevent_create(int type, int key, int modifiers, void* text);
|
||||
VQT6_API int vqt6_qkeyevent_key(void* event);
|
||||
VQT6_API void* vqt6_qkeyevent_text(void* event);
|
||||
VQT6_API int vqt6_qkeyevent_modifiers(void* event);
|
||||
VQT6_API int vqt6_qkeyevent_is_auto_repeat(void* event);
|
||||
VQT6_API void vqt6_qkeyevent_free(void* event);
|
||||
|
||||
// ============================================================
|
||||
// QMouseEvent
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qmouseevent_create(int type, void* local_pos, int button, int buttons, int modifiers);
|
||||
VQT6_API int vqt6_qmouseevent_button(void* event);
|
||||
VQT6_API int vqt6_qmouseevent_buttons(void* event);
|
||||
VQT6_API int vqt6_qmouseevent_x(void* event);
|
||||
VQT6_API int vqt6_qmouseevent_y(void* event);
|
||||
VQT6_API int vqt6_qmouseevent_global_x(void* event);
|
||||
VQT6_API int vqt6_qmouseevent_global_y(void* event);
|
||||
VQT6_API int vqt6_qmouseevent_modifiers(void* event);
|
||||
VQT6_API void vqt6_qmouseevent_free(void* event);
|
||||
|
||||
// ============================================================
|
||||
// QResizeEvent / QPaintEvent / QCloseEvent
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qresizeevent_create(int width, int height, int old_width, int old_height);
|
||||
VQT6_API void vqt6_qresizeevent_size(void* event, int* w, int* h);
|
||||
VQT6_API void vqt6_qresizeevent_old_size(void* event, int* w, int* h);
|
||||
VQT6_API void vqt6_qresizeevent_free(void* event);
|
||||
|
||||
VQT6_API void* vqt6_qpaintevent_create(int rect_x, int rect_y, int rect_w, int rect_h);
|
||||
VQT6_API void vqt6_qpaintevent_rect(void* event, int* x, int* y, int* w, int* h);
|
||||
VQT6_API void vqt6_qpaintevent_free(void* event);
|
||||
|
||||
VQT6_API void* vqt6_qcloseevent_create(void);
|
||||
VQT6_API int vqt6_qcloseevent_is_accepted(void* event);
|
||||
VQT6_API void vqt6_qcloseevent_accept(void* event);
|
||||
VQT6_API void vqt6_qcloseevent_ignore(void* event);
|
||||
VQT6_API void vqt6_qcloseevent_free(void* event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // VQT6_BRIDGE_GUI_H
|
||||
519
includes/vqt6/_bridge_network.cpp
Normal file
519
includes/vqt6/_bridge_network.cpp
Normal file
@@ -0,0 +1,519 @@
|
||||
// ============================================================
|
||||
// vqt6/_bridge_network.cpp — QtNetwork C 桥接层实现
|
||||
// ============================================================
|
||||
|
||||
#include "_bridge.h"
|
||||
#include "_bridge_network.h"
|
||||
#include <QHostAddress>
|
||||
#include <QAbstractSocket>
|
||||
#include <QTcpSocket>
|
||||
#include <QUdpSocket>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QHttpHeaders>
|
||||
#include <QHttp2Configuration>
|
||||
#include <QNetworkCookieJar>
|
||||
|
||||
// ============================================================
|
||||
// QHostAddress
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_create(void) {
|
||||
return new QHostAddress();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_create_with_ipv4(uint32_t ipv4) {
|
||||
return new QHostAddress(static_cast<quint32>(ipv4));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_create_with_string(void* address) {
|
||||
if (address == nullptr) return new QHostAddress();
|
||||
return new QHostAddress(*static_cast<QString*>(address));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_create_with_local_host(void) {
|
||||
return new QHostAddress(QHostAddress::LocalHost);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_create_with_local_ipv4(void) {
|
||||
return new QHostAddress(QHostAddress::LocalHostIPv4);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_create_with_broadcast(void) {
|
||||
return new QHostAddress(QHostAddress::Broadcast);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_create_with_any_ipv4(void) {
|
||||
return new QHostAddress(QHostAddress::AnyIPv4);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qhostaddress_to_string(void* addr) {
|
||||
if (addr == nullptr) return nullptr;
|
||||
return new QString(static_cast<QHostAddress*>(addr)->toString());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API uint32_t vqt6_qhostaddress_to_ipv4(void* addr) {
|
||||
if (addr == nullptr) return 0;
|
||||
return static_cast<uint32_t>(static_cast<QHostAddress*>(addr)->toIPv4Address());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qhostaddress_is_null(void* addr) {
|
||||
if (addr == nullptr) return 0;
|
||||
return static_cast<QHostAddress*>(addr)->isNull() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qhostaddress_is_loopback(void* addr) {
|
||||
if (addr == nullptr) return 0;
|
||||
return static_cast<QHostAddress*>(addr)->isLoopback() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qhostaddress_is_broadcast(void* addr) {
|
||||
if (addr == nullptr) return 0;
|
||||
return static_cast<QHostAddress*>(addr)->isBroadcast() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qhostaddress_protocol(void* addr) {
|
||||
if (addr == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QHostAddress*>(addr)->protocol());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qhostaddress_free(void* addr) {
|
||||
delete static_cast<QHostAddress*>(addr);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QAbstractSocket
|
||||
// ============================================================
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_state(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QAbstractSocket*>(socket)->state());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_error(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QAbstractSocket*>(socket)->error());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qabstractsocket_error_string(void* socket) {
|
||||
if (socket == nullptr) return nullptr;
|
||||
return new QString(static_cast<QAbstractSocket*>(socket)->errorString());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qabstractsocket_connect_to_host(void* socket, void* host_name, uint16_t port) {
|
||||
if (socket == nullptr || host_name == nullptr) return;
|
||||
static_cast<QAbstractSocket*>(socket)->connectToHost(*static_cast<QString*>(host_name), port);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qabstractsocket_connect_to_host_with_addr(void* socket, void* address, uint16_t port) {
|
||||
if (socket == nullptr || address == nullptr) return;
|
||||
static_cast<QAbstractSocket*>(socket)->connectToHost(*static_cast<QHostAddress*>(address), port);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qabstractsocket_disconnect_from_host(void* socket) {
|
||||
if (socket == nullptr) return;
|
||||
static_cast<QAbstractSocket*>(socket)->disconnectFromHost();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_wait_for_connected(void* socket, int timeout_ms) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QAbstractSocket*>(socket)->waitForConnected(timeout_ms) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_wait_for_ready_read(void* socket, int timeout_ms) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QAbstractSocket*>(socket)->waitForReadyRead(timeout_ms) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_wait_for_bytes_written(void* socket, int timeout_ms) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QAbstractSocket*>(socket)->waitForBytesWritten(timeout_ms) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_wait_for_disconnected(void* socket, int timeout_ms) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QAbstractSocket*>(socket)->waitForDisconnected(timeout_ms) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_is_valid(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QAbstractSocket*>(socket)->isValid() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_is_open(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QAbstractSocket*>(socket)->isOpen() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qabstractsocket_flush(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QAbstractSocket*>(socket)->flush() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qabstractsocket_close(void* socket) {
|
||||
if (socket == nullptr) return;
|
||||
static_cast<QAbstractSocket*>(socket)->close();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qabstractsocket_abort(void* socket) {
|
||||
if (socket == nullptr) return;
|
||||
static_cast<QAbstractSocket*>(socket)->abort();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qabstractsocket_read(void* socket, void* buf, size_t max_size) {
|
||||
if (socket == nullptr || buf == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QAbstractSocket*>(socket)->read(static_cast<char*>(buf), static_cast<qint64>(max_size)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qabstractsocket_read_all(void* socket, size_t* out_size) {
|
||||
if (socket == nullptr) return nullptr;
|
||||
QByteArray ba = static_cast<QAbstractSocket*>(socket)->readAll();
|
||||
if (out_size != nullptr) *out_size = static_cast<size_t>(ba.size());
|
||||
return ba.data();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qabstractsocket_write(void* socket, const void* data, size_t size) {
|
||||
if (socket == nullptr || data == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QAbstractSocket*>(socket)->write(static_cast<const char*>(data), static_cast<qint64>(size)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qabstractsocket_bytes_available(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QAbstractSocket*>(socket)->bytesAvailable());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qabstractsocket_bytes_to_write(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QAbstractSocket*>(socket)->bytesToWrite());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qabstractsocket_peer_address(void* socket) {
|
||||
if (socket == nullptr) return nullptr;
|
||||
return new QHostAddress(static_cast<QAbstractSocket*>(socket)->peerAddress());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API uint16_t vqt6_qabstractsocket_peer_port(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<uint16_t>(static_cast<QAbstractSocket*>(socket)->peerPort());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qabstractsocket_local_address(void* socket) {
|
||||
if (socket == nullptr) return nullptr;
|
||||
return new QHostAddress(static_cast<QAbstractSocket*>(socket)->localAddress());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API uint16_t vqt6_qabstractsocket_local_port(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<uint16_t>(static_cast<QAbstractSocket*>(socket)->localPort());
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QTcpSocket
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qtcpsocket_create(void) {
|
||||
return new QTcpSocket();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qtcpsocket_create_with_parent(void* parent) {
|
||||
if (parent == nullptr) return nullptr;
|
||||
return new QTcpSocket(static_cast<QObject*>(parent));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtcpsocket_connect_to_host(void* socket, void* host_name, uint16_t port, int mode) {
|
||||
if (socket == nullptr || host_name == nullptr) return;
|
||||
static_cast<QTcpSocket*>(socket)->connectToHost(*static_cast<QString*>(host_name), port,
|
||||
static_cast<QIODevice::OpenMode>(mode));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtcpsocket_connect_to_host_with_addr(void* socket, void* address, uint16_t port, int mode) {
|
||||
if (socket == nullptr || address == nullptr) return;
|
||||
static_cast<QTcpSocket*>(socket)->connectToHost(*static_cast<QHostAddress*>(address), port,
|
||||
static_cast<QIODevice::OpenMode>(mode));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qtcpsocket_set_socket_descriptor(void* socket, intptr_t socket_descriptor) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QTcpSocket*>(socket)->setSocketDescriptor(static_cast<qintptr>(socket_descriptor)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API intptr_t vqt6_qtcpsocket_socket_descriptor(void* socket) {
|
||||
if (socket == nullptr) return -1;
|
||||
return static_cast<intptr_t>(static_cast<QTcpSocket*>(socket)->socketDescriptor());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtcpsocket_set_proxy(void* socket, int proxy_type) {
|
||||
Q_UNUSED(socket);
|
||||
Q_UNUSED(proxy_type);
|
||||
// QNetworkProxy 配置在更高层
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qtcpsocket_abort(void* socket) {
|
||||
if (socket == nullptr) return;
|
||||
static_cast<QTcpSocket*>(socket)->abort();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QUdpSocket
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qudpsocket_create(void) {
|
||||
return new QUdpSocket();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qudpsocket_create_with_parent(void* parent) {
|
||||
if (parent == nullptr) return nullptr;
|
||||
return new QUdpSocket(static_cast<QObject*>(parent));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qudpsocket_bind(void* socket, uint16_t port) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QUdpSocket*>(socket)->bind(port) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qudpsocket_bind_with_addr(void* socket, void* address, uint16_t port) {
|
||||
if (socket == nullptr || address == nullptr) return 0;
|
||||
return static_cast<QUdpSocket*>(socket)->bind(*static_cast<QHostAddress*>(address), port) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qudpsocket_close(void* socket) {
|
||||
if (socket == nullptr) return;
|
||||
static_cast<QUdpSocket*>(socket)->close();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qudpsocket_write_datagram(void* socket, const void* data, size_t size, void* host, uint16_t port) {
|
||||
if (socket == nullptr || data == nullptr || host == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QUdpSocket*>(socket)->writeDatagram(
|
||||
static_cast<const char*>(data), static_cast<qint64>(size),
|
||||
*static_cast<QHostAddress*>(host), port));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qudpsocket_read_datagram(void* socket, void* data, size_t max_size, void* host, uint16_t* port) {
|
||||
if (socket == nullptr || data == nullptr) return 0;
|
||||
QHostAddress sender;
|
||||
quint16 sender_port = 0;
|
||||
qint64 n = static_cast<QUdpSocket*>(socket)->readDatagram(
|
||||
static_cast<char*>(data), static_cast<qint64>(max_size), &sender, &sender_port);
|
||||
if (host != nullptr) {
|
||||
QHostAddress* dst = static_cast<QHostAddress*>(host);
|
||||
*dst = sender;
|
||||
}
|
||||
if (port != nullptr) {
|
||||
*port = sender_port;
|
||||
}
|
||||
return static_cast<size_t>(n);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qudpsocket_has_pending_datagrams(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<QUdpSocket*>(socket)->hasPendingDatagrams() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qudpsocket_pending_datagram_size(void* socket) {
|
||||
if (socket == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QUdpSocket*>(socket)->pendingDatagramSize());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qudpsocket_join_multicast_group(void* socket, void* group_address) {
|
||||
if (socket == nullptr || group_address == nullptr) return 0;
|
||||
return static_cast<QUdpSocket*>(socket)->joinMulticastGroup(*static_cast<QHostAddress*>(group_address)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qudpsocket_leave_multicast_group(void* socket, void* group_address) {
|
||||
if (socket == nullptr || group_address == nullptr) return 0;
|
||||
return static_cast<QUdpSocket*>(socket)->leaveMulticastGroup(*static_cast<QHostAddress*>(group_address)) ? 1 : 0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QNetworkRequest
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qnetworkrequest_create(void) {
|
||||
return new QNetworkRequest();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkrequest_create_with_url(void* url) {
|
||||
if (url == nullptr) return new QNetworkRequest();
|
||||
return new QNetworkRequest(QUrl(*static_cast<QString*>(url)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkrequest_set_url(void* req, void* url) {
|
||||
if (req == nullptr || url == nullptr) return;
|
||||
static_cast<QNetworkRequest*>(req)->setUrl(QUrl(*static_cast<QString*>(url)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkrequest_url(void* req) {
|
||||
if (req == nullptr) return nullptr;
|
||||
return new QString(static_cast<QNetworkRequest*>(req)->url().toString());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkrequest_set_header(void* req, int header_type, void* value) {
|
||||
if (req == nullptr || value == nullptr) return;
|
||||
static_cast<QNetworkRequest*>(req)->setHeader(static_cast<QNetworkRequest::KnownHeaders>(header_type),
|
||||
*static_cast<QVariant*>(value));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkrequest_header(void* req, int header_type) {
|
||||
if (req == nullptr) return nullptr;
|
||||
return new QVariant(static_cast<QNetworkRequest*>(req)->header(static_cast<QNetworkRequest::KnownHeaders>(header_type)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkrequest_set_raw_header(void* req, const char* header_name, const void* value, size_t value_size) {
|
||||
if (req == nullptr || header_name == nullptr) return;
|
||||
static_cast<QNetworkRequest*>(req)->setRawHeader(QByteArray(header_name),
|
||||
QByteArray(static_cast<const char*>(value), static_cast<int>(value_size)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkrequest_raw_header(void* req, const char* header_name, size_t* out_size) {
|
||||
if (req == nullptr || header_name == nullptr) return nullptr;
|
||||
QByteArray ba = static_cast<QNetworkRequest*>(req)->rawHeader(QByteArray(header_name));
|
||||
if (out_size != nullptr) *out_size = static_cast<size_t>(ba.size());
|
||||
return ba.data();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkrequest_set_attribute(void* req, int attr_type, void* value) {
|
||||
if (req == nullptr || value == nullptr) return;
|
||||
static_cast<QNetworkRequest*>(req)->setAttribute(static_cast<QNetworkRequest::Attribute>(attr_type),
|
||||
*static_cast<QVariant*>(value));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkrequest_attribute(void* req, int attr_type) {
|
||||
if (req == nullptr) return nullptr;
|
||||
return new QVariant(static_cast<QNetworkRequest*>(req)->attribute(static_cast<QNetworkRequest::Attribute>(attr_type)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkrequest_free(void* req) {
|
||||
delete static_cast<QNetworkRequest*>(req);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QNetworkAccessManager
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qnetworkaccessmanager_create(void) {
|
||||
return new QNetworkAccessManager();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkaccessmanager_create_with_parent(void* parent) {
|
||||
if (parent == nullptr) return nullptr;
|
||||
return new QNetworkAccessManager(static_cast<QObject*>(parent));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkaccessmanager_get(void* nam, void* req) {
|
||||
if (nam == nullptr || req == nullptr) return nullptr;
|
||||
return static_cast<QNetworkAccessManager*>(nam)->get(*static_cast<QNetworkRequest*>(req));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkaccessmanager_post(void* nam, void* req, const void* data, size_t size) {
|
||||
if (nam == nullptr || req == nullptr) return nullptr;
|
||||
QByteArray payload;
|
||||
if (data != nullptr && size > 0) {
|
||||
payload = QByteArray(static_cast<const char*>(data), static_cast<int>(size));
|
||||
}
|
||||
return static_cast<QNetworkAccessManager*>(nam)->post(*static_cast<QNetworkRequest*>(req), payload);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkaccessmanager_put(void* nam, void* req, const void* data, size_t size) {
|
||||
if (nam == nullptr || req == nullptr) return nullptr;
|
||||
QByteArray payload;
|
||||
if (data != nullptr && size > 0) {
|
||||
payload = QByteArray(static_cast<const char*>(data), static_cast<int>(size));
|
||||
}
|
||||
return static_cast<QNetworkAccessManager*>(nam)->put(*static_cast<QNetworkRequest*>(req), payload);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkaccessmanager_delete_resource(void* nam, void* req) {
|
||||
if (nam == nullptr || req == nullptr) return nullptr;
|
||||
return static_cast<QNetworkAccessManager*>(nam)->deleteResource(*static_cast<QNetworkRequest*>(req));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkaccessmanager_head(void* nam, void* req) {
|
||||
if (nam == nullptr || req == nullptr) return nullptr;
|
||||
return static_cast<QNetworkAccessManager*>(nam)->head(*static_cast<QNetworkRequest*>(req));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkaccessmanager_set_cookie_store(void* nam, void* store) {
|
||||
if (nam == nullptr || store == nullptr) return;
|
||||
QNetworkCookieJar* jar = qobject_cast<QNetworkCookieJar*>(static_cast<QObject*>(store));
|
||||
if (jar != nullptr) {
|
||||
static_cast<QNetworkAccessManager*>(nam)->setCookieJar(jar);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// QNetworkReply
|
||||
// ============================================================
|
||||
extern "C" VQT6_API void* vqt6_qnetworkreply_url(void* reply) {
|
||||
if (reply == nullptr) return nullptr;
|
||||
return new QString(static_cast<QNetworkReply*>(reply)->url().toString());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkreply_request(void* reply) {
|
||||
if (reply == nullptr) return nullptr;
|
||||
return new QNetworkRequest(static_cast<QNetworkReply*>(reply)->request());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qnetworkreply_error(void* reply) {
|
||||
if (reply == nullptr) return 0;
|
||||
return static_cast<int>(static_cast<QNetworkReply*>(reply)->error());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkreply_error_string(void* reply) {
|
||||
if (reply == nullptr) return nullptr;
|
||||
return new QString(static_cast<QNetworkReply*>(reply)->errorString());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qnetworkreply_is_finished(void* reply) {
|
||||
if (reply == nullptr) return 0;
|
||||
return static_cast<QNetworkReply*>(reply)->isFinished() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qnetworkreply_is_running(void* reply) {
|
||||
if (reply == nullptr) return 0;
|
||||
return static_cast<QNetworkReply*>(reply)->isRunning() ? 1 : 0;
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkreply_abort(void* reply) {
|
||||
if (reply == nullptr) return;
|
||||
static_cast<QNetworkReply*>(reply)->abort();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qnetworkreply_read(void* reply, void* buf, size_t max_size) {
|
||||
if (reply == nullptr || buf == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QNetworkReply*>(reply)->read(static_cast<char*>(buf), static_cast<qint64>(max_size)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkreply_read_all(void* reply, size_t* out_size) {
|
||||
if (reply == nullptr) return nullptr;
|
||||
QByteArray ba = static_cast<QNetworkReply*>(reply)->readAll();
|
||||
if (out_size != nullptr) *out_size = static_cast<size_t>(ba.size());
|
||||
return ba.data();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API size_t vqt6_qnetworkreply_bytes_available(void* reply) {
|
||||
if (reply == nullptr) return 0;
|
||||
return static_cast<size_t>(static_cast<QNetworkReply*>(reply)->bytesAvailable());
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkreply_header(void* reply, int header_type) {
|
||||
if (reply == nullptr) return nullptr;
|
||||
return new QVariant(static_cast<QNetworkReply*>(reply)->header(static_cast<QNetworkRequest::KnownHeaders>(header_type)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkreply_raw_header(void* reply, const char* header_name, size_t* out_size) {
|
||||
if (reply == nullptr || header_name == nullptr) return nullptr;
|
||||
QByteArray ba = static_cast<QNetworkReply*>(reply)->rawHeader(QByteArray(header_name));
|
||||
if (out_size != nullptr) *out_size = static_cast<size_t>(ba.size());
|
||||
return ba.data();
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void* vqt6_qnetworkreply_attribute(void* reply, int attribute_code) {
|
||||
if (reply == nullptr) return nullptr;
|
||||
return new QVariant(static_cast<QNetworkReply*>(reply)->attribute(static_cast<QNetworkRequest::Attribute>(attribute_code)));
|
||||
}
|
||||
|
||||
extern "C" VQT6_API int vqt6_qnetworkreply_attribute_int(void* reply, int attribute_code, int default_value) {
|
||||
if (reply == nullptr) return default_value;
|
||||
return static_cast<QNetworkReply*>(reply)->attribute(static_cast<QNetworkRequest::Attribute>(attribute_code)).toInt(default_value);
|
||||
}
|
||||
|
||||
extern "C" VQT6_API void vqt6_qnetworkreply_set_raw_header(void* reply, const char* header_name, const void* value, size_t value_size) {
|
||||
if (reply == nullptr || header_name == nullptr) return;
|
||||
static_cast<QNetworkReply*>(reply)->setRawHeader(QByteArray(header_name),
|
||||
QByteArray(static_cast<const char*>(value), static_cast<int>(value_size)));
|
||||
}
|
||||
137
includes/vqt6/_bridge_network.h
Normal file
137
includes/vqt6/_bridge_network.h
Normal file
@@ -0,0 +1,137 @@
|
||||
// ============================================================
|
||||
// vqt6/_bridge_network.h — QtNetwork C 桥接函数声明
|
||||
// ============================================================
|
||||
|
||||
#ifndef VQT6_BRIDGE_NETWORK_H
|
||||
#define VQT6_BRIDGE_NETWORK_H
|
||||
|
||||
#include "_bridge.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ============================================================
|
||||
// QHostAddress
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qhostaddress_create(void);
|
||||
VQT6_API void* vqt6_qhostaddress_create_with_ipv4(uint32_t ipv4);
|
||||
VQT6_API void* vqt6_qhostaddress_create_with_string(void* address);
|
||||
VQT6_API void* vqt6_qhostaddress_create_with_local_host(void);
|
||||
VQT6_API void* vqt6_qhostaddress_create_with_local_ipv4(void);
|
||||
VQT6_API void* vqt6_qhostaddress_create_with_broadcast(void);
|
||||
VQT6_API void* vqt6_qhostaddress_create_with_any_ipv4(void);
|
||||
VQT6_API void* vqt6_qhostaddress_to_string(void* addr);
|
||||
VQT6_API uint32_t vqt6_qhostaddress_to_ipv4(void* addr);
|
||||
VQT6_API int vqt6_qhostaddress_is_null(void* addr);
|
||||
VQT6_API int vqt6_qhostaddress_is_loopback(void* addr);
|
||||
VQT6_API int vqt6_qhostaddress_is_broadcast(void* addr);
|
||||
VQT6_API int vqt6_qhostaddress_protocol(void* addr);
|
||||
VQT6_API void vqt6_qhostaddress_free(void* addr);
|
||||
|
||||
// ============================================================
|
||||
// QAbstractSocket
|
||||
// ============================================================
|
||||
VQT6_API int vqt6_qabstractsocket_state(void* socket);
|
||||
VQT6_API int vqt6_qabstractsocket_error(void* socket);
|
||||
VQT6_API void* vqt6_qabstractsocket_error_string(void* socket);
|
||||
VQT6_API void vqt6_qabstractsocket_connect_to_host(void* socket, void* host_name, uint16_t port);
|
||||
VQT6_API void vqt6_qabstractsocket_connect_to_host_with_addr(void* socket, void* address, uint16_t port);
|
||||
VQT6_API void vqt6_qabstractsocket_disconnect_from_host(void* socket);
|
||||
VQT6_API int vqt6_qabstractsocket_wait_for_connected(void* socket, int timeout_ms);
|
||||
VQT6_API int vqt6_qabstractsocket_wait_for_ready_read(void* socket, int timeout_ms);
|
||||
VQT6_API int vqt6_qabstractsocket_wait_for_bytes_written(void* socket, int timeout_ms);
|
||||
VQT6_API int vqt6_qabstractsocket_wait_for_disconnected(void* socket, int timeout_ms);
|
||||
VQT6_API int vqt6_qabstractsocket_is_valid(void* socket);
|
||||
VQT6_API int vqt6_qabstractsocket_is_open(void* socket);
|
||||
VQT6_API int vqt6_qabstractsocket_flush(void* socket);
|
||||
VQT6_API void vqt6_qabstractsocket_close(void* socket);
|
||||
VQT6_API void vqt6_qabstractsocket_abort(void* socket);
|
||||
VQT6_API size_t vqt6_qabstractsocket_read(void* socket, void* buf, size_t max_size);
|
||||
VQT6_API void* vqt6_qabstractsocket_read_all(void* socket, size_t* out_size);
|
||||
VQT6_API size_t vqt6_qabstractsocket_write(void* socket, const void* data, size_t size);
|
||||
VQT6_API size_t vqt6_qabstractsocket_bytes_available(void* socket);
|
||||
VQT6_API size_t vqt6_qabstractsocket_bytes_to_write(void* socket);
|
||||
VQT6_API void* vqt6_qabstractsocket_peer_address(void* socket);
|
||||
VQT6_API uint16_t vqt6_qabstractsocket_peer_port(void* socket);
|
||||
VQT6_API void* vqt6_qabstractsocket_local_address(void* socket);
|
||||
VQT6_API uint16_t vqt6_qabstractsocket_local_port(void* socket);
|
||||
|
||||
// ============================================================
|
||||
// QTcpSocket
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qtcpsocket_create(void);
|
||||
VQT6_API void* vqt6_qtcpsocket_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qtcpsocket_connect_to_host(void* socket, void* host_name, uint16_t port, int mode);
|
||||
VQT6_API void vqt6_qtcpsocket_connect_to_host_with_addr(void* socket, void* address, uint16_t port, int mode);
|
||||
VQT6_API int vqt6_qtcpsocket_set_socket_descriptor(void* socket, intptr_t socket_descriptor);
|
||||
VQT6_API intptr_t vqt6_qtcpsocket_socket_descriptor(void* socket);
|
||||
VQT6_API void vqt6_qtcpsocket_set_proxy(void* socket, int proxy_type);
|
||||
VQT6_API void vqt6_qtcpsocket_abort(void* socket);
|
||||
|
||||
// ============================================================
|
||||
// QUdpSocket
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qudpsocket_create(void);
|
||||
VQT6_API void* vqt6_qudpsocket_create_with_parent(void* parent);
|
||||
VQT6_API int vqt6_qudpsocket_bind(void* socket, uint16_t port);
|
||||
VQT6_API int vqt6_qudpsocket_bind_with_addr(void* socket, void* address, uint16_t port);
|
||||
VQT6_API void vqt6_qudpsocket_close(void* socket);
|
||||
VQT6_API size_t vqt6_qudpsocket_write_datagram(void* socket, const void* data, size_t size, void* host, uint16_t port);
|
||||
VQT6_API size_t vqt6_qudpsocket_read_datagram(void* socket, void* data, size_t max_size, void* host, uint16_t* port);
|
||||
VQT6_API int vqt6_qudpsocket_has_pending_datagrams(void* socket);
|
||||
VQT6_API size_t vqt6_qudpsocket_pending_datagram_size(void* socket);
|
||||
VQT6_API int vqt6_qudpsocket_join_multicast_group(void* socket, void* group_address);
|
||||
VQT6_API int vqt6_qudpsocket_leave_multicast_group(void* socket, void* group_address);
|
||||
|
||||
// ============================================================
|
||||
// QNetworkRequest
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qnetworkrequest_create(void);
|
||||
VQT6_API void* vqt6_qnetworkrequest_create_with_url(void* url);
|
||||
VQT6_API void vqt6_qnetworkrequest_set_url(void* req, void* url);
|
||||
VQT6_API void* vqt6_qnetworkrequest_url(void* req);
|
||||
VQT6_API void vqt6_qnetworkrequest_set_header(void* req, int header_type, void* value);
|
||||
VQT6_API void* vqt6_qnetworkrequest_header(void* req, int header_type);
|
||||
VQT6_API void vqt6_qnetworkrequest_set_raw_header(void* req, const char* header_name, const void* value, size_t value_size);
|
||||
VQT6_API void* vqt6_qnetworkrequest_raw_header(void* req, const char* header_name, size_t* out_size);
|
||||
VQT6_API void vqt6_qnetworkrequest_set_attribute(void* req, int attr_type, void* value);
|
||||
VQT6_API void* vqt6_qnetworkrequest_attribute(void* req, int attr_type);
|
||||
VQT6_API void vqt6_qnetworkrequest_free(void* req);
|
||||
|
||||
// ============================================================
|
||||
// QNetworkAccessManager
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qnetworkaccessmanager_create(void);
|
||||
VQT6_API void* vqt6_qnetworkaccessmanager_create_with_parent(void* parent);
|
||||
VQT6_API void* vqt6_qnetworkaccessmanager_get(void* nam, void* req);
|
||||
VQT6_API void* vqt6_qnetworkaccessmanager_post(void* nam, void* req, const void* data, size_t size);
|
||||
VQT6_API void* vqt6_qnetworkaccessmanager_put(void* nam, void* req, const void* data, size_t size);
|
||||
VQT6_API void* vqt6_qnetworkaccessmanager_delete_resource(void* nam, void* req);
|
||||
VQT6_API void* vqt6_qnetworkaccessmanager_head(void* nam, void* req);
|
||||
VQT6_API void vqt6_qnetworkaccessmanager_set_cookie_store(void* nam, void* store);
|
||||
|
||||
// ============================================================
|
||||
// QNetworkReply
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qnetworkreply_url(void* reply);
|
||||
VQT6_API void* vqt6_qnetworkreply_request(void* reply);
|
||||
VQT6_API int vqt6_qnetworkreply_error(void* reply);
|
||||
VQT6_API void* vqt6_qnetworkreply_error_string(void* reply);
|
||||
VQT6_API int vqt6_qnetworkreply_is_finished(void* reply);
|
||||
VQT6_API int vqt6_qnetworkreply_is_running(void* reply);
|
||||
VQT6_API void vqt6_qnetworkreply_abort(void* reply);
|
||||
VQT6_API size_t vqt6_qnetworkreply_read(void* reply, void* buf, size_t max_size);
|
||||
VQT6_API void* vqt6_qnetworkreply_read_all(void* reply, size_t* out_size);
|
||||
VQT6_API size_t vqt6_qnetworkreply_bytes_available(void* reply);
|
||||
VQT6_API void* vqt6_qnetworkreply_header(void* reply, int header_type);
|
||||
VQT6_API void* vqt6_qnetworkreply_raw_header(void* reply, const char* header_name, size_t* out_size);
|
||||
VQT6_API void* vqt6_qnetworkreply_attribute(void* reply, int attribute_code);
|
||||
VQT6_API int vqt6_qnetworkreply_attribute_int(void* reply, int attribute_code, int default_value);
|
||||
VQT6_API void vqt6_qnetworkreply_set_raw_header(void* reply, const char* header_name, const void* value, size_t value_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // VQT6_BRIDGE_NETWORK_H
|
||||
1745
includes/vqt6/_bridge_widgets.cpp
Normal file
1745
includes/vqt6/_bridge_widgets.cpp
Normal file
File diff suppressed because it is too large
Load Diff
432
includes/vqt6/_bridge_widgets.h
Normal file
432
includes/vqt6/_bridge_widgets.h
Normal file
@@ -0,0 +1,432 @@
|
||||
// ============================================================
|
||||
// vqt6/_bridge_widgets.h — QtWidgets C 桥接函数声明
|
||||
// ============================================================
|
||||
|
||||
#ifndef VQT6_BRIDGE_WIDGETS_H
|
||||
#define VQT6_BRIDGE_WIDGETS_H
|
||||
|
||||
#include "_bridge.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ============================================================
|
||||
// QApplication
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qapplication_create(int argc, char** argv);
|
||||
VQT6_API void* vqt6_qapplication_instance(void);
|
||||
VQT6_API int vqt6_qapplication_exec(void* app);
|
||||
VQT6_API void vqt6_qapplication_quit(void* app);
|
||||
VQT6_API void vqt6_qapplication_exit(void* app, int exit_code);
|
||||
VQT6_API void vqt6_qapplication_process_events(void* app);
|
||||
VQT6_API int vqt6_qapplication_desktop_width(void* app);
|
||||
VQT6_API int vqt6_qapplication_desktop_height(void* app);
|
||||
VQT6_API void vqt6_qapplication_set_quit_on_last_window_closed(void* app, int quit);
|
||||
VQT6_API int vqt6_qapplication_quit_on_last_window_closed(void* app);
|
||||
|
||||
// ============================================================
|
||||
// QWidget
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qwidget_create(void);
|
||||
VQT6_API void* vqt6_qwidget_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qwidget_show(void* widget);
|
||||
VQT6_API void vqt6_qwidget_hide(void* widget);
|
||||
VQT6_API int vqt6_qwidget_close(void* widget);
|
||||
VQT6_API int vqt6_qwidget_is_visible(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_visible(void* widget, int visible);
|
||||
VQT6_API void vqt6_qwidget_set_geometry(void* widget, int x, int y, int w, int h);
|
||||
VQT6_API void vqt6_qwidget_geometry(void* widget, int* x, int* y, int* w, int* h);
|
||||
VQT6_API void vqt6_qwidget_resize(void* widget, int w, int h);
|
||||
VQT6_API void vqt6_qwidget_size(void* widget, int* w, int* h);
|
||||
VQT6_API void vqt6_qwidget_move(void* widget, int x, int y);
|
||||
VQT6_API void vqt6_qwidget_pos(void* widget, int* x, int* y);
|
||||
VQT6_API int vqt6_qwidget_width(void* widget);
|
||||
VQT6_API int vqt6_qwidget_height(void* widget);
|
||||
VQT6_API int vqt6_qwidget_x(void* widget);
|
||||
VQT6_API int vqt6_qwidget_y(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_window_title(void* widget, void* title);
|
||||
VQT6_API void* vqt6_qwidget_window_title(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_text(void* widget, void* text);
|
||||
VQT6_API void* vqt6_qwidget_text(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_enabled(void* widget, int enabled);
|
||||
VQT6_API int vqt6_qwidget_is_enabled(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_parent(void* widget, void* parent);
|
||||
VQT6_API void* vqt6_qwidget_parent_widget(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_focus(void* widget);
|
||||
VQT6_API void vqt6_qwidget_clear_focus(void* widget);
|
||||
VQT6_API int vqt6_qwidget_has_focus(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_focus_policy(void* widget, int policy);
|
||||
VQT6_API void vqt6_qwidget_update(void* widget);
|
||||
VQT6_API void vqt6_qwidget_repaint(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_update_enabled(void* widget, int enabled);
|
||||
VQT6_API void vqt6_qwidget_set_window_flags(void* widget, int flags);
|
||||
VQT6_API int vqt6_qwidget_window_flags(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_cursor(void* widget, void* cursor);
|
||||
VQT6_API void* vqt6_qwidget_cursor(void* widget);
|
||||
VQT6_API void vqt6_qwidget_unset_cursor(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_tool_tip(void* widget, void* tip);
|
||||
VQT6_API void* vqt6_qwidget_tool_tip(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_status_tip(void* widget, void* tip);
|
||||
VQT6_API void* vqt6_qwidget_status_tip(void* widget);
|
||||
VQT6_API void vqt6_qwidget_set_minimum_size(void* widget, int w, int h);
|
||||
VQT6_API void vqt6_qwidget_set_maximum_size(void* widget, int w, int h);
|
||||
VQT6_API void vqt6_qwidget_set_fixed_size(void* widget, int w, int h);
|
||||
VQT6_API void vqt6_qwidget_minimum_size(void* widget, int* w, int* h);
|
||||
VQT6_API void vqt6_qwidget_maximum_size(void* widget, int* w, int* h);
|
||||
|
||||
// ============================================================
|
||||
// QDialog
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qdialog_create(void);
|
||||
VQT6_API void* vqt6_qdialog_create_with_parent(void* parent);
|
||||
VQT6_API int vqt6_qdialog_exec(void* dialog);
|
||||
VQT6_API void vqt6_qdialog_done(void* dialog, int result);
|
||||
VQT6_API void vqt6_qdialog_accept(void* dialog);
|
||||
VQT6_API void vqt6_qdialog_reject(void* dialog);
|
||||
VQT6_API void vqt6_qdialog_set_result(void* dialog, int result);
|
||||
VQT6_API int vqt6_qdialog_result(void* dialog);
|
||||
VQT6_API void vqt6_qdialog_set_modal(void* dialog, int modal);
|
||||
VQT6_API int vqt6_qdialog_is_modal(void* dialog);
|
||||
|
||||
// ============================================================
|
||||
// QMainWindow
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qmainwindow_create(void);
|
||||
VQT6_API void* vqt6_qmainwindow_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qmainwindow_set_central_widget(void* mw, void* widget);
|
||||
VQT6_API void* vqt6_qmainwindow_central_widget(void* mw);
|
||||
VQT6_API void* vqt6_qmainwindow_menu_bar(void* mw);
|
||||
VQT6_API void vqt6_qmainwindow_set_menu_bar(void* mw, void* menubar);
|
||||
VQT6_API void* vqt6_qmainwindow_status_bar(void* mw);
|
||||
VQT6_API void vqt6_qmainwindow_set_status_bar(void* mw, void* statusbar);
|
||||
VQT6_API void vqt6_qmainwindow_add_tool_bar(void* mw, void* toolbar);
|
||||
VQT6_API void vqt6_qmainwindow_add_tool_bar_break(void* mw);
|
||||
|
||||
// ============================================================
|
||||
// QLabel
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qlabel_create(void);
|
||||
VQT6_API void* vqt6_qlabel_create_with_text(void* text);
|
||||
VQT6_API void* vqt6_qlabel_create_with_text_parent(void* text, void* parent);
|
||||
VQT6_API void vqt6_qlabel_set_text(void* label, void* text);
|
||||
VQT6_API void* vqt6_qlabel_text(void* label);
|
||||
VQT6_API void vqt6_qlabel_set_alignment(void* label, int alignment);
|
||||
VQT6_API int vqt6_qlabel_alignment(void* label);
|
||||
VQT6_API void vqt6_qlabel_set_pixmap(void* label, void* pixmap);
|
||||
VQT6_API void* vqt6_qlabel_pixmap(void* label);
|
||||
VQT6_API void vqt6_qlabel_set_indent(void* label, int indent);
|
||||
VQT6_API void vqt6_qlabel_set_margin(void* label, int margin);
|
||||
VQT6_API void vqt6_qlabel_set_word_wrap(void* label, int wrap);
|
||||
VQT6_API int vqt6_qlabel_word_wrap(void* label);
|
||||
|
||||
// ============================================================
|
||||
// QPushButton
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qpushbutton_create(void);
|
||||
VQT6_API void* vqt6_qpushbutton_create_with_text(void* text);
|
||||
VQT6_API void* vqt6_qpushbutton_create_with_text_parent(void* text, void* parent);
|
||||
VQT6_API void vqt6_qpushbutton_set_text(void* btn, void* text);
|
||||
VQT6_API void* vqt6_qpushbutton_text(void* btn);
|
||||
VQT6_API void vqt6_qpushbutton_set_icon(void* btn, void* icon);
|
||||
VQT6_API void* vqt6_qpushbutton_icon(void* btn);
|
||||
VQT6_API void vqt6_qpushbutton_set_default(void* btn, int is_default);
|
||||
VQT6_API int vqt6_qpushbutton_is_default(void* btn);
|
||||
VQT6_API void vqt6_qpushbutton_set_flat(void* btn, int flat);
|
||||
VQT6_API int vqt6_qpushbutton_is_flat(void* btn);
|
||||
VQT6_API void vqt6_qpushbutton_set_checkable(void* btn, int checkable);
|
||||
VQT6_API int vqt6_qpushbutton_is_checkable(void* btn);
|
||||
VQT6_API void vqt6_qpushbutton_set_checked(void* btn, int checked);
|
||||
VQT6_API int vqt6_qpushbutton_is_checked(void* btn);
|
||||
VQT6_API void vqt6_qpushbutton_click(void* btn);
|
||||
|
||||
// ============================================================
|
||||
// QLineEdit
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qlineedit_create(void);
|
||||
VQT6_API void* vqt6_qlineedit_create_with_text(void* text);
|
||||
VQT6_API void* vqt6_qlineedit_create_with_text_parent(void* text, void* parent);
|
||||
VQT6_API void* vqt6_qlineedit_text(void* le);
|
||||
VQT6_API void vqt6_qlineedit_set_text(void* le, void* text);
|
||||
VQT6_API void* vqt6_qlineedit_placeholder_text(void* le);
|
||||
VQT6_API void vqt6_qlineedit_set_placeholder_text(void* le, void* text);
|
||||
VQT6_API void vqt6_qlineedit_set_max_length(void* le, int max);
|
||||
VQT6_API int vqt6_qlineedit_max_length(void* le);
|
||||
VQT6_API void vqt6_qlineedit_set_read_only(void* le, int ro);
|
||||
VQT6_API int vqt6_qlineedit_is_read_only(void* le);
|
||||
VQT6_API void vqt6_qlineedit_set_echo_mode(void* le, int mode);
|
||||
VQT6_API int vqt6_qlineedit_echo_mode(void* le);
|
||||
VQT6_API void vqt6_qlineedit_select_all(void* le);
|
||||
VQT6_API void vqt6_qlineedit_clear(void* le);
|
||||
|
||||
// ============================================================
|
||||
// QTextEdit / QPlainTextEdit
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qtextedit_create(void);
|
||||
VQT6_API void* vqt6_qtextedit_create_with_parent(void* parent);
|
||||
VQT6_API void* vqt6_qtextedit_to_plain_text(void* te);
|
||||
VQT6_API void vqt6_qtextedit_set_plain_text(void* te, void* text);
|
||||
VQT6_API void vqt6_qtextedit_set_html(void* te, void* html);
|
||||
VQT6_API void* vqt6_qtextedit_to_html(void* te);
|
||||
VQT6_API void vqt6_qtextedit_append(void* te, void* text);
|
||||
VQT6_API void vqt6_qtextedit_clear(void* te);
|
||||
VQT6_API void vqt6_qtextedit_set_read_only(void* te, int ro);
|
||||
VQT6_API int vqt6_qtextedit_is_read_only(void* te);
|
||||
|
||||
VQT6_API void* vqt6_qplaintextedit_create(void);
|
||||
VQT6_API void* vqt6_qplaintextedit_create_with_parent(void* parent);
|
||||
VQT6_API void* vqt6_qplaintextedit_to_plain_text(void* pte);
|
||||
VQT6_API void vqt6_qplaintextedit_set_plain_text(void* pte, void* text);
|
||||
VQT6_API void vqt6_qplaintextedit_append(void* pte, void* text);
|
||||
VQT6_API void vqt6_qplaintextedit_clear(void* pte);
|
||||
VQT6_API void vqt6_qplaintextedit_set_read_only(void* pte, int ro);
|
||||
VQT6_API int vqt6_qplaintextedit_line_count(void* pte);
|
||||
|
||||
// ============================================================
|
||||
// QCheckBox / QRadioButton
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qcheckbox_create(void);
|
||||
VQT6_API void* vqt6_qcheckbox_create_with_text(void* text);
|
||||
VQT6_API void* vqt6_qcheckbox_create_with_text_parent(void* text, void* parent);
|
||||
VQT6_API void vqt6_qcheckbox_set_checked(void* cb, int checked);
|
||||
VQT6_API int vqt6_qcheckbox_is_checked(void* cb);
|
||||
VQT6_API void vqt6_qcheckbox_set_text(void* cb, void* text);
|
||||
VQT6_API void* vqt6_qcheckbox_text(void* cb);
|
||||
VQT6_API void vqt6_qcheckbox_set_tristate(void* cb, int tristate);
|
||||
VQT6_API int vqt6_qcheckbox_is_tristate(void* cb);
|
||||
|
||||
VQT6_API void* vqt6_qradiobutton_create(void);
|
||||
VQT6_API void* vqt6_qradiobutton_create_with_text(void* text);
|
||||
VQT6_API void* vqt6_qradiobutton_create_with_text_parent(void* text, void* parent);
|
||||
VQT6_API void vqt6_qradiobutton_set_checked(void* rb, int checked);
|
||||
VQT6_API int vqt6_qradiobutton_is_checked(void* rb);
|
||||
VQT6_API void vqt6_qradiobutton_set_text(void* rb, void* text);
|
||||
VQT6_API void* vqt6_qradiobutton_text(void* rb);
|
||||
|
||||
// ============================================================
|
||||
// QComboBox
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qcombobox_create(void);
|
||||
VQT6_API void* vqt6_qcombobox_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qcombobox_add_item(void* cb, void* text);
|
||||
VQT6_API void vqt6_qcombobox_add_items(void* cb, void* items);
|
||||
VQT6_API void vqt6_qcombobox_insert_item(void* cb, int index, void* text);
|
||||
VQT6_API void vqt6_qcombobox_remove_item(void* cb, int index);
|
||||
VQT6_API void vqt6_qcombobox_clear(void* cb);
|
||||
VQT6_API int vqt6_qcombobox_count(void* cb);
|
||||
VQT6_API int vqt6_qcombobox_current_index(void* cb);
|
||||
VQT6_API void vqt6_qcombobox_set_current_index(void* cb, int index);
|
||||
VQT6_API void* vqt6_qcombobox_current_text(void* cb);
|
||||
VQT6_API void* vqt6_qcombobox_item_text(void* cb, int index);
|
||||
VQT6_API void vqt6_qcombobox_set_editable(void* cb, int editable);
|
||||
VQT6_API int vqt6_qcombobox_is_editable(void* cb);
|
||||
|
||||
// ============================================================
|
||||
// QListWidget
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qlistwidget_create(void);
|
||||
VQT6_API void* vqt6_qlistwidget_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qlistwidget_add_item(void* lw, void* text);
|
||||
VQT6_API void vqt6_qlistwidget_add_items(void* lw, void* items);
|
||||
VQT6_API void vqt6_qlistwidget_insert_item(void* lw, int row, void* text);
|
||||
VQT6_API void vqt6_qlistwidget_remove_item_widget(void* lw, int row);
|
||||
VQT6_API void* vqt6_qlistwidget_take_item(void* lw, int row);
|
||||
VQT6_API void vqt6_qlistwidget_clear(void* lw);
|
||||
VQT6_API int vqt6_qlistwidget_count(void* lw);
|
||||
VQT6_API int vqt6_qlistwidget_current_row(void* lw);
|
||||
VQT6_API void vqt6_qlistwidget_set_current_row(void* lw, int row);
|
||||
VQT6_API void* vqt6_qlistwidget_current_item_text(void* lw);
|
||||
VQT6_API void* vqt6_qlistwidget_item_text(void* lw, int row);
|
||||
VQT6_API void vqt6_qlistwidget_set_item_text(void* lw, int row, void* text);
|
||||
|
||||
// ============================================================
|
||||
// QProgressBar
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qprogressbar_create(void);
|
||||
VQT6_API void* vqt6_qprogressbar_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qprogressbar_set_value(void* pb, int value);
|
||||
VQT6_API int vqt6_qprogressbar_value(void* pb);
|
||||
VQT6_API void vqt6_qprogressbar_set_minimum(void* pb, int min);
|
||||
VQT6_API void vqt6_qprogressbar_set_maximum(void* pb, int max);
|
||||
VQT6_API void vqt6_qprogressbar_set_range(void* pb, int min, int max);
|
||||
VQT6_API int vqt6_qprogressbar_minimum(void* pb);
|
||||
VQT6_API int vqt6_qprogressbar_maximum(void* pb);
|
||||
VQT6_API void vqt6_qprogressbar_set_text_visible(void* pb, int visible);
|
||||
VQT6_API void vqt6_qprogressbar_set_format(void* pb, void* format);
|
||||
VQT6_API void vqt6_qprogressbar_reset(void* pb);
|
||||
|
||||
// ============================================================
|
||||
// QSlider
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qslider_create(void);
|
||||
VQT6_API void* vqt6_qslider_create_with_orientation(int orientation);
|
||||
VQT6_API void* vqt6_qslider_create_with_orientation_parent(int orientation, void* parent);
|
||||
VQT6_API void vqt6_qslider_set_value(void* s, int value);
|
||||
VQT6_API int vqt6_qslider_value(void* s);
|
||||
VQT6_API void vqt6_qslider_set_minimum(void* s, int min);
|
||||
VQT6_API void vqt6_qslider_set_maximum(void* s, int max);
|
||||
VQT6_API void vqt6_qslider_set_range(void* s, int min, int max);
|
||||
VQT6_API void vqt6_qslider_set_orientation(void* s, int orientation);
|
||||
VQT6_API int vqt6_qslider_orientation(void* s);
|
||||
VQT6_API void vqt6_qslider_set_single_step(void* s, int step);
|
||||
VQT6_API void vqt6_qslider_set_page_step(void* s, int step);
|
||||
|
||||
// ============================================================
|
||||
// QSpinBox
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qspinbox_create(void);
|
||||
VQT6_API void* vqt6_qspinbox_create_with_parent(void* parent);
|
||||
VQT6_API int vqt6_qspinbox_value(void* sb);
|
||||
VQT6_API void vqt6_qspinbox_set_value(void* sb, int value);
|
||||
VQT6_API void vqt6_qspinbox_set_minimum(void* sb, int min);
|
||||
VQT6_API void vqt6_qspinbox_set_maximum(void* sb, int max);
|
||||
VQT6_API void vqt6_qspinbox_set_range(void* sb, int min, int max);
|
||||
VQT6_API int vqt6_qspinbox_minimum(void* sb);
|
||||
VQT6_API int vqt6_qspinbox_maximum(void* sb);
|
||||
VQT6_API void vqt6_qspinbox_set_single_step(void* sb, int step);
|
||||
VQT6_API void vqt6_qspinbox_set_prefix(void* sb, void* prefix);
|
||||
VQT6_API void vqt6_qspinbox_set_suffix(void* sb, void* suffix);
|
||||
VQT6_API void* vqt6_qspinbox_prefix(void* sb);
|
||||
VQT6_API void* vqt6_qspinbox_suffix(void* sb);
|
||||
|
||||
// ============================================================
|
||||
// Layouts
|
||||
// ============================================================
|
||||
VQT6_API void vqt6_qlayout_add_widget(void* layout, void* widget);
|
||||
VQT6_API void vqt6_qlayout_remove_widget(void* layout, void* widget);
|
||||
VQT6_API int vqt6_qlayout_count(void* layout);
|
||||
VQT6_API void* vqt6_qlayout_item_at(void* layout, int index);
|
||||
VQT6_API void vqt6_qlayout_set_contents_margins(void* layout, int left, int top, int right, int bottom);
|
||||
VQT6_API void vqt6_qlayout_set_spacing(void* layout, int spacing);
|
||||
VQT6_API int vqt6_qlayout_spacing(void* layout);
|
||||
VQT6_API void vqt6_qlayout_invalidate(void* layout);
|
||||
|
||||
VQT6_API void* vqt6_qhboxlayout_create(void);
|
||||
VQT6_API void* vqt6_qhboxlayout_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qhboxlayout_add_layout(void* layout, void* child);
|
||||
VQT6_API void vqt6_qhboxlayout_add_stretch(void* layout, int stretch);
|
||||
VQT6_API void vqt6_qhboxlayout_add_spacing(void* layout, int size);
|
||||
|
||||
VQT6_API void* vqt6_qvboxlayout_create(void);
|
||||
VQT6_API void* vqt6_qvboxlayout_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qvboxlayout_add_layout(void* layout, void* child);
|
||||
VQT6_API void vqt6_qvboxlayout_add_stretch(void* layout, int stretch);
|
||||
VQT6_API void vqt6_qvboxlayout_add_spacing(void* layout, int size);
|
||||
|
||||
VQT6_API void* vqt6_qgridlayout_create(void);
|
||||
VQT6_API void* vqt6_qgridlayout_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qgridlayout_add_widget(void* gl, void* w, int row, int col);
|
||||
VQT6_API void vqt6_qgridlayout_add_widget_with_span(void* gl, void* w, int row, int col, int row_span, int col_span);
|
||||
|
||||
VQT6_API void* vqt6_qformlayout_create(void);
|
||||
VQT6_API void* vqt6_qformlayout_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qformlayout_add_row(void* fl, void* label, void* field);
|
||||
VQT6_API void vqt6_qformlayout_add_row_widget_pair(void* fl, void* label, void* field);
|
||||
|
||||
// ============================================================
|
||||
// QStackedWidget / QTabWidget
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qstackedwidget_create(void);
|
||||
VQT6_API void* vqt6_qstackedwidget_create_with_parent(void* parent);
|
||||
VQT6_API int vqt6_qstackedwidget_add_widget(void* sw, void* w);
|
||||
VQT6_API void vqt6_qstackedwidget_remove_widget(void* sw, void* w);
|
||||
VQT6_API int vqt6_qstackedwidget_count(void* sw);
|
||||
VQT6_API int vqt6_qstackedwidget_current_index(void* sw);
|
||||
VQT6_API void vqt6_qstackedwidget_set_current_index(void* sw, int index);
|
||||
VQT6_API void* vqt6_qstackedwidget_current_widget(void* sw);
|
||||
VQT6_API void* vqt6_qstackedwidget_widget(void* sw, int index);
|
||||
|
||||
VQT6_API void* vqt6_qtabwidget_create(void);
|
||||
VQT6_API void* vqt6_qtabwidget_create_with_parent(void* parent);
|
||||
VQT6_API int vqt6_qtabwidget_add_tab(void* tw, void* w, void* label);
|
||||
VQT6_API int vqt6_qtabwidget_insert_tab(void* tw, int index, void* w, void* label);
|
||||
VQT6_API void vqt6_qtabwidget_remove_tab(void* tw, int index);
|
||||
VQT6_API int vqt6_qtabwidget_count(void* tw);
|
||||
VQT6_API int vqt6_qtabwidget_current_index(void* tw);
|
||||
VQT6_API void vqt6_qtabwidget_set_current_index(void* tw, int index);
|
||||
VQT6_API void* vqt6_qtabwidget_tab_text(void* tw, int index);
|
||||
VQT6_API void vqt6_qtabwidget_set_tab_text(void* tw, int index, void* text);
|
||||
VQT6_API void vqt6_qtabwidget_set_tabs_closable(void* tw, int closable);
|
||||
VQT6_API int vqt6_qtabwidget_tabs_closable(void* tw);
|
||||
|
||||
// ============================================================
|
||||
// QMenuBar / QMenu / QAction
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qmenubar_create(void);
|
||||
VQT6_API void* vqt6_qmenubar_create_with_parent(void* parent);
|
||||
VQT6_API void* vqt6_qmenubar_add_menu(void* mb, void* title);
|
||||
VQT6_API void vqt6_qmenubar_add_menu_with_menu(void* mb, void* menu);
|
||||
VQT6_API void vqt6_qmenubar_add_action(void* mb, void* action);
|
||||
VQT6_API void vqt6_qmenubar_clear(void* mb);
|
||||
|
||||
VQT6_API void* vqt6_qmenu_create(void);
|
||||
VQT6_API void* vqt6_qmenu_create_with_title(void* title);
|
||||
VQT6_API void* vqt6_qmenu_create_with_title_parent(void* title, void* parent);
|
||||
VQT6_API void* vqt6_qmenu_add_menu(void* menu, void* title);
|
||||
VQT6_API void vqt6_qmenu_add_action(void* menu, void* action);
|
||||
VQT6_API void vqt6_qmenu_add_separator(void* menu);
|
||||
VQT6_API void vqt6_qmenu_clear(void* menu);
|
||||
VQT6_API void vqt6_qmenu_set_title(void* menu, void* title);
|
||||
VQT6_API void* vqt6_qmenu_title(void* menu);
|
||||
VQT6_API void* vqt6_qmenu_add_action_with_text(void* menu, void* text);
|
||||
|
||||
VQT6_API void* vqt6_qaction_create(void);
|
||||
VQT6_API void* vqt6_qaction_create_with_text(void* text);
|
||||
VQT6_API void* vqt6_qaction_create_with_text_parent(void* text, void* parent);
|
||||
VQT6_API void vqt6_qaction_set_text(void* action, void* text);
|
||||
VQT6_API void* vqt6_qaction_text(void* action);
|
||||
VQT6_API void vqt6_qaction_set_icon(void* action, void* icon);
|
||||
VQT6_API void* vqt6_qaction_icon(void* action);
|
||||
VQT6_API void vqt6_qaction_set_shortcut(void* action, void* key_sequence);
|
||||
VQT6_API void* vqt6_qaction_shortcut(void* action);
|
||||
VQT6_API void vqt6_qaction_set_checkable(void* action, int checkable);
|
||||
VQT6_API int vqt6_qaction_is_checkable(void* action);
|
||||
VQT6_API void vqt6_qaction_set_checked(void* action, int checked);
|
||||
VQT6_API int vqt6_qaction_is_checked(void* action);
|
||||
VQT6_API void vqt6_qaction_set_enabled(void* action, int enabled);
|
||||
VQT6_API int vqt6_qaction_is_enabled(void* action);
|
||||
VQT6_API void vqt6_qaction_trigger(void* action);
|
||||
|
||||
// ============================================================
|
||||
// QStatusBar / QToolBar
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qstatusbar_create(void);
|
||||
VQT6_API void* vqt6_qstatusbar_create_with_parent(void* parent);
|
||||
VQT6_API void vqt6_qstatusbar_show_message(void* sb, void* message, int timeout_ms);
|
||||
VQT6_API void vqt6_qstatusbar_clear_message(void* sb);
|
||||
VQT6_API void* vqt6_qstatusbar_current_message(void* sb);
|
||||
VQT6_API void vqt6_qstatusbar_add_widget(void* sb, void* w, int stretch);
|
||||
VQT6_API void vqt6_qstatusbar_add_permanent_widget(void* sb, void* w, int stretch);
|
||||
|
||||
VQT6_API void* vqt6_qtoolbar_create(void);
|
||||
VQT6_API void* vqt6_qtoolbar_create_with_parent(void* parent);
|
||||
VQT6_API void* vqt6_qtoolbar_add_widget(void* tb, void* w);
|
||||
VQT6_API void vqt6_qtoolbar_add_action(void* tb, void* action);
|
||||
VQT6_API void vqt6_qtoolbar_add_separator(void* tb);
|
||||
VQT6_API void vqt6_qtoolbar_set_icon_size(void* tb, int w, int h);
|
||||
VQT6_API void vqt6_qtoolbar_set_orientation(void* tb, int orientation);
|
||||
VQT6_API int vqt6_qtoolbar_orientation(void* tb);
|
||||
|
||||
// ============================================================
|
||||
// QMessageBox
|
||||
// ============================================================
|
||||
VQT6_API int vqt6_qmessagebox_information(void* parent, void* title, void* text, int buttons);
|
||||
VQT6_API int vqt6_qmessagebox_warning(void* parent, void* title, void* text, int buttons);
|
||||
VQT6_API int vqt6_qmessagebox_critical(void* parent, void* title, void* text, int buttons);
|
||||
VQT6_API int vqt6_qmessagebox_question(void* parent, void* title, void* text, int buttons);
|
||||
VQT6_API void vqt6_qmessagebox_about(void* parent, void* title, void* text);
|
||||
VQT6_API void vqt6_qmessagebox_about_qt(void* parent);
|
||||
|
||||
// ============================================================
|
||||
// QFileDialog
|
||||
// ============================================================
|
||||
VQT6_API void* vqt6_qfiledialog_get_open_file_name(void* parent, void* caption, void* dir, void* filter);
|
||||
VQT6_API void* vqt6_qfiledialog_get_save_file_name(void* parent, void* caption, void* dir, void* filter);
|
||||
VQT6_API void* vqt6_qfiledialog_get_existing_directory(void* parent, void* caption, void* dir);
|
||||
VQT6_API void* vqt6_qfiledialog_get_open_file_names(void* parent, void* caption, void* dir, void* filter);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // VQT6_BRIDGE_WIDGETS_H
|
||||
157
includes/vqt6/_qtcore.py
Normal file
157
includes/vqt6/_qtcore.py
Normal file
@@ -0,0 +1,157 @@
|
||||
import t, c
|
||||
from stdint import *
|
||||
from vqt6._types import *
|
||||
|
||||
# ============================================================
|
||||
# vqt6/_qtcore.py — QtCore 的 t.State FFI 声明
|
||||
#
|
||||
# 所有函数都是 C 桥接层 (libvqt6_bridge.a) 的 extern "C" 函数
|
||||
# 命名规范: vqt6_<class>_<action>
|
||||
# ============================================================
|
||||
|
||||
# ============================================================
|
||||
# QString — UTF-16 字符串
|
||||
# ============================================================
|
||||
# 创建 QString(从 UTF-8 C 字符串)
|
||||
def vqt6_qstring_create(utf8: t.CChar | t.CPtr) -> QtStringPtr | t.State: pass
|
||||
|
||||
# 获取 QString 的 UTF-8 表示(写入 buf,返回实际长度,不含 \0)
|
||||
# buf 需足够大(建议 4 * qstring.length() + 1)
|
||||
def vqt6_qstring_to_utf8(qstr: QtStringPtr, buf: t.CChar | t.CPtr, buf_size: t.CSizeT) -> t.CSizeT | t.State: pass
|
||||
|
||||
# 释放 QString
|
||||
def vqt6_qstring_free(qstr: QtStringPtr) -> t.State: pass
|
||||
|
||||
# 获取 QString 字符数
|
||||
def vqt6_qstring_length(qstr: QtStringPtr) -> t.CInt | t.State: pass
|
||||
|
||||
# QString 是否为空
|
||||
def vqt6_qstring_is_empty(qstr: QtStringPtr) -> t.CInt | t.State: pass
|
||||
|
||||
# QString 比较
|
||||
def vqt6_qstring_equals(qstr: QtStringPtr, other: QtStringPtr) -> t.CInt | t.State: pass
|
||||
|
||||
# QString 拼接(返回新 QString)
|
||||
def vqt6_qstring_append(qstr: QtStringPtr, other: QtStringPtr) -> QtStringPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QByteArray — 字节数组
|
||||
# ============================================================
|
||||
def vqt6_qbytearray_create(data: t.CVoid | t.CPtr, size: t.CSizeT) -> QtByteArrayPtr | t.State: pass
|
||||
def vqt6_qbytearray_data(qba: QtByteArrayPtr, out_size: t.CSizeT | t.CPtr) -> t.CVoid | t.CPtr | t.State: pass
|
||||
def vqt6_qbytearray_size(qba: QtByteArrayPtr) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qbytearray_free(qba: QtByteArrayPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QObject — 所有 Qt 对象的基类
|
||||
# ============================================================
|
||||
# 注意: Qt 对象的内存由 C++ 管理,Viper 端不应直接 free
|
||||
def vqt6_qobject_delete(obj: QtObjectPtr) -> t.State: pass
|
||||
def vqt6_qobject_delete_later(obj: QtObjectPtr) -> t.State: pass
|
||||
def vqt6_qobject_set_object_name(obj: QtObjectPtr, name: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qobject_object_name(obj: QtObjectPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qobject_set_parent(child: QtObjectPtr, parent: QtObjectPtr) -> t.State: pass
|
||||
def vqt6_qobject_parent(obj: QtObjectPtr) -> QtObjectPtr | t.State: pass
|
||||
|
||||
# 信号/槽连接 (简化版: 函数指针形式)
|
||||
# typedef void (*vqt6_callback_t)(void* user_data);
|
||||
# vqt6_qobject_connect_typed(sender, signal_id, receiver, slot_id, type) 由 C++ 桥接层处理
|
||||
# 由于函数指针在 C ABI 中复杂,我们采用字符串 signal/slot 名 + 全局回调注册表
|
||||
def vqt6_qobject_connect(sender: QtObjectPtr, signal_name: t.CChar | t.CPtr,
|
||||
receiver: QtObjectPtr, slot_name: t.CChar | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def vqt6_qobject_disconnect(sender: QtObjectPtr, signal_name: t.CChar | t.CPtr,
|
||||
receiver: QtObjectPtr, slot_name: t.CChar | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
# 事件过滤器
|
||||
def vqt6_qobject_install_event_filter(watched: QtObjectPtr, filter: QtObjectPtr) -> t.State: pass
|
||||
def vqt6_qobject_remove_event_filter(watched: QtObjectPtr, filter: QtObjectPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QCoreApplication — 事件循环基类
|
||||
# ============================================================
|
||||
def vqt6_qcoreapp_create(app_name: t.CChar | t.CPtr) -> QtCoreAppPtr | t.State: pass
|
||||
def vqt6_qcoreapp_instance() -> QtCoreAppPtr | t.State: pass
|
||||
def vqt6_qcoreapp_exec(app: QtCoreAppPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcoreapp_quit(app: QtCoreAppPtr, exit_code: t.CInt) -> t.State: pass
|
||||
def vqt6_qcoreapp_exit(app: QtCoreAppPtr, exit_code: t.CInt) -> t.State: pass
|
||||
def vqt6_qcoreapp_process_events(app: QtCoreAppPtr, flags: t.CInt) -> t.State: pass
|
||||
def vqt6_qcoreapp_post_event(receiver: QtObjectPtr, event: QtEventPtr) -> t.State: pass
|
||||
def vqt6_qcoreapp_send_event(receiver: QtObjectPtr, event: QtEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcoreapp_organization_name(app: QtCoreAppPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qcoreapp_set_organization_name(app: QtCoreAppPtr, name: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qcoreapp_application_name(app: QtCoreAppPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qcoreapp_set_application_name(app: QtCoreAppPtr, name: QtStringPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QTimer — 定时器
|
||||
# ============================================================
|
||||
def vqt6_qtimer_create() -> QtTimerPtr | t.State: pass
|
||||
def vqt6_qtimer_create_with_parent(parent: QtObjectPtr) -> QtTimerPtr | t.State: pass
|
||||
def vqt6_qtimer_start(timer: QtTimerPtr, interval_ms: t.CInt) -> t.State: pass
|
||||
def vqt6_qtimer_stop(timer: QtTimerPtr) -> t.State: pass
|
||||
def vqt6_qtimer_set_interval(timer: QtTimerPtr, interval_ms: t.CInt) -> t.State: pass
|
||||
def vqt6_qtimer_interval(timer: QtTimerPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qtimer_is_active(timer: QtTimerPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qtimer_set_single_shot(timer: QtTimerPtr, single_shot: t.CInt) -> t.State: pass
|
||||
def vqt6_qtimer_is_single_shot(timer: QtTimerPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QVariant — 通用数据容器
|
||||
# ============================================================
|
||||
def vqt6_qvariant_create_int(value: t.CInt) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qvariant_create_double(value: t.CDouble) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qvariant_create_bool(value: t.CInt) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qvariant_create_string(s: QtStringPtr) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qvariant_to_int(v: QtVariantPtr, ok: t.CInt | t.CPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qvariant_to_double(v: QtVariantPtr, ok: t.CInt | t.CPtr) -> t.CDouble | t.State: pass
|
||||
def vqt6_qvariant_to_bool(v: QtVariantPtr, ok: t.CInt | t.CPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qvariant_to_string(v: QtVariantPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qvariant_type_id(v: QtVariantPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qvariant_is_valid(v: QtVariantPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qvariant_free(v: QtVariantPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QEvent — 事件基类
|
||||
# ============================================================
|
||||
def vqt6_qevent_type(event: QtEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qevent_accept(event: QtEventPtr) -> t.State: pass
|
||||
def vqt6_qevent_ignore(event: QtEventPtr) -> t.State: pass
|
||||
def vqt6_qevent_is_accepted(event: QtEventPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 字符串列表 (QStringList / QList<QString>)
|
||||
# ============================================================
|
||||
def vqt6_qstringlist_create() -> QtStringListPtr | t.State: pass
|
||||
def vqt6_qstringlist_append(list: QtStringListPtr, str: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qstringlist_size(list: QtStringListPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qstringlist_at(list: QtStringListPtr, index: t.CInt) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qstringlist_free(list: QtStringListPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 字节数组列表 (QList<QByteArray>)
|
||||
# ============================================================
|
||||
def vqt6_qbytearraylist_create() -> QtByteArrayListPtr | t.State: pass
|
||||
def vqt6_qbytearraylist_append(list: QtByteArrayListPtr, qba: QtByteArrayPtr) -> t.State: pass
|
||||
def vqt6_qbytearraylist_size(list: QtByteArrayListPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qbytearraylist_at(list: QtByteArrayListPtr, index: t.CInt) -> QtByteArrayPtr | t.State: pass
|
||||
def vqt6_qbytearraylist_free(list: QtByteArrayListPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 全局回调注册表
|
||||
# ============================================================
|
||||
# 用于从 C++ 端回调 Viper 代码
|
||||
# Viper 注册一个 slot 函数(用整数 ID 标识),C++ 在触发信号时通过 ID 查找
|
||||
# typedef void (*vqt6_slot_callback_t)(int slot_id, void* user_data);
|
||||
def vqt6_register_slot(slot_id: t.CInt, user_data: t.CVoid | t.CPtr) -> t.State: pass
|
||||
def vqt6_unregister_slot(slot_id: t.CInt) -> t.State: pass
|
||||
def vqt6_trigger_slot(slot_id: t.CInt) -> t.State: pass # 测试用
|
||||
237
includes/vqt6/_qtgui.py
Normal file
237
includes/vqt6/_qtgui.py
Normal file
@@ -0,0 +1,237 @@
|
||||
import t, c
|
||||
from stdint import *
|
||||
from vqt6._types import *
|
||||
|
||||
# ============================================================
|
||||
# vqt6/_qtgui.py — QtGui 的 t.State FFI 声明
|
||||
# ============================================================
|
||||
|
||||
# ============================================================
|
||||
# QColor — 颜色
|
||||
# ============================================================
|
||||
def vqt6_qcolor_create_rgb(r: t.CInt, g: t.CInt, b: t.CInt) -> QtColorPtr | t.State: pass
|
||||
def vqt6_qcolor_create_rgba(r: t.CInt, g: t.CInt, b: t.CInt, a: t.CInt) -> QtColorPtr | t.State: pass
|
||||
def vqt6_qcolor_create_name(name: QtStringPtr) -> QtColorPtr | t.State: pass
|
||||
def vqt6_qcolor_create_hex(hex_str: QtStringPtr) -> QtColorPtr | t.State: pass
|
||||
def vqt6_qcolor_red(c: QtColorPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcolor_green(c: QtColorPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcolor_blue(c: QtColorPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcolor_alpha(c: QtColorPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcolor_set_red(c: QtColorPtr, r: t.CInt) -> t.State: pass
|
||||
def vqt6_qcolor_set_green(c: QtColorPtr, g: t.CInt) -> t.State: pass
|
||||
def vqt6_qcolor_set_blue(c: QtColorPtr, b: t.CInt) -> t.State: pass
|
||||
def vqt6_qcolor_set_alpha(c: QtColorPtr, a: t.CInt) -> t.State: pass
|
||||
def vqt6_qcolor_set_rgb(c: QtColorPtr, r: t.CInt, g: t.CInt, b: t.CInt) -> t.State: pass
|
||||
def vqt6_qcolor_set_rgba(c: QtColorPtr, r: t.CInt, g: t.CInt, b: t.CInt, a: t.CInt) -> t.State: pass
|
||||
def vqt6_qcolor_name(c: QtColorPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qcolor_is_valid(c: QtColorPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcolor_free(c: QtColorPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QFont — 字体
|
||||
# ============================================================
|
||||
def vqt6_qfont_create() -> QtFontPtr | t.State: pass
|
||||
def vqt6_qfont_create_with_family(family: QtStringPtr) -> QtFontPtr | t.State: pass
|
||||
def vqt6_qfont_create_with_family_size(family: QtStringPtr, point_size: t.CInt) -> QtFontPtr | t.State: pass
|
||||
def vqt6_qfont_set_family(font: QtFontPtr, family: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qfont_family(font: QtFontPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qfont_set_point_size(font: QtFontPtr, point_size: t.CInt) -> t.State: pass
|
||||
def vqt6_qfont_point_size(font: QtFontPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfont_set_pixel_size(font: QtFontPtr, pixel_size: t.CInt) -> t.State: pass
|
||||
def vqt6_qfont_pixel_size(font: QtFontPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfont_set_bold(font: QtFontPtr, bold: t.CInt) -> t.State: pass
|
||||
def vqt6_qfont_bold(font: QtFontPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfont_set_italic(font: QtFontPtr, italic: t.CInt) -> t.State: pass
|
||||
def vqt6_qfont_italic(font: QtFontPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfont_set_underline(font: QtFontPtr, underline: t.CInt) -> t.State: pass
|
||||
def vqt6_qfont_underline(font: QtFontPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfont_set_strike_out(font: QtFontPtr, strike_out: t.CInt) -> t.State: pass
|
||||
def vqt6_qfont_strike_out(font: QtFontPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfont_set_weight(font: QtFontPtr, weight: t.CInt) -> t.State: pass
|
||||
def vqt6_qfont_weight(font: QtFontPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfont_free(font: QtFontPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QFontMetrics — 字体度量
|
||||
# ============================================================
|
||||
def vqt6_qfontmetrics_create(font: QtFontPtr) -> QtFontMetricsPtr | t.State: pass
|
||||
def vqt6_qfontmetrics_width(fm: QtFontMetricsPtr, text: QtStringPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfontmetrics_height(fm: QtFontMetricsPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfontmetrics_ascent(fm: QtFontMetricsPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfontmetrics_descent(fm: QtFontMetricsPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qfontmetrics_free(fm: QtFontMetricsPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QPixmap — 像素图
|
||||
# ============================================================
|
||||
def vqt6_qpixmap_create() -> QtPixmapPtr | t.State: pass
|
||||
def vqt6_qpixmap_create_with_size(w: t.CInt, h: t.CInt) -> QtPixmapPtr | t.State: pass
|
||||
def vqt6_qpixmap_load(pm: QtPixmapPtr, file_name: QtStringPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpixmap_load_from_data(pm: QtPixmapPtr, data: t.CVoid | t.CPtr, size: t.CSizeT) -> t.CInt | t.State: pass
|
||||
def vqt6_qpixmap_save(pm: QtPixmapPtr, file_name: QtStringPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpixmap_width(pm: QtPixmapPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpixmap_height(pm: QtPixmapPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpixmap_is_null(pm: QtPixmapPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpixmap_scaled(pm: QtPixmapPtr, w: t.CInt, h: t.CInt) -> QtPixmapPtr | t.State: pass
|
||||
def vqt6_qpixmap_fill(pm: QtPixmapPtr, color: QtColorPtr) -> t.State: pass
|
||||
def vqt6_qpixmap_free(pm: QtPixmapPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QImage — 图像
|
||||
# ============================================================
|
||||
def vqt6_qimage_create() -> QtImagePtr | t.State: pass
|
||||
def vqt6_qimage_create_with_size(w: t.CInt, h: t.CInt, format: t.CInt) -> QtImagePtr | t.State: pass
|
||||
def vqt6_qimage_load(img: QtImagePtr, file_name: QtStringPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qimage_save(img: QtImagePtr, file_name: QtStringPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qimage_width(img: QtImagePtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qimage_height(img: QtImagePtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qimage_format(img: QtImagePtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qimage_is_null(img: QtImagePtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qimage_fill(img: QtImagePtr, color: QtColorPtr) -> t.State: pass
|
||||
def vqt6_qimage_scaled(img: QtImagePtr, w: t.CInt, h: t.CInt) -> QtImagePtr | t.State: pass
|
||||
def vqt6_qimage_free(img: QtImagePtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QPainter — 绘画器
|
||||
# ============================================================
|
||||
def vqt6_qpainter_create() -> QtPainterPtr | t.State: pass
|
||||
def vqt6_qpainter_begin(p: QtPainterPtr, device: QtPixmapPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpainter_end(p: QtPainterPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpainter_is_active(p: QtPainterPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpainter_set_pen(p: QtPainterPtr, pen: QtPenPtr) -> t.State: pass
|
||||
def vqt6_qpainter_set_brush(p: QtPainterPtr, brush: QtBrushPtr) -> t.State: pass
|
||||
def vqt6_qpainter_set_font(p: QtPainterPtr, font: QtFontPtr) -> t.State: pass
|
||||
def vqt6_qpainter_pen(p: QtPainterPtr) -> QtPenPtr | t.State: pass
|
||||
def vqt6_qpainter_brush(p: QtPainterPtr) -> QtBrushPtr | t.State: pass
|
||||
def vqt6_qpainter_font(p: QtPainterPtr) -> QtFontPtr | t.State: pass
|
||||
def vqt6_qpainter_set_opacity(p: QtPainterPtr, opacity: t.CDouble) -> t.State: pass
|
||||
def vqt6_qpainter_opacity(p: QtPainterPtr) -> t.CDouble | t.State: pass
|
||||
|
||||
# 绘图原语
|
||||
def vqt6_qpainter_draw_line(p: QtPainterPtr, x1: t.CInt, y1: t.CInt, x2: t.CInt, y2: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_rect(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_fill_rect(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt, color: QtColorPtr) -> t.State: pass
|
||||
def vqt6_qpainter_draw_ellipse(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_arc(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt, start_angle: t.CInt, span_angle: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_chord(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt, start_angle: t.CInt, span_angle: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_pie(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt, start_angle: t.CInt, span_angle: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_polygon(p: QtPainterPtr, points: t.CInt | t.CPtr, point_count: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_polyline(p: QtPainterPtr, points: t.CInt | t.CPtr, point_count: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_point(p: QtPainterPtr, x: t.CInt, y: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_points(p: QtPainterPtr, points: t.CInt | t.CPtr, point_count: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_draw_text(p: QtPainterPtr, x: t.CInt, y: t.CInt, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qpainter_draw_text_in_rect(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt, flags: t.CInt, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qpainter_draw_pixmap(p: QtPainterPtr, x: t.CInt, y: t.CInt, pixmap: QtPixmapPtr) -> t.State: pass
|
||||
def vqt6_qpainter_draw_image(p: QtPainterPtr, x: t.CInt, y: t.CInt, image: QtImagePtr) -> t.State: pass
|
||||
def vqt6_qpainter_draw_tiled_pixmap(p: QtPainterPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt, pixmap: QtPixmapPtr) -> t.State: pass
|
||||
|
||||
# 变换
|
||||
def vqt6_qpainter_translate(p: QtPainterPtr, dx: t.CInt, dy: t.CInt) -> t.State: pass
|
||||
def vqt6_qpainter_rotate(p: QtPainterPtr, angle: t.CDouble) -> t.State: pass
|
||||
def vqt6_qpainter_scale(p: QtPainterPtr, sx: t.CDouble, sy: t.CDouble) -> t.State: pass
|
||||
def vqt6_qpainter_reset_transform(p: QtPainterPtr) -> t.State: pass
|
||||
def vqt6_qpainter_save(p: QtPainterPtr) -> t.State: pass
|
||||
def vqt6_qpainter_restore(p: QtPainterPtr) -> t.State: pass
|
||||
|
||||
def vqt6_qpainter_free(p: QtPainterPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QPen — 画笔
|
||||
# ============================================================
|
||||
def vqt6_qpen_create() -> QtPenPtr | t.State: pass
|
||||
def vqt6_qpen_create_with_color(color: QtColorPtr) -> QtPenPtr | t.State: pass
|
||||
def vqt6_qpen_create_with_color_width(color: QtColorPtr, width: t.CInt) -> QtPenPtr | t.State: pass
|
||||
def vqt6_qpen_set_color(pen: QtPenPtr, color: QtColorPtr) -> t.State: pass
|
||||
def vqt6_qpen_color(pen: QtPenPtr) -> QtColorPtr | t.State: pass
|
||||
def vqt6_qpen_set_width(pen: QtPenPtr, width: t.CInt) -> t.State: pass
|
||||
def vqt6_qpen_width(pen: QtPenPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpen_set_style(pen: QtPenPtr, style: t.CInt) -> t.State: pass
|
||||
def vqt6_qpen_style(pen: QtPenPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpen_free(pen: QtPenPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QBrush — 画刷
|
||||
# ============================================================
|
||||
def vqt6_qbrush_create() -> QtBrushPtr | t.State: pass
|
||||
def vqt6_qbrush_create_with_color(color: QtColorPtr) -> QtBrushPtr | t.State: pass
|
||||
def vqt6_qbrush_create_with_style(style: t.CInt) -> QtBrushPtr | t.State: pass
|
||||
def vqt6_qbrush_set_color(brush: QtBrushPtr, color: QtColorPtr) -> t.State: pass
|
||||
def vqt6_qbrush_color(brush: QtBrushPtr) -> QtColorPtr | t.State: pass
|
||||
def vqt6_qbrush_set_style(brush: QtBrushPtr, style: t.CInt) -> t.State: pass
|
||||
def vqt6_qbrush_style(brush: QtBrushPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qbrush_free(brush: QtBrushPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QIcon — 图标
|
||||
# ============================================================
|
||||
def vqt6_qicon_create() -> QtIconPtr | t.State: pass
|
||||
def vqt6_qicon_create_with_file(file_name: QtStringPtr) -> QtIconPtr | t.State: pass
|
||||
def vqt6_qicon_add_file(icon: QtIconPtr, file_name: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qicon_add_pixmap(icon: QtIconPtr, pixmap: QtPixmapPtr) -> t.State: pass
|
||||
def vqt6_qicon_is_null(icon: QtIconPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qicon_pixmap(icon: QtIconPtr, w: t.CInt, h: t.CInt) -> QtPixmapPtr | t.State: pass
|
||||
def vqt6_qicon_free(icon: QtIconPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QCursor — 鼠标光标
|
||||
# ============================================================
|
||||
def vqt6_qcursor_create() -> QtCursorPtr | t.State: pass
|
||||
def vqt6_qcursor_create_with_shape(shape: t.CInt) -> QtCursorPtr | t.State: pass
|
||||
def vqt6_qcursor_pos(x: t.CInt | t.CPtr, y: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qcursor_set_pos(x: t.CInt, y: t.CInt) -> t.State: pass
|
||||
def vqt6_qcursor_set_shape(cursor: QtCursorPtr, shape: t.CInt) -> t.State: pass
|
||||
def vqt6_qcursor_shape(cursor: QtCursorPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcursor_free(cursor: QtCursorPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QKeyEvent — 键盘事件
|
||||
# ============================================================
|
||||
def vqt6_qkeyevent_create(type: t.CInt, key: t.CInt, modifiers: t.CInt, text: QtStringPtr) -> QtKeyEventPtr | t.State: pass
|
||||
def vqt6_qkeyevent_key(event: QtKeyEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qkeyevent_text(event: QtKeyEventPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qkeyevent_modifiers(event: QtKeyEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qkeyevent_is_auto_repeat(event: QtKeyEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qkeyevent_free(event: QtKeyEventPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QMouseEvent — 鼠标事件
|
||||
# ============================================================
|
||||
def vqt6_qmouseevent_create(type: t.CInt, local_pos: QtObjectPtr, button: t.CInt, buttons: t.CInt, modifiers: t.CInt) -> QtMouseEventPtr | t.State: pass
|
||||
def vqt6_qmouseevent_button(event: QtMouseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qmouseevent_buttons(event: QtMouseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qmouseevent_x(event: QtMouseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qmouseevent_y(event: QtMouseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qmouseevent_global_x(event: QtMouseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qmouseevent_global_y(event: QtMouseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qmouseevent_modifiers(event: QtMouseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qmouseevent_free(event: QtMouseEventPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QResizeEvent / QPaintEvent / QCloseEvent
|
||||
# ============================================================
|
||||
def vqt6_qresizeevent_create(width: t.CInt, height: t.CInt, old_width: t.CInt, old_height: t.CInt) -> QtResizeEventPtr | t.State: pass
|
||||
def vqt6_qresizeevent_size(event: QtResizeEventPtr, w: t.CInt | t.CPtr, h: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qresizeevent_old_size(event: QtResizeEventPtr, w: t.CInt | t.CPtr, h: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qresizeevent_free(event: QtResizeEventPtr) -> t.State: pass
|
||||
|
||||
def vqt6_qpaintevent_create(rect_x: t.CInt, rect_y: t.CInt, rect_w: t.CInt, rect_h: t.CInt) -> QtPaintEventPtr | t.State: pass
|
||||
def vqt6_qpaintevent_rect(event: QtPaintEventPtr, x: t.CInt | t.CPtr, y: t.CInt | t.CPtr, w: t.CInt | t.CPtr, h: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qpaintevent_free(event: QtPaintEventPtr) -> t.State: pass
|
||||
|
||||
def vqt6_qcloseevent_create() -> QtCloseEventPtr | t.State: pass
|
||||
def vqt6_qcloseevent_is_accepted(event: QtCloseEventPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcloseevent_accept(event: QtCloseEventPtr) -> t.State: pass
|
||||
def vqt6_qcloseevent_ignore(event: QtCloseEventPtr) -> t.State: pass
|
||||
def vqt6_qcloseevent_free(event: QtCloseEventPtr) -> t.State: pass
|
||||
184
includes/vqt6/_qtnetwork.py
Normal file
184
includes/vqt6/_qtnetwork.py
Normal file
@@ -0,0 +1,184 @@
|
||||
import t, c
|
||||
from stdint import *
|
||||
from vqt6._types import *
|
||||
|
||||
# ============================================================
|
||||
# vqt6/_qtnetwork.py — QtNetwork 的 t.State FFI 声明
|
||||
# ============================================================
|
||||
|
||||
# ============================================================
|
||||
# QHostAddress — IP 地址
|
||||
# ============================================================
|
||||
def vqt6_qhostaddress_create() -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qhostaddress_create_with_ipv4(ipv4: t.CUInt32T) -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qhostaddress_create_with_string(address: QtStringPtr) -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qhostaddress_create_with_local_host() -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qhostaddress_create_with_local_ipv4() -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qhostaddress_create_with_broadcast() -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qhostaddress_create_with_any_ipv4() -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qhostaddress_to_string(addr: QtHostAddressPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qhostaddress_to_ipv4(addr: QtHostAddressPtr) -> t.CUInt32T | t.State: pass
|
||||
def vqt6_qhostaddress_is_null(addr: QtHostAddressPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qhostaddress_is_loopback(addr: QtHostAddressPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qhostaddress_is_broadcast(addr: QtHostAddressPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qhostaddress_protocol(addr: QtHostAddressPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qhostaddress_free(addr: QtHostAddressPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QAbstractSocket — TCP/UDP 套接字基类
|
||||
# ============================================================
|
||||
# 套接字状态
|
||||
QT_SOCKET_UNCONNECTED_STATE: t.CDefine = 0
|
||||
QT_SOCKET_HOST_LOOKUP_STATE: t.CDefine = 1
|
||||
QT_SOCKET_CONNECTING_STATE: t.CDefine = 2
|
||||
QT_SOCKET_CONNECTED_STATE: t.CDefine = 3
|
||||
QT_SOCKET_BOUND_STATE: t.CDefine = 4
|
||||
QT_SOCKET_LISTENING_STATE: t.CDefine = 5
|
||||
QT_SOCKET_CLOSING_STATE: t.CDefine = 6
|
||||
|
||||
# 套接字类型
|
||||
QT_SOCKET_TCP: t.CDefine = 0
|
||||
QT_SOCKET_UDP: t.CDefine = 1
|
||||
|
||||
# 套接字错误
|
||||
QT_SOCKET_NO_ERROR: t.CDefine = 0
|
||||
|
||||
# 通用方法
|
||||
def vqt6_qabstractsocket_state(socket: QtAbstractSocketPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_error(socket: QtAbstractSocketPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_error_string(socket: QtAbstractSocketPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qabstractsocket_connect_to_host(socket: QtAbstractSocketPtr, host_name: QtStringPtr, port: t.CUInt16T) -> t.State: pass
|
||||
def vqt6_qabstractsocket_connect_to_host_with_addr(socket: QtAbstractSocketPtr, address: QtHostAddressPtr, port: t.CUInt16T) -> t.State: pass
|
||||
def vqt6_qabstractsocket_disconnect_from_host(socket: QtAbstractSocketPtr) -> t.State: pass
|
||||
def vqt6_qabstractsocket_wait_for_connected(socket: QtAbstractSocketPtr, timeout_ms: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_wait_for_ready_read(socket: QtAbstractSocketPtr, timeout_ms: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_wait_for_bytes_written(socket: QtAbstractSocketPtr, timeout_ms: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_wait_for_disconnected(socket: QtAbstractSocketPtr, timeout_ms: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_is_valid(socket: QtAbstractSocketPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_is_open(socket: QtAbstractSocketPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_flush(socket: QtAbstractSocketPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qabstractsocket_close(socket: QtAbstractSocketPtr) -> t.State: pass
|
||||
def vqt6_qabstractsocket_abort(socket: QtAbstractSocketPtr) -> t.State: pass
|
||||
def vqt6_qabstractsocket_read(socket: QtAbstractSocketPtr, buf: t.CVoid | t.CPtr, max_size: t.CSizeT) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qabstractsocket_read_all(socket: QtAbstractSocketPtr, out_size: t.CSizeT | t.CPtr) -> t.CVoid | t.CPtr | t.State: pass
|
||||
def vqt6_qabstractsocket_write(socket: QtAbstractSocketPtr, data: t.CVoid | t.CPtr, size: t.CSizeT) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qabstractsocket_bytes_available(socket: QtAbstractSocketPtr) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qabstractsocket_bytes_to_write(socket: QtAbstractSocketPtr) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qabstractsocket_peer_address(socket: QtAbstractSocketPtr) -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qabstractsocket_peer_port(socket: QtAbstractSocketPtr) -> t.CUInt16T | t.State: pass
|
||||
def vqt6_qabstractsocket_local_address(socket: QtAbstractSocketPtr) -> QtHostAddressPtr | t.State: pass
|
||||
def vqt6_qabstractsocket_local_port(socket: QtAbstractSocketPtr) -> t.CUInt16T | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QTcpSocket — TCP 套接字
|
||||
# ============================================================
|
||||
def vqt6_qtcpsocket_create() -> QtTcpSocketPtr | t.State: pass
|
||||
def vqt6_qtcpsocket_create_with_parent(parent: QtObjectPtr) -> QtTcpSocketPtr | t.State: pass
|
||||
def vqt6_qtcpsocket_connect_to_host(socket: QtTcpSocketPtr, host_name: QtStringPtr, port: t.CUInt16T, mode: t.CInt) -> t.State: pass
|
||||
def vqt6_qtcpsocket_connect_to_host_with_addr(socket: QtTcpSocketPtr, address: QtHostAddressPtr, port: t.CUInt16T, mode: t.CInt) -> t.State: pass
|
||||
def vqt6_qtcpsocket_set_socket_descriptor(socket: QtTcpSocketPtr, socket_descriptor: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qtcpsocket_socket_descriptor(socket: QtTcpSocketPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qtcpsocket_set_proxy(socket: QtTcpSocketPtr, proxy_type: t.CInt) -> t.State: pass
|
||||
def vqt6_qtcpsocket_abort(socket: QtTcpSocketPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QUdpSocket — UDP 套接字
|
||||
# ============================================================
|
||||
def vqt6_qudpsocket_create() -> QtUdpSocketPtr | t.State: pass
|
||||
def vqt6_qudpsocket_create_with_parent(parent: QtObjectPtr) -> QtUdpSocketPtr | t.State: pass
|
||||
def vqt6_qudpsocket_bind(socket: QtUdpSocketPtr, port: t.CUInt16T) -> t.CInt | t.State: pass
|
||||
def vqt6_qudpsocket_bind_with_addr(socket: QtUdpSocketPtr, address: QtHostAddressPtr, port: t.CUInt16T) -> t.CInt | t.State: pass
|
||||
def vqt6_qudpsocket_close(socket: QtUdpSocketPtr) -> t.State: pass
|
||||
def vqt6_qudpsocket_write_datagram(socket: QtUdpSocketPtr, data: t.CVoid | t.CPtr, size: t.CSizeT, host: QtHostAddressPtr, port: t.CUInt16T) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qudpsocket_read_datagram(socket: QtUdpSocketPtr, data: t.CVoid | t.CPtr, max_size: t.CSizeT, host: QtHostAddressPtr, port: t.CUInt16T | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qudpsocket_has_pending_datagrams(socket: QtUdpSocketPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qudpsocket_pending_datagram_size(socket: QtUdpSocketPtr) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qudpsocket_join_multicast_group(socket: QtUdpSocketPtr, group_address: QtHostAddressPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qudpsocket_leave_multicast_group(socket: QtUdpSocketPtr, group_address: QtHostAddressPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QNetworkRequest — 网络请求
|
||||
# ============================================================
|
||||
def vqt6_qnetworkrequest_create() -> QtNetworkRequestPtr | t.State: pass
|
||||
def vqt6_qnetworkrequest_create_with_url(url: QtStringPtr) -> QtNetworkRequestPtr | t.State: pass
|
||||
def vqt6_qnetworkrequest_set_url(req: QtNetworkRequestPtr, url: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qnetworkrequest_url(req: QtNetworkRequestPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qnetworkrequest_set_header(req: QtNetworkRequestPtr, header_type: t.CInt, value: QtVariantPtr) -> t.State: pass
|
||||
def vqt6_qnetworkrequest_header(req: QtNetworkRequestPtr, header_type: t.CInt) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qnetworkrequest_set_raw_header(req: QtNetworkRequestPtr, header_name: t.CChar | t.CPtr, value: t.CVoid | t.CPtr, value_size: t.CSizeT) -> t.State: pass
|
||||
def vqt6_qnetworkrequest_raw_header(req: QtNetworkRequestPtr, header_name: t.CChar | t.CPtr, out_size: t.CSizeT | t.CPtr) -> t.CVoid | t.CPtr | t.State: pass
|
||||
def vqt6_qnetworkrequest_set_attribute(req: QtNetworkRequestPtr, attr_type: t.CInt, value: QtVariantPtr) -> t.State: pass
|
||||
def vqt6_qnetworkrequest_attribute(req: QtNetworkRequestPtr, attr_type: t.CInt) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qnetworkrequest_free(req: QtNetworkRequestPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QNetworkAccessManager — HTTP 客户端管理器
|
||||
# ============================================================
|
||||
def vqt6_qnetworkaccessmanager_create() -> QtNetworkAccessManagerPtr | t.State: pass
|
||||
def vqt6_qnetworkaccessmanager_create_with_parent(parent: QtObjectPtr) -> QtNetworkAccessManagerPtr | t.State: pass
|
||||
def vqt6_qnetworkaccessmanager_get(nam: QtNetworkAccessManagerPtr, req: QtNetworkRequestPtr) -> QtNetworkReplyPtr | t.State: pass
|
||||
def vqt6_qnetworkaccessmanager_post(nam: QtNetworkAccessManagerPtr, req: QtNetworkRequestPtr, data: t.CVoid | t.CPtr, size: t.CSizeT) -> QtNetworkReplyPtr | t.State: pass
|
||||
def vqt6_qnetworkaccessmanager_put(nam: QtNetworkAccessManagerPtr, req: QtNetworkRequestPtr, data: t.CVoid | t.CPtr, size: t.CSizeT) -> QtNetworkReplyPtr | t.State: pass
|
||||
def vqt6_qnetworkaccessmanager_delete_resource(nam: QtNetworkAccessManagerPtr, req: QtNetworkRequestPtr) -> QtNetworkReplyPtr | t.State: pass
|
||||
def vqt6_qnetworkaccessmanager_head(nam: QtNetworkAccessManagerPtr, req: QtNetworkRequestPtr) -> QtNetworkReplyPtr | t.State: pass
|
||||
def vqt6_qnetworkaccessmanager_set_cookie_store(nam: QtNetworkAccessManagerPtr, store: QtObjectPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QNetworkReply — 网络响应
|
||||
# ============================================================
|
||||
def vqt6_qnetworkreply_url(reply: QtNetworkReplyPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qnetworkreply_request(reply: QtNetworkReplyPtr) -> QtNetworkRequestPtr | t.State: pass
|
||||
def vqt6_qnetworkreply_error(reply: QtNetworkReplyPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qnetworkreply_error_string(reply: QtNetworkReplyPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qnetworkreply_is_finished(reply: QtNetworkReplyPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qnetworkreply_is_running(reply: QtNetworkReplyPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qnetworkreply_abort(reply: QtNetworkReplyPtr) -> t.State: pass
|
||||
def vqt6_qnetworkreply_read(reply: QtNetworkReplyPtr, buf: t.CVoid | t.CPtr, max_size: t.CSizeT) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qnetworkreply_read_all(reply: QtNetworkReplyPtr, out_size: t.CSizeT | t.CPtr) -> t.CVoid | t.CPtr | t.State: pass
|
||||
def vqt6_qnetworkreply_bytes_available(reply: QtNetworkReplyPtr) -> t.CSizeT | t.State: pass
|
||||
def vqt6_qnetworkreply_header(reply: QtNetworkReplyPtr, header_type: t.CInt) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qnetworkreply_raw_header(reply: QtNetworkReplyPtr, header_name: t.CChar | t.CPtr, out_size: t.CSizeT | t.CPtr) -> t.CVoid | t.CPtr | t.State: pass
|
||||
def vqt6_qnetworkreply_attribute(reply: QtNetworkReplyPtr, attribute_code: t.CInt) -> QtVariantPtr | t.State: pass
|
||||
def vqt6_qnetworkreply_attribute_int(reply: QtNetworkReplyPtr, attribute_code: t.CInt, default_value: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qnetworkreply_set_raw_header(reply: QtNetworkReplyPtr, header_name: t.CChar | t.CPtr, value: t.CVoid | t.CPtr, value_size: t.CSizeT) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 套接字类型枚举
|
||||
# ============================================================
|
||||
# 套接字类型
|
||||
QT_ABSTRACT_SOCKET_TCP: t.CDefine = 0
|
||||
QT_ABSTRACT_SOCKET_UDP: t.CDefine = 1
|
||||
|
||||
# 网络层协议
|
||||
QT_NETWORK_IPV4_PROTOCOL: t.CDefine = 0
|
||||
QT_NETWORK_IPV6_PROTOCOL: t.CDefine = 1
|
||||
QT_NETWORK_ANY_IP_PROTOCOL: t.CDefine = 2
|
||||
|
||||
# 主机地址特殊情况
|
||||
QT_HOST_ADDRESS_LOCAL_HOST: t.CDefine = 0x00000000
|
||||
QT_HOST_ADDRESS_LOCAL_HOST_IPV6: t.CDefine = 0x00000001
|
||||
QT_HOST_ADDRESS_BROADCAST: t.CDefine = 0x00000002
|
||||
QT_HOST_ADDRESS_ANY_IPV4: t.CDefine = 0x00000004
|
||||
QT_HOST_ADDRESS_ANY_IPV6: t.CDefine = 0x00000005
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 已知端口常量
|
||||
# ============================================================
|
||||
QT_PORT_FTP: t.CDefine = 21
|
||||
QT_PORT_SSH: t.CDefine = 22
|
||||
QT_PORT_TELNET: t.CDefine = 23
|
||||
QT_PORT_SMTP: t.CDefine = 25
|
||||
QT_PORT_DNS: t.CDefine = 53
|
||||
QT_PORT_HTTP: t.CDefine = 80
|
||||
QT_PORT_POP3: t.CDefine = 110
|
||||
QT_PORT_IMAP: t.CDefine = 143
|
||||
QT_PORT_HTTPS: t.CDefine = 443
|
||||
QT_PORT_SMB: t.CDefine = 445
|
||||
478
includes/vqt6/_qtwidgets.py
Normal file
478
includes/vqt6/_qtwidgets.py
Normal file
@@ -0,0 +1,478 @@
|
||||
import t, c
|
||||
from stdint import *
|
||||
from vqt6._types import *
|
||||
|
||||
# ============================================================
|
||||
# vqt6/_qtwidgets.py — QtWidgets 的 t.State FFI 声明
|
||||
# ============================================================
|
||||
|
||||
# ============================================================
|
||||
# QApplication — GUI 应用入口
|
||||
# ============================================================
|
||||
# argc/argv 通过单独的 buffer 数组传入(Viper 中 C 数组使用指针+长度)
|
||||
def vqt6_qapplication_create(argc: t.CInt, argv: t.CPtr | t.CPtr) -> QtAppPtr | t.State: pass
|
||||
def vqt6_qapplication_instance() -> QtAppPtr | t.State: pass
|
||||
def vqt6_qapplication_exec(app: QtAppPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qapplication_quit(app: QtAppPtr) -> t.State: pass
|
||||
def vqt6_qapplication_exit(app: QtAppPtr, exit_code: t.CInt) -> t.State: pass
|
||||
def vqt6_qapplication_process_events(app: QtAppPtr) -> t.State: pass
|
||||
def vqt6_qapplication_desktop_width(app: QtAppPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qapplication_desktop_height(app: QtAppPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qapplication_set_quit_on_last_window_closed(app: QtAppPtr, quit: t.CInt) -> t.State: pass
|
||||
def vqt6_qapplication_quit_on_last_window_closed(app: QtAppPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QWidget — 所有窗口的基类
|
||||
# ============================================================
|
||||
def vqt6_qwidget_create() -> QtWidgetPtr | t.State: pass
|
||||
def vqt6_qwidget_create_with_parent(parent: QtWidgetPtr) -> QtWidgetPtr | t.State: pass
|
||||
def vqt6_qwidget_show(widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qwidget_hide(widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qwidget_close(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qwidget_is_visible(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qwidget_set_visible(widget: QtWidgetPtr, visible: t.CInt) -> t.State: pass
|
||||
|
||||
# 几何
|
||||
def vqt6_qwidget_set_geometry(widget: QtWidgetPtr, x: t.CInt, y: t.CInt, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_geometry(widget: QtWidgetPtr, x: t.CInt | t.CPtr, y: t.CInt | t.CPtr, w: t.CInt | t.CPtr, h: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qwidget_resize(widget: QtWidgetPtr, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_size(widget: QtWidgetPtr, w: t.CInt | t.CPtr, h: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qwidget_move(widget: QtWidgetPtr, x: t.CInt, y: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_pos(widget: QtWidgetPtr, x: t.CInt | t.CPtr, y: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qwidget_width(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qwidget_height(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qwidget_x(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qwidget_y(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
|
||||
# 文本与标题
|
||||
def vqt6_qwidget_set_window_title(widget: QtWidgetPtr, title: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qwidget_window_title(widget: QtWidgetPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qwidget_set_text(widget: QtWidgetPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qwidget_text(widget: QtWidgetPtr) -> QtStringPtr | t.State: pass
|
||||
|
||||
# 启用
|
||||
def vqt6_qwidget_set_enabled(widget: QtWidgetPtr, enabled: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_is_enabled(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
|
||||
# 父对象
|
||||
def vqt6_qwidget_set_parent(widget: QtWidgetPtr, parent: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qwidget_parent_widget(widget: QtWidgetPtr) -> QtWidgetPtr | t.State: pass
|
||||
|
||||
# 焦点
|
||||
def vqt6_qwidget_set_focus(widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qwidget_clear_focus(widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qwidget_has_focus(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qwidget_set_focus_policy(widget: QtWidgetPtr, policy: t.CInt) -> t.State: pass
|
||||
|
||||
# 更新
|
||||
def vqt6_qwidget_update(widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qwidget_repaint(widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qwidget_set_update_enabled(widget: QtWidgetPtr, enabled: t.CInt) -> t.State: pass
|
||||
|
||||
# 窗口标志
|
||||
def vqt6_qwidget_set_window_flags(widget: QtWidgetPtr, flags: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_window_flags(widget: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
|
||||
# 鼠标光标
|
||||
def vqt6_qwidget_set_cursor(widget: QtWidgetPtr, cursor: QtCursorPtr) -> t.State: pass
|
||||
def vqt6_qwidget_cursor(widget: QtWidgetPtr) -> QtCursorPtr | t.State: pass
|
||||
def vqt6_qwidget_unset_cursor(widget: QtWidgetPtr) -> t.State: pass
|
||||
|
||||
# 工具提示
|
||||
def vqt6_qwidget_set_tool_tip(widget: QtWidgetPtr, tip: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qwidget_tool_tip(widget: QtWidgetPtr) -> QtStringPtr | t.State: pass
|
||||
|
||||
# 状态栏提示
|
||||
def vqt6_qwidget_set_status_tip(widget: QtWidgetPtr, tip: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qwidget_status_tip(widget: QtWidgetPtr) -> QtStringPtr | t.State: pass
|
||||
|
||||
# 最小/最大尺寸
|
||||
def vqt6_qwidget_set_minimum_size(widget: QtWidgetPtr, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_set_maximum_size(widget: QtWidgetPtr, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_set_fixed_size(widget: QtWidgetPtr, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qwidget_minimum_size(widget: QtWidgetPtr, w: t.CInt | t.CPtr, h: t.CInt | t.CPtr) -> t.State: pass
|
||||
def vqt6_qwidget_maximum_size(widget: QtWidgetPtr, w: t.CInt | t.CPtr, h: t.CInt | t.CPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QDialog — 对话框
|
||||
# ============================================================
|
||||
def vqt6_qdialog_create() -> QtDialogPtr | t.State: pass
|
||||
def vqt6_qdialog_create_with_parent(parent: QtWidgetPtr) -> QtDialogPtr | t.State: pass
|
||||
def vqt6_qdialog_exec(dialog: QtDialogPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qdialog_done(dialog: QtDialogPtr, result: t.CInt) -> t.State: pass
|
||||
def vqt6_qdialog_accept(dialog: QtDialogPtr) -> t.State: pass
|
||||
def vqt6_qdialog_reject(dialog: QtDialogPtr) -> t.State: pass
|
||||
def vqt6_qdialog_set_result(dialog: QtDialogPtr, result: t.CInt) -> t.State: pass
|
||||
def vqt6_qdialog_result(dialog: QtDialogPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qdialog_set_modal(dialog: QtDialogPtr, modal: t.CInt) -> t.State: pass
|
||||
def vqt6_qdialog_is_modal(dialog: QtDialogPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QMainWindow — 主窗口
|
||||
# ============================================================
|
||||
def vqt6_qmainwindow_create() -> QtMainWindowPtr | t.State: pass
|
||||
def vqt6_qmainwindow_create_with_parent(parent: QtWidgetPtr) -> QtMainWindowPtr | t.State: pass
|
||||
def vqt6_qmainwindow_set_central_widget(mw: QtMainWindowPtr, widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qmainwindow_central_widget(mw: QtMainWindowPtr) -> QtWidgetPtr | t.State: pass
|
||||
def vqt6_qmainwindow_menu_bar(mw: QtMainWindowPtr) -> QtMenuBarPtr | t.State: pass
|
||||
def vqt6_qmainwindow_set_menu_bar(mw: QtMainWindowPtr, menubar: QtMenuBarPtr) -> t.State: pass
|
||||
def vqt6_qmainwindow_status_bar(mw: QtMainWindowPtr) -> QtStatusBarPtr | t.State: pass
|
||||
def vqt6_qmainwindow_set_status_bar(mw: QtMainWindowPtr, statusbar: QtStatusBarPtr) -> t.State: pass
|
||||
def vqt6_qmainwindow_add_tool_bar(mw: QtMainWindowPtr, toolbar: QtToolBarPtr) -> t.State: pass
|
||||
def vqt6_qmainwindow_add_tool_bar_break(mw: QtMainWindowPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QLabel — 标签
|
||||
# ============================================================
|
||||
def vqt6_qlabel_create() -> QtLabelPtr | t.State: pass
|
||||
def vqt6_qlabel_create_with_text(text: QtStringPtr) -> QtLabelPtr | t.State: pass
|
||||
def vqt6_qlabel_create_with_text_parent(text: QtStringPtr, parent: QtWidgetPtr) -> QtLabelPtr | t.State: pass
|
||||
def vqt6_qlabel_set_text(label: QtLabelPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qlabel_text(label: QtLabelPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qlabel_set_alignment(label: QtLabelPtr, alignment: t.CInt) -> t.State: pass
|
||||
def vqt6_qlabel_alignment(label: QtLabelPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlabel_set_pixmap(label: QtLabelPtr, pixmap: QtPixmapPtr) -> t.State: pass
|
||||
def vqt6_qlabel_pixmap(label: QtLabelPtr) -> QtPixmapPtr | t.State: pass
|
||||
def vqt6_qlabel_set_indent(label: QtLabelPtr, indent: t.CInt) -> t.State: pass
|
||||
def vqt6_qlabel_set_margin(label: QtLabelPtr, margin: t.CInt) -> t.State: pass
|
||||
def vqt6_qlabel_set_word_wrap(label: QtLabelPtr, wrap: t.CInt) -> t.State: pass
|
||||
def vqt6_qlabel_word_wrap(label: QtLabelPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QPushButton — 按钮
|
||||
# ============================================================
|
||||
def vqt6_qpushbutton_create() -> QtPushButtonPtr | t.State: pass
|
||||
def vqt6_qpushbutton_create_with_text(text: QtStringPtr) -> QtPushButtonPtr | t.State: pass
|
||||
def vqt6_qpushbutton_create_with_text_parent(text: QtStringPtr, parent: QtWidgetPtr) -> QtPushButtonPtr | t.State: pass
|
||||
def vqt6_qpushbutton_set_text(btn: QtPushButtonPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qpushbutton_text(btn: QtPushButtonPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qpushbutton_set_icon(btn: QtPushButtonPtr, icon: QtIconPtr) -> t.State: pass
|
||||
def vqt6_qpushbutton_icon(btn: QtPushButtonPtr) -> QtIconPtr | t.State: pass
|
||||
def vqt6_qpushbutton_set_default(btn: QtPushButtonPtr, is_default: t.CInt) -> t.State: pass
|
||||
def vqt6_qpushbutton_is_default(btn: QtPushButtonPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpushbutton_set_flat(btn: QtPushButtonPtr, flat: t.CInt) -> t.State: pass
|
||||
def vqt6_qpushbutton_is_flat(btn: QtPushButtonPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpushbutton_set_checkable(btn: QtPushButtonPtr, checkable: t.CInt) -> t.State: pass
|
||||
def vqt6_qpushbutton_is_checkable(btn: QtPushButtonPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpushbutton_set_checked(btn: QtPushButtonPtr, checked: t.CInt) -> t.State: pass
|
||||
def vqt6_qpushbutton_is_checked(btn: QtPushButtonPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qpushbutton_click(btn: QtPushButtonPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QLineEdit — 单行输入框
|
||||
# ============================================================
|
||||
def vqt6_qlineedit_create() -> QtLineEditPtr | t.State: pass
|
||||
def vqt6_qlineedit_create_with_text(text: QtStringPtr) -> QtLineEditPtr | t.State: pass
|
||||
def vqt6_qlineedit_create_with_text_parent(text: QtStringPtr, parent: QtWidgetPtr) -> QtLineEditPtr | t.State: pass
|
||||
def vqt6_qlineedit_text(le: QtLineEditPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qlineedit_set_text(le: QtLineEditPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qlineedit_placeholder_text(le: QtLineEditPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qlineedit_set_placeholder_text(le: QtLineEditPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qlineedit_set_max_length(le: QtLineEditPtr, max: t.CInt) -> t.State: pass
|
||||
def vqt6_qlineedit_max_length(le: QtLineEditPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlineedit_set_read_only(le: QtLineEditPtr, ro: t.CInt) -> t.State: pass
|
||||
def vqt6_qlineedit_is_read_only(le: QtLineEditPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlineedit_set_echo_mode(le: QtLineEditPtr, mode: t.CInt) -> t.State: pass
|
||||
def vqt6_qlineedit_echo_mode(le: QtLineEditPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlineedit_select_all(le: QtLineEditPtr) -> t.State: pass
|
||||
def vqt6_qlineedit_clear(le: QtLineEditPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QTextEdit / QPlainTextEdit — 多行文本编辑器
|
||||
# ============================================================
|
||||
def vqt6_qtextedit_create() -> QtTextEditPtr | t.State: pass
|
||||
def vqt6_qtextedit_create_with_parent(parent: QtWidgetPtr) -> QtTextEditPtr | t.State: pass
|
||||
def vqt6_qtextedit_to_plain_text(te: QtTextEditPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qtextedit_set_plain_text(te: QtTextEditPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qtextedit_set_html(te: QtTextEditPtr, html: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qtextedit_to_html(te: QtTextEditPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qtextedit_append(te: QtTextEditPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qtextedit_clear(te: QtTextEditPtr) -> t.State: pass
|
||||
def vqt6_qtextedit_set_read_only(te: QtTextEditPtr, ro: t.CInt) -> t.State: pass
|
||||
def vqt6_qtextedit_is_read_only(te: QtTextEditPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def vqt6_qplaintextedit_create() -> QtPlainTextEditPtr | t.State: pass
|
||||
def vqt6_qplaintextedit_create_with_parent(parent: QtWidgetPtr) -> QtPlainTextEditPtr | t.State: pass
|
||||
def vqt6_qplaintextedit_to_plain_text(pte: QtPlainTextEditPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qplaintextedit_set_plain_text(pte: QtPlainTextEditPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qplaintextedit_append(pte: QtPlainTextEditPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qplaintextedit_clear(pte: QtPlainTextEditPtr) -> t.State: pass
|
||||
def vqt6_qplaintextedit_set_read_only(pte: QtPlainTextEditPtr, ro: t.CInt) -> t.State: pass
|
||||
def vqt6_qplaintextedit_line_count(pte: QtPlainTextEditPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QCheckBox / QRadioButton — 复选/单选
|
||||
# ============================================================
|
||||
def vqt6_qcheckbox_create() -> QtCheckBoxPtr | t.State: pass
|
||||
def vqt6_qcheckbox_create_with_text(text: QtStringPtr) -> QtCheckBoxPtr | t.State: pass
|
||||
def vqt6_qcheckbox_create_with_text_parent(text: QtStringPtr, parent: QtWidgetPtr) -> QtCheckBoxPtr | t.State: pass
|
||||
def vqt6_qcheckbox_set_checked(cb: QtCheckBoxPtr, checked: t.CInt) -> t.State: pass
|
||||
def vqt6_qcheckbox_is_checked(cb: QtCheckBoxPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcheckbox_set_text(cb: QtCheckBoxPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qcheckbox_text(cb: QtCheckBoxPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qcheckbox_set_tristate(cb: QtCheckBoxPtr, tristate: t.CInt) -> t.State: pass
|
||||
def vqt6_qcheckbox_is_tristate(cb: QtCheckBoxPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def vqt6_qradiobutton_create() -> QtRadioButtonPtr | t.State: pass
|
||||
def vqt6_qradiobutton_create_with_text(text: QtStringPtr) -> QtRadioButtonPtr | t.State: pass
|
||||
def vqt6_qradiobutton_create_with_text_parent(text: QtStringPtr, parent: QtWidgetPtr) -> QtRadioButtonPtr | t.State: pass
|
||||
def vqt6_qradiobutton_set_checked(rb: QtRadioButtonPtr, checked: t.CInt) -> t.State: pass
|
||||
def vqt6_qradiobutton_is_checked(rb: QtRadioButtonPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qradiobutton_set_text(rb: QtRadioButtonPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qradiobutton_text(rb: QtRadioButtonPtr) -> QtStringPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QComboBox — 下拉框
|
||||
# ============================================================
|
||||
def vqt6_qcombobox_create() -> QtComboBoxPtr | t.State: pass
|
||||
def vqt6_qcombobox_create_with_parent(parent: QtWidgetPtr) -> QtComboBoxPtr | t.State: pass
|
||||
def vqt6_qcombobox_add_item(cb: QtComboBoxPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qcombobox_add_items(cb: QtComboBoxPtr, items: QtStringListPtr) -> t.State: pass
|
||||
def vqt6_qcombobox_insert_item(cb: QtComboBoxPtr, index: t.CInt, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qcombobox_remove_item(cb: QtComboBoxPtr, index: t.CInt) -> t.State: pass
|
||||
def vqt6_qcombobox_clear(cb: QtComboBoxPtr) -> t.State: pass
|
||||
def vqt6_qcombobox_count(cb: QtComboBoxPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcombobox_current_index(cb: QtComboBoxPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qcombobox_set_current_index(cb: QtComboBoxPtr, index: t.CInt) -> t.State: pass
|
||||
def vqt6_qcombobox_current_text(cb: QtComboBoxPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qcombobox_item_text(cb: QtComboBoxPtr, index: t.CInt) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qcombobox_set_editable(cb: QtComboBoxPtr, editable: t.CInt) -> t.State: pass
|
||||
def vqt6_qcombobox_is_editable(cb: QtComboBoxPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QListWidget — 列表控件
|
||||
# ============================================================
|
||||
def vqt6_qlistwidget_create() -> QtListWidgetPtr | t.State: pass
|
||||
def vqt6_qlistwidget_create_with_parent(parent: QtWidgetPtr) -> QtListWidgetPtr | t.State: pass
|
||||
def vqt6_qlistwidget_add_item(lw: QtListWidgetPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qlistwidget_add_items(lw: QtListWidgetPtr, items: QtStringListPtr) -> t.State: pass
|
||||
def vqt6_qlistwidget_insert_item(lw: QtListWidgetPtr, row: t.CInt, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qlistwidget_remove_item_widget(lw: QtListWidgetPtr, row: t.CInt) -> t.State: pass
|
||||
def vqt6_qlistwidget_take_item(lw: QtListWidgetPtr, row: t.CInt) -> QtListWidgetItemPtr | t.State: pass
|
||||
def vqt6_qlistwidget_clear(lw: QtListWidgetPtr) -> t.State: pass
|
||||
def vqt6_qlistwidget_count(lw: QtListWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlistwidget_current_row(lw: QtListWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlistwidget_set_current_row(lw: QtListWidgetPtr, row: t.CInt) -> t.State: pass
|
||||
def vqt6_qlistwidget_current_item_text(lw: QtListWidgetPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qlistwidget_item_text(lw: QtListWidgetPtr, row: t.CInt) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qlistwidget_set_item_text(lw: QtListWidgetPtr, row: t.CInt, text: QtStringPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QProgressBar — 进度条
|
||||
# ============================================================
|
||||
def vqt6_qprogressbar_create() -> QtProgressBarPtr | t.State: pass
|
||||
def vqt6_qprogressbar_create_with_parent(parent: QtWidgetPtr) -> QtProgressBarPtr | t.State: pass
|
||||
def vqt6_qprogressbar_set_value(pb: QtProgressBarPtr, value: t.CInt) -> t.State: pass
|
||||
def vqt6_qprogressbar_value(pb: QtProgressBarPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qprogressbar_set_minimum(pb: QtProgressBarPtr, min: t.CInt) -> t.State: pass
|
||||
def vqt6_qprogressbar_set_maximum(pb: QtProgressBarPtr, max: t.CInt) -> t.State: pass
|
||||
def vqt6_qprogressbar_set_range(pb: QtProgressBarPtr, min: t.CInt, max: t.CInt) -> t.State: pass
|
||||
def vqt6_qprogressbar_minimum(pb: QtProgressBarPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qprogressbar_maximum(pb: QtProgressBarPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qprogressbar_set_text_visible(pb: QtProgressBarPtr, visible: t.CInt) -> t.State: pass
|
||||
def vqt6_qprogressbar_set_format(pb: QtProgressBarPtr, format: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qprogressbar_reset(pb: QtProgressBarPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QSlider — 滑块
|
||||
# ============================================================
|
||||
def vqt6_qslider_create() -> QtSliderPtr | t.State: pass
|
||||
def vqt6_qslider_create_with_orientation(orientation: t.CInt) -> QtSliderPtr | t.State: pass
|
||||
def vqt6_qslider_create_with_orientation_parent(orientation: t.CInt, parent: QtWidgetPtr) -> QtSliderPtr | t.State: pass
|
||||
def vqt6_qslider_set_value(s: QtSliderPtr, value: t.CInt) -> t.State: pass
|
||||
def vqt6_qslider_value(s: QtSliderPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qslider_set_minimum(s: QtSliderPtr, min: t.CInt) -> t.State: pass
|
||||
def vqt6_qslider_set_maximum(s: QtSliderPtr, max: t.CInt) -> t.State: pass
|
||||
def vqt6_qslider_set_range(s: QtSliderPtr, min: t.CInt, max: t.CInt) -> t.State: pass
|
||||
def vqt6_qslider_set_orientation(s: QtSliderPtr, orientation: t.CInt) -> t.State: pass
|
||||
def vqt6_qslider_orientation(s: QtSliderPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qslider_set_single_step(s: QtSliderPtr, step: t.CInt) -> t.State: pass
|
||||
def vqt6_qslider_set_page_step(s: QtSliderPtr, step: t.CInt) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QSpinBox — 数字输入框
|
||||
# ============================================================
|
||||
def vqt6_qspinbox_create() -> QtSpinBoxPtr | t.State: pass
|
||||
def vqt6_qspinbox_create_with_parent(parent: QtWidgetPtr) -> QtSpinBoxPtr | t.State: pass
|
||||
def vqt6_qspinbox_value(sb: QtSpinBoxPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qspinbox_set_value(sb: QtSpinBoxPtr, value: t.CInt) -> t.State: pass
|
||||
def vqt6_qspinbox_set_minimum(sb: QtSpinBoxPtr, min: t.CInt) -> t.State: pass
|
||||
def vqt6_qspinbox_set_maximum(sb: QtSpinBoxPtr, max: t.CInt) -> t.State: pass
|
||||
def vqt6_qspinbox_set_range(sb: QtSpinBoxPtr, min: t.CInt, max: t.CInt) -> t.State: pass
|
||||
def vqt6_qspinbox_minimum(sb: QtSpinBoxPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qspinbox_maximum(sb: QtSpinBoxPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qspinbox_set_single_step(sb: QtSpinBoxPtr, step: t.CInt) -> t.State: pass
|
||||
def vqt6_qspinbox_set_prefix(sb: QtSpinBoxPtr, prefix: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qspinbox_set_suffix(sb: QtSpinBoxPtr, suffix: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qspinbox_prefix(sb: QtSpinBoxPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qspinbox_suffix(sb: QtSpinBoxPtr) -> QtStringPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 布局 - QLayout / QBoxLayout / QGridLayout / QFormLayout
|
||||
# ============================================================
|
||||
def vqt6_qlayout_add_widget(layout: QtLayoutPtr, widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qlayout_remove_widget(layout: QtLayoutPtr, widget: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qlayout_count(layout: QtLayoutPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlayout_item_at(layout: QtLayoutPtr, index: t.CInt) -> QtWidgetPtr | t.State: pass
|
||||
def vqt6_qlayout_set_contents_margins(layout: QtLayoutPtr, left: t.CInt, top: t.CInt, right: t.CInt, bottom: t.CInt) -> t.State: pass
|
||||
def vqt6_qlayout_set_spacing(layout: QtLayoutPtr, spacing: t.CInt) -> t.State: pass
|
||||
def vqt6_qlayout_spacing(layout: QtLayoutPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qlayout_invalidate(layout: QtLayoutPtr) -> t.State: pass
|
||||
|
||||
# QHBoxLayout
|
||||
def vqt6_qhboxlayout_create() -> QtBoxLayoutPtr | t.State: pass
|
||||
def vqt6_qhboxlayout_create_with_parent(parent: QtWidgetPtr) -> QtBoxLayoutPtr | t.State: pass
|
||||
def vqt6_qhboxlayout_add_layout(layout: QtBoxLayoutPtr, child: QtLayoutPtr) -> t.State: pass
|
||||
def vqt6_qhboxlayout_add_stretch(layout: QtBoxLayoutPtr, stretch: t.CInt) -> t.State: pass
|
||||
def vqt6_qhboxlayout_add_spacing(layout: QtBoxLayoutPtr, size: t.CInt) -> t.State: pass
|
||||
|
||||
# QVBoxLayout
|
||||
def vqt6_qvboxlayout_create() -> QtBoxLayoutPtr | t.State: pass
|
||||
def vqt6_qvboxlayout_create_with_parent(parent: QtWidgetPtr) -> QtBoxLayoutPtr | t.State: pass
|
||||
def vqt6_qvboxlayout_add_layout(layout: QtBoxLayoutPtr, child: QtLayoutPtr) -> t.State: pass
|
||||
def vqt6_qvboxlayout_add_stretch(layout: QtBoxLayoutPtr, stretch: t.CInt) -> t.State: pass
|
||||
def vqt6_qvboxlayout_add_spacing(layout: QtBoxLayoutPtr, size: t.CInt) -> t.State: pass
|
||||
|
||||
# QGridLayout
|
||||
def vqt6_qgridlayout_create() -> QtGridLayoutPtr | t.State: pass
|
||||
def vqt6_qgridlayout_create_with_parent(parent: QtWidgetPtr) -> QtGridLayoutPtr | t.State: pass
|
||||
def vqt6_qgridlayout_add_widget(gl: QtGridLayoutPtr, w: QtWidgetPtr, row: t.CInt, col: t.CInt) -> t.State: pass
|
||||
def vqt6_qgridlayout_add_widget_with_span(gl: QtGridLayoutPtr, w: QtWidgetPtr, row: t.CInt, col: t.CInt, row_span: t.CInt, col_span: t.CInt) -> t.State: pass
|
||||
|
||||
# QFormLayout
|
||||
def vqt6_qformlayout_create() -> QtFormLayoutPtr | t.State: pass
|
||||
def vqt6_qformlayout_create_with_parent(parent: QtWidgetPtr) -> QtFormLayoutPtr | t.State: pass
|
||||
def vqt6_qformlayout_add_row(fl: QtFormLayoutPtr, label: QtStringPtr, field: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qformlayout_add_row_widget_pair(fl: QtFormLayoutPtr, label: QtWidgetPtr, field: QtWidgetPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QStackedWidget / QTabWidget
|
||||
# ============================================================
|
||||
def vqt6_qstackedwidget_create() -> QtStackedWidgetPtr | t.State: pass
|
||||
def vqt6_qstackedwidget_create_with_parent(parent: QtWidgetPtr) -> QtStackedWidgetPtr | t.State: pass
|
||||
def vqt6_qstackedwidget_add_widget(sw: QtStackedWidgetPtr, w: QtWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qstackedwidget_remove_widget(sw: QtStackedWidgetPtr, w: QtWidgetPtr) -> t.State: pass
|
||||
def vqt6_qstackedwidget_count(sw: QtStackedWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qstackedwidget_current_index(sw: QtStackedWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qstackedwidget_set_current_index(sw: QtStackedWidgetPtr, index: t.CInt) -> t.State: pass
|
||||
def vqt6_qstackedwidget_current_widget(sw: QtStackedWidgetPtr) -> QtWidgetPtr | t.State: pass
|
||||
def vqt6_qstackedwidget_widget(sw: QtStackedWidgetPtr, index: t.CInt) -> QtWidgetPtr | t.State: pass
|
||||
|
||||
def vqt6_qtabwidget_create() -> QtTabWidgetPtr | t.State: pass
|
||||
def vqt6_qtabwidget_create_with_parent(parent: QtWidgetPtr) -> QtTabWidgetPtr | t.State: pass
|
||||
def vqt6_qtabwidget_add_tab(tw: QtTabWidgetPtr, w: QtWidgetPtr, label: QtStringPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qtabwidget_insert_tab(tw: QtTabWidgetPtr, index: t.CInt, w: QtWidgetPtr, label: QtStringPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qtabwidget_remove_tab(tw: QtTabWidgetPtr, index: t.CInt) -> t.State: pass
|
||||
def vqt6_qtabwidget_count(tw: QtTabWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qtabwidget_current_index(tw: QtTabWidgetPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qtabwidget_set_current_index(tw: QtTabWidgetPtr, index: t.CInt) -> t.State: pass
|
||||
def vqt6_qtabwidget_tab_text(tw: QtTabWidgetPtr, index: t.CInt) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qtabwidget_set_tab_text(tw: QtTabWidgetPtr, index: t.CInt, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qtabwidget_set_tabs_closable(tw: QtTabWidgetPtr, closable: t.CInt) -> t.State: pass
|
||||
def vqt6_qtabwidget_tabs_closable(tw: QtTabWidgetPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QMenuBar / QMenu / QAction
|
||||
# ============================================================
|
||||
def vqt6_qmenubar_create() -> QtMenuBarPtr | t.State: pass
|
||||
def vqt6_qmenubar_create_with_parent(parent: QtWidgetPtr) -> QtMenuBarPtr | t.State: pass
|
||||
def vqt6_qmenubar_add_menu(mb: QtMenuBarPtr, title: QtStringPtr) -> QtMenuPtr | t.State: pass
|
||||
def vqt6_qmenubar_add_menu_with_menu(mb: QtMenuBarPtr, menu: QtMenuPtr) -> t.State: pass
|
||||
def vqt6_qmenubar_add_action(mb: QtMenuBarPtr, action: QtActionPtr) -> t.State: pass
|
||||
def vqt6_qmenubar_clear(mb: QtMenuBarPtr) -> t.State: pass
|
||||
|
||||
def vqt6_qmenu_create() -> QtMenuPtr | t.State: pass
|
||||
def vqt6_qmenu_create_with_title(title: QtStringPtr) -> QtMenuPtr | t.State: pass
|
||||
def vqt6_qmenu_create_with_title_parent(title: QtStringPtr, parent: QtWidgetPtr) -> QtMenuPtr | t.State: pass
|
||||
def vqt6_qmenu_add_menu(menu: QtMenuPtr, title: QtStringPtr) -> QtMenuPtr | t.State: pass
|
||||
def vqt6_qmenu_add_action(menu: QtMenuPtr, action: QtActionPtr) -> t.State: pass
|
||||
def vqt6_qmenu_add_separator(menu: QtMenuPtr) -> t.State: pass
|
||||
def vqt6_qmenu_clear(menu: QtMenuPtr) -> t.State: pass
|
||||
def vqt6_qmenu_set_title(menu: QtMenuPtr, title: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qmenu_title(menu: QtMenuPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qmenu_add_action_with_text(menu: QtMenuPtr, text: QtStringPtr) -> QtActionPtr | t.State: pass
|
||||
|
||||
def vqt6_qaction_create() -> QtActionPtr | t.State: pass
|
||||
def vqt6_qaction_create_with_text(text: QtStringPtr) -> QtActionPtr | t.State: pass
|
||||
def vqt6_qaction_create_with_text_parent(text: QtStringPtr, parent: QtWidgetPtr) -> QtActionPtr | t.State: pass
|
||||
def vqt6_qaction_set_text(action: QtActionPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qaction_text(action: QtActionPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qaction_set_icon(action: QtActionPtr, icon: QtIconPtr) -> t.State: pass
|
||||
def vqt6_qaction_icon(action: QtActionPtr) -> QtIconPtr | t.State: pass
|
||||
def vqt6_qaction_set_shortcut(action: QtActionPtr, key_sequence: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qaction_shortcut(action: QtActionPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qaction_set_checkable(action: QtActionPtr, checkable: t.CInt) -> t.State: pass
|
||||
def vqt6_qaction_is_checkable(action: QtActionPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qaction_set_checked(action: QtActionPtr, checked: t.CInt) -> t.State: pass
|
||||
def vqt6_qaction_is_checked(action: QtActionPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qaction_set_enabled(action: QtActionPtr, enabled: t.CInt) -> t.State: pass
|
||||
def vqt6_qaction_is_enabled(action: QtActionPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qaction_trigger(action: QtActionPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QStatusBar / QToolBar
|
||||
# ============================================================
|
||||
def vqt6_qstatusbar_create() -> QtStatusBarPtr | t.State: pass
|
||||
def vqt6_qstatusbar_create_with_parent(parent: QtWidgetPtr) -> QtStatusBarPtr | t.State: pass
|
||||
def vqt6_qstatusbar_show_message(sb: QtStatusBarPtr, message: QtStringPtr, timeout_ms: t.CInt) -> t.State: pass
|
||||
def vqt6_qstatusbar_clear_message(sb: QtStatusBarPtr) -> t.State: pass
|
||||
def vqt6_qstatusbar_current_message(sb: QtStatusBarPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qstatusbar_add_widget(sb: QtStatusBarPtr, w: QtWidgetPtr, stretch: t.CInt) -> t.State: pass
|
||||
def vqt6_qstatusbar_add_permanent_widget(sb: QtStatusBarPtr, w: QtWidgetPtr, stretch: t.CInt) -> t.State: pass
|
||||
|
||||
def vqt6_qtoolbar_create() -> QtToolBarPtr | t.State: pass
|
||||
def vqt6_qtoolbar_create_with_parent(parent: QtWidgetPtr) -> QtToolBarPtr | t.State: pass
|
||||
def vqt6_qtoolbar_add_widget(tb: QtToolBarPtr, w: QtWidgetPtr) -> QtActionPtr | t.State: pass
|
||||
def vqt6_qtoolbar_add_action(tb: QtToolBarPtr, action: QtActionPtr) -> t.State: pass
|
||||
def vqt6_qtoolbar_add_separator(tb: QtToolBarPtr) -> t.State: pass
|
||||
def vqt6_qtoolbar_set_icon_size(tb: QtToolBarPtr, w: t.CInt, h: t.CInt) -> t.State: pass
|
||||
def vqt6_qtoolbar_set_orientation(tb: QtToolBarPtr, orientation: t.CInt) -> t.State: pass
|
||||
def vqt6_qtoolbar_orientation(tb: QtToolBarPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QMessageBox — 消息对话框(静态方法)
|
||||
# ============================================================
|
||||
def vqt6_qmessagebox_information(parent: QtWidgetPtr, title: QtStringPtr, text: QtStringPtr, buttons: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qmessagebox_warning(parent: QtWidgetPtr, title: QtStringPtr, text: QtStringPtr, buttons: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qmessagebox_critical(parent: QtWidgetPtr, title: QtStringPtr, text: QtStringPtr, buttons: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qmessagebox_question(parent: QtWidgetPtr, title: QtStringPtr, text: QtStringPtr, buttons: t.CInt) -> t.CInt | t.State: pass
|
||||
def vqt6_qmessagebox_about(parent: QtWidgetPtr, title: QtStringPtr, text: QtStringPtr) -> t.State: pass
|
||||
def vqt6_qmessagebox_about_qt(parent: QtWidgetPtr) -> t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QFileDialog — 文件选择对话框(静态方法)
|
||||
# ============================================================
|
||||
def vqt6_qfiledialog_get_open_file_name(parent: QtWidgetPtr, caption: QtStringPtr, dir: QtStringPtr, filter: QtStringPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qfiledialog_get_save_file_name(parent: QtWidgetPtr, caption: QtStringPtr, dir: QtStringPtr, filter: QtStringPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qfiledialog_get_existing_directory(parent: QtWidgetPtr, caption: QtStringPtr, dir: QtStringPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qfiledialog_get_open_file_names(parent: QtWidgetPtr, caption: QtStringPtr, dir: QtStringPtr, filter: QtStringPtr) -> QtStringListPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# QColorDialog / QFontDialog / QInputDialog — 各种对话框
|
||||
# ============================================================
|
||||
def vqt6_qcolordialog_get_color(initial: QtColorPtr, parent: QtWidgetPtr, title: QtStringPtr) -> QtColorPtr | t.State: pass
|
||||
def vqt6_qfontdialog_get_font(initial: QtFontPtr, parent: QtWidgetPtr, title: QtStringPtr) -> QtFontPtr | t.State: pass
|
||||
def vqt6_qinputdialog_get_text(parent: QtWidgetPtr, title: QtStringPtr, label: QtStringPtr, echo_mode: t.CInt, text: QtStringPtr, ok_pressed: t.CInt | t.CPtr) -> QtStringPtr | t.State: pass
|
||||
def vqt6_qinputdialog_get_int(parent: QtWidgetPtr, title: QtStringPtr, label: QtStringPtr, value: t.CInt, min_val: t.CInt, max_val: t.CInt, step: t.CInt, ok_pressed: t.CInt | t.CPtr) -> t.CInt | t.State: pass
|
||||
def vqt6_qinputdialog_get_double(parent: QtWidgetPtr, title: QtStringPtr, label: QtStringPtr, value: t.CDouble, min_val: t.CDouble, max_val: t.CDouble, decimals: t.CInt, ok_pressed: t.CInt | t.CPtr) -> t.CDouble | t.State: pass
|
||||
def vqt6_qinputdialog_get_item(parent: QtWidgetPtr, title: QtStringPtr, label: QtStringPtr, items: QtStringListPtr, current: t.CInt, editable: t.CInt, ok_pressed: t.CInt | t.CPtr) -> QtStringPtr | t.State: pass
|
||||
186
includes/vqt6/_types.py
Normal file
186
includes/vqt6/_types.py
Normal file
@@ -0,0 +1,186 @@
|
||||
import t
|
||||
from stdint import *
|
||||
|
||||
# ============================================================
|
||||
# vqt6/_types.py — 公共类型定义
|
||||
#
|
||||
# Qt6 C++ 类在 Viper 端都是不透明指针 (void*)
|
||||
# 不暴露 C++ 类的内部布局,只暴露指针
|
||||
# ============================================================
|
||||
|
||||
# 不透明指针 typedef(Qt6 C++ 类的 Viper 端表示)
|
||||
QtObjectPtr: t.CTypedef = t.CVoid | t.CPtr # void* 通用不透明指针
|
||||
QtStringPtr: t.CTypedef = t.CVoid | t.CPtr # QString*
|
||||
QtByteArrayPtr: t.CTypedef = t.CVoid | t.CPtr # QByteArray*
|
||||
QtVariantPtr: t.CTypedef = t.CVoid | t.CPtr # QVariant*
|
||||
QtObjectListPtr: t.CTypedef = t.CVoid | t.CPtr # QList<QObject*>*
|
||||
QtStringListPtr: t.CTypedef = t.CVoid | t.CPtr # QStringList*
|
||||
QtByteArrayListPtr: t.CTypedef = t.CVoid | t.CPtr # QList<QByteArray>*
|
||||
QtEventPtr: t.CTypedef = t.CVoid | t.CPtr # QEvent*
|
||||
|
||||
# QtCore
|
||||
QtCoreAppPtr: t.CTypedef = t.CVoid | t.CPtr # QCoreApplication*
|
||||
QtTimerPtr: t.CTypedef = t.CVoid | t.CPtr # QTimer*
|
||||
QtObjectPtr: t.CTypedef = t.CVoid | t.CPtr # QObject*
|
||||
QtThreadPtr: t.CTypedef = t.CVoid | t.CPtr # QThread*
|
||||
QtMutexPtr: t.CTypedef = t.CVoid | t.CPtr # QMutex*
|
||||
QtWaitConditionPtr: t.CTypedef = t.CVoid | t.CPtr # QWaitCondition*
|
||||
|
||||
# QtGui
|
||||
QtColorPtr: t.CTypedef = t.CVoid | t.CPtr # QColor*
|
||||
QtFontPtr: t.CTypedef = t.CVoid | t.CPtr # QFont*
|
||||
QtFontMetricsPtr: t.CTypedef = t.CVoid | t.CPtr # QFontMetrics*
|
||||
QtPixmapPtr: t.CTypedef = t.CVoid | t.CPtr # QPixmap*
|
||||
QtImagePtr: t.CTypedef = t.CVoid | t.CPtr # QImage*
|
||||
QtPainterPtr: t.CTypedef = t.CVoid | t.CPtr # QPainter*
|
||||
QtPenPtr: t.CTypedef = t.CVoid | t.CPtr # QPen*
|
||||
QtBrushPtr: t.CTypedef = t.CVoid | t.CPtr # QBrush*
|
||||
QtIconPtr: t.CTypedef = t.CVoid | t.CPtr # QIcon*
|
||||
QtKeyEventPtr: t.CTypedef = t.CVoid | t.CPtr # QKeyEvent*
|
||||
QtMouseEventPtr: t.CTypedef = t.CVoid | t.CPtr # QMouseEvent*
|
||||
QtResizeEventPtr: t.CTypedef = t.CVoid | t.CPtr # QResizeEvent*
|
||||
QtPaintEventPtr: t.CTypedef = t.CVoid | t.CPtr # QPaintEvent*
|
||||
QtCloseEventPtr: t.CTypedef = t.CVoid | t.CPtr # QCloseEvent*
|
||||
QtCursorPtr: t.CTypedef = t.CVoid | t.CPtr # QCursor*
|
||||
|
||||
# QtWidgets
|
||||
QtAppPtr: t.CTypedef = t.CVoid | t.CPtr # QApplication*
|
||||
QtWidgetPtr: t.CTypedef = t.CVoid | t.CPtr # QWidget*
|
||||
QtDialogPtr: t.CTypedef = t.CVoid | t.CPtr # QDialog*
|
||||
QtMainWindowPtr: t.CTypedef = t.CVoid | t.CPtr # QMainWindow*
|
||||
QtLabelPtr: t.CTypedef = t.CVoid | t.CPtr # QLabel*
|
||||
QtPushButtonPtr: t.CTypedef = t.CVoid | t.CPtr # QPushButton*
|
||||
QtLineEditPtr: t.CTypedef = t.CVoid | t.CPtr # QLineEdit*
|
||||
QtTextEditPtr: t.CTypedef = t.CVoid | t.CPtr # QTextEdit*
|
||||
QtPlainTextEditPtr: t.CTypedef = t.CVoid | t.CPtr # QPlainTextEdit*
|
||||
QtCheckBoxPtr: t.CTypedef = t.CVoid | t.CPtr # QCheckBox*
|
||||
QtRadioButtonPtr: t.CTypedef = t.CVoid | t.CPtr # QRadioButton*
|
||||
QtComboBoxPtr: t.CTypedef = t.CVoid | t.CPtr # QComboBox*
|
||||
QtListWidgetPtr: t.CTypedef = t.CVoid | t.CPtr # QListWidget*
|
||||
QtListWidgetItemPtr: t.CTypedef = t.CVoid | t.CPtr # QListWidgetItem*
|
||||
QtProgressBarPtr: t.CTypedef = t.CVoid | t.CPtr # QProgressBar*
|
||||
QtSliderPtr: t.CTypedef = t.CVoid | t.CPtr # QSlider*
|
||||
QtSpinBoxPtr: t.CTypedef = t.CVoid | t.CPtr # QSpinBox*
|
||||
QtLayoutPtr: t.CTypedef = t.CVoid | t.CPtr # QLayout*
|
||||
QtBoxLayoutPtr: t.CTypedef = t.CVoid | t.CPtr # QHBoxLayout / QVBoxLayout*
|
||||
QtGridLayoutPtr: t.CTypedef = t.CVoid | t.CPtr # QGridLayout*
|
||||
QtFormLayoutPtr: t.CTypedef = t.CVoid | t.CPtr # QFormLayout*
|
||||
QtStackedWidgetPtr: t.CTypedef = t.CVoid | t.CPtr # QStackedWidget*
|
||||
QtTabWidgetPtr: t.CTypedef = t.CVoid | t.CPtr # QTabWidget*
|
||||
QtMenuBarPtr: t.CTypedef = t.CVoid | t.CPtr # QMenuBar*
|
||||
QtMenuPtr: t.CTypedef = t.CVoid | t.CPtr # QMenu*
|
||||
QtActionPtr: t.CTypedef = t.CVoid | t.CPtr # QAction*
|
||||
QtStatusBarPtr: t.CTypedef = t.CVoid | t.CPtr # QStatusBar*
|
||||
QtToolBarPtr: t.CTypedef = t.CVoid | t.CPtr # QToolBar*
|
||||
QtMessageBoxPtr: t.CTypedef = t.CVoid | t.CPtr # QMessageBox*
|
||||
QtFileDialogPtr: t.CTypedef = t.CVoid | t.CPtr # QFileDialog*
|
||||
QtColorDialogPtr: t.CTypedef = t.CVoid | t.CPtr # QColorDialog*
|
||||
QtFontDialogPtr: t.CTypedef = t.CVoid | t.CPtr # QFontDialog*
|
||||
QtInputDialogPtr: t.CTypedef = t.CVoid | t.CPtr # QInputDialog*
|
||||
|
||||
# QtNetwork
|
||||
QtTcpSocketPtr: t.CTypedef = t.CVoid | t.CPtr # QTcpSocket*
|
||||
QtUdpSocketPtr: t.CTypedef = t.CVoid | t.CPtr # QUdpSocket*
|
||||
QtHostAddressPtr: t.CTypedef = t.CVoid | t.CPtr # QHostAddress*
|
||||
QtAbstractSocketPtr: t.CTypedef = t.CVoid | t.CPtr # QAbstractSocket*
|
||||
QtNetworkAccessManagerPtr: t.CTypedef = t.CVoid | t.CPtr # QNetworkAccessManager*
|
||||
QtNetworkReplyPtr: t.CTypedef = t.CVoid | t.CPtr # QNetworkReply*
|
||||
QtNetworkRequestPtr: t.CTypedef = t.CVoid | t.CPtr # QNetworkRequest*
|
||||
|
||||
# ============================================================
|
||||
# Qt 通用常量(C++ 枚举值的 C 兼容定义)
|
||||
# ============================================================
|
||||
|
||||
# Qt 键盘按键 (Qt::Key)
|
||||
QT_KEY_ESCAPE: t.CDefine = 0x01000000
|
||||
QT_KEY_TAB: t.CDefine = 0x01000001
|
||||
QT_KEY_BACKTAB: t.CDefine = 0x01000002
|
||||
QT_KEY_BACKSPACE: t.CDefine = 0x01000003
|
||||
QT_KEY_RETURN: t.CDefine = 0x01000004
|
||||
QT_KEY_ENTER: t.CDefine = 0x01000005
|
||||
QT_KEY_INSERT: t.CDefine = 0x01000006
|
||||
QT_KEY_DELETE: t.CDefine = 0x01000007
|
||||
QT_KEY_PAUSE: t.CDefine = 0x01000008
|
||||
QT_KEY_PRINT: t.CDefine = 0x01000009
|
||||
QT_KEY_HOME: t.CDefine = 0x01000010
|
||||
QT_KEY_END: t.CDefine = 0x01000011
|
||||
QT_KEY_LEFT: t.CDefine = 0x01000012
|
||||
QT_KEY_UP: t.CDefine = 0x01000013
|
||||
QT_KEY_RIGHT: t.CDefine = 0x01000014
|
||||
QT_KEY_DOWN: t.CDefine = 0x01000015
|
||||
QT_KEY_PAGEUP: t.CDefine = 0x01000016
|
||||
QT_KEY_PAGEDOWN: t.CDefine = 0x01000017
|
||||
QT_KEY_SHIFT: t.CDefine = 0x01000020
|
||||
QT_KEY_CONTROL: t.CDefine = 0x01000021
|
||||
QT_KEY_META: t.CDefine = 0x01000022
|
||||
QT_KEY_ALT: t.CDefine = 0x01000023
|
||||
QT_KEY_F1: t.CDefine = 0x01000030
|
||||
QT_KEY_F2: t.CDefine = 0x01000031
|
||||
QT_KEY_F12: t.CDefine = 0x0100003b
|
||||
QT_KEY_SPACE: t.CDefine = 0x20
|
||||
QT_KEY_A: t.CDefine = 0x41
|
||||
QT_KEY_Z: t.CDefine = 0x5a
|
||||
QT_KEY_0: t.CDefine = 0x30
|
||||
QT_KEY_9: t.CDefine = 0x39
|
||||
|
||||
# Qt 鼠标按键 (Qt::MouseButton)
|
||||
QT_NO_BUTTON: t.CDefine = 0x00000000
|
||||
QT_LEFT_BUTTON: t.CDefine = 0x00000001
|
||||
QT_RIGHT_BUTTON: t.CDefine = 0x00000002
|
||||
QT_MID_BUTTON: t.CDefine = 0x00000004
|
||||
|
||||
# Qt::AlignmentFlag
|
||||
QT_ALIGN_LEFT: t.CDefine = 0x0001
|
||||
QT_ALIGN_RIGHT: t.CDefine = 0x0002
|
||||
QT_ALIGN_HCENTER: t.CDefine = 0x0004
|
||||
QT_ALIGN_TOP: t.CDefine = 0x0020
|
||||
QT_ALIGN_BOTTOM: t.CDefine = 0x0040
|
||||
QT_ALIGN_VCENTER: t.CDefine = 0x0080
|
||||
QT_ALIGN_CENTER: t.CDefine = QT_ALIGN_HCENTER | QT_ALIGN_VCENTER
|
||||
|
||||
# Qt::Orientation
|
||||
QT_HORIZONTAL: t.CDefine = 0x1
|
||||
QT_VERTICAL: t.CDefine = 0x2
|
||||
|
||||
# Qt 焦点
|
||||
QT_NO_FOCUS: t.CDefine = 0x00
|
||||
QT_TAB_FOCUS: t.CDefine = 0x01
|
||||
QT_CLICK_FOCUS: t.CDefine = 0x02
|
||||
QT_STRONG_FOCUS: t.CDefine = QT_TAB_FOCUS | QT_CLICK_FOCUS
|
||||
QT_WHEEL_FOCUS: t.CDefine = 0x04
|
||||
QT_ALL_FOCUS: t.CDefine = QT_STRONG_FOCUS | QT_WHEEL_FOCUS
|
||||
|
||||
# Qt::WindowFlag
|
||||
QT_WINDOW: t.CDefine = 0x00000001
|
||||
QT_DIALOG: t.CDefine = 0x00000002 | QT_WINDOW
|
||||
QT_SHEET: t.CDefine = 0x00000004 | QT_WINDOW
|
||||
QT_DRAWER: t.CDefine = QT_SHEET | 0x00000008
|
||||
QT_POPUP: t.CDefine = 0x00000008 | QT_WINDOW
|
||||
QT_TOOL: t.CDefine = 0x0000000a | QT_WINDOW
|
||||
QT_TOOLTIP: t.CDefine = 0x0000000c | QT_WINDOW
|
||||
QT_SPLASH_SCREEN: t.CDefine = 0x0000000e | QT_WINDOW
|
||||
|
||||
QT_WINDOW_TITLE: t.CDefine = 0x00000001
|
||||
QT_WINDOW_SYSTEM_MENU: t.CDefine = 0x00000002
|
||||
QT_WINDOW_MIN_MAX_BUTTONS: t.CDefine = 0x00000004
|
||||
QT_WINDOW_CLOSE_BUTTON: t.CDefine = 0x08000000
|
||||
QT_WINDOW_CONTEXT_HELP_BUTTON: t.CDefine = 0x00000008
|
||||
|
||||
# QMessageBox 标准按钮
|
||||
QT_OK: t.CDefine = 0x00000400
|
||||
QT_CANCEL: t.CDefine = 0x00400000
|
||||
QT_YES: t.CDefine = 0x00004000
|
||||
QT_NO: t.CDefine = 0x00010000
|
||||
QT_CLOSE: t.CDefine = 0x00200000
|
||||
|
||||
# 事件类型
|
||||
QT_EVENT_NONE: t.CDefine = 0
|
||||
QT_EVENT_KEY: t.CDefine = 6
|
||||
QT_EVENT_MOUSE_BUTTON_PRESS: t.CDefine = 2
|
||||
QT_EVENT_MOUSE_BUTTON_RELEASE: t.CDefine = 3
|
||||
QT_EVENT_MOUSE_MOVE: t.CDefine = 5
|
||||
QT_EVENT_PAINT: t.CDefine = 12
|
||||
QT_EVENT_RESIZE: t.CDefine = 14
|
||||
QT_EVENT_CLOSE: t.CDefine = 19
|
||||
QT_EVENT_SHOW: t.CDefine = 17
|
||||
QT_EVENT_HIDE: t.CDefine = 18
|
||||
Reference in New Issue
Block a user