本文整理汇总了Python中PyQt4.QtGui.QTabBar.setDocumentMode方法的典型用法代码示例。如果您正苦于以下问题:Python QTabBar.setDocumentMode方法的具体用法?Python QTabBar.setDocumentMode怎么用?Python QTabBar.setDocumentMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.setDocumentMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImportWindow
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import setDocumentMode [as 别名]
class ImportWindow(QWidget):
def __init__(self, parent, doc):
QWidget.__init__(self, parent, Qt.Window)
self._setupUi()
self.doc = doc
self.model = ImportWindowModel(document=doc.model)
self.swapOptionsComboBox = ComboboxModel(model=self.model.swap_type_list, view=self.swapOptionsComboBoxView)
self.table = ImportTable(model=self.model.import_table, view=self.tableView)
self.model.view = self
self._setupColumns() # Can only be done after the model has been connected
self.tabView.tabCloseRequested.connect(self.tabCloseRequested)
self.tabView.currentChanged.connect(self.currentTabChanged)
self.targetAccountComboBox.currentIndexChanged.connect(self.targetAccountChanged)
self.importButton.clicked.connect(self.importClicked)
self.swapButton.clicked.connect(self.swapClicked)
def _setupUi(self):
self.setWindowTitle(tr("Import"))
self.resize(557, 407)
self.verticalLayout = QtGui.QVBoxLayout(self)
self.tabView = QTabBar(self)
self.tabView.setMinimumSize(QtCore.QSize(0, 20))
self.verticalLayout.addWidget(self.tabView)
self.targetAccountLayout = QtGui.QHBoxLayout()
self.targetAccountLabel = QtGui.QLabel(tr("Target Account:"))
self.targetAccountLayout.addWidget(self.targetAccountLabel)
self.targetAccountComboBox = QComboBox(self)
self.targetAccountComboBox.setMinimumSize(QtCore.QSize(150, 0))
self.targetAccountLayout.addWidget(self.targetAccountComboBox)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.targetAccountLayout.addItem(spacerItem)
self.groupBox = QGroupBox(tr("Are some fields wrong? Fix them!"))
self.gridLayout = QtGui.QGridLayout(self.groupBox)
self.swapOptionsComboBoxView = QComboBox(self.groupBox)
self.gridLayout.addWidget(self.swapOptionsComboBoxView, 0, 0, 1, 2)
self.applyToAllCheckBox = QtGui.QCheckBox(tr("Apply to all accounts"))
self.gridLayout.addWidget(self.applyToAllCheckBox, 1, 0, 1, 1)
self.swapButton = QPushButton(tr("Fix"))
self.gridLayout.addWidget(self.swapButton, 1, 1, 1, 1)
self.targetAccountLayout.addWidget(self.groupBox)
self.verticalLayout.addLayout(self.targetAccountLayout)
self.tableView = TableView(self)
self.tableView.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.tableView.setDragEnabled(True)
self.tableView.setDragDropMode(QtGui.QAbstractItemView.InternalMove)
self.tableView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.tableView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.tableView.horizontalHeader().setHighlightSections(False)
self.tableView.horizontalHeader().setMinimumSectionSize(18)
self.tableView.verticalHeader().setVisible(False)
self.tableView.verticalHeader().setDefaultSectionSize(18)
self.verticalLayout.addWidget(self.tableView)
self.horizontalLayout = QtGui.QHBoxLayout()
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.importButton = QPushButton(tr("Import"))
self.horizontalLayout.addWidget(self.importButton)
self.verticalLayout.addLayout(self.horizontalLayout)
self.tabView.setTabsClosable(True)
self.tabView.setDrawBase(False)
self.tabView.setDocumentMode(True)
self.tabView.setUsesScrollButtons(True)
def _setupColumns(self):
# Can't set widget alignment in a layout in the Designer
l = self.targetAccountLayout
l.setAlignment(self.targetAccountLabel, Qt.AlignTop)
l.setAlignment(self.targetAccountComboBox, Qt.AlignTop)
#--- Event Handlers
def currentTabChanged(self, index):
self.model.selected_pane_index = index
def importClicked(self):
self.model.import_selected_pane()
def swapClicked(self):
applyToAll = self.applyToAllCheckBox.isChecked()
self.model.perform_swap(applyToAll)
def tabCloseRequested(self, index):
self.model.close_pane(index)
self.tabView.removeTab(index)
def targetAccountChanged(self, index):
self.model.selected_target_account_index = index
self.table.updateColumnsVisibility()
#--- model --> view
def close(self):
self.hide()
def close_selected_tab(self):
self.tabView.removeTab(self.tabView.currentIndex())
def refresh_target_accounts(self):
# We disconnect the combobox because we don't want the clear() call to set the selected
# target index in the model.
self.targetAccountComboBox.currentIndexChanged.disconnect(self.targetAccountChanged)
#.........这里部分代码省略.........