diff --git a/src/Gui/DlgKeyboard.ui b/src/Gui/DlgKeyboard.ui
index ddfc5ea96..e32224d09 100644
--- a/src/Gui/DlgKeyboard.ui
+++ b/src/Gui/DlgKeyboard.ui
@@ -194,6 +194,13 @@
+ -
+
+
+ Clear
+
+
+
-
diff --git a/src/Gui/DlgKeyboardImp.cpp b/src/Gui/DlgKeyboardImp.cpp
index 9c17c49e9..9ca756ff2 100644
--- a/src/Gui/DlgKeyboardImp.cpp
+++ b/src/Gui/DlgKeyboardImp.cpp
@@ -260,6 +260,43 @@ void DlgCustomKeyboardImp::on_buttonAssign_clicked()
}
}
+/** Clears the accelerator of the selected command. */
+void DlgCustomKeyboardImp::on_buttonClear_clicked()
+{
+ QTreeWidgetItem* item = commandTreeWidget->currentItem();
+ if (!item)
+ return;
+
+ QVariant data = item->data(1, Qt::UserRole);
+ QByteArray name = data.toByteArray(); // command name
+
+ CommandManager & cCmdMgr = Application::Instance->commandManager();
+ Command* cmd = cCmdMgr.getCommandByName(name.constData());
+ if (cmd && cmd->getAction()) {
+ Action* action = cmd->getAction();
+ action->setShortcut(QString());
+ accelLineEditShortcut->clear();
+ editShortcut->clear();
+
+ // update the tool tip
+ QString toolTip = QCoreApplication::translate(cmd->className(),
+ cmd->getToolTipText(), 0, QCoreApplication::UnicodeUTF8);
+ action->setToolTip(toolTip);
+
+ // update the status tip
+ QString statusTip = QCoreApplication::translate(cmd->className(),
+ cmd->getStatusTip(), 0, QCoreApplication::UnicodeUTF8);
+ if (statusTip.isEmpty())
+ statusTip = toolTip;
+ action->setStatusTip(statusTip);
+
+ ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut");
+ hGrp->SetASCII(name.constData(), accelLineEditShortcut->text().toUtf8());
+ buttonAssign->setEnabled(false);
+ buttonReset->setEnabled(true);
+ }
+}
+
/** Resets the accelerator of the selected command to the default. */
void DlgCustomKeyboardImp::on_buttonReset_clicked()
{
diff --git a/src/Gui/DlgKeyboardImp.h b/src/Gui/DlgKeyboardImp.h
index e32448fe4..94faa00e2 100644
--- a/src/Gui/DlgKeyboardImp.h
+++ b/src/Gui/DlgKeyboardImp.h
@@ -52,6 +52,7 @@ protected Q_SLOTS:
void on_categoryBox_activated(int index);
void on_commandTreeWidget_currentItemChanged(QTreeWidgetItem*);
void on_buttonAssign_clicked();
+ void on_buttonClear_clicked();
void on_buttonReset_clicked();
void on_buttonResetAll_clicked();
void on_editShortcut_textChanged(const QString&);