void Decision::setOpinions(QVariantMap newOpinions) { canonicalizeOpinions(newOpinions); if (newOpinions == opinions()) return; // Now we actually allocate space for and set the opinions auto opinionList = m_decision.initOpinions(newOpinions.size()); unsigned currentIndex = 0; while (!newOpinions.empty()) { auto builder = opinionList[currentIndex++]; auto key = newOpinions.firstKey(); builder.setContestant(key.toInt()); builder.setOpinion(newOpinions.take(key).toInt()); } emit opinionsChanged(); }