// Write the command set to settings. bool QsciCommandSet::writeSettings(QSettings &qs, const char *prefix) { bool rc = true; QString skey; for (int i = 0; i < cmds.count(); ++i) { QsciCommand *cmd = cmds.at(i); skey.sprintf("%s/keymap/c%d/", prefix, static_cast<int>(cmd->command())); // Write the key. qs.setValue(skey + "key", cmd->key()); // Write the alternate key. qs.setValue(skey + "alt", cmd->key()); } return rc; }
// Find the command bound to a key. QsciCommand *QsciCommandSet::boundTo(int key) const { for (int i = 0; i < cmds.count(); ++i) { QsciCommand *cmd = cmds.at(i); if (cmd->key() == key || cmd->alternateKey() == key) return cmd; } return 0; }
// Write the command set to settings. bool QsciCommandSet::writeSettings(QSettings &qs, const char *prefix) { bool rc = true; QString skey; for (int i = 0; i < cmds.count(); ++i) { QsciCommand *cmd = cmds.at(i); skey.sprintf("%s/keymap/c%d/", prefix, cmd->msgId()); // Write the key. if (!qs.writeEntry(skey + "key", cmd->key())) rc = false; // Write the alternate key. if (!qs.writeEntry(skey + "alt", cmd->alternateKey())) rc = false; } return rc; }