diff --git a/QTreeWidget/README.md b/QTreeWidget/README.md index f47b05a..1851d82 100644 --- a/QTreeWidget/README.md +++ b/QTreeWidget/README.md @@ -11,9 +11,10 @@ ![ParsingJson](ScreenShot/ParsingJson.png) + ## 2、点击父节点全选/取消全选子节点 [运行 testTreeWidget.py](testTreeWidget.py) 点击父节点全选/取消全选子节点 -![testTreeWidget](allSelect.png) \ No newline at end of file +![testTreeWidget](ScreenShot/allSelectNode.png) \ No newline at end of file diff --git a/QTreeWidget/ScreenShot/allSelect.png b/QTreeWidget/ScreenShot/allSelectNode.png similarity index 100% rename from QTreeWidget/ScreenShot/allSelect.png rename to QTreeWidget/ScreenShot/allSelectNode.png diff --git a/QTreeWidget/testTree.py b/QTreeWidget/testTree.py deleted file mode 100644 index b317521..0000000 --- a/QTreeWidget/testTree.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'testTree.ui' -# -# Created by: PyQt5 UI code generator 5.11.3 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(719, 544) - self.treeWidget = QtWidgets.QTreeWidget(Form) - self.treeWidget.setGeometry(QtCore.QRect(80, 80, 256, 192)) - self.treeWidget.setObjectName("treeWidget") - item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget) - item_0.setCheckState(0, QtCore.Qt.Unchecked) - item_1 = QtWidgets.QTreeWidgetItem(item_0) - item_1.setCheckState(0, QtCore.Qt.Unchecked) - item_1 = QtWidgets.QTreeWidgetItem(item_0) - item_1.setCheckState(0, QtCore.Qt.Unchecked) - item_1 = QtWidgets.QTreeWidgetItem(item_0) - item_1.setCheckState(0, QtCore.Qt.Unchecked) - item_1 = QtWidgets.QTreeWidgetItem(item_0) - item_1.setCheckState(0, QtCore.Qt.Unchecked) - item_1 = QtWidgets.QTreeWidgetItem(item_0) - item_1.setCheckState(0, QtCore.Qt.Unchecked) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - _translate = QtCore.QCoreApplication.translate - Form.setWindowTitle(_translate("Form", "Form")) - self.treeWidget.headerItem().setText(0, _translate("Form", "测试")) - __sortingEnabled = self.treeWidget.isSortingEnabled() - self.treeWidget.setSortingEnabled(False) - self.treeWidget.topLevelItem(0).setText(0, _translate("Form", "测试1")) - self.treeWidget.topLevelItem(0).child(0).setText(0, _translate("Form", "子节点1")) - self.treeWidget.topLevelItem(0).child(1).setText(0, _translate("Form", "字节点2")) - self.treeWidget.topLevelItem(0).child(2).setText(0, _translate("Form", "字节点3")) - self.treeWidget.topLevelItem(0).child(3).setText(0, _translate("Form", "字节点4")) - self.treeWidget.topLevelItem(0).child(4).setText(0, _translate("Form", "字节点5")) - self.treeWidget.setSortingEnabled(__sortingEnabled) - diff --git a/QTreeWidget/testTreeWidget.py b/QTreeWidget/testTreeWidget.py index 49e931c..30420d1 100644 --- a/QTreeWidget/testTreeWidget.py +++ b/QTreeWidget/testTreeWidget.py @@ -17,6 +17,7 @@ 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()