diff framework/MainWindowBase.cpp @ 391:9e31759254fe

Attempt to get rebuilt-shortcuts working on OS/X (unsuccessfully)
author Chris Cannam
date Wed, 13 Aug 2014 10:11:25 +0100
parents 3e5c8a03bcb7
children 75af0658be84
line wrap: on
line diff
--- 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<QMenu *> menus = mb->findChildren<QMenu *>();
     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<QAction *>(o);
     if (a && a->isEnabled()) {
         cerr << "about to call trigger on action " << a << ", name " << a->text() << endl;