Fix update_list: Improve connection status label updates for Wiimote list

This commit is contained in:
Barış Hamil 2026-02-14 23:03:44 +03:00
parent 4b53c173d6
commit 7a3e056395

View file

@ -286,13 +286,13 @@ void wiimote_settings_dialog::update_list()
}
else
{
// Just update connection status labels without clearing
for (usz i = 0; i < states.size(); i++)
for (usz i = 0; i < std::min(static_cast<usz>(ui->wiimoteList->count()), states.size()); i++)
{
QListWidgetItem* item = ui->wiimoteList->item(static_cast<int>(i));
if (!item) continue;
QString label = tr("Wiimote #%1").arg(i + 1);
if (!states[i].connected) label += " (" + tr("Disconnected") + ")";
if (QListWidgetItem* item = ui->wiimoteList->item(static_cast<int>(i)); item && item->text() != label)
if (item->text() != label)
{
item->setText(label);
}