How to change QTableWidget
header's font and its content margin and spacing?
I would like to make the font for "Column 0", "Column 1" smaller and have no spacing between the name of the columns and the header edge.
from PyQt4 import QtCore, QtGui
app = QtGui.QApplication([])
columns = ['Column 0', 'Column 1', 'Column 2']
items = [['Row%s Col%s'%(row,col) for col in range(len(columns))] for row in range(100)]
view = QtGui.QTableWidget()
view.setColumnCount(len(columns))
view.setHorizontalHeaderLabels(columns)
view.setRowCount(len(items))
for row, item in enumerate(items):
for col, column_name in enumerate(item):
item = QtGui.QTableWidgetItem("%s"%column_name)
view.setItem(row, col, item)
view.setRowHeight(row, 16)
view.show()
app.exec_()