本文整理匯總了Python中PyQt5.QtWidgets.QTabWidget方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QTabWidget方法的具體用法?Python QtWidgets.QTabWidget怎麽用?Python QtWidgets.QTabWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QTabWidget方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setupUi
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def setupUi(self, Master):
Master.setObjectName("Master")
Master.resize(718, 477)
self.verticalLayout = QtWidgets.QVBoxLayout(Master)
self.verticalLayout.setObjectName("verticalLayout")
self.splitter = QtWidgets.QSplitter(Master)
self.splitter.setOrientation(QtCore.Qt.Vertical)
self.splitter.setObjectName("splitter")
self.tab_widget = QtWidgets.QTabWidget(self.splitter)
self.tab_widget.setObjectName("tab_widget")
self.docker = QtWidgets.QDockWidget(self.splitter)
self.docker.setObjectName("docker")
self.docker.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea)
self.log_widget = QtWidgets.QTreeWidget(self.docker)
self.log_widget.setHeaderItem(QtWidgets.QTreeWidgetItem(["date", "origin", "type", "message"]))
self.docker.setWidget(self.log_widget)
self.verticalLayout.addWidget(self.splitter)
self.tab_widget.setCurrentIndex(-1)
QtCore.QMetaObject.connectSlotsByName(Master)
Master.setWindowTitle("IDASec")
示例2: setupUi
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def setupUi(self, QHangupsConversations):
QHangupsConversations.setObjectName("QHangupsConversations")
QHangupsConversations.resize(500, 350)
self.centralwidget = QtWidgets.QWidget(QHangupsConversations)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.conversationsTabWidget = QtWidgets.QTabWidget(self.centralwidget)
self.conversationsTabWidget.setElideMode(QtCore.Qt.ElideRight)
self.conversationsTabWidget.setTabsClosable(True)
self.conversationsTabWidget.setMovable(True)
self.conversationsTabWidget.setObjectName("conversationsTabWidget")
self.gridLayout.addWidget(self.conversationsTabWidget, 0, 0, 1, 1)
QHangupsConversations.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(QHangupsConversations)
self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 27))
self.menubar.setObjectName("menubar")
QHangupsConversations.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(QHangupsConversations)
self.statusbar.setObjectName("statusbar")
QHangupsConversations.setStatusBar(self.statusbar)
self.retranslateUi(QHangupsConversations)
self.conversationsTabWidget.setCurrentIndex(-1)
QtCore.QMetaObject.connectSlotsByName(QHangupsConversations)
示例3: populate
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def populate(self):
self.setFeatures(QtWidgets.QDockWidget.DockWidgetClosable)
self.setTitleBarWidget(QtWidgets.QWidget(self)) # Removes titlebar
self.sideDockTabWidget = QtWidgets.QTabWidget(self)
self.setWidget(self.sideDockTabWidget)
# This order is important
self.bookmarkModel = QtGui.QStandardItemModel(self)
self.bookmarkProxyModel = BookmarkProxyModel(self)
self.bookmarks = Bookmarks(self)
self.bookmarks.generate_bookmark_model()
if not self.parent.are_we_doing_images_only:
self.annotationModel = QtGui.QStandardItemModel(self)
self.annotations = Annotations(self)
self.annotations.generate_annotation_model()
self.searchResultsModel = QtGui.QStandardItemModel(self)
self.search = Search(self)
示例4: _initUi
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def _initUi(self):
self.setWindowTitle('配置-MongoDB')
tabWidget = QTabWidget()
self._createConnectionTab(tabWidget)
self._createCommonDaysTab(tabWidget)
self._createTicksTab(tabWidget)
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(tabWidget, 0, 0, 2, 1)
grid.addWidget(okPushButton, 0, 1)
grid.addWidget(cancelPushButton, 1, 1)
self.setLayout(grid)
示例5: _initUi
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def _initUi(self):
self.setWindowTitle('配置-賬號(實盤交易)')
self._tabWidget = QTabWidget()
self._createYhTab()
self._createThsTab()
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(self._tabWidget, 0, 0, 2, 1)
grid.addWidget(okPushButton, 0, 1)
grid.addWidget(cancelPushButton, 1, 1)
self.setLayout(grid)
示例6: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def __init__(self,passedKeywords):
super(TabLayout,self).__init__()
self.keywords = passedKeywords
self.customTab = QTabWidget()
self.news = QScrollArea()
self.scroll_widget = QWidget()
self.scroll_layout = QVBoxLayout(self.scroll_widget)
self.scroll_layout.setSpacing(20.0)
articles = news_func(self.keywords)
for article in articles:
self.myLabel = Tiles(parent="None",description = article['description'][0:100],title=article['title'],url=article['url'],urlImage=article['urlToImage'])
self.scroll_layout.addLayout(self.myLabel.tileLayout)
self.news.setWidget(self.scroll_widget)
self.customTab.addTab(self.news,"News")
示例7: _ui_tabs
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def _ui_tabs(self):
"""Returns tab widget w/ Playback, Text, MP3s, Advanced."""
use_icons = not platform.startswith('darwin')
tabs = QtWidgets.QTabWidget()
for content, icon, label in [
(self._ui_tabs_playback, 'player-time', "Playback"),
(self._ui_tabs_text, 'editclear', "Text"),
(self._ui_tabs_mp3gen, 'document-new', "MP3s"),
(self._ui_tabs_windows, 'kpersonalizer', "Windows"),
(self._ui_tabs_advanced, 'configure', "Advanced"),
]:
if use_icons:
tabs.addTab(content(), QtGui.QIcon(f'{ICONS}/{icon}.png'),
label)
else: # active tabs do not display correctly on Mac OS X w/ icons
tabs.addTab(content(), label)
tabs.currentChanged.connect(lambda: (tabs.adjustSize(),
self.adjustSize()))
return tabs
示例8: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def __init__(self, cue_class, **kwargs):
super().__init__(cue_class, **kwargs)
self.setLayout(QHBoxLayout())
self._pages = []
self.tabWidget = QTabWidget(self)
self.layout().addWidget(self.tabWidget)
for page in protocols.ProtocolsSettingsPages:
page_widget = page(cue_class, parent=self)
self.tabWidget.addTab(page_widget,
translate('SettingsPageName', page.Name))
self._pages.append(page_widget)
self.tabWidget.setCurrentIndex(0)
示例9: paintEvent
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def paintEvent(self, event):
if self.count():
QtWidgets.QTabWidget.paintEvent(self, event)
else:
painter = QtGui.QPainter(self)
rect = event.rect()
image = QtGui.QImage("images/pychemqt.png")
rectImage = QtCore.QRect(25, rect.center().y()-50, 100, 100)
painter.drawImage(rectImage, image)
txt = QtWidgets.QApplication.translate(
"pychemqt", """Welcome to pychemqt,
a software for simulating Chemical Engineering units operations,
Copyright © 2012 Juan José Gómez Romera (jjgomera)
Licenced with GPL.v3
This software is distributed in the hope that it will be useful,
but without any warranty, it is provided "as is" without warranty of any kind
You can start by creating a new project or opening an existing project.""",
None)
rect.setLeft(150)
painter.drawText(rect, QtCore.Qt.AlignVCenter, txt)
示例10: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def __init__(self):
"""
Creates and initializes the tab dialog
"""
super().__init__()
self.setWindowTitle(globals.trans.string('AreaDlg', 0))
self.setWindowIcon(GetIcon('area'))
self.tabWidget = QtWidgets.QTabWidget()
self.LoadingTab = LoadingTab()
self.TilesetsTab = TilesetsTab()
self.tabWidget.addTab(self.TilesetsTab, globals.trans.string('AreaDlg', 1))
self.tabWidget.addTab(self.LoadingTab, globals.trans.string('AreaDlg', 2))
buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
buttonBox.accepted.connect(self.accept)
buttonBox.rejected.connect(self.reject)
mainLayout = QtWidgets.QVBoxLayout()
mainLayout.addWidget(self.tabWidget)
mainLayout.addWidget(buttonBox)
self.setLayout(mainLayout)
示例11: setLang
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def setLang(self, langName):
uiList_lang_read = self.memoData['lang'][langName]
for ui_name in uiList_lang_read:
ui_element = self.uiList[ui_name]
if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
if uiList_lang_read[ui_name] != "":
ui_element.setText(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:
# uiType: QMenu, QGroupBox
if uiList_lang_read[ui_name] != "":
ui_element.setTitle(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QTabWidget]:
# uiType: QTabWidget
tabCnt = ui_element.count()
if uiList_lang_read[ui_name] != "":
tabNameList = uiList_lang_read[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != "":
ui_element.setTabText(i,tabNameList[i])
elif type(ui_element) == str:
# uiType: string for msg
if uiList_lang_read[ui_name] != "":
self.uiList[ui_name] = uiList_lang_read[ui_name]
示例12: poslistTabs
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def poslistTabs(self):
poslistsTabs = QtWidgets.QGroupBox("Position Lists:")
layout = QtWidgets.QGridLayout()
self.poslistTabWidget = QtWidgets.QTabWidget()
#elc_table = ElcTable(0,3,self.headModelWidget.glHeadModel,self)
#self.poslistTabWidget.addTab(elc_table.generateGroupBox(), "tDCS")
layout.addWidget(self.poslistTabWidget,0,0,3,0)
add_tDCS_button = QtWidgets.QPushButton("Add tDCS Poslist")
add_tDCS_button.clicked.connect(self.addTdcsPoslistTab)
layout.addWidget(add_tDCS_button,3,0)
add_TMS_button = QtWidgets.QPushButton("Add TMS Poslist")
add_TMS_button.clicked.connect(self.addTmsPoslistTab)
layout.addWidget(add_TMS_button,3,1)
copy_button = QtWidgets.QPushButton("Copy Poslist")
copy_button.clicked.connect(self.copyPoslist)
layout.addWidget(copy_button,3,2)
self.poslistTabWidget.setTabsClosable(True)
self.poslistTabWidget.tabCloseRequested.connect(self.removePoslistTab)
self.poslistTabWidget.currentChanged.connect(self.changeGlStimulators)
#self.pos
poslistsTabs.setLayout(layout)
return poslistsTabs
#Adds a tdcs-type tab to the poslist tabs
示例13: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def __init__(self, parent, tokens):
super(QWidget, self).__init__(parent)
self.layout = QVBoxLayout(self)
self.tabPlot = QTabWidget()
self.tabPlot.tab1 = QWidget()
self.tabPlot.tab2 = QWidget()
self.tabPlot.resize(300, 200)
self.tabPlot.addTab(self.tabPlot.tab1, "2D-Plot")
self.tabPlot.addTab(self.tabPlot.tab2, "3D-Plot")
self.tabPlot.tab1.setLayout(plotFigure2D(self))
self.tabPlot.tab2.setLayout(plotFigure3D(self))
self.layout.addWidget(self.tabPlot)
plot(self, tokens)
示例14: _createCommonDaysTab
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def _createCommonDaysTab(self, tabWidget):
widget = QTabWidget()
self._createWindTab(widget)
self._createTuShareTab(widget)
tabWidget.addTab(widget, "通用和日線數據")
示例15: _overlapAct
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTabWidget [as 別名]
def _overlapAct(self):
grid = self.layout()
# remove
self._dataLabel.setText('')
self._indLabel.setText('')
grid.removeWidget(self._dataLabel)
grid.removeWidget(self._dataWidget)
grid.removeWidget(self._indLabel)
grid.removeWidget(self._indWidget)
# add
self._tabWidget = QTabWidget()
self._tabWidget.addTab(self._dataWidget, '數據')
self._tabWidget.addTab(self._indWidget, '指示')
grid.addWidget(self._tabWidget, 0, 0)
grid.setRowStretch(0, 1)
grid.setRowStretch(1, 0)
grid.setRowStretch(2, 0)
grid.setRowStretch(3, 0)
# 設置Tab右鍵菜單事件
tabBar = self._tabWidget.tabBar()
tabBar.setContextMenuPolicy(Qt.CustomContextMenu)
tabBar.customContextMenuRequested.connect(self._showTabContextMenu)
# 創建TabBar菜單
self._tabBarMenu = QMenu(self)
action = QAction('平鋪', self)
action.triggered.connect(self._flatAct)
self._tabBarMenu.addAction(action)