2019-04-20 11:32:46 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
'''
|
|
|
|
Created on 2017年4月20日
|
|
|
|
@author: weike32
|
|
|
|
@site: https://pyqt5.com , https://github.com/weike32
|
|
|
|
@email: 394967319@qq.com
|
|
|
|
@file: CopyContent
|
|
|
|
@description:
|
|
|
|
'''
|
|
|
|
import sys
|
2019-06-04 14:11:24 +08:00
|
|
|
|
2019-04-20 11:32:46 +08:00
|
|
|
from PyQt5.QtCore import Qt
|
|
|
|
from PyQt5.QtWidgets import QDialog, QApplication
|
|
|
|
|
2019-06-04 14:11:24 +08:00
|
|
|
from Lib.testTree import Ui_Form # @UnresolvedImport
|
|
|
|
|
|
|
|
|
|
|
|
class graphAnalysis(QDialog, Ui_Form):
|
2019-04-20 11:32:46 +08:00
|
|
|
def __init__(self):
|
|
|
|
super(graphAnalysis, self).__init__()
|
|
|
|
self.setupUi(self)
|
2019-04-20 11:47:18 +08:00
|
|
|
# 点击父节点
|
2019-04-20 11:32:46 +08:00
|
|
|
self.treeWidget.itemChanged.connect(self.handleChanged)
|
2019-06-04 14:11:24 +08:00
|
|
|
|
|
|
|
def handleChanged(self, item, column):
|
2019-04-20 11:32:46 +08:00
|
|
|
count = item.childCount()
|
|
|
|
if item.checkState(column) == Qt.Checked:
|
|
|
|
for index in range(count):
|
2019-06-04 14:11:24 +08:00
|
|
|
item.child(index).setCheckState(0, Qt.Checked)
|
2019-04-20 11:32:46 +08:00
|
|
|
if item.checkState(column) == Qt.Unchecked:
|
|
|
|
for index in range(count):
|
2019-06-04 14:11:24 +08:00
|
|
|
item.child(index).setCheckState(0, Qt.Unchecked)
|
2019-04-20 11:32:46 +08:00
|
|
|
|
|
|
|
|
2019-06-04 14:11:24 +08:00
|
|
|
if __name__ == "__main__":
|
2019-04-20 11:32:46 +08:00
|
|
|
app = QApplication(sys.argv)
|
|
|
|
w = graphAnalysis()
|
|
|
|
w.show()
|
2019-06-04 14:11:24 +08:00
|
|
|
sys.exit(app.exec_())
|