本文整理汇总了Python中PyQt4.Qt.QTreeWidget.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeWidget.__init__方法的具体用法?Python QTreeWidget.__init__怎么用?Python QTreeWidget.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.Qt import QTreeWidget [as 别名]
# 或者: from PyQt4.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, parent=None):
QTreeWidget.__init__(self, parent)
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.itemDoubleClicked.connect(self.item_double_clicked)
示例2: __init__
# 需要导入模块: from PyQt4.Qt import QTreeWidget [as 别名]
# 或者: from PyQt4.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, storage, show_files):
QTreeWidget.__init__(self)
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)
示例3: __init__
# 需要导入模块: from PyQt4.Qt import QTreeWidget [as 别名]
# 或者: from PyQt4.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
示例4: __init__
# 需要导入模块: from PyQt4.Qt import QTreeWidget [as 别名]
# 或者: from PyQt4.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)
示例5: __init__
# 需要导入模块: from PyQt4.Qt import QTreeWidget [as 别名]
# 或者: from PyQt4.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, parent=None):
QTreeWidget.__init__(self, parent)
self.delegate = ItemDelegate(self)
self.setTextElideMode(Qt.ElideMiddle)
self.setItemDelegate(self.delegate)
self.header().close()
self.setDragEnabled(True)
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.in_drop_event = False
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.show_context_menu)
self.root = self.invisibleRootItem()
示例6: __init__
# 需要导入模块: from PyQt4.Qt import QTreeWidget [as 别名]
# 或者: from PyQt4.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, parent=None, name=None):
QTreeWidget.__init__(self, parent)
global folderClosedIcon, folderLockedIcon, folderOpenIcon, fileIcon
folderClosedIcon = QIcon(QPixmap(folder_closed_image))
folderLockedIcon = QIcon(QPixmap(folder_locked_image))
folderOpenIcon = QIcon(QPixmap(folder_open_image))
fileIcon = QIcon(QPixmap(pix_file_image))
self.setHeaderLabels(["", "Name"])
#self.addColumn("Name", 150) # added 150. mark 060303. [bruce then changed 'width=150' to '150' to avoid exception]
# Calling addColumn() here causes DirView to change size after its parent (MMKit) is shown.
# I've not been successful figuring out how to control the height of the DirView (QTreeWidget)
# after adding this column. See comments in MWsemantics._findGoodLocation() for more
# information about how I compensate for this. Mark 060222.
#self.setGeometry(QRect(7,-1,191,150))
self.setMinimumSize(QSize(160,150))
# Trying to force height to be 150, but addColumn() overrides this. To see the problem,
# simply comment out addColumn() above and enter Build mode. mark 060222.
#self.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.MinimumExpanding,0,0,self.sizePolicy().hasHeightForWidth()))
qt4todo('self.setTreeStepSize(20)')
qt4todo('self.setColumnWidth(0, 150)') # Force the column width to 150 again. Fixes bug 1613. mark 060303.
示例7: __init__
# 需要导入模块: from PyQt4.Qt import QTreeWidget [as 别名]
# 或者: from PyQt4.Qt.QTreeWidget import __init__ [as 别名]
def __init__(self, *args):
QTreeWidget.__init__(self, *args)
self.setContextMenuPolicy(Qt.CustomContextMenu)
QObject.connect(self, SIGNAL('customContextMenuRequested(const QPoint &)'), self._request_context_menu)
QObject.connect(self, SIGNAL('itemExpanded(QTreeWidgetItem *)'), self._item_expanded_collapsed)
QObject.connect(self, SIGNAL('itemCollapsed(QTreeWidgetItem *)'), self._item_expanded_collapsed)