本文整理汇总了Python中PyQt5.Qt.QTreeView.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeView.__init__方法的具体用法?Python QTreeView.__init__怎么用?Python QTreeView.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QTreeView
的用法示例。
在下文中一共展示了QTreeView.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, *args):
QTreeView.__init__(self, *args)
self.delegate = Delegate(self)
self.setItemDelegate(self.delegate)
self.setMinimumWidth(80)
self.header().close()
self.setMouseTracking(True)
self.setStyleSheet('''
QTreeView {
background-color: palette(window);
color: palette(window-text);
border: none;
}
QTreeView::item {
border: 1px solid transparent;
padding-top:0.5ex;
padding-bottom:0.5ex;
}
QTreeView::item:hover {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
border: 1px solid #bfcde4;
border-radius: 6px;
}
''')
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.context_menu)
示例2: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, parent=None):
QTreeView.__init__(self, parent=None)
self.alter_tb = None
self.disable_recounting = False
self.setUniformRowHeights(True)
self.setCursor(Qt.PointingHandCursor)
self.setIconSize(QSize(20, 20))
self.setTabKeyNavigation(True)
self.setAnimated(True)
self.setHeaderHidden(True)
self.setItemDelegate(TagDelegate(self))
self.made_connections = False
self.setAcceptDrops(True)
self.setDragEnabled(True)
self.setDragDropMode(self.DragDrop)
self.setDropIndicatorShown(True)
self.in_drag_drop = False
self.setAutoExpandDelay(500)
self.pane_is_visible = False
self.search_icon = QIcon(I("search.png"))
self.user_category_icon = QIcon(I("tb_folder.png"))
self.delete_icon = QIcon(I("list_remove.png"))
self.rename_icon = QIcon(I("edit-undo.png"))
self._model = TagsModel(self)
self._model.search_item_renamed.connect(self.search_item_renamed)
self._model.refresh_required.connect(self.refresh_required, type=Qt.QueuedConnection)
self._model.tag_item_renamed.connect(self.tag_item_renamed)
self._model.restriction_error.connect(self.restriction_error)
self._model.user_categories_edited.connect(self.user_categories_edited, type=Qt.QueuedConnection)
self._model.drag_drop_finished.connect(self.drag_drop_finished)
stylish_tb = """
QTreeView {
background-color: palette(window);
color: palette(window-text);
border: none;
}
"""
self.setStyleSheet(
"""
QTreeView::item {
border: 1px solid transparent;
padding-top:0.8ex;
padding-bottom:0.8ex;
}
QTreeView::item:hover {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
border: 1px solid #bfcde4;
border-radius: 6px;
}
"""
+ ("" if gprefs["tag_browser_old_look"] else stylish_tb)
)
if gprefs["tag_browser_old_look"]:
self.setAlternatingRowColors(True)
# Allowing keyboard focus looks bad in the Qt Fusion style and is useless
# anyway since the enter/spacebar keys do nothing
self.setFocusPolicy(Qt.NoFocus)
示例3: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, *args):
QTreeView.__init__(self,*args)
self._model = Matches()
self.setModel(self._model)
self.rt_delegate = RichTextDelegate(self)
for i in self._model.HTML_COLS:
self.setItemDelegateForColumn(i, self.rt_delegate)
示例4: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, parent=None):
QTreeView.__init__(self, parent)
self.setHeaderHidden(True)
self.setAnimated(True)
self.activated.connect(self.item_activated)
self.clicked.connect(self.item_activated)
pi = plugins['progress_indicator'][0]
if hasattr(pi, 'set_no_activate_on_click'):
pi.set_no_activate_on_click(self)
self.initialized = False
self.setExpandsOnDoubleClick(False)
示例5: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, *args):
QTreeView.__init__(self,*args)
self._model = Matches([p for p in store_plugins()])
self.setModel(self._model)
self.setIconSize(QSize(24, 24))
self.rt_delegate = RichTextDelegate(self)
for i in self._model.HTML_COLS:
self.setItemDelegateForColumn(i, self.rt_delegate)
for i in range(self._model.columnCount()):
self.resizeColumnToContents(i)
self.model().sort(1, Qt.AscendingOrder)
self.header().setSortIndicator(self.model().sort_col, self.model().sort_order)
示例6: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, parent=None):
QTreeView.__init__(self, parent=None)
self.setMouseTracking(True)
self.alter_tb = None
self.disable_recounting = False
self.setUniformRowHeights(True)
self.setIconSize(QSize(20, 20))
self.setTabKeyNavigation(True)
self.setAnimated(True)
self.setHeaderHidden(True)
self.setItemDelegate(TagDelegate(self))
self.made_connections = False
self.setAcceptDrops(True)
self.setDragEnabled(True)
self.setDragDropMode(self.DragDrop)
self.setDropIndicatorShown(True)
self.in_drag_drop = False
self.setAutoExpandDelay(500)
self.pane_is_visible = False
self.search_icon = QIcon(I('search.png'))
self.search_copy_icon = QIcon(I("search_copy_saved.png"))
self.user_category_icon = QIcon(I('tb_folder.png'))
self.delete_icon = QIcon(I('list_remove.png'))
self.rename_icon = QIcon(I('edit-undo.png'))
self._model = TagsModel(self)
self._model.search_item_renamed.connect(self.search_item_renamed)
self._model.refresh_required.connect(self.refresh_required,
type=Qt.QueuedConnection)
self._model.tag_item_renamed.connect(self.tag_item_renamed)
self._model.restriction_error.connect(self.restriction_error)
self._model.user_categories_edited.connect(self.user_categories_edited,
type=Qt.QueuedConnection)
self._model.drag_drop_finished.connect(self.drag_drop_finished)
self.set_look_and_feel()
# Allowing keyboard focus looks bad in the Qt Fusion style and is useless
# anyway since the enter/spacebar keys do nothing
self.setFocusPolicy(Qt.NoFocus)
示例7: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, *args):
QTreeView.__init__(self, *args)
self.setCursor(Qt.PointingHandCursor)
self.setMinimumWidth(80)
self.header().close()
self.setStyleSheet('''
QTreeView {
background-color: palette(window);
color: palette(window-text);
border: none;
}
QTreeView::item {
border: 1px solid transparent;
padding-top:0.5ex;
padding-bottom:0.5ex;
}
QTreeView::item:hover {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
border: 1px solid #bfcde4;
border-radius: 6px;
}
''')
示例8: __init__
# 需要导入模块: from PyQt5.Qt import QTreeView [as 别名]
# 或者: from PyQt5.Qt.QTreeView import __init__ [as 别名]
def __init__(self, parent):
QTreeView.__init__(self, parent)
self.setAnimated(True)
self.setHeaderHidden(True)
self.setObjectName('recipes')
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)