本文整理汇总了Python中PyQt5.QtWidgets.QTreeWidgetItem方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QTreeWidgetItem方法的具体用法?Python QtWidgets.QTreeWidgetItem怎么用?Python QtWidgets.QTreeWidgetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QTreeWidgetItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def setupUi(self, Master):
Master.setObjectName("Master")
Master.resize(718, 477)
self.verticalLayout = QtWidgets.QVBoxLayout(Master)
self.verticalLayout.setObjectName("verticalLayout")
self.splitter = QtWidgets.QSplitter(Master)
self.splitter.setOrientation(QtCore.Qt.Vertical)
self.splitter.setObjectName("splitter")
self.tab_widget = QtWidgets.QTabWidget(self.splitter)
self.tab_widget.setObjectName("tab_widget")
self.docker = QtWidgets.QDockWidget(self.splitter)
self.docker.setObjectName("docker")
self.docker.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea)
self.log_widget = QtWidgets.QTreeWidget(self.docker)
self.log_widget.setHeaderItem(QtWidgets.QTreeWidgetItem(["date", "origin", "type", "message"]))
self.docker.setWidget(self.log_widget)
self.verticalLayout.addWidget(self.splitter)
self.tab_widget.setCurrentIndex(-1)
QtCore.QMetaObject.connectSlotsByName(Master)
Master.setWindowTitle("IDASec")
示例2: newScreen
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def newScreen(self):
item = self.treeview_params.currentItem()
if not item:
self.logview.append("<font color=red>" + _("Please select a category before creating new screen") + "</font>")
return
if item.parent() is not None:
item = item.parent()
category = utf8(item.text(0))
nsn = widgets.QInputDialog.getText(self, 'DDT4All', _('Enter screen name'))
if not nsn[1]:
return
newscreenname = utf8(nsn[0])
if newscreenname:
self.paramview.createScreen(newscreenname, category)
item.addChild(widgets.QTreeWidgetItem([newscreenname]))
self.screennames.append(newscreenname)
示例3: add_row
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def add_row(self, offset, name, size, value, is_array):
parent = QtWidgets.QTreeWidgetItem(self.tree)
parent.setText(0, "%d" % offset)
parent.setText(1, "%s" % name)
parent.setText(2, "%d" % size)
if is_array:
parent.setExpanded(self.expand_arrays)
parent.setText(3, "Array [%d]" % len(value))
size = sizeof(value._type_)
for idx, val in enumerate(value):
child = QtWidgets.QTreeWidgetItem(parent)
child.setText(0, "%d" % (offset+(size*idx)))
child.setText(1, "%s[%d]" % (name, idx))
child.setText(2, "%d" % size)
child.setText(3, "%#x" % val)
else:
parent.setText(3, "%#x" % value)
示例4: populate_tree
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def populate_tree(self, d):
# Clear previous items
self.tree.clear()
# Build the tree
for key in d:
src_file_item = QtWidgets.QTreeWidgetItem(self.tree)
src_file_item.setText(0, key)
src_file_item.ea = BADADDR
for ea, name, str_data in d[key]:
item = QtWidgets.QTreeWidgetItem(src_file_item)
item.setText(0, "%s [0x%08x] %s" % (name, ea, str_data))
item.ea = ea
self.tree.itemDoubleClicked.connect(handler)
示例5: ParseCategory
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def ParseCategory(self, items):
"""
Parses a XML category
"""
nodes = []
for item in items:
node = QtWidgets.QTreeWidgetItem()
node.setText(0, item[0])
# see if it's a category or a level
if isinstance(item[1], str):
# it's a level
node.setData(0, Qt.UserRole, item[1])
node.setToolTip(0, item[1])
else:
# it's a category
children = self.ParseCategory(item[1])
for cnode in children:
node.addChild(cnode)
node.setToolTip(0, item[0])
nodes.append(node)
return tuple(nodes)
示例6: add_cpu_sensors
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def add_cpu_sensors(self):
"""Add selected temperature sensor(s) to the "Selected CPU sensor(s)" three widget."""
items = [item for item in self.ui.treeWidgetHWMonData.selectedItems()]
# The new items should have the tree widget itself as parent
parent = self.ui.treeWidgetSelectedCPUSensors
for item in items:
sensor_item = QtWidgets.QTreeWidgetItem(parent)
sensor_item.setText(0, item.text(0))
sensor_item.setText(1, item.text(1))
sensor_item.setForeground(0, QtGui.QBrush(QtCore.Qt.blue)) # Text color blue
# Deselect all items in the HWMon tree widget after they have been added
self.ui.treeWidgetHWMonData.clearSelection()
示例7: DataToTree
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def DataToTree(self, tree, cur_node, data, filter='', col=0):
node_info = data[0]
node_info_child = data[1]
[cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
# re filter
if filter != '' and isinstance(filter, (str, unicode)):
filter = re.compile(filter, re.IGNORECASE)
for sub_data in node_info_child:
if filter == '':
new_node = QtWidgets.QTreeWidgetItem()
cur_node.addChild(new_node)
self.DataToTree(tree, new_node, sub_data)
else:
if not filter.search(sub_data[0][col]) and not self.DataChildCheck(sub_data[1], filter, col):
pass
else:
new_node = QtWidgets.QTreeWidgetItem()
cur_node.addChild(new_node)
new_node.setExpanded(1)
self.DataToTree(tree, new_node, sub_data, filter, col)
示例8: DataToTree
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def DataToTree(self, tree, cur_node, data, filter=''):
node_info = data[0]
node_info_child = data[1]
[cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
target = re.compile(filter, re.IGNORECASE)
for sub_data in node_info_child:
if filter == '':
new_node = QtWidgets.QTreeWidgetItem()
cur_node.addChild(new_node)
self.DataToTree(tree, new_node, sub_data)
else:
if not target.search(sub_data[0][0]) and not self.DataChildCheck(sub_data[1], filter):
pass
else:
new_node = QtWidgets.QTreeWidgetItem()
cur_node.addChild(new_node)
new_node.setExpanded(1)
self.DataToTree(tree, new_node, sub_data, filter)
示例9: DataToTree_old_2LevelSearch
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def DataToTree_old_2LevelSearch(self, tree, cur_node, data, filter=''):
node_info = data[0]
node_info_child = data[1]
[cur_node.setText(i, node_info[i]) for i in range(len(node_info))]
target = re.compile(filter, re.IGNORECASE)
for sub_data in node_info_child:
if filter == '':
new_node = QtWidgets.QTreeWidgetItem()
cur_node.addChild(new_node)
self.DataToTree(tree, new_node, sub_data)
else:
if not target.search(sub_data[0][0]) and len(sub_data[1]) == 0:
#print(sub_data[0][0]) print(sub_data[1])
pass
else:
new_node = QtWidgets.QTreeWidgetItem()
cur_node.addChild(new_node)
new_node.setExpanded(1)
self.DataToTree(tree, new_node, sub_data, filter)
示例10: _del_option
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def _del_option(self, parent: QTreeWidgetItem, child: QTreeWidgetItem):
self.blockSignals(True)
parent.removeChild(child)
selected_option = False
for i in range(parent.childCount()):
parent.child(i).setData(0, 35, i)
if parent.child(i).checkState(0) == Qt.Checked:
selected_option = True
if parent.childCount() > 0 and not selected_option:
parent.child(0).setCheckState(0, Qt.Checked)
# Deselects if no options left
if not parent.childCount():
parent.setCheckState(0, Qt.Unchecked)
self.blockSignals(False)
self.update_size()
示例11: check_dependency
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def check_dependency(self, item: QTreeWidgetItem):
"""
Looks for mentioned dependents, and enables/disables those depending on checkstate.
:param item: changed item from QTreeWidget (paramTree)
:type item: QTreeWidget
"""
if item.data(0, 33) == 0 and item.data(0, 37):
for i in item.data(0, 37):
if item.checkState(0) == Qt.Unchecked:
self.blockSignals(True)
i.setDisabled(True)
i.setExpanded(False)
self.blockSignals(False)
i.setCheckState(0, Qt.Unchecked)
else:
self.blockSignals(True)
i.setDisabled(False)
self.blockSignals(False)
示例12: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
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)
示例13: add_df_to_nav
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def add_df_to_nav(self, df_name, parent=None):
"""
Add DataFrame to the nav by looking up the DataFrame by name in df_dicts
Args:
df_name (str): Name of the DataFrame
parent (QTreeWidgetItem): Parent item in the nav tree hierarchy
"""
if parent is None:
parent = self.nav_tree
# Calculate and format the shape of the DataFrame
shape = self.df_dicts[df_name]['dataframe'].shape
shape = str(shape[0]) + ' X ' + str(shape[1])
item = QtWidgets.QTreeWidgetItem(parent, [df_name, shape])
self.nav_tree.itemSelectionChanged.emit()
self.nav_tree.setCurrentItem(item)
示例14: _build_tree
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def _build_tree(self, function_tree, root):
'''
Builds Qt Widget tree.
'''
if not function_tree:
return
if isinstance(function_tree, FunctionData):
self._handle_function_data_instance(function_tree, root)
return
for name, tree in sorted(function_tree.iteritems()):
func_item = QtWidgets.QTreeWidgetItem(root)
if not isinstance(tree, FunctionData):
name = self._handle_class_name(tree, name, func_item)
func_item.setText(0, name)
self._build_tree(tree, func_item)
示例15: deactivate
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTreeWidgetItem [as 别名]
def deactivate(self, item):
"""
Deactivate the plots and DataBuffers connected to the given item
Args:
item (QTreeWidgetItem): ``QTreeWidgetItem`` that represents the
plots to be deactivated.
"""
if self.check_activated(item):
item.setBackground(0, Window.WhiteBrush)
callback_func_params = self._dependencies[item.text(0)]
if isinstance(callback_func_params[0], Window):
for curve_name in callback_func_params[1].curves_names:
self.deactivate(self._activation_items[curve_name])
self._deactivate_buffer_plots(callback_func_params[1])
callback_func_params[0].erase(callback_func_params[1])