dolphin/Source/Core/DolphinQt/TAS/TASSpinBox.cpp
Pokechu22 3f6b931150 DolphinQt: Fix TAS widgets not updating with enable controller input
This regressed in 0300b44d23. Specifically, the sliders and the stick/IR widgets did not update, but the spin boxes did update.
2023-03-12 17:58:48 -07:00

32 lines
778 B
C++

// Copyright 2019 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "DolphinQt/TAS/TASSpinBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h"
TASSpinBox::TASSpinBox(QWidget* parent) : QSpinBox(parent)
{
connect(this, QOverload<int>::of(&TASSpinBox::valueChanged), this, &TASSpinBox::OnUIValueChanged);
}
int TASSpinBox::GetValue() const
{
return m_state.GetValue();
}
void TASSpinBox::OnControllerValueChanged(int new_value)
{
if (m_state.OnControllerValueChanged(new_value))
QueueOnObject(this, &TASSpinBox::ApplyControllerValueChange);
}
void TASSpinBox::OnUIValueChanged(int new_value)
{
m_state.OnUIValueChanged(new_value);
}
void TASSpinBox::ApplyControllerValueChange()
{
setValue(m_state.ApplyControllerValueChange());
}