| 546 | } |
| 547 | |
| 548 | QTreeWidgetItem * UpdateDialog::CreateTreeItem(CountryId const & countryId, size_t posInRanking, string matchedBy, |
| 549 | QTreeWidgetItem * parent) |
| 550 | { |
| 551 | QString const text = GetNodeName(countryId); |
| 552 | auto * const item = new TreeItem(parent, QStringList(text)); |
| 553 | item->setData(KColumnIndexCountry, Qt::UserRole, QVariant(countryId.c_str())); |
| 554 | |
| 555 | auto const pos = QVariant(static_cast<qint64>(posInRanking)); |
| 556 | item->setData(KColumnIndexPositionInRanking, Qt::DisplayRole, pos); |
| 557 | |
| 558 | auto const matched = QVariant(matchedBy.c_str()); |
| 559 | item->setData(KColumnIndexMatchedBy, Qt::DisplayRole, matched); |
| 560 | |
| 561 | if (parent == nullptr) |
| 562 | m_tree->addTopLevelItem(item); |
| 563 | |
| 564 | m_treeItemByCountryId.insert(make_pair(countryId, item)); |
| 565 | |
| 566 | return item; |
| 567 | } |
| 568 | |
| 569 | vector<QTreeWidgetItem *> UpdateDialog::GetTreeItemsByCountryId(CountryId const & countryId) |
| 570 | { |