diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2024-11-04 00:23:34 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2025-01-20 17:55:10 -0600 |
| commit | d19304dc1537b8ecba3b766972fa2e12308178e4 (patch) | |
| tree | 5aa36ecdd7d4c0a76152fb7c360d53f462c2ae0b /Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp | |
| parent | 510a688a2ae7fd127b8fb29808d8c65af9fa9214 (diff) | |
MappingIndicator: Add graphical indicators on the left of MappingButton
that don't have a large indicator.
Diffstat (limited to 'Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp index 30f0e41e86..1ac0428ca3 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp @@ -313,14 +313,29 @@ QGroupBox* MappingWidget::CreateControlsBox(const QString& name, ControllerEmu:: void MappingWidget::CreateControl(const ControllerEmu::Control* control, QFormLayout* layout, bool indicator) { - auto* button = new MappingButton(this, control->control_ref.get(), indicator); - + auto* const button = new MappingButton(this, control->control_ref.get(), indicator); button->setMinimumWidth(100); button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + const bool translate = control->translate == ControllerEmu::Translatability::Translate; const QString translated_name = translate ? tr(control->ui_name.c_str()) : QString::fromStdString(control->ui_name); - layout->addRow(translated_name, button); + + if (indicator && control->control_ref->IsInput()) + { + auto* const button_indicator = new ButtonIndicator{control->control_ref.get()}; + connect(this, &MappingWidget::Update, button_indicator, qOverload<>(&MappingIndicator::update)); + + auto* const hbox = new QHBoxLayout; + hbox->setSpacing(0); + hbox->addWidget(button_indicator); + hbox->addWidget(button); + layout->addRow(translated_name, hbox); + } + else + { + layout->addRow(translated_name, button); + } } ControllerEmu::EmulatedController* MappingWidget::GetController() const |
