Add tooltips to tabs, so you can tell what even long titles are

This commit is contained in:
Micah Lee 2021-04-13 18:28:00 -04:00
parent 6772431220
commit 3c76f3403d
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 9 additions and 6 deletions

View File

@ -236,11 +236,9 @@ class ModeSettingsWidget(QtWidgets.QWidget):
elif self.tab_mode == None: elif self.tab_mode == None:
pass pass
else: else:
self.settings.set("general", "title", self.title_lineedit.text()) title = self.title_lineedit.text()
shortened_title = self.title_lineedit.text() self.settings.set("general", "title", title)
if len(shortened_title) > 11: self.tab.change_title.emit(self.tab.tab_id, title)
shortened_title = shortened_title[:10] + "..."
self.tab.change_title.emit(self.tab.tab_id, shortened_title)
def persistent_checkbox_clicked(self): def persistent_checkbox_clicked(self):
self.settings.set("persistent", "enabled", self.persistent_checkbox.isChecked()) self.settings.set("persistent", "enabled", self.persistent_checkbox.isChecked())

View File

@ -188,8 +188,13 @@ class TabWidget(QtWidgets.QTabWidget):
self.bring_to_front.emit() self.bring_to_front.emit()
def change_title(self, tab_id, title): def change_title(self, tab_id, title):
shortened_title = title
if len(shortened_title) > 11:
shortened_title = shortened_title[:10] + "..."
index = self.indexOf(self.tabs[tab_id]) index = self.indexOf(self.tabs[tab_id])
self.setTabText(index, title) self.setTabText(index, shortened_title)
self.setTabToolTip(index, title)
def change_icon(self, tab_id, icon_path): def change_icon(self, tab_id, icon_path):
index = self.indexOf(self.tabs[tab_id]) index = self.indexOf(self.tabs[tab_id])