本文整理汇总了Python中PyQt4.QtGui.QListView.setHorizontalScrollMode方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.setHorizontalScrollMode方法的具体用法?Python QListView.setHorizontalScrollMode怎么用?Python QListView.setHorizontalScrollMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.setHorizontalScrollMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setHorizontalScrollMode [as 别名]
def __init__(self, model, enlargeFunction, parent):
QWidget.__init__(self, parent)
def enlarge(index):
enlargeFunction(model.list[index.row()])
windowSize = self.window().frameSize()
self.resize(QSize(windowSize.width()-(25+utilities.bigCardSize[0]),275))
lvViewer = QListView(self)
lvViewer.setModel(model)
lvViewer.setDragEnabled(True)
lvViewer.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
lvViewer.setFlow(QListView.LeftToRight)
lvViewer.setFocus()
self.connect(lvViewer, SIGNAL('clicked(QModelIndex)'), enlarge)
button = QPushButton("Close", self)
self.connect(button,SIGNAL('clicked()'),self.hide)
layout = QVBoxLayout(self)
layout.addWidget(QLabel("I'm sorry this is so ugly.",self))
layout.addWidget(lvViewer)
layout.addWidget(button)
self.setLayout(layout)
self.show()
示例2: displayExile
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setHorizontalScrollMode [as 别名]
def displayExile(self):
from PyQt4.QtGui import QListView, QAbstractItemView, QPushButton, QVBoxLayout, QLabel
from PyQt4.QtCore import QSize
from util import utilities
windowSize = self.window().frameSize()
self.viewer = QWidget(self.window())
self.viewer.move(10,10)
self.viewer.resize(QSize(windowSize.width()-(25+utilities.bigCardSize[0]),275))
lvViewer = QListView(self.viewer)
lvViewer.setModel(self.model)
lvViewer.setDragEnabled(True)
lvViewer.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
lvViewer.setFlow(QListView.LeftToRight)
lvViewer.setFocus()
self.connect(lvViewer, SIGNAL('clicked(QModelIndex)'), self.enlarge)
button = QPushButton("Close", self.viewer)
self.connect(button,SIGNAL('clicked()'),self.hideViewer)
layout = QVBoxLayout(self)
layout.addWidget(QLabel("I'm sorry this is so ugly.",self.viewer))
layout.addWidget(lvViewer)
layout.addWidget(button)
self.viewer.setLayout(layout)
self.viewer.show()