MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / onResetShortcutButtonClicked

Method onResetShortcutButtonClicked

Gui/PreferencesPanel.cpp:1617–1648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1615}
1616
1617void
1618PreferencesPanel::onResetShortcutButtonClicked()
1619{
1620 QList<QTreeWidgetItem*> items = _imp->shortcutsTree->selectedItems();
1621 if (items.size() > 1) {
1622 //we do not support selection of more than 1 item
1623 return;
1624 }
1625
1626 if ( items.empty() ) {
1627 _imp->shortcutEditor->setText( QString() );
1628 _imp->shortcutEditor->setPlaceholderText( tr("Type to set shortcut") );
1629
1630 return;
1631 }
1632
1633 QTreeWidgetItem* selection = items.front();
1634 BoundAction* action = _imp->getActionForTreeItem(selection);
1635 assert(action);
1636 action->modifiers = action->defaultModifiers;
1637 KeyBoundAction* ka = dynamic_cast<KeyBoundAction*>(action);
1638 if (ka) {
1639 ka->currentShortcut = ka->defaultShortcut;
1640 appPTR->notifyShortcutChanged(ka);
1641 }
1642 setItemShortCutText(selection, action, true);
1643
1644 QString sc, altsc;
1645 makeItemShortCutText(action, true, &sc, &altsc);
1646 _imp->shortcutEditor->setText(sc);
1647 _imp->altShortcutEditor->setText(altsc);
1648}
1649
1650void
1651PreferencesPanel::onRestoreDefaultShortcutsButtonClicked()

Callers

nothing calls this directly

Calls 8

setItemShortCutTextFunction · 0.85
makeItemShortCutTextFunction · 0.85
emptyMethod · 0.80
getActionForTreeItemMethod · 0.80
notifyShortcutChangedMethod · 0.80
QStringClass · 0.50
sizeMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected