diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index a02041cad..9f24da96c 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -280,17 +280,18 @@ def shortcut_action(parent, name, shortcuts, function, icon=None, checked=None, """ Return a shortcut enabled action. """ + action = QtGui.QAction(parent) + action.setObjectName(name) if icon is not None: - action = icon_action(parent, name, icon, checked, category) - elif checked is not None: - action = checkable_action(parent, name, checked, category) - else: - action = base_action(parent, name, category) + action.setIcon(build_icon(icon)) + if checked is not None: + action.setCheckable(True) + action.setChecked(checked) + action.setCheckable(True) action.setShortcuts(shortcuts) action.setShortcutContext(QtCore.Qt.WindowShortcut) - # We have to save the default shortcut again, as the action's shortcut was - # set after adding the shortcut to the action list. - action.defaultShortcuts = action.shortcuts() + if category is not None: + ActionList.add_action(action, category) QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), function) return action diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 1ec2e1772..3fe27f4d9 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -144,7 +144,6 @@ class SlideController(QtGui.QWidget): self.onSlideSelectedPrevious, shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp], context=QtCore.Qt.WidgetWithChildrenShortcut) - self.previousItem.setObjectName(u'previousItem') self.nextItem = self.toolbar.addToolbarButton( translate('OpenLP.SlideController', 'Next Slide'), u':/slides/slide_next.png', @@ -152,7 +151,6 @@ class SlideController(QtGui.QWidget): self.onSlideSelectedNext, shortcuts=[QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown], context=QtCore.Qt.WidgetWithChildrenShortcut) - self.nextItem.setObjectName(u'nextItem') self.toolbar.addToolbarSeparator(u'Close Separator') if self.isLive: self.hideMenu = QtGui.QToolButton(self.toolbar) @@ -367,10 +365,14 @@ class SlideController(QtGui.QWidget): QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged) def setPreviewHotkeys(self, parent=None): + self.previousItem.setObjectName(u'previousItemPreview') + self.nextItem.setObjectName(u'nextItemPreview') ActionList.add_action(self.previousItem, u'Preview Toolbar') ActionList.add_action(self.nextItem, u'Preview Toolbar') def setLiveHotkeys(self, parent=None): + self.previousItem.setObjectName(u'previousItemLive') + self.nextItem.setObjectName(u'nextItemLive') ActionList.add_action(self.previousItem, u'Live Toolbar') ActionList.add_action(self.nextItem, u'Live Toolbar') self.previousService = shortcut_action(parent, u'previousService',