MCPcopy Create free account
hub / github.com/baldurk/renderdoc / RegisterShortcut

Method RegisterShortcut

qrenderdoc/Windows/MainWindow.cpp:2336–2360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2334}
2335
2336void MainWindow::RegisterShortcut(const rdcstr &shortcut, QWidget *widget, ShortcutCallback callback)
2337{
2338 QKeySequence ks = QKeySequence::fromString(shortcut);
2339
2340 if(widget)
2341 {
2342 // we need to create a Qt shortcut for this widget. Even though we don't actually use the
2343 // callback, unless a shortcut exists Qt might not properly send the ShortcutOverride event to
2344 // our eventFilter - an example is on windows where Shift-F10 might go straight to a
2345 // ContextEvent. So we create a shortcut on this widget & key-sequence to force Qt to process it
2346 m_QtShortcuts.push_back(new QShortcut(ks, widget));
2347
2348 m_WidgetShortcutCallbacks[ks][widget] = callback;
2349 }
2350 else
2351 {
2352 if(m_GlobalShortcutCallbacks[ks])
2353 {
2354 qCritical() << "Assigning duplicate global shortcut for" << ks;
2355 return;
2356 }
2357
2358 m_GlobalShortcutCallbacks[ks] = callback;
2359 }
2360}
2361
2362void MainWindow::UnregisterShortcut(const rdcstr &shortcut, QWidget *widget)
2363{

Callers 5

setContextMethod · 0.80
editShaderMethod · 0.80
debugShaderMethod · 0.80
MakeExecuteActionMethod · 0.80
EventBrowserMethod · 0.80

Calls 1

push_backMethod · 0.45

Tested by 1

setContextMethod · 0.64