本文整理汇总了Python中PySide.QtGui.QTableView.setModel方法的典型用法代码示例。如果您正苦于以下问题:Python QTableView.setModel方法的具体用法?Python QTableView.setModel怎么用?Python QTableView.setModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTableView
的用法示例。
在下文中一共展示了QTableView.setModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def __init__(self):
super(PhoneFrame, self).__init__()
self.setWindowTitle('Phone Book.')
self.name = QLineEdit()
self.number = QLineEdit()
entry = QFormLayout()
entry.addRow(QLabel('Name'), self.name)
entry.addRow(QLabel('Number'), self.number)
buttons = QHBoxLayout()
button = QPushButton('&Add')
button.clicked.connect(self._addEntry)
buttons.addWidget(button)
button = QPushButton('&Update')
button.clicked.connect(self._updateEntry)
buttons.addWidget(button)
button = QPushButton('&Delete')
button.clicked.connect(self._deleteEntry)
buttons.addWidget(button)
dataDisplay = QTableView()
dataDisplay.setModel(PhoneDataModel())
layout = QVBoxLayout()
layout.addLayout(entry)
layout.addLayout(buttons)
layout.addWidget(dataDisplay)
self.setLayout(layout)
self.show()
示例2: _addtabondemand
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def _addtabondemand(self, thread):
"""Adds a new tab for the given thread, if it doesn't exist yet.
If it does, it will be made the current tab.
@param thread Instance of FourChanThreahHeader
"""
i = thread.id_()
if not i in self._openthreads.keys():
table = QTableView(self)
table.setModel(LiveFeedModel(self))
table.setAlternatingRowColors(True)
table.setEditTriggers(QAbstractItemView.NoEditTriggers)
table.setIconSize(QSize(192, 192))
table.horizontalHeader().setVisible(False)
table.horizontalHeader().setDefaultSectionSize(192)
table.horizontalHeader().setStretchLastSection(True)
table.verticalHeader().setVisible(False)
table.verticalHeader().setDefaultSectionSize(192)
table.doubleClicked.connect(self._showlivepost)
idx = self.tabPosts.addTab(table, "/%s/%s" % (thread.forum(), i))
self._openthreads[i] = (idx, thread, table)
fct = FourChanThread(
FourChanThreadUrl(thread.url()), self._masterobserver)
fct.postadded.connect(self._updatethread)
self._masterobserver.addobserver(
FourChanThreadObserver(fct, parent=self))
fct.refresh(True)
else:
idx = self._openthreads[i][0]
self.tabPosts.setCurrentIndex(idx)
示例3: testSetModel
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def testSetModel(self):
model = VirtualList()
model._getItemCalled = False
table = QTableView()
table.setModel(model)
table.show()
self.assertFalse(model._getItemCalled)
示例4: setupTabs
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def setupTabs(self):
""" Setup the various tabs in the AddressWidget. """
groups = ["ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VW", "XYZ"]
for group in groups:
proxyModel = QSortFilterProxyModel(self)
proxyModel.setSourceModel(self.tableModel)
proxyModel.setDynamicSortFilter(True)
tableView = QTableView()
tableView.setModel(proxyModel)
tableView.setSortingEnabled(True)
tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
tableView.horizontalHeader().setStretchLastSection(True)
tableView.verticalHeader().hide()
tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
tableView.setSelectionMode(QAbstractItemView.SingleSelection)
# This here be the magic: we use the group name (e.g. "ABC") to
# build the regex for the QSortFilterProxyModel for the group's
# tab. The regex will end up looking like "^[ABC].*", only
# allowing this tab to display items where the name starts with
# "A", "B", or "C". Notice that we set it to be case-insensitive.
reFilter = "^[%s].*" % group
proxyModel.setFilterRegExp(QRegExp(reFilter, Qt.CaseInsensitive))
proxyModel.setFilterKeyColumn(0) # Filter on the "name" column
proxyModel.sort(0, Qt.AscendingOrder)
tableView.selectionModel().selectionChanged.connect(self.selectionChanged)
self.addTab(tableView, group)
示例5: MainWindow
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
class MainWindow(QWidget):
def __init__(self):
QWidget.__init__(self)
self.resize(640, 480)
vbox = QVBoxLayout()
self.setWindowTitle('TableDemo')
self.setLayout(vbox)
self.table = QTableView()
self.table.setAlternatingRowColors(True)
self.table.setSortingEnabled(True)
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
cards = [Card(u'巫医', u'战吼:恢复2点生命值。', 1, 2, 1),
Card(u'狼骑兵', u'冲锋', 3, 3, 1),
Card(u'石牙野猪', u'冲锋', 1, 1, 1),
Card(u'森金持盾卫士', u'嘲讽', 4, 3, 5),
]
cardModel = CardModel(cards)
sortModel = QSortFilterProxyModel()
sortModel.setSourceModel(cardModel)
self.table.setModel(sortModel)
vbox.addWidget(self.table)
def printItem(self, idx):
print idx.model().persons[idx.row()]
示例6: testReferenceCountingWhenDeletingReferrer
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def testReferenceCountingWhenDeletingReferrer(self):
'''Tests reference count of model object referred by deceased view object.'''
model = TestModel()
refcount1 = getrefcount(model)
view = QTableView()
view.setModel(model)
self.assertEqual(getrefcount(view.model()), refcount1 + 1)
del view
self.assertEqual(getrefcount(model), refcount1)
示例7: MainWindow
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
class MainWindow(QWidget):
def __init__(self):
super(MainWindow, self).__init__()
self.layout = QVBoxLayout(self)
self.grid = QTableView()
self.grid.setModel(TaskTableModel(TaskView()))
self.layout.addWidget(self.grid)
示例8: skillsWindow
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
class skillsWindow(QDialog):
def __init__(self, dataModel, oberTablo):
QDialog.__init__(self)
self.setWindowTitle('All Skills')
self.setWindowIcon(QIcon('elance.ico'))
self.oberTablo = oberTablo
#create & configure tablewiew
self.table_view = QTableView()
self.table_view.setModel(dataModel)
self.table_view.setSortingEnabled(True)
self.table_view.sortByColumn(1, Qt.DescendingOrder)
self.table_view.resizeColumnsToContents()
self.table_view.resizeRowsToContents()
#http://stackoverflow.com/questions/7189305/set-optimal-size-of-a-dialog-window-containing-a-tablewidget
#http://stackoverflow.com/questions/8766633/how-to-determine-the-correct-size-of-a-qtablewidget
w = 0
w += self.table_view.contentsMargins().left() +\
self.table_view.contentsMargins().right() +\
self.table_view.verticalHeader().width()
w += qApp.style().pixelMetric(QStyle.PM_ScrollBarExtent)
for i in range(len(self.table_view.model().header)):
w += self.table_view.columnWidth(i)
self.table_view.horizontalHeader().setStretchLastSection(True)
self.table_view.setMinimumWidth(w)
# create two buttons
self.findEntries = QPushButton('Find entries')
self.findEntries.clicked.connect(self.ApplyFilterToMainList)
self.cancel = QPushButton('Cancel')
self.cancel.clicked.connect(self.winClose)
self.mainLayout = QGridLayout()
self.mainLayout.addWidget(self.table_view, 0,0,1,3)
self.mainLayout.addWidget(self.findEntries, 1,0)
self.mainLayout.addWidget(self.cancel, 1,2)
self.setLayout(self.mainLayout)
self.show()
def ApplyFilterToMainList(self):
selection = self.table_view.selectionModel().selection()
skills = []
for selRange in selection:
for index in selRange.indexes():
skill = index.model().data(index, Qt.DisplayRole)
skills.append(skill)
self.oberTablo.model().emit(SIGNAL("modelAboutToBeReset()"))
self.oberTablo.model().criteria = {'Skills':skills}
self.oberTablo.model().emit(SIGNAL("modelReset()"))
self.close()
def winClose(self):
self.close()
示例9: __init__
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
database = QSqlDatabase.addDatabase('QSQLITE')
database.setDatabaseName('astatsscraper.db') # Better lookup logic needed
if not database.open():
print('Error opening database!')
model = QSqlTableModel(db=database)
model.setTable('steam_apps')
table = QTableView()
table.setEditTriggers(QAbstractItemView.NoEditTriggers)
table.setModel(model)
self.setCentralWidget(table)
table.show()
示例10: test_database_view
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def test_database_view(qtbot, session):
session.add(Person(name="Roger Milla"))
session.add(Person(name="François Biyik"))
session.add(Person(name="Salvatore Schillaci"))
session.commit()
persons = DatabaseObjectModel(Person, session)
persons.addAttributeColumn("name", "Name")
assert persons.data(ModelIndexDuck(0, 0), Qt.DisplayRole) == "Roger Milla"
view = QTableView()
view.setModel(persons)
persons.appendObject(Person(name="Claudio Cannigia"))
persons.removeObject(0)
qtbot.addWidget(view)
view.show()
示例11: setup_ui
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def setup_ui(self):
splitter = QSplitter(self)
left = QWidget(splitter)
left.setLayout(QVBoxLayout(left))
left.layout().addWidget(QLabel('QTableView', left))
tableview = QTableView(left)
tableview.setModel(TableModel(tableview))
left.layout().addWidget(tableview)
splitter.addWidget(left)
right = QWidget(splitter)
right.setLayout(QVBoxLayout(right))
right.layout().addWidget(QLabel('QTableWidget', right))
# create a table widget for DATA
tablewidget = QTableWidget(len(DATA), len(DATA[1]), right)
right.layout().addWidget(tablewidget)
splitter.addWidget(right)
self.setCentralWidget(splitter)
# add tablewidget data
self.add_data(tablewidget)
示例12: testReferenceCounting
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
def testReferenceCounting(self):
'''Tests reference count of model object referred by view objects.'''
model1 = TestModel()
refcount1 = getrefcount(model1)
view1 = QTableView()
view1.setModel(model1)
self.assertEqual(getrefcount(view1.model()), refcount1 + 1)
view2 = QTableView()
view2.setModel(model1)
self.assertEqual(getrefcount(view2.model()), refcount1 + 2)
model2 = TestModel()
view2.setModel(model2)
self.assertEqual(getrefcount(view1.model()), refcount1 + 1)
示例13: MainWindow
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
class MainWindow(QMainWindow):
def __init__(self, datta):
QMainWindow.__init__(self)
self.setWindowTitle('Project Parser')
appIcon = QIcon('search.png')
self.setWindowIcon(appIcon)
self.viewPortBL = QDesktopWidget().availableGeometry().topLeft()
self.viewPortTR = QDesktopWidget().availableGeometry().bottomRight()
self.margin = int(QDesktopWidget().availableGeometry().width()*0.1/2)
self.shirina = QDesktopWidget().availableGeometry().width() - self.margin*2
self.visota = QDesktopWidget().availableGeometry().height() - self.margin*2
self.setGeometry(self.viewPortBL.x() + self.margin, self.viewPortBL.y() + self.margin,
self.shirina, self.visota)
# statusbar
self.myStatusBar = QStatusBar()
self.setStatusBar(self.myStatusBar)
#lower long layout
self.lowerLong = QFrame()
self.detailsLabel = QLabel()
self.skillsLabel = QLabel()
self.urlLabel = QLabel()
self.locationLabel = QLabel()
self.skillsLabel.setText('skills')
self.detailsLabel.setWordWrap(True)
self.la = QVBoxLayout()
self.la.addWidget(self.detailsLabel)
self.la.addWidget(self.skillsLabel)
self.la.addWidget(self.urlLabel)
self.la.addWidget(self.locationLabel)
self.lowerLong.setLayout(self.la)
# table
self.source_model = MyTableModel(self, datta, ['Id', 'Date', 'Title'])
self.proxy_model = myTableProxy(self)
self.proxy_model.setSourceModel(self.source_model)
self.proxy_model.setDynamicSortFilter(True)
self.table_view = QTableView()
self.table_view.setModel(self.proxy_model)
self.table_view.setAlternatingRowColors(True)
self.table_view.resizeColumnsToContents()
self.table_view.resizeRowsToContents()
self.table_view.horizontalHeader().setStretchLastSection(True)
self.table_view.setSortingEnabled(True)
self.table_view.sortByColumn(2, Qt.AscendingOrder)
# events
self.selection = self.table_view.selectionModel()
self.selection.selectionChanged.connect(self.handleSelectionChanged)
#DO NOT use CreateIndex() method, use index()
index = self.proxy_model.index(0,0)
self.selection.select(index, QItemSelectionModel.Select)
self.upperLong = self.table_view
# right side widgets
self.right = QFrame()
self.la1 = QVBoxLayout()
self.btnDownload = QPushButton('Download data')
self.btnDownload.clicked.connect(self.download)
self.myButton = QPushButton('Show Skillls')
self.myButton.clicked.connect(self.showAllSkills)
self.btnSearchByWord = QPushButton('Search by word(s)')
self.btnSearchByWord.clicked.connect(self.onSearchByWord)
self.btnResetFilter= QPushButton('Discard Filter')
self.btnResetFilter.clicked.connect(self.discardFilter)
self.btnCopyURL = QPushButton('URL to Clipboard')
self.btnCopyURL.clicked.connect(self.copyToClipboard)
self.btnExit = QPushButton('Exit')
self.btnExit.clicked.connect(lambda: sys.exit())
self.dateTimeStamp = QLabel()
self.la1.addWidget(self.btnDownload)
self.la1.addSpacing(10)
self.la1.addWidget(self.myButton)
self.la1.addSpacing(10)
self.la1.addWidget(self.btnSearchByWord)
self.la1.addSpacing(10)
self.la1.addWidget(self.btnResetFilter)
self.la1.addSpacing(10)
self.la1.addWidget(self.btnCopyURL)
self.la1.addSpacing(70)
self.la1.addWidget(self.btnExit)
self.la1.addStretch(stretch=0)
self.la1.addWidget(self.dateTimeStamp)
self.right.setLayout(self.la1)
self.right.setFrameShape(QFrame.StyledPanel)
# splitters
self.horiSplit = QSplitter(Qt.Vertical)
self.horiSplit.addWidget(self.upperLong)
self.horiSplit.addWidget(self.lowerLong)
self.horiSplit.setSizes([self.visota/2, self.visota/2])
self.vertiSplit = QSplitter(Qt.Horizontal)
self.vertiSplit.addWidget(self.horiSplit)
self.vertiSplit.addWidget(self.right)
self.vertiSplit.setSizes([self.shirina*3/4, self.shirina*1/4])
self.setCentralWidget(self.vertiSplit)
self.settings = QSettings('elance.ini', QSettings.IniFormat)
self.settings.beginGroup('DATE_STAMP')
#.........这里部分代码省略.........
示例14: uiManager
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
class uiManager(QMainWindow):
def __init__(self):
super(uiManager, self).__init__()
self.setMinimumSize(900,500)
self.setWindowTitle("Manage")
self.aFileModel = FileModel() # Add files
self.sFileModel = FileModel() # Queried files
self.eFileModel = FileModel() # Editing files
self.tabWidget = QTabWidget()
self.setCentralWidget(self.tabWidget)
self.defActions()
self.addTab()
self.searchTab()
self.editTab()
self.testtab()
self.statusBar().showMessage("Hi.")
def defActions(self):
self.findAct = QAction("+", self, triggered=self.findFilesDlg)
self.dropAddTabAct = QAction("-", self, shortcut="Delete",
triggered=self.dropAddTabRows)
self.dropEditTabAct = QAction("-", self, shortcut="Delete",
triggered=self.dropEditTabRows)
def dropEditTabRows(self):
self.dropFiles(self.eFileTable, self.eFileModel)
def dropAddTabRows(self):
self.dropFiles(self.aFileTable, self.aFileModel)
def testtab(self):
self.test = QWidget()
self.tabWidget.addTab(self.test, "WORDS")
self.tabWidget.setCornerWidget(self.test)
def addTab(self):
self.aFileTable = QTableView()
self.aFileTable.setModel(self.aFileModel)
self.aFileTable.setSelectionBehavior(QAbstractItemView.SelectRows)
self.setColumnsWidths(self.aFileTable)
self.addWidget = QWidget()
vLayout = QVBoxLayout()
vLayout.addWidget(self.aFileTable)
addBtn = QToolButton()
addBtn.setDefaultAction(self.findAct)
# addBtn.clicked.connect(self.findFilesDlg)
dropBtn = QToolButton()
dropBtn.setDefaultAction(self.dropAddTabAct)
# rmvBtn.clicked.connect(self.rmvFiles)
insBtn = QPushButton("Track")
insBtn.clicked.connect(self.insert)
hLayout = QHBoxLayout()
hLayout.addWidget(addBtn)
hLayout.addWidget(dropBtn)
hLayout.addStretch(1)
hLayout.addWidget(insBtn)
vLayout.addLayout(hLayout)
self.addWidget.setLayout(vLayout)
self.tabWidget.addTab(self.addWidget, u"Add")
def searchTab(self):
# sFileModel + view tab
self.sFileTable = QTableView()
self.sFileTable.setModel(self.sFileModel)
self.sFileTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.sFileTable.setSelectionBehavior(QAbstractItemView.SelectRows)
self.setColumnsWidths(self.sFileTable)
self.searchWidget = QWidget()
# Horizontal layout
# Button, Line Edit, Button
hLayout = QHBoxLayout()
self.searchBox = QLineEdit()
#.........这里部分代码省略.........
示例15: Ui_MainWindow
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setModel [as 别名]
class Ui_MainWindow(QMainWindow):
"""Cette classe contient tous les widgets de notre application."""
defaultPalette = QPalette()
defaultPalette.setColor(QPalette.Base, QColor("#151515"))
defaultPalette.setColor(QPalette.Text, Qt.white)
def __init__(self):
super(Ui_MainWindow, self).__init__()
# initialise la GUI avec un exemple
self.text = "Ceci est un petit texte d'exemple."
# les variables sont en place, initialise la GUI
self.initUI()
# exécute l'exemple
self.orgText.setText(self.text)
self.encode_text(False)
self.logLab.setText(
u"Saisir du texte ou importer un fichier, puis pousser \n"
u"le bouton correspondant à l'opération souhaitée.")
def initUI(self):
"""Met en place les éléments de l'interface."""
# -+++++++------------------- main window -------------------+++++++- #
self.setWindowTitle(u"Encodage / Décodage de Huffman")
self.centerAndResize()
centralwidget = QWidget(self)
mainGrid = QGridLayout(centralwidget)
mainGrid.setColumnMinimumWidth(0, 450)
# -+++++++------------------ groupe analyse -----------------+++++++- #
analysGroup = QGroupBox(u"Analyse", centralwidget)
self.analysGrid = QGridLayout(analysGroup)
# ----------- groupe de la table des codes ---------- #
codeTableGroup = QGroupBox(u"Table des codes", analysGroup)
codeTableGrid = QGridLayout(codeTableGroup)
# un tableau pour les codes
self.codesTableModel = MyTableModel()
self.codesTable = QTableView(codeTableGroup)
self.codesTable.setModel(self.codesTableModel)
self.codesTable.setFont(QFont("Mono", 8))
self.codesTable.resizeColumnsToContents()
self.codesTable.setSortingEnabled(True)
codeTableGrid.addWidget(self.codesTable, 0, 0, 1, 1)
self.analysGrid.addWidget(codeTableGroup, 1, 0, 1, 1)
# ----------- label du ratio de compression ---------- #
self.ratioLab = QLabel(u"Ratio de compression: ", analysGroup)
font = QFont()
font.setBold(True)
font.setWeight(75)
font.setKerning(True)
self.ratioLab.setFont(font)
self.analysGrid.addWidget(self.ratioLab, 2, 0, 1, 1)
# -+++++++-------- groupe de la table de comparaison --------+++++++- #
self.compGroup = QGroupBox(analysGroup)
self.compGroup.setTitle(u"Comparaisons")
compGrid = QGridLayout(self.compGroup)
# un tableau pour le ratio
self.compTable = QTableWidget(self.compGroup)
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.compTable.sizePolicy().hasHeightForWidth())
self.compTable.setSizePolicy(sizePolicy)
self.compTable.setBaseSize(QSize(0, 0))
font = QFont()
font.setWeight(50)
self.compTable.setFont(font)
self.compTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.compTable.setShowGrid(True)
self.compTable.setGridStyle(Qt.SolidLine)
# lignes / colonnes
self.compTable.setColumnCount(2)
self.compTable.setRowCount(3)
self.compTable.setVerticalHeaderItem(0, QTableWidgetItem("Taille (bits)"))
self.compTable.setVerticalHeaderItem(1, QTableWidgetItem("Entropie"))
self.compTable.setVerticalHeaderItem(2, QTableWidgetItem("Taille moy. (bits)"))
for i in range(2):
self.compTable.verticalHeaderItem(i).setTextAlignment(
Qt.AlignRight)
self.compTable.setHorizontalHeaderItem(0, QTableWidgetItem("ASCII"))
self.compTable.setHorizontalHeaderItem(1, QTableWidgetItem("Huffman"))
# nom des items
self.compTabASCIIMem = QTableWidgetItem()
self.compTable.setItem(0, 0, self.compTabASCIIMem)
self.compTabASCIIEnt = QTableWidgetItem()
self.compTable.setItem(1, 0, self.compTabASCIIEnt)
self.compTabASCIIAvg = QTableWidgetItem()
self.compTable.setItem(2, 0, self.compTabASCIIAvg)
self.compTabHuffMem = QTableWidgetItem()
self.compTable.setItem(0, 1, self.compTabHuffMem)
self.compTabHuffEnt = QTableWidgetItem()
self.compTable.setItem(1, 1, self.compTabHuffEnt)
self.compTabHuffAvg = QTableWidgetItem()
self.compTable.setItem(2, 1, self.compTabHuffAvg)
# parem du tableau
self.compTable.horizontalHeader().setCascadingSectionResizes(False)
self.compTable.verticalHeader().setVisible(True)
font = QFont("Mono", 8)
self.compTable.setFont(font)
#.........这里部分代码省略.........