From 7421431a1d81037bc53d5498dedbfc85ef2aa658 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Wed, 28 Oct 2020 15:58:14 +0100 Subject: [PATCH] Fix a few warnings regarding `QAbstractButton::setChecked` usage The method takes a boolean, not a `Qt::CheckState`. Since the rest of the codebase uses booleans, I didn't bother keeping the enum where it was possible (for checkboxes, one could use `setCheckState` with a `Qt::CheckState` but that's only really useful for tristate checkboxes). Note that this shouldn't change any behavior as the enum has a value of 0 for the `Unchecked` variant. --- src/platform/qt/BattleChipView.cpp | 8 ++++---- src/platform/qt/IOViewer.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platform/qt/BattleChipView.cpp b/src/platform/qt/BattleChipView.cpp index 5c9b2cb8f..83f38db9b 100644 --- a/src/platform/qt/BattleChipView.cpp +++ b/src/platform/qt/BattleChipView.cpp @@ -50,7 +50,7 @@ BattleChipView::BattleChipView(std::shared_ptr controller, Windo m_model.setScale(size); connect(m_ui.chipId, static_cast(&QSpinBox::valueChanged), m_ui.inserted, [this]() { - m_ui.inserted->setChecked(Qt::Unchecked); + m_ui.inserted->setChecked(false); }); connect(m_ui.chipName, static_cast(&QComboBox::currentIndexChanged), m_ui.chipId, [this](int id) { if (id < 0) { @@ -103,11 +103,11 @@ BattleChipView::BattleChipView(std::shared_ptr controller, Windo m_controller->attachBattleChipGate(); setFlavor(4); if (qtitle.startsWith("AGB-B4B") || qtitle.startsWith("AGB-B4W") || qtitle.startsWith("AGB-BR4") || qtitle.startsWith("AGB-BZ3")) { - m_ui.gateBattleChip->setChecked(Qt::Checked); + m_ui.gateBattleChip->setChecked(true); } else if (qtitle.startsWith("AGB-BRB") || qtitle.startsWith("AGB-BRK")) { - m_ui.gateProgress->setChecked(Qt::Checked); + m_ui.gateProgress->setChecked(true); } else if (qtitle.startsWith("AGB-BR5") || qtitle.startsWith("AGB-BR6")) { - m_ui.gateBeastLink->setChecked(Qt::Checked); + m_ui.gateBeastLink->setChecked(true); } if (!QFileInfo(GBAApp::dataDir() + "/chips.rcc").exists() && !QFileInfo(ConfigController::configDir() + "/chips.rcc").exists()) { diff --git a/src/platform/qt/IOViewer.cpp b/src/platform/qt/IOViewer.cpp index 1e04b20d1..572cb58a7 100644 --- a/src/platform/qt/IOViewer.cpp +++ b/src/platform/qt/IOViewer.cpp @@ -1080,7 +1080,7 @@ void IOViewer::updateRegister() { } for (int i = 0; i < 16; ++i) { - m_b[i]->setChecked(value & (1 << i) ? Qt::Checked : Qt::Unchecked); + m_b[i]->setChecked(value & (1 << i)); } m_value = value; emit valueChanged();