45 @return requested data |
45 @return requested data |
46 """ |
46 """ |
47 if role == Qt.SizeHintRole: |
47 if role == Qt.SizeHintRole: |
48 fm = QFontMetrics(QFont()) |
48 fm = QFontMetrics(QFont()) |
49 height = fm.height() + fm.height() // 3 |
49 height = fm.height() + fm.height() // 3 |
50 width = fm.width( |
50 try: |
51 self.headerData(section, orientation, Qt.DisplayRole)) |
51 width = fm.horizontalAdvance( |
|
52 self.headerData(section, orientation, Qt.DisplayRole)) |
|
53 except AttributeError: |
|
54 width = fm.width( |
|
55 self.headerData(section, orientation, Qt.DisplayRole)) |
52 return QSize(width, height) |
56 return QSize(width, height) |
53 |
57 |
54 if orientation == Qt.Horizontal and role == Qt.DisplayRole: |
58 if orientation == Qt.Horizontal and role == Qt.DisplayRole: |
55 try: |
59 try: |
56 return self.__headers[section] |
60 return self.__headers[section] |