+ fixes #0001674: Allow clearing keyboard shortcuts for actions
This commit is contained in:
parent
7e01d0128b
commit
237bf8332c
|
@ -194,6 +194,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonClear">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="buttonReset">
|
<widget class="QPushButton" name="buttonReset">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -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. */
|
/** Resets the accelerator of the selected command to the default. */
|
||||||
void DlgCustomKeyboardImp::on_buttonReset_clicked()
|
void DlgCustomKeyboardImp::on_buttonReset_clicked()
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,7 @@ protected Q_SLOTS:
|
||||||
void on_categoryBox_activated(int index);
|
void on_categoryBox_activated(int index);
|
||||||
void on_commandTreeWidget_currentItemChanged(QTreeWidgetItem*);
|
void on_commandTreeWidget_currentItemChanged(QTreeWidgetItem*);
|
||||||
void on_buttonAssign_clicked();
|
void on_buttonAssign_clicked();
|
||||||
|
void on_buttonClear_clicked();
|
||||||
void on_buttonReset_clicked();
|
void on_buttonReset_clicked();
|
||||||
void on_buttonResetAll_clicked();
|
void on_buttonResetAll_clicked();
|
||||||
void on_editShortcut_textChanged(const QString&);
|
void on_editShortcut_textChanged(const QString&);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user