本文整理汇总了Python中PySide.QtGui.QTableView.setColumnHidden方法的典型用法代码示例。如果您正苦于以下问题:Python QTableView.setColumnHidden方法的具体用法?Python QTableView.setColumnHidden怎么用?Python QTableView.setColumnHidden使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTableView
的用法示例。
在下文中一共展示了QTableView.setColumnHidden方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PhotonIntensityResultWidget
# 需要导入模块: from PySide.QtGui import QTableView [as 别名]
# 或者: from PySide.QtGui.QTableView import setColumnHidden [as 别名]
class PhotonIntensityResultWidget(_SaveableResultWidget):
def _initUI(self):
# Variables
model = _PhotonIntensityResultTableModel(self.result())
# Widgets
self._table = QTableView()
self._table.setModel(model)
header = self._table.horizontalHeader()
for i in range(1, 9):
header.setResizeMode(i, QHeaderView.Stretch)
# Layouts
layout = _SaveableResultWidget._initUI(self)
layout.addWidget(self._table)
return layout
def _initToolbox(self):
toolbox = _SaveableResultWidget._initToolbox(self)
self._itm_abbrev = _PhotonIntensityResultAbbreviationToolItem(self)
toolbox.addItem(self._itm_abbrev, "Abbreviations")
itm_detector = DetectorToolItem(self)
toolbox.addItem(itm_detector, "Detector")
self._itm_options = _PhotonIntensityResultOptionsToolItem(self)
self._itm_options.stateChanged.connect(self._onOptionsChanged)
toolbox.addItem(self._itm_options, "Options")
return toolbox
def _onOptionsChanged(self):
model = self._table.model()
model.setShowUncertainty(self._itm_options.showUncertainty())
pg, cg, bg, tg = self._itm_options.showGenerated()
pe, ce, be, te = self._itm_options.showEmitted()
self._table.setColumnHidden(1, not pg)
self._table.setColumnHidden(2, not pe)
self._table.setColumnHidden(3, not cg)
self._table.setColumnHidden(4, not ce)
self._table.setColumnHidden(5, not bg)
self._table.setColumnHidden(6, not be)
self._table.setColumnHidden(7, not tg)
self._table.setColumnHidden(8, not te)
factor = self._itm_options.factor()
model.setFactor(factor)
def dump(self):
rows = []
rows.append(
[
"Transition",
"PG",
"PG unc",
"PE",
"PE unc",
"CG",
"CG unc",
"CE",
"CE unc",
"BG",
"BG unc",
"BE",
"BE unc",
"TG",
"TG unc",
"TE",
"TE unc",
]
)
result = self.result()
for transition in result:
row = [transition]
row.extend(result.intensity(transition, False, False))
row.extend(result.intensity(transition, True, False))
row.extend(result.characteristic_fluorescence(transition, False))
row.extend(result.characteristic_fluorescence(transition, True))
row.extend(result.bremsstrahlung_fluorescence(transition, False))
row.extend(result.bremsstrahlung_fluorescence(transition, True))
row.extend(result.intensity(transition, False, True))
row.extend(result.intensity(transition, True, True))
rows.append(row)
return rows