當前位置: 首頁>>代碼示例>>Python>>正文


Python QTreeWidget.__init__方法代碼示例

本文整理匯總了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)
開發者ID:randy1,項目名稱:calibre,代碼行數:37,代碼來源:file_list.py

示例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)
開發者ID:yeyanchao,項目名稱:calibre,代碼行數:10,代碼來源:mtp_folder_browser.py

示例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
開發者ID:089git,項目名稱:calibre,代碼行數:12,代碼來源:mtp_folder_browser.py

示例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)
開發者ID:089git,項目名稱:calibre,代碼行數:21,代碼來源:main.py

示例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()
開發者ID:shootstar,項目名稱:calibre,代碼行數:23,代碼來源:file_list.py

示例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.
開發者ID:ematvey,項目名稱:NanoEngineer-1,代碼行數:24,代碼來源:DirView.py

示例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)
開發者ID:kernsuite-debian,項目名稱:kittens,代碼行數:8,代碼來源:widgets.py


注:本文中的PyQt4.Qt.QTreeWidget.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。