comparison framework/MainWindowBase.cpp @ 393:ff43500426da

More debug
author Chris Cannam
date Wed, 13 Aug 2014 11:49:45 +0100
parents 75af0658be84
children 71b21d6e66be
comparison
equal deleted inserted replaced
392:75af0658be84 393:ff43500426da
338 m_menuShortcutMapper = new QSignalMapper(this); 338 m_menuShortcutMapper = new QSignalMapper(this);
339 connect(m_menuShortcutMapper, SIGNAL(mapped(QObject *)), 339 connect(m_menuShortcutMapper, SIGNAL(mapped(QObject *)),
340 this, SLOT(menuActionMapperInvoked(QObject *))); 340 this, SLOT(menuActionMapperInvoked(QObject *)));
341 } 341 }
342 342
343 cerr << "examining menu: " << menu << ", " << menu->title() << endl;
344 QMenu *pm = qobject_cast<QMenu *>(menu->parent());
345 if (pm) {
346 cerr << "(sub-menu of: " << pm << ", " << pm->title() << ")" << endl;
347 }
348
343 foreach (QAction *a, menu->actions()) { 349 foreach (QAction *a, menu->actions()) {
344 QWidgetList ww = a->associatedWidgets(); 350 QWidgetList ww = a->associatedWidgets();
345 bool hasButton = false; 351 bool hasButton = false;
346 foreach (QWidget *w, ww) { 352 foreach (QWidget *w, ww) {
347 if (qobject_cast<QAbstractButton *>(w)) { 353 if (qobject_cast<QAbstractButton *>(w)) {
353 QKeySequence sc = a->shortcut(); 359 QKeySequence sc = a->shortcut();
354 if (sc.count() == 1 && !(sc[0] & Qt::KeyboardModifierMask)) { 360 if (sc.count() == 1 && !(sc[0] & Qt::KeyboardModifierMask)) {
355 QShortcut *newSc = new QShortcut(sc, a->parentWidget()); 361 QShortcut *newSc = new QShortcut(sc, a->parentWidget());
356 QObject::connect(newSc, SIGNAL(activated()), 362 QObject::connect(newSc, SIGNAL(activated()),
357 m_menuShortcutMapper, SLOT(map())); 363 m_menuShortcutMapper, SLOT(map()));
358 cerr << "setting mapping for action " << a << ", name " << a->text() << " on mapper " << m_menuShortcutMapper << " through shortcut " << newSc << endl; 364 cerr << "setting mapping for action " << a << ", name " << a->text() << " on mapper " << m_menuShortcutMapper << " through shortcut " << newSc << " with key " << newSc->key().toString() << endl;
359 m_menuShortcutMapper->setMapping(newSc, a); 365 m_menuShortcutMapper->setMapping(newSc, a);
360 m_appShortcuts.push_back(newSc); 366 m_appShortcuts.push_back(newSc);
361 } 367 }
362 } 368 }
363 #endif 369 #endif