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()) |