MappingButton: use BlockUserInputFilter
This commit is contained in:
parent
7d438da911
commit
c624ef43f0
|
@ -15,6 +15,7 @@
|
|||
#include "DolphinQt2/Config/Mapping/MappingCommon.h"
|
||||
#include "DolphinQt2/Config/Mapping/MappingWidget.h"
|
||||
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
|
||||
#include "DolphinQt2/QtUtils/BlockUserInputFilter.h"
|
||||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
@ -42,9 +43,7 @@ void MappingButton::OnButtonPressed()
|
|||
if (m_parent->GetDevice() == nullptr || !m_reference->IsInput())
|
||||
return;
|
||||
|
||||
if (!m_block.TestAndSet())
|
||||
return;
|
||||
|
||||
installEventFilter(BlockUserInputFilter::Instance());
|
||||
grabKeyboard();
|
||||
grabMouse();
|
||||
|
||||
|
@ -63,7 +62,7 @@ void MappingButton::OnButtonPressed()
|
|||
|
||||
releaseMouse();
|
||||
releaseKeyboard();
|
||||
m_block.Clear();
|
||||
removeEventFilter(BlockUserInputFilter::Instance());
|
||||
|
||||
if (!expr.isEmpty())
|
||||
{
|
||||
|
@ -97,22 +96,6 @@ void MappingButton::Update()
|
|||
m_parent->SaveSettings();
|
||||
}
|
||||
|
||||
bool MappingButton::event(QEvent* event)
|
||||
{
|
||||
const QEvent::Type event_type = event->type();
|
||||
// Returning 'true' means "yes, this event has been handled, don't propagate it to parent
|
||||
// widgets".
|
||||
if (m_block.IsSet() &&
|
||||
(event_type == QEvent::KeyPress || event_type == QEvent::KeyRelease ||
|
||||
event_type == QEvent::MouseButtonPress || event_type == QEvent::MouseButtonRelease ||
|
||||
event_type == QEvent::MouseButtonDblClick))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return QPushButton::event(event);
|
||||
}
|
||||
|
||||
void MappingButton::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
switch (event->button())
|
||||
|
|
|
@ -25,7 +25,6 @@ signals:
|
|||
void AdvancedPressed();
|
||||
|
||||
private:
|
||||
bool event(QEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
void OnButtonPressed();
|
||||
|
@ -34,5 +33,4 @@ private:
|
|||
|
||||
MappingWidget* m_parent;
|
||||
ControlReference* m_reference;
|
||||
Common::Flag m_block;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue