58 fm = QFontMetrics(QFont()) |
58 fm = QFontMetrics(QFont()) |
59 for section in range(self.__zoomValuesModel.columnCount()): |
59 for section in range(self.__zoomValuesModel.columnCount()): |
60 header = self.zoomValuesTable.horizontalHeader().sectionSizeHint( |
60 header = self.zoomValuesTable.horizontalHeader().sectionSizeHint( |
61 section) |
61 section) |
62 if section == 0: |
62 if section == 0: |
63 header = fm.width("extraveryveryverylongsitename") |
63 try: |
|
64 header = fm.horizontalAdvance( |
|
65 "extraveryveryverylongsitename") |
|
66 except AttributeError: |
|
67 header = fm.width( |
|
68 "extraveryveryverylongsitename") |
64 elif section == 1: |
69 elif section == 1: |
65 header = fm.width("averagelongzoomvalue") |
70 try: |
66 buffer = fm.width("mm") |
71 header = fm.horizontalAdvance("averagelongzoomvalue") |
|
72 except AttributeError: |
|
73 header = fm.width("averagelongzoomvalue") |
|
74 try: |
|
75 buffer = fm.width("mm") |
|
76 except AttributeError: |
|
77 buffer = fm.width("mm") |
67 header += buffer |
78 header += buffer |
68 self.zoomValuesTable.horizontalHeader().resizeSection( |
79 self.zoomValuesTable.horizontalHeader().resizeSection( |
69 section, header) |
80 section, header) |
70 self.zoomValuesTable.horizontalHeader().setStretchLastSection(True) |
81 self.zoomValuesTable.horizontalHeader().setStretchLastSection(True) |