src/mainwindow.cpp

changeset 1433
bd3a9e237ef5
parent 1432
4cc687851fbb
child 1435
b8dc3620e5db
equal deleted inserted replaced
1432:4cc687851fbb 1433:bd3a9e237ef5
755 } 755 }
756 } 756 }
757 757
758 // --------------------------------------------------------------------------------------------------------------------- 758 // ---------------------------------------------------------------------------------------------------------------------
759 // 759 //
760 void MainWindow::saveShortcuts()
761 {
762 applyToActions([&](QAction* action)
763 {
764 QString const key = "shortcut_" + action->objectName();
765
766 if (m_defaultShortcuts[action] != action->shortcut())
767 settingsObject().setValue(key, action->shortcut());
768 else
769 settingsObject().remove(key);
770 });
771 }
772
773 // ---------------------------------------------------------------------------------------------------------------------
774 //
775 void MainWindow::applyToActions(function<void(QAction*)> function) 760 void MainWindow::applyToActions(function<void(QAction*)> function)
776 { 761 {
777 for (QAction* act : findChildren<QAction*>()) 762 for (QAction* act : findChildren<QAction*>())
778 { 763 {
779 if (not act->objectName().isEmpty()) 764 if (not act->objectName().isEmpty())

mercurial