mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-09-24 06:45:00 -04:00
Reset and unregister global shortcut when it's not locked anymore.
This commit is contained in:
parent
fa51f7e10e
commit
d3af39a7ae
2 changed files with 11 additions and 3 deletions
|
@ -56,6 +56,14 @@ void ShortcutWidget::setShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShortcutWidget::resetShortcut()
|
||||||
|
{
|
||||||
|
m_key = static_cast<Qt::Key>(0);
|
||||||
|
m_modifiers = 0;
|
||||||
|
m_locked = false;
|
||||||
|
autoType()->unregisterGlobalShortcut();
|
||||||
|
}
|
||||||
|
|
||||||
void ShortcutWidget::keyPressEvent(QKeyEvent* event)
|
void ShortcutWidget::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
keyEvent(event);
|
keyEvent(event);
|
||||||
|
@ -106,15 +114,14 @@ void ShortcutWidget::keyEvent(QKeyEvent* event)
|
||||||
setShortcut(key, modifiers);
|
setShortcut(key, modifiers);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_locked = false;
|
resetShortcut();
|
||||||
setStyleSheet("");
|
setStyleSheet("");
|
||||||
displayShortcut(key, modifiers);
|
displayShortcut(key, modifiers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (m_locked) {
|
if (m_locked) {
|
||||||
m_locked = false;
|
resetShortcut();
|
||||||
m_key = static_cast<Qt::Key>(0);
|
|
||||||
setStyleSheet("");
|
setStyleSheet("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
void keyEvent(QKeyEvent* event);
|
void keyEvent(QKeyEvent* event);
|
||||||
void displayShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
void displayShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
||||||
|
void resetShortcut();
|
||||||
|
|
||||||
Qt::Key m_key;
|
Qt::Key m_key;
|
||||||
Qt::KeyboardModifiers m_modifiers;
|
Qt::KeyboardModifiers m_modifiers;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue