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


Python QTabWidget.setParent方法代码示例

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


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

示例1: RenderPropWidget

# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import setParent [as 别名]
class RenderPropWidget(QWidget):
    """
	RenderPropWidget is a widget that is displayed under the render widgets. It
	contains a tabwidget in which information of the data can be displayed and
	in which visualization parameters can be shown. One of the tabs is a
	RenderParameterWidget object.
	"""

    def __init__(self, renderController, parent=None):
        super(RenderPropWidget, self).__init__(parent=parent)

        # Three tabs: Visualization, data info and slices
        self.visParamTabWidget = RenderParameterWidget(renderController)
        self.dataInfoTabWidget = RenderInfoWidget()
        self.slicesTabWidget = RenderSlicerParamWidget(renderController)

        # Create the load dataset widget
        self.loadDataWidget = QWidget()
        self.loadDataButton = QPushButton()
        self.loadDataButton.setText("Load a dataset")

        layout = QVBoxLayout()
        layout.setAlignment(Qt.AlignTop)
        layout.addWidget(self.loadDataButton)
        self.loadDataWidget.setLayout(layout)

        # Create the tab widget
        self.tabWidget = QTabWidget()
        self.tabWidget.addTab(self.visParamTabWidget, "Visualization")
        self.tabWidget.addTab(self.dataInfoTabWidget, "Data info")
        self.tabWidget.addTab(self.slicesTabWidget, "Slices")

        layout = QVBoxLayout()
        layout.addWidget(self.loadDataWidget)
        self.setLayout(layout)

    def setFileChangedSignal(self, signal):
        """
		:param signal: Signal that is connected to some file-loading slots.
		:type signal: SIGNAL
		"""
        self.signal = signal
        self.signal.connect(self.setFile)
        self.signal.connect(self.dataInfoTabWidget.setFile)

    def setLoadDataSlot(self, slot):
        """
		The button is connected to the given slot. The slot action should load
		a dataset from disk.

		:type slot: Slot
		"""
        self.loadDataButton.clicked.connect(slot)

    @Slot(basestring)
    def setFile(self, fileName):
        """
		When a file is loaded, the 'load data' button is removed from the widget
		and the actual tabs with parameters are put on screen.
		"""
        layout = self.layout()
        if fileName is None:
            if layout.indexOf(self.tabWidget) != -1:
                # Remove the parameter widgets
                layout.removeWidget(self.tabWidget)
                self.tabWidget.setParent(None)
                # Show the load data button
                layout.addWidget(self.loadDataWidget)
                self.setLayout(layout)
        else:
            if layout.indexOf(self.loadDataWidget) != -1:
                # Remove the load data button
                layout.removeWidget(self.loadDataWidget)
                self.loadDataWidget.setParent(None)
                # Add the parameter widgets
                layout.addWidget(self.tabWidget)
                self.setLayout(layout)
开发者ID:rcockbur,项目名称:3DMedicalVisualizationTool,代码行数:79,代码来源:RenderPropWidget.py


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