本文整理汇总了Python中PySide.QtGui.QTabWidget.indexOf方法的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget.indexOf方法的具体用法?Python QTabWidget.indexOf怎么用?Python QTabWidget.indexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTabWidget
的用法示例。
在下文中一共展示了QTabWidget.indexOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MultiRenderPropWidget
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import indexOf [as 别名]
class MultiRenderPropWidget(QWidget):
"""
MultiRenderPropWidget is a widget that is displayed under the multi render
widget. It contains tabs with some controls for interaction and
visualization of the combined / multi-volume render widget.
"""
def __init__(self, multiRenderController, parent=None):
super(MultiRenderPropWidget, self).__init__(parent=parent)
# Two tabs: Visualization and Data info
self.mixParamWidget = RenderParameterWidget(multiRenderController)
self.transformParamWidget = TransformationParameterWidget()
self.registrationHistoryWidget = TransformationHistoryWidget()
self.slicesTabWidget = RenderSlicerParamWidget(multiRenderController)
# Create the tab widget
self.tabWidget = QTabWidget()
self.tabWidget.addTab(self.mixParamWidget, "Visualization")
self.tabWidget.addTab(self.registrationHistoryWidget, "History")
self.tabWidget.addTab(self.slicesTabWidget, "Slices")
self.currentTabIndex = 0
self.tabWidget.currentChanged.connect(self.tabIndexChanged)
layout = QVBoxLayout()
self.setLayout(layout)
layout.addWidget(self.tabWidget)
self.registrationHistoryWidget.setMultiRenderWidget(multiRenderController.multiRenderWidget)
def setTransformTool(self, transformTool):
if self.tabWidget.indexOf(self.transformParamWidget) < 0:
self.tabWidget.addTab(self.transformParamWidget, "Transformation")
self.tabWidget.setCurrentWidget(self.transformParamWidget)
self.transformParamWidget.setTransformationTool(transformTool)
def transformToolFinished(self):
index = self.tabWidget.indexOf(self.transformParamWidget)
if index >= 0:
# Restore the last tab index that wasn't the transform tab
self.tabWidget.setCurrentIndex(self.currentTabIndex)
self.tabWidget.removeTab(index)
@Slot(int)
def tabIndexChanged(self, index):
transformIndex = self.tabWidget.indexOf(self.transformParamWidget)
if index != transformIndex:
self.currentTabIndex = index
示例2: RenderPropWidget
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import indexOf [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.slicesTabWidget, "Slices")
self.tabWidget.addTab(self.dataInfoTabWidget, "Data info")
self.currentTabIndex = 0
self.extraTabWidget = None
self.tabWidget.currentChanged.connect(self.tabIndexChanged)
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)
@Slot(int)
def tabIndexChanged(self, index):
transformIndex = self.tabWidget.indexOf(self.extraTabWidget)
if index != transformIndex:
self.currentTabIndex = index
def addTabWidget(self, widget, name):
self.extraTabWidget = widget
self.tabWidget.addTab(widget, name)
self.tabWidget.setCurrentWidget(self.extraTabWidget)
def removeTabWidget(self):
if self.extraTabWidget is None:
return
index = self.tabWidget.indexOf(self.extraTabWidget)
if index >= 0:
# Restore the last tab index that wasn't the transform tab
self.tabWidget.setCurrentIndex(self.currentTabIndex)
#.........这里部分代码省略.........
示例3: Truss
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import indexOf [as 别名]
class Truss(QMainWindow):
def __init__(self, parent=None):
super(Truss, self).__init__(parent)
self.resize(800, 600)
self.filename = None
self.filetuple = None
self.dirty = False # Refers to Data Page only.
centralwidget = QWidget(self)
gridLayout = QGridLayout(centralwidget)
self.tabWidget = QTabWidget(centralwidget)
self.tab = QWidget()
font = QFont()
font.setFamily("Courier 10 Pitch")
font.setPointSize(12)
self.tab.setFont(font)
gridLayout_3 = QGridLayout(self.tab)
self.plainTextEdit = QPlainTextEdit(self.tab)
gridLayout_3.addWidget(self.plainTextEdit, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab, "")
self.tab_2 = QWidget()
self.tab_2.setFont(font)
gridLayout_2 = QGridLayout(self.tab_2)
self.plainTextEdit_2 = QPlainTextEdit(self.tab_2)
gridLayout_2.addWidget(self.plainTextEdit_2, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab_2, "")
gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
self.setCentralWidget(centralwidget)
menubar = QMenuBar(self)
menubar.setGeometry(QRect(0, 0, 800, 29))
menu_File = QMenu(menubar)
self.menu_Solve = QMenu(menubar)
self.menu_Help = QMenu(menubar)
self.setMenuBar(menubar)
self.statusbar = QStatusBar(self)
self.setStatusBar(self.statusbar)
self.action_New = QAction(self)
self.actionSave_As = QAction(self)
self.action_Save = QAction(self)
self.action_Open = QAction(self)
self.action_Quit = QAction(self)
self.action_About = QAction(self)
self.actionShow_CCPL = QAction(self)
self.action_Solve = QAction(self)
self.action_CCPL = QAction(self)
self.action_Help = QAction(self)
menu_File.addAction(self.action_New)
menu_File.addAction(self.action_Open)
menu_File.addAction(self.actionSave_As)
menu_File.addAction(self.action_Save)
menu_File.addSeparator()
menu_File.addAction(self.action_Quit)
self.menu_Solve.addAction(self.action_Solve)
self.menu_Help.addAction(self.action_About)
self.menu_Help.addAction(self.action_CCPL)
self.menu_Help.addAction(self.action_Help)
menubar.addAction(menu_File.menuAction())
menubar.addAction(self.menu_Solve.menuAction())
menubar.addAction(self.menu_Help.menuAction())
self.setWindowTitle("Main Window")
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab),\
"Data Page")
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2),\
"Solution Page")
menu_File.setTitle("&File")
self.menu_Solve.setTitle("&Solve")
self.menu_Help.setTitle("&Help")
self.tabWidget.setCurrentIndex(0)
self.action_New.setText("&New")
self.action_Open.setText("&Open")
self.actionSave_As.setText("Save &As")
self.action_Save.setText("&Save")
self.action_Quit.setText("&Quit")
self.action_Solve.setText("&Solve")
self.action_About.setText("&About")
self.action_CCPL.setText("&CCPL")
self.action_Help.setText("&Help")
self.action_Quit.triggered.connect(self.close)
allToolBar = self.addToolBar("AllToolBar")
allToolBar.setObjectName("AllToolBar")
self.addActions(allToolBar, (self.action_Open, self.actionSave_As,\
self.action_Save, self.action_Solve,\
self.action_Quit ))
self.action_New.triggered.connect(self.fileNew)
self.action_Open.triggered.connect(self.fileOpen)
self.actionSave_As.triggered.connect(self.fileSaveAs)
self.action_Save.triggered.connect(self.fileSave)
self.action_Solve.triggered.connect(self.trussSolve)
self.action_About.triggered.connect(self.aboutBox)
self.action_CCPL.triggered.connect(self.displayCCPL)
self.action_Help.triggered.connect(self.help)
self.plainTextEdit.textChanged.connect(self.setDirty)
self.action_New = self.editAction(self.action_New, None,\
'ctrl+N', 'filenew', 'New File.')
self.action_Open = self.editAction(self.action_Open, None,
'ctrl+O', 'fileopen', 'Open File.')
self.actionSave_As = self.editAction(self.actionSave_As,\
None, 'ctrl+A', 'filesaveas',\
'Save and Name File.')
self.action_Save = self.editAction(self.action_Save, None,
'ctrl+S', 'filesave', 'Save File.')
#.........这里部分代码省略.........