all repos — mgba @ bd9fdc502583d658842b681caa2073905b87ccf1

mGBA Game Boy Advance Emulator

Qt: Hide hat number if it's 0
Vicki Pfau vi@endrift.com
Sat, 06 Mar 2021 20:09:12 -0800
commit

bd9fdc502583d658842b681caa2073905b87ccf1

parent

b20739093faaccd9e226f484dd1217fceb1a52d4

1 files changed, 8 insertions(+), 4 deletions(-)

jump to
M src/platform/qt/KeyEditor.cppsrc/platform/qt/KeyEditor.cpp

@@ -209,18 +209,22 @@

void KeyEditor::updateButtonText() { QStringList text; if (m_hat >= 0) { + QString hatId("%0"); + if (m_hat) { + hatId += QString::number(m_hat); + } switch (m_hatDirection) { case GamepadHatEvent::UP: - text.append(QString("↑%0").arg(m_hat)); + text.append(hatId.arg("↑")); break; case GamepadHatEvent::RIGHT: - text.append(QString("→%0").arg(m_hat)); + text.append(hatId.arg("→")); break; case GamepadHatEvent::DOWN: - text.append(QString("↓%0").arg(m_hat)); + text.append(hatId.arg("↓")); break; case GamepadHatEvent::LEFT: - text.append(QString("←%0").arg(m_hat)); + text.append(hatId.arg("←")); break; default: break;