本文整理匯總了Python中PyQt5.QtWidgets.QTreeWidget方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QTreeWidget方法的具體用法?Python QtWidgets.QTreeWidget怎麽用?Python QtWidgets.QTreeWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QTreeWidget方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setupUi
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [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: OnCreate
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def OnCreate(self, form):
# Get parent widget
self.parent = idaapi.PluginForm.FormToPyQtWidget(form)
# Create tree control
self.tree = QtWidgets.QTreeWidget()
self.tree.setHeaderLabels(("Names",))
self.tree.setColumnWidth(0, 100)
if self.d is None:
self.d, self.s = get_source_strings()
d = self.d
# Create layout
layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.tree)
self.populate_tree(d)
# Populate PluginForm
self.parent.setLayout(layout)
示例3: OnCreate
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def OnCreate(self, form):
"""
Called when the view is created
"""
self.bp_tree_widget = QtWidgets.QTreeWidget()
self.bp_handler = BpHandler.get_bp_handler()
self.die_icons = DIE.UI.Die_Icons.get_die_icons()
# Get parent widget
self.parent = self.FormToPyQtWidget(form)
self._add_parser_data()
toolbar = QtWidgets.QToolBar()
action_refresh = QtWidgets.QAction(self.die_icons.icon_refresh, "Refresh", toolbar)
action_refresh.triggered.connect(self.refresh)
toolbar.addAction(action_refresh)
layout = QtWidgets.QGridLayout()
layout.addWidget(toolbar)
layout.addWidget(self.bp_tree_widget)
self.parent.setLayout(layout)
示例4: OnCreate
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def OnCreate(self, form):
"""
Called when the view is created
"""
self.data_parser = DataParser.getParser()
self.ptable_widget = QtWidgets.QTreeWidget()
# Get parent widget
self.parent = self.FormToPyQtWidget(form)
self._add_parser_data()
layout = QtWidgets.QGridLayout()
layout.addWidget(self.ptable_widget)
self.parent.setLayout(layout)
示例5: selectionChanged
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def selectionChanged(self):
sender = self.sender()
if isinstance(sender, QtWidgets.QTreeWidget):
self.currentScene.blockSignals(True)
self.currentScene.clearSelection()
for element in self.list.selectedItems():
if element.parent() == self.list.Equipment:
obj = self.currentScene.getObject(
"e", int(element.text(0).split(" ")[0]))
obj.setSelected(True)
if element.parent() == self.list.Stream:
obj = self.currentScene.getObject(
"s", int(element.text(0)))
obj.setSelected(True)
self.currentScene.blockSignals(False)
elif isinstance(sender, flujo.GraphicsScene):
self.list.blockSignals(True)
self.list.clearSelection()
for element in sender.selectedItems():
if isinstance(element, flujo.StreamItem):
self.list.Stream.child(element.id-1).setSelected(True)
elif isinstance(element, flujo.EquipmentItem) and \
element.tipo == "e":
self.list.Equipment.child(element.id-1).setSelected(True)
self.list.blockSignals(False)
示例6: SetAppStyle
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def SetAppStyle(styleKey=''):
"""
Set the application window color
"""
# Change the color if applicable
if globals.theme.color('ui') is not None and not globals.theme.forceStyleSheet:
globals.app.setPalette(QtGui.QPalette(globals.theme.color('ui')))
# Change the style
if not styleKey: styleKey = setting('uiStyle', "Fusion")
style = QtWidgets.QStyleFactory.create(styleKey)
globals.app.setStyle(style)
# Apply the style sheet, if exists
if globals.theme.styleSheet:
globals.app.setStyleSheet(globals.theme.styleSheet)
# Manually set the background color
if globals.theme.forceUiColor and not globals.theme.forceStyleSheet:
color = globals.theme.color('ui').getRgb()
bgColor = "#%02x%02x%02x" % tuple(map(lambda x: x // 2, color[:3]))
globals.app.setStyleSheet("""
QListView, QTreeWidget, QLineEdit, QDoubleSpinBox, QSpinBox, QTextEdit{
background-color: %s;
}""" % bgColor)
示例7: check_dependency
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [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)
示例8: setupUi
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [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)
示例9: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def __init__(self, parent=None, viewer=None):
QtWidgets.QTreeWidget.__init__(self, parent)
self.treelements = {}
self.viewer = viewer
self.colors = {
'default': QtGui.QColor.fromRgb(0, 0, 0, 0),
'red': QtGui.QColor.fromRgb(255, 0, 0, 150),
'green': QtGui.QColor.fromRgb(0, 255, 0, 150),
'blue': QtGui.QColor.fromRgb(0, 0, 255, 150),
'redblue': QtGui.QColor.fromRgb(255, 0, 255, 150),
'redgreen': QtGui.QColor.fromRgb(255, 255, 0, 150),
'bluegreen': QtGui.QColor.fromRgb(0, 255, 255, 150),
'gray': QtGui.QColor.fromRgb(200, 200, 200, 250)}
self.setHeaderLabels(['Available Layers'])
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.treeContextMenu)
self.itemChanged.connect(self.newLayerName)
self.scalemenu = [None] * 6
示例10: setupEmptyTree
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def setupEmptyTree(self):
"""Setup empty Tree at startup. """
if hasattr(self, "tree"):
del self.tree
self.tree = QtWidgets.QTreeWidget(self)
self.tree.header().close()
示例11: setupUi
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(241, 367)
self.gridLayout = QtWidgets.QGridLayout(Form)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
self.label = QtWidgets.QLabel(Form)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
self.itemTree = QtWidgets.QTreeWidget(Form)
self.itemTree.setObjectName("itemTree")
self.itemTree.headerItem().setText(0, "1")
self.itemTree.header().setVisible(False)
self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
self.label_2 = QtWidgets.QLabel(Form)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
self.formatList = QtWidgets.QListWidget(Form)
self.formatList.setObjectName("formatList")
self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
self.exportBtn = QtWidgets.QPushButton(Form)
self.exportBtn.setObjectName("exportBtn")
self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
self.closeBtn = QtWidgets.QPushButton(Form)
self.closeBtn.setObjectName("closeBtn")
self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
self.paramTree = ParameterTree(Form)
self.paramTree.setObjectName("paramTree")
self.paramTree.headerItem().setText(0, "1")
self.paramTree.header().setVisible(False)
self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
self.label_3 = QtWidgets.QLabel(Form)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
self.copyBtn = QtWidgets.QPushButton(Form)
self.copyBtn.setObjectName("copyBtn")
self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例12: get_QTreeWidget
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def get_QTreeWidget():
"""QTreeWidget getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QTreeWidget
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QTreeWidget
示例13: _create_gui
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def _create_gui(self):
columns = ['offset','name','size','value']
self.tree = QtWidgets.QTreeWidget()
self.tree.setAttribute(Qt.WA_MacShowFocusRect, 0)
self.tree.setColumnCount(len(columns))
self.tree.setHeaderLabels(columns)
self.tree.setContextMenuPolicy(Qt.CustomContextMenu)
self.tree.customContextMenuRequested.connect(self.context_menu)
hbox = QtWidgets.QHBoxLayout()
lbl_address = QtWidgets.QLabel("Address:")
lbl_address.setStyleSheet("font-weight: bold;")
hbox.addWidget(lbl_address)
self.lbl_hex_addr = QtWidgets.QLabel()
hbox.addWidget(self.lbl_hex_addr)
hbox.addStretch(1)
layout = QtWidgets.QVBoxLayout()
layout.addLayout(hbox)
layout.addWidget(self.tree)
#layout.setSpacing(0)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
示例14: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def __init__(self, parent=None):
super(ShowDependences, self).__init__(parent)
self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(
os.environ["pychemqt"]+"/images/button/showPrograms.png")))
self.setWindowTitle(
QtWidgets.QApplication.translate("pychemqt", "External program"))
layout = QtWidgets.QVBoxLayout(self)
self.tree = QtWidgets.QTreeWidget()
header = QtWidgets.QTreeWidgetItem(
[QtWidgets.QApplication.translate("pychemqt", "Module"),
QtWidgets.QApplication.translate("pychemqt", "Status")])
self.tree.setHeaderItem(header)
for module, txt in optional_modules:
if os.environ[module] == "True":
mod = __import__(module)
st = mod.__file__
else:
st = QtWidgets.QApplication.translate("pychemqt", "not found")
item = QtWidgets.QTreeWidgetItem([module, st])
self.tree.addTopLevelItem(item)
layout.addWidget(self.tree)
button = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Close)
button.rejected.connect(self.reject)
layout.addWidget(button)
示例15: setLang
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTreeWidget [as 別名]
def setLang(self, langName):
lang_data = self.memoData['lang'][langName]
for ui_name in lang_data.keys():
if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
ui_element = self.uiList[ui_name]
# '' means no translation availdanle in that data file
if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
ui_element.setText(lang_data[ui_name])
elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
# uiType: QMenu, QGroupBox
ui_element.setTitle(lang_data[ui_name])
elif isinstance(ui_element, QtWidgets.QTabWidget):
# uiType: QTabWidget
tabCnt = ui_element.count()
tabNameList = lang_data[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != '':
ui_element.setTabText(i,tabNameList[i])
elif isinstance(ui_element, QtWidgets.QComboBox):
# uiType: QComboBox
itemCnt = ui_element.count()
itemNameList = lang_data[ui_name].split(';')
ui_element.clear()
ui_element.addItems(itemNameList)
elif isinstance(ui_element, QtWidgets.QTreeWidget):
# uiType: QTreeWidget
labelCnt = ui_element.headerItem().columnCount()
labelList = lang_data[ui_name].split(';')
ui_element.setHeaderLabels(labelList)
elif isinstance(ui_element, QtWidgets.QTableWidget):
# uiType: QTableWidget
colCnt = ui_element.columnCount()
headerList = lang_data[ui_name].split(';')
cur_table.setHorizontalHeaderLabels( headerList )
elif isinstance(ui_element, (str, unicode) ):
# uiType: string for msg
self.uiList[ui_name] = lang_data[ui_name]