本文整理汇总了Python中PyQt5.QtWidgets.QListView.viewport方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.viewport方法的具体用法?Python QListView.viewport怎么用?Python QListView.viewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QListView
的用法示例。
在下文中一共展示了QListView.viewport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import viewport [as 别名]
def main(args):
app = QApplication(args)
page = QSplitter()
data = Model(1000, 10, page)
selections = QItemSelectionModel(data)
table = QTableView()
table.setModel(data)
table.setSelectionModel(selections)
table.horizontalHeader().setSectionsMovable(True)
table.verticalHeader().setSectionsMovable(True)
# Set StaticContents to enable minimal repaints on resizes.
table.viewport().setAttribute(Qt.WA_StaticContents)
page.addWidget(table)
tree = QTreeView()
tree.setModel(data)
tree.setSelectionModel(selections)
tree.setUniformRowHeights(True)
tree.header().setStretchLastSection(False)
tree.viewport().setAttribute(Qt.WA_StaticContents)
# Disable the focus rect to get minimal repaints when scrolling on Mac.
tree.setAttribute(Qt.WA_MacShowFocusRect, False)
page.addWidget(tree)
list = QListView()
list.setModel(data)
list.setSelectionModel(selections)
list.setViewMode(QListView.IconMode)
list.setSelectionMode(QAbstractItemView.ExtendedSelection)
list.setAlternatingRowColors(False)
list.viewport().setAttribute(Qt.WA_StaticContents)
list.setAttribute(Qt.WA_MacShowFocusRect, False)
page.addWidget(list)
page.setWindowIcon(QIcon(images_dir + '/interview.png'))
page.setWindowTitle("Interview")
page.show()
return app.exec_()