# HG changeset patch # User Chris Cannam # Date 1407921085 -3600 # Node ID 9e31759254fea142072b43789db1a615d9f715f8 # Parent 3e5c8a03bcb7a87fd1b6eb7f9bc130c92f8d0906 Attempt to get rebuilt-shortcuts working on OS/X (unsuccessfully) diff -r 3e5c8a03bcb7 -r 9e31759254fe framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Wed Aug 13 09:52:46 2014 +0100 +++ b/framework/MainWindowBase.cpp Wed Aug 13 10:11:25 2014 +0100 @@ -277,9 +277,16 @@ void MainWindowBase::finaliseMenus() { + cerr << "deleting mapper " << m_menuShortcutMapper << endl; delete m_menuShortcutMapper; m_menuShortcutMapper = 0; + foreach (QShortcut *sc, m_appShortcuts) { + cerr << "deleting shortcut " << sc << endl; + delete sc; + } + m_appShortcuts.clear(); + QMenuBar *mb = menuBar(); QList menus = mb->findChildren(); foreach (QMenu *menu, menus) { @@ -349,8 +356,9 @@ QShortcut *newSc = new QShortcut(sc, a->parentWidget()); QObject::connect(newSc, SIGNAL(activated()), m_menuShortcutMapper, SLOT(map())); - cerr << "setting mapping for action " << a << ", name " << a->text() << endl; + cerr << "setting mapping for action " << a << ", name " << a->text() << " on mapper " << m_menuShortcutMapper << " through shortcut " << newSc << endl; m_menuShortcutMapper->setMapping(newSc, a); + m_appShortcuts.push_back(newSc); } } #endif @@ -359,6 +367,7 @@ void MainWindowBase::menuActionMapperInvoked(QObject *o) { + cerr << "menuActionMapperInvoked from mapper " << sender() << endl; QAction *a = qobject_cast(o); if (a && a->isEnabled()) { cerr << "about to call trigger on action " << a << ", name " << a->text() << endl; diff -r 3e5c8a03bcb7 -r 9e31759254fe framework/MainWindowBase.h --- a/framework/MainWindowBase.h Wed Aug 13 09:52:46 2014 +0100 +++ b/framework/MainWindowBase.h Wed Aug 13 10:11:25 2014 +0100 @@ -60,6 +60,8 @@ class KeyReference; class Labeller; class ModelDataTableDialog; +class QSignalMapper; +class QShortcut; /** * The base class for the SV main window. This includes everything to @@ -427,6 +429,8 @@ // shortcuts on OS/X virtual void finaliseMenus(); virtual void finaliseMenu(QMenu *); + QSignalMapper *m_menuShortcutMapper; + QList m_appShortcuts; virtual bool shouldCreateNewSessionForRDFAudio(bool *) { return true; }