mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(passwordedit): optimize event handler unregistration
Only search the vector once, and using old enough Qt API. Follow up to #3418.
This commit is contained in:
parent
279225cd2d
commit
ebc3a60e97
|
@ -42,10 +42,11 @@ void PasswordEdit::registerHandler()
|
|||
void PasswordEdit::unregisterHandler()
|
||||
{
|
||||
#ifdef ENABLE_CAPSLOCK_INDICATOR
|
||||
if (eventHandler && eventHandler->actions.contains(action))
|
||||
int idx;
|
||||
|
||||
if (eventHandler && (idx = eventHandler->actions.indexOf(action)) >= 0)
|
||||
{
|
||||
//TODO: future: use removeOne() when Qt 5.3 (Debian 8) support ends.
|
||||
eventHandler->actions.remove(eventHandler->actions.indexOf(action));
|
||||
eventHandler->actions.remove(idx);
|
||||
if (eventHandler->actions.isEmpty())
|
||||
{
|
||||
delete eventHandler;
|
||||
|
|
Loading…
Reference in New Issue
Block a user