2 Star 10 Fork 7

终點起點/PySide6-UI-Demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
pyqtutil.py 1003 Bytes
一键复制 编辑 原始数据 按行查看 历史
终點起點 提交于 2024-06-28 14:21 +08:00 . 新增部分控件
#import types
import datetime
from shiboken6 import Shiboken
#from PySide6.QtWidgets import *
#from PySide6.QtGui import *
from PySide6.QtCore import *
'''
python对象转Qt对象
'''
class PyQtUtil(object):
class QDateTime(Shiboken.Object):
@staticmethod
def fromPython(dt:datetime.datetime):
#由于python的datetime的毫秒是0-999999,而qt中的毫秒是0~999,故毫秒需要特别处理
return QDateTime(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second,int(dt.microsecond/1000))
class QDate(Shiboken.Object):
@staticmethod
def fromPython(date:datetime.date):
return QDate(date.year,date.month,date.day)
class QTime(Shiboken.Object):
@staticmethod
def fromPython(dt:datetime.datetime):
#由于python的datetime的毫秒是0-999999,而qt中的毫秒是0~999,故毫秒需要特别处理
return QTime(dt.hour,dt.minute,dt.second,int(dt.microsecond/1000))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/johnjiangw/pyside6-ui-demo.git
git@gitee.com:johnjiangw/pyside6-ui-demo.git
johnjiangw
pyside6-ui-demo
PySide6-UI-Demo
master

搜索帮助