mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
ungrouped elements in group question have random sequence
This commit is contained in:
@@ -523,16 +523,21 @@ void setupGroupQuestion(GroupQuestion *question) {
|
||||
|
||||
// Ieliek nesagrupētos elementus.
|
||||
wGroupQuestion->show();
|
||||
std::vector<std::string> ungroupedElements;
|
||||
for (auto group: question->groups) {
|
||||
for (auto itemText: group.elements) {
|
||||
ungroupedElements.push_back(itemText);
|
||||
}
|
||||
}
|
||||
std::shuffle(ungroupedElements.begin(), ungroupedElements.end(), rng);
|
||||
for (auto element: ungroupedElements) {
|
||||
auto *qItem = acquireItem();
|
||||
qItem->setData(NEUTRAL, Qt::UserRole + 1);
|
||||
qItem->setCheckable(false);
|
||||
qItem->setData(QVariant(), Qt::CheckStateRole);
|
||||
qItem->setText(QString::fromStdString(itemText));
|
||||
qItem->setText(QString::fromStdString(element));
|
||||
groupItemModel->appendRow(qItem);
|
||||
}
|
||||
}
|
||||
groupItemList->update();
|
||||
|
||||
{ // Uzstāda grupu sarakstus, kur lietotājs pārliek elementus;
|
||||
|
||||
Reference in New Issue
Block a user