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


Python QStackedWidget.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4.Qt import QStackedWidget [as 别名]
# 或者: from PyQt4.Qt.QStackedWidget import __init__ [as 别名]
    def __init__(self, parent=None):
        QStackedWidget.__init__(self, parent)
        self.welcome = w = QLabel('<p>'+_(
            'Double click a file in the left panel to start editing'
            ' it.'))
        self.addWidget(w)
        w.setWordWrap(True)
        w.setAlignment(Qt.AlignTop | Qt.AlignHCenter)

        self.container = c = QWidget(self)
        self.addWidget(c)
        l = c.l = QVBoxLayout(c)
        c.setLayout(l)
        l.setContentsMargins(0, 0, 0, 0)
        self.editor_tabs = t = QTabWidget(c)
        l.addWidget(t)
        t.setDocumentMode(True)
        t.setTabsClosable(True)
        t.setMovable(True)
        pal = self.palette()
        if pal.color(pal.WindowText).lightness() > 128:
            i = QImage(I('modified.png'))
            i.invertPixels()
            self.modified_icon = QIcon(QPixmap.fromImage(i))
        else:
            self.modified_icon = QIcon(I('modified.png'))
        self.editor_tabs.currentChanged.connect(self.current_editor_changed)
        self.editor_tabs.tabCloseRequested.connect(self._close_requested)
        self.search_panel = SearchPanel(self)
        l.addWidget(self.search_panel)
        self.restore_state()
        self.editor_tabs.tabBar().installEventFilter(self)
开发者ID:h4ck3rm1k3,项目名称:calibre,代码行数:34,代码来源:ui.py

示例2: __init__

# 需要导入模块: from PyQt4.Qt import QStackedWidget [as 别名]
# 或者: from PyQt4.Qt.QStackedWidget import __init__ [as 别名]
    def __init__(self,
                 parentWidget,
                 switchPageWidget  = None,
                 childWidgetList   = [],
                 label             = '',
                 labelColumn       = 0,
                 spanWidth         = True,
                 ):
        """
        Appends a QStackedWidget (Qt) widget to the bottom of I{parentWidget},
        which must be a Property Manager group box.

        @param parentWidget: the parent group box containing this widget.
        @type  parentWidget: PM_GroupBox

        @param switchPageWidget: The widget that is used to switch between
                                 pages. If None (the default), it is up to the
                                 caller to manage page switching.
        @type  switchPageWidget: PM_ComboBox or PM_ListWidget

        @param childWidgetList: a list of child widgets (pages), typically a
                                list of PM_GroupBoxes that contain multiple
                                widgets. Each child widget will get stacked onto
                                this stacked widget as a separate page.
        @type  childWidgetList: PM_GroupBox (or other PM widgets).

        @param label: label that appears above (or to the left of) this widget.
        @type  label: str

        @param labelColumn: The column number of the label in the group box
                            grid layout. The only valid values are 0 (left
                            column) and 1 (right column). The default is 0
                            (left column).
        @type  labelColumn: int

        @param spanWidth: If True, the widget and its label will span the width
                      of the group box. Its label will appear directly above
                      the widget (unless the label is empty) and is left justified.
        @type  spanWidth: bool (default True)

        @see: U{B{QStackedWidget}<http://doc.trolltech.com/4/qstackedwidget.html>}
        """

        QStackedWidget.__init__(self)

        assert isinstance(parentWidget, PM_GroupBox)

        self.parentWidget = parentWidget
        self.label        = label
        self.labelColumn  = labelColumn
        self.spanWidth    = spanWidth

        for widget in childWidgetList:
            self.addWidget(widget)

        self.setSwitchPageWidget(switchPageWidget)

        parentWidget.addPmWidget(self)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:60,代码来源:PM_StackedWidget.py


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