本文整理汇总了Python中PyQt5.QtWidgets.QListView.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.__init__方法的具体用法?Python QListView.__init__怎么用?Python QListView.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QListView
的用法示例。
在下文中一共展示了QListView.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, parent=None):
QListView.__init__(self, parent)
dndView.__init__(self, parent)
outlineBasics.__init__(self, parent)
self.setResizeMode(QListView.Adjust)
self.setWrapping(True)
self.setItemDelegate(corkDelegate())
self.setSpacing(5)
self.setVerticalScrollMode(self.ScrollPerPixel)
self.setFlow(self.LeftToRight)
self.setSelectionBehavior(self.SelectRows)
self.updateBackground()
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, qpart, model):
QListView.__init__(self, qpart.viewport())
# ensure good selected item background on Windows
palette = self.palette()
palette.setColor(palette.Inactive, palette.Highlight, palette.color(palette.Active, palette.Highlight))
self.setPalette(palette)
self.setAttribute(Qt.WA_DeleteOnClose)
self.setItemDelegate(HTMLDelegate(self))
self._qpart = qpart
self.setFont(qpart.font())
self.setCursor(QCursor(Qt.PointingHandCursor))
self.setFocusPolicy(Qt.NoFocus)
self.setModel(model)
self._selectedIndex = -1
# if cursor moved, we shall close widget, if its position (and model) hasn't been updated
self._closeIfNotUpdatedTimer = QTimer(self)
self._closeIfNotUpdatedTimer.setInterval(200)
self._closeIfNotUpdatedTimer.setSingleShot(True)
self._closeIfNotUpdatedTimer.timeout.connect(self._afterCursorPositionChanged)
qpart.installEventFilter(self)
qpart.cursorPositionChanged.connect(self._onCursorPositionChanged)
self.clicked.connect(lambda index: self.itemSelected.emit(index.row()))
self.updateGeometry()
self.show()
qpart.setFocus()
示例3: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, *args):
# Invoke parent init
QListView.__init__(self, *args)
# Get a reference to the window object
self.app = get_app()
self.win = args[0]
# Get Model data
self.title_model = TitlesModel()
# Setup header columns
self.setModel(self.title_model.model)
self.setIconSize(QSize(131, 108))
self.setGridSize(QSize(102, 92))
self.setViewMode(QListView.IconMode)
self.setResizeMode(QListView.Adjust)
self.setUniformItemSizes(True)
self.setWordWrap(True)
self.setTextElideMode(Qt.ElideRight)
# Refresh view
self.refresh_view()
示例4: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, parent):
QListView.__init__(self, parent)
self.resultListModel = QStandardItemModel(self)
self.setModel(self.resultListModel)
self.selectionModel().selectionChanged.connect(self.doItemSelected)
示例5: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, parent=None, model=None):
QListView.__init__(self, parent)
if model is None:
model = LayerStackModel()
self.init(model)
示例6: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, *args):
# Invoke parent init
QListView.__init__(self, *args)
# Get a reference to the window object
self.win = get_app().window
# Get Model data
self.files_model = FilesModel()
self.setAcceptDrops(True)
self.setDragEnabled(True)
self.setDropIndicatorShown(True)
self.selected = []
self.ignore_image_sequence_paths = []
# Setup header columns
self.setModel(self.files_model.model)
self.setIconSize(QSize(131, 108))
self.setViewMode(QListView.IconMode)
self.setResizeMode(QListView.Adjust)
self.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.setUniformItemSizes(True)
self.setWordWrap(True)
self.setStyleSheet('QListView::item { padding-top: 2px; }')
# Refresh view
self.refresh_view()
# setup filter events
app = get_app()
app.window.filesFilter.textChanged.connect(self.filter_changed)
app.window.actionFilesClear.triggered.connect(self.clear_filter)
示例7: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, *args):
# Invoke parent init
QListView.__init__(self, *args)
# Get a reference to the window object
self.win = get_app().window
# Get Model data
self.effects_model = EffectsModel()
# Keep track of mouse press start position to determine when to start drag
self.setAcceptDrops(True)
self.setDragEnabled(True)
self.setDropIndicatorShown(True)
# Setup header columns
self.setModel(self.effects_model.model)
self.setIconSize(QSize(131, 108))
self.setViewMode(QListView.IconMode)
self.setResizeMode(QListView.Adjust)
self.setUniformItemSizes(True)
self.setWordWrap(True)
self.setStyleSheet('QListView::item { padding-top: 2px; }')
# Refresh view
self.refresh_view()
# setup filter events
app = get_app()
app.window.effectsFilter.textChanged.connect(self.filter_changed)
app.window.actionEffectsClear.triggered.connect(self.clear_filter)
示例8: __init__
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import __init__ [as 别名]
def __init__(self, commits, commit_url, *args):
# Invoke parent init
QListView.__init__(self, *args)
# Get a reference to the window object
self.win = get_app().window
# Get Model data
self.changelog_model = ChangelogModel(commits)
self.selected = []
# Setup header columns
self.setModel(self.changelog_model.model)
self.setIndentation(0)
self.setSelectionBehavior(QTreeView.SelectRows)
self.setSelectionBehavior(QAbstractItemView.SelectRows)
self.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.setWordWrap(True)
self.setStyleSheet('QTreeView::item { padding-top: 2px; }')
self.commit_url = commit_url
# Refresh view
self.refresh_view()
# setup filter events
app = get_app()