修复无法运行错误

This commit is contained in:
Irony 2019-06-04 14:11:24 +08:00
parent 3f2dcd7ad1
commit 1d481eb1ed
6 changed files with 69 additions and 7 deletions

View file

@ -53,6 +53,7 @@ encoding//QSplitter/RewriteHandle.py=utf-8
encoding//QTableWidget/TableWidget.py=utf-8 encoding//QTableWidget/TableWidget.py=utf-8
encoding//QThread/moveToThread.py=utf-8 encoding//QThread/moveToThread.py=utf-8
encoding//QTreeWidget/ParsingJson.py=utf-8 encoding//QTreeWidget/ParsingJson.py=utf-8
encoding//QTreeWidget/testTreeWidget.py=utf-8
encoding//QWebEngineView/GetCookie.py=utf-8 encoding//QWebEngineView/GetCookie.py=utf-8
encoding//QWebEngineView/JsSignals.py=utf-8 encoding//QWebEngineView/JsSignals.py=utf-8
encoding//QWebView/DreamTree.py=utf-8 encoding//QWebView/DreamTree.py=utf-8

View file

View file

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'testTree.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# 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)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())

0
QTreeWidget/__init__.py Normal file
View file

View file

@ -9,28 +9,32 @@ Created on 2017年4月20日
@description: @description:
''' '''
import sys import sys
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QApplication from PyQt5.QtWidgets import QDialog, QApplication
from QTreeWidget.testTree import Ui_Form
class graphAnalysis(QDialog,Ui_Form): from Lib.testTree import Ui_Form # @UnresolvedImport
class graphAnalysis(QDialog, Ui_Form):
def __init__(self): def __init__(self):
super(graphAnalysis, self).__init__() super(graphAnalysis, self).__init__()
self.setupUi(self) self.setupUi(self)
# 点击父节点 # 点击父节点
self.treeWidget.itemChanged.connect(self.handleChanged) self.treeWidget.itemChanged.connect(self.handleChanged)
def handleChanged(self,item,column):
def handleChanged(self, item, column):
count = item.childCount() count = item.childCount()
if item.checkState(column) == Qt.Checked: if item.checkState(column) == Qt.Checked:
for index in range(count): for index in range(count):
item.child(index).setCheckState(0,Qt.Checked) item.child(index).setCheckState(0, Qt.Checked)
if item.checkState(column) == Qt.Unchecked: if item.checkState(column) == Qt.Unchecked:
for index in range(count): for index in range(count):
item.child(index).setCheckState(0,Qt.Unchecked) item.child(index).setCheckState(0, Qt.Unchecked)
if __name__ =="__main__": if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = graphAnalysis() w = graphAnalysis()
w.show() w.show()
sys.exit(app.exec_()) sys.exit(app.exec_())