Prompt to replace mouse shortcuts.

This commit is contained in:
leo 2016-04-30 20:07:32 +00:00
parent 638fd10beb
commit e6c6ef9490

View file

@ -674,6 +674,18 @@ void lcQPreferencesDialog::on_mouseAssign_clicked()
Modifiers |= Qt::AltModifier;
}
for (int ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
{
if (ToolIdx != ButtonIndex && options->MouseShortcuts.mShortcuts[ToolIdx].Button == Button && options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers == Modifiers)
{
if (QMessageBox::question(this, tr("Override Shortcut"), tr("This shortcut is already assigned to '%1', do you want to replace it?").arg(gToolNames[ToolIdx]), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
return;
options->MouseShortcuts.mShortcuts[ToolIdx].Button = Qt::NoButton;
options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers = Qt::NoModifier;
}
}
int ItemIndex = ui->mouseTree->indexOfTopLevelItem(Current);
options->MouseShortcuts.mShortcuts[ItemIndex].Button = Button;
options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers = Modifiers;