本文整理汇总了Python中PyQt4.QtGui.QListView.setWordWrap方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.setWordWrap方法的具体用法?Python QListView.setWordWrap怎么用?Python QListView.setWordWrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.setWordWrap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ResultWin
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setWordWrap [as 别名]
class ResultWin(QMainWindow):
""" Window use to display pylint results """
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
self.parent = parent
try:
self.setAttribute(Qt.WA_Maemo5AutoOrientation, True)
except AttributeError:
pass
self.list_view = QListView()
self.list_model = ResultModel()
self.list_view.setViewMode(QListView.ListMode)
self.list_view.setWordWrap(True)
self.list_view.setResizeMode(QListView.Adjust)
self.list_view.setModel(self.list_model)
self.setCentralWidget(self.list_view)
def set_results(self, results):
""" Set the tuple in the model """
self.list_model.set_data(results)
def append_results(self, results):
""" Append the tuple in the model """
self.list_model.append_data(results)
示例2: QtListControl
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setWordWrap [as 别名]
#.........这里部分代码省略.........
# owner = getattr(item, 'item_owner', None)
# if owner is not None:
# owner.on_double_clicked()
#--------------------------------------------------------------------------
# ProxyListControl API
#--------------------------------------------------------------------------
def set_item_model(self, model):
""" Set the item model for the widget.
"""
if model is None:
self.widget.setModel(None)
else:
self.widget.setModel(QItemModelWrapper(model))
def set_model_column(self, column):
""" Set the model column for the widget.
"""
self.widget.setModelColumn(column)
def set_view_mode(self, mode):
""" Set the view mode of the underlying control.
"""
# Always set static movement for now. This can be revisited in
# the future if the need arises to support movable items.
widget = self.widget
widget.setViewMode(VIEW_MODES[mode])
widget.setMovement(QListView.Static)
def set_resize_mode(self, mode):
""" Set the resize mode of the underlying control.
"""
self.widget.setResizeMode(RESIZE_MODES[mode])
def set_flow_mode(self, mode):
""" Set the flow mode of the underlying control.
"""
if mode == 'default':
if self.widget.viewMode() == QListView.ListMode:
qflow = QListView.TopToBottom
else:
qflow = QListView.LeftToRight
else:
qflow = FLOW_MODES[mode]
self.widget.setFlow(qflow)
def set_item_wrap(self, wrap):
""" Set the item wrapping on the underlying control.
"""
if wrap is None:
wrap = self.widget.viewMode() == QListView.IconMode
self.widget.setWrapping(wrap)
def set_word_wrap(self, wrap):
""" Set the word wrap on the underlying control.
"""
self.widget.setWordWrap(wrap)
def set_item_spacing(self, spacing):
""" Set the item spacing on the underlying control.
"""
self.widget.setSpacing(spacing)
def set_icon_size(self, size):
""" Set the icon size on the underlying control.
"""
self.widget.setIconSize(QSize(*size))
def set_uniform_item_sizes(self, uniform):
""" Set the uniform item sizes flag on the underlying control.
"""
self.widget.setUniformItemSizes(uniform)
def set_layout_mode(self, mode):
""" Set the layout mode on the underlying control.
"""
self.widget.setLayoutMode(LAYOUT_MODES[mode])
def set_batch_size(self, size):
""" Set the batch size on the underlying control.
"""
self.widget.setBatchSize(size)
def refresh_items_layout(self):
""" Refresh the items layout.
"""
pass