本文整理汇总了Python中PyQt4.QtGui.QTabBar.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Python QTabBar.setMinimumSize方法的具体用法?Python QTabBar.setMinimumSize怎么用?Python QTabBar.setMinimumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTabBar
的用法示例。
在下文中一共展示了QTabBar.setMinimumSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImportWindow
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import setMinimumSize [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)
#.........这里部分代码省略.........
示例2: MainWindow
# 需要导入模块: from PyQt4.QtGui import QTabBar [as 别名]
# 或者: from PyQt4.QtGui.QTabBar import setMinimumSize [as 别名]
class MainWindow(QMainWindow):
def __init__(self, doc):
QMainWindow.__init__(self, None)
self.doc = doc
self.app = doc.app
self._setupUi()
# Create base elements
self.model = MainWindowModel(document=doc.model)
self.model2view = {}
self.apanel = AccountPanel(mainwindow=self)
self.tpanel = TransactionPanel(mainwindow=self)
self.mepanel = MassEditionPanel(mainwindow=self)
self.scpanel = SchedulePanel(mainwindow=self)
self.bpanel = BudgetPanel(mainwindow=self)
self.cdrpanel = CustomDateRangePanel(mainwindow=self)
self.arpanel = AccountReassignPanel(mainwindow=self)
self.expanel = ExportPanel(mainwindow=self)
self.alookup = Lookup(self, model=self.model.account_lookup)
self.clookup = Lookup(self, model=self.model.completion_lookup)
self.drsel = DateRangeSelector(mainwindow=self, view=self.dateRangeSelectorView)
self.sfield = SearchField(model=self.model.search_field, view=self.searchLineEdit)
self.recentDocuments = Recent(self.app, 'recentDocuments')
self.recentDocuments.addMenu(self.menuOpenRecent)
self.model.view = self
self.model.connect()
self._updateUndoActions()
self._bindSignals()
def _setupUi(self): # has to take place *before* base elements creation
self.setWindowTitle("moneyGuru")
self.resize(700, 580)
self.centralwidget = QtGui.QWidget(self)
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setMargin(0)
self.topBar = QtGui.QWidget(self.centralwidget)
self.horizontalLayout_2 = QHBoxLayout(self.topBar)
self.horizontalLayout_2.setContentsMargins(2, 0, 2, 0)
spacerItem = QtGui.QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.dateRangeSelectorView = DateRangeSelectorView(self.topBar)
self.dateRangeSelectorView.setMinimumSize(QSize(220, 0))
self.horizontalLayout_2.addWidget(self.dateRangeSelectorView)
spacerItem1 = QtGui.QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.searchLineEdit = SearchEdit(self.topBar)
self.searchLineEdit.setMaximumSize(QSize(240, 16777215))
self.horizontalLayout_2.addWidget(self.searchLineEdit)
self.verticalLayout.addWidget(self.topBar)
self.tabBar = QTabBar(self.centralwidget)
self.tabBar.setMinimumSize(QSize(0, 20))
self.verticalLayout.addWidget(self.tabBar)
self.mainView = QtGui.QStackedWidget(self.centralwidget)
self.verticalLayout.addWidget(self.mainView)
# Bottom buttons & status label
self.bottomBar = QtGui.QWidget(self.centralwidget)
self.horizontalLayout = QHBoxLayout(self.bottomBar)
self.horizontalLayout.setMargin(2)
self.horizontalLayout.setMargin(0)
self.newItemButton = QPushButton(self.bottomBar)
buttonSizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
buttonSizePolicy.setHorizontalStretch(0)
buttonSizePolicy.setVerticalStretch(0)
buttonSizePolicy.setHeightForWidth(self.newItemButton.sizePolicy().hasHeightForWidth())
self.newItemButton.setSizePolicy(buttonSizePolicy)
self.newItemButton.setIcon(QIcon(QPixmap(':/plus_8')))
self.horizontalLayout.addWidget(self.newItemButton)
self.deleteItemButton = QPushButton(self.bottomBar)
self.deleteItemButton.setSizePolicy(buttonSizePolicy)
self.deleteItemButton.setIcon(QIcon(QPixmap(':/minus_8')))
self.horizontalLayout.addWidget(self.deleteItemButton)
self.editItemButton = QPushButton(self.bottomBar)
self.editItemButton.setSizePolicy(buttonSizePolicy)
self.editItemButton.setIcon(QIcon(QPixmap(':/info_gray_12')))
self.horizontalLayout.addWidget(self.editItemButton)
self.horizontalLayout.addItem(horizontalSpacer(size=20))
self.graphVisibilityButton = QPushButton()
self.graphVisibilityButton.setSizePolicy(buttonSizePolicy)
self.graphVisibilityButton.setIcon(QIcon(QPixmap(':/graph_visibility_on_16')))
self.horizontalLayout.addWidget(self.graphVisibilityButton)
self.piechartVisibilityButton = QPushButton()
self.piechartVisibilityButton.setSizePolicy(buttonSizePolicy)
self.piechartVisibilityButton.setIcon(QIcon(QPixmap(':/piechart_visibility_on_16')))
self.horizontalLayout.addWidget(self.piechartVisibilityButton)
self.columnsVisibilityButton = QPushButton()
self.columnsVisibilityButton.setSizePolicy(buttonSizePolicy)
self.columnsVisibilityButton.setIcon(QIcon(QPixmap(':/columns_16')))
self.horizontalLayout.addWidget(self.columnsVisibilityButton)
self.statusLabel = QtGui.QLabel(tr("Status"))
self.statusLabel.setAlignment(Qt.AlignCenter)
self.horizontalLayout.addWidget(self.statusLabel)
self.verticalLayout.addWidget(self.bottomBar)
#.........这里部分代码省略.........