options players tab only show now when filled
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Syping 2020-08-25 14:07:42 +02:00
parent 6b2b18ed16
commit 2bf6bb5630
1 changed files with 22 additions and 13 deletions

View File

@ -136,24 +136,33 @@ OptionsDialog::~OptionsDialog()
void OptionsDialog::setupTreeWidget()
{
for (QString playerIDStr : profileDB->getPlayers())
{
bool ok;
int playerID = playerIDStr.toInt(&ok);
if (ok)
const QStringList players = profileDB->getPlayers();
if (players.length() != 0) {
QStringList::const_iterator it = players.constBegin();
QStringList::const_iterator end = players.constEnd();
while (it != end)
{
QString playerName = profileDB->getPlayerName(playerID);
bool ok;
int playerID = it->toInt(&ok);
if (ok)
{
QString playerName = profileDB->getPlayerName(playerID);
QStringList playerTreeViewList;
playerTreeViewList += playerIDStr;
playerTreeViewList += playerName;
QStringList playerTreeViewList;
playerTreeViewList += *it;
playerTreeViewList += playerName;
QTreeWidgetItem *playerItem = new QTreeWidgetItem(playerTreeViewList);
ui->twPlayers->addTopLevelItem(playerItem);
playerItems += playerItem;
QTreeWidgetItem *playerItem = new QTreeWidgetItem(playerTreeViewList);
ui->twPlayers->addTopLevelItem(playerItem);
playerItems += playerItem;
}
it++;
}
ui->twPlayers->sortItems(1, Qt::AscendingOrder);
}
else {
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabPlayers));
}
ui->twPlayers->sortItems(1, Qt::AscendingOrder);
}
void OptionsDialog::setupLanguageBox()