109 Star 860 Fork 307

PyQt5 / PyQt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
testTreeWidget.py 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
Irony 提交于 2021-07-13 14:52 . support PySide2
#!/usr/bin/env python
# encoding: utf-8
"""
Created on 2017年4月20日
@author: weike32
@site: https://pyqt.site , https://github.com/weike32
@email: 394967319@qq.com
@file: CopyContent
@description:
"""
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QApplication
from Lib.testTree import Ui_Form # @UnresolvedImport
class graphAnalysis(QDialog, Ui_Form):
def __init__(self):
super(graphAnalysis, self).__init__()
self.setupUi(self)
# 点击父节点
self.treeWidget.itemChanged.connect(self.handleChanged)
def handleChanged(self, item, column):
count = item.childCount()
if item.checkState(column) == Qt.Checked:
for index in range(count):
item.child(index).setCheckState(0, Qt.Checked)
if item.checkState(column) == Qt.Unchecked:
for index in range(count):
item.child(index).setCheckState(0, Qt.Unchecked)
if __name__ == "__main__":
app = QApplication(sys.argv)
w = graphAnalysis()
w.show()
sys.exit(app.exec_())
Python
1
https://gitee.com/PyQt5/PyQt.git
git@gitee.com:PyQt5/PyQt.git
PyQt5
PyQt
PyQt
master

搜索帮助