display tool tip in shortcut dialog

This commit is contained in:
Andreas Preikschat 2013-04-28 20:22:36 +02:00
parent 989b922ab9
commit 02603eaad5
2 changed files with 16 additions and 6 deletions

View File

@ -310,7 +310,7 @@ class Ui_MainWindow(object):
can_shortcuts=True, can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_online_help_clicked) category=UiStrings().Help, triggers=self.on_online_help_clicked)
self.web_site_item = create_action(main_window, u'webSiteItem', can_shortcuts=True, category=UiStrings().Help) self.web_site_item = create_action(main_window, u'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
# Some shortcuts not connected to buttons or menu entires. # Shortcuts not connected to buttons or menu entires.
self.search_shortcut_action = create_action(main_window, self.search_shortcut_action = create_action(main_window,
u'searchShortcut', can_shortcuts=True, category=UiStrings().File, u'searchShortcut', can_shortcuts=True, category=UiStrings().File,
triggers=self.on_search_shortcut_triggered) triggers=self.on_search_shortcut_triggered)
@ -438,6 +438,9 @@ class Ui_MainWindow(object):
if os.name == u'nt': if os.name == u'nt':
self.offlineHelpItem.setText(translate('OpenLP.MainWindow', '&User Guide')) self.offlineHelpItem.setText(translate('OpenLP.MainWindow', '&User Guide'))
self.on_line_help_item.setText(translate('OpenLP.MainWindow', '&Online Help')) self.on_line_help_item.setText(translate('OpenLP.MainWindow', '&Online Help'))
self.search_shortcut_action.setText(UiStrings().Search)
self.search_shortcut_action.setToolTip(
translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.'))
self.web_site_item.setText(translate('OpenLP.MainWindow', '&Web Site')) self.web_site_item.setText(translate('OpenLP.MainWindow', '&Web Site'))
for item in self.language_group.actions(): for item in self.language_group.actions():
item.setText(item.objectName()) item.setText(item.objectName())

View File

@ -129,11 +129,18 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
continue continue
item = QtGui.QTreeWidgetItem([category.name]) item = QtGui.QTreeWidgetItem([category.name])
for action in category.actions: for action in category.actions:
actionText = REMOVE_AMPERSAND.sub('', action.text()) action_text = REMOVE_AMPERSAND.sub('', action.text())
actionItem = QtGui.QTreeWidgetItem([actionText]) action_item = QtGui.QTreeWidgetItem([action_text])
actionItem.setIcon(0, action.icon()) action_item.setIcon(0, action.icon())
actionItem.setData(0, QtCore.Qt.UserRole, action) action_item.setData(0, QtCore.Qt.UserRole, action)
item.addChild(actionItem) tool_tip_text = action.toolTip()
# Only display tool tips if they are helpful.
if tool_tip_text != action_text:
# Display the tool tip in all three colums.
action_item.setToolTip(0, tool_tip_text)
action_item.setToolTip(1, tool_tip_text)
action_item.setToolTip(2, tool_tip_text)
item.addChild(action_item)
self.treeWidget.addTopLevelItem(item) self.treeWidget.addTopLevelItem(item)
item.setExpanded(True) item.setExpanded(True)
self.refreshShortcutList() self.refreshShortcutList()