当前位置: 首页>>代码示例>>Python>>正文


Python QListView.setLayoutMode方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QListView.setLayoutMode方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.setLayoutMode方法的具体用法?Python QListView.setLayoutMode怎么用?Python QListView.setLayoutMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QListView的用法示例。


在下文中一共展示了QListView.setLayoutMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: QtListControl

# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setLayoutMode [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
开发者ID:davidjk,项目名称:enaml,代码行数:104,代码来源:qt_list_control.py


注:本文中的PyQt4.QtGui.QListView.setLayoutMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。