| 339 | } |
| 340 | |
| 341 | bool event(QEvent *e) |
| 342 | { |
| 343 | if (e->type() == QEvent::Shortcut) { |
| 344 | |
| 345 | QShortcutEvent *se = static_cast<QShortcutEvent *>(e); |
| 346 | if (se->isAmbiguous() && sp_actionHandles) { |
| 347 | |
| 348 | QString msg = QObject::tr ("Keyboard shortcut is ambiguous: "); |
| 349 | msg += QString (se->key ().toString ()); |
| 350 | msg += tl::to_qstring ("\n\n"); |
| 351 | msg += QObject::tr ("Targets of the that shortcut are:"); |
| 352 | msg += tl::to_qstring ("\n"); |
| 353 | |
| 354 | for (std::set<Action *>::const_iterator a = sp_actionHandles->begin (); a != sp_actionHandles->end (); ++a) { |
| 355 | if (! (*a)->qaction ()->shortcut ().isEmpty () && (*a)->qaction ()->shortcut ().matches (se->key ()) != QKeySequence::NoMatch) { |
| 356 | msg += QChar (0x2022) /*bullet*/; |
| 357 | msg += tl::to_qstring (" "); |
| 358 | msg += (*a)->qaction ()->text (); |
| 359 | msg += tl::to_qstring ("\n"); |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | QMessageBox::warning (0, QObject::tr ("Warning"), msg); |
| 364 | |
| 365 | return true; |
| 366 | |
| 367 | } |
| 368 | |
| 369 | } |
| 370 | |
| 371 | return QAction::event(e); |
| 372 | } |
| 373 | |
| 374 | private: |
| 375 | size_t m_id; |
no test coverage detected