本文整理汇总了Python中UI.widgets.Tabla.resizeColumnsToContents方法的典型用法代码示例。如果您正苦于以下问题:Python Tabla.resizeColumnsToContents方法的具体用法?Python Tabla.resizeColumnsToContents怎么用?Python Tabla.resizeColumnsToContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI.widgets.Tabla
的用法示例。
在下文中一共展示了Tabla.resizeColumnsToContents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from UI.widgets import Tabla [as 别名]
# 或者: from UI.widgets.Tabla import resizeColumnsToContents [as 别名]
def __init__(self, ids, EoSIndex=0, parent=None):
"""Constructor"""
super(Ui_BIP, self).__init__(parent)
self.setWindowTitle(QtWidgets.QApplication.translate(
"pychemqt", "BIP (Binary interaction parameters)"))
lyt = QtWidgets.QGridLayout(self)
lyt.addWidget(QtWidgets.QLabel("EoS"), 1, 1)
self.eleccion = QtWidgets.QComboBox()
lyt.addWidget(self.eleccion, 1, 2)
lyt.addItem(QtWidgets.QSpacerItem(
0, 0, QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Fixed), 1, 3)
self.stacked = QtWidgets.QStackedWidget()
lyt.addWidget(self.stacked, 2, 1, 1, 3)
# Get component names to show in table header
names = []
for cmp in ids:
databank.execute(
"SELECT id, name FROM compuestos WHERE id==%i" % cmp)
names.append("%4i - %s" % databank.fetchone())
args = (len(ids), len(ids))
kw = {"stretch": False, "readOnly": True, "horizontalHeader": names,
"verticalHeaderLabels": names}
title = {"WILSON": "Aij", "UNIQUAC": "ΔUij", "NRTL": "Gij"}
# Iterate over the EoS available
for EoS in EoSBIP:
self.eleccion.addItem(EoS)
k = Kij(ids, EoS)
widget = QtWidgets.QWidget()
lyt2 = QtWidgets.QVBoxLayout(widget)
lyt2.addWidget(QtWidgets.QLabel(title.get(EoS, "Kij")))
table1 = Tabla(*args, **kw)
lyt2.addWidget(table1)
# Special case for NRTL with two interaction parameters matrix
if EoS == "NRTL":
lyt2.addWidget(QtWidgets.QLabel("α"))
table2 = Tabla(*args, **kw)
lyt2.addWidget(table2)
kij, aij = k
table1.setData(kij)
table2.setData(aij)
table1.resizeColumnsToContents()
table2.resizeColumnsToContents()
else:
table1.setData(k)
table1.resizeColumnsToContents()
self.stacked.addWidget(widget)
self.eleccion.currentIndexChanged.connect(self.stacked.setCurrentIndex)
button = QtWidgets.QDialogButtonBox(
QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
button.accepted.connect(self.accept)
button.rejected.connect(self.reject)
lyt.addWidget(button, 3, 1, 1, 3)
self.eleccion.setCurrentIndex(EoSIndex)