本文整理汇总了Python中PyQt5.Qt.QTreeWidget.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeWidget.__init__方法的具体用法?Python QTreeWidget.__init__怎么用?Python QTreeWidget.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.Qt import QTreeWidget [as 别名]
# 或者: from PyQt5.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, storage, show_files=False, item_func=browser_item):
QTreeWidget.__init__(self)
self.item_func = item_func
self.show_files = show_files
self.create_children(storage, self)
self.name = storage.name
self.object_id = storage.persistent_id
self.setMinimumHeight(350)
self.setHeaderHidden(True)
self.storage = storage
示例2: __init__
# 需要导入模块: from PyQt5.Qt import QTreeWidget [as 别名]
# 或者: from PyQt5.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, parent):
QTreeWidget.__init__(self, parent)
self.setHeaderLabel(_('Table of Contents'))
self.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
self.setDragEnabled(True)
self.setSelectionMode(self.ExtendedSelection)
self.viewport().setAcceptDrops(True)
self.setDropIndicatorShown(True)
self.setDragDropMode(self.InternalMove)
self.setAutoScroll(True)
self.setAutoScrollMargin(ICON_SIZE*2)
self.setDefaultDropAction(Qt.MoveAction)
self.setAutoExpandDelay(1000)
self.setAnimated(True)
self.setMouseTracking(True)
self.in_drop_event = False
self.root = self.invisibleRootItem()
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.show_context_menu)
示例3: __init__
# 需要导入模块: from PyQt5.Qt import QTreeWidget [as 别名]
# 或者: from PyQt5.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, parent=None):
QTreeWidget.__init__(self, parent)
self.categories = {}
self.ordered_selected_indexes = False
pi = plugins["progress_indicator"][0]
if hasattr(pi, "set_no_activate_on_click"):
pi.set_no_activate_on_click(self)
self.current_edited_name = None
self.delegate = ItemDelegate(self)
self.delegate.rename_requested.connect(self.rename_requested)
self.setTextElideMode(Qt.ElideMiddle)
self.setItemDelegate(self.delegate)
self.setIconSize(QSize(16, 16))
self.header().close()
self.setDragEnabled(True)
self.setEditTriggers(self.EditKeyPressed)
self.setSelectionMode(self.ExtendedSelection)
self.viewport().setAcceptDrops(True)
self.setDropIndicatorShown(True)
self.setDragDropMode(self.InternalMove)
self.setAutoScroll(True)
self.setAutoScrollMargin(TOP_ICON_SIZE * 2)
self.setDefaultDropAction(Qt.MoveAction)
self.setAutoExpandDelay(1000)
self.setAnimated(True)
self.setMouseTracking(True)
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.show_context_menu)
self.root = self.invisibleRootItem()
self.emblem_cache = {}
self.rendered_emblem_cache = {}
self.top_level_pixmap_cache = {
name: QPixmap(I(icon)).scaled(TOP_ICON_SIZE, TOP_ICON_SIZE, transformMode=Qt.SmoothTransformation)
for name, icon in {
"text": "keyboard-prefs.png",
"styles": "lookfeel.png",
"fonts": "font.png",
"misc": "mimetypes/dir.png",
"images": "view-image.png",
}.iteritems()
}
self.itemActivated.connect(self.item_double_clicked)