Skip to content

Commit

Permalink
Fix converting hash dictionary to random list.
Browse files Browse the repository at this point in the history
  • Loading branch information
pktiuk committed Sep 16, 2020
1 parent 298fb96 commit d82ea2d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/setnamesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ SetNamesDialog::SetNamesDialog(InputDevice *device, QWidget *parent) :
setAttribute(Qt::WA_DeleteOnClose);
this->device = device;

QList<SetJoystick*> joysList = device->getJoystick_sets().values();
for (QList<SetJoystick*>::iterator currSetJoy = joysList.begin(); currSetJoy != joysList.end(); currSetJoy++)
auto joysList = device->getJoystick_sets();

for (int i = 0; i < joysList.size(); i++)
{
int i = currSetJoy - joysList.begin();
ui->setNamesTableWidget->setItem(i, 0, new QTableWidgetItem((*currSetJoy)->getName()));
auto name = joysList[i]->getName();
ui->setNamesTableWidget->setItem(i, 0, new QTableWidgetItem(name));
}

connect(this, &SetNamesDialog::accepted, this, &SetNamesDialog::saveSetNameChanges);
Expand All @@ -66,6 +67,7 @@ void SetNamesDialog::saveSetNameChanges()
QString oldSetNameText = device->getSetJoystick(i)->getName();

if (setNameText != oldSetNameText)
qDebug() << "Set saved: "<< setNameText << " " << i;
device->getSetJoystick(i)->setName(setNameText);
}
}
Expand Down

0 comments on commit d82ea2d

Please sign in to comment.