mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:20:06 +00:00
Handle held hotkeys on frame update (paintGL) rather than on key press
This commit is contained in:
parent
dcaba52db7
commit
7e99b5fb00
2 changed files with 124 additions and 79 deletions
|
|
@ -66,6 +66,10 @@ void HotkeyManager::Impl::UpdateHotkey(types::Hotkey hotkey,
|
|||
|
||||
void HotkeyManager::HandleKeyPress(QKeyEvent* ev)
|
||||
{
|
||||
logger_->trace("HandleKeyPress: {}, {}",
|
||||
ev->keyCombination().toCombined(),
|
||||
ev->isAutoRepeat());
|
||||
|
||||
for (auto& hotkey : p->hotkeys_)
|
||||
{
|
||||
if (hotkey.second.count() == 1 &&
|
||||
|
|
@ -78,7 +82,16 @@ void HotkeyManager::HandleKeyPress(QKeyEvent* ev)
|
|||
|
||||
void HotkeyManager::HandleKeyRelease(QKeyEvent* ev)
|
||||
{
|
||||
Q_UNUSED(ev);
|
||||
logger_->trace("HandleKeyRelease: {}", ev->keyCombination().toCombined());
|
||||
|
||||
for (auto& hotkey : p->hotkeys_)
|
||||
{
|
||||
if (hotkey.second.count() == 1 &&
|
||||
hotkey.second[0] == ev->keyCombination())
|
||||
{
|
||||
Q_EMIT HotkeyReleased(hotkey.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<HotkeyManager> HotkeyManager::Instance()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue