I'm finding I can't programmatically resize a column in a QTableView with setColumnCount().
The function does seem to work with QTreeViews though, which is weird.
I've found a workaround, using tableview.horizontalHeader().resizeSection(col, pixels), but just wondering if this a bug somewhere.
#!/usr/bin/python
from PySide.QtCore import *
from PySide.QtGui import *
import sys
app = QApplication(sys.argv)
model = QStandardItemModel()
model.setHeaderData(0, Qt.Horizontal, "Date")
model.setHeaderData(1, Qt.Horizontal, "Time")
model.setHeaderData(2, Qt.Horizontal, "Proc")
model.setItem(0, 0, QStandardItem("First"))
model.setItem(0, 1, QStandardItem("Second"))
model.setItem(0, 2, QStandardItem("Third"))
table = QTableView()
table.setModel(model)
# table.setColumnWidth(0, 150) # <--- this doesn't work!
table.horizontalHeader().resizeSection(0, 150)
vbox = QVBoxLayout()
vbox.addWidget(table)
dialog = QDialog()
dialog.setLayout(vbox)
dialog.resize(400, 400)
dialog.show()
sys.exit(app.exec_())