Qt/MappingButton: light up when mapped key is pressed

This commit is contained in:
spycrab
2018-02-06 11:00:23 +01:00
parent 87d7c994e7
commit 220e4bcd99
3 changed files with 44 additions and 3 deletions

View File

@ -47,9 +47,13 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
group_box->setLayout(form_layout);
bool need_indicator = group->type == ControllerEmu::GroupType::Cursor ||
group->type == ControllerEmu::GroupType::Stick ||
group->type == ControllerEmu::GroupType::Tilt;
for (auto& control : group->controls)
{
auto* button = new MappingButton(this, control->control_ref.get());
auto* button = new MappingButton(this, control->control_ref.get(), !need_indicator);
button->setMinimumWidth(100);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@ -87,6 +91,9 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
m_bools.push_back(checkbox);
}
if (need_indicator)
form_layout->addRow(new MappingIndicator(group));
return group_box;
}