Hi,Trying to set the size of the icon displayed by a vertical header using its setIconSize() method in QTableView and QStandardItemModel framework. All attempts are unsuccessful so far.
Have attached small snippet and an PNG illustrating the issue. Any ideas about what is going wrong? Best regards, Mads -- +-----------------------------------------------------+ | Mads Ipsen | +----------------------+------------------------------+ | Gåsebæksvej 7, 4. tv | | | DK-2500 Valby | phone: +45-29716388 | | Denmark | email: [email protected] | +----------------------+------------------------------+
import sys
from PyQt4 import QtGui, QtCore
class Table(QtGui.QTableView):
def __init__(self):
QtGui.QTableView.__init__(self)
# Hook up model
self._model = QtGui.QStandardItemModel(3,3)
self.setModel(self._model)
# Add dummy data
for i in range(3):
for j in range(3):
item = QtGui.QStandardItem('(%d,%d)' % (i,j))
self._model.setItem(i,j,item)
# Set vertical header icon sizes
self.verticalHeader().setIconSize(QtCore.QSize(128,128))
# Vertical header icons
for i in range(3):
pixmap = QtGui.QPixmap('X.png')
self._model.setHeaderData(i, QtCore.Qt.Vertical, QtCore.QVariant(pixmap), QtCore.Qt.DecorationRole)
# Alt. vertical header icons - also does NOT work
# for i in range(3):
# item = QtGui.QStandardItem()
# item.setSizeHint(QtCore.QSize(128,128))
# item.setIcon(QtGui.QIcon('X.png'))
# self._model.setVerticalHeaderItem(i, item)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
table = Table()
table.show()
sys.exit(app.exec_())
<<attachment: X.png>>
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
