本文整理汇总了Python中PySide.QtGui.QTabWidget.setTabText方法的典型用法代码示例。如果您正苦于以下问题:Python QTabWidget.setTabText方法的具体用法?Python QTabWidget.setTabText怎么用?Python QTabWidget.setTabText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTabWidget
的用法示例。
在下文中一共展示了QTabWidget.setTabText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: window
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import setTabText [as 别名]
#.........这里部分代码省略.........
complete_tab_layout = QHBoxLayout()
complete_tab_layout.setSpacing(0)
complete_tab_layout.setContentsMargins(0, 0, 0, 0)
complete_tab_layout.addWidget(tasklist)
complete_tab_layout.addWidget(page_widget)
complete_tab_widget = QFrame()
complete_tab_widget.setLayout(complete_tab_layout)
#for page in tab['history']:
# new_tab.load(QUrl(page['url']))
#print tab['current_history']
#for item in new_tab.history().items():
# print item
#new_tab.history().goToItem(new_tab.history().itemAt(tab['current_history']))
new_tab.load(QUrl(tab['history'][tab['current_history']]['url']))
tab['current_history']
self.tabs.setUpdatesEnabled(False)
if self.new_tab_behavior == "insert":
self.tabs.insertTab(self.tabs.currentIndex()+1, complete_tab_widget,
unicode(new_tab.title()))
elif self.new_tab_behavior == "append":
self.tabs.appendTab(complete_tab_widget, unicode(new_tab.title()))
self.tabs.setUpdatesEnabled(True)
new_tab.titleChanged.connect(self.change_tab)
new_tab.urlChanged.connect(self.change_tab)
new_tab.loadStarted.connect(self.load_start)
new_tab.loadFinished.connect(self.load_finish)
new_tab.loadProgress.connect(self.pbar.setValue)
new_tab.page().linkHovered.connect(self.linkHover)
inspector.setPage(new_tab.page())
for index, tab in enumerate(saved_tabs['tabs']):
self.tabs.setTabText(index, tab['history'][tab['current_history']]['title'])
self.tabs.setCurrentIndex(saved_tabs['current_tab'])
else:
self.new_tab()
tabs_layout = QVBoxLayout()
tabs_layout.setSpacing(0)
tabs_layout.setContentsMargins(0, 0, 0, 0)
tabs_layout.addWidget(self.tabs)
self.tabs_widget = QFrame()
self.tabs_widget.setObjectName("TabLine")
self.tabs_widget.setStyleSheet(self.style_sheet)
self.tabs_widget.setLayout(tabs_layout)
self.tabs_widget.setVisible(True)
# Webkit settings
gsettings = self.tabs.currentWidget().findChild(QFrame, unicode('pageWidget')).findChild(QWebView, unicode('webView')).settings().globalSettings()
# Basic settings
gsettings.setAttribute(QWebSettings.AutoLoadImages, True)
gsettings.setAttribute(QWebSettings.JavascriptEnabled, True)
gsettings.setAttribute(QWebSettings.JavascriptCanOpenWindows, False)
gsettings.setAttribute(QWebSettings.JavascriptCanAccessClipboard, False)
gsettings.setAttribute(QWebSettings.PluginsEnabled, False) # Flash isn't stable at present
gsettings.setAttribute(QWebSettings.JavaEnabled, False) # Java applet's aren't supported by PySide
gsettings.setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
gsettings.setAttribute(QWebSettings.AcceleratedCompositingEnabled,
True)
# Performace settings
gsettings.setAttribute(QWebSettings.DnsPrefetchEnabled, True)
gsettings.setAttribute(QWebSettings.AcceleratedCompositingEnabled, True)
gsettings.setAttribute(QWebSettings.DnsPrefetchEnabled, True)
示例2: Truss
# 需要导入模块: from PySide.QtGui import QTabWidget [as 别名]
# 或者: from PySide.QtGui.QTabWidget import setTabText [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.')
#.........这里部分代码省略.........