62 """ |
62 """ |
63 Private method to calculate the section sizes of the horizontal header. |
63 Private method to calculate the section sizes of the horizontal header. |
64 """ |
64 """ |
65 fm = QFontMetrics(QFont()) |
65 fm = QFontMetrics(QFont()) |
66 for section in range(self.__passwordModel.columnCount()): |
66 for section in range(self.__passwordModel.columnCount()): |
67 header = self.passwordsTable.horizontalHeader()\ |
67 header = self.passwordsTable.horizontalHeader().sectionSizeHint( |
68 .sectionSizeHint(section) |
68 section) |
69 if section == 0: |
69 if section == 0: |
70 header = fm.width("averagebiglongsitename") |
70 header = fm.width("averagebiglongsitename") |
71 elif section == 1: |
71 elif section == 1: |
72 header = fm.width("averagelongusername") |
72 header = fm.width("averagelongusername") |
73 elif section == 2: |
73 elif section == 2: |
74 header = fm.width("averagelongpassword") |
74 header = fm.width("averagelongpassword") |
75 buffer = fm.width("mm") |
75 buffer = fm.width("mm") |
76 header += buffer |
76 header += buffer |
77 self.passwordsTable.horizontalHeader()\ |
77 self.passwordsTable.horizontalHeader().resizeSection( |
78 .resizeSection(section, header) |
78 section, header) |
79 self.passwordsTable.horizontalHeader().setStretchLastSection(True) |
79 self.passwordsTable.horizontalHeader().setStretchLastSection(True) |
80 |
80 |
81 @pyqtSlot() |
81 @pyqtSlot() |
82 def on_passwordsButton_clicked(self): |
82 def on_passwordsButton_clicked(self): |
83 """ |
83 """ |