Put the MainWindow in charge of handling 'global' type shortcuts

* QShortcut falls down on duplicates. It can have activatedAmbiguously
  events, but these happen in arbitrary order and the shortcuts on
  menu items just swallow the ambiguous activate so it's not useful.
* Instead we just let MainWindow pick up ShortcutOverride events and
  consult a mapping of which shortcuts to use. We can use a smarter
  selection method to choose the more 'local' shortcut if two shortcuts
  that conflict exist.
This commit is contained in:
baldurk
2017-06-08 18:23:10 +01:00
parent 085026aa91
commit 199c26adbf
7 changed files with 184 additions and 65 deletions
+2 -3
View File
@@ -217,9 +217,8 @@ void ShaderViewer::editShader(bool customShader, const QString &entryPoint, cons
m_FindState = FindState();
});
// TODO - shortcuts
QObject::connect(new QShortcut(QKeySequence(Qt::Key_S | Qt::ControlModifier), scintilla),
&QShortcut::activated, this, &ShaderViewer::on_save_clicked);
m_Ctx.GetMainWindow()->RegisterShortcut(QKeySequence(QKeySequence::Save).toString(), this,
[this]() { on_save_clicked(); });
QWidget *w = (QWidget *)scintilla;
w->setProperty("filename", f);